diff options
Diffstat (limited to 'binfilter/bf_forms/source')
86 files changed, 0 insertions, 31136 deletions
diff --git a/binfilter/bf_forms/source/component/BaseListBox.hxx b/binfilter/bf_forms/source/component/BaseListBox.hxx deleted file mode 100644 index d045b6afbaf5..000000000000 --- a/binfilter/bf_forms/source/component/BaseListBox.hxx +++ /dev/null @@ -1,47 +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. - * - ************************************************************************/ - -#ifndef _FORMS_BASELISTBOX_HXX_ -#define _FORMS_BASELISTBOX_HXX_ - -namespace binfilter { -//......................................................................... -namespace frm -{ - -const sal_uInt16 ENTRY_NOT_FOUND = 0xFFFF; -const sal_uInt16 BOUNDCOLUMN = 0x0001; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_BASELISTBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Button.hxx b/binfilter/bf_forms/source/component/Button.hxx deleted file mode 100644 index 3b84f23a55ca..000000000000 --- a/binfilter/bf_forms/source/component/Button.hxx +++ /dev/null @@ -1,125 +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. - * - ************************************************************************/ - -#ifndef _FRM_BUTTON_HXX_ -#define _FRM_BUTTON_HXX_ - -#include "Image.hxx" - -#include <com/sun/star/awt/XButton.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OButtonModel -//================================================================== -class OButtonModel - :public OImageModel - ,public ::comphelper::OAggregationArrayUsageHelper<OButtonModel> -{ -public: - DECLARE_DEFAULT_LEAF_XTOR( OButtonModel ); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OButtonModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -// OButtonControl -//================================================================== -typedef ::cppu::ImplHelper2< ::com::sun::star::awt::XButton, - ::com::sun::star::awt::XActionListener> OButtonControl_BASE; -class OButtonControl : public OButtonControl_BASE, - public OImageControl -{ - sal_uInt32 nClickEvent; - -protected: - - // UNO Anbindung - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OButtonControl(); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OButtonControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OButtonControl, OImageControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::awt::XActionListener - virtual void SAL_CALL actionPerformed(const ::com::sun::star::awt::ActionEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::awt::XButton - virtual void SAL_CALL addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setActionCommand(const ::rtl::OUString& _rCommand) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException) - { OControl::disposing(_rSource); } -private: - DECL_LINK( OnClick, void* ); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_BUTTON_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/CheckBox.hxx b/binfilter/bf_forms/source/component/CheckBox.hxx deleted file mode 100644 index 5bcb63f28707..000000000000 --- a/binfilter/bf_forms/source/component/CheckBox.hxx +++ /dev/null @@ -1,134 +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. - * - ************************************************************************/ - -#ifndef _FORMS_CHECKBOX_HXX_ -#define _FORMS_CHECKBOX_HXX_ - -#include "FormComponent.hxx" - -#include <comphelper/propmultiplex.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ - -enum { CB_NOCHECK, CB_CHECK, CB_DONTKNOW }; - -//================================================================== -//= OCheckBoxModel -//================================================================== -class OCheckBoxModel :public OBoundControlModel - ,public OPropertyChangeListener - ,public ::comphelper::OAggregationArrayUsageHelper< OCheckBoxModel > -{ - ::rtl::OUString m_sReferenceValue; // Referenzwert zum Checken des Buttons - sal_Int16 m_nDefaultChecked; // Soll beim Reset gecheckt werden ? - sal_Bool m_bInReset; - - OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer; - -protected: - sal_Int16 getState(const ::com::sun::star::uno::Any& rValue); - - virtual void _onValueChanged(); - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual ::com::sun::star::uno::Any _getControlValue() const; - -public: - DECLARE_DEFAULT_LEAF_XTOR( OCheckBoxModel ); - - // XServiceInfo - IMPLEMENTATION_NAME(OCheckBoxModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - - // XPropertySetRef - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // OPropertyChangeListener - virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); - - // XReset - virtual void SAL_CALL reset() throw(::com::sun::star::uno::RuntimeException); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - virtual void SAL_CALL disposing(); - -protected: - virtual void _reset(); - virtual sal_Bool _commit(); - - void implConstruct(); - - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= OCheckBoxControl -//================================================================== -class OCheckBoxControl : public OBoundControl -{ -public: - OCheckBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // XServiceInfo - IMPLEMENTATION_NAME(OCheckBoxControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_CHECKBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Columns.hxx b/binfilter/bf_forms/source/component/Columns.hxx deleted file mode 100644 index 32c62bd0b222..000000000000 --- a/binfilter/bf_forms/source/component/Columns.hxx +++ /dev/null @@ -1,222 +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. - * - ************************************************************************/ - -#ifndef _FRM_COLUMNS_HXX -#define _FRM_COLUMNS_HXX - -#include <comphelper/proparrhlp.hxx> -#include <comphelper/uno3.hxx> -#include "strings.hxx" - -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/io/XObjectInputStream.hpp> -#include <cppuhelper/compbase2.hxx> -#include <comphelper/broadcasthelper.hxx> -#include "cloneable.hxx" -namespace binfilter { - - using namespace ::comphelper; - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OGridColumn -//================================================================== -typedef ::cppu::WeakAggComponentImplHelper2< ::com::sun::star::container::XChild, - ::com::sun::star::lang::XUnoTunnel > OGridColumn_BASE; -class OGridColumn :public ::comphelper::OBaseMutex - ,public OGridColumn_BASE - ,public OPropertySetAggregationHelper - ,public OCloneableAggregation -{ -protected: -// [properties] - ::com::sun::star::uno::Any m_aWidth; // column width - ::com::sun::star::uno::Any m_aAlign; // column alignment - ::com::sun::star::uno::Any m_aHidden; // column hidden? -// [properties] - - InterfaceRef m_xParent; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> - m_xAggregate; - ::rtl::OUString m_aModelName; - -// [properties] - ::rtl::OUString m_aLabel; // Name der Spalte -// [properties] - -public: - OGridColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _sModelName = ::rtl::OUString()); - virtual ~OGridColumn(); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OGridColumn_BASE); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - - static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelImplementationId(); - // XUnoTunnel - virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<sal_Int8>& _rIdentifier) throw(::com::sun::star::uno::RuntimeException); - -// XTypeProvider - virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XChild - virtual InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException){return m_xParent;} - virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::io::XPersistObject - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); - -// ::com::sun::star::beans::XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); - -// ::com::sun::star::beans::XPropertyState - virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle); - virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle); - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - - const ::rtl::OUString& getModelName() const { return m_aModelName; } - -protected: - static void clearAggregateProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps, sal_Bool bAllowDropDown); - static void setOwnProperties(::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property>& seqProps); - - //DECLARE_XCLONEABLE(); -}; - -#define DECL_COLUMN(ClassName) \ -class ClassName \ - :public OGridColumn \ - ,public OAggregationArrayUsageHelper< ClassName > \ -{ \ -public: \ - ClassName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory);\ - \ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); \ - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); \ - \ - virtual void fillProperties( \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ - ) const; \ -}; - - -#define IMPL_COLUMN(ClassName, Model, bAllowDropDown) \ -ClassName::ClassName(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) \ - :OGridColumn(_rxFactory, Model){} \ -::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> ClassName::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException)\ -{ \ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); \ - return xInfo; \ -} \ -::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \ -{ \ - return *const_cast<ClassName*>(this)->getArrayHelper(); \ -} \ -void ClassName::fillProperties( \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \ - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \ - ) const \ -{ \ - if (m_xAggregateSet.is()) \ - { \ - _rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \ - clearAggregateProperties(_rAggregateProps, bAllowDropDown); \ - setOwnProperties(_rProps); \ - } \ -} \ - -// liste der moeglichen Controls -DECLARE_CONSTASCII_USTRING(FRM_COL_TEXTFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COL_CHECKBOX); -DECLARE_CONSTASCII_USTRING(FRM_COL_COMBOBOX); -DECLARE_CONSTASCII_USTRING(FRM_COL_LISTBOX); -DECLARE_CONSTASCII_USTRING(FRM_COL_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COL_DATEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COL_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COL_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COL_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COL_FORMATTEDFIELD); - - -// column type ids -#define TYPE_CHECKBOX 0 -#define TYPE_COMBOBOX 1 -#define TYPE_CURRENCYFIELD 2 -#define TYPE_DATEFIELD 3 -#define TYPE_FORMATTEDFIELD 4 -#define TYPE_LISTBOX 5 -#define TYPE_NUMERICFIELD 6 -#define TYPE_PATTERNFIELD 7 -#define TYPE_TEXTFIELD 8 -#define TYPE_TIMEFIELD 9 - -// liste aller bekannten columns -const StringSequence& getColumnTypes(); -sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName); - -// Columns -DECL_COLUMN(TextFieldColumn) -DECL_COLUMN(PatternFieldColumn) -DECL_COLUMN(DateFieldColumn) -DECL_COLUMN(TimeFieldColumn) -DECL_COLUMN(NumericFieldColumn) -DECL_COLUMN(CurrencyFieldColumn) -DECL_COLUMN(CheckBoxColumn) -DECL_COLUMN(ComboBoxColumn) -DECL_COLUMN(ListBoxColumn) -DECL_COLUMN(FormattedFieldColumn) - - -} // namespace frm -}//end of namespace binfilter -#endif // _FRM_COLUMNS_HXX - -//......................................................................... - -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/ComboBox.hxx b/binfilter/bf_forms/source/component/ComboBox.hxx deleted file mode 100644 index 1ea72bfaefbe..000000000000 --- a/binfilter/bf_forms/source/component/ComboBox.hxx +++ /dev/null @@ -1,156 +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. - * - ************************************************************************/ - -#ifndef _FORMS_COMBOBOX_HXX_ -#define _FORMS_COMBOBOX_HXX_ - -#include "FormComponent.hxx" - -#include <com/sun/star/util/XNumberFormatter.hpp> -#include <com/sun/star/form/ListSourceType.hpp> -#include "errorbroadcaster.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -//================================================================== -// OComboBoxModel -//================================================================== -class OComboBoxModel - :public OBoundControlModel - ,public OErrorBroadcaster - ,public ::comphelper::OAggregationArrayUsageHelper< OComboBoxModel > -{ - ::com::sun::star::uno::Any m_aBoundColumn; // obsolet - ::rtl::OUString m_aListSource; // - ::rtl::OUString m_aDefaultText; // DefaultText - ::rtl::OUString m_aSaveValue; - - StringSequence m_aDesignModeStringItems; - // upon loading, in some cases we reset fill our string item list ourself. We don't want - // to lose the user's items then, so we remember them here. - - - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter> m_xFormatter; - - ::com::sun::star::form::ListSourceType m_eListSourceType; // type der list source - ::com::sun::star::util::Date m_aNullDate; - sal_Int32 m_nFormatKey; - sal_Int16 m_nFieldType; - sal_Int16 m_nKeyType; - sal_Bool m_bEmptyIsNull; // LeerString wird als NULL interpretiert - - - - static sal_Int32 nTextHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OComboBoxModel ); - - virtual void SAL_CALL disposing(); - - // OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - - // XLoadListener - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _unloaded(); - - virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - IMPLEMENTATION_NAME(OComboBoxModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // UNO - DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - - // XBoundComponent - virtual sal_Bool _commit(); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XReset - virtual void _reset(); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - void loadData(); - - DECLARE_XCLONEABLE(); -}; - -//================================================================== -// OComboBoxControl -//================================================================== - -class OComboBoxControl : public OBoundControl -{ -public: - OComboBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // XServiceInfo - IMPLEMENTATION_NAME(OComboBoxControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_COMBOBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Currency.hxx b/binfilter/bf_forms/source/component/Currency.hxx deleted file mode 100644 index 3ce339c6c500..000000000000 --- a/binfilter/bf_forms/source/component/Currency.hxx +++ /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. - * - ************************************************************************/ - -#ifndef _FORMS_CURRENCY_HXX_ -#define _FORMS_CURRENCY_HXX_ - -#include "EditBase.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= OCurrencyModel -//================================================================== -class OCurrencyModel - :public OEditBaseModel - ,public ::comphelper::OAggregationArrayUsageHelper< OCurrencyModel > -{ - ::com::sun::star::uno::Any m_aSaveValue; - - static sal_Int32 nValueHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OCurrencyModel ); - - // starform::XBoundComponent - virtual sal_Bool _commit(); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OCurrencyModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun ::star::uno::RuntimeException); - - // starform::XReset - virtual void _reset(); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); - - void implConstruct(); -}; - -//================================================================== -//= OCurrencyControl -//================================================================== -class OCurrencyControl: public OBoundControl -{ -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OCurrencyControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OCurrencyControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_CURRENCY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/DatabaseForm.hxx b/binfilter/bf_forms/source/component/DatabaseForm.hxx deleted file mode 100644 index 7b554f139888..000000000000 --- a/binfilter/bf_forms/source/component/DatabaseForm.hxx +++ /dev/null @@ -1,483 +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. - * - ************************************************************************/ - -#ifndef _FRM_DATABASEFORM_HXX_ -#define _FRM_DATABASEFORM_HXX_ - -#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> -#include <com/sun/star/form/FormSubmitMethod.hpp> -#include <com/sun/star/form/FormSubmitEncoding.hpp> -#include <com/sun/star/form/XSubmit.hpp> -#include <com/sun/star/form/XReset.hpp> -#include <com/sun/star/form/XDatabaseParameterBroadcaster.hpp> -#include <com/sun/star/sdb/XCompletedExecution.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdbcx/XDeleteRows.hpp> -#include <com/sun/star/sdbc/XResultSetUpdate.hpp> -#include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp> -#include <com/sun/star/form/NavigationBarMode.hpp> -#include <com/sun/star/form/XLoadable.hpp> -#include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/awt/XTabControllerModel.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/sdbc/XParameters.hpp> -#include <com/sun/star/sdbc/XConnection.hpp> - - -#include <tools/link.hxx> -#include "InterfaceContainer.hxx" -#include "ids.hxx" - -#include <comphelper/propmultiplex.hxx> -#include <comphelper/guarding.hxx> -#include <comphelper/proparrhlp.hxx> -#include <cppuhelper/implbase11.hxx> -#include <cppuhelper/implbase2.hxx> - -namespace com { namespace sun { namespace star { namespace sdbc { - class SQLException; -} } } } -class Timer; -class INetMIMEMessage; -namespace binfilter { - - -//typedef ::comphelper::OReusableGuard< ::osl::Mutex > ReusableMutexGuard; - -//......................................................................... -namespace frm -{ -//......................................................................... - -//======================================================================== -//= html tools -//======================================================================== - -const sal_uInt16 SUCCESSFUL_REPRESENT_TEXT = 0x0001; -const sal_uInt16 SUCCESSFUL_REPRESENT_FILE = 0x0002; - -const ::rtl::OUString ALL_COMPONENTS_GROUP_NAME = ::rtl::OUString::createFromAscii("AllComponentGroup"); - -//------------------------------------------------------------------------------ -class HtmlSuccessfulObj -{ -public: - ::rtl::OUString aName; - ::rtl::OUString aValue; - sal_uInt16 nRepresentation; - - HtmlSuccessfulObj( const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue, - sal_uInt16 _nRepresent = SUCCESSFUL_REPRESENT_TEXT ) - :aName( _rName ) - ,aValue( _rValue ) - ,nRepresentation( _nRepresent ) - { - } - - HtmlSuccessfulObj() - { - } -}; - - -DECLARE_STL_VECTOR(HtmlSuccessfulObj, HtmlSuccessfulObjList); - -//======================================================================== -class OGroupManager; -class OFormSubmitResetThread; -struct OParameterInfoImpl; -typedef ::cppu::ImplHelper11< ::com::sun::star::form::XForm, - ::com::sun::star::awt::XTabControllerModel, - ::com::sun::star::form::XLoadListener, - ::com::sun::star::sdbc::XRowSetListener, - ::com::sun::star::sdb::XRowSetApproveListener, - ::com::sun::star::form::XDatabaseParameterBroadcaster, - ::com::sun::star::sdb::XSQLErrorListener, - ::com::sun::star::sdb::XSQLErrorBroadcaster, - ::com::sun::star::form::XReset, - ::com::sun::star::form::XSubmit, - ::com::sun::star::form::XLoadable > ODatabaseForm_BASE1; - - -typedef ::cppu::ImplHelper2< ::com::sun::star::container::XNamed, - ::com::sun::star::lang::XServiceInfo> ODatabaseForm_BASE2; - -typedef ::cppu::ImplHelper7< ::com::sun::star::sdbc::XCloseable, - ::com::sun::star::sdbc::XRowSet, - ::com::sun::star::sdb::XCompletedExecution, - ::com::sun::star::sdb::XRowSetApproveBroadcaster, - ::com::sun::star::sdbc::XResultSetUpdate, - ::com::sun::star::sdbcx::XDeleteRows, - ::com::sun::star::sdbc::XParameters > ODatabaseForm_BASE3; - - -class ODatabaseForm :public OFormComponents - ,public OPropertySetAggregationHelper - ,public OPropertyChangeListener - ,public ::comphelper::OAggregationArrayUsageHelper<ODatabaseForm> - ,public ODatabaseForm_BASE1 - ,public ODatabaseForm_BASE2 - ,public ODatabaseForm_BASE3 -{ - friend class OFormSubmitResetThread; - - OImplementationIdsRef m_aHoldIdHelper; - - // listener administration - ::cppu::OInterfaceContainerHelper m_aLoadListeners; - ::cppu::OInterfaceContainerHelper m_aRowSetApproveListeners; - ::cppu::OInterfaceContainerHelper m_aRowSetListeners; - ::cppu::OInterfaceContainerHelper m_aParameterListeners; - ::cppu::OInterfaceContainerHelper m_aResetListeners; - ::cppu::OInterfaceContainerHelper m_aSubmitListeners; - ::cppu::OInterfaceContainerHelper m_aErrorListeners; - ::osl::Mutex m_aResetSafety; - ::com::sun::star::uno::Any m_aCycle; - ::com::sun::star::uno::Any m_aIgnoreResult; // set when we are a subform and our master form positioned on a new row - ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aMasterFields; - ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aDetailFields; - ::std::vector<bool> m_aParameterVisited; - - // the object doin' most of the work - an SDB-rowset - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; - // same object, interface as member because of performance reasons - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> m_xAggregateAsRowSet; - - OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer; - // Verwaltung der ControlGruppen - OGroupManager* m_pGroupManager; - OParameterInfoImpl* m_pParameterInfo; - Timer* m_pLoadTimer; - - OFormSubmitResetThread* m_pThread; - ::rtl::OUString m_sCurrentErrorContext; - // will be used as additional context information - // when an exception is catched and forwarded to the listeners - - INT32 m_nResetsPending; -// <overwritten_properties> - sal_Int32 m_nPrivileges; -// </overwritten_properties> - -// <properties> - ::rtl::OUString m_sName; - ::rtl::OUString m_aTargetURL; - ::rtl::OUString m_aTargetFrame; - ::com::sun::star::form::FormSubmitMethod m_eSubmitMethod; - ::com::sun::star::form::FormSubmitEncoding m_eSubmitEncoding; - ::com::sun::star::form::NavigationBarMode m_eNavigation; - sal_Bool m_bAllowInsert : 1; - sal_Bool m_bAllowUpdate : 1; - sal_Bool m_bAllowDelete : 1; -// </properties> - sal_Bool m_bLoaded : 1; - sal_Bool m_bSubForm : 1; - sal_Bool m_bForwardingConnection : 1; // sal_True if we're setting the ActiveConnection on the aggregate - sal_Bool m_bSharingConnection : 1; // sal_True if the connection we're using is shared with out parent - -public: - ODatabaseForm(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - ~ODatabaseForm(); - - // UNO binding - DECLARE_UNO3_AGG_DEFAULTS(ODatabaseForm, OFormComponents); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XComponent - virtual void SAL_CALL disposing(); - - // property handling - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception ); - - ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle ) - throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - void fire( sal_Int32 * pnHandles, const ::com::sun::star::uno::Any * pNewValues, const ::com::sun::star::uno::Any * pOldValues, sal_Int32 nCount, sal_Bool bVetoable ); - - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - - // com::sun::star::beans::XPropertyState - virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle); - virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle); - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const; - - // com::sun::star::sdbc::XSQLErrorBroadcaster - virtual void SAL_CALL addSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSQLErrorListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::form::XForm - // nothing to implement - - // com::sun::star::form::XReset - virtual void SAL_CALL reset() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::form::XSubmit - virtual void SAL_CALL submit(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& aControl, const ::com::sun::star::awt::MouseEvent& aMouseEvt) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addSubmitListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XSubmitListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSubmitListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XSubmitListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::container::XChild - virtual InterfaceRef SAL_CALL getParent() throw ( ::com::sun::star::uno::RuntimeException) { return OFormComponents::getParent(); } - virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw ( :: com::sun::star::lang::NoSupportException , ::com::sun::star::uno::RuntimeException); - - // com::sun::star::container::XNamed - virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setName(const ::rtl::OUString& aName) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::awt::XTabControllerModel - virtual sal_Bool SAL_CALL getGroupControl() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setGroupControl(sal_Bool _bGroupControl) throw(::com::sun::star::uno::RuntimeException) { } - virtual void SAL_CALL setControlModels(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rControls) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > > SAL_CALL getControlModels() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setGroup(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rGroup, const ::rtl::OUString& _rGroupName) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getGroupCount() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL getGroup(sal_Int32 _nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rxGroup, ::rtl::OUString& _rName) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL getGroupByName(const ::rtl::OUString& _rName, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > >& _rxGroup) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::form::XLoadListener - virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::form::XLoadable - virtual void SAL_CALL load() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unload() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reload() throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLoaded() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addLoadListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeLoadListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XCloseable - virtual void SAL_CALL close() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XRowSetListener - virtual void SAL_CALL cursorMoved(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL rowChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL rowSetChanged(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdb::XRowSetApproveListener - virtual sal_Bool SAL_CALL approveCursorMove(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL approveRowChange(const ::com::sun::star::sdb::RowChangeEvent& event) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL approveRowSetChange(const ::com::sun::star::lang::EventObject& event) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdb::XRowSetApproveBroadcaster - virtual void SAL_CALL addRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeRowSetApproveListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XRowSetApproveListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun:star::form::XDatabaseParameterBroadcaster - virtual void SAL_CALL addParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeParameterListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XDatabaseParameterListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XRowSet - virtual void SAL_CALL execute() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addRowSetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeRowSetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSetListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdb::XCompletedExecution - virtual void SAL_CALL executeWithCompletion( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& handler ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XResultSet - virtual sal_Bool SAL_CALL next() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isBeforeFirst() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isAfterLast() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isFirst() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isLast() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL beforeFirst() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL afterLast() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL first() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL last() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Int32 SAL_CALL getRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL absolute(sal_Int32 row) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL relative(sal_Int32 rows) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL previous() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL refreshRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowUpdated() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowInserted() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL rowDeleted() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual InterfaceRef SAL_CALL getStatement() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XResultSetUpdate - virtual void SAL_CALL insertRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL updateRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deleteRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL cancelRowUpdates() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL moveToInsertRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL moveToCurrentRow() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbcx::XDeleteRows - virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL deleteRows(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any>& rows) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - // com::sun::star::lang::XServiceInfo - virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::lang::XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_Static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCurrentServiceNames_Static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCompatibleServiceNames_Static(); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); - - // com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XSQLErrorListener - virtual void SAL_CALL errorOccured(const ::com::sun::star::sdb::SQLErrorEvent& aEvent) throw(::com::sun::star::uno::RuntimeException); - - // com::sun::star::sdbc::XParameters - virtual void SAL_CALL setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setByte(sal_Int32 parameterIndex, sal_Int8 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setShort(sal_Int32 parameterIndex, sal_Int16 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setInt(sal_Int32 parameterIndex, sal_Int32 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLong(sal_Int32 parameterIndex, sal_Int64 x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setFloat(sal_Int32 parameterIndex, float x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDouble(sal_Int32 parameterIndex, double x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBytes(sal_Int32 parameterIndex, const ::com::sun::star::uno::Sequence< sal_Int8 >& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDate(sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTime(sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setTimestamp(sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBinaryStream(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setCharacterStream(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream>& x, sal_Int32 length) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setObject(sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setObjectWithInfo(sal_Int32 parameterIndex, const ::com::sun::star::uno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setRef(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRef>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setBlob(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XBlob>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setClob(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setArray(sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray>& x) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL clearParameters() throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException); - - inline void submitNBC( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt ); - -protected: - virtual void implInserted( const ElementDescription* _pElement ); - virtual void implRemoved(const InterfaceRef& _rxObject); - - // OPropertyChangeListener - virtual void _propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& ) throw(::com::sun::star::uno::RuntimeException); - -private: - sal_Bool executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifies, sal_Bool bMoveToFirst = sal_True, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >()); - bool fillParameters(::osl::ResettableMutexGuard& _rClearForNotifies, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >()); - void createParameterInfo(); - bool hasValidParent() const; - // if there are no parameter infos we now that we have a complete new statement to execute - bool needStatementRebuild() const {return m_pParameterInfo == NULL;} - - // impl methods - void load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirst = sal_True, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >()) - throw(::com::sun::star::uno::RuntimeException); - void reload_impl(sal_Bool bMoveToFirst, - const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& _rxCompletionHandler = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >()) - throw(::com::sun::star::uno::RuntimeException); - void submit_impl(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt, bool _bAproveByListeners); - void reset_impl(bool _bAproveByListeners); - - sal_Bool implEnsureConnection(); - - // connection sharing - - /// stops sharing the connection with the parent - void stopSharingConnection( ); - - /// called when the connection which we share with our parent is beeing disposed - void disposingSharedConnection( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConn ); - - /// checks if we currently share our connection with our parent - sal_Bool isSharingConnection( ) const { return m_bSharingConnection; } - - /// invalidate all our parameter-related stuff - void invlidateParameters(); - - void saveInsertOnlyState( ); - void restoreInsertOnlyState( ); - - // error handling - void onError(const ::com::sun::star::sdb::SQLErrorEvent& _rEvent); - void onError(::com::sun::star::sdbc::SQLException&, const ::rtl::OUString& _rContextDescription); - - // html tools - ::rtl::OUString GetDataURLEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); - ::rtl::OUString GetDataTextEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); - ::com::sun::star::uno::Sequence<sal_Int8> GetDataMultiPartEncoded(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt, - ::rtl::OUString& rContentType); - - void AppendComponent(HtmlSuccessfulObjList& rList, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& xComponentSet, const ::rtl::OUString& rNamePrefix, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); - - void FillSuccessfulList(HtmlSuccessfulObjList& rList, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt); - - void InsertTextPart(INetMIMEMessage& rParent, const ::rtl::OUString& rName, const ::rtl::OUString& rData); - sal_Bool InsertFilePart(INetMIMEMessage& rParent, const ::rtl::OUString& rName, const ::rtl::OUString& rFileName); - void Encode(::rtl::OUString& rString) const; - - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection > getConnection(); - - DECL_LINK( OnTimeout, void* ); -}; - -inline void ODatabaseForm::submitNBC(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - submit_impl(Control, MouseEvt, sal_False); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} -#endif // _FRM_DATABASEFORM_HXX_ - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Date.hxx b/binfilter/bf_forms/source/component/Date.hxx deleted file mode 100644 index abe38fda0c3e..000000000000 --- a/binfilter/bf_forms/source/component/Date.hxx +++ /dev/null @@ -1,122 +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. - * - ************************************************************************/ - -#ifndef _FORMS_DATE_HXX_ -#define _FORMS_DATE_HXX_ - -#include "EditBase.hxx" -#include "limitedformats.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= ODateModel -//================================================================== -class ODateModel - :public OEditBaseModel - ,public OLimitedFormats - ,public ::comphelper::OAggregationArrayUsageHelper< ODateModel > -{ - ::com::sun::star::uno::Any m_aSaveValue; - sal_Bool m_bDateTimeField; - static sal_Int32 nDateHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( ODateModel ); - -// starform::XBoundComponent - virtual sal_Bool _commit(); - -// stario::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::beans::XPropertySet - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(ODateModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::beans::XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// starform::XReset - virtual void _reset( void ); - -// starform::XLoadListener - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= ODateControl -//================================================================== -class ODateControl: public OBoundControl -{ -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - ODateControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - DECLARE_UNO3_AGG_DEFAULTS(ODateControl, OBoundControl); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(ODateControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_DATE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Edit.hxx b/binfilter/bf_forms/source/component/Edit.hxx deleted file mode 100644 index 5f0f893b9dce..000000000000 --- a/binfilter/bf_forms/source/component/Edit.hxx +++ /dev/null @@ -1,174 +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. - * - ************************************************************************/ - -#ifndef _FORMS_EDIT_HXX_ -#define _FORMS_EDIT_HXX_ - -#include "EditBase.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -//================================================================== -//= OEditModel -//================================================================== -class OEditModel - :public OEditBaseModel - ,public ::comphelper::OAggregationArrayUsageHelper< OEditModel > -{ - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter> m_xFormatter; - ::rtl::OUString m_aSaveValue; - sal_Int32 m_nFormatKey; - ::com::sun::star::util::Date m_aNullDate; - sal_Int32 m_nFieldType; - sal_Int16 m_nKeyType; - sal_Bool m_bMaxTextLenModified : 1; // set to <TRUE/> when we change the MaxTextLen of the aggregate - - sal_Bool m_bWritingFormattedFake : 1; - // are we writing something which should be interpreted as formatted upon reading? - sal_Bool m_bNumericField : 1; - // are we bound to some kind of numeric field? - - static sal_Int32 nTextHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - - DECLARE_DEFAULT_LEAF_XTOR( OEditModel ); - - void enableFormattedWriteFake() { m_bWritingFormattedFake = sal_True; } - void disableFormattedWriteFake() { m_bWritingFormattedFake = sal_False; } - sal_Bool lastReadWasFormattedFake() const { return (getLastReadVersion() & PF_FAKE_FORMATTED_FIELD) != 0; } - - friend InterfaceRef SAL_CALL OEditModel_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - friend class OFormattedFieldWrapper; - friend class OFormattedModel; // temporary - -public: - virtual void SAL_CALL disposing(); - -// ::com::sun::star::form::XBoundComponent - virtual sal_Bool _commit(); - - // XPropertySet - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; -// ::com::sun::star::io::XPersistObject - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::beans::XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OEditModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::form::XLoadListener - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _unloaded(); - -// ::com::sun::star::form::XReset - virtual void _reset(); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - virtual sal_Int16 getPersistenceFlags() const; - - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= OEditControl -//================================================================== -typedef ::cppu::ImplHelper3< ::com::sun::star::awt::XFocusListener, - ::com::sun::star::awt::XKeyListener, - ::com::sun::star::form::XChangeBroadcaster > OEditControl_BASE; - -class OEditControl : public OBoundControl - ,public OEditControl_BASE -{ - ::cppu::OInterfaceContainerHelper - m_aChangeListeners; - - ::rtl::OUString m_aHtmlChangeValue; - sal_uInt32 m_nKeyEvent; - -public: - OEditControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OEditControl(); - - DECLARE_UNO3_AGG_DEFAULTS(OEditControl, OBoundControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OEditControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::form::XChangeBroadcaster - virtual void SAL_CALL addChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::awt::XFocusListener - virtual void SAL_CALL focusGained( const ::com::sun::star::awt::FocusEvent& e ) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL focusLost( const ::com::sun::star::awt::FocusEvent& e ) throw ( ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::awt::XKeyListener - virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - -private: - DECL_LINK( OnKeyPressed, void* ); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_EDIT_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/EditBase.hxx b/binfilter/bf_forms/source/component/EditBase.hxx deleted file mode 100644 index 8358418902b4..000000000000 --- a/binfilter/bf_forms/source/component/EditBase.hxx +++ /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. - * - ************************************************************************/ - -#ifndef _FORMS_EDITBASE_HXX_ -#define _FORMS_EDITBASE_HXX_ - -#include "FormComponent.hxx" - -namespace binfilter { - -// persistence flags for use with the version id -#define PF_HANDLE_COMMON_PROPS 0x8000 - // Derived classes which use their own persistence methods (read/write) and have an own - // version handling therein may want to clear this flag in getPersistenceFlags. - // If done so, this class will write an version without a call to writeCommonEditProperties. -#define PF_FAKE_FORMATTED_FIELD 0x4000 - // .... hmmm .... a fake, as the name suggests. see OFormattedFieldWrapper -#define PF_RESERVED_2 0x2000 -#define PF_RESERVED_3 0x1000 -#define PF_RESERVED_4 0x0800 -#define PF_RESERVED_5 0x0400 -#define PF_RESERVED_6 0x0200 -#define PF_RESERVED_7 0x0100 - -#define PF_SPECIAL_FLAGS 0xFF00 - -//......................................................................... -namespace frm -{ - -//================================================================== -//= OEditBaseModel -//================================================================== -class OEditBaseModel : public OBoundControlModel -{ - sal_Int16 m_nLastReadVersion; - -protected: -// [properties] fuer all Editierfelder - ::com::sun::star::uno::Any m_aDefault; - ::rtl::OUString m_aDefaultText; // default value - sal_Bool m_bEmptyIsNull : 1; // empty string will be interepreted as NULL when committing - sal_Bool m_bFilterProposal : 1; // use a list of possible value in filtermode -// [properties] - - sal_Int16 getLastReadVersion() const { return m_nLastReadVersion; } - -public: - DECLARE_DEFAULT_XTOR( OEditBaseModel ); - - // XPersistObject - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XPropertySet - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - - // XPropertyState - virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle); - virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle); - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - -protected: - // new properties common to all edit models should be handled with the following two methods - void SAL_CALL readCommonEditProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); - void SAL_CALL writeCommonEditProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); - void defaultCommonEditProperties(); - - virtual sal_Int16 getPersistenceFlags() const; - // derived classes may use this if they want this base class to write additinal version flags - // (one of the PF_.... constants). After ::read they may ask for that flags with getLastReadVersion -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_EDITBASE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/EventThread.hxx b/binfilter/bf_forms/source/component/EventThread.hxx deleted file mode 100644 index ff02f57c701f..000000000000 --- a/binfilter/bf_forms/source/component/EventThread.hxx +++ /dev/null @@ -1,127 +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. - * - ************************************************************************/ - -#ifndef _FRM_EVENT_THREAD_HXX_ -#define _FRM_EVENT_THREAD_HXX_ - -#include <com/sun/star/awt/XControl.hpp> -#include <osl/thread.hxx> - - -#include <osl/conditn.hxx> -#include <cppuhelper/component.hxx> - -#include <comphelper/stl_types.hxx> -#include <comphelper/guarding.hxx> -#include <comphelper/uno3.hxx> -namespace binfilter { - using namespace ::comphelper; - -//......................................................................... -namespace frm -{ -//......................................................................... - -// *************************************************************************************************** -// *************************************************************************************************** - -typedef ::osl::Thread OComponentEventThread_TBASE; -class OComponentEventThread - :public OComponentEventThread_TBASE - ,public ::com::sun::star::lang::XEventListener - ,public ::cppu::OWeakObject -{ - DECLARE_STL_VECTOR(::com::sun::star::lang::EventObject*, ThreadEvents); - DECLARE_STL_VECTOR(::com::sun::star::uno::Reference< ::com::sun::star::uno::XAdapter> , ThreadObjects); - DECLARE_STL_VECTOR(sal_Bool, ThreadBools); - - ::osl::Mutex m_aMutex; - ::osl::Condition m_aCond; // Queue gefuellt? - ThreadEvents m_aEvents; // Event-Queue - ThreadObjects m_aControls; // Control fuer Submit - ThreadBools m_aFlags; // Flags fuer Submit/Reset - - ::cppu::OComponentHelper* m_pCompImpl; // Implementierung des Controls - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xComp; // ::com::sun::star::lang::XComponent des Controls - -protected: - - // XThread - virtual void SAL_CALL run(); - - virtual void SAL_CALL kill(); - virtual void SAL_CALL onTerminated(); - - // Die folgende Methode wird gerufen um das Event unter Beruecksichtigung - // seines Typs zu duplizieren. - virtual ::com::sun::star::lang::EventObject* cloneEvent(const ::com::sun::star::lang::EventObject* _pEvt) const = 0; - - // Ein Event bearbeiten. Der Mutex ist dabei nicht gelockt, pCompImpl - // bleibt aber in jedem Fall gueltig. Bei pEvt kann es sich auch um - // einen abgeleiteten Typ handeln, naemlich den, den cloneEvent - // zurueckgibt. rControl ist nur gesetzt, wenn beim addEvent ein - // Control uebergeben wurde. Da das Control nur als WeakRef gehalten - // wird kann es auch zwischenzeitlich verschwinden. - virtual void processEvent( ::cppu::OComponentHelper* _pCompImpl, - const ::com::sun::star::lang::EventObject* _pEvt, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& _rControl, - sal_Bool _bFlag) = 0; - -public: - - // UNO Anbindung - DECLARE_UNO3_DEFAULTS(OComponentEventThread, OWeakObject); - virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException); - - OComponentEventThread(::cppu::OComponentHelper* pCompImpl); - virtual ~OComponentEventThread(); - - void addEvent( const ::com::sun::star::lang::EventObject* _pEvt, sal_Bool bFlag = sal_False ); - void addEvent( const ::com::sun::star::lang::EventObject* _pEvt, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>& rControl, - sal_Bool bFlag = sal_False ); - - // ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource ) throw (::com::sun::star::uno::RuntimeException); - -/* resolve ambiguity : both OWeakObject and OObject have these memory operators */ - void * SAL_CALL operator new( size_t size ) throw() { return osl::Thread::operator new(size); } - void SAL_CALL operator delete( void * p ) throw() { osl::Thread::operator delete(p); } - -private: - void implStarted( ); - void implTerminated( ); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_EVENT_THREAD_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/File.hxx b/binfilter/bf_forms/source/component/File.hxx deleted file mode 100644 index 875bf055b2c7..000000000000 --- a/binfilter/bf_forms/source/component/File.hxx +++ /dev/null @@ -1,107 +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. - * - ************************************************************************/ - -#ifndef _FORMS_FILE_HXX_ -#define _FORMS_FILE_HXX_ - -#include "FormComponent.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OFileControlModel -//================================================================== -class OFileControlModel - :public OControlModel - ,public ::com::sun::star::form::XReset - ,public ::comphelper::OAggregationArrayUsageHelper< OFileControlModel > -{ - ::cppu::OInterfaceContainerHelper m_aResetListeners; - ::rtl::OUString m_sDefaultValue; - -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OFileControlModel ); - - DECLARE_UNO3_AGG_DEFAULTS(OFileControlModel, OControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OFileControlModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - -// ::com::sun::star::beans::XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com ::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com ::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::form::XReset - virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - virtual void _reset(); - - DECLARE_XCLONEABLE(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_FILE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Filter.hxx b/binfilter/bf_forms/source/component/Filter.hxx deleted file mode 100644 index 5d8ba2ea9837..000000000000 --- a/binfilter/bf_forms/source/component/Filter.hxx +++ /dev/null @@ -1,160 +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. - * - ************************************************************************/ - -#ifndef FORMS_COMPONENT_FILTER_HXX -#define FORMS_COMPONENT_FILTER_HXX - -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/form/XBoundComponent.hpp> -#include <com/sun/star/awt/XTextComponent.hpp> -#include <com/sun/star/sdb/SQLContext.hpp> - -#include <toolkit/controls/unocontrol.hxx> - - -#include <cppuhelper/implbase5.hxx> - -#include <comphelper/uno3.hxx> -#include <connectivity/sqlparse.hxx> - -#include <bf_svx/ParseContext.hxx> -class Window; -namespace binfilter { - - -//......................................................................... -namespace frm -{ -//......................................................................... - - //===================================================================== - // OFilterControl - //===================================================================== - typedef ::cppu::ImplHelper5 < ::com::sun::star::awt::XTextComponent - , ::com::sun::star::awt::XFocusListener - , ::com::sun::star::awt::XItemListener - , ::com::sun::star::form::XBoundComponent - , ::com::sun::star::lang::XInitialization - > OFilterControl_BASE; - - class OFilterControl :public UnoControl - ,public OFilterControl_BASE - ,public ::binfilter::svxform::OParseContextClient//STRIP008 ,public ::svxform::OParseContextClient - { - TextListenerMultiplexer m_aTextListeners; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xORB; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData > m_xMetaData; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xMessageParent; - - ::rtl::OUString m_aText; - ::connectivity::OSQLParser m_aParser; - sal_Int16 m_nControlClass; // which kind of control do we use? - sal_Bool m_bFilterList : 1; - sal_Bool m_bMultiLine : 1; - sal_Bool m_bFilterListFilled : 1; - - private: -// OFilterControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - - void implInitFilterList(); - - public: - OFilterControl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB ); - - DECLARE_UNO3_AGG_DEFAULTS(OFilterControl,OWeakAggObject); - ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - - static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId(); - sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 > & rId ); - - virtual ::rtl::OUString GetComponentServiceName(); - virtual void SAL_CALL createPeer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit > & rxToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > & rParentPeer ) throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::lang::XComponent - virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::awt::XTextComponent - virtual void SAL_CALL addTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL removeTextListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener > & l ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setText( const ::rtl::OUString& aText ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::rtl::OUString SAL_CALL getText() throw( ::com::sun::star::uno::RuntimeException ); - virtual ::rtl::OUString SAL_CALL getSelectedText() throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw( ::com::sun::star::uno::RuntimeException ); - virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Bool SAL_CALL isEditable() throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setEditable( sal_Bool bEditable ) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL setMaxTextLen( sal_Int16 nLength ) throw( ::com::sun::star::uno::RuntimeException ); - virtual sal_Int16 SAL_CALL getMaxTextLen() throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::form::XBoundComponent - virtual void SAL_CALL addUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener > & l) throw( ::com::sun::star::uno::RuntimeException ) {} - virtual void SAL_CALL removeUpdateListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener > & l) throw( ::com::sun::star::uno::RuntimeException ) {} - virtual sal_Bool SAL_CALL commit() throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::awt::XFocusListener - virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ); - virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& e) throw( ::com::sun::star::uno::RuntimeException ){} - - // ::com::sun::star::awt::XItemListener - virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException ); - - // ::com::sun::star::util::XInitialization - virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - - // com::sun::star::lang::XServiceInfo - static version - static ::rtl::OUString SAL_CALL getImplementationName_Static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(); - static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getCurrentServiceNames_Static(); - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory ); - - protected: - virtual void PrepareWindowDescriptor( ::com::sun::star::awt::WindowDescriptor& rDesc ); - virtual void ImplSetPeerProperty( const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rVal ); - - sal_Bool ensureInitialized( ); - }; -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // FORMS_COMPONENT_FILTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/FixedText.hxx b/binfilter/bf_forms/source/component/FixedText.hxx deleted file mode 100644 index b83727378d3b..000000000000 --- a/binfilter/bf_forms/source/component/FixedText.hxx +++ /dev/null @@ -1,82 +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. - * - ************************************************************************/ - -#ifndef _FORMS_FIXEDTEXT_HXX_ -#define _FORMS_FIXEDTEXT_HXX_ - -#include "FormComponent.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -//================================================================== -// OFixedTextModel -//================================================================== -class OFixedTextModel - :public OControlModel - ,public ::comphelper::OAggregationArrayUsageHelper< OFixedTextModel > -{ -public: - DECLARE_DEFAULT_LEAF_XTOR( OFixedTextModel ); - -// XPropertySetRef - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// XServiceInfo - IMPLEMENTATION_NAME(OFixedTextModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - -// XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_FIXEDTEXT_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/FormComponent.hxx b/binfilter/bf_forms/source/component/FormComponent.hxx deleted file mode 100644 index 1afdfc339bbd..000000000000 --- a/binfilter/bf_forms/source/component/FormComponent.hxx +++ /dev/null @@ -1,496 +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. - * - ************************************************************************/ - -#ifndef _FORMS_FORMCOMPONENT_HXX_ -#define _FORMS_FORMCOMPONENT_HXX_ - -#include <cppuhelper/component.hxx> -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/implbase5.hxx> -#include <com/sun/star/awt/XControl.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/form/XBoundControl.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/form/XFormComponent.hpp> -#include <com/sun/star/form/XBoundComponent.hpp> -#include <com/sun/star/form/XLoadListener.hpp> -#include <com/sun/star/form/XReset.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdb/XColumn.hpp> -#include <com/sun/star/sdb/XColumnUpdate.hpp> -#include <com/sun/star/util/XCloneable.hpp> - -#include <comphelper/uno3.hxx> -#include <comphelper/guarding.hxx> -#include <comphelper/basicio.hxx> - -#include "property.hrc" -#include "property.hxx" -#include "ids.hxx" -#include "cloneable.hxx" -namespace binfilter { - - using namespace ::comphelper; - - -//......................................................................... -namespace frm -{ -//......................................................................... - -// default tab index for components -const sal_Int16 FRM_DEFAULT_TABINDEX = 0; - -// macro for quickly implementing XServiceInfo::getImplementationName -#define IMPLEMENTATION_NAME(ImplName) \ - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException) \ - { return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.") + ::rtl::OUString::createFromAscii(#ImplName); } - -// macro for overriding the getInfoServive method of OAggregationArrayUsageHelper -#define IMPLEMENT_INFO_SERVICE() \ - virtual IPropertyInfoService* getInfoService() const { return &s_aPropInfos; } - -//================================================================== -//= substitutions for the xxx_AGGREGATION_PROPERTY_HELPER-macros -//================================================================== -#define FRM_BEGIN_PROP_HELPER(count) \ - BEGIN_AGGREGATION_PROPERTY_HELPER(count, m_xAggregateSet) \ - -#define FRM_END_PROP_HELPER() \ - END_AGGREGATION_PROPERTY_HELPER(); \ - -//========================================================================= -//= OControl -//= base class for form layer controls -//========================================================================= -typedef ::cppu::ImplHelper3 < ::com::sun::star::awt::XControl - , ::com::sun::star::lang::XEventListener - , ::com::sun::star::lang::XServiceInfo - > OControl_BASE; - -class OControl :public ::cppu::OComponentHelper - ,public OControl_BASE -{ -protected: - osl::Mutex m_aMutex; - OImplementationIdsRef m_aHoldIdHelper; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > - m_xControl; - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> - m_xAggregate; - ::rtl::OUString m_aService; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > - m_xServiceFactory; - -public: - OControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, const ::rtl::OUString& _sService); - - virtual ~OControl(); - -// UNO - DECLARE_UNO3_AGG_DEFAULTS(OControl, OComponentHelper); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); - -// XTypeProvider - virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// XComponent (as base of XControl) - virtual void SAL_CALL dispose( ) throw(::com::sun::star::uno::RuntimeException) - { OComponentHelper::dispose(); } - virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException) - { OComponentHelper::addEventListener(_rxListener); } - virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException) - { OComponentHelper::removeEventListener(_rxListener); } - -// XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); - -// XServiceInfo - virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw (::com::sun::star::uno::RuntimeException); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0; - -// XControl - virtual void SAL_CALL setContext(const InterfaceRef& Context) throw (::com::sun::star::uno::RuntimeException); - virtual InterfaceRef SAL_CALL getContext() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference<starawt::XToolkit>& Toolkit, const ::com::sun::star::uno::Reference<starawt::XWindowPeer>& Parent) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference<starawt::XWindowPeer> SAL_CALL getPeer() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference<starawt::XControlModel>& Model) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference<starawt::XControlModel> SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference<starawt::XView> SAL_CALL getView() throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isDesignMode() throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL isTransparent() throw (::com::sun::star::uno::RuntimeException); - -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - // overwrite this and call the base class if you have additional types -}; - -//================================================================== -//= OBoundControl -//= a form control implementing the XBoundControl interface -//================================================================== -typedef ::cppu::ImplHelper1< ::com::sun::star::form::XBoundControl > OBoundControl_BASE; -class OBoundControl :public OControl - ,public OBoundControl_BASE -{ -protected: - sal_Bool m_bLocked : 1; - -public: - OBoundControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _sService); - virtual ~OBoundControl(); - - DECLARE_UNO3_AGG_DEFAULTS(OBoundControl, OControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException); - -// XBoundControl - virtual sal_Bool SAL_CALL getLock() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException); - // default implementation just disables the controls, overwrite _setLock to change this behaviour - -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - // implement the lock setting - virtual void _setLock(sal_Bool _bLock); -}; - -//================================================================== -//= OControlModel -//= model of a form layer control -//================================================================== -typedef ::cppu::ImplHelper5 < ::com::sun::star::form::XFormComponent - , ::com::sun::star::io::XPersistObject - , ::com::sun::star::container::XNamed - , ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::util::XCloneable - > OControlModel_BASE; - - -class OControlModel :public ::cppu::OComponentHelper - ,public OPropertySetAggregationHelper - ,public OControlModel_BASE - ,public OCloneableAggregation -{ - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xServiceFactory; - - ::osl::Mutex m_aMutex; - // we use this kind of mutex to check the correct using of MutexRelease - // (in the product version OCountedMutex is defined as OMutex) - - InterfaceRef m_xParent; // ParentComponent - OImplementationIdsRef m_aHoldIdHelper; - - static ConcretInfoService s_aPropInfos; - - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& - getORB( ) const { return m_xServiceFactory; } - -// <properties> - ::rtl::OUString m_aName; // name of the control - ::rtl::OUString m_aTag; // tag for additional data - sal_Int16 m_nTabIndex; // index within the taborder - sal_Int16 m_nClassId; // type of the control -// </properties> - - -protected: - OControlModel( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, // factory to create the aggregate with - const ::rtl::OUString& _rUnoControlModelTypeName, // service name of te model to aggregate - const ::rtl::OUString& rDefault = ::rtl::OUString(), // service name of the default control - const sal_Bool _bSetDelegator = sal_True // set to FALSE if you want to call setDelegator later (after returning from this ctor) - ); - OControlModel( - const OControlModel* _pOriginal, // the original object to clone - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, // factory to create the aggregate with - const sal_Bool _bSetDelegator = sal_True // set to FALSE if you want to call setDelegator later (after returning from this ctor) - ); - virtual ~OControlModel(); - - using OComponentHelper::rBHelper; - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - - void readHelpTextCompatibly(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& _rxInStream); - void writeHelpTextCompatibly(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& _rxOutStream); - - void doSetDelegator(); - void doResetDelegator(); - -public: - DECLARE_UNO3_AGG_DEFAULTS(OControl, OComponentHelper); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - -// XTypeProvider - virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL getTypes() throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// XNamed - virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setName(const ::rtl::OUString& aName) throw(::com::sun::star::uno::RuntimeException); - -// XServiceInfo - virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw (::com::sun::star::uno::RuntimeException); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException) = 0; - -// XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException) = 0; - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// XChild (base of XFormComponent) - virtual InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - -// XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); - -// XPropertySet - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - -// ::com::sun::star::beans::XPropertyState - virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle); - virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle); - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - -// XCloneable - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException) = 0; -}; - -//================================================================== -#define DECLARE_DEFAULT_XTOR( classname ) \ - classname( \ - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, \ - const ::rtl::OUString& _rUnoControlModelTypeName, \ - const ::rtl::OUString& _rDefault, \ - const sal_Bool _bSetDelegator = sal_True \ - ); \ - classname( \ - const classname* _pOriginal, \ - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, \ - const sal_Bool _bSetDelegator = sal_True \ - ); \ - ~classname() \ - -#define DECLARE_DEFAULT_LEAF_XTOR( classname ) \ - classname( \ - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \ - ); \ - classname( \ - const classname* _pOriginal, \ - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory \ - ); \ - ~classname() \ - -//================================================================== -// XCloneable -#define DECLARE_XCLONEABLE( ) \ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException) - -#define IMPLEMENT_DEFAULT_CLONING( classname ) \ - ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL classname::createClone( ) throw (::com::sun::star::uno::RuntimeException) \ - { \ - return new classname( this, getORB() ); \ - } - -//================================================================== -//= OBoundControlModel -//= model of a form layer control which is bound to a data source field -//================================================================== -typedef ::cppu::ImplHelper3< ::com::sun::star::form::XLoadListener, - ::com::sun::star::form::XReset, - ::com::sun::star::beans::XPropertyChangeListener > OBoundControlModel_BASE1; -typedef ::cppu::ImplHelper1< ::com::sun::star::form::XBoundComponent> OBoundControlModel_BASE2; - -class OBoundControlModel :public OControlModel - ,public OBoundControlModel_BASE1 - ,public OBoundControlModel_BASE2 -{ -private: - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xField; -protected: - cppu::OInterfaceContainerHelper m_aUpdateListeners; - cppu::OInterfaceContainerHelper m_aResetListeners; - - ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet> m_xCursor; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumnUpdate> m_xColumnUpdate; - ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn> m_xColumn; - - - ::rtl::OUString m_aLabelServiceName; - // when setting the label for our control (property FM_PROP_CONTROLLABEL, member m_xLabelControl), - // we accept only objects supporting an XControlModel interface, an XServiceInfo interface and - // support for a service (XServiceInfo::supportsService) determined by this string. - // Any other arguments will throw an IllegalArgumentException. - // The default value is FM_COMPONENT_FIXEDTEXT. - ::rtl::OUString m_sDataFieldConnectivityProperty; - -// <properties> - ::rtl::OUString m_aControlSource; // Datenquelle, Name des Feldes - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xLabelControl; // reference to a sibling control (model) which is our label -// </properties> - - sal_Bool m_bLoaded : 1; - sal_Bool m_bRequired : 1; - sal_Bool m_bCommitable : 1; - sal_Bool m_bForwardValueChanges : 1; - - sal_Bool m_bResetting : 1; // sal_True while in ::reset - -protected: - OBoundControlModel( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, // factory to create the aggregate with - const ::rtl::OUString& _rUnoControlModelTypeName, // service name of te model to aggregate - const ::rtl::OUString& _rDefault = ::rtl::OUString(), // service name of the default control - const sal_Bool _bCommitable = sal_True, // is the control (model) commitable ? - const sal_Bool _bSetDelegator = sal_True // set to FALSE if you want to call setDelegator later (after returning from this ctor) - ); - OBoundControlModel( - const OBoundControlModel* _pOriginal, // the original object to clone - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rFactory, // factory to create the aggregate with - const sal_Bool _bCommitable = sal_True, // is the control (model) commitable ? - const sal_Bool _bSetDelegator = sal_True // set to FALSE if you want to call setDelegator later (after returning from this ctor) - ); - virtual ~OBoundControlModel(); - - // UNO - virtual sal_Bool _commit() { return sal_True; } - - // Laden der Werte aus dem Datenbankfeld - // wird bei Reset und Load aufgerufen, der Wert kann als Parameter uebergeben werden - virtual void _onValueChanged() = 0; - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _unloaded(); - virtual void _reset(); - - /** nFieldType ist der Typ des Feldes, an das das Model gebunden werden soll. - Das Binden erfolgt genau dann, wenn Rueckgabewert sal_True. - Die Standard-Implementation erlaubt alles ausser den drei binary-Typen und - FieldType_OTHER. - */ - virtual sal_Bool _approve(sal_Int32 _nColumnType); - - // We can't write (new) common properties in this base class, as the file format doesn't allow this - // (unfortunally). So derived classes may use the following to methods. They secured the written - // data with marks, so any new common properties in newer versions will be skipped by older ones. - void writeCommonProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); - void readCommonProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); - // the next method may be used in derived classes's read when an unknown version is encountered - void defaultCommonProperties(); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - - void setField( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxField,sal_Bool _bFire=sal_True); - inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& getField() const - { - return m_xField; - } - -public: - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OBoundControlModel, OControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// XReset - virtual void SAL_CALL reset( ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeResetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); - -// XServiceInfo - virtual StringSequence SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - -// XChild - virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - -// XPersistObject - virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// XBoundComponent - virtual sal_Bool SAL_CALL commit() throw(::com::sun::star::uno::RuntimeException); -// XUpdateBroadcaster (base of XBoundComponent) - virtual void SAL_CALL addUpdateListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeUpdateListener( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XUpdateListener >& aListener ) throw(::com::sun::star::uno::RuntimeException); - -// XPropertySet - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - -// XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); - -// XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw(::com::sun::star::uno::RuntimeException); - -// XLoadListener - virtual void SAL_CALL loaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloading( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloaded( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); - -private: - sal_Bool connectToField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxForm); - void resetField() { m_xColumnUpdate = NULL; m_xColumn = NULL; m_xField = NULL; } -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_FORMCOMPONENT_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/FormattedField.hxx b/binfilter/bf_forms/source/component/FormattedField.hxx deleted file mode 100644 index 5f277e916b43..000000000000 --- a/binfilter/bf_forms/source/component/FormattedField.hxx +++ /dev/null @@ -1,203 +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. - * - ************************************************************************/ - -#ifndef _FORMS_FORMATTEDFIELD_HXX_ -#define _FORMS_FORMATTEDFIELD_HXX_ - -#include "EditBase.hxx" - -#include <i18npool/lang.h> - -#include <comphelper/propmultiplex.hxx> -#include <cppuhelper/implbase1.hxx> -#include "errorbroadcaster.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - - //================================================================== - //= OFormattedModel - //================================================================== - - class OFormattedModel - :public OEditBaseModel - ,public OErrorBroadcaster - ,public OPropertyChangeListener - ,public ::comphelper::OAggregationArrayUsageHelper< OFormattedModel > - { - OPropertyChangeMultiplexer* m_pPropertyMultiplexer; - - // das Original, falls ich die Format-Properties meines aggregierten Models gefaket, d.h. von dem Feld, an das - // ich gebunden bin, weitergereicht habe (nur gueltig wenn loaded) - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> m_xOriginalFormatter; - ::com::sun::star::util::Date m_aNullDate; - ::com::sun::star::uno::Any m_aSaveValue; - - sal_Int32 m_nFieldType; - sal_Int16 m_nKeyType; - sal_Bool m_bOriginalNumeric : 1, - m_bNumeric : 1, // analog fuer TreatAsNumeric-Property - m_bAggregateListening : 1; - - static ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > s_xDefaultFormatter; - static sal_Int32 nValueHandle; - // falls ich wirklich mal einen selber benutzen muss, wird der zwischen allen Instanzen geteilt - - protected: - virtual void _onValueChanged(); - - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcDefaultFormatsSupplier() const; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormFormatsSupplier() const; - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> calcFormatsSupplier() const; - DECLARE_DEFAULT_LEAF_XTOR( OFormattedModel ); - - friend class OFormattedFieldWrapper; - - /// starts multiplexing the aggregate's property changes - void startAggregateListening(); - /// stops multiplexing the aggregate's property changes - void stopAggregateListening(); - /// release the aggregate listener - void releaseAggregateListener(); - - protected: - // XInterface - DECLARE_UNO3_AGG_DEFAULTS( OFormattedModel, OEditBaseModel ); - - // XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - - // XAggregation - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - // OComponentHelper - virtual void SAL_CALL disposing(); - - // XServiceInfo - IMPLEMENTATION_NAME(OFormattedModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // XBoundComponent - virtual sal_Bool _commit(); - - // XPersistObject - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference<stario::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - - // XLoadListener - virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& rEvent) throw ( ::com::sun::star::uno::RuntimeException); - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _unloaded(); - - // XReset - virtual void _reset( void ); - - // XPropertyState - void setPropertyToDefaultByHandle(sal_Int32 nHandle); - ::com::sun::star::uno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const; - - void SAL_CALL setPropertyToDefault(const ::rtl::OUString& aPropertyName) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - - // XPropertyChangeListener - virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); - - protected: - virtual sal_Int16 getPersistenceFlags() const; - // as we have an own version handling for persistence - - protected: - DECLARE_XCLONEABLE(); - - void implConstruct(); - }; - - //================================================================== - //= OFormattedControl - //================================================================== - typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XKeyListener> OFormattedControl_BASE; - class OFormattedControl : public OBoundControl - ,public OFormattedControl_BASE - { - sal_uInt32 m_nKeyEvent; - - public: - OFormattedControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OFormattedControl(); - - DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OFormattedControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XKeyListener - virtual void SAL_CALL keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::awt::XControl - virtual void SAL_CALL setDesignMode(sal_Bool bOn) throw ( ::com::sun::star::uno::RuntimeException); - - private: - DECL_LINK( OnKeyPressed, void* ); - }; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_FORMATTEDFIELD_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/FormattedFieldWrapper.hxx b/binfilter/bf_forms/source/component/FormattedFieldWrapper.hxx deleted file mode 100644 index fb10761c2ca3..000000000000 --- a/binfilter/bf_forms/source/component/FormattedFieldWrapper.hxx +++ /dev/null @@ -1,100 +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. - * - ************************************************************************/ - -#ifndef _FRM_FORMATTED_FIELD_WRAPPER_HXX_ -#define _FRM_FORMATTED_FIELD_WRAPPER_HXX_ - -#include "FormComponent.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -class OEditModel; -//================================================================== -//= OFormattedFieldWrapper -//================================================================== -typedef ::cppu::WeakAggImplHelper3 < ::com::sun::star::io::XPersistObject - , ::com::sun::star::lang::XServiceInfo - , ::com::sun::star::util::XCloneable - > OFormattedFieldWrapper_Base; - -class OFormattedFieldWrapper : public OFormattedFieldWrapper_Base -{ - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xServiceFactory; - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; - - OEditModel* m_pEditPart; - // if we act as formatted this is used to write the EditModel part - ::com::sun::star::uno::Reference< ::com::sun::star::io::XPersistObject> m_xFormattedPart; - // if we act as formatted, this is the PersistObject interface of our aggregate, used - // to read and write the FormattedModel part - - OFormattedFieldWrapper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, sal_Bool _bActAsFormatted); - // if _bActAsFormatted is sal_False, the state is undetermined until somebody calls ::read or does - // anything which requires a living aggregate - OFormattedFieldWrapper( const OFormattedFieldWrapper* _pCloneSource ); - virtual ~OFormattedFieldWrapper(); - - friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - -public: - // UNO - DECLARE_UNO3_AGG_DEFAULTS(OFormattedFieldWrapper, OWeakAggObject); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - - // XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // XCloneable - virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone( ) throw (::com::sun::star::uno::RuntimeException); - -protected: - /// ensure we're in a defined state, which means a FormattedModel _OR_ an EditModel - void ensureAggregate(); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_FORMATTED_FIELD_WRAPPER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/FormsCollection.hxx b/binfilter/bf_forms/source/component/FormsCollection.hxx deleted file mode 100644 index c253690f8d5f..000000000000 --- a/binfilter/bf_forms/source/component/FormsCollection.hxx +++ /dev/null @@ -1,98 +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. - * - ************************************************************************/ - -#include "InterfaceContainer.hxx" - -#include <cppuhelper/implbase2.hxx> - -#include "ids.hxx" - -#include <com/sun/star/lang/XServiceInfo.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OFormsCollection -// Implementiert den UNO-Container fuer Formulare -// enthaelt alle zugeordneten Forms -// dieses Container kann selbst den Context fuer Formulare darstellen -// oder aussen einen Context uebergeben bekommen -//================================================================== -typedef ::cppu::OComponentHelper FormsCollectionComponentBase; -typedef ::cppu::ImplHelper2< ::com::sun::star::container::XChild - ,::com::sun::star::lang::XServiceInfo > OFormsCollection_BASE; - - // else MSVC kills itself on some statements -class OFormsCollection - :public FormsCollectionComponentBase - ,public OInterfaceContainer - ,public OFormsCollection_BASE -{ - ::osl::Mutex m_aMutex; - OImplementationIdsRef m_aHoldIdHelper; - ::comphelper::InterfaceRef m_xParent; // Parent - -public: - OFormsCollection(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OFormsCollection(); - -public: - DECLARE_UNO3_AGG_DEFAULTS(OFormsCollection, FormsCollectionComponentBase); - - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); - -// XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - -// XServiceInfo - virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); - virtual StringSequence SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::container::XChild - virtual ::comphelper::InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setParent(const ::comphelper::InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} // namespace frm -//......................................................................... -}//end of namespace binfilter - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Grid.hxx b/binfilter/bf_forms/source/component/Grid.hxx deleted file mode 100644 index c8ad72134af1..000000000000 --- a/binfilter/bf_forms/source/component/Grid.hxx +++ /dev/null @@ -1,223 +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. - * - ************************************************************************/ - -#include "FormComponent.hxx" - -#include <com/sun/star/form/XGridColumnFactory.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/form/XLoadable.hpp> - -#include <tools/link.hxx> - -#include "InterfaceContainer.hxx" - -#include <comphelper/proparrhlp.hxx> -#include <cppuhelper/implbase6.hxx> -#include "errorbroadcaster.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -class OGridColumn; - -//================================================================== -// ColumnDescription -//================================================================== - - struct ColumnDescription : public ElementDescription - { - public: - OGridColumn* pColumn; // not owned by this instance! only to prevent duplicate XUnoTunnel usage - }; - -//================================================================== -// OGridControlModel -//================================================================== -typedef ::cppu::ImplHelper6 < ::com::sun::star::awt::XControlModel - , ::com::sun::star::form::XGridColumnFactory - , ::com::sun::star::form::XLoadListener - , ::com::sun::star::form::XReset - , ::com::sun::star::view::XSelectionSupplier - , ::com::sun::star::sdb::XSQLErrorListener - > OGridControlModel_BASE; - -class OGridControlModel :public OControlModel - ,public OInterfaceContainer - ,public OErrorBroadcaster - ,public OAggregationArrayUsageHelper< OGridControlModel > - // though we don't use aggregation, we're derived from an OPropertySetAggregationHelper, - // which expects that we use an OPropertyArrayAggregationHelper, which we ensure - // with deriving from OAggregationArrayUsageHelper - ,public OGridControlModel_BASE -{ - ::cppu::OInterfaceContainerHelper m_aSelectListeners, - m_aResetListeners; - -// [properties] - ::com::sun::star::uno::Any m_aRowHeight; // Zeilenhoehe - ::com::sun::star::uno::Any m_aTabStop; - ::com::sun::star::uno::Any m_aTextColor; - ::com::sun::star::uno::Any m_aBackgroundColor; - ::com::sun::star::uno::Any m_aCursorColor; // transient - ::com::sun::star::awt::FontDescriptor m_aFont; - ::com::sun::star::awt::FontDescriptor m_aOldFont; - ::rtl::OUString m_aDefaultControl; - ::rtl::OUString m_sHelpText; - ::com::sun::star::uno::Any m_aTextLineColor; - sal_Int16 m_nFontRelief; - sal_Int16 m_nFontEmphasis; -// [properties] - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xSelection; - ::com::sun::star::uno::Reference< ::com::sun::star::form::XLoadable > m_xParentFormLoadable; - sal_uInt32 m_nFontEvent; - -// [properties] - ::rtl::OUString m_sHelpURL; // URL - sal_Int16 m_nBorder; - sal_Bool m_bEnable : 1; - sal_Bool m_bNavigation : 1; - sal_Bool m_bRecordMarker : 1; - sal_Bool m_bPrintable : 1; - sal_Bool m_bAlwaysShowCursor : 1; // transient - sal_Bool m_bDisplaySynchron : 1; // transient -// [properties] - -protected: - void _reset(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OGridControlModel ); - -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - -// starcontainer::XChild - virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OGridControlModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - -// XTypeProvider - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::form::XLoadListener - virtual void SAL_CALL loaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL unloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloading(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reloaded(const ::com::sun::star::lang::EventObject& aEvent) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::form::XReset - virtual void SAL_CALL reset() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeResetListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::view::XSelectionSupplier - virtual sal_Bool SAL_CALL select(const ::com::sun::star::uno::Any& aElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSelectionChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::form::XGridColumnFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> SAL_CALL createColumn(const ::rtl::OUString& ColumnType) throw ( :: com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual StringSequence SAL_CALL getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException); - -// stario::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference<stario::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::beans::XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - -// ::com::sun::star::beans::XPropertyState - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - -// ::com::sun::star::sdb::XSQLErrorListener - virtual void SAL_CALL errorOccured( const ::com::sun::star::sdb::SQLErrorEvent& _rEvent ) throw (::com::sun::star::uno::RuntimeException); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); - -protected: - virtual void approveNewElement( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject, - ElementDescription* _pElement - ); - - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> createColumn(sal_Int32 nTypeId) const; - - OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const; - - virtual ElementDescription* createElementMetaData( ); - -protected: - virtual void implRemoved(const InterfaceRef& _rxObject); - virtual void implInserted( const ElementDescription* _pElement ); - virtual void implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement ); - - void gotColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn); - void lostColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxColumn); - - void cloneColumns( const OGridControlModel* _pOriginalContainer ); - -private: - DECL_LINK( OnFontChanged, void* ); -}; - -//......................................................................... -} // namespace frm -//......................................................................... -}//end of namespace binfilter - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/GroupBox.hxx b/binfilter/bf_forms/source/component/GroupBox.hxx deleted file mode 100644 index 9b6be93ca9e5..000000000000 --- a/binfilter/bf_forms/source/component/GroupBox.hxx +++ /dev/null @@ -1,95 +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. - * - ************************************************************************/ - -#ifndef _FORMS_GROUPBOX_HXX_ -#define _FORMS_GROUPBOX_HXX_ - -#include "FormComponent.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -//================================================================== -// OGroupBoxModel -//================================================================== -class OGroupBoxModel - :public OControlModel - ,public ::comphelper::OAggregationArrayUsageHelper< OGroupBoxModel > -{ -public: - DECLARE_DEFAULT_LEAF_XTOR( OGroupBoxModel ); - - // XServiceInfo - IMPLEMENTATION_NAME(OGroupBoxModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XPropertySetRef - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -// OGroupBoxControl (nur aus Kompatibilitaet zur 5.0) -//================================================================== -class OGroupBoxControl : public OControl -{ -public: - OGroupBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // XServiceInfo - IMPLEMENTATION_NAME(OGroupBoxControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_GROUPBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/GroupManager.hxx b/binfilter/bf_forms/source/component/GroupManager.hxx deleted file mode 100644 index b6337985ee08..000000000000 --- a/binfilter/bf_forms/source/component/GroupManager.hxx +++ /dev/null @@ -1,230 +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. - * - ************************************************************************/ - -#ifndef _FRM_GROUPMANAGER_HXX_ -#define _FRM_GROUPMANAGER_HXX_ - -#include <com/sun/star/awt/XControlModel.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XContainer.hpp> - - -#include <cppuhelper/implbase2.hxx> - -#include <comphelper/stl_types.hxx> -namespace binfilter { - using namespace ::comphelper; - -/*======================================================================== -Funktionsweise GroupManager: - -Der GroupManager horcht an der starform, ob FormComponents eingefuegt oder entfernt -werden. Zusaetzlich horcht er bei den FormComponents an den Properties -"Name" und "TabIndex". Mit diesen Infos aktualisiert er seine Gruppen. - -Der GroupManager verwaltet eine Gruppe, in der alle Controls nach TabIndex -geordnet sind, und ein Array von Gruppen, in dem jede FormComponent noch -einmal einer Gruppe dem Namen nach zugeordnet wird. -Die einzelnen Gruppen werden ueber eine Map aktiviert, wenn sie mehr als -ein Element besitzen. - -Die Gruppen verwalten intern die FormComponents in zwei Arrays. In dem -GroupCompArray werden die Components nach TabIndex und Einfuegepostion -sortiert. Da auf dieses Array ueber die FormComponent zugegriffen -wird, gibt es noch das GroupCompAccessArray, in dem die FormComponents -nach ihrer Speicheradresse sortiert sind. Jedes Element des -GroupCompAccessArrays ist mit einem Element des GroupCompArrays verpointert. - -========================================================================*/ - -//......................................................................... -namespace frm -{ -//......................................................................... - -//======================================================================== - template <class ELEMENT, class LESS_COMPARE> - sal_Int32 insert_sorted(::std::vector<ELEMENT>& _rArray, const ELEMENT& _rNewElement, const LESS_COMPARE& _rCompareOp) - { - typename ::std::vector<ELEMENT>::iterator aInsertPos = lower_bound( - _rArray.begin(), - _rArray.end(), - _rNewElement, - _rCompareOp - ); - aInsertPos = _rArray.insert(aInsertPos, _rNewElement); - return aInsertPos - _rArray.begin(); - } - - template <class ELEMENT, class LESS_COMPARE> - sal_Bool seek_entry(const ::std::vector<ELEMENT>& _rArray, const ELEMENT& _rNewElement, sal_Int32& nPos, const LESS_COMPARE& _rCompareOp) - { - typename ::std::vector<ELEMENT>::const_iterator aExistentPos = lower_bound( - _rArray.begin(), - _rArray.end(), - _rNewElement, - _rCompareOp - ); - if ((aExistentPos != _rArray.end()) && (*aExistentPos == _rNewElement)) - { // we have a valid "lower or equal" element and it's really "equal" - nPos = aExistentPos - _rArray.begin(); - return sal_True; - } - nPos = -1; - return sal_False; - } - -//======================================================================== -class OGroupComp -{ - ::rtl::OUString m_aName; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xComponent; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xControlModel; - sal_Int32 m_nPos; - sal_Int16 m_nTabIndex; - - friend class OGroupCompLess; - -public: - OGroupComp(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& rxElement, sal_Int32 nInsertPos ); - OGroupComp(const OGroupComp& _rSource); - OGroupComp(); - - sal_Bool operator==( const OGroupComp& rComp ) const; - - inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& GetComponent() const { return m_xComponent; } - inline const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& GetControlModel() const { return m_xControlModel; } - - sal_Int32 GetPos() const { return m_nPos; } - sal_Int16 GetTabIndex() const { return m_nTabIndex; } - ::rtl::OUString GetName() const { return m_aName; } -}; - -DECLARE_STL_VECTOR(OGroupComp, OGroupCompArr); - -//======================================================================== -class OGroupComp; -class OGroupCompAcc -{ - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> m_xComponent; - - OGroupComp m_aGroupComp; - - friend class OGroupCompAccLess; - -public: - OGroupCompAcc(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& rxElement, const OGroupComp& _rGroupComp ); - - sal_Bool operator==( const OGroupCompAcc& rCompAcc ) const; - - inline const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& GetComponent() const { return m_xComponent; } - const OGroupComp& GetGroupComponent() const { return m_aGroupComp; } -}; - -DECLARE_STL_VECTOR(OGroupCompAcc, OGroupCompAccArr); - -//======================================================================== -class OGroup -{ - OGroupCompArr m_aCompArray; - OGroupCompAccArr m_aCompAccArray; - - ::rtl::OUString m_aGroupName; - sal_uInt16 m_nInsertPos; // Die Einfugeposition der GroupComps wird von der Gruppe bestimmt. - - friend class OGroupLess; - -public: - OGroup( const ::rtl::OUString& rGroupName ); -#ifdef DBG_UTIL - OGroup( const OGroup& _rSource ); // just to ensure the DBG_CTOR call -#endif - virtual ~OGroup(); - - sal_Bool operator==( const OGroup& rGroup ) const; - - ::rtl::OUString GetGroupName() const { return m_aGroupName; } - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> > GetControlModels() const; - - void InsertComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& rxElement ); - void RemoveComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& rxElement ); - sal_uInt16 Count() const { return m_aCompArray.size(); } - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& GetObject( sal_uInt16 nP ) const - { return m_aCompArray[nP].GetComponent(); } -}; - -DECLARE_STL_USTRINGACCESS_MAP(OGroup, OGroupArr); -DECLARE_STL_VECTOR(OGroupArr::iterator, OActiveGroups); - -//======================================================================== -class OGroupManager : public ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertyChangeListener, ::com::sun::star::container::XContainerListener> -{ - OGroup* m_pCompGroup; // Alle Components nach TabIndizes sortiert - OGroupArr m_aGroupArr; // Alle Components nach Gruppen sortiert - OActiveGroups m_aActiveGroupMap; // In dieser Map werden die Indizes aller Gruppen gehalten, - // die mehr als 1 Element haben - - ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer > - m_xContainer; - - // Helper functions - void InsertElement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& rxElement ); - void RemoveElement( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& rxElement ); - void removeFromGroupMap(const ::rtl::OUString& _sGroupName,const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xSet); - -public: - OGroupManager(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainer >& _rxContainer); - virtual ~OGroupManager(); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::beans::XPropertyChangeListener - virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw ( ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XContainerListener - virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& _rEvent) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& _rEvent) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& _rEvent) throw ( ::com::sun::star::uno::RuntimeException); - -// Other functions - sal_Int32 getGroupCount(); - void getGroup(sal_Int32 nGroup, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup, ::rtl::OUString& Name); - void getGroupByName(const ::rtl::OUString& Name, ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> >& _rGroup); - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> > getControlModels(); -}; - - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_GROUPMANAGER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Hidden.hxx b/binfilter/bf_forms/source/component/Hidden.hxx deleted file mode 100644 index a6e6fdde6642..000000000000 --- a/binfilter/bf_forms/source/component/Hidden.hxx +++ /dev/null @@ -1,92 +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. - * - ************************************************************************/ - -#ifndef _FORMS_HIDDEN_HXX_ -#define _FORMS_HIDDEN_HXX_ - -#include "FormComponent.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -//================================================================== -// OHiddenModel -//================================================================== -class OHiddenModel - :public OControlModel - ,public ::comphelper::OAggregationArrayUsageHelper< OHiddenModel > -{ - ::rtl::OUString m_sHiddenValue; - -public: - DECLARE_DEFAULT_LEAF_XTOR( OHiddenModel ); - - // OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - - // XPropertySetRef - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // XServiceInfo - IMPLEMENTATION_NAME(OHiddenModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE( ); -}; - -} -#endif // _FORMS_HIDDEN_HXX_ - -//......................................................................... -}//end of namespace binfilter -//......................................................................... - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Image.hxx b/binfilter/bf_forms/source/component/Image.hxx deleted file mode 100644 index 014c42726655..000000000000 --- a/binfilter/bf_forms/source/component/Image.hxx +++ /dev/null @@ -1,225 +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. - * - ************************************************************************/ - -#ifndef _FRM_IMAGE_HXX_ -#define _FRM_IMAGE_HXX_ - -#include "FormComponent.hxx" - -#include "EventThread.hxx" - -#include <comphelper/propmultiplex.hxx> -#include "imgprod.hxx" - -#include <com/sun/star/form/XImageProducerSupplier.hpp> -#include <com/sun/star/form/FormButtonType.hpp> -#include <com/sun/star/form/XApproveActionBroadcaster.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <cppuhelper/implbase2.hxx> -namespace binfilter { - - -class SfxMedium; - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OImageModel -//================================================================== -typedef ::cppu::ImplHelper2 < ::com::sun::star::form::XImageProducerSupplier - , ::com::sun::star::awt::XImageProducer - > OImageModel_Base; - -class OImageModel :public OImageModel_Base - ,public OControlModel - ,public OPropertyChangeListener -{ -protected: - ::com::sun::star::form::FormButtonType m_eButtonType; // Art des Buttons (push,submit,reset) - ::rtl::OUString m_sTargetURL; // starutil::URL fuer den starutil::URL-Button - ::rtl::OUString m_sTargetFrame; // TargetFrame zum Oeffnen - -// ImageProducer stuff - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> m_xProducer; - SfxMedium* m_pMedium; // Download-Medium - ImageProducer* m_pProducer; - sal_Bool m_bDispatchUrlInternal; // property: is not allowed to set : 1 - sal_Bool m_bDownloading : 1; // laeuft ein Download? - sal_Bool m_bProdStarted : 1; - - - - DECL_STATIC_LINK( OImageModel, DataAvailableLink, void* ); - DECL_STATIC_LINK( OImageModel, DownloadDoneLink, void* ); - - inline ImageProducer* GetImageProducer() { return m_pProducer; } - - void StartProduction(); - void SetURL(const ::rtl::OUString& rURL); - void DataAvailable(); - void DownloadDone(); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - inline sal_Bool isDispatchUrlInternal() const { return m_bDispatchUrlInternal; } - inline void setDispatchUrlInternal(sal_Bool _bDispatch) { m_bDispatchUrlInternal = _bDispatch; } - -public: - DECLARE_DEFAULT_XTOR( OImageModel ); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OImageModel, OControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::form::XImageProducerSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> SAL_CALL getImageProducer() throw (::com::sun::star::uno::RuntimeException) { return m_xProducer; } - -// OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); - - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - -// OPropertyChangeListener - virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent&) throw(::com::sun::star::uno::RuntimeException); - -// XPersistObject - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::beans::XPropertyState - virtual ::com::sun::star::beans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle); - virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle); - virtual ::com::sun::star::uno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const; - -// XImageProducer - virtual void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException); - -protected: - void implConstruct(); - - // to be called from within the cloning-ctor of your derived class - void implInitializeImageURL( ); -}; - -//================================================================== -// OImageControl -//================================================================== -typedef ::cppu::ImplHelper2< ::com::sun::star::form::XApproveActionBroadcaster, - ::com::sun::star::beans::XPropertyChangeListener> OImageControl_BASE; -class OImageControlThread_Impl; - -class OImageControl : public OImageControl_BASE, - public OControl -{ - friend class OImageControlThread_Impl; - -protected: - ::cppu::OInterfaceContainerHelper - m_aApproveActionListeners, - m_aActionListeners; - ::rtl::OUString m_aActionCommand; - - OImageControlThread_Impl *m_pThread; - -public: - OImageControl( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, - const ::rtl::OUString& _aService); - virtual ~OImageControl(); - -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OImageControl, OControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::form::XApproveActionBroadcaster - virtual void SAL_CALL addApproveActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XApproveActionListener>& _rxListener) - throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeApproveActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XApproveActionListener>& _rxListener) - throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::awt::XControl - virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& _rToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& Parent) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& Model) throw (::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::beans::XPropertyChangeListener - virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& ) throw(::com::sun::star::uno::RuntimeException); - -protected: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getXModel(const InterfaceRef& xIface) const; - - virtual void actionPerformed_Impl( sal_Bool bNotifyListener, const ::com::sun::star::awt::MouseEvent& rEvt = ::com::sun::star::awt::MouseEvent()); - - ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); -}; - -//================================================================== -// OImageControlThread_Impl -//================================================================== -class OImageControlThread_Impl: public OComponentEventThread -{ -protected: - - // Die folgende Methode wrrd gerufen um das Event unter Beruecksichtigung - // seines Typs zu duplizieren - virtual ::com::sun::star::lang::EventObject* cloneEvent( const ::com::sun::star::lang::EventObject* _pEvt ) const; - - // Ein Event bearbeiten. Der Mutex ist dabei nicht gelockt, pCompImpl - // bleibt aber in jedem Fall gueltig. - virtual void processEvent( ::cppu::OComponentHelper *pCompImpl, - const ::com::sun::star::lang::EventObject*, - const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl>&, - sal_Bool ); - -public: - OImageControlThread_Impl( OImageControl *pControl ) : - OComponentEventThread( pControl ) - {} - - void addEvent() { ::com::sun::star::lang::EventObject aEvt; OComponentEventThread::addEvent( &aEvt ); } -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_IMAGE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/ImageButton.hxx b/binfilter/bf_forms/source/component/ImageButton.hxx deleted file mode 100644 index 680b0c268da9..000000000000 --- a/binfilter/bf_forms/source/component/ImageButton.hxx +++ /dev/null @@ -1,116 +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. - * - ************************************************************************/ - -#ifndef _FRM_IMAGE_BUTTON_HXX_ -#define _FRM_IMAGE_BUTTON_HXX_ - -#include "Image.hxx" - -#include <com/sun/star/awt/XMouseListener.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OImageButtonModel -//================================================================== -class OImageButtonModel - :public OImageModel - ,public ::comphelper::OAggregationArrayUsageHelper< OImageButtonModel > -{ -public: - DECLARE_DEFAULT_LEAF_XTOR( OImageButtonModel ); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OImageButtonModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -// OImageButtonControl -//================================================================== -typedef ::cppu::ImplHelper1< ::com::sun::star::awt::XMouseListener> OImageButtonControl_BASE; -class OImageButtonControl : public OImageControl, - public OImageButtonControl_BASE -{ -protected: - // UNO Anbindung - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OImageButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OImageButtonControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OImageButtonControl, OImageControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException) - { OControl::disposing(_rSource); } - -// ::com::sun::star::awt::XMouseListener - virtual void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) { } - virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) { } - virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) { } -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_IMAGE_BUTTON_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/ImageControl.hxx b/binfilter/bf_forms/source/component/ImageControl.hxx deleted file mode 100644 index bedfaa3b8d3c..000000000000 --- a/binfilter/bf_forms/source/component/ImageControl.hxx +++ /dev/null @@ -1,184 +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. - * - ************************************************************************/ - -#ifndef _FRM_IMAGE_CONTROL_HXX_ -#define _FRM_IMAGE_CONTROL_HXX_ - -#include "FormComponent.hxx" - -#include "imgprod.hxx" - -#include <com/sun/star/form/XImageProducerSupplier.hpp> -#include <com/sun/star/awt/XMouseListener.hpp> - -#include <comphelper/propmultiplex.hxx> -#include <cppuhelper/implbase2.hxx> -namespace binfilter { - - using namespace ::comphelper; - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -// OImageControlModel -//================================================================== -typedef ::cppu::ImplHelper2 < ::com::sun::star::form::XImageProducerSupplier - , ::com::sun::star::awt::XImageProducer - > OImageControlModel_Base; - -class OImageControlModel - :public OImageControlModel_Base - ,public ::comphelper::OAggregationArrayUsageHelper<OImageControlModel> - ,public OBoundControlModel - ,public OPropertyChangeListener -{ - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> m_xImageProducer; - ImageProducer* m_pImageProducer; - sal_Bool m_bReadOnly; - - OPropertyChangeMultiplexer* m_pAggregatePropertyMultiplexer; - - // Helper functions - void UpdateFromField(); - -protected: - // UNO Anbindung - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - virtual void _onValueChanged(); - - virtual sal_Bool _approve(sal_Int32 _nColumnType); - - inline ImageProducer* GetImageProducer() { return m_pImageProducer; } - -public: - DECLARE_DEFAULT_LEAF_XTOR( OImageControlModel ); - - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OImageControlModel, OBoundControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::form::XBoundComponent - virtual ::com::sun::star::uno::Any _getControlValue() const; - virtual void _reset(); - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OImageControlModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// OPropertyChangeListener - virtual void _propertyChanged( const ::com::sun::star::beans::PropertyChangeEvent& ) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::form::XImageProducerSupplier - virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageProducer> SAL_CALL getImageProducer() throw ( ::com::sun::star::uno::RuntimeException); - -// XImageProducer - virtual void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& xConsumer ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL startProduction( ) throw (::com::sun::star::uno::RuntimeException); - -// ::comphelper::OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); - - void implConstruct(); -}; - -//================================================================== -// OImageControlControl -//================================================================== -class OImageControlControl : public ::com::sun::star::awt::XMouseListener, - public OBoundControl -{ -protected: - // UNO Anbindung - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OImageControlControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OImageControlControl, OBoundControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException) - { OBoundControl::disposing(_rSource); } - -// ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OImageControlControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - -// ::com::sun::star::awt::XMouseListener - virtual void SAL_CALL mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL mouseReleased(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) { } - virtual void SAL_CALL mouseEntered(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) { } - virtual void SAL_CALL mouseExited(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) { } - -// ::com::sun::star::awt::XControl - virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& _rToolkit, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer>& _rParent) throw(::com::sun::star::uno::RuntimeException); - -private: - void implClearGraphics(); - void implInsertGraphics(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_IMAGE_CONTROL_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/ListBox.hxx b/binfilter/bf_forms/source/component/ListBox.hxx deleted file mode 100644 index f7fc9e58aec6..000000000000 --- a/binfilter/bf_forms/source/component/ListBox.hxx +++ /dev/null @@ -1,212 +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. - * - ************************************************************************/ - -#ifndef _FORMS_LISTBOX_HXX_ -#define _FORMS_LISTBOX_HXX_ - -#include "FormComponent.hxx" -#include <cppuhelper/interfacecontainer.hxx> -#include <cppuhelper/interfacecontainer.hxx> -#include <vcl/timer.hxx> - -#include <com/sun/star/util/XRefreshable.hpp> -#include <com/sun/star/util/XNumberFormatter.hpp> -#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> -#include <com/sun/star/form/ListSourceType.hpp> -#include <com/sun/star/awt/XItemListener.hpp> -#include <com/sun/star/awt/XFocusListener.hpp> -#include <com/sun/star/form/XChangeBroadcaster.hpp> -#include <cppuhelper/implbase1.hxx> -#include "errorbroadcaster.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ - -const ::rtl::OUString LISTBOX_EMPTY_VALUE = ::rtl::OUString::createFromAscii("$$$empty$$$"); - -//================================================================== -//= OListBoxModel -//================================================================== -typedef ::cppu::ImplHelper1 < ::com::sun::star::util::XRefreshable - > OListBoxModel_BASE; - -class OListBoxModel :public OBoundControlModel - ,public OListBoxModel_BASE - ,public OErrorBroadcaster - ,public ::comphelper::OAggregationArrayUsageHelper< OListBoxModel > -{ - ::com::sun::star::uno::Any m_aSaveValue; - - // <properties> - ::com::sun::star::form::ListSourceType m_eListSourceType; // type der list source - ::com::sun::star::uno::Any m_aBoundColumn; - StringSequence m_aListSourceSeq; // - StringSequence m_aValueSeq; // alle Werte, readonly - ::com::sun::star::uno::Sequence<sal_Int16> m_aDefaultSelectSeq; // DefaultSelected - // </properties> - - ::cppu::OInterfaceContainerHelper m_aRefreshListeners; - - static sal_Int32 nSelectHandle; - // [properties] - - sal_Int16 m_nNULLPos; // Position an der der NULLwert abgelegt wird - sal_Bool m_bBoundComponent : 1; - - // Helper functions - StringSequence GetCurValueSeq() const; - - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -protected: - // UNO Anbindung - virtual void _onValueChanged(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OListBoxModel ); - -// XServiceInfo - IMPLEMENTATION_NAME(OListBoxModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - -// UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OListBoxModel, OBoundControlModel); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - -// XLoadListener - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - virtual void _unloaded(); - -// XBoundComponent - virtual sal_Bool _commit(); - -// XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - -// XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// XReset - virtual void _reset(); - -// XRefreshable - virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addRefreshListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeRefreshListener(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - void loadData(); - - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= OListBoxControl -//================================================================== -typedef ::cppu::ImplHelper3< ::com::sun::star::awt::XFocusListener, - ::com::sun::star::awt::XItemListener, - ::com::sun::star::form::XChangeBroadcaster > OListBoxControl_BASE; - -class OListBoxControl :public OBoundControl - ,public OListBoxControl_BASE -{ - ::cppu::OInterfaceContainerHelper m_aChangeListeners; - - ::com::sun::star::uno::Any m_aCurrentSelection; - Timer m_aChangeTimer; - -protected: - // UNO Anbindung - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OListBoxControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OListBoxControl(); - - // UNO Anbindung - DECLARE_UNO3_AGG_DEFAULTS(OListBoxControl, OBoundControl); - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw (::com::sun::star::uno::RuntimeException); - -// XServiceInfo - IMPLEMENTATION_NAME(OListBoxControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - -// XChangeBroadcaster - virtual void SAL_CALL addChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XChangeListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - -// XFocusListener - virtual void SAL_CALL focusGained(const ::com::sun::star::awt::FocusEvent& _rEvent) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL focusLost(const ::com::sun::star::awt::FocusEvent& _rEvent) throw(::com::sun::star::uno::RuntimeException); - -// XItemListener - virtual void SAL_CALL itemStateChanged(const ::com::sun::star::awt::ItemEvent& _rEvent) throw(::com::sun::star::uno::RuntimeException); - -// XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -private: - DECL_LINK( OnTimeout, void* ); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_LISTBOX_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Numeric.hxx b/binfilter/bf_forms/source/component/Numeric.hxx deleted file mode 100644 index 965856d24680..000000000000 --- a/binfilter/bf_forms/source/component/Numeric.hxx +++ /dev/null @@ -1,108 +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. - * - ************************************************************************/ - -#ifndef _FORMS_NUMERIC_HXX_ -#define _FORMS_NUMERIC_HXX_ - -#include "EditBase.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= ONumericModel -//================================================================== -class ONumericModel - :public OEditBaseModel - ,public ::comphelper::OAggregationArrayUsageHelper< ONumericModel > -{ - ::com::sun::star::uno::Any m_aSaveValue; - static sal_Int32 nValueHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( ONumericModel ); - - // starform::XBoundComponent - virtual sal_Bool _commit(); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(ONumericModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - - // starform::XReset - virtual void _reset(); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= ONumericControl -//================================================================== -class ONumericControl: public OBoundControl -{ -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - ONumericControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(ONumericControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_NUMERIC_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Pattern.hxx b/binfilter/bf_forms/source/component/Pattern.hxx deleted file mode 100644 index 081b665b08db..000000000000 --- a/binfilter/bf_forms/source/component/Pattern.hxx +++ /dev/null @@ -1,109 +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. - * - ************************************************************************/ - -#ifndef _FORMS_PATTERN_HXX_ -#define _FORMS_PATTERN_HXX_ - -#include "EditBase.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= OPatternModel -//================================================================== -class OPatternModel - :public OEditBaseModel - ,public ::comphelper::OAggregationArrayUsageHelper< OPatternModel > -{ - ::rtl::OUString m_aSaveValue; - - static sal_Int32 nTextHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OPatternModel ); - - // starform::XBoundComponent - virtual sal_Bool _commit(); - - // ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OPatternModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - - // starform::XReset - virtual void _reset(); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= OPatternControl -//================================================================== -class OPatternControl: public OBoundControl -{ -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OPatternControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OPatternControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_PATTERN_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/RadioButton.hxx b/binfilter/bf_forms/source/component/RadioButton.hxx deleted file mode 100644 index 026260965af5..000000000000 --- a/binfilter/bf_forms/source/component/RadioButton.hxx +++ /dev/null @@ -1,133 +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. - * - ************************************************************************/ - -#ifndef _FORMS_RADIOBUTTON_HXX_ -#define _FORMS_RADIOBUTTON_HXX_ - -#include "FormComponent.hxx" - -#include <comphelper/propmultiplex.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ - -enum { RB_NOCHECK, RB_CHECK, RB_DONTKNOW }; - -//================================================================== -// ORadioButtonModel -//================================================================== -class ORadioButtonModel :public OBoundControlModel - ,public OPropertyChangeListener - ,public ::comphelper::OAggregationArrayUsageHelper< ORadioButtonModel > -{ - ::rtl::OUString m_sReferenceValue; // Referenzwert zum Checken des Buttons - sal_Int16 m_nDefaultChecked; // Soll beim Reset gecheckt werden ? - - sal_Bool m_bInReset : 1; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Any _getControlValue() const; - -public: - DECLARE_DEFAULT_LEAF_XTOR( ORadioButtonModel ); - - // XServiceInfo - IMPLEMENTATION_NAME(ORadioButtonModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - - // OPropertySetHelper - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle) const; - virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw (::com::sun::star::uno::Exception); - virtual sal_Bool SAL_CALL convertFastPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, ::com::sun::star::uno::Any& _rOldValue, sal_Int32 _nHandle, const ::com::sun::star::uno::Any& _rValue ) - throw (::com::sun::star::lang::IllegalArgumentException); - - // XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - write(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL - read(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - - // OPropertyChangeListener - virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); - - // XReset - virtual void SAL_CALL reset() throw(::com::sun::star::uno::RuntimeException); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - virtual void _reset(); - virtual sal_Bool _commit(); - -protected: - void SetSiblingPropsTo(const ::rtl::OUString& rPropName, const ::com::sun::star::uno::Any& rValue); - - void implConstruct(); - DECLARE_XCLONEABLE( ); -}; - -//================================================================== -// ORadioButtonControl -//================================================================== -class ORadioButtonControl: public OBoundControl -{ -public: - ORadioButtonControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - - // XServiceInfo - IMPLEMENTATION_NAME(ORadioButtonControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); - -protected: - // XControl - virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference<starawt::XToolkit>& Toolkit, const ::com::sun::star::uno::Reference<starawt::XWindowPeer>& Parent) throw (::com::sun::star::uno::RuntimeException); -}; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_RADIOBUTTON_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/Time.hxx b/binfilter/bf_forms/source/component/Time.hxx deleted file mode 100644 index e3666d0f4b19..000000000000 --- a/binfilter/bf_forms/source/component/Time.hxx +++ /dev/null @@ -1,122 +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. - * - ************************************************************************/ - -#ifndef _FORMS_TIME_HXX_ -#define _FORMS_TIME_HXX_ - -#include "EditBase.hxx" -#include "limitedformats.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= OTimeModel -//================================================================== -class OTimeModel - :public OEditBaseModel - ,public OLimitedFormats - ,public ::comphelper::OAggregationArrayUsageHelper< OTimeModel > -{ - ::com::sun::star::uno::Any m_aSaveValue; - sal_Bool m_bDateTimeField; - static sal_Int32 nTimeHandle; - -protected: - virtual void _onValueChanged(); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - DECLARE_DEFAULT_LEAF_XTOR( OTimeModel ); - - // starform::XBoundComponent - virtual sal_Bool _commit(); - - // stario::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName() throw ( ::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::beans::XPropertySet - virtual void SAL_CALL getFastPropertyValue(::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; - virtual sal_Bool SAL_CALL convertFastPropertyValue(::com::sun::star::uno::Any& rConvertedValue, ::com::sun::star::uno::Any& rOldValue, - sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) - throw(::com::sun::star::lang::IllegalArgumentException); - virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue) throw ( ::com::sun::star::uno::Exception); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OTimeModel); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); - - // ::com::sun::star::beans::XPropertySet - virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); - virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); - - // starform::XReset - virtual void _reset( void ); - - // starform::XLoadListener - virtual void _loaded(const ::com::sun::star::lang::EventObject& rEvent); - - // OAggregationArrayUsageHelper - virtual void fillProperties( - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, - ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps - ) const; - IMPLEMENT_INFO_SERVICE() - -protected: - DECLARE_XCLONEABLE(); -}; - -//================================================================== -//= OTimeControl -//================================================================== -class OTimeControl: public OBoundControl -{ -protected: - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> _getTypes(); - -public: - OTimeControl(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - DECLARE_UNO3_AGG_DEFAULTS(OTimeControl, OBoundControl); - - // ::com::sun::star::lang::XServiceInfo - IMPLEMENTATION_NAME(OTimeControl); - virtual StringSequence SAL_CALL getSupportedServiceNames() throw(); -}; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_TIME_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/cloneable.hxx b/binfilter/bf_forms/source/component/cloneable.hxx deleted file mode 100644 index d7d248afbe8f..000000000000 --- a/binfilter/bf_forms/source/component/cloneable.hxx +++ /dev/null @@ -1,59 +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. - * - ************************************************************************/ - -#ifndef FORMS_COMPONENT_CLONEABLE_HXX -#define FORMS_COMPONENT_CLONEABLE_HXX - -#include <com/sun/star/uno/XAggregation.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - //==================================================================== - //= OCloneableAggregation - //==================================================================== - class OCloneableAggregation - { - protected: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation> m_xAggregate; - - protected: - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > createAggregateClone( const OCloneableAggregation* _pOriginal ); - }; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // FORMS_COMPONENT_CLONEABLE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/errorbroadcaster.hxx b/binfilter/bf_forms/source/component/errorbroadcaster.hxx deleted file mode 100644 index 0b3bbba13478..000000000000 --- a/binfilter/bf_forms/source/component/errorbroadcaster.hxx +++ /dev/null @@ -1,77 +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. - * - ************************************************************************/ - -#ifndef FORMS_ERRORBROADCASTER_HXX -#define FORMS_ERRORBROADCASTER_HXX - -#include <cppuhelper/implbase1.hxx> -#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp> -#include <cppuhelper/interfacecontainer.h> -#include <com/sun/star/sdbc/SQLException.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - //===================================================================== - //= OErrorBroadcaster - //===================================================================== - typedef ::cppu::ImplHelper1 < ::com::sun::star::sdb::XSQLErrorBroadcaster - > OErrorBroadcaster_BASE; - - class OErrorBroadcaster : public OErrorBroadcaster_BASE - { - private: - ::cppu::OBroadcastHelper& m_rBHelper; - ::cppu::OInterfaceContainerHelper m_aErrorListeners; - - protected: - OErrorBroadcaster( ::cppu::OBroadcastHelper& _rBHelper ); - ~OErrorBroadcaster( ); - - void SAL_CALL disposing(); - - void SAL_CALL onError( const ::com::sun::star::sdbc::SQLException& _rException, const ::rtl::OUString& _rContextDescription ); - void SAL_CALL onError( const ::com::sun::star::sdb::SQLErrorEvent& _rException ); - - protected: - // XSQLErrorBroadcaster - virtual void SAL_CALL addSQLErrorListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener >& _rListener ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeSQLErrorListener( const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XSQLErrorListener >& _rListener ) throw (::com::sun::star::uno::RuntimeException); - }; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // FORMS_ERRORBROADCASTER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Button.cxx b/binfilter/bf_forms/source/component/forms_Button.cxx deleted file mode 100644 index 6e54cd482618..000000000000 --- a/binfilter/bf_forms/source/component/forms_Button.cxx +++ /dev/null @@ -1,416 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Button.hxx" - -#include <tools/urlobj.hxx> -#include <vcl/svapp.hxx> -#include <comphelper/streamsection.hxx> - -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include "bf_so3/staticbaseurl.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -//= OButtonModel -//================================================================== -DBG_NAME(OButtonModel) -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OButtonModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OButtonModel(_rxFactory)); -} - -//------------------------------------------------------------------ -OButtonModel::OButtonModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OImageModel(_rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_CONTROL_COMMANDBUTTON) - // use the old control name for compytibility reasons -{ - DBG_CTOR( OButtonModel, NULL ); - m_nClassId = FormComponentType::COMMANDBUTTON; -} - -//------------------------------------------------------------------ -OButtonModel::OButtonModel( const OButtonModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OImageModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OButtonModel, NULL ); - implInitializeImageURL(); -} - -//------------------------------------------------------------------------------ -OButtonModel::~OButtonModel() -{ - DBG_DTOR(OButtonModel, NULL); -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OButtonModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void OButtonModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(8) - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(BUTTONTYPE, FormButtonType, BOUND); - DECL_PROP1(DISPATCHURLINTERNAL, sal_Bool, BOUND); - DECL_PROP1(TARGET_URL, ::rtl::OUString, BOUND); - DECL_PROP1(TARGET_FRAME, ::rtl::OUString, BOUND); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OButtonModel::getInfoHelper() -{ - return *const_cast<OButtonModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OButtonModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OButtonModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_COMMANDBUTTON; - return aSupported; -} - -//------------------------------------------------------------------------------ -::rtl::OUString OButtonModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_COMMANDBUTTON; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void OButtonModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OImageModel::write(_rxOutStream); - - _rxOutStream->writeShort(0x0003); // Version - - { - OStreamSection aSection( _rxOutStream.get() ); - // this will allow readers to skip unknown bytes in their dtor - - _rxOutStream->writeShort( (sal_uInt16)m_eButtonType ); - - ::rtl::OUString sTmp = INetURLObject::decode(::binfilter::StaticBaseUrl::AbsToRel( m_sTargetURL ), '%', INetURLObject::DECODE_UNAMBIGUOUS); - _rxOutStream << sTmp; - _rxOutStream << m_sTargetFrame; - writeHelpTextCompatibly(_rxOutStream); - _rxOutStream << isDispatchUrlInternal(); - } -} - -//------------------------------------------------------------------------------ -void OButtonModel::read(const Reference<XObjectInputStream>& _rxInStream) throw (::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OImageModel::read(_rxInStream); - - sal_uInt16 nVersion = _rxInStream->readShort(); // Version - switch (nVersion) - { - case 0x0001: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - - ::rtl::OUString sTmp; - _rxInStream >> sTmp; - m_sTargetURL = ::binfilter::StaticBaseUrl::RelToAbs( sTmp ); - _rxInStream >> m_sTargetFrame; - } - break; - - case 0x0002: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - - ::rtl::OUString sTmp; - _rxInStream >> sTmp; - m_sTargetURL = ::binfilter::StaticBaseUrl::RelToAbs( sTmp ); - _rxInStream >> m_sTargetFrame; - readHelpTextCompatibly(_rxInStream); - } - break; - - case 0x0003: - { - OStreamSection aSection( _rxInStream.get() ); - // this will skip any unknown bytes in it's dtor - - // button type - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - - // URL - ::rtl::OUString sTmp; - _rxInStream >> sTmp; - m_sTargetURL = ::binfilter::StaticBaseUrl::RelToAbs( sTmp ); - - // target frame - _rxInStream >> m_sTargetFrame; - - // help text - readHelpTextCompatibly(_rxInStream); - - // DispatchInternal - sal_Bool bDispath; - _rxInStream >> bDispath; - setDispatchUrlInternal(bDispath); - } - break; - - default: - DBG_ERROR("OButtonModel::read : unknown version !"); - m_eButtonType = FormButtonType_PUSH; - m_sTargetURL = ::rtl::OUString(); - m_sTargetFrame = ::rtl::OUString(); - break; - } -} - -//================================================================== -// OButtonControl -//================================================================== -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OButtonControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OButtonControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OButtonControl::_getTypes() -{ - return ::comphelper::concatSequences( - OButtonControl_BASE::getTypes(), OImageControl::_getTypes() - ); -} - -//------------------------------------------------------------------------------ -StringSequence OButtonControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_COMMANDBUTTON; - return aSupported; -} - -//------------------------------------------------------------------------------ -OButtonControl::OButtonControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OImageControl(_rxFactory, VCL_CONTROL_COMMANDBUTTON) - ,nClickEvent(0) -{ - increment(m_refCount); - { - // als ActionListener anmelden - Reference<XButton> xButton; - query_aggregation( m_xAggregate, xButton); - if (xButton.is()) - xButton->addActionListener(this); - } - // Refcount bei 1 fuer Listener - sal_Int32 n = decrement(m_refCount); -} - -//------------------------------------------------------------------------------ -OButtonControl::~OButtonControl() -{ - if (nClickEvent) - Application::RemoveUserEvent(nClickEvent); -} - -// UNO Anbindung -//------------------------------------------------------------------------------ -Any SAL_CALL OButtonControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - // if asked for the XTypeProvider, don't let OButtonControl_BASE do this - Any aReturn; - if ( !_rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >( NULL ) ) ) ) - aReturn = OButtonControl_BASE::queryInterface( _rType ); - - if ( !aReturn.hasValue() ) - aReturn = OImageControl::queryAggregation( _rType ); - - return aReturn; -} - -// ActionListener -//------------------------------------------------------------------------------ -void OButtonControl::actionPerformed(const ActionEvent& rEvent) throw ( ::com::sun::star::uno::RuntimeException) -{ - // Asynchron fuer starutil::URL-Button - sal_uInt32 n = Application::PostUserEvent( LINK(this, OButtonControl,OnClick) ); - { - ::osl::MutexGuard aGuard( m_aMutex ); - nClickEvent = n; - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK( OButtonControl, OnClick, void*, EMPTYARG ) -{ - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - nClickEvent = 0; - - if (m_aApproveActionListeners.getLength()) - { - // Wenn es ApproveAction-Lisener gibt, muss ein eigener Thread - // aufgemacht werden. - if( !m_pThread ) - { - m_pThread = new OImageControlThread_Impl( this ); - m_pThread->acquire(); - m_pThread->create(); - } - m_pThread->addEvent(); - } - else - { - // Sonst nicht. Dann darf man aber auf keinen Fal die Listener - // benachrichtigen, auch dann nicht, wenn er spaeter hinzukommt. - aGuard.clear(); - - // recognize the button type - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (!xSet.is()) - return 0L; - - if (FormButtonType_PUSH == *(FormButtonType*)xSet->getPropertyValue(PROPERTY_BUTTONTYPE).getValue()) - { - // notify the action listeners for a push button - ::cppu::OInterfaceIteratorHelper aIter(m_aActionListeners); - ActionEvent aEvt(static_cast<XWeak*>(this), m_aActionCommand); - while(aIter.hasMoreElements() ) - { - // catch exceptions - // and catch them on a per-listener basis - if one listener fails, the others still need - // to get notified - // 97676 - 21.02.2002 - fs@openoffice.org - try - { - static_cast< XActionListener* >( aIter.next() )->actionPerformed(aEvt); - } -#ifdef DBG_UTIL - catch( const RuntimeException& ) - { - // silent this - } -#endif - catch( const Exception& ) - { - DBG_ERROR( "OButtonControl::OnClick: caught a exception other than RuntimeException!" ); - } - } - } - else - actionPerformed_Impl( sal_False ); - } - return 0L; -} - -// XButton -//------------------------------------------------------------------------------ -void OButtonControl::setLabel(const ::rtl::OUString& Label) throw( RuntimeException ) -{ - Reference<XButton> xButton; - query_aggregation( m_xAggregate, xButton ); - if (xButton.is()) - xButton->setLabel(Label); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::setActionCommand(const ::rtl::OUString& _rCommand) throw( RuntimeException ) -{ - { - ::osl::MutexGuard aGuard( m_aMutex ); - m_aActionCommand = _rCommand; - } - - Reference<XButton> xButton; - query_aggregation( m_xAggregate, xButton); - if (xButton.is()) - xButton->setActionCommand(_rCommand); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::addActionListener(const Reference<XActionListener>& _rxListener) throw( RuntimeException ) -{ - m_aActionListeners.addInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OButtonControl::removeActionListener(const Reference<XActionListener>& _rxListener) throw( RuntimeException ) -{ - m_aActionListeners.removeInterface(_rxListener); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_CheckBox.cxx b/binfilter/bf_forms/source/component/forms_CheckBox.cxx deleted file mode 100644 index 9c61b22bcb19..000000000000 --- a/binfilter/bf_forms/source/component/forms_CheckBox.cxx +++ /dev/null @@ -1,465 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "CheckBox.hxx" -#include "property.hrc" -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -//= OCheckBoxControl -//================================================================== - -//------------------------------------------------------------------ -OCheckBoxControl::OCheckBoxControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_CHECKBOX) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OCheckBoxControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OCheckBoxControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCheckBoxControl::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_CHECKBOX; - return aSupported; -} - -//================================================================== -//= OCheckBoxModel -//================================================================== - -//================================================================== -InterfaceRef SAL_CALL OCheckBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OCheckBoxModel(_rxFactory)); -} - -//------------------------------------------------------------------ -DBG_NAME( OCheckBoxModel ) -//------------------------------------------------------------------ -OCheckBoxModel::OCheckBoxModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_CHECKBOX, FRM_CONTROL_CHECKBOX, sal_False, sal_False) - // use the old control name for compytibility reasons - ,OPropertyChangeListener(m_aMutex) - ,m_bInReset(sal_False) - ,m_pAggregatePropertyMultiplexer(NULL) -{ - DBG_CTOR( OCheckBoxModel, NULL ); - implConstruct(); - - m_nClassId = FormComponentType::CHECKBOX; - m_nDefaultChecked = CB_NOCHECK; - m_sDataFieldConnectivityProperty = PROPERTY_STATE; -} - -//------------------------------------------------------------------ -OCheckBoxModel::OCheckBoxModel( const OCheckBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OBoundControlModel( _pOriginal, _rxFactory, sal_False, sal_False ) - ,OPropertyChangeListener( m_aMutex ) - ,m_bInReset( sal_False ) - ,m_pAggregatePropertyMultiplexer( NULL ) -{ - DBG_CTOR( OCheckBoxModel, NULL ); - implConstruct(); - - m_nDefaultChecked = _pOriginal->m_nDefaultChecked; - m_sReferenceValue = _pOriginal->m_sReferenceValue; -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::implConstruct() -{ - increment( m_refCount ); - if ( m_xAggregateSet.is() ) - { - m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet, sal_False ); - m_pAggregatePropertyMultiplexer->acquire(); - m_pAggregatePropertyMultiplexer->addProperty( PROPERTY_STATE ); - } - decrement( m_refCount ); - - doSetDelegator(); -} - -//------------------------------------------------------------------------------ -OCheckBoxModel::~OCheckBoxModel() -{ - doResetDelegator(); - - if (m_pAggregatePropertyMultiplexer) - { - m_pAggregatePropertyMultiplexer->dispose(); - m_pAggregatePropertyMultiplexer->release(); - m_pAggregatePropertyMultiplexer = NULL; - } - DBG_DTOR( OCheckBoxModel, NULL ); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OCheckBoxModel ) - -//------------------------------------------------------------------------------ -void SAL_CALL OCheckBoxModel::disposing() -{ - if (m_pAggregatePropertyMultiplexer) - m_pAggregatePropertyMultiplexer->dispose(); - - OBoundControlModel::disposing(); -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::_propertyChanged(const PropertyChangeEvent& _rEvent) throw(RuntimeException) -{ - // as we aren't commitable we have to take care of the field we are bound to ourself - osl::MutexGuard aGuard(m_aMutex); - if (getField().is() && !m_bInReset) - { - - sal_uInt16 nState; - _rEvent.NewValue >>= nState; - switch (nState) - { - case CB_DONTKNOW: - m_xColumnUpdate->updateNull(); - break; - case CB_CHECK: - m_xColumnUpdate->updateBoolean(sal_True); - break; - case CB_NOCHECK: - m_xColumnUpdate->updateBoolean(sal_False); - break; - default: - DBG_ERROR("OCheckBoxModel::_commit : invalid value !"); - } - } -} - - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCheckBoxModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_CHECKBOX; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_CHECKBOX; - return aSupported; -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const -{ - switch (_nHandle) - { - case PROPERTY_ID_REFVALUE: _rValue <<= m_sReferenceValue; break; - case PROPERTY_ID_DEFAULTCHECKED : _rValue <<= m_nDefaultChecked; break; - default: - OBoundControlModel::getFastPropertyValue(_rValue, _nHandle); - } -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::uno::Exception) -{ - switch (_nHandle) - { - case PROPERTY_ID_REFVALUE : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, "OCheckBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_sReferenceValue; - break; - - case PROPERTY_ID_DEFAULTCHECKED : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_SHORT, "OCheckBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_nDefaultChecked; - _reset(); - break; - - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OCheckBoxModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_REFVALUE : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_sReferenceValue); - break; - case PROPERTY_ID_DEFAULTCHECKED : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_nDefaultChecked); - break; - default: - bModified = OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OCheckBoxModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& OCheckBoxModel::getInfoHelper() -{ - return *const_cast<OCheckBoxModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(10) - // the "State" property is transient, so change this -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_STATE, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(REFVALUE, ::rtl::OUString, BOUND); - DECL_PROP1(DEFAULTCHECKED, sal_Int16, BOUND); - DECL_PROP1(NAME, rtl::OUString, BOUND); - DECL_PROP1(TAG, rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OCheckBoxModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_CHECKBOX; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OCheckBoxModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::write(_rxOutStream); - - // Version - _rxOutStream->writeShort(0x0003); - // Properties - _rxOutStream << m_sReferenceValue; - _rxOutStream << (sal_Int16)m_nDefaultChecked; - writeHelpTextCompatibly(_rxOutStream); - // from version 0x0003 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OCheckBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::read(_rxInStream); - osl::MutexGuard aGuard(m_aMutex); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - - switch (nVersion) - { - case 0x0001 : _rxInStream >> m_sReferenceValue; m_nDefaultChecked = _rxInStream->readShort(); break; - case 0x0002 : - _rxInStream >> m_sReferenceValue; - _rxInStream >> m_nDefaultChecked; - readHelpTextCompatibly(_rxInStream); - break; - case 0x0003 : - _rxInStream >> m_sReferenceValue; - _rxInStream >> m_nDefaultChecked; - readHelpTextCompatibly(_rxInStream); - readCommonProperties(_rxInStream); - break; - default : - DBG_ERROR("OCheckBoxModel::read : unknown version !"); - m_sReferenceValue = ::rtl::OUString(); - m_nDefaultChecked = 0; - defaultCommonProperties(); - break; - } - - // Nach dem Lesen die Defaultwerte anzeigen - if (m_aControlSource.getLength()) - // (not if we don't have a control source - the "State" property acts like it is persistent, then - _reset(); -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::_loaded(const EventObject& rEvent) -{ - OBoundControlModel::_loaded(rEvent); -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::_onValueChanged() -{ - ////////////////////////////////////////////////////////////////// - // Wert an ControlModel setzen - if (m_xAggregateSet.is()) - { - Any aValue; - sal_Bool bValue = m_xColumn->getBoolean(); - if (m_xColumn->wasNull()) - { - sal_Bool bTriState; - m_xAggregateSet->getPropertyValue(PROPERTY_TRISTATE) >>= bTriState; - aValue <<= (sal_Int16)(bTriState ? CB_DONTKNOW : m_nDefaultChecked); - } - else - aValue <<= ( bValue ? (sal_Int16)CB_CHECK : (sal_Int16)CB_NOCHECK ); - m_bInReset = sal_True; - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateSet->setPropertyValue(PROPERTY_STATE, aValue); - } - m_bInReset = sal_False; - } -} - -//------------------------------------------------------------------------------ -Any OCheckBoxModel::_getControlValue() const -{ - return m_xAggregateSet->getPropertyValue(PROPERTY_STATE); -} - -//------------------------------------------------------------------------------ -void OCheckBoxModel::_reset( void ) -{ - Any aValue; - aValue <<= (sal_Int16)m_nDefaultChecked; - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateSet->setPropertyValue(PROPERTY_STATE, aValue); - } -} - -//----------------------------------------------------------------------------- -sal_Bool OCheckBoxModel::_commit() -{ - if (!m_bInReset) - // normally we don't have a commit as we forward all state changes immediately to our field we're bound to - return sal_True; - - // we're in reset, so this commit means "put the value into the field you're bound to" - // 72769 - 08.02.00 - FS - DBG_ASSERT(getField().is(), "OCheckBoxModel::_commit : committing while resetting, but not bound ?"); - if (getField().is()) - { - try - { - sal_Int16 nValue; - m_xAggregateSet->getPropertyValue(PROPERTY_STATE) >>= nValue; - switch (nValue) - { - case CB_DONTKNOW: - m_xColumnUpdate->updateNull(); - break; - case CB_CHECK: - m_xColumnUpdate->updateBoolean(sal_True); - break; - case CB_NOCHECK: - m_xColumnUpdate->updateBoolean(sal_False); - break; - default: - DBG_ERROR("OCheckBoxModel::_commit : invalid value !"); - } - } - catch(Exception&) - { - DBG_ERROR("OCheckBoxModel::_commit : could not commit !"); - } - } - return sal_True; -} - -//----------------------------------------------------------------------------- -void OCheckBoxModel::reset(void) throw (com::sun::star::uno::RuntimeException) -{ - m_bInReset = sal_True; - OBoundControlModel::reset(); - m_bInReset = sal_False; -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Columns.cxx b/binfilter/bf_forms/source/component/forms_Columns.cxx deleted file mode 100644 index d02c2d0c5dd5..000000000000 --- a/binfilter/bf_forms/source/component/forms_Columns.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. - * - ************************************************************************/ - -#include "Columns.hxx" -#include "property.hrc" -#include "property.hxx" -#include "ids.hxx" - -#include <com/sun/star/io/XMarkableStream.hpp> -#include <com/sun/star/form/XFormComponent.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <comphelper/property.hxx> -#include <comphelper/basicio.hxx> - -#include "services.hxx" -#include "frm_resource.hrc" -#include <rtl/uuid.h> -#include <rtl/memory.h> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -namespace binfilter { - -namespace internal { -sal_Int32 findPos(const ::rtl::OUString& aStr, const StringSequence& rList); -} - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; - -const sal_uInt16 WIDTH = 0x0001; -const sal_uInt16 ALIGN = 0x0002; -const sal_uInt16 OLD_HIDDEN = 0x0004; -const sal_uInt16 COMPATIBLE_HIDDEN = 0x0008; - -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_TEXTFIELD, "TextField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_COMBOBOX, "ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_CHECKBOX, "CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_TIMEFIELD, "TimeField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_DATEFIELD, "DateField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_NUMERICFIELD, "NumericField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_CURRENCYFIELD, "CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_PATTERNFIELD, "PatternField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_LISTBOX, "ListBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COL_FORMATTEDFIELD, "FormattedField"); - -//------------------------------------------------------------------------------ -const StringSequence& getColumnTypes() -{ - static StringSequence aColumnTypes(10); - if (!aColumnTypes.getConstArray()[0].getLength()) - { - ::rtl::OUString* pNames = aColumnTypes.getArray(); - pNames[TYPE_CHECKBOX] = FRM_COL_CHECKBOX; - pNames[TYPE_COMBOBOX] = FRM_COL_COMBOBOX; - pNames[TYPE_CURRENCYFIELD] = FRM_COL_CURRENCYFIELD; - pNames[TYPE_DATEFIELD] = FRM_COL_DATEFIELD; - pNames[TYPE_FORMATTEDFIELD] = FRM_COL_FORMATTEDFIELD; - pNames[TYPE_LISTBOX] = FRM_COL_LISTBOX; - pNames[TYPE_NUMERICFIELD] = FRM_COL_NUMERICFIELD; - pNames[TYPE_PATTERNFIELD] = FRM_COL_PATTERNFIELD; - pNames[TYPE_TEXTFIELD] = FRM_COL_TEXTFIELD; - pNames[TYPE_TIMEFIELD] = FRM_COL_TIMEFIELD; - } - return aColumnTypes; -} - -//------------------------------------------------------------------------------ -sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName) -{ - const ::rtl::OUString aModelPrefix = ::rtl::OUString::createFromAscii("com.sun.star.form.component."); - const ::rtl::OUString aCompatibleModelPrefix = ::rtl::OUString::createFromAscii("stardiv.one.form.component."); - - sal_Int32 nTypeId = -1; - if (aModelName == FRM_COMPONENT_EDIT) - nTypeId = TYPE_TEXTFIELD; - else - { - sal_Int32 nPrefixPos = aModelName.indexOf(aModelPrefix); - sal_Int32 nCampatiblePrefixPos = aModelName.indexOf(aCompatibleModelPrefix); - DBG_ASSERT( (nPrefixPos != -1) || (nCampatiblePrefixPos != -1), - "::getColumnTypeByModelName() : wrong servivce !"); - - ::rtl::OUString aColumnType = (nPrefixPos != -1) - ? aModelName.copy(aModelPrefix.getLength()) - : aModelName.copy(aCompatibleModelPrefix.getLength()); - - const StringSequence& rColumnTypes = getColumnTypes(); - nTypeId = ::binfilter::internal::findPos(aColumnType, rColumnTypes);//STRIP008 nTypeId = ::internal::findPos(aColumnType, rColumnTypes); - } - return nTypeId; -} - -/*************************************************************************/ - -//------------------------------------------------------------------ -const Sequence<sal_Int8>& OGridColumn::getUnoTunnelImplementationId() -{ - static Sequence< sal_Int8 > * pSeq = 0; - if( !pSeq ) - { - ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -//------------------------------------------------------------------ -sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence<sal_Int8>& _rIdentifier) throw(RuntimeException) -{ - sal_Int64 nReturn(0); - - if ( (_rIdentifier.getLength() == 16) - && (0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 )) - ) - { - nReturn = reinterpret_cast<sal_Int64>(this); - } - else - { - Reference<XUnoTunnel> xAggregateTunnel(m_xAggregate, UNO_QUERY); - if (xAggregateTunnel.is()) - nReturn = xAggregateTunnel->getSomething(_rIdentifier); - } - return nReturn; -} - -//------------------------------------------------------------------ -Sequence<sal_Int8> SAL_CALL OGridColumn::getImplementationId() throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------ -Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException) -{ - Reference<XTypeProvider> xProv; - - if (query_aggregation(m_xAggregate, xProv)) - return concatSequences(OGridColumn_BASE::getTypes(), xProv->getTypes()); - return OGridColumn_BASE::getTypes(); -} - -//------------------------------------------------------------------ -Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeException) -{ - Any aReturn; - // though our aggregate may be an XFormComponent or an XServiceInfo, we aren't anymore - if ( _rType.equals(::getCppuType(static_cast< Reference< XFormComponent >* >(NULL))) - || _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) - ) - return aReturn; - - aReturn = OGridColumn_BASE::queryAggregation(_rType); - if (!aReturn.hasValue()) - { - aReturn = OPropertySetAggregationHelper::queryInterface(_rType); - if (!aReturn.hasValue() && m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - - return aReturn; -} - -DBG_NAME(OGridColumn) -//------------------------------------------------------------------------------ -OGridColumn::OGridColumn(const Reference<XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _sModelName) - :OGridColumn_BASE(m_aMutex) - ,OPropertySetAggregationHelper(OGridColumn_BASE::rBHelper) - ,m_aModelName(_sModelName) - ,m_aHidden( makeAny( sal_False ) ) -{ - DBG_CTOR(OGridColumn,NULL); - - // Anlegen des UnoControlModels - if ( m_aModelName.getLength() ) // is there a to-be-aggregated model? - { - increment( m_refCount ); - - // Muss im eigenen Block, - // da xAgg vor dem delegator setzen wieder freigesetzt sein mus ! - { - m_xAggregate = Reference< XAggregation >( _rxFactory->createInstance( m_aModelName ), UNO_QUERY ); - setAggregation( m_xAggregate ); - } - - if (m_xAggregate.is()) - { // don't omit this brackets - they ensure that the following temporary is properly deleted - m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) ); - } - - // Refcount wieder bei NULL - decrement( m_refCount ); - } - - if ( m_xAggregateSet.is() ) - { - Reference< XPropertySetInfo > xPropInfo = m_xAggregateSet->getPropertySetInfo(); - if ( xPropInfo.is() && xPropInfo->hasPropertyByName( PROPERTY_TRISTATE ) ) - m_xAggregateSet->setPropertyValue( PROPERTY_TRISTATE, makeAny( sal_True ) ); - } -} - -//------------------------------------------------------------------------------ -OGridColumn::~OGridColumn() -{ - if (!OGridColumn_BASE::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - // freigeben der Agg - if (m_xAggregate.is()) - { - InterfaceRef xIface; - m_xAggregate->setDelegator(xIface); - } - - DBG_DTOR(OGridColumn,NULL); -} - -// XCloneable -//------------------------------------------------------------------------------ -//IMPLEMENT_DEFAULT_CLONING( OGridColumn ) - -// XChild -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::setParent(const InterfaceRef& Parent) throw(NoSupportException, RuntimeException) -{ - m_xParent = Parent; -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::disposing(const EventObject& _rSource) throw(RuntimeException) -{ - OPropertySetAggregationHelper::disposing(_rSource); - - Reference<XEventListener> xEvtLstner; - if (query_aggregation(m_xAggregate, xEvtLstner)) - xEvtLstner->disposing(_rSource); -} - -// OGridColumn_BASE -//----------------------------------------------------------------------------- -void OGridColumn::disposing() -{ - OGridColumn_BASE::disposing(); - OPropertySetAggregationHelper::disposing(); - - Reference<XComponent> xComp; - if (query_aggregation(m_xAggregate, xComp)) - xComp->dispose(); - - setParent(InterfaceRef ()); -} - -//------------------------------------------------------------------------------ -void OGridColumn::clearAggregateProperties(Sequence<Property>& seqProps, sal_Bool bAllowDropDown) -{ - RemoveProperty(seqProps, PROPERTY_ALIGN); - RemoveProperty(seqProps, PROPERTY_AUTOCOMPLETE); - RemoveProperty(seqProps, PROPERTY_BACKGROUNDCOLOR); - RemoveProperty(seqProps, PROPERTY_BORDER); - if (!bAllowDropDown) - RemoveProperty(seqProps, PROPERTY_DROPDOWN); - RemoveProperty(seqProps, PROPERTY_ECHO_CHAR); - RemoveProperty(seqProps, PROPERTY_FILLCOLOR); - RemoveProperty(seqProps, PROPERTY_FONT); - RemoveProperty(seqProps, PROPERTY_FONT_NAME); - RemoveProperty(seqProps, PROPERTY_FONT_STYLENAME); - RemoveProperty(seqProps, PROPERTY_FONT_FAMILY); - RemoveProperty(seqProps, PROPERTY_FONT_CHARSET); - RemoveProperty(seqProps, PROPERTY_FONT_HEIGHT); - RemoveProperty(seqProps, PROPERTY_FONT_WEIGHT); - RemoveProperty(seqProps, PROPERTY_FONT_SLANT); - RemoveProperty(seqProps, PROPERTY_FONT_UNDERLINE); - RemoveProperty(seqProps, PROPERTY_FONT_STRIKEOUT); - RemoveProperty(seqProps, PROPERTY_FONT_WORDLINEMODE); - RemoveProperty(seqProps, PROPERTY_TEXTLINECOLOR); - RemoveProperty(seqProps, PROPERTY_FONTEMPHASISMARK); - RemoveProperty(seqProps, PROPERTY_FONTRELIEF); - RemoveProperty(seqProps, PROPERTY_HARDLINEBREAKS); - RemoveProperty(seqProps, PROPERTY_HSCROLL); - RemoveProperty(seqProps, PROPERTY_LABEL); - RemoveProperty(seqProps, PROPERTY_LINECOLOR); - RemoveProperty(seqProps, PROPERTY_MULTI); - RemoveProperty(seqProps, PROPERTY_MULTILINE); - RemoveProperty(seqProps, PROPERTY_MULTISELECTION); - RemoveProperty(seqProps, PROPERTY_PRINTABLE); - RemoveProperty(seqProps, PROPERTY_TABINDEX); - RemoveProperty(seqProps, PROPERTY_TABSTOP); - RemoveProperty(seqProps, PROPERTY_TEXTCOLOR); - RemoveProperty(seqProps, PROPERTY_TRISTATE); - RemoveProperty(seqProps, PROPERTY_VSCROLL); - RemoveProperty(seqProps, PROPERTY_CONTROLLABEL); -} - -//------------------------------------------------------------------------------ -void OGridColumn::setOwnProperties(Sequence<Property>& aDescriptor) -{ - aDescriptor.realloc(5); - Property* pProps = aDescriptor.getArray(); - sal_Int32 nPos = 0; - DECL_PROP1(LABEL, ::rtl::OUString, BOUND); - DECL_PROP3(WIDTH, sal_Int32, BOUND, MAYBEVOID, MAYBEDEFAULT); - DECL_PROP3(ALIGN, sal_Int16, BOUND, MAYBEVOID, MAYBEDEFAULT); - DECL_BOOL_PROP2(HIDDEN, BOUND, MAYBEDEFAULT); - DECL_PROP1(COLUMNSERVICENAME, ::rtl::OUString, READONLY); -} - -// Reference<XPropertySet> -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OGridColumn::getPropertySetInfo() throw(RuntimeException) -{ - DBG_ERROR("OGridColumn::getPropertySetInfo() : Dummy Called"); - return Reference<XPropertySetInfo> (); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OGridColumn::getInfoHelper() -{ - DBG_ERROR("OGridColumn::getInfoHelper() : Dummy Called"); - - Sequence<Property> aDescriptor, aAggProperties; - static OPropertyArrayAggregationHelper aDescAry(aDescriptor, aAggProperties); - return aDescAry; -} - -//------------------------------------------------------------------------------ -void OGridColumn::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_COLUMNSERVICENAME: - rValue <<= m_aModelName; - break; - case PROPERTY_ID_LABEL: - rValue <<= m_aLabel; - break; - case PROPERTY_ID_WIDTH: - rValue = m_aWidth; - break; - case PROPERTY_ID_ALIGN: - rValue = m_aAlign; - break; - case PROPERTY_ID_HIDDEN: - rValue = m_aHidden; - break; - default: - OPropertySetAggregationHelper::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, - sal_Int32 nHandle, const Any& rValue )throw( IllegalArgumentException ) -{ - sal_Bool bModified(sal_False); - switch (nHandle) - { - case PROPERTY_ID_LABEL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aLabel); - break; - case PROPERTY_ID_WIDTH: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth, ::getCppuType((const sal_Int32*)NULL)); - break; - case PROPERTY_ID_ALIGN: - try - { - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType((const sal_Int16*)NULL)); - } - catch(starlang::IllegalArgumentException&) - { - OSL_ENSURE(0,"OGridColumn::convertFastPropertyValue: TextAlign must be casted to sal_Int16!"); - throw; - } - break; - case PROPERTY_ID_HIDDEN: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getBOOL(m_aHidden)); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OGridColumn::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (::com::sun::star::uno::Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_LABEL: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" ); - rValue >>= m_aLabel; - break; - case PROPERTY_ID_WIDTH: - m_aWidth = rValue; - break; - case PROPERTY_ID_ALIGN: - m_aAlign = rValue; - break; - case PROPERTY_ID_HIDDEN: - m_aHidden = rValue; - break; - } -} - - -// XPropertyState -//------------------------------------------------------------------------------ -PropertyState OGridColumn::getPropertyStateByHandle(sal_Int32 nHandle) -{ - PropertyState eState = PropertyState_DIRECT_VALUE; - - switch (nHandle) - { - case PROPERTY_ID_WIDTH: - if (!m_aWidth.hasValue()) - eState = PropertyState_DEFAULT_VALUE; - break; - - case PROPERTY_ID_ALIGN: - if (!m_aAlign.hasValue()) - eState = PropertyState_DEFAULT_VALUE; - break; - - case PROPERTY_ID_HIDDEN: - { - sal_Bool bHidden = sal_True; - if ( ( m_aHidden >>= bHidden ) && !bHidden ) - eState = PropertyState_DEFAULT_VALUE; - } - break; - - default: - eState = OPropertySetAggregationHelper::getPropertyStateByHandle(nHandle); - } - return eState; -} - -//------------------------------------------------------------------------------ -void OGridColumn::setPropertyToDefaultByHandle(sal_Int32 nHandle) -{ - switch (nHandle) - { - case PROPERTY_ID_WIDTH: - case PROPERTY_ID_ALIGN: - setFastPropertyValue(nHandle, Any()); - break; - case PROPERTY_ID_HIDDEN: - setFastPropertyValue( nHandle, makeAny( (sal_Bool)sal_False ) ); - break; - default: - OPropertySetAggregationHelper::setPropertyToDefaultByHandle(nHandle); - } -} - -//------------------------------------------------------------------------------ -Any OGridColumn::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_WIDTH: - case PROPERTY_ID_ALIGN: - return Any(); - case PROPERTY_ID_HIDDEN: - return makeAny((sal_Bool)sal_False); - default: - return OPropertySetAggregationHelper::getPropertyDefaultByHandle(nHandle); - } -} - -//XPersistObject -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::write(const Reference<XObjectOutputStream>& _rxOutStream) -{ - // 1. Schreiben des UnoControls - Reference<XMarkableStream> xMark(_rxOutStream, UNO_QUERY); - sal_Int32 nMark = xMark->createMark(); - - sal_Int32 nLen = 0; - _rxOutStream->writeLong(nLen); - - Reference<XPersistObject> xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->write(_rxOutStream); - - // feststellen der Laenge - nLen = xMark->offsetToMark(nMark) - 4; - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); - - // 2. Schreiben einer VersionsNummer - _rxOutStream->writeShort(0x0002); - - sal_uInt16 nAnyMask = 0; - if (m_aWidth.getValueType().getTypeClass() == TypeClass_LONG) - nAnyMask |= WIDTH; - - if (m_aAlign.getValueTypeClass() == TypeClass_SHORT) - nAnyMask |= ALIGN; - - nAnyMask |= COMPATIBLE_HIDDEN; - - _rxOutStream->writeShort(nAnyMask); - - if (nAnyMask & WIDTH) - _rxOutStream->writeLong(getINT32(m_aWidth)); - if (nAnyMask & ALIGN) - _rxOutStream->writeShort(getINT16(m_aAlign)); - - // Name - _rxOutStream << m_aLabel; - - // the new place for the hidden flag : after m_aLabel, so older office version read the correct label, too - if (nAnyMask & COMPATIBLE_HIDDEN) - _rxOutStream->writeBoolean(getBOOL(m_aHidden)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridColumn::read(const Reference<XObjectInputStream>& _rxInStream) -{ - // 1. Lesen des UnoControls - sal_Int32 nLen = _rxInStream->readLong(); - if (nLen) - { - Reference<XMarkableStream> xMark(_rxInStream, UNO_QUERY); - sal_Int32 nMark = xMark->createMark(); - Reference<XPersistObject> xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->read(_rxInStream); - - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nLen); - xMark->deleteMark(nMark); - } - - // 2. Lesen des Versionsnummer - sal_uInt16 nVersion = _rxInStream->readShort(); - sal_uInt16 nAnyMask = _rxInStream->readShort(); - - if (nAnyMask & WIDTH) - { - sal_Int32 nValue = _rxInStream->readLong(); - m_aWidth <<= (sal_Int32)nValue; - } - - if (nAnyMask & ALIGN) - { - sal_Int16 nValue = _rxInStream->readShort(); - m_aAlign <<= nValue; - } - if (nAnyMask & OLD_HIDDEN) - { - sal_Bool bValue = _rxInStream->readBoolean(); - m_aHidden <<= (sal_Bool)bValue; - } - - // Name - _rxInStream >> m_aLabel; - - if (nAnyMask & COMPATIBLE_HIDDEN) - { - sal_Bool bValue = _rxInStream->readBoolean(); - m_aHidden <<= (sal_Bool)bValue; - } -} - -//------------------------------------------------------------------------------ -IMPL_COLUMN(TextFieldColumn, FRM_SUN_COMPONENT_TEXTFIELD, sal_False); -IMPL_COLUMN(PatternFieldColumn, FRM_SUN_COMPONENT_PATTERNFIELD, sal_False); -IMPL_COLUMN(DateFieldColumn, FRM_SUN_COMPONENT_DATEFIELD, sal_True); -IMPL_COLUMN(TimeFieldColumn, FRM_SUN_COMPONENT_TIMEFIELD, sal_False); -IMPL_COLUMN(NumericFieldColumn, FRM_SUN_COMPONENT_NUMERICFIELD, sal_False); -IMPL_COLUMN(CurrencyFieldColumn, FRM_SUN_COMPONENT_CURRENCYFIELD, sal_False); -IMPL_COLUMN(CheckBoxColumn, FRM_SUN_COMPONENT_CHECKBOX, sal_False); -IMPL_COLUMN(ComboBoxColumn, FRM_SUN_COMPONENT_COMBOBOX, sal_False); -IMPL_COLUMN(ListBoxColumn, FRM_SUN_COMPONENT_LISTBOX, sal_False); -IMPL_COLUMN(FormattedFieldColumn, FRM_SUN_COMPONENT_FORMATTEDFIELD, sal_False); - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_ComboBox.cxx b/binfilter/bf_forms/source/component/forms_ComboBox.cxx deleted file mode 100644 index 42a25ced0323..000000000000 --- a/binfilter/bf_forms/source/component/forms_ComboBox.cxx +++ /dev/null @@ -1,845 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "ComboBox.hxx" -#include "property.hrc" -#include "services.hxx" -#include "frm_resource.hxx" -#include "frm_resource.hrc" -#include "BaseListBox.hxx" -#include <comphelper/numbers.hxx> -#include <connectivity/dbtools.hxx> -#include <connectivity/dbconversion.hxx> - -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> -#include <com/sun/star/sdb/XQueriesSupplier.hpp> -#include <com/sun/star/util/NumberFormat.hpp> -#include <com/sun/star/sdbc/XConnection.hpp> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> - -#include <limits.h> - -namespace binfilter { - - using namespace ::dbtools; - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//======================================================================== -// class OComboBoxModel -//======================================================================== -sal_Int32 OComboBoxModel::nTextHandle = -1; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OComboBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return (*new OComboBoxModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OComboBoxModel::_getTypes() -{ - return ::comphelper::concatSequences( - OBoundControlModel::_getTypes(), - OErrorBroadcaster::getTypes() - ); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OComboBoxModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_COMBOBOX; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_COMBOBOX; - return aSupported; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OComboBoxModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControlModel::queryAggregation( _rType ); - return aReturn.hasValue() ? aReturn : OErrorBroadcaster::queryInterface( _rType ); -} - -//------------------------------------------------------------------ -DBG_NAME( OComboBoxModel ) -//------------------------------------------------------------------ -OComboBoxModel::OComboBoxModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_COMBOBOX, FRM_CONTROL_COMBOBOX) - // use the old control name for compytibility reasons - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_eListSourceType(ListSourceType_TABLE) - ,m_bEmptyIsNull(sal_True) - ,m_aNullDate(DBTypeConversion::getStandardDate()) - ,m_nKeyType(NumberFormat::UNDEFINED) - ,m_nFormatKey(0) - ,m_nFieldType(DataType::OTHER) -{ - DBG_CTOR( OComboBoxModel, NULL ); - - m_nClassId = FormComponentType::COMBOBOX; - m_sDataFieldConnectivityProperty = PROPERTY_TEXT; - if (OComboBoxModel::nTextHandle == -1) - OComboBoxModel::nTextHandle = getOriginalHandle(PROPERTY_ID_TEXT); -} - -//------------------------------------------------------------------ -OComboBoxModel::OComboBoxModel( const OComboBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OBoundControlModel( _pOriginal, _rxFactory ) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aNullDate(DBTypeConversion::getStandardDate()) - ,m_nKeyType(NumberFormat::UNDEFINED) - ,m_nFormatKey(0) - ,m_nFieldType(DataType::OTHER) -{ - DBG_CTOR( OComboBoxModel, NULL ); - - m_eListSourceType = _pOriginal->m_eListSourceType; - m_bEmptyIsNull = _pOriginal->m_bEmptyIsNull; - m_aListSource = _pOriginal->m_aListSource; - m_aDefaultText = _pOriginal->m_aDefaultText; -} - -//------------------------------------------------------------------ -OComboBoxModel::~OComboBoxModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR( OComboBoxModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OComboBoxModel ) - -//------------------------------------------------------------------------------ -void OComboBoxModel::disposing() -{ - OBoundControlModel::disposing(); - OErrorBroadcaster::disposing(); - m_xFormatter = NULL; -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const -{ - switch (_nHandle) - { - case PROPERTY_ID_LISTSOURCETYPE : _rValue <<= m_eListSourceType; break; - case PROPERTY_ID_LISTSOURCE : _rValue <<= m_aListSource; break; - case PROPERTY_ID_EMPTY_IS_NULL : _rValue <<= m_bEmptyIsNull; break; - case PROPERTY_ID_DEFAULT_TEXT : _rValue <<= m_aDefaultText; break; - default: - OBoundControlModel::getFastPropertyValue(_rValue, _nHandle); - } -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) - throw (Exception) -{ - switch (_nHandle) - { - case PROPERTY_ID_LISTSOURCETYPE : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<ListSourceType*>(NULL))), - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_eListSourceType; - break; - - case PROPERTY_ID_LISTSOURCE : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aListSource; - // die ListSource hat sich geaendert -> neu laden - if (ListSourceType_VALUELIST != m_eListSourceType) - { - if (m_xCursor.is() && !getField().is()) // combobox bereits mit Datenbank verbunden ? - // neu laden - loadData(); - } - break; - - case PROPERTY_ID_EMPTY_IS_NULL : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_bEmptyIsNull; - break; - - case PROPERTY_ID_DEFAULT_TEXT : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aDefaultText; - _reset(); - break; - - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OComboBoxModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_LISTSOURCETYPE : - bModified = tryPropertyValueEnum(_rConvertedValue, _rOldValue, _rValue, m_eListSourceType); - break; - - case PROPERTY_ID_LISTSOURCE : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aListSource); - break; - - case PROPERTY_ID_EMPTY_IS_NULL : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_bEmptyIsNull); - break; - - case PROPERTY_ID_DEFAULT_TEXT : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aDefaultText); - break; - - default: - bModified = OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OComboBoxModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& OComboBoxModel::getInfoHelper() -{ - return *const_cast<OComboBoxModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(12) - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(LISTSOURCETYPE, ListSourceType, BOUND); - DECL_PROP1(LISTSOURCE, ::rtl::OUString, BOUND); - DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND); - DECL_PROP1(DEFAULT_TEXT, ::rtl::OUString, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OComboBoxModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_COMBOBOX; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OComboBoxModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::write(_rxOutStream); - - // Version - // Version 0x0002: EmptyIsNull - // Version 0x0003: ListSource->Seq - // Version 0x0004: DefaultText - // Version 0x0005: HelpText - _rxOutStream->writeShort(0x0006); - - // Maskierung fuer any - sal_uInt16 nAnyMask = 0; - if (m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT) - nAnyMask |= BOUNDCOLUMN; - _rxOutStream << nAnyMask; - - StringSequence aListSourceSeq(&m_aListSource, 1); - _rxOutStream << aListSourceSeq; - _rxOutStream << (sal_Int16)m_eListSourceType; - - if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) - { - sal_Int16 nBoundColumn; - m_aBoundColumn >>= nBoundColumn; - _rxOutStream << nBoundColumn; - } - - _rxOutStream << (sal_Bool)m_bEmptyIsNull; - _rxOutStream << m_aDefaultText; - writeHelpTextCompatibly(_rxOutStream); - - // from version 0x0006 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OComboBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::read(_rxInStream); - ::osl::MutexGuard aGuard(m_aMutex); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - DBG_ASSERT(nVersion > 0, "OComboBoxModel::read : version 0 ? this should never have been written !"); - - if (nVersion > 0x0006) - { - DBG_ERROR("OComboBoxModel::read : invalid (means unknown) version !"); - m_aListSource = ::rtl::OUString(); - m_aBoundColumn <<= (sal_Int16)0; - m_aDefaultText = ::rtl::OUString(); - m_eListSourceType = ListSourceType_TABLE; - m_bEmptyIsNull = sal_True; - defaultCommonProperties(); - return; - } - - // Maskierung fuer any - sal_uInt16 nAnyMask; - _rxInStream >> nAnyMask; - - // ListSource - if (nVersion < 0x0003) - { - ::rtl::OUString sListSource; - _rxInStream >> m_aListSource; - } - else // nVersion == 4 - { - m_aListSource = ::rtl::OUString(); - StringSequence aListSource; - _rxInStream >> aListSource; - const ::rtl::OUString* pToken = aListSource.getConstArray(); - sal_Int32 nLen = aListSource.getLength(); - for (sal_Int32 i = 0; i < nLen; ++i, ++pToken) - m_aListSource += *pToken; - } - - sal_Int16 nValue; - _rxInStream >> nValue; - m_eListSourceType = (ListSourceType)nValue; - - if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) - { - sal_Int16 nValue; - _rxInStream >> nValue; - m_aBoundColumn <<= nValue; - } - - if (nVersion > 0x0001) - { - sal_Bool bNull; - _rxInStream >> bNull; - m_bEmptyIsNull = bNull; - } - - if (nVersion > 0x0003) // nVersion == 4 - _rxInStream >> m_aDefaultText; - - // Stringliste muss geleert werden, wenn eine Listenquelle gesetzt ist - // dieses kann der Fall sein wenn im alive modus gespeichert wird - if (m_aListSource.getLength() && m_xAggregateSet.is()) - { - StringSequence aSequence; - m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, makeAny(aSequence)); - } - - if (nVersion > 0x0004) - readHelpTextCompatibly(_rxInStream); - - if (nVersion > 0x0005) - readCommonProperties(_rxInStream); - - // Nach dem Lesen die Defaultwerte anzeigen - if (m_aControlSource.getLength()) - { - // (not if we don't have a control source - the "State" property acts like it is persistent, then - _reset(); - } -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::loadData() -{ - DBG_ASSERT(m_eListSourceType != ListSourceType_VALUELIST, "OComboBoxModel::loadData : do not call for a value list !"); - //// - // Connection holen - Reference<XRowSet> xForm(m_xCursor, UNO_QUERY); - if (!xForm.is()) - return; - Reference<XConnection> xConnection = getConnection(xForm); - if (!xConnection.is()) - return; - - // we need a com::sun::star::sdb::Connection for some of the code below ... - Reference<XServiceInfo> xServiceInfo(xConnection, UNO_QUERY); - if (!xServiceInfo.is() || !xServiceInfo->supportsService(SRV_SDB_CONNECTION)) - { - DBG_ERROR("OComboBoxModel::loadData : invalid connection !"); - return; - } - - Reference<XStatement> xStmt; - Reference<XResultSet> xListCursor; - - if (!m_aListSource.getLength() || m_eListSourceType == ListSourceType_VALUELIST) - return; - - try - { - switch (m_eListSourceType) - { - case ListSourceType_TABLEFIELDS: - // don't work with a statement here, the fields will be collected below - break; - case ListSourceType_TABLE: - { - // does the bound field belong to the table ? - // if we use an alias for the bound field, we won't find it - // in that case we use the first field of the table - - Reference<XNameAccess> xFieldsByName = getTableFields(xConnection, m_aListSource); - Reference<XIndexAccess> xFieldsByIndex(xFieldsByName, UNO_QUERY); - - ::rtl::OUString aFieldName; - if (xFieldsByName.is() && xFieldsByName->hasByName(m_aControlSource)) - { - aFieldName = m_aControlSource; - } - else - { - // otherwise look for the alias - Reference<XSQLQueryComposerFactory> xFactory(xConnection, UNO_QUERY); - if (!xFactory.is()) - break; - - Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer(); - try - { - Reference<XPropertySet> xFormAsSet(xForm, UNO_QUERY); - ::rtl::OUString aStatement; - xFormAsSet->getPropertyValue(PROPERTY_ACTIVECOMMAND) >>= aStatement; - xComposer->setQuery(aStatement); - } - catch(Exception&) - { - disposeComponent(xComposer); - break; - } - - // search the field - Reference<XColumnsSupplier> xSupplyFields(xComposer, UNO_QUERY); - DBG_ASSERT(xSupplyFields.is(), "OComboBoxModel::loadData : invalid query composer !"); - - Reference<XNameAccess> xFieldNames = xSupplyFields->getColumns(); - if (xFieldNames->hasByName(m_aControlSource)) - { - Reference<XPropertySet> xComposerFieldAsSet(*(Reference<XPropertySet>*)xFieldNames->getByName(m_aControlSource).getValue()); - if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet)) - xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName; - } - - disposeComponent(xComposer); - } - - if (!aFieldName.getLength()) - break; - - Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData(); - ::rtl::OUString aQuote = xMeta->getIdentifierQuoteString(); - ::rtl::OUString aStatement = ::rtl::OUString::createFromAscii("SELECT DISTINCT "); - - aStatement += quoteName(aQuote, aFieldName); - aStatement += ::rtl::OUString::createFromAscii(" FROM "); - aStatement += quoteTableName(xMeta, m_aListSource,::dbtools::eInDataManipulation); - - xStmt = xConnection->createStatement(); - xListCursor = xStmt->executeQuery(aStatement); - } break; - case ListSourceType_QUERY: - { - Reference<XQueriesSupplier> xSupplyQueries(xConnection, UNO_QUERY); - Reference<XPropertySet> xQuery(*(InterfaceRef*)xSupplyQueries->getQueries()->getByName(m_aListSource).getValue(), UNO_QUERY); - xStmt = xConnection->createStatement(); - Reference<XPropertySet>(xStmt, UNO_QUERY)->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)); - - ::rtl::OUString sStatement; - xQuery->getPropertyValue(PROPERTY_COMMAND) >>= sStatement; - xListCursor = xStmt->executeQuery(sStatement); - } break; - default: - { - xStmt = xConnection->createStatement(); - if (ListSourceType_SQLPASSTHROUGH == m_eListSourceType) - { - Reference<XPropertySet> xStatementProps(xStmt, UNO_QUERY); - xStatementProps->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny(sal_Bool(sal_False))); - } - xListCursor = xStmt->executeQuery(m_aListSource); - } - } - } - catch(SQLException& eSQL) - { - onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST)); - disposeComponent(xListCursor); - disposeComponent(xStmt); - return; - } - catch(Exception& eUnknown) - { - eUnknown; - disposeComponent(xListCursor); - disposeComponent(xStmt); - return; - } - - if (ListSourceType_TABLEFIELDS != m_eListSourceType && !xListCursor.is()) - // something went wrong ... - return; - - ::std::vector< ::rtl::OUString > aStringList; - aStringList.reserve(16); - try - { - switch (m_eListSourceType) - { - case ListSourceType_SQL: - case ListSourceType_SQLPASSTHROUGH: - case ListSourceType_TABLE: - case ListSourceType_QUERY: - { - // die XDatabaseVAriant der ersten Spalte - Reference<XColumnsSupplier> xSupplyCols(xListCursor, UNO_QUERY); - DBG_ASSERT(xSupplyCols.is(), "OComboBoxModel::loadData : cursor supports the row set service but is no column supplier ??!"); - Reference<XIndexAccess> xColumns; - if (xSupplyCols.is()) - { - xColumns = Reference<XIndexAccess>(xSupplyCols->getColumns(), UNO_QUERY); - DBG_ASSERT(xColumns.is(), "OComboBoxModel::loadData : no columns supplied by the row set !"); - } - Reference<XColumn> xDataField; - if (xColumns.is()) - xDataField = Reference<XColumn>(*(InterfaceRef*)xColumns->getByIndex(0).getValue(), UNO_QUERY); - if (!xDataField.is()) - { - disposeComponent(xListCursor); - return; - } - - // Listen fuellen - sal_Int16 i = 0; - // per definitionem the list cursor is positioned _before_ the first row at the moment - while (xListCursor->next() && (i++<SHRT_MAX)) // max anzahl eintraege - { - - aStringList.push_back(DBTypeConversion::getValue(xDataField, - m_xFormatter, - m_aNullDate, - m_nFormatKey, - m_nKeyType)); - } - } - break; - case ListSourceType_TABLEFIELDS: - { - Reference<XNameAccess> xFieldNames = getTableFields(xConnection, m_aListSource); - if (xFieldNames.is()) - { - StringSequence seqNames = xFieldNames->getElementNames(); - sal_Int32 nFieldsCount = seqNames.getLength(); - const ::rtl::OUString* pustrNames = seqNames.getConstArray(); - - for (sal_Int32 k=0; k<nFieldsCount; ++k) - aStringList.push_back(pustrNames[k]); - } - } - break; - } - } - catch(SQLException& eSQL) - { - onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST)); - disposeComponent(xListCursor); - disposeComponent(xStmt); - return; - } - catch(Exception& eUnknown) - { - eUnknown; - disposeComponent(xListCursor); - disposeComponent(xStmt); - return; - } - - // String-Sequence fuer ListBox erzeugen - StringSequence aStringSeq(aStringList.size()); - ::rtl::OUString* pStringAry = aStringSeq.getArray(); - for (sal_Int32 i = 0; i<aStringSeq.getLength(); ++i) - pStringAry[i] = aStringList[i]; - - // String-Sequence an ListBox setzen - m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, makeAny(aStringSeq)); - - // destroy cursor & statement - disposeComponent(xListCursor); - disposeComponent(xStmt); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::_loaded(const EventObject& rEvent) -{ - Reference<XPropertySet> xField = getField(); - if (xField.is()) - { - // jetzt den Key und typ ermitteln - xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= m_nFieldType; - xField->getPropertyValue(PROPERTY_FORMATKEY) >>= m_nFormatKey; - - // XNumberFormatter besorgen - Reference<XRowSet> xRowSet(rEvent.Source, UNO_QUERY); - DBG_ASSERT(xRowSet.is(), "OComboBoxModel::_loaded : invalid event source !"); - Reference<XNumberFormatsSupplier> xSupplier = getNumberFormats(getConnection(xRowSet), sal_False, m_xServiceFactory); - if (xSupplier.is()) - { - m_xFormatter = Reference<XNumberFormatter>( - m_xServiceFactory->createInstance(FRM_NUMBER_FORMATTER), UNO_QUERY - ); - if (m_xFormatter.is()) - m_xFormatter->attachNumberFormatsSupplier(xSupplier); - - m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), m_nFormatKey); - xSupplier->getNumberFormatSettings()->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) >>= m_aNullDate; - } - } - - m_xAggregateSet->getPropertyValue(PROPERTY_STRINGITEMLIST) >>= m_aDesignModeStringItems; - - // Daten nur laden, wenn eine Listenquelle angegeben wurde - if (m_aListSource.getLength() && m_xCursor.is()) - loadData(); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::_unloaded() -{ - if (getField().is()) - { - m_xFormatter = 0; - m_nFieldType = DataType::OTHER; - m_nFormatKey = 0; - m_nKeyType = NumberFormat::UNDEFINED; - m_aNullDate = DBTypeConversion::getStandardDate(); - } - - // reset the string item list - m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, makeAny(m_aDesignModeStringItems)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OComboBoxModel::reloaded( const EventObject& aEvent ) throw(RuntimeException) -{ - OBoundControlModel::reloaded(aEvent); - - // reload data if we have a list source - if (m_aListSource.getLength() && m_xCursor.is()) - loadData(); -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool OComboBoxModel::_commit() -{ - ::rtl::OUString aNewValue; - m_xAggregateFastSet->getFastPropertyValue(OComboBoxModel::nTextHandle) >>= aNewValue; - sal_Bool bModified = (aNewValue != m_aSaveValue); - if (bModified) - { - if (!aNewValue.getLength() && !m_bRequired && m_bEmptyIsNull) - m_xColumnUpdate->updateNull(); - else - { - try - { - DBTypeConversion::setValue(m_xColumnUpdate, m_xFormatter, m_aNullDate, aNewValue, - m_nFormatKey, m_nFieldType, m_nKeyType); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - - // add the new value to the list - sal_Bool bAddToList = bModified; - // (only if this is not the "commit" triggered by a "reset") - if (m_bResetting) - bAddToList = sal_False; - - Any aAnyList = m_xAggregateSet->getPropertyValue(PROPERTY_STRINGITEMLIST); - if (bAddToList && aAnyList.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL)))) - { - StringSequence aStringItemList = *(StringSequence*)aAnyList.getValue(); - const ::rtl::OUString* pStringItems = aStringItemList.getConstArray(); - sal_Int32 i; - for (i=0; i<aStringItemList.getLength(); ++i, ++pStringItems) - { - if (pStringItems->equals(aNewValue)) - break; - } - - // not found -> add - if (i >= aStringItemList.getLength()) - { - sal_Int32 nOldLen = aStringItemList.getLength(); - aStringItemList.realloc(nOldLen + 1); - ::rtl::OUString* pStringItems = aStringItemList.getArray() + nOldLen; - *pStringItems = aNewValue; - - aAnyList <<= aStringItemList; - m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, aAnyList); - } - } - - return sal_True; -} - -// XPropertiesChangeListener -//------------------------------------------------------------------------------ -void OComboBoxModel::_onValueChanged() -{ - // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // and in this special case do it before calling DBTypeConversion::getValue, as this uses the number formatter - // which's implementation locks the SM, too :( - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - DBG_ASSERT(m_xColumn.is(), "OComboBoxModel::_onValueChanged : have no column !"); - m_aSaveValue = DBTypeConversion::getValue(m_xColumn, - m_xFormatter, - m_aNullDate, - m_nFormatKey, - m_nKeyType); - - m_xAggregateFastSet->setFastPropertyValue(OComboBoxModel::nTextHandle, makeAny(m_aSaveValue)); -} - -//------------------------------------------------------------------------------ -void OComboBoxModel::_reset() -{ - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OComboBoxModel::nTextHandle, makeAny(m_aDefaultText)); - } -} - -//======================================================================== -//= OComboBoxControl -//======================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OComboBoxControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OComboBoxControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -OComboBoxControl::OComboBoxControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_COMBOBOX) -{ -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OComboBoxControl::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_COMBOBOX; - return aSupported; -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Currency.cxx b/binfilter/bf_forms/source/component/forms_Currency.cxx deleted file mode 100644 index 4007657952a1..000000000000 --- a/binfilter/bf_forms/source/component/forms_Currency.cxx +++ /dev/null @@ -1,303 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Currency.hxx" - -#include <bf_svtools/syslocale.hxx> - -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// OCurrencyControl -//================================================================== -//------------------------------------------------------------------ -OCurrencyControl::OCurrencyControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_CURRENCYFIELD) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OCurrencyControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OCurrencyControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OCurrencyControl::_getTypes() -{ - return OBoundControl::_getTypes(); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCurrencyControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_CURRENCYFIELD; - return aSupported; -} - -//================================================================== -// OCurrencyModel -//================================================================== -sal_Int32 OCurrencyModel::nValueHandle = -1; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OCurrencyModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OCurrencyModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OCurrencyModel::_getTypes() -{ - return OEditBaseModel::_getTypes(); -} - -//------------------------------------------------------------------ -void OCurrencyModel::implConstruct() -{ - if (m_xAggregateSet.is()) - { - try - { - // get the system international informations - const LocaleDataWrapper& aLocaleInfo = SvtSysLocale().GetLocaleData(); - - ::rtl::OUString sCurrencySymbol; - sal_Bool bPrependCurrencySymbol; - switch ( aLocaleInfo.getCurrPositiveFormat() ) - { - case 0: // $1 - sCurrencySymbol = String(aLocaleInfo.getCurrSymbol()); - bPrependCurrencySymbol = sal_True; - break; - case 1: // 1$ - sCurrencySymbol = String(aLocaleInfo.getCurrSymbol()); - bPrependCurrencySymbol = sal_False; - break; - case 2: // $ 1 - sCurrencySymbol = ::rtl::OUString(String(aLocaleInfo.getCurrSymbol())) + ::rtl::OUString::createFromAscii(" "); - bPrependCurrencySymbol = sal_True; - break; - case 3: // 1 $ - sCurrencySymbol = ::rtl::OUString::createFromAscii(" ") + ::rtl::OUString(String(aLocaleInfo.getCurrSymbol())); - bPrependCurrencySymbol = sal_False; - break; - } - if (sCurrencySymbol.getLength()) - { - m_xAggregateSet->setPropertyValue(PROPERTY_CURRENCYSYMBOL, makeAny(sCurrencySymbol)); - m_xAggregateSet->setPropertyValue(PROPERTY_CURRSYM_POSITION, makeAny(bPrependCurrencySymbol)); - } - } - catch(Exception&) - { - DBG_ERROR( "OCurrencyModel::implConstruct: caught an exception while initializing the aggregate!" ); - } - } -} - -//------------------------------------------------------------------ -DBG_NAME( OCurrencyModel ) -//------------------------------------------------------------------ -OCurrencyModel::OCurrencyModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_CURRENCYFIELD, FRM_CONTROL_CURRENCYFIELD) - // use the old control name for compytibility reasons -{ - DBG_CTOR( OCurrencyModel, NULL ); - - m_nClassId = FormComponentType::CURRENCYFIELD; - m_sDataFieldConnectivityProperty = PROPERTY_VALUE; - if (OCurrencyModel::nValueHandle == -1) - OCurrencyModel::nValueHandle = getOriginalHandle(PROPERTY_ID_VALUE); - - implConstruct(); -} - -//------------------------------------------------------------------ -OCurrencyModel::OCurrencyModel( const OCurrencyModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OCurrencyModel, NULL ); - implConstruct(); -} - -//------------------------------------------------------------------ -OCurrencyModel::~OCurrencyModel() -{ - DBG_DTOR( OCurrencyModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OCurrencyModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OCurrencyModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_CURRENCYFIELD; - return aSupported; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OCurrencyModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void OCurrencyModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(9) - // Value auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_VALUE, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP3(DEFAULT_VALUE, double, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OCurrencyModel::getInfoHelper() -{ - return *const_cast<OCurrencyModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OCurrencyModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_CURRENCYFIELD; // old (non-sun) name for compatibility ! -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool OCurrencyModel::_commit() -{ - Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OCurrencyModel::nValueHandle ); - if (!compare(aNewValue, m_aSaveValue)) - { - if (aNewValue.getValueType().getTypeClass() == TypeClass_VOID) - m_xColumnUpdate->updateNull(); - else - { - try - { - m_xColumnUpdate->updateDouble(getDouble(aNewValue)); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -void OCurrencyModel::_onValueChanged() -{ - m_aSaveValue <<= m_xColumn->getDouble(); - if (m_xColumn->wasNull()) - m_aSaveValue.clear(); - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OCurrencyModel::nValueHandle, m_aSaveValue); - } -} - -// XReset -//------------------------------------------------------------------------------ -void OCurrencyModel::_reset( void ) -{ - Any aValue; - if (m_aDefault.getValueType().getTypeClass() == TypeClass_DOUBLE) - aValue = m_aDefault; - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OCurrencyModel::nValueHandle, aValue); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_DatabaseForm.cxx b/binfilter/bf_forms/source/component/forms_DatabaseForm.cxx deleted file mode 100644 index 3ee4b5db1595..000000000000 --- a/binfilter/bf_forms/source/component/forms_DatabaseForm.cxx +++ /dev/null @@ -1,3888 +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. - * - ************************************************************************/ - -#include <stdio.h> -#include <ctype.h> - -#include "DatabaseForm.hxx" -#include "EventThread.hxx" -#include "ListBox.hxx" -#include "frm_resource.hxx" -#include "frm_resource.hrc" - -#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> -#include <com/sun/star/sdbc/ResultSetType.hpp> -#include <com/sun/star/sdbc/ResultSetConcurrency.hpp> -#include <com/sun/star/form/DataSelectionType.hpp> -#include <com/sun/star/sdb/SQLContext.hpp> -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <com/sun/star/sdb/RowSetVetoException.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/sdb/XParametersSupplier.hpp> -#include <com/sun/star/sdbcx/Privilege.hpp> -#include <com/sun/star/form/TabulatorCycle.hpp> -#include <com/sun/star/awt/XControlContainer.hpp> -#include <com/sun/star/awt/XTextComponent.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> - - - -#include "GroupManager.hxx" - -#include "property.hrc" -#include "services.hxx" - -#include <tools/fsys.hxx> -#include <tools/inetmsg.hxx> -#include <bf_svtools/inetstrm.hxx> -#include <comphelper/seqstream.hxx> -#include <comphelper/enumhelper.hxx> -#include <comphelper/container.hxx> -#include <connectivity/dbtools.hxx> -#include <tools/urlobj.hxx> -#include <rtl/math.hxx> -#include <bf_svtools/inettype.hxx> -#include <vcl/svapp.hxx> -#include <rtl/tencinfo.h> -#include <unotools/ucblockbytes.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include "formsmodule.hxx" - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -// compatiblity: DatabaseCursorType is dead, but for compatiblity reasons we still have to write it ... -namespace com { -namespace sun { -namespace star { -namespace data { - -enum DatabaseCursorType -{ - DatabaseCursorType_FORWARD = 0, - DatabaseCursorType_SNAPSHOT = 1, - DatabaseCursorType_KEYSET = 2, - DatabaseCursorType_DYNAMIC = 3, - DatabaseCursorType_MAKE_FIXED_SIZE = SAL_MAX_ENUM -}; - -} } } } - -#include <comphelper/interaction.hxx> -#include <com/sun/star/sdb/XInteractionSupplyParameters.hpp> -#include <com/sun/star/sdb/ParametersRequest.hpp> -#include "bf_so3/staticbaseurl.hxx" -namespace binfilter { - -#define DATABASEFORM_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.ODatabaseForm") - -using namespace ::dbtools; -using namespace ::comphelper; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::task; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::data; -using namespace ::com::sun::star::util; - -//-------------------------------------------------------------------------- -extern "C" void SAL_CALL createRegistryInfo_ODatabaseForm() -{ - static ::binfilter::frm::OMultiInstanceAutoRegistration< ::binfilter::frm::ODatabaseForm > aAutoRegistration;//STRIP008 static ::frm::OMultiInstanceAutoRegistration< ::frm::ODatabaseForm > aAutoRegistration; -} - -//......................................................................... -namespace frm -{ -//......................................................................... - - -//------------------------------------------------------------------ -Reference< XModel> getXModel(const Reference< XInterface>& xIface) -{ - Reference< XModel> xModel(xIface, UNO_QUERY); - if (xModel.is()) - return xModel; - else - { - Reference< XChild> xChild(xIface, UNO_QUERY); - if (xChild.is()) - { - Reference< XInterface> xParent( xChild->getParent()); - return getXModel(xParent); - } - else - return NULL; - } -} - -//================================================================== -// OParameterContinuation -//================================================================== -class OParameterContinuation : public OInteraction< XInteractionSupplyParameters > -{ - Sequence< PropertyValue > m_aValues; - -public: - OParameterContinuation() { } - - Sequence< PropertyValue > getValues() const { return m_aValues; } - -// XInteractionSupplyParameters - virtual void SAL_CALL setParameters( const Sequence< PropertyValue >& _rValues ) throw(RuntimeException); -}; - -//------------------------------------------------------------------ -void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyValue >& _rValues ) throw(RuntimeException) -{ - m_aValues = _rValues; -} - -//================================================================== -//= OParametersImpl -//=----------------------------------------------------------------- -//= class for the parameter event see approveParameter -//================================================================== - -typedef ::cppu::WeakImplHelper2<XIndexAccess, XEnumerationAccess> OParametersImplBase; -class OParametersImpl : public OParametersImplBase -{ -public: - typedef ::std::vector<Reference<XPropertySet> > Parameters; - typedef Parameters::iterator ParametersIterator; - -private: - Parameters m_aParameters; - -protected: - virtual ~OParametersImpl(){} -public: - // UNO - DECLARE_UNO3_AGG_DEFAULTS(OParametersImpl, OParametersImplBase); - - // XElementAccess - virtual Type SAL_CALL getElementType() throw( RuntimeException ); - virtual sal_Bool SAL_CALL hasElements() throw( RuntimeException ); - - // XEnumerationAccess - virtual Reference<XEnumeration> SAL_CALL createEnumeration() throw( RuntimeException ); - - // XIndexAccess - virtual sal_Int32 SAL_CALL getCount() throw( RuntimeException ); - virtual Any SAL_CALL getByIndex(sal_Int32 _rIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ); - - Parameters& getParameters() { return m_aParameters; } -}; - -// XElementAccess -//------------------------------------------------------------------------------ -Type SAL_CALL OParametersImpl::getElementType() throw( RuntimeException ) -{ - return ::getCppuType(static_cast<Reference<XPropertySet>*>(NULL)); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OParametersImpl::hasElements() throw( RuntimeException ) -{ - return !m_aParameters.empty(); -} - -// XIndexAccess -//------------------------------------------------------------------------------ -sal_Int32 SAL_CALL OParametersImpl::getCount() throw( RuntimeException ) -{ - return m_aParameters.size(); -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OParametersImpl::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - if ((_nIndex < 0) || (_nIndex >= (sal_Int32)m_aParameters.size())) - throw IndexOutOfBoundsException(); - - return makeAny(m_aParameters[_nIndex]); -} - -// XEnumerationAccess -//------------------------------------------------------------------------------ -Reference<XEnumeration> OParametersImpl::createEnumeration() throw( RuntimeException ) -{ - return new OEnumerationByIndex(reinterpret_cast<XIndexAccess*>(this)); -} - -//================================================================== -//= OParameterInfoImpl -//=----------------------------------------------------------------- -//= class which collects all information for parameter filling -//================================================================== -typedef ::std::multimap< ::rtl::OUString,sal_Int32,::comphelper::UStringLess > MapUString2INT32; - -struct OParameterInfoImpl -{ - sal_Int32 nCount; // Number of Parameters - Reference<XSQLQueryComposer> xComposer; - Reference<XIndexAccess> xParamsAsIndex; - OParametersImpl* pParameters; - MapUString2INT32 aParamMapping; - - OParameterInfoImpl():nCount(0),pParameters(NULL){} - ~OParameterInfoImpl() - { - if (pParameters) - pParameters->release(); - } -}; - -//================================================================== -//= OFormSubmitResetThread -//=----------------------------------------------------------------- -//= submitting and resetting html-forms asynchronously -//================================================================== - -//------------------------------------------------------------------ -class OFormSubmitResetThread: public OComponentEventThread -{ -protected: - - // duplicate an event with respect to it's type - virtual EventObject *cloneEvent( const EventObject *pEvt ) const; - - // process an event. while processing the mutex isn't locked, and pCompImpl - // is made sure to remain valid - virtual void processEvent( ::cppu::OComponentHelper* _pCompImpl, - const EventObject* _pEvt, - const Reference<XControl>& _rControl, - sal_Bool _bSubmit); - -public: - - OFormSubmitResetThread(ODatabaseForm* pControl) : OComponentEventThread(pControl) { } -}; - -//------------------------------------------------------------------ -EventObject* OFormSubmitResetThread::cloneEvent( - const EventObject *pEvt ) const -{ - return new ::com::sun::star::awt::MouseEvent( *(::com::sun::star::awt::MouseEvent *)pEvt ); -} - -//------------------------------------------------------------------ -void OFormSubmitResetThread::processEvent( - ::cppu::OComponentHelper* pCompImpl, - const EventObject *_pEvt, - const Reference<XControl>& _rControl, - sal_Bool _bSubmit) -{ - if (_bSubmit) - ((ODatabaseForm *)pCompImpl)->submit_impl(_rControl, *reinterpret_cast<const ::com::sun::star::awt::MouseEvent*>(_pEvt), true); - else - ((ODatabaseForm *)pCompImpl)->reset_impl(true); -} - -//================================================================== -//= ODatabaseForm -//================================================================== - -//------------------------------------------------------------------ -Reference< XInterface > SAL_CALL ODatabaseForm::Create( const Reference< XMultiServiceFactory >& _rxFactory ) -{ - return *( new ODatabaseForm( _rxFactory ) ); -} - -//------------------------------------------------------------------------------ -Sequence<sal_Int8> SAL_CALL ODatabaseForm::getImplementationId() throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------ -Sequence<Type> SAL_CALL ODatabaseForm::getTypes() throw(RuntimeException) -{ - // ask the aggregate - Sequence<Type> aAggregateTypes; - Reference<XTypeProvider> xAggregateTypes; - if (query_aggregation(m_xAggregate, xAggregateTypes)) - aAggregateTypes = xAggregateTypes->getTypes(); - - Sequence<Type> aRet = concatSequences(aAggregateTypes, ODatabaseForm_BASE1::getTypes(), OFormComponents::getTypes()); - return concatSequences(aRet,ODatabaseForm_BASE2::getTypes(), ODatabaseForm_BASE3::getTypes()); -} - -//------------------------------------------------------------------ -Any SAL_CALL ODatabaseForm::queryAggregation(const Type& _rType) throw(RuntimeException) -{ - Any aReturn = ODatabaseForm_BASE1::queryInterface(_rType); - // our own interfaces - if (!aReturn.hasValue()) - { - aReturn = ODatabaseForm_BASE2::queryInterface(_rType); - // property set related interfaces - if (!aReturn.hasValue()) - { - aReturn = OPropertySetAggregationHelper::queryInterface(_rType); - - // form component collection related interfaces - if (!aReturn.hasValue()) - { - aReturn = OFormComponents::queryAggregation(_rType); - - // interfaces already present in the aggregate which we want to reroute - // only available if we could create the aggregate - if (!aReturn.hasValue() && m_xAggregateAsRowSet.is()) - aReturn = ODatabaseForm_BASE3::queryInterface(_rType); - - // aggregate interfaces - // (ask the aggregated object _after_ the OComponentHelper (base of OFormComponents), - // so calls to the XComponent interface reach us and not the aggreagtion) - if (!aReturn.hasValue() && m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - } - } - - return aReturn; -} - -DBG_NAME(ODatabaseForm) -//------------------------------------------------------------------ -ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory) - :OFormComponents(_rxFactory) - ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) - ,OPropertyChangeListener(m_aMutex) - ,m_aLoadListeners(m_aMutex) - ,m_aRowSetApproveListeners(m_aMutex) - ,m_aRowSetListeners(m_aMutex) - ,m_aParameterListeners(m_aMutex) - ,m_aResetListeners(m_aMutex) - ,m_aSubmitListeners(m_aMutex) - ,m_aErrorListeners(m_aMutex) - ,m_bLoaded(sal_False) - ,m_bSubForm(sal_False) - ,m_eNavigation(NavigationBarMode_CURRENT) - ,m_nPrivileges(0) - ,m_pParameterInfo(NULL) - ,m_pThread(NULL) - ,m_eSubmitMethod(FormSubmitMethod_GET) - ,m_eSubmitEncoding(FormSubmitEncoding_URL) - ,m_bAllowDelete(sal_True) - ,m_bAllowUpdate(sal_True) - ,m_bAllowInsert(sal_True) - ,m_pLoadTimer(NULL) - ,m_nResetsPending(0) - ,m_bForwardingConnection(sal_False) - ,m_pAggregatePropertyMultiplexer(NULL) - ,m_bSharingConnection( sal_False ) -{ - DBG_CTOR(ODatabaseForm,NULL); - - // aggregate a row set - increment(m_refCount); - - { - m_xAggregate = Reference<XAggregation>(m_xServiceFactory->createInstance(SRV_SDB_ROWSET), UNO_QUERY); - // m_xAggregate = Reference<XAggregation>(m_xServiceFactory->createInstance(rtl::OUString::createFromAscii("com.sun.star.sdb.dbaccess.ORowSet")), UNO_QUERY); - DBG_ASSERT(m_xAggregate.is(), "ODatabaseForm::ODatabaseForm : could not instantiate an SDB rowset !"); - m_xAggregateAsRowSet = Reference<XRowSet> (m_xAggregate,UNO_QUERY); - setAggregation(m_xAggregate); - } - - // listen for the properties, important for Parameters - if (m_xAggregateSet.is()) - { - m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False); - m_pAggregatePropertyMultiplexer->acquire(); - m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_COMMAND); - m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_FILTER_CRITERIA); - m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_APPLYFILTER); - m_pAggregatePropertyMultiplexer->addProperty(PROPERTY_ACTIVE_CONNECTION); - } - - if (m_xAggregate.is()) - { - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); - } - - decrement(m_refCount); - - m_pGroupManager = new OGroupManager(this); - m_pGroupManager->acquire(); -} - -//------------------------------------------------------------------ -ODatabaseForm::~ODatabaseForm() -{ - DBG_DTOR(ODatabaseForm,NULL); - - m_pGroupManager->release(); - - if (m_xAggregate.is()) - m_xAggregate->setDelegator(InterfaceRef()); - - if (m_pAggregatePropertyMultiplexer) - { - m_pAggregatePropertyMultiplexer->dispose(); - m_pAggregatePropertyMultiplexer->release(); - m_pAggregatePropertyMultiplexer = NULL; - } -} - -//============================================================================== -// html tools -//------------------------------------------------------------------------ -::rtl::OUString ODatabaseForm::GetDataURLEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - - // Liste von successful Controls fuellen - HtmlSuccessfulObjList aSuccObjList; - FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); - - - // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUString aResult; - ::rtl::OUString aName; - ::rtl::OUString aValue; - - for ( HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin(); - pSuccObj < aSuccObjList.end(); - ++pSuccObj - ) - { - aName = pSuccObj->aName; - aValue = pSuccObj->aValue; - if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE && aValue.getLength() ) - { - // Bei File-URLs wird der Dateiname und keine URL uebertragen, - // weil Netscape dies so macht. - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); - aURL.SetSmartURL(aValue); - if( INET_PROT_FILE == aURL.GetProtocol() ) - aValue = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS); - } - Encode( aName ); - Encode( aValue ); - aResult += aName; - aResult += UniString('='); - aResult += aValue; - if (pSuccObj < aSuccObjList.end() - 1) - aResult += UniString('&'); - } - - - aSuccObjList.clear(); - - return aResult; -} - -//============================================================================== -// html tools -//------------------------------------------------------------------------ -::rtl::OUString ODatabaseForm::GetDataTextEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - - // Liste von successful Controls fuellen - HtmlSuccessfulObjList aSuccObjList; - FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); - // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUString aResult; - ::rtl::OUString aName; - ::rtl::OUString aValue; - - for ( HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin(); - pSuccObj < aSuccObjList.end(); - ++pSuccObj - ) - { - aName = pSuccObj->aName; - aValue = pSuccObj->aValue; - if (pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE && aValue.getLength()) - { - // Bei File-URLs wird der Dateiname und keine URL uebertragen, - // weil Netscape dies so macht. - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); - aURL.SetSmartURL(aValue); - if( INET_PROT_FILE == aURL.GetProtocol() ) - aValue = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS); - } - Encode( aName ); - Encode( aValue ); - aResult += pSuccObj->aName; - aResult += UniString('='); - aResult += pSuccObj->aValue; - if (pSuccObj < aSuccObjList.end() - 1) - aResult += ::rtl::OUString::createFromAscii("\r\n"); - } - - - // Liste loeschen - aSuccObjList.clear(); - - return aResult; -} - -//------------------------------------------------------------------------ -Sequence<sal_Int8> ODatabaseForm::GetDataMultiPartEncoded(const Reference<XControl>& SubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt, ::rtl::OUString& rContentType) -{ - - // Parent erzeugen - INetMIMEMessage aParent; - aParent.EnableAttachChild( INETMSG_MULTIPART_FORM_DATA ); - - - // Liste von successful Controls fuellen - HtmlSuccessfulObjList aSuccObjList; - FillSuccessfulList( aSuccObjList, SubmitButton, MouseEvt ); - - - // Liste zu ::rtl::OUString zusammensetzen - ::rtl::OUString aResult; - for ( HtmlSuccessfulObjListIterator pSuccObj = aSuccObjList.begin(); - pSuccObj < aSuccObjList.end(); - ++pSuccObj - ) - { - if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_TEXT ) - InsertTextPart( aParent, pSuccObj->aName, pSuccObj->aValue ); - else if( pSuccObj->nRepresentation == SUCCESSFUL_REPRESENT_FILE ) - InsertFilePart( aParent, pSuccObj->aName, pSuccObj->aValue ); - } - - - // Liste loeschen - aSuccObjList.clear(); - - // Fuer Parent MessageStream erzeugen - INetMIMEMessageStream aMessStream; - aMessStream.SetSourceMessage( &aParent ); - aMessStream.GenerateHeader( sal_False ); - - // MessageStream in SvStream kopieren - SvMemoryStream aMemStream; - char* pBuf = new char[1025]; - int nRead; - while( (nRead = aMessStream.Read(pBuf, 1024)) > 0 ) - aMemStream.Write( pBuf, nRead ); - delete[] pBuf; - - aMemStream.Flush(); - aMemStream.Seek( 0 ); - void* pData = (void*)aMemStream.GetData(); - sal_Int32 nLen = aMemStream.Seek(STREAM_SEEK_TO_END); - - rContentType = UniString(aParent.GetContentType()); - return Sequence<sal_Int8>((sal_Int8*)pData, nLen); -} - -//------------------------------------------------------------------------ -void ODatabaseForm::AppendComponent(HtmlSuccessfulObjList& rList, const Reference<XPropertySet>& xComponentSet, const ::rtl::OUString& rNamePrefix, - const Reference<XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt) -{ - if (!xComponentSet.is()) - return; - - // MIB 25.6.98: Geschachtelte Formulare abfangen ... oder muesste - // man sie submitten? - if (!hasProperty(PROPERTY_CLASSID, xComponentSet)) - return; - - // Namen ermitteln - if (!hasProperty(PROPERTY_NAME, xComponentSet)) - return; - - sal_Int16 nClassId; - xComponentSet->getPropertyValue(PROPERTY_CLASSID) >>= nClassId; - ::rtl::OUString aName; - xComponentSet->getPropertyValue( PROPERTY_NAME ) >>= aName; - if( !aName.getLength() && nClassId != FormComponentType::IMAGEBUTTON) - return; - else // Name um den Prefix erweitern - aName = rNamePrefix + aName; - - switch( nClassId ) - { - // Buttons - case FormComponentType::COMMANDBUTTON: - { - // Es wird nur der gedrueckte Submit-Button ausgewertet - // MIB: Sofern ueberhaupt einer uebergeben wurde - if( rxSubmitButton.is() ) - { - Reference<XPropertySet> xSubmitButtonComponent(rxSubmitButton->getModel(), UNO_QUERY); - if (xSubmitButtonComponent == xComponentSet && hasProperty(PROPERTY_LABEL, xComponentSet)) - { - // <name>=<label> - ::rtl::OUString aLabel; - xComponentSet->getPropertyValue( PROPERTY_LABEL ) >>= aLabel; - rList.push_back( HtmlSuccessfulObj(aName, aLabel) ); - } - } - } break; - - // ImageButtons - case FormComponentType::IMAGEBUTTON: - { - // Es wird nur der gedrueckte Submit-Button ausgewertet - // MIB: Sofern ueberhaupt einer uebergeben wurde - if( rxSubmitButton.is() ) - { - Reference<XPropertySet> xSubmitButtonComponent(rxSubmitButton->getModel(), UNO_QUERY); - if (xSubmitButtonComponent == xComponentSet) - { - // <name>.x=<pos.X>&<name>.y=<pos.Y> - ::rtl::OUString aLhs = aName; - ::rtl::OUString aRhs = ::rtl::OUString::valueOf( MouseEvt.X ); - - // nur wenn ein Name vorhanden ist, kann ein name.x - aLhs += aName.getLength() ? UniString::CreateFromAscii(".x") : UniString::CreateFromAscii("x"); - rList.push_back( HtmlSuccessfulObj(aLhs, aRhs) ); - - aLhs = aName; - aRhs = ::rtl::OUString::valueOf( MouseEvt.Y ); - aLhs += aName.getLength() ? UniString::CreateFromAscii(".y") : UniString::CreateFromAscii("y"); - rList.push_back( HtmlSuccessfulObj(aLhs, aRhs) ); - - } - } - } break; - - // CheckBoxen / RadioButtons - case FormComponentType::CHECKBOX: - case FormComponentType::RADIOBUTTON: - { - // <name>=<refValue> - if( !hasProperty(PROPERTY_STATE, xComponentSet) ) - break; - sal_Int16 nChecked; - xComponentSet->getPropertyValue( PROPERTY_STATE ) >>= nChecked; - if( nChecked != 1 ) - break; - - ::rtl::OUString aStrValue; - if( hasProperty(PROPERTY_REFVALUE, xComponentSet) ) - xComponentSet->getPropertyValue( PROPERTY_REFVALUE ) >>= aStrValue; - - rList.push_back( HtmlSuccessfulObj(aName, aStrValue) ); - } break; - - // Edit - case FormComponentType::TEXTFIELD: - { - // <name>=<text> - if( !hasProperty(PROPERTY_TEXT, xComponentSet) ) - break; - - // MIB: Spezial-Behandlung fuer Multiline-Edit nur dann, wenn - // es auch ein Control dazu gibt. - Any aTmp = xComponentSet->getPropertyValue( PROPERTY_MULTILINE ); - sal_Bool bMulti = rxSubmitButton.is() - && (aTmp.getValueType().getTypeClass() == TypeClass_BOOLEAN) - && getBOOL(aTmp); - ::rtl::OUString sText; - if ( bMulti ) // Bei MultiLineEdit Text am Control abholen - { - - Reference<XControlContainer> xControlContainer(rxSubmitButton->getContext(), UNO_QUERY); - if( !xControlContainer.is() ) break; - - Sequence<Reference<XControl> > aControlSeq = xControlContainer->getControls(); - Reference<XControl> xControl; - Reference<XFormComponent> xControlComponent; - - // Richtiges Control suchen - sal_Int32 i; - for( i=0; i<aControlSeq.getLength(); i++ ) - { - xControl = aControlSeq.getConstArray()[i]; - Reference<XPropertySet> xModel(xControl->getModel(), UNO_QUERY); - if (xModel == xComponentSet) - { - Reference<XTextComponent> xTextComponent(xControl, UNO_QUERY); - if( xTextComponent.is() ) - sText = xTextComponent->getText(); - break; - } - } - // Control nicht gefunden oder nicht existent, (Edit im Grid) - if (i == aControlSeq.getLength()) - xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= sText; - } - else - xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= sText; - - rList.push_back( HtmlSuccessfulObj(aName, sText) ); - } break; - - // ComboBox, Patternfield - case FormComponentType::COMBOBOX: - case FormComponentType::PATTERNFIELD: - { - // <name>=<text> - if( hasProperty(PROPERTY_TEXT, xComponentSet) ) - { - ::rtl::OUString aText; - xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= aText; - rList.push_back( HtmlSuccessfulObj(aName, aText) ); - } - } break; - case FormComponentType::CURRENCYFIELD: - case FormComponentType::NUMERICFIELD: - { - // <name>=<wert> // wert wird als double mit Punkt als Decimaltrenner - // kein Wert angegeben (NULL) -> wert leer - if( hasProperty(PROPERTY_VALUE, xComponentSet) ) - { - ::rtl::OUString aText; - Any aVal = xComponentSet->getPropertyValue( PROPERTY_VALUE ); - - double aDoubleVal; - if (aVal >>= aDoubleVal) - { - sal_Int16 nScale; - xComponentSet->getPropertyValue( PROPERTY_DECIMAL_ACCURACY ) >>= nScale; - aText = ::rtl::math::doubleToUString(aDoubleVal, rtl_math_StringFormat_F, nScale, '.', sal_True); - } - rList.push_back( HtmlSuccessfulObj(aName, aText) ); - } - } break; - case FormComponentType::DATEFIELD: - { - // <name>=<wert> // Wert wird als Datum im Format (MM-DD-YYYY) - // kein Wert angegeben (NULL) -> wert leer - if( hasProperty(PROPERTY_DATE, xComponentSet) ) - { - ::rtl::OUString aText; - Any aVal = xComponentSet->getPropertyValue( PROPERTY_DATE ); - sal_Int32 nInt32Val; - if (aVal >>= nInt32Val) - { - ::Date aDate(nInt32Val); - char s[11]; - sprintf(s,"%02d-%02d-%04d", - (int)aDate.GetMonth(), - (int)aDate.GetDay(), - (int)aDate.GetYear()); - s[10] = 0; - aText = ::rtl::OUString::createFromAscii(s); - } - rList.push_back( HtmlSuccessfulObj(aName, aText) ); - } - } break; - case FormComponentType::TIMEFIELD: - { - // <name>=<wert> // Wert wird als Zeit im Format (HH:MM:SS) angegeben - // kein Wert angegeben (NULL) -> wert leer - if( hasProperty(PROPERTY_TIME, xComponentSet) ) - { - ::rtl::OUString aText; - Any aVal = xComponentSet->getPropertyValue( PROPERTY_TIME ); - sal_Int32 nInt32Val; - if (aVal >>= nInt32Val) - { - ::Time aTime(nInt32Val); - char s[10]; - sprintf(s,"%02d:%02d:%02d", - (int)aTime.GetHour(), - (int)aTime.GetMin(), - (int)aTime.GetSec()); - s[8] = 0; - aText = ::rtl::OUString::createFromAscii(s); - } - rList.push_back( HtmlSuccessfulObj(aName, aText) ); - } - } break; - - // starform - case FormComponentType::HIDDENCONTROL: - { - - // <name>=<value> - if( hasProperty(PROPERTY_HIDDEN_VALUE, xComponentSet) ) - { - ::rtl::OUString aText; - xComponentSet->getPropertyValue( PROPERTY_HIDDEN_VALUE ) >>= aText; - rList.push_back( HtmlSuccessfulObj(aName, aText) ); - } - } break; - - // starform - case FormComponentType::FILECONTROL: - { - // <name>=<text> - if( hasProperty(PROPERTY_TEXT, xComponentSet) ) - { - - ::rtl::OUString aText; - xComponentSet->getPropertyValue( PROPERTY_TEXT ) >>= aText; - rList.push_back( HtmlSuccessfulObj(aName, aText, SUCCESSFUL_REPRESENT_FILE) ); - } - } break; - - // starform - case FormComponentType::LISTBOX: - { - - // <name>=<Token0>&<name>=<Token1>&...&<name>=<TokenN> (Mehrfachselektion) - if (!hasProperty(PROPERTY_SELECT_SEQ, xComponentSet) || - !hasProperty(PROPERTY_STRINGITEMLIST, xComponentSet)) - break; - - // angezeigte Werte - Sequence< ::rtl::OUString > aVisibleList; - xComponentSet->getPropertyValue( PROPERTY_STRINGITEMLIST ) >>= aVisibleList; - sal_Int32 nStringCnt = aVisibleList.getLength(); - const ::rtl::OUString* pStrings = aVisibleList.getConstArray(); - - // Werte-Liste - Sequence< ::rtl::OUString > aValueList; - xComponentSet->getPropertyValue( PROPERTY_VALUE_SEQ ) >>= aValueList; - sal_Int32 nValCnt = aValueList.getLength(); - const ::rtl::OUString* pVals = aValueList.getConstArray(); - - // Selektion - Sequence<sal_Int16> aSelectList; - xComponentSet->getPropertyValue( PROPERTY_SELECT_SEQ ) >>= aSelectList; - sal_Int32 nSelCount = aSelectList.getLength(); - const sal_Int16* pSels = aSelectList.getConstArray(); - - // Einfach- oder Mehrfach-Selektion - // Bei Einfach-Selektionen beruecksichtigt MT nur den ersten Eintrag - // in der Liste. - if (nSelCount > 1 && !getBOOL(xComponentSet->getPropertyValue(PROPERTY_MULTISELECTION))) - nSelCount = 1; - - // Die Indizes in der Selektions-Liste koennen auch ungueltig sein, - // also muss man die gueltigen erstmal raussuchen um die Laenge - // der neuen Liste zu bestimmen. - sal_Int32 nCurCnt = 0; - sal_Int32 i; - for( i=0; i<nSelCount; ++i ) - { - if( pSels[i] < nStringCnt ) - ++nCurCnt; - } - - ::rtl::OUString aSubValue; - for(i=0; i<nCurCnt; ++i ) - { - sal_Int16 nSelPos = pSels[i]; - // Wenn Index in WerteListe, Eintrag aus Werteliste holen - // ansonsten angezeigten Wert nehmen. Ein - // LISTBOX_EMPTY_VALUE entspricht einem leeren, aber - // vorhandenem VALUE des Option-Tags. - if (nSelPos < nValCnt && pVals[nSelPos].getLength()) - { - if( pVals[nSelPos] == LISTBOX_EMPTY_VALUE ) - aSubValue = ::rtl::OUString(); - else - aSubValue = pVals[nSelPos]; - } - else - { - aSubValue = pStrings[nSelPos]; - } - rList.push_back( HtmlSuccessfulObj(aName, aSubValue) ); - } - } break; - case FormComponentType::GRIDCONTROL: - { - // Die einzelnen Spaltenwerte werden verschickt, - // der Name wird mit dem Prefix des Names des Grids erweitert - Reference<XIndexAccess> xContainer(xComponentSet, UNO_QUERY); - if (!xContainer.is()) - break; - - aName += UniString('.'); - - Reference<XPropertySet> xSet; - sal_Int32 nCount = xContainer->getCount(); - // we know already how many objects should be appended, - // so why not allocate the space for them - rList.reserve( nCount + rList.capacity() ); // not size() - for (sal_Int32 i = 0; i < nCount; ++i) - { - xContainer->getByIndex(i) >>= xSet; - if (xSet.is()) - AppendComponent(rList, xSet, aName, rxSubmitButton, MouseEvt); - } - } - } -} - -//------------------------------------------------------------------------ -void ODatabaseForm::FillSuccessfulList( HtmlSuccessfulObjList& rList, - const Reference<XControl>& rxSubmitButton, const ::com::sun::star::awt::MouseEvent& MouseEvt ) -{ - // Liste loeschen - rList.clear(); - // Ueber Components iterieren - Reference<XPropertySet> xComponentSet; - ::rtl::OUString aPrefix; - - // we know already how many objects should be appended, - // so why not allocate the space for them - rList.reserve( getCount() ); - for( sal_Int32 nIndex=0; nIndex < getCount(); nIndex++ ) - { - getByIndex( nIndex ) >>= xComponentSet; - AppendComponent(rList, xComponentSet, aPrefix, rxSubmitButton, MouseEvt); - } -} - -//------------------------------------------------------------------------ -void ODatabaseForm::Encode( ::rtl::OUString& rString ) const -{ - ::rtl::OUString aResult; - - // Immer ANSI #58641 -// rString.Convert(CHARSET_SYSTEM, CHARSET_ANSI); - - - // Zeilenendezeichen werden als CR dargestellt - UniString sConverter = rString; - sConverter.ConvertLineEnd( LINEEND_CR ); - rString = sConverter; - - - // Jeden einzelnen Character ueberpruefen - sal_Int32 nStrLen = rString.getLength(); - sal_Unicode nCharCode; - for( sal_Int32 nCurPos=0; nCurPos < nStrLen; ++nCurPos ) - { - nCharCode = rString[nCurPos]; - - // Behandlung fuer chars, die kein alphanumerisches Zeichen sind - // und CharacterCodes > 127 - if( (!isalnum(nCharCode) && nCharCode != (sal_Unicode)' ') || nCharCode > 127 ) - { - switch( nCharCode ) - { - case 13: // CR - aResult += ::rtl::OUString::createFromAscii("%0D%0A"); // Hex-Darstellung CR LF - break; - - - // Netscape Sonderbehandlung - case 42: // '*' - case 45: // '-' - case 46: // '.' - case 64: // '@' - case 95: // '_' - aResult += UniString(nCharCode); - break; - - default: - { - // In Hex umrechnen - short nHi = ((sal_Int16)nCharCode) / 16; - short nLo = ((sal_Int16)nCharCode) - (nHi*16); - if( nHi > 9 ) nHi += (int)'A'-10; else nHi += (int)'0'; - if( nLo > 9 ) nLo += (int)'A'-10; else nLo += (int)'0'; - aResult += UniString('%'); - aResult += UniString((sal_Unicode)nHi); - aResult += UniString((sal_Unicode)nLo); - } - } - } - else - aResult += UniString(nCharCode); - } - - - // Spaces durch '+' ersetzen - aResult = aResult.replace(' ', '+'); - - rString = aResult; -} - -//------------------------------------------------------------------------ -void ODatabaseForm::InsertTextPart( INetMIMEMessage& rParent, const ::rtl::OUString& rName, - const ::rtl::OUString& rData ) -{ - - // Part als Message-Child erzeugen - INetMIMEMessage* pChild = new INetMIMEMessage(); - - - // Header - ::rtl::OUString aContentDisp = ::rtl::OUString::createFromAscii("form-data; name=\""); - aContentDisp += rName; - aContentDisp += UniString('\"'); - pChild->SetContentDisposition( aContentDisp ); - pChild->SetContentType( UniString::CreateFromAscii("text/plain") ); - - rtl_TextEncoding eSystemEncoding = gsl_getSystemTextEncoding(); - const sal_Char* pBestMatchingEncoding = rtl_getBestMimeCharsetFromTextEncoding( eSystemEncoding ); - UniString aBestMatchingEncoding = UniString::CreateFromAscii( pBestMatchingEncoding ); - pChild->SetContentTransferEncoding(aBestMatchingEncoding); - - // Body - SvMemoryStream* pStream = new SvMemoryStream; - pStream->WriteLine( ByteString( UniString(rData), rtl_getTextEncodingFromMimeCharset(pBestMatchingEncoding) ) ); - pStream->Flush(); - pStream->Seek( 0 ); - pChild->SetDocumentLB( new SvLockBytes(pStream, sal_True) ); - rParent.AttachChild( *pChild ); -} - -//------------------------------------------------------------------------ -sal_Bool ODatabaseForm::InsertFilePart( INetMIMEMessage& rParent, const ::rtl::OUString& rName, - const ::rtl::OUString& rFileName ) -{ - UniString aFileName( rFileName ); - UniString aContentType(UniString::CreateFromAscii(CONTENT_TYPE_STR_TEXT_PLAIN)); - SvStream *pStream = 0; - - if( aFileName.Len() ) - { - // Bisher koennen wir nur File-URLs verarbeiten - INetURLObject aURL; - aURL.SetSmartProtocol(INET_PROT_FILE); - aURL.SetSmartURL(rFileName); - if( INET_PROT_FILE == aURL.GetProtocol() ) - { - aFileName = INetURLObject::decode(aURL.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS); - DirEntry aDirEntry( aFileName ); - if( aDirEntry.Exists() ) - { - pStream = ::utl::UcbStreamHelper::CreateStream(aFileName, STREAM_READ); - if (!pStream || (pStream->GetError() != ERRCODE_NONE)) - { - delete pStream; - pStream = 0; - } - } - INetContentType eContentType = INetContentTypes::GetContentType4Extension( - aDirEntry.GetExtension() ); - if (eContentType != CONTENT_TYPE_UNKNOWN) - aContentType = INetContentTypes::GetContentType(eContentType); - } - } - - // Wenn irgendetwas nicht geklappt hat, legen wir einen leeren - // MemoryStream an - if( !pStream ) - pStream = new SvMemoryStream; - - - // Part als Message-Child erzeugen - INetMIMEMessage* pChild = new INetMIMEMessage; - - - // Header - ::rtl::OUString aContentDisp = ::rtl::OUString::createFromAscii( "form-data; name=\"" ); - aContentDisp += rName; - aContentDisp += UniString('\"'); - aContentDisp += ::rtl::OUString::createFromAscii("; filename=\""); - aContentDisp += aFileName; - aContentDisp += UniString('\"'); - pChild->SetContentDisposition( aContentDisp ); - pChild->SetContentType( aContentType ); - pChild->SetContentTransferEncoding( UniString(::rtl::OUString::createFromAscii("8bit")) ); - - - // Body - pChild->SetDocumentLB( new SvLockBytes(pStream, sal_True) ); - rParent.AttachChild( *pChild ); - - return sal_True; -} - -//============================================================================== -// internals -//------------------------------------------------------------------------------ -void ODatabaseForm::onError(const SQLErrorEvent& _rEvent) -{ - m_aErrorListeners.notifyEach(&XSQLErrorListener::errorOccured, _rEvent); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::onError(SQLException& _rException, const ::rtl::OUString& _rContextDescription) -{ - DBG_ERROR( "ODatabaseForm::onError: dead code!" ); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::createParameterInfo() -{ - DBG_ERROR( "ODatabaseForm::createParameterInfo: why is this still used in binfilter?!!" ); -} - -//------------------------------------------------------------------------------ -bool ODatabaseForm::hasValidParent() const -{ - // do we have to fill the parameters again? - if (m_bSubForm) - { - Reference<XResultSet> xResultSet(m_xParent, UNO_QUERY); - if (!xResultSet.is()) - { - DBG_ERROR("ODatabaseForm::hasValidParent() : no parent resultset !"); - return false; - } - try - { - Reference< XPropertySet > xSet( m_xParent, UNO_QUERY ); - Reference< XLoadable > xLoad( m_xParent, UNO_QUERY ); - if ( xLoad->isLoaded() - && ( xResultSet->isBeforeFirst() - || xResultSet->isAfterLast() - || getBOOL( xSet->getPropertyValue( PROPERTY_ISNEW ) ) - ) - ) - // the parent form is loaded and on a "virtual" row -> not valid - return false; - } - catch(Exception&) - { - // parent could be forwardonly? - return false; - } - } - return true; -} - -//------------------------------------------------------------------------------ -bool ODatabaseForm::fillParameters(::osl::ResettableMutexGuard& _rClearForNotifies, const Reference< XInteractionHandler >& _rxCompletionHandler) -{ - Reference<XParameters> xExecutionParams; - if (!query_aggregation( m_xAggregate, xExecutionParams)) - { - DBG_ERROR("ODatabaseForm::fillParameters : invalid row set (doesn't support parameters) !"); - // normally the row set should support parameters ... - return true; - } - - // do we have to fill the parameters again? - if ( !m_pParameterInfo ) - createParameterInfo(); - - if (!m_pParameterInfo || m_pParameterInfo->nCount == 0) - return true; - - // is there a valid parent? - if (m_bSubForm && !hasValidParent()) - return true; - - // do we have to fill the parent parameters? - OParametersImpl::Parameters& rParams = m_pParameterInfo->pParameters->getParameters(); - - // do we have to fill the parent parameters? - if (m_pParameterInfo->nCount > (sal_Int32)rParams.size()) - { - Reference<XColumnsSupplier> xParentColsSuppl(m_xParent, UNO_QUERY); - if (xParentColsSuppl.is()) - { - Reference<XNameAccess> xParentCols = xParentColsSuppl->getColumns(); - sal_Int32 nMasterLen = m_aMasterFields.getLength(); - if (xParentCols->hasElements() && (nMasterLen > 0)) - { - const ::rtl::OUString* pMasterFields = m_aMasterFields.getConstArray(); - const ::rtl::OUString* pDetailFields = m_aDetailFields.getConstArray(); - - Any aParamType,aScale,aValue; - for (sal_Int32 i = 0; i < nMasterLen; ++i, ++pMasterFields, ++pDetailFields) - { - Reference<XPropertySet> xMasterField, xDetailField; - MapUString2INT32::const_iterator aFind; - if ( xParentCols->hasByName(*pMasterFields) && - ( aFind = m_pParameterInfo->aParamMapping.find(*pDetailFields)) != m_pParameterInfo->aParamMapping.end() ) - { - // parameter defined by master slave definition - ::cppu::extractInterface(xMasterField, xParentCols->getByName(*pMasterFields)); - do - { - m_pParameterInfo->xParamsAsIndex->getByIndex(aFind->second) >>= xDetailField; - OSL_ENSURE(xDetailField.is(),"ParameterField is not valid!"); - - // get the type of the param - aParamType = xDetailField->getPropertyValue(PROPERTY_FIELDTYPE); - DBG_ASSERT(aParamType.getValueType().getTypeClass() == TypeClass_LONG, "ODatabaseForm::fillParameters : invalid parameter field !"); - sal_Int32 nScale = 0; - if (hasProperty(PROPERTY_SCALE, xDetailField)) - { - aScale = xDetailField->getPropertyValue(PROPERTY_SCALE); - DBG_ASSERT(aScale.getValueType().getTypeClass() == TypeClass_LONG, "ODatabaseForm::fillParameters : invalid parameter field !"); - nScale = getINT32(aScale); - } - // and fill the param value - aValue = xMasterField->getPropertyValue(PROPERTY_VALUE); - // parameters are based at 1 - try - { - xExecutionParams->setObjectWithInfo(aFind->second + 1, aValue, getINT32(aParamType), nScale); - } - catch( const Exception& ) - { - OSL_ENSURE( sal_False, - ::rtl::OString( "ODatabaseForm::fillParameters: master-detail parameter number " ) - += ::rtl::OString::valueOf( sal_Int32(aFind->second + 1) )); - } - ++aFind; - } - while ( aFind != m_pParameterInfo->aParamMapping.end() ); - } - else - // no column matching so leave the parameter setting - return true; - } - } - } - } - - // now fill the remaining params - bool bCanceled = false; - if (_rxCompletionHandler.is()) - { - // ask the handler for the missing parameters - - // ensure we're connected - if (!implEnsureConnection()) - return sal_False; - - // two continuations (Ok and Cancel) - OInteractionAbort* pAbort = new OInteractionAbort; - OParameterContinuation* pParams = new OParameterContinuation; - - // the request - ParametersRequest aRequest; - aRequest.Parameters = m_pParameterInfo->pParameters; - aRequest.Connection = getConnection(); - OInteractionRequest* pRequest = new OInteractionRequest(makeAny(aRequest)); - Reference< XInteractionRequest > xRequest(pRequest); - - // some knittings - pRequest->addContinuation(pAbort); - pRequest->addContinuation(pParams); - - // execute the request - _rxCompletionHandler->handle(xRequest); - - if (!pParams->wasSelected()) - // canceled by the user (i.e. (s)he canceled the dialog) - return sal_False; - - // transfer the values from the continuation object to the parameter columns - Sequence< PropertyValue > aFinalValues = pParams->getValues(); - const PropertyValue* pFinalValues = aFinalValues.getConstArray(); - for (sal_Int32 i=0; i<aFinalValues.getLength(); ++i, ++pFinalValues) - { - Reference< XPropertySet > xParamColumn; - ::cppu::extractInterface(xParamColumn, aRequest.Parameters->getByIndex(i)); - if (xParamColumn.is()) - { -#ifdef DBG_UTIL - ::rtl::OUString sName; - xParamColumn->getPropertyValue(PROPERTY_NAME) >>= sName; - DBG_ASSERT(sName.equals(pFinalValues->Name), "ODatabaseForm::fillParameters: inconsistent parameter names!"); -#endif - xParamColumn->setPropertyValue(PROPERTY_VALUE, pFinalValues->Value); - // the property sets are wrapper classes, translating the Value property into a call to - // the appropriate XParameters interface - } - } - } - else - { - sal_Int32 nParamsLeft = rParams.size(); - if (nParamsLeft) - { - ::cppu::OInterfaceIteratorHelper aIter(m_aParameterListeners); - DatabaseParameterEvent aEvt(static_cast<XWeak*>(this), m_pParameterInfo->pParameters); - - _rClearForNotifies.clear(); - while (aIter.hasMoreElements() && !bCanceled) - bCanceled = !((XDatabaseParameterListener*)aIter.next())->approveParameter(aEvt); - _rClearForNotifies.reset(); - } - } - return !bCanceled; -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::saveInsertOnlyState( ) -{ - OSL_ENSURE( !m_aIgnoreResult.hasValue(), "ODatabaseForm::saveInsertOnlyState: overriding old value!" ); - m_aIgnoreResult = m_xAggregateSet->getPropertyValue( PROPERTY_INSERTONLY ); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::restoreInsertOnlyState( ) -{ - if ( m_aIgnoreResult.hasValue() ) - { - m_xAggregateSet->setPropertyValue( PROPERTY_INSERTONLY, m_aIgnoreResult ); - m_aIgnoreResult = Any(); - } -} - -//------------------------------------------------------------------------------ -sal_Bool ODatabaseForm::executeRowSet(::osl::ResettableMutexGuard& _rClearForNotifies, sal_Bool bMoveToFirst, const Reference< XInteractionHandler >& _rxCompletionHandler) -{ - if (!m_xAggregateAsRowSet.is()) - return sal_False; - - if (!fillParameters(_rClearForNotifies, _rxCompletionHandler)) - return sal_False; - - restoreInsertOnlyState( ); - - // ensure the aggregated row set has the correct properties - sal_Int32 nConcurrency; - // if we have a parent, who is not positioned on a valid row - // we can't be updatable! - if (m_bSubForm && !hasValidParent()) - { - // don't use any parameters if we don't have a valid parent - nConcurrency = ResultSetConcurrency::READ_ONLY; - // clearParameters(); - if(m_pParameterInfo && m_pParameterInfo->nCount > 0) - { - // reset all parameter values - // (fs@openoffice.org: what is the difference to the "clearParameter" call which was removed - // in revision 1.39, and replaced with the lines below??) - Reference<XParameters> xExecutionParams; - query_aggregation( m_xAggregate, xExecutionParams); - for (sal_Int32 nPos=1;nPos <= m_pParameterInfo->nCount; ++nPos) - xExecutionParams->setNull(nPos,DataType::VARCHAR); - - // switch to "insert only" mode - saveInsertOnlyState( ); - m_xAggregateSet->setPropertyValue( PROPERTY_INSERTONLY, makeAny( sal_True ) ); - } - } - else if (m_bAllowInsert || m_bAllowUpdate || m_bAllowDelete) - nConcurrency = ResultSetConcurrency::UPDATABLE; - else - nConcurrency = ResultSetConcurrency::READ_ONLY; - - m_xAggregateSet->setPropertyValue(PROPERTY_RESULTSET_CONCURRENCY, makeAny(nConcurrency)); - - sal_Int32 nResultSetType = ResultSetType::SCROLL_SENSITIVE; - m_xAggregateSet->setPropertyValue(PROPERTY_RESULTSET_TYPE, makeAny(nResultSetType)); - - sal_Bool bSuccess = sal_False; - try - { - m_xAggregateAsRowSet->execute(); - bSuccess = sal_True; - } - catch(RowSetVetoException& eVeto) - { - eVeto; - } - catch(SQLException& eDb) - { - _rClearForNotifies.clear(); - if (m_sCurrentErrorContext.getLength()) - onError(eDb, m_sCurrentErrorContext); - else - onError(eDb, FRM_RES_STRING(RID_STR_READERROR)); - _rClearForNotifies.reset(); - } - - if (bSuccess) - { - // adjust the privilege property - // m_nPrivileges; - m_xAggregateSet->getPropertyValue(PROPERTY_PRIVILEGES) >>= m_nPrivileges; - if (!m_bAllowInsert) - m_nPrivileges &= ~Privilege::INSERT; - if (!m_bAllowUpdate) - m_nPrivileges &= ~Privilege::UPDATE; - if (!m_bAllowDelete) - m_nPrivileges &= ~Privilege::DELETE; - - if (bMoveToFirst) - { - // the row set is positioned _before_ the first row (per definitionem), so move the set ... - try - { - // if we have an insert only rowset we move to the insert row - next(); - if (((m_nPrivileges & Privilege::INSERT) == Privilege::INSERT) - && isAfterLast()) - { - // move on the insert row of set - // resetting must be done later, after the load events have been posted - // see :moveToInsertRow and load , reload - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - xUpdate->moveToInsertRow(); - } - } - catch(SQLException& eDB) - { - _rClearForNotifies.clear(); - if (m_sCurrentErrorContext.getLength()) - onError(eDB, m_sCurrentErrorContext); - else - onError(eDB, FRM_RES_STRING(RID_STR_READERROR)); - _rClearForNotifies.reset(); - bSuccess = sal_False; - } - } - } - return bSuccess; -} - -//------------------------------------------------------------------ -void ODatabaseForm::disposing() -{ - if (m_pAggregatePropertyMultiplexer) - m_pAggregatePropertyMultiplexer->dispose(); - - if (m_bLoaded) - unload(); - - // cancel the submit/reset-thread - { - ::osl::MutexGuard aGuard( m_aMutex ); - if (m_pThread) - { - m_pThread->release(); - m_pThread = NULL; - } - } - - EventObject aEvt(static_cast<XWeak*>(this)); - m_aLoadListeners.disposeAndClear(aEvt); - m_aRowSetApproveListeners.disposeAndClear(aEvt); - m_aParameterListeners.disposeAndClear(aEvt); - m_aResetListeners.disposeAndClear(aEvt); - m_aSubmitListeners.disposeAndClear(aEvt); - m_aErrorListeners.disposeAndClear(aEvt); - - OFormComponents::disposing(); - OPropertySetAggregationHelper::disposing(); - - // stop listening on the aggregate - if (m_xAggregateAsRowSet.is()) - m_xAggregateAsRowSet->removeRowSetListener(this); - - // dispose the active connection - Reference<XComponent> xAggregationComponent; - if (query_aggregation(m_xAggregate, xAggregationComponent)) - xAggregationComponent->dispose(); -} - -//------------------------------------------------------------------------------ -Reference< XConnection > ODatabaseForm::getConnection() -{ - Reference< XConnection > xConn; - m_xAggregateSet->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xConn; - return xConn; -} - -//============================================================================== -// property handling -//------------------------------------------------------------------------------ -void ODatabaseForm::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - BEGIN_AGGREGATION_PROPERTY_HELPER(15, m_xAggregateSet) - // this property is overwritten by the form - RemoveProperty(_rAggregateProps, PROPERTY_PRIVILEGES); - RemoveProperty(_rAggregateProps, PROPERTY_DATASOURCE); - RemoveProperty(_rAggregateProps, PROPERTY_ACTIVE_CONNECTION); - // we remove and re-declare the DataSourceName property, 'cause we want it to be constrained, and the - // original property of our aggregate isn't - - DECL_IFACE_PROP3(ACTIVE_CONNECTION, XConnection, BOUND, TRANSIENT, MAYBEVOID); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(MASTERFIELDS, Sequence< ::rtl::OUString >, BOUND); - DECL_PROP1(DETAILFIELDS, Sequence< ::rtl::OUString >, BOUND); - DECL_PROP2(DATASOURCE, ::rtl::OUString, BOUND, CONSTRAINED); - DECL_PROP3(CYCLE, TabulatorCycle, BOUND, MAYBEVOID, MAYBEDEFAULT); - DECL_PROP1(NAVIGATION, NavigationBarMode, BOUND); - DECL_BOOL_PROP1(ALLOWADDITIONS, BOUND); - DECL_BOOL_PROP1(ALLOWEDITS, BOUND); - DECL_BOOL_PROP1(ALLOWDELETIONS, BOUND); - DECL_PROP2(PRIVILEGES, sal_Int32, TRANSIENT, READONLY); - DECL_PROP1(TARGET_URL, ::rtl::OUString, BOUND); - DECL_PROP1(TARGET_FRAME, ::rtl::OUString, BOUND); - DECL_PROP1(SUBMIT_METHOD, FormSubmitMethod, BOUND); - DECL_PROP1(SUBMIT_ENCODING, FormSubmitEncoding, BOUND); - END_AGGREGATION_PROPERTY_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& ODatabaseForm::getInfoHelper() -{ - return *const_cast<ODatabaseForm*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> ODatabaseForm::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xDescriptorInfo( createPropertySetInfo( getInfoHelper() ) ); - return xDescriptorInfo; -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::fire( sal_Int32* pnHandles, const Any* pNewValues, const Any* pOldValues, sal_Int32 nCount, sal_Bool bVetoable ) -{ - // same as in getFastPropertyValue(INT32) : if we're resetting currently don't fire any changes of the - // IsModified property from FALSE to TRUE, as this is only temporary 'til the reset is done - if (m_nResetsPending > 0) - { - // look for the PROPERTY_ID_ISMODIFIED - sal_Int32 nPos = 0; - for (nPos=0; nPos<nCount; ++nPos) - if (pnHandles[nPos] == PROPERTY_ID_ISMODIFIED) - break; - - if ((nPos < nCount) && (pNewValues[nPos].getValueType().getTypeClass() == TypeClass_BOOLEAN) && getBOOL(pNewValues[nPos])) - { // yeah, we found it, and it changed to TRUE - if (nPos == 0) - { // just cut the first element - ++pnHandles; - ++pNewValues; - ++pOldValues; - --nCount; - } - else if (nPos == nCount - 1) - // just cut the last element - --nCount; - else - { // split into two base class calls - OPropertySetAggregationHelper::fire(pnHandles, pNewValues, pOldValues, nPos, bVetoable); - ++nPos; - OPropertySetAggregationHelper::fire(pnHandles + nPos, pNewValues + nPos, pOldValues + nPos, nCount - nPos, bVetoable); - return; - } - } - } - - OPropertySetAggregationHelper::fire(pnHandles, pNewValues, pOldValues, nCount, bVetoable); -} - -//------------------------------------------------------------------------------ -Any SAL_CALL ODatabaseForm::getFastPropertyValue( sal_Int32 nHandle ) - throw(UnknownPropertyException, WrappedTargetException, RuntimeException) -{ - if ((nHandle == PROPERTY_ID_ISMODIFIED) && (m_nResetsPending > 0)) - return ::cppu::bool2any((sal_False)); - // don't allow the aggregate which is currently reset to return a (temporary) "yes" - else - return OPropertySetAggregationHelper::getFastPropertyValue(nHandle); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_DATASOURCE: - { - rValue = makeAny(::rtl::OUString()); - try - { - rValue = m_xAggregateSet->getPropertyValue(PROPERTY_DATASOURCE); - } - catch(Exception&) { } - } - break; - case PROPERTY_ID_ACTIVE_CONNECTION: - { - try - { - rValue = m_xAggregateSet->getPropertyValue(PROPERTY_ACTIVE_CONNECTION); - } - catch(Exception&) { } - } - break; - case PROPERTY_ID_TARGET_URL: - rValue <<= m_aTargetURL; - break; - case PROPERTY_ID_TARGET_FRAME: - rValue <<= m_aTargetFrame; - break; - case PROPERTY_ID_SUBMIT_METHOD: - rValue <<= m_eSubmitMethod; - break; - case PROPERTY_ID_SUBMIT_ENCODING: - rValue <<= m_eSubmitEncoding; - break; - case PROPERTY_ID_NAME: - rValue <<= m_sName; - break; - case PROPERTY_ID_MASTERFIELDS: - rValue <<= m_aMasterFields; - break; - case PROPERTY_ID_DETAILFIELDS: - rValue <<= m_aDetailFields; - break; - case PROPERTY_ID_CYCLE: - rValue = m_aCycle; - break; - case PROPERTY_ID_NAVIGATION: - rValue <<= m_eNavigation; - break; - case PROPERTY_ID_ALLOWADDITIONS: - rValue <<= (sal_Bool)m_bAllowInsert; - break; - case PROPERTY_ID_ALLOWEDITS: - rValue <<= (sal_Bool)m_bAllowUpdate; - break; - case PROPERTY_ID_ALLOWDELETIONS: - rValue <<= (sal_Bool)m_bAllowDelete; - break; - case PROPERTY_ID_PRIVILEGES: - rValue <<= (sal_Int32)m_nPrivileges; - break; - } -} - -//------------------------------------------------------------------------------ -sal_Bool ODatabaseForm::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, - sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) -{ - sal_Bool bModified(sal_False); - switch (nHandle) - { - case PROPERTY_ID_DATASOURCE: - { - Any aAggregateProperty; - getFastPropertyValue(aAggregateProperty, PROPERTY_ID_DATASOURCE); - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, aAggregateProperty, ::getCppuType(static_cast<const ::rtl::OUString*>(NULL))); - } - break; - case PROPERTY_ID_ACTIVE_CONNECTION: - { - Any aAggregateProperty; - getFastPropertyValue(aAggregateProperty, PROPERTY_ID_ACTIVE_CONNECTION); - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, aAggregateProperty, ::getCppuType(static_cast<const Reference<XConnection>*>(NULL))); - } - break; - case PROPERTY_ID_TARGET_URL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTargetURL); - break; - case PROPERTY_ID_TARGET_FRAME: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTargetFrame); - break; - case PROPERTY_ID_SUBMIT_METHOD: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_eSubmitMethod); - break; - case PROPERTY_ID_SUBMIT_ENCODING: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_eSubmitEncoding); - break; - case PROPERTY_ID_NAME: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sName); - break; - case PROPERTY_ID_MASTERFIELDS: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aMasterFields); - break; - case PROPERTY_ID_DETAILFIELDS: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDetailFields); - break; - case PROPERTY_ID_CYCLE: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aCycle, ::getCppuType(static_cast<const TabulatorCycle*>(NULL))); - break; - case PROPERTY_ID_NAVIGATION: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_eNavigation); - break; - case PROPERTY_ID_ALLOWADDITIONS: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAllowInsert); - break; - case PROPERTY_ID_ALLOWEDITS: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAllowUpdate); - break; - case PROPERTY_ID_ALLOWDELETIONS: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAllowDelete); - break; - default: - DBG_ERROR("ODatabaseForm::convertFastPropertyValue : unknown property !"); - } - return bModified; -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw( Exception ) -{ - switch (nHandle) - { - case PROPERTY_ID_DATASOURCE: - try - { - m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, rValue); - } - catch(Exception&) { } - break; - case PROPERTY_ID_ACTIVE_CONNECTION: - try - { - if ( m_bSharingConnection ) - stopSharingConnection( ); - - m_bForwardingConnection = sal_True; - m_xAggregateSet->setPropertyValue(PROPERTY_ACTIVE_CONNECTION, rValue); - m_bForwardingConnection = sal_False; - } - catch(Exception&) { } - break; - case PROPERTY_ID_TARGET_URL: - rValue >>= m_aTargetURL; - break; - case PROPERTY_ID_TARGET_FRAME: - rValue >>= m_aTargetFrame; - break; - case PROPERTY_ID_SUBMIT_METHOD: - rValue >>= m_eSubmitMethod; - break; - case PROPERTY_ID_SUBMIT_ENCODING: - rValue >>= m_eSubmitEncoding; - break; - case PROPERTY_ID_NAME: - rValue >>= m_sName; - break; - case PROPERTY_ID_MASTERFIELDS: - rValue >>= m_aMasterFields; - invlidateParameters(); - break; - case PROPERTY_ID_DETAILFIELDS: - rValue >>= m_aDetailFields; - invlidateParameters(); - break; - case PROPERTY_ID_CYCLE: - m_aCycle = rValue; - break; - case PROPERTY_ID_NAVIGATION: - rValue >>= m_eNavigation; - break; - case PROPERTY_ID_ALLOWADDITIONS: - m_bAllowInsert = getBOOL(rValue); - break; - case PROPERTY_ID_ALLOWEDITS: - m_bAllowUpdate = getBOOL(rValue); - break; - case PROPERTY_ID_ALLOWDELETIONS: - m_bAllowDelete = getBOOL(rValue); - break; - default: - DBG_ERROR("ODatabaseForm::setFastPropertyValue_NoBroadcast : unknown property !"); - } -} - -//============================================================================== -// com::sun::star::beans::XPropertyState -//------------------------------------------------------------------ -PropertyState ODatabaseForm::getPropertyStateByHandle(sal_Int32 nHandle) -{ - PropertyState eState; - switch (nHandle) - { - case PROPERTY_ID_NAVIGATION: - return (NavigationBarMode_CURRENT == m_eNavigation) ? PropertyState_DEFAULT_VALUE : PropertyState_DIRECT_VALUE; - break; - case PROPERTY_ID_CYCLE: - if (!m_aCycle.hasValue()) - eState = PropertyState_DEFAULT_VALUE; - else - eState = PropertyState_DIRECT_VALUE; - break; - default: - eState = OPropertySetAggregationHelper::getPropertyStateByHandle(nHandle); - } - return eState; -} - -//------------------------------------------------------------------ -void ODatabaseForm::setPropertyToDefaultByHandle(sal_Int32 nHandle) -{ - switch (nHandle) - { - case PROPERTY_ID_NAVIGATION: - setFastPropertyValue(nHandle, makeAny(NavigationBarMode_CURRENT)); - break; - case PROPERTY_ID_CYCLE: - setFastPropertyValue(nHandle, Any()); - break; - default: - OPropertySetAggregationHelper::setPropertyToDefaultByHandle(nHandle); - } -} - -//------------------------------------------------------------------ -Any ODatabaseForm::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_NAVIGATION: - return makeAny(NavigationBarMode_CURRENT); - break; - case PROPERTY_ID_CYCLE: - return Any(); - default: - return OPropertySetAggregationHelper::getPropertyDefaultByHandle(nHandle); - } -} - -//============================================================================== -// com::sun::star::form::XReset -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::reset() throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - - if (isLoaded()) - { - ::osl::MutexGuard aResetGuard(m_aResetSafety); - ++m_nResetsPending; - reset_impl(true); - return; - } - - if (m_aResetListeners.getLength()) - { - ::osl::MutexGuard aResetGuard(m_aResetSafety); - ++m_nResetsPending; - // create an own thread if we have (approve-)reset-listeners (so the listeners can't do that much damage - // to this thread which is probably the main one) - if (!m_pThread) - { - m_pThread = new OFormSubmitResetThread(this); - m_pThread->acquire(); - m_pThread->create(); - } - EventObject aEvt; - m_pThread->addEvent(&aEvt, sal_False); - } - else - { - // direct call without any approving by the listeners - aGuard.clear(); - - ::osl::MutexGuard aResetGuard(m_aResetSafety); - ++m_nResetsPending; - reset_impl(false); - } -} - -//----------------------------------------------------------------------------- -void ODatabaseForm::reset_impl(bool _bAproveByListeners) -{ - if (_bAproveByListeners) - { - bool bCanceled = false; - ::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); - EventObject aEvt(static_cast<XWeak*>(this)); - - while (aIter.hasMoreElements() && !bCanceled) - if (!((XResetListener*)aIter.next())->approveReset(aEvt)) - bCanceled = true; - if (bCanceled) - return; - } - - ::osl::ResettableMutexGuard aResetGuard(m_aResetSafety); - // do we have a database connected form and stay on the insert row - sal_Bool bInsertRow = sal_False; - if (m_xAggregateSet.is()) - bInsertRow = getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ISNEW)); - if (bInsertRow) - { - try - { - // Iterate through all columns and set the default value - Reference< XColumnsSupplier > xColsSuppl( m_xAggregateSet, UNO_QUERY ); - Reference< XIndexAccess > xIndexCols( xColsSuppl->getColumns(), UNO_QUERY ); - for (sal_Int32 i = 0; i < xIndexCols->getCount(); ++i) - { - Reference< XPropertySet > xColProps; - xIndexCols->getByIndex(i) >>= xColProps; - - Reference< XColumnUpdate > xColUpdate( xColProps, UNO_QUERY ); - if ( !xColUpdate.is() ) - continue; - - Reference< XPropertySetInfo > xPSI; - if ( xColProps.is() ) - xPSI = xColProps->getPropertySetInfo( ); - - static const ::rtl::OUString PROPERTY_CONTROLDEFAULT( RTL_CONSTASCII_USTRINGPARAM( "ControlDefault" ) ); - if ( xPSI.is() && xPSI->hasPropertyByName( PROPERTY_CONTROLDEFAULT ) ) - { - Any aDefault = xColProps->getPropertyValue( PROPERTY_CONTROLDEFAULT ); - - sal_Bool bReadOnly = sal_False; - if ( xPSI->hasPropertyByName( PROPERTY_ISREADONLY ) ) - xColProps->getPropertyValue( PROPERTY_ISREADONLY ) >>= bReadOnly; - - if ( !bReadOnly ) - { - try - { - if ( aDefault.hasValue() ) - xColUpdate->updateObject( aDefault ); - } - catch(Exception&) - { - } - } - } - } - } - catch(Exception&) - { - } - - if (m_bSubForm) - { - // Iterate through all columns and set the default value - Reference<XColumnsSupplier> xColsSuppl(m_xAggregateSet, UNO_QUERY); - - // now set the values on which a subform depends - Reference<XColumnsSupplier> xParentColsSuppl(m_xParent, UNO_QUERY); - Reference<XNameAccess> xParentCols = xParentColsSuppl->getColumns(); - sal_Int32 nMasterLen = m_aMasterFields.getLength(); - if (xParentCols->hasElements() && (nMasterLen > 0)) - { - try - { - // analyze our parameters - if ( !m_pParameterInfo ) - createParameterInfo(); - - if ( m_pParameterInfo && m_pParameterInfo->nCount ) - { - Reference<XNameAccess> xCols(xColsSuppl->getColumns(), UNO_QUERY); - - const ::rtl::OUString* pMasterFields = m_aMasterFields.getConstArray(); - const ::rtl::OUString* pDetailFields = m_aDetailFields.getConstArray(); - const ::rtl::OUString* pDetailFieldsEnd = pDetailFields + m_aDetailFields.getLength(); - for (pDetailFields; pDetailFields < pDetailFieldsEnd; ++pDetailFields, ++pMasterFields) - { - Reference<XPropertySet> xMasterField, xField; - MapUString2INT32::const_iterator aFind; - if ( (aFind = m_pParameterInfo->aParamMapping.find(*pDetailFields)) != m_pParameterInfo->aParamMapping.end() ) - { // we really have a parameter column with this name - Reference< XPropertySet > xParamColumn; - do - { - m_pParameterInfo->xParamsAsIndex->getByIndex(aFind->second) >>= xParamColumn; - if (xParamColumn.is()) - { // we really really have it :) - ::rtl::OUString sParamColumnRealName; - xParamColumn->getPropertyValue(PROPERTY_REALNAME) >>= sParamColumnRealName; - if (xCols->hasByName(sParamColumnRealName)) - { // our own columns have a column which's name equals the real name of the param column - if (xParentCols->hasByName(*pMasterFields)) - { // and our parent's cols know the master field which is connected to the current detail field - - // -> transfer the value property - xParentCols->getByName(*pMasterFields) >>= xMasterField; - xCols->getByName(sParamColumnRealName) >>= xField; - if (xField.is() && xMasterField.is()) - xField->setPropertyValue(PROPERTY_VALUE, xMasterField->getPropertyValue(PROPERTY_VALUE)); - } - } - } - ++aFind; - } - while ( aFind != m_pParameterInfo->aParamMapping.end() ); - } - } - } - } - catch(const Exception&) - { - OSL_ENSURE(sal_False, "ODatabaseForm::reset_impl: could not initialize the master-detail-driven parameters!"); - } - } - } - } - - aResetGuard.clear(); - // iterate through all components. don't use an XIndexAccess as this will cause massive - // problems with the count. - Reference<XEnumeration> xIter = createEnumeration(); - while (xIter->hasMoreElements()) - { - Reference<XReset> xReset; - xIter->nextElement() >>= xReset; - if (xReset.is()) - { - // TODO : all reset-methods have to be thread-safe - xReset->reset(); - } - } - - aResetGuard.reset(); - // ensure that the row isn't modified - // (do this _before_ the listeners are notified ! their reaction (maybe asynchronous) may depend - // on the modified state of the row - // 21.02.00 - 73265 - FS) - if (bInsertRow) - m_xAggregateSet->setPropertyValue(PROPERTY_ISMODIFIED, ::cppu::bool2any(sal_Bool(sal_False))); - - aResetGuard.clear(); - { - EventObject aEvt(static_cast<XWeak*>(this)); - m_aResetListeners.notifyEach(&XResetListener::resetted, aEvt); - } - - aResetGuard.reset(); - // and again : ensure the row isn't modified - // we already did this after we (and maybe our dependents) resetted the values, but the listeners may have changed the row, too - if (bInsertRow) - m_xAggregateSet->setPropertyValue(PROPERTY_ISMODIFIED, ::cppu::bool2any((sal_False))); - - --m_nResetsPending; -} - -//----------------------------------------------------------------------------- -void SAL_CALL ODatabaseForm::addResetListener(const Reference<XResetListener>& _rListener) throw( RuntimeException ) -{ - m_aResetListeners.addInterface(_rListener); -} - -//----------------------------------------------------------------------------- -void SAL_CALL ODatabaseForm::removeResetListener(const Reference<XResetListener>& _rListener) throw( RuntimeException ) -{ - m_aResetListeners.removeInterface(_rListener); -} - -//============================================================================== -// com::sun::star::form::XSubmit -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::submit( const Reference<XControl>& Control, - const ::com::sun::star::awt::MouseEvent& MouseEvt ) throw( RuntimeException ) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - // Sind Controls und eine Submit-URL vorhanden? - if( !getCount() || !m_aTargetURL.getLength() ) - return; - } - - ::osl::ClearableMutexGuard aGuard(m_aMutex); - if (m_aSubmitListeners.getLength()) - { - // create an own thread if we have (approve-)submit-listeners (so the listeners can't do that much damage - // to this thread which is probably the main one) - if (!m_pThread) - { - m_pThread = new OFormSubmitResetThread(this); - m_pThread->acquire(); - m_pThread->create(); - } - m_pThread->addEvent(&MouseEvt, Control, sal_True); - } - else - { - // direct call without any approving by the listeners - aGuard.clear(); - submit_impl( Control, MouseEvt, true ); - } -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::submit_impl(const Reference<XControl>& Control, const ::com::sun::star::awt::MouseEvent& MouseEvt, bool _bAproveByListeners) -{ - - if (_bAproveByListeners) - { - ::cppu::OInterfaceIteratorHelper aIter(m_aSubmitListeners); - EventObject aEvt(static_cast<XWeak*>(this)); - sal_Bool bCanceled = sal_False; - while (aIter.hasMoreElements() && !bCanceled) - { - if (!((XSubmitListener*)aIter.next())->approveSubmit(aEvt)) - bCanceled = sal_True; - } - - if (bCanceled) - return; - } - - FormSubmitEncoding eSubmitEncoding; - FormSubmitMethod eSubmitMethod; - ::rtl::OUString aURLStr; - ::rtl::OUString aReferer; - ::rtl::OUString aTargetName; - Reference< XModel > xModel; - { - SolarMutexGuard aGuard; - // starform->Forms - - Reference<XChild> xParent(m_xParent, UNO_QUERY); - - if (xParent.is()) - xModel = getXModel(xParent->getParent()); - - if (xModel.is()) - aReferer = xModel->getURL(); - - // TargetItem - aTargetName = m_aTargetFrame; - - eSubmitEncoding = m_eSubmitEncoding; - eSubmitMethod = m_eSubmitMethod; - aURLStr = m_aTargetURL; - } - - if (!xModel.is()) - return; - - Reference<XURLTransformer> - xTransformer(m_xServiceFactory->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")), UNO_QUERY); - DBG_ASSERT(xTransformer.is(), "ODatabaseForm::submit_impl : could not create an URL transformer !"); - - // URL-Encoding - if( eSubmitEncoding == FormSubmitEncoding_URL ) - { - ::rtl::OUString aData; - { - SolarMutexGuard aGuard; - aData = GetDataURLEncoded( Control, MouseEvt ); - } - - Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); - if (!xFrame.is()) - return; - - URL aURL; - // FormMethod GET - if( eSubmitMethod == FormSubmitMethod_GET ) - { - INetURLObject aUrlObj( aURLStr, INetURLObject::WAS_ENCODED ); - aUrlObj.SetParam( aData, INetURLObject::ENCODE_ALL ); - aURL.Complete = aUrlObj.GetMainURL( INetURLObject::DECODE_UNAMBIGUOUS ); - if (xTransformer.is()) - xTransformer->parseStrict(aURL); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); - - if (xDisp.is()) - { - Sequence<PropertyValue> aArgs(1); - aArgs.getArray()->Name = ::rtl::OUString::createFromAscii("Referer"); - aArgs.getArray()->Value <<= aReferer; - xDisp->dispatch(aURL, aArgs); - } - } - // FormMethod POST - else if( eSubmitMethod == FormSubmitMethod_POST ) - { - aURL.Complete = aURLStr; - xTransformer->parseStrict(aURL); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); - - if (xDisp.is()) - { - Sequence<PropertyValue> aArgs(2); - aArgs.getArray()[0].Name = ::rtl::OUString::createFromAscii("Referer"); - aArgs.getArray()[0].Value <<= aReferer; - - // build a sequence from the to-be-submitted string - ByteString a8BitData(aData.getStr(), (sal_uInt16)aData.getLength(), RTL_TEXTENCODING_MS_1252); - // always ANSI #58641 - Sequence< sal_Int8 > aPostData((sal_Int8*)a8BitData.GetBuffer(), a8BitData.Len()); - Reference< XInputStream > xPostData = new SequenceInputStream(aPostData); - - aArgs.getArray()[1].Name = ::rtl::OUString::createFromAscii("PostData"); - aArgs.getArray()[1].Value <<= xPostData; - - xDisp->dispatch(aURL, aArgs); - } - } - } - else if( eSubmitEncoding == FormSubmitEncoding_MULTIPART ) - { - Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); - if (!xFrame.is()) - return; - - URL aURL; - aURL.Complete = aURLStr; - xTransformer->parseStrict(aURL); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); - - if (xDisp.is()) - { - ::rtl::OUString aContentType; - Sequence<sal_Int8> aData; - { - SolarMutexGuard aGuard; - aData = GetDataMultiPartEncoded(Control, MouseEvt, aContentType); - } - if (!aData.getLength()) - return; - - Sequence<PropertyValue> aArgs(3); - aArgs.getArray()[0].Name = ::rtl::OUString::createFromAscii("Referer"); - aArgs.getArray()[0].Value <<= aReferer; - aArgs.getArray()[1].Name = ::rtl::OUString::createFromAscii("ContentType"); - aArgs.getArray()[1].Value <<= aContentType; - - // build a sequence from the to-be-submitted string - Reference< XInputStream > xPostData = new SequenceInputStream(aData); - - aArgs.getArray()[2].Name = ::rtl::OUString::createFromAscii("PostData"); - aArgs.getArray()[2].Value <<= xPostData; - - xDisp->dispatch(aURL, aArgs); - } - } - else if( eSubmitEncoding == FormSubmitEncoding_TEXT ) - { - ::rtl::OUString aData; - { - SolarMutexGuard aGuard; - aData = GetDataTextEncoded( Reference<XControl> (), MouseEvt ); - } - - Reference< XFrame > xFrame = xModel->getCurrentController()->getFrame(); - if (!xFrame.is()) - return; - - URL aURL; - - aURL.Complete = aURLStr; - xTransformer->parseStrict(aURL); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aURL, aTargetName, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | FrameSearchFlag::CHILDREN | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE | FrameSearchFlag::TASKS); - - if (xDisp.is()) - { - Sequence<PropertyValue> aArgs(2); - aArgs.getArray()[0].Name = ::rtl::OUString::createFromAscii("Referer"); - aArgs.getArray()[0].Value <<= aReferer; - - // build a sequence from the to-be-submitted string - ByteString aSystemEncodedData(aData.getStr(), (sal_uInt16)aData.getLength(), osl_getThreadTextEncoding()); - Sequence< sal_Int8 > aPostData((sal_Int8*)aSystemEncodedData.GetBuffer(), aSystemEncodedData.Len()); - Reference< XInputStream > xPostData = new SequenceInputStream(aPostData); - - aArgs.getArray()[1].Name = ::rtl::OUString::createFromAscii("PostData"); - aArgs.getArray()[1].Value <<= xPostData; - - xDisp->dispatch(aURL, aArgs); - } - } - else - DBG_ERROR("ODatabaseForm::submit_Impl : wrong encoding !"); - -} - -// XSubmit -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::addSubmitListener(const Reference<XSubmitListener>& _rListener) throw( RuntimeException ) -{ - m_aSubmitListeners.addInterface(_rListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::removeSubmitListener(const Reference<XSubmitListener>& _rListener) throw( RuntimeException ) -{ - m_aSubmitListeners.removeInterface(_rListener); -} - -//============================================================================== -// com::sun::star::sdbc::XSQLErrorBroadcaster -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::addSQLErrorListener(const Reference<XSQLErrorListener>& _rListener) throw( RuntimeException ) -{ - m_aErrorListeners.addInterface(_rListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::removeSQLErrorListener(const Reference<XSQLErrorListener>& _rListener) throw( RuntimeException ) -{ - m_aErrorListeners.removeInterface(_rListener); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::invlidateParameters() -{ - ::osl::MutexGuard aGuard(m_aMutex); - DELETEZ(m_pParameterInfo); - clearParameters(); -} - -//============================================================================== -// OChangeListener -//------------------------------------------------------------------------------ -void ODatabaseForm::_propertyChanged(const PropertyChangeEvent& evt) throw( RuntimeException ) -{ - if ((0 == evt.PropertyName.compareToAscii(PROPERTY_ACTIVE_CONNECTION)) && !m_bForwardingConnection) - { - // the rowset changed it's active connection itself (without interaction from our side), so - // we need to fire this event, too - sal_Int32 nHandle = PROPERTY_ID_ACTIVE_CONNECTION; - fire(&nHandle, &evt.NewValue, &evt.OldValue, 1, sal_False); - } - else // it was one of the statement relevant props - { - // if the statement has changed we have to delete the parameter info - invlidateParameters(); - } -} - -//============================================================================== -// smartXChild -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - - Reference<XForm> xParentForm(getParent(), UNO_QUERY); - if (xParentForm.is()) - { - Reference<XRowSetApproveBroadcaster> xParentApprBroadcast(xParentForm, UNO_QUERY); - if (xParentApprBroadcast.is()) - xParentApprBroadcast->removeRowSetApproveListener(this); - Reference<XLoadable> xParentLoadable(xParentForm, UNO_QUERY); - if (xParentLoadable.is()) - xParentLoadable->removeLoadListener(this); - } - - OFormComponents::setParent(Parent); - - xParentForm = Reference<XForm> (getParent(), UNO_QUERY); - if (xParentForm.is()) - { - Reference<XRowSetApproveBroadcaster> xParentApprBroadcast(xParentForm, UNO_QUERY); - if (xParentApprBroadcast.is()) - xParentApprBroadcast->addRowSetApproveListener(this); - Reference<XLoadable> xParentLoadable(xParentForm, UNO_QUERY); - if (xParentLoadable.is()) - xParentLoadable->addLoadListener(this); - } -} - -//============================================================================== -// smartXTabControllerModel -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::getGroupControl() throw(com::sun::star::uno::RuntimeException) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - - // Sollen Controls in einer TabOrder gruppe zusammengefasst werden? - if (m_aCycle.hasValue()) - { - sal_Int32 nCycle; - ::cppu::enum2int(nCycle, m_aCycle); - return nCycle != TabulatorCycle_PAGE; - } - - if (isLoaded() && getConnection().is()) - return sal_True; - - return sal_False; -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setControlModels(const Sequence<Reference<XControlModel> >& rControls) throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - - // TabIndex in der Reihenfolge der Sequence setzen - const Reference<XControlModel>* pControls = rControls.getConstArray(); - sal_Int16 nTabIndex = 1; - sal_Int32 nCount = getCount(); - sal_Int32 nNewCount = rControls.getLength(); - - // HiddenControls und Formulare werden nicht aufgefuehrt - if (nNewCount <= nCount) - { - Any aElement; - for (sal_Int32 i=0; i < nNewCount; ++i, ++pControls) - { - Reference<XFormComponent> xComp(*pControls, UNO_QUERY); - if (xComp.is()) - { - // suchen der Componente in der Liste - for (sal_Int32 j = 0; j < nCount; ++j) - { - Reference<XFormComponent> xElement; - ::cppu::extractInterface(xElement, getByIndex(j)); - if (xComp == xElement) - { - Reference<XPropertySet> xSet(xComp, UNO_QUERY); - if (xSet.is() && hasProperty(PROPERTY_TABINDEX, xSet)) - xSet->setPropertyValue( PROPERTY_TABINDEX, makeAny(nTabIndex++) ); - break; - } - } - } - } - } -} - -//------------------------------------------------------------------------------ -Sequence<Reference<XControlModel> > SAL_CALL ODatabaseForm::getControlModels() throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pGroupManager->getControlModels(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setGroup( const Sequence<Reference<XControlModel> >& _rGroup, const ::rtl::OUString& Name ) throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - - // Die Controls werden gruppiert, indem ihr Name dem Namen des ersten - // Controls der Sequenz angepasst wird - const Reference<XControlModel>* pControls = _rGroup.getConstArray(); - Reference<XPropertySet> xSet; - ::rtl::OUString sGroupName; - - for( sal_Int32 i=0; i<_rGroup.getLength(); ++i, ++pControls ) - { - Reference< XPropertySet > xSet(*pControls, UNO_QUERY); - if ( !xSet.is() ) - { - // can't throw an exception other than a RuntimeException (which would not be appropriate), - // so we ignore (and only assert) this - OSL_ENSURE( sal_False, "ODatabaseForm::setGroup: invalid arguments!" ); - continue; - } - - if (!sGroupName.getLength()) - xSet->getPropertyValue(PROPERTY_NAME) >>= sGroupName; - else - xSet->setPropertyValue(PROPERTY_NAME, makeAny(sGroupName)); - } -} - -//------------------------------------------------------------------------------ -sal_Int32 SAL_CALL ODatabaseForm::getGroupCount() throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - return m_pGroupManager->getGroupCount(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::getGroup( sal_Int32 nGroup, Sequence<Reference<XControlModel> >& _rGroup, ::rtl::OUString& _rName ) throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - _rGroup.realloc(0); - _rName = ::rtl::OUString(); - - if ((nGroup < 0) || (nGroup >= m_pGroupManager->getGroupCount())) - return; - m_pGroupManager->getGroup( nGroup, _rGroup, _rName ); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::getGroupByName(const ::rtl::OUString& Name, Sequence< Reference<XControlModel> >& _rGroup) throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - _rGroup.realloc(0); - m_pGroupManager->getGroupByName( Name, _rGroup ); -} - -//============================================================================== -// com::sun::star::lang::XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::disposing(const EventObject& Source) throw( RuntimeException ) -{ - // does the call come from the connection which we are sharing with our parent? - if ( isSharingConnection() ) - { - Reference< XConnection > xConnSource( Source.Source, UNO_QUERY ); - if ( xConnSource.is() ) - { -#if OSL_DEBUG_LEVEL > 0 - Reference< XConnection > xActiveConn; - m_xAggregateSet->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xActiveConn; - OSL_ENSURE( xActiveConn.get() == xConnSource.get(), "ODatabaseForm::disposing: where did this come from?" ); - // there should be exactly one XConnection object we're listening at - our aggregate connection -#endif - disposingSharedConnection( xConnSource ); - } - } - - OInterfaceContainer::disposing(Source); - - // does the disposing come from the aggregate ? - if (m_xAggregate.is()) - { // no -> forward it - com::sun::star::uno::Reference<com::sun::star::lang::XEventListener> xListener; - if (query_aggregation(m_xAggregate, xListener)) - xListener->disposing(Source); - } -} - -//============================================================================== -// com::sun::star::form::XLoadListener -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::loaded(const EventObject& aEvent) throw( RuntimeException ) -{ - // now start the rowset listening to recover cursor events - load_impl(sal_True); - { - ::osl::MutexGuard aGuard(m_aMutex); - Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY); - if (xParentRowSet.is()) - xParentRowSet->addRowSetListener(this); - - m_pLoadTimer = new Timer(); - m_pLoadTimer->SetTimeout(100); - m_pLoadTimer->SetTimeoutHdl(LINK(this,ODatabaseForm,OnTimeout)); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::unloading(const EventObject& aEvent) throw( RuntimeException ) -{ - { - // now stop the rowset listening if we are a subform - ::osl::MutexGuard aGuard(m_aMutex); - DELETEZ(m_pLoadTimer); - - Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY); - if (xParentRowSet.is()) - xParentRowSet->removeRowSetListener(this); - } - - unload(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::unloaded(const EventObject& aEvent) throw( RuntimeException ) -{ - // nothing to do -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::reloading(const EventObject& aEvent) throw( RuntimeException ) -{ - // now stop the rowset listening if we are a subform - ::osl::MutexGuard aGuard(m_aMutex); - Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY); - if (xParentRowSet.is()) - xParentRowSet->removeRowSetListener(this); - - if (m_pLoadTimer && m_pLoadTimer->IsActive()) - m_pLoadTimer->Stop(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::reloaded(const EventObject& aEvent) throw( RuntimeException ) -{ - reload_impl(sal_True); - { - ::osl::MutexGuard aGuard(m_aMutex); - Reference<XRowSet> xParentRowSet(m_xParent, UNO_QUERY); - if (xParentRowSet.is()) - xParentRowSet->addRowSetListener(this); - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK( ODatabaseForm, OnTimeout, void*, EMPTYARG ) -{ - reload_impl(sal_True); - return 1; -} - -//============================================================================== -// com::sun::star::form::XLoadable -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::load() throw( RuntimeException ) -{ - load_impl(sal_False); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::disposingSharedConnection( const Reference< XConnection >& _rxConn ) -{ - stopSharingConnection(); - - // TODO: we could think about whether or not to re-connect. - unload( ); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::stopSharingConnection( ) -{ - OSL_ENSURE( m_bSharingConnection, "ODatabaseForm::stopSharingConnection: invalid call!" ); - - if ( m_bSharingConnection ) - { - // get the connection - Reference< XConnection > xSharedConn; - m_xAggregateSet->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) >>= xSharedConn; - OSL_ENSURE( xSharedConn.is(), "ODatabaseForm::stopSharingConnection: there's no conn!" ); - - // remove ourself as event listener - Reference< XComponent > xSharedConnComp( xSharedConn, UNO_QUERY ); - if ( xSharedConnComp.is() ) - xSharedConnComp->removeEventListener( static_cast< XLoadListener* >( this ) ); - - // no need to dispose the conn: we're not the owner, this is our parent - // (in addition, this method may be called if the connection is beeing disposed while we use it) - - // reset the property - xSharedConn.clear(); - m_bForwardingConnection = sal_True; - m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xSharedConn ) ); - m_bForwardingConnection = sal_False; - - // reset the flag - m_bSharingConnection = sal_False; - } -} - -//------------------------------------------------------------------------------ -sal_Bool ODatabaseForm::implEnsureConnection() -{ - OSL_ENSURE( sal_False, "ODatabaseForm::implEnsureConnection: this should be dead code, we're in binfilter here!" ); - return sal_False; -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirst, const Reference< XInteractionHandler >& _rxCompletionHandler ) throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - - // are we already loaded? - if (isLoaded()) - return; - - m_bSubForm = bCausedByParentForm; - - // if we don't have a connection, we are not intended to be a database form or the aggregate was not able - // to establish a connection - sal_Bool bConnected = implEnsureConnection(); - - // we don't have to execute if we do not have a command to execute - sal_Bool bExecute = bConnected && m_xAggregateSet.is() && getString(m_xAggregateSet->getPropertyValue(PROPERTY_COMMAND)).getLength(); - - // a database form always uses caching - // we use starting fetchsize with at least 10 rows - if (bConnected) - m_xAggregateSet->setPropertyValue(PROPERTY_FETCHSIZE, makeAny((sal_Int32)10)); - - // if we're loaded as sub form we got a "rowSetChanged" from the parent rowset _before_ we got the "loaded" - // so we don't need to execute the statement again, this was already done - // (and there were no relevant changes between these two listener calls, the "load" of a form is quite an - // atomar operation.) - - sal_Bool bSuccess = sal_False; - if (bExecute) - { - m_sCurrentErrorContext = FRM_RES_STRING(RID_ERR_LOADING_FORM); - bSuccess = executeRowSet(aGuard, bMoveToFirst, _rxCompletionHandler); - } - - if (bSuccess) - { - m_bLoaded = sal_True; - aGuard.clear(); - EventObject aEvt(static_cast<XWeak*>(this)); - m_aLoadListeners.notifyEach(&XLoadListener::loaded, aEvt); - - // if we are on the insert row, we have to reset all controls - // to set the default values - if (bExecute && getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ISNEW))) - reset(); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::unload() throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - if (!isLoaded()) - return; - - DELETEZ(m_pLoadTimer); - - aGuard.clear(); - EventObject aEvt(static_cast<XWeak*>(this)); - m_aLoadListeners.notifyEach(&XLoadListener::unloading, aEvt); - - if (m_xAggregateAsRowSet.is()) - { - // we may have reset the InsertOnly property on the aggregate - restore it - restoreInsertOnlyState( ); - - // clear the parameters if there are any - invlidateParameters(); - - try - { - // close the aggregate - Reference<XCloseable> xCloseable; - query_aggregation( m_xAggregate, xCloseable); - aGuard.clear(); - if (xCloseable.is()) - xCloseable->close(); - } - catch(SQLException& eDB) - { - eDB; - } - aGuard.reset(); - } - - m_bLoaded = sal_False; - - // if the connection we used while we were loaded is only shared with our parent, we - // reset it - if ( isSharingConnection() ) - stopSharingConnection(); - - aGuard.clear(); - m_aLoadListeners.notifyEach(&XLoadListener::unloaded, aEvt); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::reload() throw( RuntimeException ) -{ - reload_impl(sal_True); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::reload_impl(sal_Bool bMoveToFirst, const Reference< XInteractionHandler >& _rxCompletionHandler ) throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - if (!isLoaded()) - return; - - EventObject aEvent(static_cast<XWeak*>(this)); - { - // only if there is no approve listener we can post the event at this time - // otherwise see approveRowsetChange - // the aprrovement is done by the aggregate - if (!m_aRowSetApproveListeners.getLength()) - { - ::cppu::OInterfaceIteratorHelper aIter(m_aLoadListeners); - aGuard.clear(); - - while (aIter.hasMoreElements()) - ((XLoadListener*)aIter.next())->reloading(aEvent); - - aGuard.reset(); - } - } - - sal_Bool bSuccess = sal_True; - try - { - m_sCurrentErrorContext = FRM_RES_STRING(RID_ERR_REFRESHING_FORM); - bSuccess = executeRowSet(aGuard, bMoveToFirst, _rxCompletionHandler); - } - catch(SQLException& e) - { - DBG_ERROR("ODatabaseForm::reload_impl : shouldn't executeRowSet catch this exception ?"); - e; - } - - if (bSuccess) - { - ::cppu::OInterfaceIteratorHelper aIter(m_aLoadListeners); - aGuard.clear(); - while (aIter.hasMoreElements()) - ((XLoadListener*)aIter.next())->reloaded(aEvent); - - // if we are on the insert row, we have to reset all controls - // to set the default values - if (getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ISNEW))) - reset(); - } - else - m_bLoaded = sal_False; -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::isLoaded() throw( RuntimeException ) -{ - return m_bLoaded; -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::addLoadListener(const Reference<XLoadListener>& aListener) throw( RuntimeException ) -{ - m_aLoadListeners.addInterface(aListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::removeLoadListener(const Reference<XLoadListener>& aListener) throw( RuntimeException ) -{ - m_aLoadListeners.removeInterface(aListener); -} - -//============================================================================== -// com::sun::star::sdbc::XCloseable -//============================================================================== -void SAL_CALL ODatabaseForm::close() throw( SQLException, RuntimeException ) -{ - // unload will close the aggregate - unload(); -} - -//============================================================================== -// com::sun::star::sdbc::XRowSetListener -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::cursorMoved(const EventObject& event) throw( RuntimeException ) -{ - // reload the subform with the new parameters of the parent - // do this handling delayed to provide of execute too many SQL Statements - ::osl::ResettableMutexGuard aGuard(m_aMutex); - if (m_pLoadTimer->IsActive()) - m_pLoadTimer->Stop(); - - // and start the timer again - m_pLoadTimer->Start(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::rowChanged(const EventObject& event) throw( RuntimeException ) -{ - // ignore it -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::rowSetChanged(const EventObject& event) throw( RuntimeException ) -{ - // not interested in : - // if our parent is an ODatabaseForm, too, then after this rowSetChanged we'll get a "reloaded" - // or a "loaded" event. - // If somebody gave us another parent which is an XRowSet but doesn't handle an execute as - // "load" respectivly "reload" ... can't do anything .... -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::approveCursorMove(const EventObject& event) throw( RuntimeException ) -{ - // is our aggregate calling? - if (event.Source == InterfaceRef(static_cast<XWeak*>(this))) - { - // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface - // for XRowSetApproveBroadcaster-interface. - // So we have to multiplex this approve request. - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveCursorMove(event)) - return sal_False; - } - else - { - // this is a call from our parent ... - // a parent's cursor move will result in a re-execute of our own row-set, so we have to - // ask our own RowSetChangesListeners, too - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveRowSetChange(event)) - return sal_False; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::approveRowChange(const RowChangeEvent& event) throw( RuntimeException ) -{ - // is our aggregate calling? - if (event.Source == InterfaceRef(static_cast<XWeak*>(this))) - { - // Our aggregate doesn't have any ApproveRowSetListeners (expect ourself), as we re-routed the queryInterface - // for XRowSetApproveBroadcaster-interface. - // So we have to multiplex this approve request. - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveRowChange(event)) - return sal_False; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::approveRowSetChange(const EventObject& event) throw( RuntimeException ) -{ - if (event.Source == InterfaceRef(static_cast<XWeak*>(this))) // ignore our aggregate as we handle this approve ourself - { - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveRowSetChange(event)) - return sal_False; - - if (isLoaded()) - { - ::cppu::OInterfaceIteratorHelper aLoadIter(m_aLoadListeners); - while (aLoadIter.hasMoreElements()) - ((XLoadListener*)aLoadIter.next())->reloading(event); - } - } - else - { - // this is a call from our parent ... - // a parent's cursor move will result in a re-execute of our own row-set, so we have to - // ask our own RowSetChangesListeners, too - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveRowSetChange(event)) - return sal_False; - } - return sal_True; -} - -//============================================================================== -// com::sun::star::sdb::XRowSetApproveBroadcaster -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::addRowSetApproveListener(const Reference<XRowSetApproveListener>& _rListener) throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - m_aRowSetApproveListeners.addInterface(_rListener); - - // do we have to multiplex ? - if (m_aRowSetApproveListeners.getLength() == 1) - { - Reference<XRowSetApproveBroadcaster> xBroadcaster; - if (query_aggregation( m_xAggregate, xBroadcaster)) - { - Reference<XRowSetApproveListener> xListener((XRowSetApproveListener*)this); - xBroadcaster->addRowSetApproveListener(xListener); - } - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::removeRowSetApproveListener(const Reference<XRowSetApproveListener>& _rListener) throw( RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - // do we have to remove the multiplex ? - m_aRowSetApproveListeners.removeInterface(_rListener); - if ( m_aRowSetApproveListeners.getLength() == 0 ) - { - Reference<XRowSetApproveBroadcaster> xBroadcaster; - if (query_aggregation( m_xAggregate, xBroadcaster)) - { - Reference<XRowSetApproveListener> xListener((XRowSetApproveListener*)this); - xBroadcaster->removeRowSetApproveListener(xListener); - } - } -} - -//============================================================================== -// com::sun:star::form::XDatabaseParameterBroadcaster -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::addParameterListener(const Reference<XDatabaseParameterListener>& _rListener) throw( RuntimeException ) -{ - m_aParameterListeners.addInterface(_rListener); -} -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::removeParameterListener(const Reference<XDatabaseParameterListener>& _rListener) throw( RuntimeException ) -{ - m_aParameterListeners.removeInterface(_rListener); -} - -//============================================================================== -// com::sun::star::sdb::XCompletedExecution -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::executeWithCompletion( const Reference< XInteractionHandler >& _rxHandler ) throw(SQLException, RuntimeException) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - // the difference between execute and load is, that we position on the first row in case of load - // after execute we remain before the first row - if (!isLoaded()) - { - aGuard.clear(); - load_impl(sal_False, sal_False, _rxHandler); - } - else - { - EventObject event(static_cast< XWeak* >(this)); - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - aGuard.clear(); - - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveRowSetChange(event)) - return; - - // we're loaded and somebody want's to execute ourself -> this means a reload - reload_impl(sal_False, _rxHandler); - } -} - -//============================================================================== -// com::sun::star::sdbc::XRowSet -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::execute() throw( SQLException, RuntimeException ) -{ - ::osl::ResettableMutexGuard aGuard(m_aMutex); - // if somebody calls an execute and we're not loaded we reroute this call to our load method. - - // the difference between execute and load is, that we position on the first row in case of load - // after execute we remain before the first row - if (!isLoaded()) - { - aGuard.clear(); - load_impl(sal_False, sal_False); - } - else - { - EventObject event(static_cast< XWeak* >(this)); - ::cppu::OInterfaceIteratorHelper aIter(m_aRowSetApproveListeners); - aGuard.clear(); - - while (aIter.hasMoreElements()) - if (!((XRowSetApproveListener*)aIter.next())->approveRowSetChange(event)) - return; - - // we're loaded and somebody want's to execute ourself -> this means a reload - reload_impl(sal_False); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::addRowSetListener(const Reference<XRowSetListener>& _rListener) throw( RuntimeException ) -{ - if (m_xAggregateAsRowSet.is()) - m_xAggregateAsRowSet->addRowSetListener(_rListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::removeRowSetListener(const Reference<XRowSetListener>& _rListener) throw( RuntimeException ) -{ - if (m_xAggregateAsRowSet.is()) - m_xAggregateAsRowSet->removeRowSetListener(_rListener); -} - -//============================================================================== -// com::sun::star::sdbc::XResultSet -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::next() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->next(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::isBeforeFirst() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->isBeforeFirst(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::isAfterLast() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->isAfterLast(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::isFirst() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->isFirst(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::isLast() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->isLast(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::beforeFirst() throw( SQLException, RuntimeException ) -{ - m_xAggregateAsRowSet->beforeFirst(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::afterLast() throw( SQLException, RuntimeException ) -{ - m_xAggregateAsRowSet->afterLast(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::first() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->first(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::last() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->last(); -} - -//------------------------------------------------------------------------------ -sal_Int32 SAL_CALL ODatabaseForm::getRow() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->getRow(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::absolute(sal_Int32 row) throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->absolute(row); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::relative(sal_Int32 rows) throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->relative(rows); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::previous() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->previous(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::refreshRow() throw( SQLException, RuntimeException ) -{ - m_xAggregateAsRowSet->refreshRow(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::rowUpdated() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->rowUpdated(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::rowInserted() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->rowInserted(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::rowDeleted() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->rowDeleted(); -} - -//------------------------------------------------------------------------------ -InterfaceRef SAL_CALL ODatabaseForm::getStatement() throw( SQLException, RuntimeException ) -{ - return m_xAggregateAsRowSet->getStatement(); -} - -// com::sun::star::sdbc::XResultSetUpdate -// exceptions during insert update and delete will be forwarded to the errorlistener -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::insertRow() throw( SQLException, RuntimeException ) -{ - try - { - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - xUpdate->insertRow(); - } - catch(RowSetVetoException& eVeto) - { - eVeto; - throw; - } - catch(SQLException& eDb) - { - onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD)); - throw; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::updateRow() throw( SQLException, RuntimeException ) -{ - try - { - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - xUpdate->updateRow(); - } - catch(RowSetVetoException& eVeto) - { - eVeto; - throw; - } - catch(SQLException& eDb) - { - onError(eDb, FRM_RES_STRING(RID_STR_ERR_UPDATERECORD)); - throw; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::deleteRow() throw( SQLException, RuntimeException ) -{ - try - { - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - xUpdate->deleteRow(); - } - catch(RowSetVetoException& eVeto) - { - eVeto; - throw; - } - catch(SQLException& eDb) - { - onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORD)); - throw; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::cancelRowUpdates() throw( SQLException, RuntimeException ) -{ - try - { - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - xUpdate->cancelRowUpdates(); - } - catch(RowSetVetoException& eVeto) - { - eVeto; - throw; - } - catch(SQLException& eDb) - { - onError(eDb, FRM_RES_STRING(RID_STR_ERR_INSERTRECORD)); - throw; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::moveToInsertRow() throw( SQLException, RuntimeException ) -{ - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - { - // _always_ move to the insert row - // - // Formerly, the following line was conditioned with a "not is new", means we did not move the aggregate - // to the insert row if it was already positioned there. - // - // This prevented the RowSet implementation from resetting it's column values. We, ourself, formerly - // did this reset of columns in reset_impl, where we set every column to the ControlDefault, or, if this - // was not present, to NULL. However, the problem with setting to NULL was #88888#, the problem with - // _not_ setting to NULL (which was the original fix for #88888#) was #97955#. - // - // So now we - // * move our aggregate to the insert row - // * in reset_impl - // - set the control defaults into the columns if not void - // - do _not_ set the columns to NULL if no control default is set - // This fixes both #88888# and #97955# - // - // Still, there is #72756#. During fixing this bug, DG introduced not calling the aggregate here. So - // in theory, we re-introduced #72756#. But the bug described therein does not happen anymore, as the - // preliminaries for it changed (no display of guessed values for new records with autoinc fields) - // - // BTW: the public Issuezilla bug for #97955# is #i2815# - // - // 16.04.2002 - 97955 - fs@openoffice.org - xUpdate->moveToInsertRow(); - - // then set the default values and the parameters given from the parent - reset(); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::moveToCurrentRow() throw( SQLException, RuntimeException ) -{ - Reference<XResultSetUpdate> xUpdate; - if (query_aggregation( m_xAggregate, xUpdate)) - xUpdate->moveToCurrentRow(); -} - -// com::sun::star::sdbcx::XDeleteRows -//------------------------------------------------------------------------------ -Sequence<sal_Int32> SAL_CALL ODatabaseForm::deleteRows(const Sequence<Any>& rows) throw( SQLException, RuntimeException ) -{ - try - { - Reference<XDeleteRows> xDelete; - if (query_aggregation( m_xAggregate, xDelete)) - return xDelete->deleteRows(rows); - } - catch(RowSetVetoException& eVeto) - { - eVeto; // make compiler happy - throw; - } - catch(SQLException& eDb) - { - onError(eDb, FRM_RES_STRING(RID_STR_ERR_DELETERECORDS)); - throw; - } - - return Sequence< sal_Int32 >(); -} - -// com::sun::star::sdbc::XParameters -namespace -{ - void checkParameters(::std::vector<bool>& _rBoolVector,sal_Int32 _nParameterIndex) - { - if ((sal_Int32)_rBoolVector.size() < _nParameterIndex) - { - _rBoolVector.reserve(_rBoolVector.capacity() + _nParameterIndex); - for (sal_Int32 i = 0; i < _nParameterIndex; i++) - _rBoolVector.push_back(false); - } - _rBoolVector[_nParameterIndex - 1] = true; - } -} -//------------------------------------------------------------------------------ -#define PARAMETER_VISITED(method) \ - ::osl::MutexGuard aGuard(m_aMutex); \ - Reference<XParameters> xParameters; \ - if (query_aggregation( m_xAggregate, xParameters)) \ - xParameters->method; \ - \ - checkParameters(m_aParameterVisited,parameterIndex) - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setNull(parameterIndex, sqlType)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setObjectNull(parameterIndex, sqlType, typeName)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setBoolean(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setByte(sal_Int32 parameterIndex, sal_Int8 x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setByte(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setShort(sal_Int32 parameterIndex, sal_Int16 x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setShort(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setInt(sal_Int32 parameterIndex, sal_Int32 x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setInt(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setLong(sal_Int32 parameterIndex, sal_Int64 x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setLong(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setFloat(sal_Int32 parameterIndex, float x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setFloat(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setDouble(sal_Int32 parameterIndex, double x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setDouble(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setString(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setBytes(sal_Int32 parameterIndex, const Sequence< sal_Int8 >& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setBytes(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setDate(sal_Int32 parameterIndex, const ::com::sun::star::util::Date& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setDate(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setTime(sal_Int32 parameterIndex, const ::com::sun::star::util::Time& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setTime(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setTimestamp(sal_Int32 parameterIndex, const ::com::sun::star::util::DateTime& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setTimestamp(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setBinaryStream(sal_Int32 parameterIndex, const Reference<XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setBinaryStream(parameterIndex, x, length)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setCharacterStream(sal_Int32 parameterIndex, const Reference<XInputStream>& x, sal_Int32 length) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setCharacterStream(parameterIndex, x, length)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setObjectWithInfo(sal_Int32 parameterIndex, const Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setObjectWithInfo(parameterIndex, x, targetSqlType, scale)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setObject(sal_Int32 parameterIndex, const Any& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setObject(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setRef(sal_Int32 parameterIndex, const Reference<XRef>& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setRef(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setBlob(sal_Int32 parameterIndex, const Reference<XBlob>& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setBlob(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setClob(sal_Int32 parameterIndex, const Reference<XClob>& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setClob(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setArray(sal_Int32 parameterIndex, const Reference<XArray>& x) throw( SQLException, RuntimeException ) -{ - PARAMETER_VISITED(setArray(parameterIndex, x)); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::clearParameters() throw( SQLException, RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - Reference<XParameters> xParameters; - if (query_aggregation(m_xAggregate, xParameters)) - xParameters->clearParameters(); - m_aParameterVisited.clear(); -} - -// com::sun::star::lang::XServiceInfo -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL ODatabaseForm::getImplementationName_Static() -{ - return DATABASEFORM_IMPLEMENTATION_NAME; -} - -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getCompatibleServiceNames_Static() -{ - Sequence< ::rtl::OUString > aServices( 1 ); - ::rtl::OUString* pServices = aServices.getArray(); - - *pServices++ = FRM_COMPONENT_FORM; - - return aServices; -} - -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getCurrentServiceNames_Static() -{ - Sequence< ::rtl::OUString > aServices( 5 ); - ::rtl::OUString* pServices = aServices.getArray(); - - *pServices++ = FRM_SUN_FORMCOMPONENT; - *pServices++ = ::rtl::OUString::createFromAscii("com.sun.star.form.FormComponents"); - *pServices++ = FRM_SUN_COMPONENT_FORM; - *pServices++ = FRM_SUN_COMPONENT_HTMLFORM; - *pServices++ = FRM_SUN_COMPONENT_DATAFORM; - - return aServices; -} - -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getSupportedServiceNames_Static() -{ - return ::comphelper::concatSequences( - getCurrentServiceNames_Static(), - getCompatibleServiceNames_Static() - ); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL ODatabaseForm::getImplementationName() throw( RuntimeException ) -{ - return getImplementationName_Static(); -} - -//------------------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL ODatabaseForm::getSupportedServiceNames() throw( RuntimeException ) -{ - // the services of our aggregate - Sequence< ::rtl::OUString > aServices; - Reference< XServiceInfo > xInfo; - if (query_aggregation(m_xAggregate, xInfo)) - aServices = xInfo->getSupportedServiceNames(); - - // concat with out own services - return ::comphelper::concatSequences( - getCurrentServiceNames_Static(), - aServices - ); - // use getCurrentXXX instead of getSupportedXXX, because at runtime, we do not want to have - // the compatible names - // This is maily to be consistent with the implementation before fixing #97083#, though the - // better solution _may_ be to return the compatible names at runtime, too - // 04.03.2002 - fs@openoffice.org -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODatabaseForm::supportsService(const ::rtl::OUString& ServiceName) throw( RuntimeException ) -{ - Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - const ::rtl::OUString* pArray = aSupported.getConstArray(); - for( sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray ) - if( pArray->equals( ServiceName ) ) - return sal_True; - return sal_False; -} - -//============================================================================== -// com::sun::star::io::XPersistObject -//------------------------------------------------------------------------------ - -const sal_uInt16 CYCLE = 0x0001; -const sal_uInt16 DONTAPPLYFILTER = 0x0002; - -//------------------------------------------------------------------------------ -::rtl::OUString ODatabaseForm::getServiceName() throw( RuntimeException ) -{ - return FRM_COMPONENT_FORM; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutStream) throw( IOException, RuntimeException ) -{ - DBG_ASSERT(m_xAggregateSet.is(), "ODatabaseForm::write : only to be called if the aggregate exists !"); - - // all children - OFormComponents::write(_rxOutStream); - - // version - _rxOutStream->writeShort(0x0003); - - // Name - _rxOutStream << m_sName; - - ::rtl::OUString sDataSource; - if (m_xAggregateSet.is()) - m_xAggregateSet->getPropertyValue(PROPERTY_DATASOURCE) >>= sDataSource; - _rxOutStream << sDataSource; - - // former CursorSource - ::rtl::OUString sCommand; - if (m_xAggregateSet.is()) - m_xAggregateSet->getPropertyValue(PROPERTY_COMMAND) >>= sCommand; - _rxOutStream << sCommand; - - // former MasterFields - _rxOutStream << m_aMasterFields; - // former DetailFields - _rxOutStream << m_aDetailFields; - - // former DataSelectionType - DataSelectionType eTranslated = DataSelectionType_TABLE; - if (m_xAggregateSet.is()) - { - sal_Int32 nCommandType; - m_xAggregateSet->getPropertyValue(PROPERTY_COMMANDTYPE) >>= nCommandType; - switch (nCommandType) - { - case CommandType::TABLE : eTranslated = DataSelectionType_TABLE; break; - case CommandType::QUERY : eTranslated = DataSelectionType_QUERY; break; - case CommandType::COMMAND: - { - sal_Bool bEscapeProcessing = getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)); - eTranslated = bEscapeProcessing ? DataSelectionType_SQL : DataSelectionType_SQLPASSTHROUGH; - } - break; - default : DBG_ERROR("ODatabaseForm::write : wrong CommandType !"); - } - } - _rxOutStream->writeShort((sal_Int16)eTranslated); // former DataSelectionType - - // very old versions expect a CursorType here - _rxOutStream->writeShort(DatabaseCursorType_KEYSET); - - _rxOutStream->writeBoolean(m_eNavigation != NavigationBarMode_NONE); - - // former DataEntry - if (m_xAggregateSet.is()) - _rxOutStream->writeBoolean(getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_INSERTONLY))); - else - _rxOutStream->writeBoolean(sal_False); - - _rxOutStream->writeBoolean(m_bAllowInsert); - _rxOutStream->writeBoolean(m_bAllowUpdate); - _rxOutStream->writeBoolean(m_bAllowDelete); - - // html form stuff - ::rtl::OUString sTmp = INetURLObject::decode(::binfilter::StaticBaseUrl::AbsToRel( m_aTargetURL ), '%', INetURLObject::DECODE_UNAMBIGUOUS); - _rxOutStream << sTmp; - _rxOutStream->writeShort( (sal_Int16)m_eSubmitMethod ); - _rxOutStream->writeShort( (sal_Int16)m_eSubmitEncoding ); - _rxOutStream << m_aTargetFrame; - - // version 2 didn't know some options and the "default" state - sal_Int32 nCycle = TabulatorCycle_RECORDS; - if (m_aCycle.hasValue()) - { - ::cppu::enum2int(nCycle, m_aCycle); - if (m_aCycle == TabulatorCycle_PAGE) - // unknown in earlier versions - nCycle = TabulatorCycle_RECORDS; - } - _rxOutStream->writeShort((sal_Int16) nCycle); - - _rxOutStream->writeShort((sal_Int16)m_eNavigation); - - ::rtl::OUString sFilter; - ::rtl::OUString sOrder; - if (m_xAggregateSet.is()) - { - m_xAggregateSet->getPropertyValue(PROPERTY_FILTER_CRITERIA) >>= sFilter; - m_xAggregateSet->getPropertyValue(PROPERTY_SORT) >>= sOrder; - } - _rxOutStream << sFilter; - _rxOutStream << sOrder; - - - // version 3 - sal_uInt16 nAnyMask = 0; - if (m_aCycle.hasValue()) - nAnyMask |= CYCLE; - - if (m_xAggregateSet.is() && !getBOOL(m_xAggregateSet->getPropertyValue(PROPERTY_APPLYFILTER))) - nAnyMask |= DONTAPPLYFILTER; - - _rxOutStream->writeShort(nAnyMask); - - if (nAnyMask & CYCLE) - { - sal_Int32 nCycle; - ::cppu::enum2int(nCycle, m_aCycle); - _rxOutStream->writeShort((sal_Int16)nCycle); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::read(const Reference<XObjectInputStream>& _rxInStream) throw( IOException, RuntimeException ) -{ - DBG_ASSERT(m_xAggregateSet.is(), "ODatabaseForm::read : only to be called if the aggregate exists !"); - - OFormComponents::read(_rxInStream); - - // version - sal_uInt16 nVersion = _rxInStream->readShort(); - - _rxInStream >> m_sName; - - ::rtl::OUString sAggregateProp; - _rxInStream >> sAggregateProp; - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, makeAny(sAggregateProp)); - _rxInStream >> sAggregateProp; - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_COMMAND, makeAny(sAggregateProp)); - - _rxInStream >> m_aMasterFields; - _rxInStream >> m_aDetailFields; - - sal_Int16 nCursorSourceType = _rxInStream->readShort(); - sal_Int32 nCommandType = 0; - switch ((DataSelectionType)nCursorSourceType) - { - case DataSelectionType_TABLE : nCommandType = CommandType::TABLE; break; - case DataSelectionType_QUERY : nCommandType = CommandType::QUERY; break; - case DataSelectionType_SQL: - case DataSelectionType_SQLPASSTHROUGH: - { - nCommandType = CommandType::COMMAND; - sal_Bool bEscapeProcessing = ((DataSelectionType)nCursorSourceType) != DataSelectionType_SQLPASSTHROUGH; - m_xAggregateSet->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, makeAny((sal_Bool)bEscapeProcessing)); - } - break; - default : DBG_ERROR("ODatabaseForm::read : wrong CommandType !"); - } - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_COMMANDTYPE, makeAny(nCommandType)); - - // obsolete - sal_Int16 nDummy = _rxInStream->readShort(); - - // navigation mode was a boolean in version 1 - // war in der version 1 ein sal_Bool - sal_Bool bNavigation = _rxInStream->readBoolean(); - if (nVersion == 1) - m_eNavigation = bNavigation ? NavigationBarMode_CURRENT : NavigationBarMode_NONE; - - sal_Bool bInsertOnly = _rxInStream->readBoolean(); - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_INSERTONLY, makeAny(bInsertOnly)); - - m_bAllowInsert = _rxInStream->readBoolean(); - m_bAllowUpdate = _rxInStream->readBoolean(); - m_bAllowDelete = _rxInStream->readBoolean(); - - // html stuff - ::rtl::OUString sTmp; - _rxInStream >> sTmp; - m_aTargetURL = INetURLObject::decode(::binfilter::StaticBaseUrl::RelToAbs( sTmp ), '%', INetURLObject::DECODE_UNAMBIGUOUS); - m_eSubmitMethod = (FormSubmitMethod)_rxInStream->readShort(); - m_eSubmitEncoding = (FormSubmitEncoding)_rxInStream->readShort(); - _rxInStream >> m_aTargetFrame; - - if (nVersion > 1) - { - sal_Int32 nCycle = _rxInStream->readShort(); - m_aCycle = ::cppu::int2enum(nCycle, ::getCppuType(static_cast<const TabulatorCycle*>(NULL))); - m_eNavigation = (NavigationBarMode)_rxInStream->readShort(); - - _rxInStream >> sAggregateProp; - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_FILTER_CRITERIA, makeAny(sAggregateProp)); - _rxInStream >> sAggregateProp; - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_SORT, makeAny(sAggregateProp)); - } - - sal_uInt16 nAnyMask = 0; - if (nVersion > 2) - { - nAnyMask = _rxInStream->readShort(); - if (nAnyMask & CYCLE) - { - sal_Int32 nCycle = _rxInStream->readShort(); - m_aCycle = ::cppu::int2enum(nCycle, ::getCppuType(static_cast<const TabulatorCycle*>(NULL))); - } - else - m_aCycle.clear(); - } - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_APPLYFILTER, makeAny((sal_Bool)((nAnyMask & DONTAPPLYFILTER) == 0))); -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::implInserted( const ElementDescription* _pElement ) -{ - OFormComponents::implInserted( _pElement ); - - Reference< XSQLErrorBroadcaster > xBroadcaster( _pElement->xInterface, UNO_QUERY ); - Reference< XForm > xForm ( _pElement->xInterface, UNO_QUERY ); - - if ( xBroadcaster.is() && !xForm.is() ) - { // the object is an error broadcaster, but no form itself -> add ourself as listener - xBroadcaster->addSQLErrorListener( this ); - } -} - -//------------------------------------------------------------------------------ -void ODatabaseForm::implRemoved(const InterfaceRef& _rxObject) -{ - OFormComponents::implRemoved( _rxObject ); - - Reference<XSQLErrorBroadcaster> xBroadcaster(_rxObject, UNO_QUERY); - Reference<XForm> xForm(_rxObject, UNO_QUERY); - if (xBroadcaster.is() && !xForm.is()) - { // the object is an error broadcaster, but no form itself -> remove ourself as listener - xBroadcaster->removeSQLErrorListener(this); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::errorOccured(const SQLErrorEvent& _rEvent) throw( RuntimeException ) -{ - // give it to my own error listener - onError(_rEvent); - // TODO : think about extending the chain with an SQLContext object saying - // "this was an error of one of my children" -} - -// com::sun::star::container::XNamed -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL ODatabaseForm::getName() throw( RuntimeException ) -{ - ::rtl::OUString sReturn; - OPropertySetHelper::getFastPropertyValue(PROPERTY_ID_NAME) >>= sReturn; - return sReturn; -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODatabaseForm::setName(const ::rtl::OUString& aName) throw( RuntimeException ) -{ - setFastPropertyValue(PROPERTY_ID_NAME, makeAny(aName)); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Date.cxx b/binfilter/bf_forms/source/component/forms_Date.cxx deleted file mode 100644 index ea3d7fe6ef03..000000000000 --- a/binfilter/bf_forms/source/component/forms_Date.cxx +++ /dev/null @@ -1,345 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Date.hxx" - -#include <tools/date.hxx> -#include <connectivity/dbconversion.hxx> - -#include <com/sun/star/sdbc/DataType.hpp> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - - -#include "services.hxx" - -namespace binfilter { - -using namespace dbtools; - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; - -//------------------------------------------------------------------ -ODateControl::ODateControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_DATEFIELD) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL ODateControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new ODateControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> ODateControl::_getTypes() -{ - return OBoundControl::_getTypes(); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL ODateControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_DATEFIELD; - return aSupported; -} - -/*************************************************************************/ -sal_Int32 ODateModel::nDateHandle = -1; -//------------------------------------------------------------------ -InterfaceRef SAL_CALL ODateModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new ODateModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> ODateModel::_getTypes() -{ - return OEditBaseModel::_getTypes(); -} - -//------------------------------------------------------------------ -DBG_NAME( ODateModel ) -//------------------------------------------------------------------ -ODateModel::ODateModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_DATEFIELD, FRM_CONTROL_DATEFIELD ) - // use the old control name for compytibility reasons - ,OLimitedFormats(_rxFactory, FormComponentType::DATEFIELD) -{ - DBG_CTOR( ODateModel, NULL ); - - m_nClassId = FormComponentType::DATEFIELD; - m_sDataFieldConnectivityProperty = PROPERTY_DATE; - if (ODateModel::nDateHandle == -1) - ODateModel::nDateHandle = getOriginalHandle(PROPERTY_ID_DATE); - - setAggregateSet(m_xAggregateFastSet, getOriginalHandle(PROPERTY_ID_DATEFORMAT)); -} - -//------------------------------------------------------------------------------ -ODateModel::ODateModel( const ODateModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) - ,OLimitedFormats( _rxFactory, FormComponentType::DATEFIELD ) -{ - DBG_CTOR( ODateModel, NULL ); - - setAggregateSet( m_xAggregateFastSet, getOriginalHandle( PROPERTY_ID_DATEFORMAT ) ); -} - -//------------------------------------------------------------------------------ -ODateModel::~ODateModel( ) -{ - setAggregateSet(Reference< XFastPropertySet >(), -1); - DBG_DTOR( ODateModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( ODateModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL ODateModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_DATEFIELD; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_DATEFIELD; - return aSupported; -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL ODateModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_DATEFIELD; // old (non-sun) name for compatibility ! -} - -// XPropertySet -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL ODateModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void ODateModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(11) - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP3(DEFAULT_DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, ::rtl::OUString, READONLY, TRANSIENT); - DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT); - DECL_IFACE_PROP2(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& ODateModel::getInfoHelper() -{ - return *const_cast<ODateModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODateModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle ) const -{ - switch (_nHandle) - { - case PROPERTY_ID_FORMATKEY: - getFormatKeyPropertyValue(_rValue); - break; - case PROPERTY_ID_FORMATSSUPPLIER: - _rValue <<= getFormatsSupplier(); - break; - default: - OEditBaseModel::getFastPropertyValue(_rValue, _nHandle); - break; - } -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL ODateModel::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue, - sal_Int32 _nHandle, const Any& _rValue ) throw(IllegalArgumentException) -{ - if (PROPERTY_ID_FORMATKEY == _nHandle) - return convertFormatKeyPropertyValue(_rConvertedValue, _rOldValue, _rValue); - else - return OEditBaseModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue ); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ODateModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw ( ::com::sun::star::uno::Exception) -{ - if (PROPERTY_ID_FORMATKEY == _nHandle) - setFormatKeyPropertyValue(_rValue); - else - OEditBaseModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); -} - -// XLoadListener -//------------------------------------------------------------------------------ -void ODateModel::_loaded(const EventObject& rEvent) -{ - OBoundControlModel::_loaded(rEvent); - Reference<XPropertySet> xField = getField(); - if (xField.is()) - { - m_bDateTimeField = sal_False; - try - { - sal_Int32 nFieldType; - xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType; - m_bDateTimeField = (nFieldType == DataType::TIMESTAMP); - } - catch(Exception&) - { - } - } -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool ODateModel::_commit() -{ - Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( ODateModel::nDateHandle ); - if (!compare(aNewValue, m_aSaveValue)) - { - if (!aNewValue.hasValue()) - m_xColumnUpdate->updateNull(); - else - { - try - { - util::Date aDate; - if (!(aNewValue >>= aDate)) - { - sal_Int32 nAsInt(0); - aNewValue >>= nAsInt; - aDate = DBTypeConversion::toDate(nAsInt); - } - - if (!m_bDateTimeField) - m_xColumnUpdate->updateDate(aDate); - else - { - util::DateTime aDateTime = m_xColumn->getTimestamp(); - aDateTime.Day = aDate.Day; - aDateTime.Month = aDate.Month; - aDateTime.Year = aDate.Year; - m_xColumnUpdate->updateTimestamp(aDateTime); - } - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -void ODateModel::_onValueChanged() -{ - util::Date aDate = m_xColumn->getDate(); - if (m_xColumn->wasNull()) - m_aSaveValue.clear(); - else - // the aggregated set expects an Int32 as value ... - m_aSaveValue <<= DBTypeConversion::toINT32(aDate); - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(ODateModel::nDateHandle, m_aSaveValue); - } -} - -//------------------------------------------------------------------------------ -void ODateModel::_reset() -{ - Any aValue; - if (m_aDefault.getValueType().getTypeClass() == TypeClass_LONG) - aValue = m_aDefault; - else - { // aktuelles Datum einstellen - ::Date aCurrentDate; - aValue <<= (sal_Int32)aCurrentDate.GetDate(); - } - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(ODateModel::nDateHandle, aValue); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Edit.cxx b/binfilter/bf_forms/source/component/forms_Edit.cxx deleted file mode 100644 index 98fa3f18fa48..000000000000 --- a/binfilter/bf_forms/source/component/forms_Edit.cxx +++ /dev/null @@ -1,682 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include <com/sun/star/util/XNumberFormatter.hpp> - -#include <com/sun/star/awt/XFocusListener.hpp> - -#include <com/sun/star/awt/XKeyListener.hpp> - -#include <com/sun/star/form/XChangeBroadcaster.hpp> - - - - -#include <tools/link.hxx> - -#include "Edit.hxx" - - -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/form/XSubmit.hpp> -#include <com/sun/star/util/NumberFormat.hpp> - -#include <vcl/svapp.hxx> - -#include <comphelper/container.hxx> -#include <comphelper/numbers.hxx> - -#include <connectivity/dbtools.hxx> -#include <connectivity/dbconversion.hxx> - -#include "services.hxx" - -#include <comphelper/property.hxx> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -namespace binfilter { - - using namespace ::dbtools; - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OEditControl_CreateInstance(const Reference< XMultiServiceFactory > & _rxFactory) -{ - return *(new OEditControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OEditControl::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - { - // my two base classes - aTypes = concatSequences(OBoundControl::_getTypes(), OEditControl_BASE::getTypes()); - } - return aTypes; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OEditControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = OEditControl_BASE::queryInterface(_rType); - - return aReturn; -} - -DBG_NAME(OEditControl) -//------------------------------------------------------------------------------ -OEditControl::OEditControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_EDIT) - ,m_aChangeListeners(m_aMutex) - ,m_nKeyEvent( 0 ) -{ - DBG_CTOR(OEditControl,NULL); - - increment(m_refCount); - { // als FocusListener anmelden - Reference<XWindow> xComp; - if (query_aggregation(m_xAggregate, xComp)) - { - xComp->addFocusListener(this); - xComp->addKeyListener(this); - } - } - // Refcount wieder bei 2 fuer beide Listener - sal_Int32 n = decrement(m_refCount); -} - -//------------------------------------------------------------------------------ -OEditControl::~OEditControl() -{ - if( m_nKeyEvent ) - Application::RemoveUserEvent( m_nKeyEvent ); - - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR(OEditControl,NULL); -} - -// XChangeBroadcaster -//------------------------------------------------------------------------------ -void OEditControl::addChangeListener(const Reference<XChangeListener>& l) throw ( ::com::sun::star::uno::RuntimeException) -{ - m_aChangeListeners.addInterface( l ); -} - -//------------------------------------------------------------------------------ -void OEditControl::removeChangeListener(const Reference<XChangeListener>& l) throw ( ::com::sun::star::uno::RuntimeException) -{ - m_aChangeListeners.removeInterface( l ); -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OEditControl::disposing() -{ - OBoundControl::disposing(); - - EventObject aEvt(static_cast<XWeak*>(this)); - m_aChangeListeners.disposeAndClear(aEvt); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OEditControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_TEXTFIELD; - return aSupported; -} - -// XEventListener -//------------------------------------------------------------------------------ -void OEditControl::disposing(const EventObject& Source) throw( RuntimeException ) -{ - OBoundControl::disposing(Source); -} - -// XFocusListener -//------------------------------------------------------------------------------ -void OEditControl::focusGained( const FocusEvent& e ) throw ( ::com::sun::star::uno::RuntimeException) -{ - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (xSet.is()) - xSet->getPropertyValue( PROPERTY_TEXT ) >>= m_aHtmlChangeValue; -} - -//------------------------------------------------------------------------------ -void OEditControl::focusLost( const FocusEvent& e ) throw ( ::com::sun::star::uno::RuntimeException) -{ - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (xSet.is()) - { - ::rtl::OUString sNewHtmlChangeValue; - xSet->getPropertyValue( PROPERTY_TEXT ) >>= sNewHtmlChangeValue; - if( sNewHtmlChangeValue != m_aHtmlChangeValue ) - { - EventObject aEvt; - aEvt.Source = *this; - m_aChangeListeners.notifyEach(&XChangeListener::changed, aEvt); - } - } -} - -// XKeyListener -//------------------------------------------------------------------------------ -void OEditControl::keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException) -{ - if( e.KeyCode != KEY_RETURN || e.Modifiers != 0 ) - return; - - // Steht das Control in einem Formular mit einer Submit-URL? - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if( !xSet.is() ) - return; - - // nicht fuer multiline edits - Any aTmp( xSet->getPropertyValue(PROPERTY_MULTILINE)); - if ((aTmp.getValueType().equals(::getBooleanCppuType())) && getBOOL(aTmp)) - return; - - Reference<XFormComponent> xFComp(xSet, UNO_QUERY); - InterfaceRef xParent = xFComp->getParent(); - if( !xParent.is() ) - return; - - Reference<XPropertySet> xFormSet(xParent, UNO_QUERY); - if( !xFormSet.is() ) - return; - - aTmp = xFormSet->getPropertyValue( PROPERTY_TARGET_URL ); - if (!aTmp.getValueType().equals(::getCppuType((const ::rtl::OUString*)NULL)) || - !getString(aTmp).getLength() ) - return; - - Reference<XIndexAccess> xElements(xParent, UNO_QUERY); - sal_Int32 nCount = xElements->getCount(); - if( nCount > 1 ) - { - Reference<XPropertySet> xFCSet; - for( sal_Int32 nIndex=0; nIndex < nCount; nIndex++ ) - { - // Any aElement(xElements->getByIndex(nIndex)); - xElements->getByIndex(nIndex) >>= xFCSet; - OSL_ENSURE(xFCSet.is(),"OEditControl::keyPressed: No XPropertySet!"); - - if (hasProperty(PROPERTY_CLASSID, xFCSet) && - getINT16(xFCSet->getPropertyValue(PROPERTY_CLASSID)) == FormComponentType::TEXTFIELD) - { - // Noch ein weiteres Edit gefunden ==> dann nicht submitten - if (xFCSet != xSet) - return; - } - } - } - - // Da wir noch im Haender stehen, submit asynchron ausloesen - if( m_nKeyEvent ) - Application::RemoveUserEvent( m_nKeyEvent ); - m_nKeyEvent = Application::PostUserEvent( LINK(this, OEditControl,OnKeyPressed) ); -} - -//------------------------------------------------------------------------------ -void OEditControl::keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException) -{ -} - -//------------------------------------------------------------------------------ -IMPL_LINK(OEditControl, OnKeyPressed, void*, EMPTYARG) -{ - m_nKeyEvent = 0; - - Reference<XFormComponent> xFComp(getModel(), UNO_QUERY); - InterfaceRef xParent = xFComp->getParent(); - Reference<XSubmit> xSubmit(xParent, UNO_QUERY); - if (xSubmit.is()) - xSubmit->submit( Reference<XControl>(), ::com::sun::star::awt::MouseEvent() ); - return 0L; -} - -/*************************************************************************/ -sal_Int32 OEditModel::nTextHandle = -1; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OEditModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OEditModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OEditModel::_getTypes() -{ - return OEditBaseModel::_getTypes(); -} - - -DBG_NAME(OEditModel) -//------------------------------------------------------------------ -OEditModel::OEditModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel( _rxFactory, VCL_CONTROLMODEL_EDIT, FRM_CONTROL_EDIT ) - // use the old control name for compytibility reasons - ,m_bMaxTextLenModified(sal_False) - ,m_nKeyType(NumberFormat::UNDEFINED) - ,m_aNullDate(DBTypeConversion::getStandardDate()) - ,m_nFormatKey(0) - ,m_nFieldType(DataType::OTHER) - ,m_bWritingFormattedFake(sal_False) - ,m_bNumericField(sal_False) -{ - DBG_CTOR(OEditModel,NULL); - - m_nClassId = FormComponentType::TEXTFIELD; - m_sDataFieldConnectivityProperty = PROPERTY_TEXT; - if (OEditModel::nTextHandle == -1) - OEditModel::nTextHandle = getOriginalHandle(PROPERTY_ID_TEXT); -} - -//------------------------------------------------------------------ -OEditModel::OEditModel( const OEditModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) - ,m_bMaxTextLenModified(sal_False) - ,m_nKeyType(NumberFormat::UNDEFINED) - ,m_aNullDate(DBTypeConversion::getStandardDate()) - ,m_nFormatKey(0) - ,m_nFieldType(DataType::OTHER) - ,m_bWritingFormattedFake(sal_False) - ,m_bNumericField(sal_False) -{ - DBG_CTOR( OEditModel, NULL ); - - // Note that most of the properties are not clone from the original object: - // Things as the format key, it's type, and such, depend on the field being part of a loaded form - // (they're initialized in _loaded). Even if the original object _is_ part of such a form, we ourself - // certainly aren't, so these members are defaulted. If we're inserted into a form which is already loaded, - // they will be set to new values, anyway .... -} - -//------------------------------------------------------------------ -OEditModel::~OEditModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR(OEditModel,NULL); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OEditModel ) - -//------------------------------------------------------------------------------ -void OEditModel::disposing() -{ - OEditBaseModel::disposing(); - m_xFormatter = NULL; -} - -// XPersistObject -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OEditModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_EDIT; // old (non-sun) name for compatibility ! -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OEditModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_DATABASE_TEXTFIELD; - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_TEXTFIELD; - return aSupported; -} - -// XPropertySet -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OEditModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} -// ----------------------------------------------------------------------------- -void SAL_CALL OEditModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const -{ - if ( PROPERTY_ID_PERSISTENCE_MAXTEXTLENGTH == nHandle ) - { - if ( m_bMaxTextLenModified ) - rValue <<= sal_Int16(0); - else if ( m_xAggregateSet.is() ) - rValue = m_xAggregateSet->getPropertyValue(PROPERTY_MAXTEXTLEN); - } - else - { - OEditBaseModel::getFastPropertyValue(rValue, nHandle ); - } -} - -//------------------------------------------------------------------------------ -void OEditModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(12) - // Text auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP2(PERSISTENCE_MAXTEXTLENGTH,sal_Int16, READONLY, TRANSIENT); - DECL_PROP2(DEFAULT_TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT); - DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_BOOL_PROP2(FILTERPROPOSAL, BOUND, MAYBEDEFAULT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OEditModel::getInfoHelper() -{ - return *const_cast<OEditModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OEditModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - Any aCurrentText; - sal_Int16 nOldTextLen = 0; - // bin ich gerade loaded und habe dazu zeitweilig die MaxTextLen umgesetzt ? - if ( m_bMaxTextLenModified ) - { // -> fuer die Dauer des Speicherns meinem aggregierten Model die alte TextLen einreden - - // before doing this we have to save the current text value of the aggregate, as this may be affected by resetting the text len - // FS - 08.12.99 - 70606 - aCurrentText = m_xAggregateSet->getPropertyValue(PROPERTY_TEXT); - - m_xAggregateSet->getPropertyValue(PROPERTY_MAXTEXTLEN) >>= nOldTextLen; - m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, makeAny((sal_Int16)0)); - } - - OEditBaseModel::write(_rxOutStream); - - if ( m_bMaxTextLenModified ) - { // wieder zuruecksetzen - m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, makeAny(nOldTextLen)); - // and reset the text - // First we set it to an empty string : Without this the second setPropertyValue would not do anything as it thinks - // we aren't changing the prop (it didn't notify the - implicite - change of the text prop while setting the max text len) - // This seems to be a bug with in toolkit's EditControl-implementation. - m_xAggregateSet->setPropertyValue(PROPERTY_TEXT, makeAny(::rtl::OUString())); - m_xAggregateSet->setPropertyValue(PROPERTY_TEXT, aCurrentText); - } -} - -//------------------------------------------------------------------------------ -void OEditModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OEditBaseModel::read(_rxInStream); - - // Some versions (5.1 'til about 552) wrote a wrong DefaultControl-property value which is unknown - // to older versions (5.0). - // correct this ... - if (m_xAggregateSet.is()) - { - Any aDefaultControl = m_xAggregateSet->getPropertyValue(PROPERTY_DEFAULTCONTROL); - if ( (aDefaultControl.getValueType().getTypeClass() == TypeClass_STRING) - && (getString(aDefaultControl).compareTo(FRM_CONTROL_TEXTFIELD) == COMPARE_EQUAL) - ) - { - m_xAggregateSet->setPropertyValue(PROPERTY_DEFAULTCONTROL, makeAny(::rtl::OUString(FRM_CONTROL_EDIT))); - // Older as well as current versions should understand this : the former knew only the FRM_CONTROL_EDIT, - // the latter are registered for both FRM_CONTROL_EDIT and FRM_CONTROL_TEXTFIELD. - } - } -} - -//------------------------------------------------------------------------------ -sal_Int16 OEditModel::getPersistenceFlags() const -{ - sal_Int16 nFlags = OEditBaseModel::getPersistenceFlags(); - - if (m_bWritingFormattedFake) - nFlags |= PF_FAKE_FORMATTED_FIELD; - - return nFlags; -} - -// XLoadListener -//------------------------------------------------------------------------------ -void OEditModel::_loaded(const EventObject& rEvent) -{ - m_bNumericField = sal_False; - Reference<XPropertySet> xField = getField(); - if (xField.is()) - { - // jetzt den Key und typ ermitteln - m_nFieldType = getINT32(xField->getPropertyValue(PROPERTY_FIELDTYPE)); - m_nFormatKey = getINT32(xField->getPropertyValue(PROPERTY_FORMATKEY)); - - switch (m_nFieldType) - { - case ::com::sun::star::sdbc::DataType::DATE: - case ::com::sun::star::sdbc::DataType::TIME: - case ::com::sun::star::sdbc::DataType::TIMESTAMP: - case ::com::sun::star::sdbc::DataType::BIT: - case ::com::sun::star::sdbc::DataType::TINYINT: - case ::com::sun::star::sdbc::DataType::SMALLINT: - case ::com::sun::star::sdbc::DataType::INTEGER: - case ::com::sun::star::sdbc::DataType::REAL: - case ::com::sun::star::sdbc::DataType::BIGINT: - case ::com::sun::star::sdbc::DataType::DOUBLE: - case ::com::sun::star::sdbc::DataType::NUMERIC: - case ::com::sun::star::sdbc::DataType::DECIMAL: - m_bNumericField = sal_True; - break; - default: - m_bNumericField = sal_False; - break; - } - - // XNumberFormatter besorgen - Reference<XRowSet> xRowSet(rEvent.Source, UNO_QUERY); - DBG_ASSERT(xRowSet.is(), "OEditModel::_loaded : source is not a row set ?"); - Reference<XNumberFormatsSupplier> xSupplier = getNumberFormats(getConnection(xRowSet), sal_False, m_xServiceFactory); - if (xSupplier.is()) - { - m_xFormatter = Reference<XNumberFormatter>(m_xServiceFactory - ->createInstance(FRM_NUMBER_FORMATTER), UNO_QUERY); - if (m_xFormatter.is()) - m_xFormatter->attachNumberFormatsSupplier(xSupplier); - - m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), m_nFormatKey); - xSupplier->getNumberFormatSettings()->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) - >>= m_aNullDate; - } - - if (m_nKeyType != NumberFormat::SCIENTIFIC) - { - m_bMaxTextLenModified = getINT16(m_xAggregateSet->getPropertyValue(PROPERTY_MAXTEXTLEN)) != 0; - if ( !m_bMaxTextLenModified ) - { - sal_Int32 nFieldLen; - xField->getPropertyValue(::rtl::OUString::createFromAscii("Precision")) >>= nFieldLen; - - if (nFieldLen && nFieldLen <= USHRT_MAX) - { - Any aVal; - aVal <<= (sal_Int16)nFieldLen; - m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, aVal); - - m_bMaxTextLenModified = sal_True; - } - } - else - m_bMaxTextLenModified = sal_False; // to get sure that the text len won't be set in unloaded - } - } -} - -//------------------------------------------------------------------------------ -void OEditModel::_unloaded() -{ - OEditBaseModel::_unloaded(); - if (getField().is()) - { - if ( m_bMaxTextLenModified ) - { - Any aVal; - aVal <<= (sal_Int16)0; // nur wenn es 0 war, habe ich es in _loaded umgesetzt - m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, aVal); - m_bMaxTextLenModified = sal_False; - } - - m_xFormatter = 0; - m_nFieldType = DataType::OTHER; - m_nFormatKey = 0; - m_nKeyType = NumberFormat::UNDEFINED; - m_aNullDate = DBTypeConversion::getStandardDate(); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OEditModel::_commit() -{ - ::rtl::OUString sNewValue; - m_xAggregateFastSet->getFastPropertyValue(OEditModel::nTextHandle) >>= sNewValue; - if (sNewValue != m_aSaveValue) - { - if (!sNewValue.getLength() && !m_bRequired && m_bEmptyIsNull) - m_xColumnUpdate->updateNull(); - else - { - try - { - if ( m_bNumericField ) - DBTypeConversion::setValue(m_xColumnUpdate, m_xFormatter, m_aNullDate, sNewValue, m_nFormatKey, m_nFieldType, m_nKeyType); - else - m_xColumnUpdate->updateString(sNewValue); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = sNewValue; - } - return sal_True; -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void OEditModel::_onValueChanged() -{ - - // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // and in this special case do it before calling DBTypeConversion::getValue, as this uses the number formatter - // which's implementation locks the SM, too :( - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_aSaveValue = DBTypeConversion::getValue(m_xColumn, - m_xFormatter, - m_aNullDate, - m_nFormatKey, - m_nKeyType); - - // #i2817# OJ - sal_uInt16 nMaxTextLen = getINT16(m_xAggregateSet->getPropertyValue(PROPERTY_MAXTEXTLEN)); - if ( nMaxTextLen && m_aSaveValue.getLength() > nMaxTextLen ) - { - sal_Int32 nDiff = m_aSaveValue.getLength() - nMaxTextLen; - m_aSaveValue = m_aSaveValue.replaceAt(nMaxTextLen,nDiff,::rtl::OUString()); - } - - m_xAggregateFastSet->setFastPropertyValue(OEditModel::nTextHandle, makeAny(m_aSaveValue)); -} - -// XReset -//------------------------------------------------------------------------------ -void OEditModel::_reset() -{ - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OEditModel::nTextHandle, makeAny(m_aDefaultText)); - } -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_EditBase.cxx b/binfilter/bf_forms/source/component/forms_EditBase.cxx deleted file mode 100644 index 4fbff3d3ca01..000000000000 --- a/binfilter/bf_forms/source/component/forms_EditBase.cxx +++ /dev/null @@ -1,414 +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. - * - ************************************************************************/ - -#include "EditBase.hxx" -#include "property.hrc" -#include "frm_resource.hrc" - -#include <com/sun/star/io/XMarkableStream.hpp> - -#include <comphelper/property.hxx> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -const sal_uInt16 DEFAULT_LONG = 0x0001; -const sal_uInt16 DEFAULT_DOUBLE = 0x0002; -const sal_uInt16 FILTERPROPOSAL = 0x0004; - -DBG_NAME( OEditBaseModel ) -//------------------------------------------------------------------ -OEditBaseModel::OEditBaseModel( const Reference< XMultiServiceFactory >& _rxFactory, const ::rtl::OUString& rUnoControlModelName, - const ::rtl::OUString& rDefault, const sal_Bool _bSetDelegator ) - :OBoundControlModel( _rxFactory, rUnoControlModelName, rDefault, sal_True, _bSetDelegator ) - ,m_bFilterProposal(sal_False) - ,m_bEmptyIsNull(sal_True) - ,m_nLastReadVersion(0) -{ - DBG_CTOR( OEditBaseModel, NULL ); -} - -//------------------------------------------------------------------ -OEditBaseModel::OEditBaseModel( const OEditBaseModel* _pOriginal, const Reference< XMultiServiceFactory >& _rxFactory, const sal_Bool _bSetDelegator ) - :OBoundControlModel( _pOriginal, _rxFactory, sal_True, _bSetDelegator ) - ,m_nLastReadVersion(0) -{ - DBG_CTOR( OEditBaseModel, NULL ); - - m_bFilterProposal = _pOriginal->m_bFilterProposal; - m_bEmptyIsNull = _pOriginal->m_bEmptyIsNull; - m_aDefault = _pOriginal->m_aDefault; - m_aDefaultText = _pOriginal->m_aDefaultText; -} - -//------------------------------------------------------------------ -OEditBaseModel::~OEditBaseModel( ) -{ - DBG_DTOR( OEditBaseModel, NULL ); -} - -// XPersist -//------------------------------------------------------------------------------ -void OEditBaseModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OBoundControlModel::write(_rxOutStream); - - // Version - sal_uInt16 nVersionId = 0x0005; - DBG_ASSERT((getPersistenceFlags() & ~(sal_Int16)PF_SPECIAL_FLAGS) == 0, - "OEditBaseModel::write : invalid special version flags !"); - // please don't use other flags, older versions can't interpret them ! - - nVersionId |= getPersistenceFlags(); - _rxOutStream->writeShort(nVersionId); - - // Name - _rxOutStream->writeShort(0); // obsolete - _rxOutStream << m_aDefaultText; - - // Maskierung fuer any - sal_uInt16 nAnyMask = 0; - if (m_aDefault.getValueType().getTypeClass() == TypeClass_LONG) - nAnyMask |= DEFAULT_LONG; - else if (m_aDefault.getValueType().getTypeClass() == TypeClass_DOUBLE) - nAnyMask |= DEFAULT_DOUBLE; - - if (m_bFilterProposal) // da boolean, kein Wert speichern - nAnyMask |= FILTERPROPOSAL; - - _rxOutStream->writeBoolean(m_bEmptyIsNull); - _rxOutStream->writeShort(nAnyMask); - - if ((nAnyMask & DEFAULT_LONG) == DEFAULT_LONG) - _rxOutStream->writeLong(getINT32(m_aDefault)); - else if ((nAnyMask & DEFAULT_DOUBLE) == DEFAULT_DOUBLE) - _rxOutStream->writeDouble(getDouble(m_aDefault)); - - // since version 5 we write the help text - writeHelpTextCompatibly(_rxOutStream); - // (that's potentially bad : at the time I added the above line we had two derived classes : OEditModel and - // OFormattedModel. The first one does not have an own version handling, so it can't write the help text itself, - // the second one does it's own writing (reading) after calling our method, so normally we shouldn't write any - // additional members as this is not compatible to older office versions. - // We decided to place the writing of the help text here as it seems the less worse alternative. There is no delivered - // office version including formatted controls (and thus the OFormattedModel), and the OFormattedModel::read seems - // robust against this change (as it will read a wrong and unknown file version and thus set it's members to defaults). - - if ((nVersionId & PF_HANDLE_COMMON_PROPS) != 0) - writeCommonEditProperties(_rxOutStream); - - // !!! properties common to all OEditBaseModel derived classes should be written in writeCommonEditProperties !!! -} - -//------------------------------------------------------------------------------ -sal_Int16 OEditBaseModel::getPersistenceFlags() const -{ - return (sal_Int16)PF_HANDLE_COMMON_PROPS; -} - -//------------------------------------------------------------------------------ -void OEditBaseModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OBoundControlModel::read(_rxInStream); - ::osl::MutexGuard aGuard(m_aMutex); - - // Version eigene Versionsnummer - sal_uInt16 nVersion = _rxInStream->readShort(); - m_nLastReadVersion = nVersion; - - sal_Bool bHandleCommonProps = (nVersion & PF_HANDLE_COMMON_PROPS) != 0; - nVersion = nVersion & ~PF_SPECIAL_FLAGS; - - sal_uInt16 nOld = _rxInStream->readShort(); - _rxInStream >> m_aDefaultText; - - if (nVersion >= 0x0003) - { - m_bEmptyIsNull = _rxInStream->readBoolean(); - - sal_uInt16 nAnyMask = _rxInStream->readShort(); - if ((nAnyMask & DEFAULT_LONG) == DEFAULT_LONG) - { - sal_Int32 nValue = _rxInStream->readLong(); - m_aDefault <<= (sal_Int32)nValue; - } - else if ((nAnyMask & DEFAULT_DOUBLE) == DEFAULT_DOUBLE) - { - double fValue = _rxInStream->readDouble(); - m_aDefault <<= (double)fValue; - } - - if ((nAnyMask & FILTERPROPOSAL) == FILTERPROPOSAL) - m_bFilterProposal = sal_True; - } - - if (nVersion > 4) - readHelpTextCompatibly(_rxInStream); - - if (bHandleCommonProps) - readCommonEditProperties(_rxInStream); - - // Nach dem Lesen die Defaultwerte anzeigen - if (m_aControlSource.getLength()) - // (not if we don't have a control source - the "State" property acts like it is persistent, then) - _reset(); -}; - -//------------------------------------------------------------------------------ -void OEditBaseModel::defaultCommonEditProperties() -{ - OBoundControlModel::defaultCommonProperties(); - // no own common properties at the moment -} - -//------------------------------------------------------------------------------ -void OEditBaseModel::readCommonEditProperties(const Reference<XObjectInputStream>& _rxInStream) -{ - sal_Int32 nLen = _rxInStream->readLong(); - - Reference<XMarkableStream> xMark(_rxInStream, UNO_QUERY); - DBG_ASSERT(xMark.is(), "OBoundControlModel::readCommonProperties : can only work with markable streams !"); - sal_Int32 nMark = xMark->createMark(); - - // read properties common to all OBoundControlModels - OBoundControlModel::readCommonProperties(_rxInStream); - - // read properties common to all OEditBaseModels - - // skip the remaining bytes - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nLen); - xMark->deleteMark(nMark); -} - -//------------------------------------------------------------------------------ -void OEditBaseModel::writeCommonEditProperties(const Reference<XObjectOutputStream>& _rxOutStream) -{ - Reference<XMarkableStream> xMark(_rxOutStream, UNO_QUERY); - DBG_ASSERT(xMark.is(), "OEditBaseModel::writeCommonProperties : can only work with markable streams !"); - sal_Int32 nMark = xMark->createMark(); - - // a placeholder where we will write the overall length (later in this method) - sal_Int32 nLen = 0; - _rxOutStream->writeLong(nLen); - - // write properties common to all OBoundControlModels - OBoundControlModel::writeCommonProperties(_rxOutStream); - - // write properties common to all OEditBaseModels - - // close the block - write the correct length at the beginning - nLen = xMark->offsetToMark(nMark) - sizeof(nLen); - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); -} - -//------------------------------------------------------------------------------ -void OEditBaseModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_EMPTY_IS_NULL: - rValue <<= (sal_Bool)m_bEmptyIsNull; - break; - case PROPERTY_ID_FILTERPROPOSAL: - rValue <<= (sal_Bool)m_bFilterProposal; - break; - case PROPERTY_ID_DEFAULT_TEXT: - rValue <<= m_aDefaultText; - break; - case PROPERTY_ID_DEFAULT_VALUE: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DEFAULT_TIME: - rValue = m_aDefault; - break; - default: - OBoundControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OEditBaseModel::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, - sal_Int32 nHandle, const Any& rValue ) throw( IllegalArgumentException ) -{ - sal_Bool bModified(sal_False); - switch (nHandle) - { - case PROPERTY_ID_EMPTY_IS_NULL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEmptyIsNull); - break; - case PROPERTY_ID_FILTERPROPOSAL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bFilterProposal); - break; - case PROPERTY_ID_DEFAULT_TEXT: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultText); - break; - case PROPERTY_ID_DEFAULT_VALUE: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefault, ::getCppuType((const double*)0)); - break; - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DEFAULT_TIME: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefault, ::getCppuType((const sal_Int32*)0)); - break; - default: - bModified = OBoundControlModel::convertFastPropertyValue( - rConvertedValue, - rOldValue, - nHandle, - rValue); - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OEditBaseModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw ( ::com::sun::star::uno::Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_EMPTY_IS_NULL: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, "invalid type" ); - m_bEmptyIsNull = getBOOL(rValue); - break; - case PROPERTY_ID_FILTERPROPOSAL: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, "invalid type" ); - m_bFilterProposal = getBOOL(rValue); - break; - // Aenderung der defaultwerte fuehrt zu reset - case PROPERTY_ID_DEFAULT_TEXT: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" ); - rValue >>= m_aDefaultText; - _reset(); - break; - case PROPERTY_ID_DEFAULT_VALUE: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DEFAULT_TIME: - m_aDefault = rValue; - _reset(); - break; - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue ); - } -} - -//XPropertyState -//------------------------------------------------------------------------------ -PropertyState OEditBaseModel::getPropertyStateByHandle(sal_Int32 nHandle) -{ - PropertyState eState; - switch (nHandle) - { - case PROPERTY_ID_DEFAULT_TEXT: - if (!m_aDefaultText.getLength()) - eState = PropertyState_DEFAULT_VALUE; - else - eState = PropertyState_DIRECT_VALUE; - break; - case PROPERTY_ID_FILTERPROPOSAL: - if (!m_bFilterProposal) - eState = PropertyState_DEFAULT_VALUE; - else - eState = PropertyState_DIRECT_VALUE; - break; - case PROPERTY_ID_DEFAULT_VALUE: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DEFAULT_TIME: - if (!m_aDefault.hasValue()) - eState = PropertyState_DEFAULT_VALUE; - else - eState = PropertyState_DIRECT_VALUE; - break; - default: - eState = OBoundControlModel::getPropertyStateByHandle(nHandle); - } - return eState; -} - -//------------------------------------------------------------------------------ -void OEditBaseModel::setPropertyToDefaultByHandle(sal_Int32 nHandle) -{ - switch (nHandle) - { - case PROPERTY_ID_DEFAULT_TEXT: - setFastPropertyValue(nHandle, makeAny(::rtl::OUString())); - break; - case PROPERTY_ID_FILTERPROPOSAL: - setFastPropertyValue(nHandle, makeAny((sal_Bool)sal_False)); - break; - case PROPERTY_ID_DEFAULT_VALUE: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DEFAULT_TIME: - setFastPropertyValue(nHandle, Any()); - break; - default: - OBoundControlModel::setPropertyToDefaultByHandle(nHandle); - } -} - -//------------------------------------------------------------------------------ -Any OEditBaseModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_DEFAULT_TEXT: - return makeAny(::rtl::OUString()); - break; - case PROPERTY_ID_FILTERPROPOSAL: - return Any(makeAny((sal_Bool)sal_False)); - break; - case PROPERTY_ID_DEFAULT_VALUE: - case PROPERTY_ID_DEFAULT_DATE: - case PROPERTY_ID_DEFAULT_TIME: - return Any(); - default: - return OBoundControlModel::getPropertyDefaultByHandle(nHandle); - } -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_EventThread.cxx b/binfilter/bf_forms/source/component/forms_EventThread.cxx deleted file mode 100644 index 474f3eaa78b4..000000000000 --- a/binfilter/bf_forms/source/component/forms_EventThread.cxx +++ /dev/null @@ -1,239 +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. - * - ************************************************************************/ - -#include "EventThread.hxx" - -#include <tools/debug.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::lang; - -DBG_NAME( OComponentEventThread ) -OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImpl ) : - m_pCompImpl( pCompImpl ) -{ - DBG_CTOR( OComponentEventThread, NULL ); - - increment(m_refCount); - - // Eine Referenz des Controls halten - { - InterfaceRef xIFace(static_cast<XWeak*>(pCompImpl)); - query_interface(xIFace, m_xComp); - } - - // und uns an dem Control anmelden - { - Reference<XEventListener> xEvtLstnr = static_cast<XEventListener*>(this); - m_xComp->addEventListener( xEvtLstnr ); - } - - decrement(m_refCount); -} - -OComponentEventThread::~OComponentEventThread() -{ - DBG_DTOR( OComponentEventThread, NULL ); - - DBG_ASSERT( m_aEvents.size() == 0, - "OComponentEventThread::~OComponentEventThread: Kein dispose gerufen?" ); - while (m_aEvents.size()) - delete *m_aEvents.erase(m_aEvents.begin()); -} - -Any SAL_CALL OComponentEventThread::queryInterface(const Type& _rType) throw (RuntimeException) -{ - Any aReturn; - - aReturn = OWeakObject::queryInterface(_rType); - - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType, - static_cast<XEventListener*>(this) - ); - - return aReturn; -} - -void OComponentEventThread::disposing( const EventObject& evt ) throw ( ::com::sun::star::uno::RuntimeException) -{ - if( evt.Source == m_xComp ) - { - ::osl::MutexGuard aGuard( m_aMutex ); - - // Event-Listener abmelden - Reference<XEventListener> xEvtLstnr = static_cast<XEventListener*>(this); - m_xComp->removeEventListener( xEvtLstnr ); - - // Event-Queue loeschen - while (m_aEvents.size()) - delete *m_aEvents.erase(m_aEvents.begin()); - m_aControls.erase(m_aControls.begin(), m_aControls.end()); - m_aFlags.erase(m_aFlags.begin(), m_aFlags.end()); - - // Das Control loslassen und pCompImpl auf 0 setzen, damit der - // Thread weiss, dass er sich beenden soll. - m_xComp = 0; - m_pCompImpl = 0; - - // Den Thread aufwecken und beenden. - m_aCond.set(); - terminate(); - } -} - -void OComponentEventThread::addEvent( const EventObject* _pEvt, sal_Bool bFlag ) -{ - Reference<XControl> xTmp; - addEvent( _pEvt, xTmp, bFlag ); -} - -void OComponentEventThread::addEvent( const EventObject* _pEvt, - const Reference<XControl>& rControl, - sal_Bool bFlag ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - - // Daten in die Queue stellen - m_aEvents.push_back( cloneEvent( _pEvt ) ); - - Reference<XWeak> xWeakControl(rControl, UNO_QUERY); - Reference<XAdapter> xControlAdapter = xWeakControl.is() ? xWeakControl->queryAdapter() : Reference<XAdapter>(); - m_aControls.push_back( xControlAdapter ); - - m_aFlags.push_back( bFlag ); - - // Thread aufwecken - m_aCond.set(); -} - -//--------------------------------------------------------------------- -//--- 22.08.01 15:48:15 ----------------------------------------------- - -void OComponentEventThread::implStarted( ) -{ - acquire( ); -} - -//--------------------------------------------------------------------- -//--- 22.08.01 15:48:16 ----------------------------------------------- - -void OComponentEventThread::implTerminated( ) -{ - release( ); -} - -//--------------------------------------------------------------------- -//--- 22.08.01 15:47:31 ----------------------------------------------- - -void SAL_CALL OComponentEventThread::kill() -{ - OComponentEventThread_TBASE::terminate(); - OComponentEventThread_TBASE::join(); - - implTerminated( ); -} - -//--------------------------------------------------------------------- -//--- 22.08.01 15:47:33 ----------------------------------------------- - -void SAL_CALL OComponentEventThread::onTerminated() -{ - OComponentEventThread_TBASE::onTerminated(); - - implTerminated( ); -} - -void OComponentEventThread::run() -{ - implStarted( ); - - // uns selbst festhalten, damit wir nicht geloescht werden, - // wenn zwischendrinne mal ein dispose gerufen wird. - InterfaceRef xThis(static_cast<XWeak*>(this)); - - do - { - ::osl::MutexGuard aGuard(m_aMutex); - - while( m_aEvents.size() > 0 ) - { - // Das Control holen und festhalten, damit es waehrend des - // actionPerformed nicht geloescht werden kann. - Reference<XComponent> xComp = m_xComp; - ::cppu::OComponentHelper *pCompImpl = m_pCompImpl; - - EventObject* pEvt = *m_aEvents.erase( m_aEvents.begin() ); - Reference<XAdapter> xControlAdapter = *m_aControls.erase( m_aControls.begin() ); - sal_Bool bFlag = *m_aFlags.erase( m_aFlags.begin() ); - - { - MutexRelease aReleaseOnce(m_aMutex); - // Weil ein queryHardRef eine Exception schmeissen kann sollte - // es nicht bei gelocktem Mutex aufgerufen werden. - Reference<XControl> xControl; - if ( xControlAdapter.is() ) - query_interface(xControlAdapter->queryAdapted(), xControl); - - if( xComp.is() ) - processEvent( pCompImpl, pEvt, xControl, bFlag ); - } - - delete pEvt; - }; - - // Nach einem dispose kennen wir das Control nicht mehr. Dann darf - // auch nicht gewartet werden. - if( !m_xComp.is() ) - return; - - // Warte-Bedingung zuruecksetzen - m_aCond.reset(); - { - MutexRelease aReleaseOnce(m_aMutex); - // und warten ... falls nicht zwischenzeitlich doch noch ein - // Event eingetroffen ist. - m_aCond.wait(); - } - } - while( sal_True ); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_File.cxx b/binfilter/bf_forms/source/component/forms_File.cxx deleted file mode 100644 index ef486e15153f..000000000000 --- a/binfilter/bf_forms/source/component/forms_File.cxx +++ /dev/null @@ -1,321 +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. - * - ************************************************************************/ - - -#include <comphelper/proparrhlp.hxx> - -#include "File.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -#include "property.hrc" -#include "services.hxx" - -#include <comphelper/container.hxx> - -#include <comphelper/property.hxx> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OFileControlModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OFileControlModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OFileControlModel::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - { - // my base class - Sequence<Type> aBaseClassTypes = OControlModel::_getTypes(); - - Sequence<Type> aOwnTypes(1); - Type* pOwnTypes = aOwnTypes.getArray(); - pOwnTypes[0] = getCppuType((Reference<XReset>*)NULL); - - aTypes = concatSequences(aBaseClassTypes, aOwnTypes); - } - return aTypes; -} - - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OFileControlModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FILECONTROL; - return aSupported; -} - -//------------------------------------------------------------------ -DBG_NAME( OFileControlModel ) -//------------------------------------------------------------------ -OFileControlModel::OFileControlModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OControlModel(_rxFactory, VCL_CONTROLMODEL_FILECONTROL) - ,m_aResetListeners(m_aMutex) -{ - DBG_CTOR( OFileControlModel, NULL ); - m_nClassId = FormComponentType::FILECONTROL; -} - -//------------------------------------------------------------------ -OFileControlModel::OFileControlModel( const OFileControlModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OControlModel( _pOriginal, _rxFactory ) - ,m_aResetListeners( m_aMutex ) -{ - DBG_CTOR( OFileControlModel, NULL ); - - m_sDefaultValue = _pOriginal->m_sDefaultValue; -} - -//------------------------------------------------------------------ -OFileControlModel::~OFileControlModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - DBG_DTOR( OFileControlModel, NULL ); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OFileControlModel ) - -//------------------------------------------------------------------------------ -Any SAL_CALL OFileControlModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OControlModel::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType - ,static_cast<XReset*>(this) - ); - - return aReturn; -} - -// OComponentHelper -//----------------------------------------------------------------------------- -void OFileControlModel::disposing() -{ - OControlModel::disposing(); - - EventObject aEvt(static_cast<XWeak*>(this)); - m_aResetListeners.disposeAndClear(aEvt); -} - -//------------------------------------------------------------------------------ -void OFileControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const -{ - switch (nHandle) - { - case PROPERTY_ID_DEFAULT_TEXT : rValue <<= m_sDefaultValue; break; - default: - OControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -void OFileControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw ( ::com::sun::star::uno::Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_DEFAULT_TEXT : - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "OFileControlModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_sDefaultValue; - break; - default: - OControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OFileControlModel::convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) - throw( IllegalArgumentException ) -{ - switch (nHandle) - { - case PROPERTY_ID_DEFAULT_TEXT : - return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sDefaultValue); - default: - return OControlModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue); - } -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OFileControlModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void OFileControlModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(5) - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(DEFAULT_TEXT, ::rtl::OUString, BOUND); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - - // in den agregierten Properties muss ich noch PROPERTY_ID_TEXT auf transient setzen ... -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, PropertyAttribute::TRANSIENT, 0); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OFileControlModel::getInfoHelper() -{ - return *const_cast<OFileControlModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFileControlModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_FILECONTROL; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void OFileControlModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OControlModel::write(_rxOutStream); - - ::osl::MutexGuard aGuard(m_aMutex); - - // Version - _rxOutStream->writeShort(0x0002); - // Default-Wert - _rxOutStream << m_sDefaultValue; - writeHelpTextCompatibly(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void OFileControlModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OControlModel::read(_rxInStream); - ::osl::MutexGuard aGuard(m_aMutex); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - // Default-Wert - switch (nVersion) - { - case 1: - _rxInStream >> m_sDefaultValue; break; - case 2: - _rxInStream >> m_sDefaultValue; - readHelpTextCompatibly(_rxInStream); - break; - default: - DBG_ERROR("OFileControlModel::read : unknown version !"); - m_sDefaultValue = ::rtl::OUString(); - } - - // Nach dem Lesen die Defaultwerte anzeigen -// _reset(); -} - -//----------------------------------------------------------------------------- -void SAL_CALL OFileControlModel::reset() throw ( ::com::sun::star::uno::RuntimeException) -{ - ::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); - EventObject aEvt(static_cast<XWeak*>(this)); - sal_Bool bContinue = sal_True; - while (aIter.hasMoreElements() && bContinue) - bContinue =((XResetListener*)aIter.next())->approveReset(aEvt); - - if (bContinue) - { - { - // Wenn Models threadSave - ::osl::MutexGuard aGuard(m_aMutex); - _reset(); - } - m_aResetListeners.notifyEach(&XResetListener::resetted, aEvt); - } -} - -//----------------------------------------------------------------------------- -void OFileControlModel::addResetListener(const Reference<XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException) -{ - m_aResetListeners.addInterface(_rxListener); -} - -//----------------------------------------------------------------------------- -void OFileControlModel::removeResetListener(const Reference<XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException) -{ - m_aResetListeners.removeInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void OFileControlModel::_reset() -{ - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateSet->setPropertyValue(PROPERTY_TEXT, makeAny(m_sDefaultValue)); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Filter.cxx b/binfilter/bf_forms/source/component/forms_Filter.cxx deleted file mode 100644 index b4dcab0c9fab..000000000000 --- a/binfilter/bf_forms/source/component/forms_Filter.cxx +++ /dev/null @@ -1,817 +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. - * - ************************************************************************/ - - -#include "Filter.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/awt/XCheckBox.hpp> -#include <com/sun/star/awt/XRadioButton.hpp> -#include <com/sun/star/awt/XListBox.hpp> -#include <com/sun/star/awt/XComboBox.hpp> -#include <com/sun/star/awt/VclWindowPeerAttribute.hpp> -#include <com/sun/star/container/XChild.hpp> -#include <com/sun/star/sdbc/XRowSet.hpp> -#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> -#include <com/sun/star/sdbcx/XTablesSupplier.hpp> -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> -#include <com/sun/star/container/XNamed.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/sdb/XColumn.hpp> -#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> -#include <com/sun/star/beans/NamedValue.hpp> - -#include <connectivity/dbtools.hxx> -#include <connectivity/dbconversion.hxx> -#include <comphelper/property.hxx> -#include <comphelper/numbers.hxx> -#include <toolkit/helper/vclunohelper.hxx> -#include <vcl/wintypes.hxx> -#include <vcl/svapp.hxx> -#include <vcl/stdtext.hxx> -#include <rtl/ustrbuf.hxx> - -#include "property.hrc" -#include "frm_resource.hxx" -#include "frm_resource.hrc" -#include "formsmodule.hxx" -namespace binfilter { - -//-------------------------------------------------------------------------- -extern "C" void SAL_CALL createRegistryInfo_OFilterControl() -{ - static ::binfilter::frm::OMultiInstanceAutoRegistration< ::binfilter::frm::OFilterControl > aAutoRegistration;//STRIP008 static ::frm::OMultiInstanceAutoRegistration< ::frm::OFilterControl > aAutoRegistration; -} - -//......................................................................... -namespace frm -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::awt; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::beans; - using namespace ::com::sun::star::sdb; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::sdbcx; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::container; - using namespace ::com::sun::star::ui::dialogs; - - using namespace ::connectivity; - - //===================================================================== - // OFilterControl - //===================================================================== - //--------------------------------------------------------------------- - OFilterControl::OFilterControl( const Reference< XMultiServiceFactory >& _rxORB ) - :m_aTextListeners( *this ) - ,m_bFilterList( sal_False ) - ,m_bMultiLine( sal_False ) - ,m_nControlClass( FormComponentType::TEXTFIELD ) - ,m_bFilterListFilled( sal_False ) - ,m_xORB( _rxORB ) - ,m_aParser( _rxORB ) - { - } - - //--------------------------------------------------------------------- - sal_Bool OFilterControl::ensureInitialized( ) - { - if ( !m_xField.is() ) - { - OSL_ENSURE( sal_False, "OFilterControl::ensureInitialized: improperly initialized: no field!" ); - return sal_False; - } - - if ( !m_xMetaData.is() ) - { - OSL_ENSURE( sal_False, "OFilterControl::ensureInitialized: improperly initialized: no database meta data!" ); - return sal_False; - } - - if ( !m_xFormatter.is() ) - { - // we can create one from the connection, if it's an SDB connection - Reference< XConnection > xConn( m_xMetaData->getConnection() ); - Reference< XNumberFormatsSupplier > xFormatSupplier = ::dbtools::getNumberFormats( xConn, sal_True, m_xORB ); - - if ( xFormatSupplier.is() ) - { - m_xFormatter = m_xFormatter.query( - m_xORB->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.NumberFormatter" ) ) ) ); - if ( m_xFormatter.is() ) - m_xFormatter->attachNumberFormatsSupplier( xFormatSupplier ); - } - } - if ( !m_xFormatter.is() ) - { - OSL_ENSURE( sal_False, "OFilterControl::ensureInitialized: no number formatter!" ); - // no fallback anymore - return sal_False; - } - - return sal_True; - } - - //--------------------------------------------------------------------- - Any SAL_CALL OFilterControl::queryAggregation( const Type & rType ) throw(RuntimeException) - { - Any aRet = UnoControl::queryAggregation( rType); - if(!aRet.hasValue()) - aRet = OFilterControl_BASE::queryInterface(rType); - - return aRet; - } - - //--------------------------------------------------------------------- - ::rtl::OUString OFilterControl::GetComponentServiceName() - { - ::rtl::OUString aServiceName; - switch (m_nControlClass) - { - case FormComponentType::RADIOBUTTON: - aServiceName = ::rtl::OUString::createFromAscii("radiobutton"); - break; - case FormComponentType::CHECKBOX: - aServiceName = ::rtl::OUString::createFromAscii("checkbox"); - break; - case FormComponentType::COMBOBOX: - aServiceName = ::rtl::OUString::createFromAscii("combobox"); - break; - case FormComponentType::LISTBOX: - aServiceName = ::rtl::OUString::createFromAscii("listbox"); - break; - default: - if (m_bMultiLine) - aServiceName = ::rtl::OUString::createFromAscii("MultiLineEdit"); - else - aServiceName = ::rtl::OUString::createFromAscii("Edit"); - } - return aServiceName; - } - - // XComponent - //--------------------------------------------------------------------- - void OFilterControl::dispose() throw( RuntimeException ) - { - EventObject aEvt(*this); - m_aTextListeners.disposeAndClear( aEvt ); - UnoControl::dispose(); - } - - //--------------------------------------------------------------------- - void OFilterControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) throw(RuntimeException) - { - UnoControl::createPeer( rxToolkit, rParentPeer ); - - Reference< XVclWindowPeer > xVclWindow( getPeer(), UNO_QUERY ); - Any aValue; - if (xVclWindow.is()) - { - switch (m_nControlClass) - { - case FormComponentType::CHECKBOX: - { - // checkboxes always have a tristate-mode - sal_Bool bB(sal_True); - aValue.setValue(&bB,::getBooleanCppuType()); - xVclWindow->setProperty(PROPERTY_TRISTATE, aValue); - - aValue <<= (sal_Int32)STATE_DONTKNOW; - xVclWindow->setProperty(PROPERTY_STATE, aValue); - - Reference< XCheckBox > xBox( getPeer(), UNO_QUERY ); - xBox->addItemListener(this); - - } break; - case FormComponentType::RADIOBUTTON: - { - aValue <<= (sal_Int32)STATE_NOCHECK; - xVclWindow->setProperty(PROPERTY_STATE, aValue); - - Reference< XRadioButton > xRadio( getPeer(), UNO_QUERY ); - xRadio->addItemListener(this); - } break; - case FormComponentType::LISTBOX: - { - Reference< XListBox > xListBox( getPeer(), UNO_QUERY ); - xListBox->addItemListener(this); - } - case FormComponentType::COMBOBOX: // no break; - { - sal_Bool bB(sal_True); - aValue.setValue(&bB,::getBooleanCppuType()); - xVclWindow->setProperty(PROPERTY_AUTOCOMPLETE, aValue); - } - default: // no break; - { - Reference< XWindow > xWindow( getPeer(), UNO_QUERY ); - xWindow->addFocusListener(this); - - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - xText->setMaxTextLen(0); - } break; - } - } - - // filter controls are _never_ readonly - // #107013# - 2002-02-03 - fs@openoffice.org - Reference< XPropertySet > xModel( getModel(), UNO_QUERY ); - OSL_ENSURE( xModel.is(), "OFilterControl::createPeer: no model!" ); - Reference< XPropertySetInfo > xModelPSI; - if ( xModel.is() ) - xModelPSI = xModel->getPropertySetInfo(); - if ( xModelPSI.is() && xModelPSI->hasPropertyByName( PROPERTY_READONLY ) ) - xVclWindow->setProperty( PROPERTY_READONLY, makeAny( sal_False ) ); - - if (m_bFilterList) - m_bFilterListFilled = sal_False; - } - - //--------------------------------------------------------------------- - void OFilterControl::PrepareWindowDescriptor( WindowDescriptor& rDescr ) - { - if (m_bFilterList) - rDescr.WindowAttributes |= VclWindowPeerAttribute::DROPDOWN; - } - - //--------------------------------------------------------------------- - void OFilterControl::ImplSetPeerProperty( const ::rtl::OUString& rPropName, const Any& rVal ) - { - // these properties are ignored - if (rPropName == PROPERTY_TEXT || - rPropName == PROPERTY_STATE) - return; - - UnoControl::ImplSetPeerProperty( rPropName, rVal ); - } - - // XEventListener - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::disposing(const EventObject& Source) throw( RuntimeException ) - { - UnoControl::disposing(Source); - } - - // XItemListener - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::itemStateChanged( const ItemEvent& rEvent ) throw(RuntimeException) - { - ::rtl::OUString aText; - switch (m_nControlClass) - { - case FormComponentType::CHECKBOX: - { - switch (rEvent.Selected) - { - case STATE_CHECK: - aText = ::rtl::OUString::createFromAscii("1"); - break; - case STATE_NOCHECK: - aText = ::rtl::OUString::createFromAscii("0"); - break; - } - } break; - case FormComponentType::LISTBOX: - { - Sequence< ::rtl::OUString> aValueSelection; - Reference< XPropertySet > aPropertyPointer(getModel(), UNO_QUERY); - aPropertyPointer->getPropertyValue(PROPERTY_VALUE_SEQ) >>= aValueSelection; - if (rEvent.Selected <= aValueSelection.getLength()) - aText = aValueSelection.getConstArray()[rEvent.Selected]; - } break; - case FormComponentType::RADIOBUTTON: - { - if (rEvent.Selected == STATE_CHECK) - aText = ::comphelper::getString(Reference< XPropertySet > (getModel(), UNO_QUERY)->getPropertyValue(PROPERTY_REFVALUE)); - } break; - } - - if (m_aText.compareTo(aText)) - { - m_aText = aText; - TextEvent aEvt; - aEvt.Source = *this; - ::cppu::OInterfaceIteratorHelper aIt( m_aTextListeners ); - while( aIt.hasMoreElements() ) - ((XTextListener *)aIt.next())->textChanged( aEvt ); - } - } - - //--------------------------------------------------------------------- - void OFilterControl::implInitFilterList() - { - if ( !ensureInitialized( ) ) - // already asserted in ensureInitialized - return; - - // declare here for later disposal - Reference< XResultSet > xListCursor; - Reference< XStatement > xStatement; - - try - { - m_bFilterListFilled = sal_True; - - Reference< XPropertySet > xSet(getModel(), UNO_QUERY); - if (xSet.is() && m_xField.is()) - { - ::rtl::OUString sName; - m_xField->getPropertyValue(PROPERTY_NAME) >>= sName; - - // here we need a table to which the field belongs to - Reference< XChild > xModelAsChild( xSet, UNO_QUERY ); - Reference< XRowSet > xForm( xModelAsChild->getParent(), UNO_QUERY ); - Reference< XPropertySet > xFormAsSet( xForm, UNO_QUERY ); - - // Connection holen - Reference< XConnection > xConnection; - if ( xForm.is() ) - xConnection = ::dbtools::getConnection( xForm ); - Reference< XSQLQueryComposerFactory > xFactory( xConnection, UNO_QUERY ); - OSL_ENSURE( xFactory.is() && xFormAsSet.is(), "OFilterControl::implInitFilterList: invalid form or invalid connection!" ); - if ( !xFactory.is() || !xFormAsSet.is() ) - return; - - // create a query composer - Reference< XSQLQueryComposer > xComposer = xFactory->createQueryComposer(); - OSL_ENSURE( xComposer.is() , "OFilterControl::implInitFilterList: invalid query composer!" ); - if ( !xComposer.is() ) - return; - - // set the statement on the composer, ... - ::rtl::OUString sStatement; - xFormAsSet->getPropertyValue( PROPERTY_ACTIVECOMMAND ) >>= sStatement; - xComposer->setQuery( sStatement ); - - // ... and ask it for the involved tables and queries - Reference< XTablesSupplier > xSuppTables( xComposer, UNO_QUERY ); - Reference< XColumnsSupplier > xSuppColumns( xComposer, UNO_QUERY ); - - Reference< XNameAccess > xFieldNames; - if ( xSuppColumns.is() ) xFieldNames = xSuppColumns->getColumns(); - Reference< XNameAccess > xTablesNames; - if ( xSuppTables.is() ) xTablesNames = xSuppTables->getTables(); - - if ( !xFieldNames.is() || !xTablesNames.is() ) - { - OSL_ENSURE( sal_False, "OFilterControl::implInitFilterList: invalid query composer (no fields or no tables supplied)!" ); - return; - } - - // search the field - Reference< XPropertySet > xComposerFieldAsSet; - if ( xFieldNames->hasByName( sName ) ) - xFieldNames->getByName( sName ) >>= xComposerFieldAsSet; - - if ( xComposerFieldAsSet.is() - && ::comphelper::hasProperty( PROPERTY_TABLENAME, xComposerFieldAsSet ) - && ::comphelper::hasProperty( PROPERTY_REALNAME, xComposerFieldAsSet ) - ) - { - ::rtl::OUString sFieldName, sTableName; - xComposerFieldAsSet->getPropertyValue(PROPERTY_REALNAME) >>= sFieldName; - xComposerFieldAsSet->getPropertyValue(PROPERTY_TABLENAME) >>= sTableName; - - // no possibility to create a select statement - // looking for the complete table name - if (!xTablesNames->hasByName(sTableName)) - return; - - // this is the tablename - Reference< XNamed > xName; - xTablesNames->getByName(sTableName) >>= xName; - OSL_ENSURE(xName.is(),"No XName interface!"); - sTableName = xName->getName(); - - // ein Statement aufbauen und abschicken als query - // Access to the connection - - Reference< XColumn > xDataField; - - Reference< XDatabaseMetaData > xMeta = xConnection->getMetaData(); - ::rtl::OUString aQuote = xMeta->getIdentifierQuoteString(); - ::rtl::OUStringBuffer aStatement; - aStatement.appendAscii( "SELECT DISTINCT" ); - aStatement.append( ::dbtools::quoteName( aQuote, sName ) ); - - if ( sFieldName.getLength() && ( sName != sFieldName ) ) - { - aStatement.appendAscii(" AS "); - aStatement.append( ::dbtools::quoteName(aQuote, sFieldName) ); - } - - aStatement.appendAscii( " FROM " ); - aStatement.append( ::dbtools::quoteTableName( xMeta, sTableName, ::dbtools::eInDataManipulation ) ); - ::rtl::OUString sStatement( aStatement.makeStringAndClear( ) ); - - xStatement = xConnection->createStatement(); - xListCursor = xStatement->executeQuery( sStatement ); - - Reference< XColumnsSupplier > xSupplyCols(xListCursor, UNO_QUERY); - Reference< XIndexAccess > xFields; - if (xSupplyCols.is()) - xFields = Reference< XIndexAccess > (xSupplyCols->getColumns(), UNO_QUERY); - if (xFields.is()) - xFields->getByIndex(0) >>= xDataField; - if (!xDataField.is()) - return; - - - sal_Int16 i = 0; - ::std::vector< ::rtl::OUString> aStringList; - aStringList.reserve(16); - ::rtl::OUString aStr; - - ::com::sun::star::util::Date aNullDate( ::dbtools::DBTypeConversion::getStandardDate() ); - sal_Int32 nFormatKey = 0; - try - { - m_xFormatter->getNumberFormatsSupplier()->getNumberFormatSettings()->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")) - >>= aNullDate; - nFormatKey = ::comphelper::getINT32(m_xField->getPropertyValue(PROPERTY_FORMATKEY)); - } - catch(const Exception&) - { - } - - - sal_Int16 nKeyType = ::comphelper::getNumberFormatType(m_xFormatter->getNumberFormatsSupplier()->getNumberFormats(), nFormatKey); - while (!xListCursor->isAfterLast() && i++ < SHRT_MAX) // max anzahl eintraege - { - aStr = ::dbtools::DBTypeConversion::getValue(xDataField, m_xFormatter, aNullDate, nFormatKey, nKeyType); - - aStringList.push_back(aStr); - xListCursor->next(); - } - - Sequence< ::rtl::OUString> aStringSeq(aStringList.size()); - ::rtl::OUString* pustrStrings = aStringSeq.getArray(); - for (i = 0; i < (sal_Int16)aStringList.size(); ++i) - pustrStrings[i] = aStringList[i]; - - Reference< XComboBox > xComboBox( getPeer(), UNO_QUERY); - if ( xComboBox.is() ) - { - xComboBox->addItems(aStringSeq, 0); - // set the drop down line count - sal_Int16 nLineCount = ::std::min( (sal_Int16)10, (sal_Int16)aStringSeq.getLength() ); - xComboBox->setDropDownLineCount( nLineCount ); - } - } - } - } - catch( const Exception& e ) - { - e; // make compiler happy - OSL_ENSURE( sal_False, "OFilterControl::implInitFilterList: caught an exception!" ); - } - - ::comphelper::disposeComponent( xListCursor ); - ::comphelper::disposeComponent( xStatement ); - } - - // XFocusListener - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::focusGained(const FocusEvent& e) throw( RuntimeException ) - { - // should we fill the combobox? - if (m_bFilterList && !m_bFilterListFilled) - implInitFilterList(); - } - - //--------------------------------------------------------------------- - sal_Bool SAL_CALL OFilterControl::commit() throw(RuntimeException) - { - OSL_ENSURE( false, "OFilterControl::commit: dead code!" ); - return sal_False; - } - - // XTextComponent - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::addTextListener(const Reference< XTextListener > & l) throw(RuntimeException) - { - m_aTextListeners.addInterface( l ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::removeTextListener(const Reference< XTextListener > & l) throw(RuntimeException) - { - m_aTextListeners.removeInterface( l ); - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::setText( const ::rtl::OUString& aText ) throw(RuntimeException) - { - if ( !ensureInitialized( ) ) - // already asserted in ensureInitialized - return; - - switch (m_nControlClass) - { - case FormComponentType::CHECKBOX: - { - Reference< XVclWindowPeer > xVclWindow( getPeer(), UNO_QUERY ); - if (xVclWindow.is()) - { - Any aValue; - if (aText.equals(::rtl::OUString::createFromAscii("1"))) - aValue <<= (sal_Int32)STATE_CHECK; - else if (aText.compareTo(::rtl::OUString::createFromAscii("0")) == 0) - aValue <<= (sal_Int32)STATE_NOCHECK; - else - aValue <<= (sal_Int32)STATE_DONTKNOW; - - m_aText = aText; - xVclWindow->setProperty(PROPERTY_STATE, aValue); - } - } break; - case FormComponentType::RADIOBUTTON: - { - Reference< XVclWindowPeer > xVclWindow( getPeer(), UNO_QUERY ); - if (xVclWindow.is()) - { - ::rtl::OUString aRefText = ::comphelper::getString(com::sun::star::uno::Reference< XPropertySet > (getModel(), UNO_QUERY)->getPropertyValue(PROPERTY_REFVALUE)); - Any aValue; - if (aText == aRefText) - aValue <<= (sal_Int32)STATE_CHECK; - else - aValue <<= (sal_Int32)STATE_NOCHECK; - m_aText = aText; - xVclWindow->setProperty(PROPERTY_STATE, aValue); - } - } break; - case FormComponentType::LISTBOX: - { - Reference< XListBox > xListBox( getPeer(), UNO_QUERY ); - if (xListBox.is()) - { - m_aText = aText; - xListBox->selectItem(m_aText, sal_True); - } - } break; - default: - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - { - m_aText = aText; - xText->setText(aText); - } - } - } - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::insertText( const ::com::sun::star::awt::Selection& rSel, const ::rtl::OUString& aText ) throw(::com::sun::star::uno::RuntimeException) - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - { - xText->insertText(rSel, aText); - m_aText = xText->getText(); - } - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OFilterControl::getText() throw(RuntimeException) - { - return m_aText; - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OFilterControl::getSelectedText( void ) throw(RuntimeException) - { - ::rtl::OUString aSelected; - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - aSelected = xText->getSelectedText(); - - return aSelected; - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::setSelection( const ::com::sun::star::awt::Selection& aSelection ) throw(::com::sun::star::uno::RuntimeException) - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - xText->setSelection( aSelection ); - } - - //--------------------------------------------------------------------- - ::com::sun::star::awt::Selection SAL_CALL OFilterControl::getSelection( void ) throw(::com::sun::star::uno::RuntimeException) - { - ::com::sun::star::awt::Selection aSel; - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - aSel = xText->getSelection(); - return aSel; - } - - //--------------------------------------------------------------------- - sal_Bool SAL_CALL OFilterControl::isEditable( void ) throw(RuntimeException) - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - return xText.is() && xText->isEditable(); - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::setEditable( sal_Bool bEditable ) throw(RuntimeException) - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - xText->setEditable(bEditable); - } - - //--------------------------------------------------------------------- - sal_Int16 SAL_CALL OFilterControl::getMaxTextLen() throw(RuntimeException) - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - return xText.is() ? xText->getMaxTextLen() : 0; - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::setMaxTextLen( sal_Int16 nLength ) throw(RuntimeException) - { - Reference< XTextComponent > xText( getPeer(), UNO_QUERY ); - if (xText.is()) - xText->setMaxTextLen(nLength); - } - - //--------------------------------------------------------------------- - void SAL_CALL OFilterControl::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) - { - const Any* pArguments = aArguments.getConstArray(); - const Any* pArgumentsEnd = pArguments + aArguments.getLength(); - - PropertyValue aProp; - NamedValue aValue; - const ::rtl::OUString* pName = NULL; - const Any* pValue = NULL; - - for ( ; pArguments != pArgumentsEnd; ++pArguments ) - { - // we recognize PropertyValues and NamedValues - if ( *pArguments >>= aProp ) - { - pName = &aProp.Name; - pValue = &aProp.Value; - } - else if ( *pArguments >>= aValue ) - { - pName = &aValue.Name; - pValue = &aValue.Value; - } - else - { - DBG_ERROR( "OFilterControl::initialize: unrecognized argument!" ); - continue; - } - - if ( 0 == pName->compareToAscii( "MessageParent" ) ) - { - // the message parent - *pValue >>= m_xMessageParent; - OSL_ENSURE( m_xMessageParent.is(), "OFilterControl::initialize: invalid MessageParent!" ); - } - else if ( 0 == pName->compareToAscii( "NumberFormatter" ) ) - { - // the number format. This argument is optional. - *pValue >>= m_xFormatter; - OSL_ENSURE( m_xFormatter.is(), "OFilterControl::initialize: invalid NumberFormatter!" ); - } - else if ( 0 == pName->compareToAscii( "ControlModel" ) ) - { - // the control model for which we act as filter control - Reference< XPropertySet > xControlModel; - if ( !(*pValue >>= xControlModel ) || !xControlModel.is() ) - { - OSL_ENSURE( sal_False, "OFilterControl::initialize: invalid control model argument!" ); - continue; - } - - // some properties which are "derived" from the control model we're working for - // ................................................... - // the field - m_xField.clear(); - OSL_ENSURE( ::comphelper::hasProperty( PROPERTY_BOUNDFIELD, xControlModel ), "OFilterControl::initialize: control model needs a bound field property!" ); - xControlModel->getPropertyValue( PROPERTY_BOUNDFIELD ) >>= m_xField; - - // ................................................... - // filter list and control class - m_bFilterList = ::comphelper::hasProperty( PROPERTY_FILTERPROPOSAL, xControlModel ) && ::comphelper::getBOOL( xControlModel->getPropertyValue( PROPERTY_FILTERPROPOSAL ) ); - if ( m_bFilterList ) - m_nControlClass = FormComponentType::COMBOBOX; - else - { - sal_Int16 nClassId = ::comphelper::getINT16( xControlModel->getPropertyValue( PROPERTY_CLASSID ) ); - switch (nClassId) - { - case FormComponentType::CHECKBOX: - case FormComponentType::RADIOBUTTON: - case FormComponentType::LISTBOX: - case FormComponentType::COMBOBOX: - m_nControlClass = nClassId; - break; - default: - m_bMultiLine = ::comphelper::hasProperty( PROPERTY_MULTILINE, xControlModel ) && ::comphelper::getBOOL( xControlModel->getPropertyValue( PROPERTY_MULTILINE ) ); - m_nControlClass = FormComponentType::TEXTFIELD; - break; - } - } - - // ................................................... - // the connection meta data for the form which we're working for - Reference< XChild > xModel( xControlModel, UNO_QUERY ); - Reference< XRowSet > xForm; - if ( xModel.is() ) - xForm = xForm.query( xModel->getParent() ); - Reference< XConnection > xConn = ::dbtools::getConnection( xForm ); - - m_xMetaData.clear(); - if ( xConn.is() ) - m_xMetaData = xConn->getMetaData(); - OSL_ENSURE( m_xMetaData.is(), "OFilterControl::initialize: unable to determine the database meta data for the form's connection!" ); - } - } - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OFilterControl::getImplementationName( ) throw (RuntimeException) - { - return getImplementationName_Static(); - } - - //--------------------------------------------------------------------- - sal_Bool SAL_CALL OFilterControl::supportsService( const ::rtl::OUString& ServiceName ) throw (RuntimeException) - { - Sequence< ::rtl::OUString > aSupported( getSupportedServiceNames() ); - const ::rtl::OUString* pArray = aSupported.getConstArray(); - for( sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray ) - if( pArray->equals( ServiceName ) ) - return sal_True; - return sal_False; - } - - //--------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL OFilterControl::getSupportedServiceNames( ) throw (RuntimeException) - { - return getSupportedServiceNames_Static(); - } - - //--------------------------------------------------------------------- - ::rtl::OUString SAL_CALL OFilterControl::getImplementationName_Static() - { - return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.forms.OFilterControl" ) ); - } - - //--------------------------------------------------------------------- - Sequence< ::rtl::OUString > SAL_CALL OFilterControl::getSupportedServiceNames_Static() - { - Sequence< ::rtl::OUString > aNames( 2 ); - aNames[ 0 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.form.control.FilterControl" ) ); - aNames[ 1 ] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControl" ) ); - return aNames; - } - - //--------------------------------------------------------------------- - Reference< XInterface > SAL_CALL OFilterControl::Create( const Reference< XMultiServiceFactory >& _rxFactory ) - { - return static_cast< XServiceInfo* >( new OFilterControl( _rxFactory ) ); - } - -//......................................................................... -} // namespace frm -//......................................................................... -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_FixedText.cxx b/binfilter/bf_forms/source/component/forms_FixedText.cxx deleted file mode 100644 index 350d21f02458..000000000000 --- a/binfilter/bf_forms/source/component/forms_FixedText.cxx +++ /dev/null @@ -1,165 +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. - * - ************************************************************************/ - - -#include <comphelper/proparrhlp.hxx> - -#include "FixedText.hxx" -#include "services.hxx" -#include "property.hrc" - -#include <comphelper/property.hxx> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <com/sun/star/form/FormComponentType.hpp> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OFixedTextModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OFixedTextModel(_rxFactory)); -} - -//------------------------------------------------------------------ -DBG_NAME( OFixedTextModel ) -//------------------------------------------------------------------ -OFixedTextModel::OFixedTextModel( const Reference<XMultiServiceFactory>& _rxFactory ) - :OControlModel(_rxFactory, VCL_CONTROLMODEL_FIXEDTEXT) - -{ - DBG_CTOR( OFixedTextModel, NULL ); - m_nClassId = FormComponentType::FIXEDTEXT; -} - -//------------------------------------------------------------------ -OFixedTextModel::OFixedTextModel( const OFixedTextModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OControlModel( _pOriginal, _rxFactory ) - -{ - DBG_CTOR( OFixedTextModel, NULL ); -} - -//------------------------------------------------------------------ -OFixedTextModel::~OFixedTextModel( ) -{ - DBG_DTOR( OFixedTextModel, NULL ); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OFixedTextModel ) - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OFixedTextModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FIXEDTEXT; - return aSupported; -} - -//------------------------------------------------------------------------------ -Reference<starbeans::XPropertySetInfo> SAL_CALL OFixedTextModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<starbeans::XPropertySetInfo> xInfo(createPropertySetInfo(getInfoHelper())); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& OFixedTextModel::getInfoHelper() -{ - return *const_cast<OFixedTextModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OFixedTextModel::fillProperties( - Sequence< starbeans::Property >& _rProps, - Sequence< starbeans::Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(3) - RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP); - - DECL_PROP1(NAME, rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(TAG, rtl::OUString, BOUND); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFixedTextModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_FIXEDTEXT; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OFixedTextModel::write(const Reference<XObjectOutputStream>& _rxOutStream) - throw(IOException, RuntimeException) -{ - OControlModel::write(_rxOutStream); - - // Version - _rxOutStream->writeShort(0x0002); - writeHelpTextCompatibly(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OFixedTextModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException) -{ - OControlModel::read(_rxInStream); - - // Version - sal_Int16 nVersion = _rxInStream->readShort(); - if (nVersion > 1) - readHelpTextCompatibly(_rxInStream); -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_FormComponent.cxx b/binfilter/bf_forms/source/component/forms_FormComponent.cxx deleted file mode 100644 index 8d6df7e3df8e..000000000000 --- a/binfilter/bf_forms/source/component/forms_FormComponent.cxx +++ /dev/null @@ -1,1611 +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. - * - ************************************************************************/ - -#include "FormComponent.hxx" - - - -#include <com/sun/star/awt/XTextComponent.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/io/XMarkableStream.hpp> -#include <com/sun/star/form/XLoadable.hpp> -#include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/sdbc/ColumnValue.hpp> - -#include <connectivity/dbtools.hxx> -#include "property.hrc" -#include "services.hxx" -#include <rtl/logfile.hxx> - - -#include "frm_resource.hxx" -#include "frm_resource.hrc" - -#include <comphelper/property.hxx> - - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> - -namespace binfilter { - - -//... namespace frm ....................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::dbtools; -using namespace ::comphelper; - -//========================================================================= -//= base class for form layer controls -//========================================================================= -DBG_NAME(frm_OControl) -//------------------------------------------------------------------------------ -OControl::OControl(const Reference<com::sun::star::lang::XMultiServiceFactory>& _rxFactory, const rtl::OUString& _sService) - :OComponentHelper(m_aMutex) - ,m_aService(_sService) - ,m_xServiceFactory(_rxFactory) -{ - DBG_CTOR(frm_OControl, NULL); - // VCL-Control aggregieren - // bei Aggregation den Refcount um eins erhoehen da im setDelegator - // das Aggregat selbst den Refcount erhoeht - increment(m_refCount); - { - m_xAggregate = Reference<XAggregation>(_rxFactory->createInstance(_sService), UNO_QUERY); - m_xControl = Reference<XControl>(m_xAggregate, UNO_QUERY); - } - - if (m_xAggregate.is()) - { - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); - } - - // Refcount wieder bei NULL - sal_Int32 n = decrement(m_refCount); -} - -//------------------------------------------------------------------------------ -OControl::~OControl() -{ - DBG_DTOR(frm_OControl, NULL); - // Freigeben der Aggregation - if (m_xAggregate.is()) - { - m_xAggregate->setDelegator(InterfaceRef()); - } -} - -// UNO Anbindung -//------------------------------------------------------------------------------ -Any SAL_CALL OControl::queryAggregation( const Type& _rType ) throw(RuntimeException) -{ - // ask the base class - Any aReturn( OComponentHelper::queryAggregation(_rType) ); - // ask our own interfaces - if (!aReturn.hasValue()) - { - aReturn = OControl_BASE::queryInterface(_rType); - // ask our aggregate - if (!aReturn.hasValue() && m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - - return aReturn; -} - -//------------------------------------------------------------------------------ -Sequence<sal_Int8> SAL_CALL OControl::getImplementationId() throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------------------ -Sequence<Type> SAL_CALL OControl::getTypes() throw(RuntimeException) -{ - Sequence<Type> aOwnTypes = _getTypes(); - Reference<com::sun::star::lang::XTypeProvider> xProv; - - if (query_aggregation(m_xAggregate, xProv)) - return concatSequences(aOwnTypes, xProv->getTypes()); - else - return aOwnTypes; -} - -//------------------------------------------------------------------------------ -Sequence<Type> OControl::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - aTypes = concatSequences(OComponentHelper::getTypes(), OControl_BASE::getTypes()); - return aTypes; -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OControl::disposing() -{ - OComponentHelper::disposing(); - - Reference<com::sun::star::lang::XComponent> xComp; - if (query_aggregation(m_xAggregate, xComp)) - xComp->dispose(); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OControl::supportsService(const rtl::OUString& _rsServiceName) throw ( RuntimeException) -{ - Sequence<rtl::OUString> aSupported = getSupportedServiceNames(); - const rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rsServiceName)) - return sal_True; - return sal_False; -} - -//------------------------------------------------------------------------------ -Sequence<rtl::OUString> SAL_CALL OControl::getSupportedServiceNames() throw(RuntimeException) -{ - Sequence< rtl::OUString > aSupported; - - // ask our aggregate - Reference< com::sun::star::lang::XServiceInfo > xInfo; - if ( query_aggregation( m_xAggregate, xInfo ) ) - aSupported = xInfo->getSupportedServiceNames(); - - return aSupported; -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OControl::disposing(const com::sun::star::lang::EventObject& _rEvent) throw (RuntimeException) -{ - InterfaceRef xAggAsIface; - query_aggregation(m_xAggregate, xAggAsIface); - - // does the disposing come from the aggregate ? - if (xAggAsIface != InterfaceRef(_rEvent.Source, UNO_QUERY)) - { // no -> forward it - Reference<com::sun::star::lang::XEventListener> xListener; - if (query_aggregation(m_xAggregate, xListener)) - xListener->disposing(_rEvent); - } -} - -// XControl -//------------------------------------------------------------------------------ -void SAL_CALL OControl::setContext(const InterfaceRef& Context) throw (RuntimeException) -{ - if (m_xControl.is()) - m_xControl->setContext(Context); -} - -//------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OControl::getContext() throw (RuntimeException) -{ - return m_xControl.is() ? m_xControl->getContext() : InterfaceRef(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OControl::createPeer(const Reference<XToolkit>& Toolkit, const Reference<XWindowPeer>& Parent) throw (RuntimeException) -{ - if (m_xControl.is()) - m_xControl->createPeer(Toolkit, Parent); -} - -//------------------------------------------------------------------------------ -Reference<XWindowPeer> SAL_CALL OControl::getPeer() throw ( RuntimeException) -{ - return m_xControl.is() ? m_xControl->getPeer() : Reference<XWindowPeer>(); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OControl::setModel(const Reference<XControlModel>& Model) throw ( RuntimeException) -{ - return m_xControl.is() ? m_xControl->setModel( Model ) : sal_False; -} - -//------------------------------------------------------------------------------ -Reference<XControlModel> SAL_CALL OControl::getModel() throw ( RuntimeException) -{ - return m_xControl.is() ? m_xControl->getModel() : Reference<XControlModel>(); -} - -//------------------------------------------------------------------------------ -Reference<XView> SAL_CALL OControl::getView() throw ( RuntimeException) -{ - return m_xControl.is() ? m_xControl->getView() : Reference<XView>(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OControl::setDesignMode(sal_Bool bOn) throw ( RuntimeException) -{ - if (m_xControl.is()) - m_xControl->setDesignMode(bOn); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OControl::isDesignMode() throw ( RuntimeException) -{ - return m_xControl.is() ? m_xControl->isDesignMode() : sal_True; -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OControl::isTransparent() throw ( RuntimeException) -{ - return m_xControl.is() ? m_xControl->isTransparent() : sal_True; -} - -//================================================================== -//= OBoundControl -//================================================================== -DBG_NAME(frm_OBoundControl) -//------------------------------------------------------------------ -OBoundControl::OBoundControl(const Reference<com::sun::star::lang::XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _sService) - :OControl(_rxFactory, _sService) - ,m_bLocked(sal_False) -{ - DBG_CTOR(frm_OBoundControl, NULL); -} - -//------------------------------------------------------------------ -OBoundControl::~OBoundControl() -{ - DBG_DTOR(frm_OBoundControl, NULL); -} -// ----------------------------------------------------------------------------- -Sequence< Type> OBoundControl::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - aTypes = concatSequences(OControl::_getTypes(), OBoundControl_BASE::getTypes()); - return aTypes; -} -//------------------------------------------------------------------ -Any SAL_CALL OBoundControl::queryAggregation(const Type& _rType) throw(RuntimeException) -{ - // ask the base class - Any aReturn(OControl::queryAggregation(_rType)); - // ask our own interfaces - if (!aReturn.hasValue()) - aReturn = OBoundControl_BASE::queryInterface(_rType); - - return aReturn; -} - -//------------------------------------------------------------------ -sal_Bool SAL_CALL OBoundControl::getLock() throw(RuntimeException) -{ - return m_bLocked; -} - -//------------------------------------------------------------------ -void SAL_CALL OBoundControl::setLock(sal_Bool _bLock) throw(RuntimeException) -{ - if (m_bLocked == _bLock) - return; - - osl::MutexGuard aGuard(m_aMutex); - _setLock(_bLock); - m_bLocked = _bLock; -} - -//------------------------------------------------------------------ -void OBoundControl::_setLock(sal_Bool _bLock) -{ - // try to set the text component to readonly - Reference<XWindowPeer> xPeer = getPeer(); - Reference<com::sun::star::awt::XTextComponent> xText(xPeer, UNO_QUERY); - - if (xText.is()) - xText->setEditable(!_bLock); - else - { - // disable the window - Reference<XWindow> xComp(xPeer, UNO_QUERY); - if (xComp.is()) - xComp->setEnable(!_bLock); - } -} - -//================================================================== -//= OControlModel -//================================================================== -ConcretInfoService OControlModel::s_aPropInfos; -DBG_NAME(OControlModel) -//------------------------------------------------------------------ -Sequence<sal_Int8> SAL_CALL OControlModel::getImplementationId() throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------ -Sequence<Type> SAL_CALL OControlModel::getTypes() throw(RuntimeException) -{ - Sequence<Type> aOwnTypes = _getTypes(); - Reference<com::sun::star::lang::XTypeProvider> xProv; - - if (query_aggregation(m_xAggregate, xProv)) - return concatSequences(aOwnTypes, xProv->getTypes()); - else - return aOwnTypes; -} - -//------------------------------------------------------------------------------ -Sequence<Type> OControlModel::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - { - // my two base classes - aTypes = concatSequences(OComponentHelper::getTypes(), OPropertySetAggregationHelper::getTypes(), OControlModel_BASE::getTypes()); - } - return aTypes; -} - -//------------------------------------------------------------------ -Any SAL_CALL OControlModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - // base class 1 - Any aReturn(OComponentHelper::queryAggregation(_rType)); - - // base class 2 - if (!aReturn.hasValue()) - { - aReturn = OControlModel_BASE::queryInterface(_rType); - - // our own interfaces - if (!aReturn.hasValue()) - { - aReturn = OPropertySetAggregationHelper::queryInterface(_rType); - // our aggregate - if (!aReturn.hasValue() && m_xAggregate.is() && !_rType.equals(::getCppuType(static_cast< Reference< XCloneable>* >(NULL)))) - aReturn = m_xAggregate->queryAggregation(_rType); - } - } - return aReturn; -} - -//------------------------------------------------------------------------------ -void OControlModel::readHelpTextCompatibly(const staruno::Reference< stario::XObjectInputStream >& _rxInStream) -{ - ::rtl::OUString sHelpText; - ::comphelper::operator>>( _rxInStream, sHelpText); - try - { - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_HELPTEXT, makeAny(sHelpText)); - } - catch(const Exception&) - { - OSL_ENSURE(sal_False, "OControlModel::readHelpTextCompatibly: could not forward the property value to the aggregate!"); - } -} - -//------------------------------------------------------------------------------ -void OControlModel::writeHelpTextCompatibly(const staruno::Reference< stario::XObjectOutputStream >& _rxOutStream) -{ - ::rtl::OUString sHelpText; - try - { - if (m_xAggregateSet.is()) - m_xAggregateSet->getPropertyValue(PROPERTY_HELPTEXT) >>= sHelpText; - } - catch(const Exception&) - { - OSL_ENSURE(sal_False, "OControlModel::writeHelpTextCompatibly: could not retrieve the property value from the aggregate!"); - } - ::comphelper::operator<<( _rxOutStream, sHelpText); -} - -//------------------------------------------------------------------ -OControlModel::OControlModel( - const Reference<com::sun::star::lang::XMultiServiceFactory>& _rxFactory, - const ::rtl::OUString& _rUnoControlModelTypeName, - const ::rtl::OUString& rDefault, const sal_Bool _bSetDelegator) - :OComponentHelper(m_aMutex) - ,OPropertySetAggregationHelper(OComponentHelper::rBHelper) - ,m_nTabIndex(FRM_DEFAULT_TABINDEX) - ,m_nClassId(FormComponentType::CONTROL) - ,m_xServiceFactory(_rxFactory) -{ - DBG_CTOR(OControlModel, NULL); - if (_rUnoControlModelTypeName.getLength()) // the is a model we have to aggregate - { - increment(m_refCount); - - { - m_xAggregate = Reference<XAggregation>(_rxFactory->createInstance(_rUnoControlModelTypeName), UNO_QUERY); - setAggregation(m_xAggregate); - - if (m_xAggregateSet.is() && rDefault.getLength()) - m_xAggregateSet->setPropertyValue(PROPERTY_DEFAULTCONTROL, makeAny(rDefault)); - } - - if (_bSetDelegator) - doSetDelegator(); - - // Refcount wieder bei NULL - decrement(m_refCount); - } -} - -//------------------------------------------------------------------ -OControlModel::OControlModel( const OControlModel* _pOriginal, const Reference< XMultiServiceFactory>& _rxFactory, const sal_Bool _bSetDelegator ) - :OComponentHelper( m_aMutex ) - ,OPropertySetAggregationHelper( OComponentHelper::rBHelper ) - ,m_nTabIndex( FRM_DEFAULT_TABINDEX ) - ,m_nClassId( FormComponentType::CONTROL ) - ,m_xServiceFactory( _rxFactory ) -{ - DBG_CTOR( OControlModel, NULL ); - DBG_ASSERT( _pOriginal, "OControlModel::OControlModel: invalid original!" ); - - // copy members - m_aName = _pOriginal->m_aName; - m_aTag = _pOriginal->m_aTag; - m_nTabIndex = _pOriginal->m_nTabIndex; - m_nClassId = _pOriginal->m_nClassId; - - // temporarily increment refcount because of temporary references to ourself in the following - increment( m_refCount ); - - { - // transfer the (only, at the very moment!) ref count - m_xAggregate = createAggregateClone( _pOriginal ); - - // set aggregation (retrieve other direct interfaces of the aggregate) - setAggregation( m_xAggregate ); - } - - // set the delegator, if allowed by our derived class - if ( _bSetDelegator ) - doSetDelegator(); - - // decrement ref count - decrement( m_refCount ); -} - -//------------------------------------------------------------------ -OControlModel::~OControlModel() -{ - DBG_DTOR(OControlModel, NULL); - // release the aggregate - if (m_xAggregate.is()) - m_xAggregate->setDelegator(InterfaceRef()); -} - -//------------------------------------------------------------------------------ -void OControlModel::doResetDelegator() -{ - if (m_xAggregate.is()) - m_xAggregate->setDelegator(NULL); -} - -//------------------------------------------------------------------------------ -void OControlModel::doSetDelegator() -{ - increment(m_refCount); - if (m_xAggregate.is()) - { - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); - } - decrement(m_refCount); -} - -// XChild -//------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OControlModel::getParent() throw(RuntimeException) -{ - return m_xParent; -} - -//------------------------------------------------------------------------------ -void SAL_CALL OControlModel::setParent(const InterfaceRef& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - - Reference<XComponent> xComp(m_xParent, UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener(static_cast<XPropertiesChangeListener*>(this)); - - { - xComp = xComp.query( _rxParent ); - RTL_LOGFILE_CONTEXT( aLogger, "forms::OControlModel::setParent::logOnEventListener" ); - if ( xComp.is() ) - xComp->addEventListener(static_cast<XPropertiesChangeListener*>(this)); - } - - m_xParent = _rxParent; -} - -// XNamed -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OControlModel::getName() throw(RuntimeException) -{ - ::rtl::OUString aReturn; - OPropertySetHelper::getFastPropertyValue(PROPERTY_ID_NAME) >>= aReturn; - return aReturn; -} - -//------------------------------------------------------------------------------ -void SAL_CALL OControlModel::setName(const ::rtl::OUString& _rName) throw(RuntimeException) -{ - setFastPropertyValue(PROPERTY_ID_NAME, makeAny(_rName)); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OControlModel::supportsService(const rtl::OUString& _rServiceName) throw ( RuntimeException) -{ - Sequence<rtl::OUString> aSupported = getSupportedServiceNames(); - const rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; - return sal_False; -} - -//------------------------------------------------------------------------------ -Sequence<rtl::OUString> SAL_CALL OControlModel::getSupportedServiceNames() throw(RuntimeException) -{ - Sequence<rtl::OUString> aSupported; - - // ask our aggregate - Reference<com::sun::star::lang::XServiceInfo> xInfo; - if (query_aggregation(m_xAggregate, xInfo)) - aSupported = xInfo->getSupportedServiceNames(); - - aSupported.realloc(aSupported.getLength() + 2); - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_FORMCOMPONENT; - pArray[aSupported.getLength()-1] = ::rtl::OUString::createFromAscii("com.sun.star.form.FormControlModel"); - - return aSupported; -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OControlModel::disposing(const com::sun::star::lang::EventObject& _rSource) throw (RuntimeException) -{ - // release the parent - if (_rSource.Source == m_xParent) - { - osl::MutexGuard aGuard(m_aMutex); - m_xParent = NULL; - } - else - { - Reference<com::sun::star::lang::XEventListener> xEvtLst; - if (query_aggregation(m_xAggregate, xEvtLst)) - { - osl::MutexGuard aGuard(m_aMutex); - xEvtLst->disposing(_rSource); - } - } -} - -// OComponentHelper -//----------------------------------------------------------------------------- -void OControlModel::disposing() -{ - OPropertySetAggregationHelper::disposing(); - - Reference<com::sun::star::lang::XComponent> xComp; - if (query_aggregation(m_xAggregate, xComp)) - xComp->dispose(); - - setParent(Reference<XFormComponent>()); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OControlModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - - // 1. Schreiben des UnoControls - Reference<stario::XMarkableStream> xMark(_rxOutStream, UNO_QUERY); - if ( !xMark.is() ) - { - throw IOException( - FRM_RES_STRING( RID_STR_INVALIDSTREAM ), - static_cast< ::cppu::OWeakObject* >( this ) - ); - } - - sal_Int32 nMark = xMark->createMark(); - sal_Int32 nLen = 0; - - _rxOutStream->writeLong(nLen); - - Reference<stario::XPersistObject> xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->write(_rxOutStream); - - // feststellen der Laenge - nLen = xMark->offsetToMark(nMark) - 4; - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); - - // 2. Schreiben einer VersionsNummer - _rxOutStream->writeShort(0x0003); - - // 3. Schreiben der allgemeinen Properties - ::comphelper::operator<<( _rxOutStream, m_aName); - _rxOutStream->writeShort(m_nTabIndex); - ::comphelper::operator<<( _rxOutStream, m_aTag); // 3. version - - // !!! IMPORTANT NOTE !!! - // don't write any new members here : this wouldn't be compatible with older versions, as OControlModel - // is a base class which is called in derived classes "read" method. So if you increment the version - // and write new stuff, older office versions will read this in the _derived_ classes, which may result - // in anything from data loss to crash. - // !!! EOIN !!! -} - -//------------------------------------------------------------------------------ -void OControlModel::read(const Reference<stario::XObjectInputStream>& InStream) throw (::com::sun::star::io::IOException, RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - - Reference<stario::XMarkableStream> xMark(InStream, UNO_QUERY); - if ( !xMark.is() ) - { - throw IOException( - FRM_RES_STRING( RID_STR_INVALIDSTREAM ), - static_cast< ::cppu::OWeakObject* >( this ) - ); - } - - // 1. Lesen des UnoControls - sal_Int32 nLen = InStream->readLong(); - if (nLen) - { - sal_Int32 nMark = xMark->createMark(); - - Reference<stario::XPersistObject> xPersist; - if (query_aggregation(m_xAggregate, xPersist)) - xPersist->read(InStream); - - xMark->jumpToMark(nMark); - InStream->skipBytes(nLen); - xMark->deleteMark(nMark); - } - - // 2. Lesen des Versionsnummer - UINT16 nVersion = InStream->readShort(); - - // 3. Lesen der allgemeinen Properties - ::comphelper::operator>>( InStream, m_aName); - m_nTabIndex = InStream->readShort(); - - if (nVersion > 0x0002) - ::comphelper::operator>>( InStream, m_aTag); - - // we had a version where we wrote the help text - if (nVersion == 0x0004) - readHelpTextCompatibly(InStream); - - DBG_ASSERT(nVersion < 5, "OControlModel::read : suspicious version number !"); - // 4 was the version where we wrote the help text - // later versions shouldn't exist (see write for a detailed comment) -} - -//------------------------------------------------------------------------------ -PropertyState OControlModel::getPropertyStateByHandle( sal_Int32 _nHandle ) -{ - Any aDefault = getPropertyDefaultByHandle( _nHandle ); - Any aCurrent; - getFastPropertyValue( aCurrent, _nHandle ); - - if ( ::comphelper::compare( aDefault, aCurrent ) ) - return PropertyState_DEFAULT_VALUE; - - return PropertyState_DIRECT_VALUE; -} - -//------------------------------------------------------------------------------ -void OControlModel::setPropertyToDefaultByHandle( sal_Int32 _nHandle) -{ - Any aDefault = getPropertyDefaultByHandle( _nHandle ); - - Any aConvertedValue, aOldValue; - if ( convertFastPropertyValue( aConvertedValue, aOldValue, _nHandle, aDefault ) ) - { - setFastPropertyValue_NoBroadcast( _nHandle, aConvertedValue ); - // TODO: fire the property change - } -} - -//------------------------------------------------------------------------------ -Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const -{ - Any aReturn; - switch ( _nHandle ) - { - case PROPERTY_ID_NAME: - case PROPERTY_ID_TAG: - aReturn <<= ::rtl::OUString(); - break; - - case PROPERTY_ID_CLASSID: - aReturn <<= (sal_Int16)FormComponentType::CONTROL; - break; - - case PROPERTY_ID_TABINDEX: - aReturn <<= (sal_Int16)FRM_DEFAULT_TABINDEX; - break; - } - return aReturn; -} - -//------------------------------------------------------------------------------ -void OControlModel::getFastPropertyValue( Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_NAME: - rValue <<= m_aName; - break; - case PROPERTY_ID_TAG: - rValue <<= m_aTag; - break; - case PROPERTY_ID_CLASSID: - rValue <<= m_nClassId; - break; - case PROPERTY_ID_TABINDEX: - rValue <<= m_nTabIndex; - break; - default: - OPropertySetAggregationHelper::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OControlModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (com::sun::star::lang::IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_NAME: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aName); - break; - case PROPERTY_ID_TAG: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aTag); - break; - case PROPERTY_ID_TABINDEX: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_nTabIndex); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) - throw (Exception) -{ - switch (_nHandle) - { - case PROPERTY_ID_NAME: - DBG_ASSERT(_rValue.getValueType() == getCppuType((const ::rtl::OUString*)NULL), - "OControlModel::setFastPropertyValue_NoBroadcast : invalid type" ); - _rValue >>= m_aName; - break; - case PROPERTY_ID_TAG: - DBG_ASSERT(_rValue.getValueType() == getCppuType((const ::rtl::OUString*)NULL), - "OControlModel::setFastPropertyValue_NoBroadcast : invalid type" ); - _rValue >>= m_aTag; - break; - case PROPERTY_ID_TABINDEX: - DBG_ASSERT(_rValue.getValueType() == getCppuType((const sal_Int16*)NULL), - "OControlModel::setFastPropertyValue_NoBroadcast : invalid type" ); - _rValue >>= m_nTabIndex; - break; - } -} - -//================================================================== -//= OBoundControlModel -//================================================================== -DBG_NAME(frm_OBoundControlModel) -//------------------------------------------------------------------ -Any SAL_CALL OBoundControlModel::queryAggregation( const Type& _rType ) throw (RuntimeException) -{ - Any aReturn( OControlModel::queryAggregation(_rType) ); - if (!aReturn.hasValue()) - { - aReturn = OBoundControlModel_BASE1::queryInterface(_rType); - if (!aReturn.hasValue() && m_bCommitable) - aReturn = OBoundControlModel_BASE2::queryInterface(_rType); - } - - return aReturn; -} - -//------------------------------------------------------------------ -OBoundControlModel::OBoundControlModel( - const Reference<com::sun::star::lang::XMultiServiceFactory>& _rxFactory, - const ::rtl::OUString& _rUnoControlModelTypeName, - const ::rtl::OUString& _rDefault, - const sal_Bool _bCommitable, - const sal_Bool _bSetDelegator) - :OControlModel(_rxFactory, _rUnoControlModelTypeName, _rDefault, _bSetDelegator) - ,m_aUpdateListeners(m_aMutex) - ,m_aResetListeners(m_aMutex) - ,m_bLoaded(sal_False) - ,m_bRequired(sal_False) - ,m_bCommitable(_bCommitable) - ,m_aLabelServiceName(FRM_SUN_COMPONENT_FIXEDTEXT) - ,m_bResetting(sal_False) - ,m_bForwardValueChanges(sal_True) -{ - DBG_CTOR(frm_OBoundControlModel, NULL); -} - -//------------------------------------------------------------------ -OBoundControlModel::OBoundControlModel( - const OBoundControlModel* _pOriginal, const Reference< XMultiServiceFactory>& _rxFactory, - const sal_Bool _bCommitable, const sal_Bool _bSetDelegator ) - :OControlModel( _pOriginal, _rxFactory, _bSetDelegator ) - ,m_aUpdateListeners( m_aMutex ) - ,m_aResetListeners( m_aMutex ) - ,m_bLoaded( sal_False ) - ,m_bRequired( sal_False ) - ,m_bCommitable( _bCommitable ) - ,m_bResetting( sal_False ) - ,m_bForwardValueChanges( sal_True ) -{ - DBG_CTOR(frm_OBoundControlModel, NULL); - - m_aLabelServiceName = _pOriginal->m_aLabelServiceName; - m_sDataFieldConnectivityProperty = _pOriginal->m_sDataFieldConnectivityProperty; - m_aControlSource = _pOriginal->m_aControlSource; - // m_xLabelControl, though bneing a property, is not to be cloned, not even the reference will be transfered. - // (the former should be clear - a clone of the object we're only referencing does not make sense) - // (the second would violate the restriction for label controls that they're part of the - // same form component hierarchy - we ourself are no part, yet, so we can't have a label control) - m_bCommitable = _pOriginal->m_bCommitable; -} - -//------------------------------------------------------------------ -OBoundControlModel::~OBoundControlModel() -{ - DBG_DTOR(frm_OBoundControlModel, NULL); -} - -//----------------------------------------------------------------------------- -Sequence<Type> OBoundControlModel::_getTypes() -{ - if (m_bCommitable) - return concatSequences(OControlModel::_getTypes(),OBoundControlModel_BASE1::getTypes(),OBoundControlModel_BASE2::getTypes()); - - return concatSequences(OControlModel::_getTypes(),OBoundControlModel_BASE1::getTypes()); -} - -// OComponentHelper -//----------------------------------------------------------------------------- -void OBoundControlModel::disposing() -{ - OControlModel::disposing(); - - osl::MutexGuard aGuard(m_aMutex); - com::sun::star::lang::EventObject aEvt(static_cast<XWeak*>(this)); - m_aResetListeners.disposeAndClear(aEvt); - m_aUpdateListeners.disposeAndClear(aEvt); - - if (m_xField.is()) - { - m_xField->removePropertyChangeListener(PROPERTY_VALUE, this); - resetField(); - } - m_xCursor = NULL; - - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); -} - -// XChild -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::setParent(const Reference<XInterface>& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - - // log off old listeners - Reference< XLoadable > xLoadable( m_xParent, UNO_QUERY ); - if ( xLoadable.is() ) - xLoadable->removeLoadListener( this ); - - // log on new listeners - { - xLoadable = xLoadable.query( _rxParent ); - RTL_LOGFILE_CONTEXT( aLogger, "forms::OBoundControlModel::setParent::logOnLoadListener" ); - if ( xLoadable.is() ) - xLoadable->addLoadListener( this ); - } - - OControlModel::setParent(_rxParent); -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::disposing(const com::sun::star::lang::EventObject& _rEvent) throw (RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - if (m_xField == _rEvent.Source) - { - resetField(); - } - else if (m_xLabelControl == _rEvent.Source) - { - Reference<XPropertySet> xOldValue = m_xLabelControl; - m_xLabelControl = NULL; - - // fire a property change event - Any aOldValue; aOldValue <<= xOldValue; - Any aNewValue; aNewValue <<= m_xLabelControl; - sal_Int32 nHandle = PROPERTY_ID_CONTROLLABEL; - OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False); - } - else - OControlModel::disposing(_rEvent); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OBoundControlModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = ::rtl::OUString::createFromAscii("com.sun.star.form.DataAwareControlModel"); - return aSupported; -} - - -// XPersist -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::write( const Reference<stario::XObjectOutputStream>& _rxOutStream ) throw(stario::IOException, RuntimeException) -{ - OControlModel::write(_rxOutStream); - - osl::MutexGuard aGuard(m_aMutex); - - // Version - _rxOutStream->writeShort(0x0002); - - // Controlsource - ::comphelper::operator<<( _rxOutStream, m_aControlSource); - - // !!! IMPORTANT NOTE !!! - // don't write any new members here : this wouldn't be compatible with older versions, as OBoundControlModel - // is a base class which is called in derived classes "read" method. So if you increment the version - // and write new stuff, older office versions will read this in the _derived_ classes, which may result - // in anything from data loss to crash. - // (use writeCommonProperties instead, this is called in derived classes write-method) - // !!! EOIN !!! - // FS - 68876 - 28.09.1999 -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::defaultCommonProperties() -{ - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); - m_xLabelControl = NULL; -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::readCommonProperties(const Reference<stario::XObjectInputStream>& _rxInStream) -{ - sal_Int32 nLen = _rxInStream->readLong(); - - Reference<stario::XMarkableStream> xMark(_rxInStream, UNO_QUERY); - DBG_ASSERT(xMark.is(), "OBoundControlModel::readCommonProperties : can only work with markable streams !"); - sal_Int32 nMark = xMark->createMark(); - - // read the reference to the label control - Reference<stario::XPersistObject> xPersist; - sal_Int32 nUsedFlag; - nUsedFlag = _rxInStream->readLong(); - if (nUsedFlag) - xPersist = _rxInStream->readObject(); - m_xLabelControl = Reference<XPropertySet>(xPersist, UNO_QUERY); - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->addEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); - - // read any other new common properties here - - // skip the remaining bytes - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nLen); - xMark->deleteMark(nMark); -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::writeCommonProperties(const Reference<stario::XObjectOutputStream>& _rxOutStream) -{ - Reference<stario::XMarkableStream> xMark(_rxOutStream, UNO_QUERY); - DBG_ASSERT(xMark.is(), "OBoundControlModel::writeCommonProperties : can only work with markable streams !"); - sal_Int32 nMark = xMark->createMark(); - - // a placeholder where we will write the overall length (later in this method) - sal_Int32 nLen = 0; - _rxOutStream->writeLong(nLen); - - // write the reference to the label control - Reference<stario::XPersistObject> xPersist(m_xLabelControl, UNO_QUERY); - sal_Int32 nUsedFlag = 0; - if (xPersist.is()) - nUsedFlag = 1; - _rxOutStream->writeLong(nUsedFlag); - if (xPersist.is()) - _rxOutStream->writeObject(xPersist); - - // write any other new common properties here - - // write the correct length at the beginning of the block - nLen = xMark->offsetToMark(nMark) - sizeof(nLen); - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::read( const Reference< stario::XObjectInputStream >& _rxInStream ) throw(stario::IOException, RuntimeException) -{ - OControlModel::read(_rxInStream); - - osl::MutexGuard aGuard(m_aMutex); - UINT16 nVersion = _rxInStream->readShort(); - ::comphelper::operator>>( _rxInStream, m_aControlSource); -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const -{ - switch (nHandle) - { - case PROPERTY_ID_CONTROLSOURCEPROPERTY: - rValue <<= m_sDataFieldConnectivityProperty; - break; - case PROPERTY_ID_CONTROLSOURCE: - rValue <<= m_aControlSource; - break; - case PROPERTY_ID_BOUNDFIELD: - rValue <<= m_xField; - break; - case PROPERTY_ID_CONTROLLABEL: - if (!m_xLabelControl.is()) - rValue.clear(); - else - rValue <<= m_xLabelControl; - break; - default: - OControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OBoundControlModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, - sal_Int32 _nHandle, - const Any& _rValue) - throw (com::sun::star::lang::IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_CONTROLSOURCE: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aControlSource); - break; - case PROPERTY_ID_BOUNDFIELD: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_xField); - break; - case PROPERTY_ID_CONTROLLABEL: - if (!_rValue.hasValue()) - { // property set to void - _rConvertedValue = Any(); - getFastPropertyValue(_rOldValue, _nHandle); - bModified = m_xLabelControl.is(); - } - else - { - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_xLabelControl); - if (!m_xLabelControl.is()) - // an empty interface is interpreted as VOID - _rOldValue.clear(); - } - break; - default: - bModified = OControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_CONTROLSOURCE: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" ); - rValue >>= m_aControlSource; - break; - case PROPERTY_ID_BOUNDFIELD: - DBG_ERROR("OBoundControlModel::setFastPropertyValue_NoBroadcast : BoundField should be a read-only property !"); - throw com::sun::star::lang::IllegalArgumentException(); - break; - case PROPERTY_ID_CONTROLLABEL: - { - DBG_ASSERT(!rValue.hasValue() || (rValue.getValueType().getTypeClass() == TypeClass_INTERFACE), - "OBoundControlModel::setFastPropertyValue_NoBroadcast : invalid argument !"); - if (!rValue.hasValue()) - { // set property to "void" - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); - m_xLabelControl = NULL; - break; - } - - InterfaceRef xNewValue; - rValue >>= xNewValue; - - Reference<XControlModel> xAsModel(xNewValue, UNO_QUERY); - Reference<com::sun::star::lang::XServiceInfo> xAsServiceInfo(xNewValue, UNO_QUERY); - Reference<XPropertySet> xAsPropSet(xNewValue, UNO_QUERY); - Reference<XChild> xAsChild(xNewValue, UNO_QUERY); - if (!xAsModel.is() || !xAsServiceInfo.is() || !xAsPropSet.is() || !xAsChild.is()) - { - throw com::sun::star::lang::IllegalArgumentException(); - } - - if (!xAsServiceInfo->supportsService(m_aLabelServiceName)) - { - throw com::sun::star::lang::IllegalArgumentException(); - } - - // check if weself and the given model have a common anchestor (up to the forms collection) - Reference<XChild> xCont; - query_interface(static_cast<XWeak*>(this), xCont); - InterfaceRef xMyTopLevel = xCont->getParent(); - while (xMyTopLevel.is()) - { - Reference<XForm> xAsForm(xMyTopLevel, UNO_QUERY); - if (!xAsForm.is()) - // found my root - break; - - Reference<XChild> xAsChild(xMyTopLevel, UNO_QUERY); - xMyTopLevel = xAsChild.is() ? xAsChild->getParent() : InterfaceRef(); - } - InterfaceRef xNewTopLevel = xAsChild->getParent(); - while (xNewTopLevel.is()) - { - Reference<XForm> xAsForm(xNewTopLevel, UNO_QUERY); - if (!xAsForm.is()) - break; - - Reference<XChild> xAsChild(xNewTopLevel, UNO_QUERY); - xNewTopLevel = xAsChild.is() ? xAsChild->getParent() : InterfaceRef(); - } - if (xNewTopLevel != xMyTopLevel) - { - // the both objects don't belong to the same forms collection -> not acceptable - throw com::sun::star::lang::IllegalArgumentException(); - } - - m_xLabelControl = xAsPropSet; - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->addEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); - } - break; - default: - OControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue ); - } -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::propertyChange( const PropertyChangeEvent& evt ) throw(RuntimeException) -{ - // Bei Wertaenderung neu initialisieren - if (evt.PropertyName.equals(PROPERTY_VALUE)) - { - osl::MutexGuard aGuard(m_aMutex); - if (m_bForwardValueChanges && m_xColumn.is()) - _onValueChanged(); - } -} - -// XBoundComponent -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::addUpdateListener(const Reference<XUpdateListener>& _rxListener) throw(RuntimeException) -{ - m_aUpdateListeners.addInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::removeUpdateListener(const Reference< XUpdateListener>& _rxListener) throw(RuntimeException) -{ - m_aUpdateListeners.removeInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OBoundControlModel::commit() throw(RuntimeException) -{ - DBG_ASSERT(m_bCommitable, "OBoundControlModel::commit : invalid call (I'm not commitable !) "); - { - osl::MutexGuard aGuard(m_aMutex); - if (!m_xField.is()) - return sal_True; - } - - cppu::OInterfaceIteratorHelper aIter(m_aUpdateListeners); - com::sun::star::lang::EventObject aEvt; - aEvt.Source = static_cast<XWeak*>(this); - sal_Bool bSucceed = sal_True; - while (aIter.hasMoreElements() && bSucceed) - bSucceed = ((XUpdateListener*)aIter.next())->approveUpdate(aEvt); - - if (bSucceed) - { - osl::MutexGuard aGuard(m_aMutex); - try - { - bSucceed = _commit(); - } - catch(Exception&) - { - bSucceed = sal_False; - } - } - - if (bSucceed) - { - cppu::OInterfaceIteratorHelper aIter(m_aUpdateListeners); - while (aIter.hasMoreElements()) - ((XUpdateListener*)aIter.next())->updated(aEvt); - } - - return bSucceed; -} - -//------------------------------------------------------------------------------ -sal_Bool OBoundControlModel::connectToField(const Reference<XRowSet>& rForm) -{ - // wenn eine Verbindung zur Datenbank existiert - if (rForm.is() && getConnection(rForm).is()) - { - // Feld bestimmen und PropertyChangeListener - m_xCursor = rForm; - Reference<XPropertySet> xFieldCandidate; - - if (m_xCursor.is()) - { - Reference<XColumnsSupplier> xColumnsSupplier(m_xCursor, UNO_QUERY); - DBG_ASSERT(xColumnsSupplier.is(), "OBoundControlModel::connectToField : the row set should support the com::sun::star::sdb::ResultSet service !"); - if (xColumnsSupplier.is()) - { - Reference<XNameAccess> xColumns(xColumnsSupplier->getColumns(), UNO_QUERY); - if (xColumns.is() && xColumns->hasByName(m_aControlSource)) - { - Any aElement(xColumns->getByName(m_aControlSource)); - DBG_ASSERT(xColumns->getElementType().equals(::getCppuType(reinterpret_cast<Reference<XPropertySet>*>(NULL))), - "OBoundControlModel::connectToField : the columns container should contain XPropertySets !"); - // if this assertion fails we probably should do a queryInterface .... - aElement >>= xFieldCandidate; - } - } - } - - // darf ich mich ueberhaupt an dieses Feld binden (Typ-Check) - if (xFieldCandidate.is()) - { - sal_Int32 nFieldType; - xFieldCandidate->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType; - if (_approve(nFieldType)) - setField(xFieldCandidate,sal_False); - } - else - setField(NULL,sal_False); - - if (m_xField.is()) - { - if(m_xField->getPropertySetInfo()->hasPropertyByName(PROPERTY_VALUE)) - { - // an wertaenderungen horchen - m_xField->addPropertyChangeListener(PROPERTY_VALUE, this); - m_xColumnUpdate = Reference<XColumnUpdate>(m_xField, UNO_QUERY); - m_xColumn = Reference<XColumn>(m_xField, UNO_QUERY); - INT32 nNullableFlag; m_xField->getPropertyValue(PROPERTY_ISNULLABLE) >>= nNullableFlag; - m_bRequired = (ColumnValue::NO_NULLS == nNullableFlag); - // we're optimistic : in case of ColumnValue_NULLABLE_UNKNOWN we assume nullability .... - } - else - { - OSL_ENSURE(sal_False, "OBoundControlModel::connectToField: property NAME not supported!"); - setField(NULL,sal_False); - } - } - } - return m_xField.is(); -} - -//------------------------------------------------------------------------------ -sal_Bool OBoundControlModel::_approve(sal_Int32 _nColumnType) -{ - if ((_nColumnType == DataType::BINARY) || (_nColumnType == DataType::VARBINARY) - || (_nColumnType == DataType::LONGVARBINARY) || (_nColumnType == DataType::OTHER) - || (_nColumnType == DataType::OBJECT) || (_nColumnType == DataType::DISTINCT) - || (_nColumnType == DataType::STRUCT) || (_nColumnType == DataType::ARRAY) - || (_nColumnType == DataType::BLOB) || (_nColumnType == DataType::CLOB) - || (_nColumnType == DataType::REF) || (_nColumnType == DataType::SQLNULL)) - return sal_False; - - return sal_True; -} - -// XLoadListener -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::loaded(const com::sun::star::lang::EventObject& _rEvent) throw(RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - Reference<XRowSet> xForm(_rEvent.Source, UNO_QUERY); - Reference<XPropertySet> xOldField = m_xField; - connectToField(xForm); - - m_bLoaded = sal_True; - _loaded(_rEvent); - - if (m_xField.is()) - { - // initially call _onValueChanged - // but only if the rowset if posisitioned on a valid record - Reference< XRowSet > xRowset( _rEvent.Source, UNO_QUERY ); - OSL_ENSURE( xRowset.is(), "OBoundControlModel::loaded: invalid event source (no rowset)!" ); - if ( xRowset.is() ) - { - if ( !xRowset->isBeforeFirst() && !xRowset->isAfterLast() ) - _onValueChanged(); - } - } - - if ( xOldField != m_xField ) - { - Any aNewValue; aNewValue <<= m_xField; - Any aOldValue; aOldValue <<= xOldField; - sal_Int32 nHandle = PROPERTY_ID_BOUNDFIELD; - OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False); - } -} - - -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::unloaded( const com::sun::star::lang::EventObject& aEvent ) throw(RuntimeException) -{ -} - -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::reloading( const com::sun::star::lang::EventObject& aEvent ) throw(RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - m_bForwardValueChanges = sal_False; -} - -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::unloading(const com::sun::star::lang::EventObject& aEvent) throw(RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - _unloaded(); - - if (m_xField.is()) - { - m_xField->removePropertyChangeListener(PROPERTY_VALUE, this); - resetField(); - } - m_xCursor = NULL; - m_bLoaded = sal_False; -} - -//------------------------------------------------------------------------------ -void SAL_CALL OBoundControlModel::reloaded(const com::sun::star::lang::EventObject& aEvent) throw(RuntimeException) -{ - osl::MutexGuard aGuard(m_aMutex); - Reference<XPropertySet> xOldField = m_xField; - // did we lost the connection to the field because there was a new created? - if (!m_xField.is()) - { - Reference<XRowSet> xForm(aEvent.Source, UNO_QUERY); - connectToField(xForm); - } - - m_bForwardValueChanges = sal_True; - _loaded(aEvent); - - // do we have a field, than get the new value - if (m_xField.is()) - _onValueChanged(); - - if ( xOldField != m_xField ) - { - Any aNewValue; aNewValue <<= m_xField; - Any aOldValue; aOldValue <<= xOldField; - sal_Int32 nHandle = PROPERTY_ID_BOUNDFIELD; - OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False); - } -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::_loaded(const com::sun::star::lang::EventObject& rEvent) -{ -} - -//------------------------------------------------------------------------------ -void OBoundControlModel::_unloaded() -{ -} - -// XReset -//----------------------------------------------------------------------------- -void OBoundControlModel::_reset() -{ -} - -//----------------------------------------------------------------------------- -void OBoundControlModel::addResetListener(const Reference<XResetListener>& l) throw (RuntimeException) -{ - m_aResetListeners.addInterface(l); -} - -//----------------------------------------------------------------------------- -void OBoundControlModel::removeResetListener(const Reference<XResetListener>& l) throw (RuntimeException) -{ - m_aResetListeners.removeInterface(l); -} - -//----------------------------------------------------------------------------- -void OBoundControlModel::reset() throw (RuntimeException) -{ - cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); - com::sun::star::lang::EventObject aResetEvent(static_cast<XWeak*>(this)); - sal_Bool bContinue = sal_True; - while (aIter.hasMoreElements() && bContinue) - bContinue = reinterpret_cast<XResetListener*>(aIter.next())->approveReset(aResetEvent); - - if (!bContinue) - return; - - osl::ClearableMutexGuard aGuard(m_aMutex); - m_bResetting = sal_True; - - sal_Bool bSimpleReset = !m_xField.is() // no connection to a database field - || ( m_xCursor.is() // OR we have an improperly positioned cursor - && ( m_xCursor->isAfterLast() - || m_xCursor->isBeforeFirst() - ) - ); - - if ( !bSimpleReset ) - { - // The default values will be set if and only if the current value of the field which we're bound - // to is NULL. - // Else, the current field value should be refreshed - // This behaviour is not completely ... "matured": What should happen if the field as well as the - // control have a default value? - - sal_Bool bIsNull = sal_True; - // we have to access the field content at least once to get a reliable result by XColumn::wasNull - try - { - m_xColumn->getString(); - bIsNull = m_xColumn->wasNull(); - } - catch(Exception&) - { - DBG_ERROR("OBoundControlModel::reset : XColumn::getString and wasNull are expected to always succeed !"); - } - - if (bIsNull) - { - sal_Bool bIsNewRecord = sal_False; - Reference<XPropertySet> xSet(m_xCursor, UNO_QUERY); - if (xSet.is()) - xSet->getPropertyValue(PROPERTY_ISNEW) >>= bIsNewRecord; - if (bIsNewRecord) - { - _reset(); // setzen der Werte, - _commit(); // uebertragen der Werte ins Feld - // fuer das zuruecksetzen des modifyflags ist das Formular zustaendig - } - else - _onValueChanged(); - } - else - _onValueChanged(); - } - else - _reset(); - - m_bResetting = sal_False; - aGuard.clear(); - - cppu::OInterfaceIteratorHelper aIterDone(m_aResetListeners); - while (aIterDone.hasMoreElements()) - reinterpret_cast<XResetListener*>(aIterDone.next())->resetted(aResetEvent); -} -// ----------------------------------------------------------------------------- -void OBoundControlModel::setField( const Reference< XPropertySet>& _rxField,sal_Bool _bFire) -{ - // fire a property change event - if ( m_xField != _rxField ) - { - Any aOldValue; aOldValue <<= m_xField; - m_xField = _rxField; - if ( _bFire ) - { - Any aNewValue; aNewValue <<= _rxField; - sal_Int32 nHandle = PROPERTY_ID_BOUNDFIELD; - OPropertySetHelper::fire(&nHandle, &aNewValue, &aOldValue, 1, sal_False); - } - } -} -// ----------------------------------------------------------------------------- - -//......................................................................... -} -//... namespace frm ....................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_FormattedField.cxx b/binfilter/bf_forms/source/component/forms_FormattedField.cxx deleted file mode 100644 index 9bee7163f847..000000000000 --- a/binfilter/bf_forms/source/component/forms_FormattedField.cxx +++ /dev/null @@ -1,1126 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> - -#include <com/sun/star/awt/XKeyListener.hpp> - -#include <tools/link.hxx> - -#include "FormattedField.hxx" -#include "services.hxx" -#include "property.hrc" -#include "frm_resource.hrc" - -#include <comphelper/numbers.hxx> -#include <connectivity/dbtools.hxx> -#include <connectivity/dbconversion.hxx> - -#include <bf_svtools/zforlist.hxx> -#include <bf_svtools/numuno.hxx> - -#include <vcl/svapp.hxx> -#include <i18npool/mslangid.hxx> -#include <rtl/textenc.h> - -#include <com/sun/star/util/NumberFormat.hpp> -#include <com/sun/star/form/XSubmit.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/awt/XKeyListener.hpp> -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/util/XNumberFormatTypes.hpp> -#include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <osl/mutex.hxx> - // needed as long as we use the SolarMutex -#include <comphelper/streamsection.hxx> - -#include <comphelper/property.hxx> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -namespace binfilter { - -using namespace dbtools; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//......................................................................... -namespace frm -{ - -/*************************************************************************/ - -class StandardFormatsSupplier : protected SvNumberFormatsSupplierObj -{ -protected: - SvNumberFormatter* m_pMyPrivateFormatter; - -public: - StandardFormatsSupplier(const Reference<XMultiServiceFactory>& _rxFactory,LanguageType _eSysLanguage); - - operator Reference<XNumberFormatsSupplier> (); - SvNumberFormatsSupplierObj::operator new; - SvNumberFormatsSupplierObj::operator delete; - -protected: - ~StandardFormatsSupplier() { if (m_pMyPrivateFormatter) delete m_pMyPrivateFormatter; } -}; - - -//------------------------------------------------------------------ -StandardFormatsSupplier::StandardFormatsSupplier(const Reference< XMultiServiceFactory > & _rxFactory,LanguageType _eSysLanguage) - :SvNumberFormatsSupplierObj() - ,m_pMyPrivateFormatter(new SvNumberFormatter(_rxFactory, _eSysLanguage)) -{ - SetNumberFormatter(m_pMyPrivateFormatter); -} - -//------------------------------------------------------------------ -StandardFormatsSupplier::operator Reference<XNumberFormatsSupplier> () -{ - return static_cast<XNumberFormatsSupplier*>(static_cast<SvNumberFormatsSupplierObj*>(this)); -} - -//------------------------------------------------------------------ -Reference<XNumberFormatsSupplier> OFormattedModel::s_xDefaultFormatter; -sal_Int32 OFormattedModel::nValueHandle = -1; - -/*************************************************************************/ -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OFormattedControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OFormattedControl(_rxFactory)); -} - -//------------------------------------------------------------------ -Sequence<Type> OFormattedControl::_getTypes() -{ - return ::comphelper::concatSequences( - OFormattedControl_BASE::getTypes(), - OBoundControl::_getTypes() - ); -} - -//------------------------------------------------------------------ -Any SAL_CALL OFormattedControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = OFormattedControl_BASE::queryInterface(_rType); - return aReturn; -} - - -DBG_NAME(OFormattedControl) -//------------------------------------------------------------------------------ -OFormattedControl::OFormattedControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_FORMATTEDFIELD) - ,m_nKeyEvent(0) -{ - DBG_CTOR(OFormattedControl,NULL); - - increment(m_refCount); - { // als FocusListener anmelden - Reference<XWindow> xComp; - if (query_aggregation(m_xAggregate, xComp)) - { - xComp->addKeyListener(this); - } - } - // Refcount wieder bei 1 fuer den Listener - sal_Int32 n = decrement(m_refCount); -} - -//------------------------------------------------------------------------------ -OFormattedControl::~OFormattedControl() -{ - if( m_nKeyEvent ) - Application::RemoveUserEvent( m_nKeyEvent ); - - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR(OFormattedControl,NULL); -} - -// XKeyListener -//------------------------------------------------------------------------------ -void OFormattedControl::disposing(const EventObject& _rSource) throw(RuntimeException) -{ - OBoundControl::disposing(_rSource); -} - -//------------------------------------------------------------------------------ -void OFormattedControl::keyPressed(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException) -{ - if( e.KeyCode != KEY_RETURN || e.Modifiers != 0 ) - return; - - // Steht das Control in einem Formular mit einer Submit-URL? - Reference<com::sun::star::beans::XPropertySet> xSet(getModel(), UNO_QUERY); - if( !xSet.is() ) - return; - - Reference<XFormComponent> xFComp(xSet, UNO_QUERY); - InterfaceRef xParent = xFComp->getParent(); - if( !xParent.is() ) - return; - - Reference<com::sun::star::beans::XPropertySet> xFormSet(xParent, UNO_QUERY); - if( !xFormSet.is() ) - return; - - Any aTmp(xFormSet->getPropertyValue( PROPERTY_TARGET_URL )); - if (!isA(aTmp, static_cast< ::rtl::OUString* >(NULL)) || - !getString(aTmp).getLength() ) - return; - - Reference<XIndexAccess> xElements(xParent, UNO_QUERY); - sal_Int32 nCount = xElements->getCount(); - if( nCount > 1 ) - { - - Reference<com::sun::star::beans::XPropertySet> xFCSet; - for( sal_Int32 nIndex=0; nIndex < nCount; nIndex++ ) - { - // Any aElement(xElements->getByIndex(nIndex)); - xElements->getByIndex(nIndex) >>= xFCSet; - - if (hasProperty(PROPERTY_CLASSID, xFCSet) && - getINT16(xFCSet->getPropertyValue(PROPERTY_CLASSID)) == FormComponentType::TEXTFIELD) - { - // Noch ein weiteres Edit gefunden ==> dann nicht submitten - if (xFCSet != xSet) - return; - } - } - } - - // Da wir noch im Haender stehen, submit asynchron ausloesen - if( m_nKeyEvent ) - Application::RemoveUserEvent( m_nKeyEvent ); - m_nKeyEvent = Application::PostUserEvent( LINK(this, OFormattedControl, - OnKeyPressed) ); -} - -//------------------------------------------------------------------------------ -void OFormattedControl::keyReleased(const ::com::sun::star::awt::KeyEvent& e) throw ( ::com::sun::star::uno::RuntimeException) -{ -} - -//------------------------------------------------------------------------------ -IMPL_LINK(OFormattedControl, OnKeyPressed, void*, EMPTYARG) -{ - m_nKeyEvent = 0; - - Reference<XFormComponent> xFComp(getModel(), UNO_QUERY); - InterfaceRef xParent = xFComp->getParent(); - Reference<XSubmit> xSubmit(xParent, UNO_QUERY); - if (xSubmit.is()) - xSubmit->submit( Reference<XControl> (), ::com::sun::star::awt::MouseEvent() ); - return 0L; -} - -//------------------------------------------------------------------------------ -StringSequence OFormattedControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_FORMATTEDFIELD; - return aSupported; -} - -//------------------------------------------------------------------------------ -void OFormattedControl::setDesignMode(sal_Bool bOn) throw ( ::com::sun::star::uno::RuntimeException) -{ - OBoundControl::setDesignMode(bOn); -} - -/*************************************************************************/ -DBG_NAME(OFormattedModel) -//------------------------------------------------------------------ -void OFormattedModel::implConstruct() -{ - // members - m_bOriginalNumeric = sal_False; - m_bNumeric = sal_False; - m_xOriginalFormatter = NULL; - m_nKeyType = NumberFormat::UNDEFINED; - m_aNullDate = DBTypeConversion::getStandardDate(); - m_bAggregateListening = sal_False; - m_pPropertyMultiplexer = NULL; - m_nFieldType = DataType::OTHER; - - // default our formats supplier - increment(m_refCount); - setPropertyToDefaultByHandle(PROPERTY_ID_FORMATSSUPPLIER); - decrement(m_refCount); - - startAggregateListening(); - doSetDelegator(); -} - -//------------------------------------------------------------------ -OFormattedModel::OFormattedModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_FORMATTEDFIELD, FRM_CONTROL_FORMATTEDFIELD, sal_False ) - // use the old control name for compytibility reasons - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,OPropertyChangeListener( m_aMutex ) -{ - DBG_CTOR(OFormattedModel, NULL); - - implConstruct(); - - m_sDataFieldConnectivityProperty = PROPERTY_EFFECTIVE_VALUE; - m_nClassId = FormComponentType::TEXTFIELD; - - if (OFormattedModel::nValueHandle == -1) - OFormattedModel::nValueHandle = getOriginalHandle(PROPERTY_ID_EFFECTIVE_VALUE); -} - -//------------------------------------------------------------------ -OFormattedModel::OFormattedModel( const OFormattedModel* _pOriginal, const Reference< XMultiServiceFactory >& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,OPropertyChangeListener( m_aMutex ) -{ - DBG_CTOR(OFormattedModel, NULL); - - implConstruct(); -} - -//------------------------------------------------------------------------------ -OFormattedModel::~OFormattedModel() -{ - doResetDelegator(); - releaseAggregateListener(); - - DBG_DTOR(OFormattedModel, NULL); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OFormattedModel ) - -//------------------------------------------------------------------------------ -void OFormattedModel::startAggregateListening() -{ - DBG_ASSERT(!m_bAggregateListening, "OFormattedModel::startAggregateListening: already listening!"); - if (m_bAggregateListening) - return; - - DBG_ASSERT(NULL == m_pPropertyMultiplexer, "OFormattedModel::startAggregateListening: previous listener not released!"); - if (m_pPropertyMultiplexer) - releaseAggregateListener(); - - m_pPropertyMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet, sal_False); - m_pPropertyMultiplexer->addProperty(PROPERTY_FORMATKEY); - m_pPropertyMultiplexer->acquire(); - - m_bAggregateListening = sal_True; -} - -//------------------------------------------------------------------------------ -void OFormattedModel::stopAggregateListening() -{ - DBG_ASSERT(m_bAggregateListening, "OFormattedModel::stopAggregateListening: not listening!"); - if (!m_bAggregateListening) - return; - - if (m_pPropertyMultiplexer) - m_pPropertyMultiplexer->dispose(); - - m_bAggregateListening = sal_False; -} - -//------------------------------------------------------------------------------ -void OFormattedModel::releaseAggregateListener() -{ - DBG_ASSERT(!m_bAggregateListening, "OFormattedModel::releaseAggregateListener: still listening!"); - if (m_bAggregateListening) - stopAggregateListening(); - - if (m_pPropertyMultiplexer) - { - m_pPropertyMultiplexer->release(); - m_pPropertyMultiplexer = NULL; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OFormattedModel::disposing() -{ - stopAggregateListening(); - OErrorBroadcaster::disposing(); - OEditBaseModel::disposing(); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OFormattedModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OEditBaseModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseFormattedField"); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FORMATTEDFIELD; - return aSupported; -} - -// XAggregation -//------------------------------------------------------------------------------ -Any SAL_CALL OFormattedModel::queryAggregation(const Type& _rType) throw(RuntimeException) -{ - Any aReturn = OEditBaseModel::queryAggregation( _rType ); - return aReturn.hasValue() ? aReturn : OErrorBroadcaster::queryInterface( _rType ); -} - -// XTypeProvider -//------------------------------------------------------------------------------ -Sequence< Type > OFormattedModel::_getTypes() -{ - return ::comphelper::concatSequences( - OEditBaseModel::_getTypes(), - OErrorBroadcaster::getTypes() - ); -} - -// XPersistObject -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFormattedModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return ::rtl::OUString(FRM_COMPONENT_EDIT); -// return ::rtl::OUString(FRM_COMPONENT_FORMATTEDFIELD); // old (non-sun) name for compatibility ! -} - -// XPropertySet -//------------------------------------------------------------------------------ -Reference<com::sun::star::beans::XPropertySetInfo> SAL_CALL OFormattedModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<com::sun::star::beans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OFormattedModel::getInfoHelper() -{ - return *const_cast<OFormattedModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::fillProperties( - Sequence< com::sun::star::beans::Property >& _rProps, - Sequence< com::sun::star::beans::Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(10) - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, com::sun::star::beans::XPropertySet,BOUND,READONLY, TRANSIENT); - DECL_BOOL_PROP2(FILTERPROPOSAL, BOUND, MAYBEDEFAULT); - DECL_IFACE_PROP2(CONTROLLABEL, com::sun::star::beans::XPropertySet,BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - - // the supplier is readonly for us -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_FORMATSSUPPLIER, PropertyAttribute::READONLY, 0); - // remove this. The property does not need to be readonly anymore. - // - // The original idea why we made this readonly is that we change the supplier ourself when - // the form which we belong to is loaded, and then we use the supplier from the data source - // the for is bound to. - // But this does not contradict (like I originally thought) the possibility to change the - // formatter from outside as well. If it is changed when the form is not yet loaded, - // then we will overwrite this upon loading, anyway. If it is changed while the form - // is loaded, then this does no harm, too: The format is preserved (the aggregate cares for this), - // and upon unloading, we restore the old formatter. - // - // 84794 - 2002-10-09 - fs@openoffice.org - - // TreatAsNumeric nicht transient : wir wollen es an der UI anbinden (ist noetig, um dem EffectiveDefault - // - der kann Text oder Zahl sein - einen Sinn zu geben) - ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TREATASNUMERIC, 0, PropertyAttribute::TRANSIENT); - // same for FormatKey - // (though the paragraph above for the TreatAsNumeric does not hold anymore - we do not have an UI for this. - // But we have for the format key ...) - // 25.06.2001 - 87862 - frank.schoenheit@sun.com - ModifyPropertyAttributes(_rAggregateProps, PROPERTY_FORMATKEY, 0, PropertyAttribute::TRANSIENT); - - RemoveProperty(_rAggregateProps, PROPERTY_STRICTFORMAT); - // no strict format property for formatted fields: it does not make sense, 'cause - // there is no general way to decide which characters/sub strings are allowed during the input of an - // arbitraryly formatted control - // 81441 - 12/07/00 - FS - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const -{ - OEditBaseModel::getFastPropertyValue(rValue, nHandle); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw ( ::com::sun::star::uno::Exception) -{ - OEditBaseModel::setFastPropertyValue_NoBroadcast(nHandle, rValue); -} - -//------------------------------------------------------------------------------ -sal_Bool OFormattedModel::convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) - throw( IllegalArgumentException ) -{ - return OEditBaseModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::setPropertyToDefaultByHandle(sal_Int32 nHandle) -{ - if (nHandle == PROPERTY_ID_FORMATSSUPPLIER) - { // das aggregierte Model koennte auf die Idee kommen - Reference<XNumberFormatsSupplier> xSupplier = calcDefaultFormatsSupplier(); - DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::setPropertyToDefaultByHandle(FORMATSSUPPLIER) : have no aggregate !"); - if (m_xAggregateSet.is()) - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, makeAny(xSupplier)); - } - else - OEditBaseModel::setPropertyToDefaultByHandle(nHandle); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::setPropertyToDefault(const ::rtl::OUString& aPropertyName) throw( com::sun::star::beans::UnknownPropertyException, RuntimeException ) -{ - OPropertyArrayAggregationHelper& rPH = (OPropertyArrayAggregationHelper&)getInfoHelper(); - sal_Int32 nHandle = rPH.getHandleByName( aPropertyName ); - - if (nHandle == PROPERTY_ID_FORMATSSUPPLIER) - setPropertyToDefaultByHandle(PROPERTY_ID_FORMATSSUPPLIER); - else - OEditBaseModel::setPropertyToDefault(aPropertyName); -} - -//------------------------------------------------------------------------------ -Any OFormattedModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - if (nHandle == PROPERTY_ID_FORMATSSUPPLIER) - { - Reference<XNumberFormatsSupplier> xSupplier = calcDefaultFormatsSupplier(); - return makeAny(xSupplier); - } - else - return OEditBaseModel::getPropertyDefaultByHandle(nHandle); -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OFormattedModel::getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw( com::sun::star::beans::UnknownPropertyException, RuntimeException ) -{ - OPropertyArrayAggregationHelper& rPH = (OPropertyArrayAggregationHelper&)getInfoHelper(); - sal_Int32 nHandle = rPH.getHandleByName( aPropertyName ); - - if (nHandle == PROPERTY_ID_FORMATSSUPPLIER) - return getPropertyDefaultByHandle(PROPERTY_ID_FORMATSSUPPLIER); - else - return OEditBaseModel::getPropertyDefault(aPropertyName); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::_propertyChanged( const com::sun::star::beans::PropertyChangeEvent& evt ) throw(RuntimeException) -{ - Reference< XPropertySet > xSourceSet(evt.Source, UNO_QUERY); - if (xSourceSet.get() == m_xAggregateSet.get()) - { - if (evt.PropertyName.equals(PROPERTY_FORMATKEY)) - { - if (evt.NewValue.getValueType().getTypeClass() == TypeClass_LONG) - { - try - { - Reference<XNumberFormatsSupplier> xSupplier(calcFormatsSupplier()); - m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), getINT32(evt.NewValue)); - // as m_aSaveValue (which is used by _commit) is format dependent we have - // to recalc it, which is done by _onValueChanged - if (m_xColumn.is() && m_xAggregateFastSet.is()) - { - ::osl::MutexGuard aGuard(m_aMutex); // _onValueChanged expects that ... - _onValueChanged(); - } - } - catch(Exception&) - { - } - } - } - // our base class does not listen at the aggregate at the moment ... and it does not expect - // to get events from objects other than the field we're bound to. So do not call the - // base class method here. - return; - } -} - -//------------------------------------------------------------------------------ -Reference<XNumberFormatsSupplier> OFormattedModel::calcFormatsSupplier() const -{ - Reference<XNumberFormatsSupplier> xSupplier; - - DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::calcFormatsSupplier : have no aggregate !"); - // hat mein aggregiertes Model einen FormatSupplier ? - if( m_xAggregateSet.is() ) - - m_xAggregateSet->getPropertyValue(PROPERTY_FORMATSSUPPLIER) >>= xSupplier; - if (!xSupplier.is()) - // check if my parent form has a supplier - xSupplier = calcFormFormatsSupplier(); - - if (!xSupplier.is()) - xSupplier = calcDefaultFormatsSupplier(); - - DBG_ASSERT(xSupplier.is(), "OFormattedModel::calcFormatsSupplier : no supplier !"); - // jetzt sollte aber einer da sein - return xSupplier; -} - -//------------------------------------------------------------------------------ -Reference<XNumberFormatsSupplier> OFormattedModel::calcFormFormatsSupplier() const -{ - Reference<XChild> xMe; - query_interface(static_cast<XWeak*>(const_cast<OFormattedModel*>(this)), xMe); - // damit stellen wir sicher, dass wir auch fuer den Fall der Aggregation das richtige - // Objekt bekommen - DBG_ASSERT(xMe.is(), "OFormattedModel::calcFormFormatsSupplier : I should have a content interface !"); - - // jetzt durchhangeln nach oben, bis wir auf eine starform treffen (angefangen mit meinem eigenen Parent) - Reference<XChild> xParent(xMe->getParent(), UNO_QUERY); - Reference<XForm> xNextParentForm(xParent, UNO_QUERY); - while (!xNextParentForm.is() && xParent.is()) - { - xParent = xParent.query( xParent->getParent() ); - xNextParentForm = xNextParentForm.query( xParent ); - } - - if (!xNextParentForm.is()) - { - DBG_ERROR("OFormattedModel::calcFormFormatsSupplier : have no ancestor which is a form !"); - return NULL; - } - - // den FormatSupplier von meinem Vorfahren (falls der einen hat) - Reference< XRowSet > xRowSet( xNextParentForm, UNO_QUERY ); - Reference< XNumberFormatsSupplier > xSupplier; - if (xRowSet.is()) - xSupplier = getNumberFormats(getConnection(xRowSet), sal_True, m_xServiceFactory); - return xSupplier; -} - -//------------------------------------------------------------------------------ -Reference<XNumberFormatsSupplier> OFormattedModel::calcDefaultFormatsSupplier() const -{ - if ( !s_xDefaultFormatter.is() ) - { - // get the Office's UI locale - const Locale& rSysLocale = SvtSysLocale().GetLocaleData().getLocale(); - // translate - LanguageType eSysLanguage = MsLangId::convertLocaleToLanguage( rSysLocale ); - s_xDefaultFormatter = *new StandardFormatsSupplier(m_xServiceFactory,eSysLanguage); - } - return s_xDefaultFormatter; -} - -// XBoundComponent -//------------------------------------------------------------------------------ -void OFormattedModel::loaded(const EventObject& rEvent) throw ( ::com::sun::star::uno::RuntimeException) -{ - // HACK : our _loaded accesses our NumberFormatter which locks the solar mutex (as it doesn't have - // an own one). To prevent deadlocks with other threads which may request a property from us in an - // UI-triggered action (e.g. an tooltip) we lock the solar mutex _here_ before our base class locks - // it's own muext (which is used for property requests) - // alternative a): we use two mutexes, one which is passed to the OPropertysetHelper and used for - // property requests and one for our own code. This would need a lot of code rewriting - // alternative b): The NumberFormatter has to be really threadsafe (with an own mutex), which is - // the only "clean" solution for me. - // FS - 69603 - 02.11.99 - - SolarMutexGuard aGuard; - OEditBaseModel::loaded(rEvent); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::_loaded(const EventObject& rEvent) -{ - static const ::rtl::OUString s_aNullDataProp = ::rtl::OUString::createFromAscii("NullDate"); - - m_xOriginalFormatter = NULL; - - // get some properties of the field - m_nFieldType = DataType::OTHER; - Reference<XPropertySet> xField = getField(); - if ( xField.is() ) - { - xField->getPropertyValue( PROPERTY_FIELDTYPE ) >>= m_nFieldType; - } - - - DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::_loaded : have no aggregate !"); - if (m_xAggregateSet.is()) - { // all the following doesn't make any sense if we have no aggregate ... - Any aSupplier = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATSSUPPLIER); - DBG_ASSERT(((Reference<XNumberFormatsSupplier> *)aSupplier.getValue())->is(), "OFormattedModel::_loaded : invalid property value !"); - // das sollte im Constructor oder im read auf was richtiges gesetzt worden sein - - Any aFmtKey = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATKEY); - if (!aFmtKey.hasValue()) - { // unser aggregiertes Model hat noch keine Format-Informationen, also geben wir die von dem Feld, an das - // wir gebunden sind, weiter - sal_Int32 nType = DataType::VARCHAR; - if (xField.is()) - { - aFmtKey = xField->getPropertyValue(PROPERTY_FORMATKEY); - xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nType ; - } - - Reference<XNumberFormatsSupplier> xSupplier = calcFormFormatsSupplier(); - DBG_ASSERT(xSupplier.is(), "OFormattedModel::_loaded : bound to a field but no parent with a formatter ? how this ?"); - if (xSupplier.is()) - { - m_bOriginalNumeric = getBOOL(getPropertyValue(PROPERTY_TREATASNUMERIC)); - - if (!aFmtKey.hasValue()) - { // we aren't bound to a field (or this field's format is invalid) - // -> determine the standard text (or numeric) format of the supplier - Reference<XNumberFormatTypes> xTypes(xSupplier->getNumberFormats(), UNO_QUERY); - if (xTypes.is()) - { - Locale aApplicationLocale = Application::GetSettings().GetUILocale(); - - sal_Int32 nNewKey = 0; - if (m_bOriginalNumeric) - aFmtKey <<= (sal_Int32)xTypes->getStandardFormat(NumberFormat::NUMBER, aApplicationLocale); - else - aFmtKey <<= (sal_Int32)xTypes->getStandardFormat(NumberFormat::TEXT, aApplicationLocale); - } - } - - aSupplier >>= m_xOriginalFormatter; - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, makeAny(xSupplier)); - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATKEY, aFmtKey); - - // das Numeric-Flag an mein gebundenes Feld anpassen - if (xField.is()) - { - m_bNumeric = sal_False; - switch (nType) - { - case DataType::BIT: - case DataType::TINYINT: - case DataType::SMALLINT: - case DataType::INTEGER: - case DataType::BIGINT: - case DataType::FLOAT: - case DataType::REAL: - case DataType::DOUBLE: - case DataType::NUMERIC: - case DataType::DECIMAL: - case DataType::DATE: - case DataType::TIME: - case DataType::TIMESTAMP: - m_bNumeric = sal_True; - break; - } - } - else - m_bNumeric = m_bOriginalNumeric; - - setPropertyValue(PROPERTY_TREATASNUMERIC, makeAny((sal_Bool)m_bNumeric)); - - m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), getINT32(aFmtKey)); - xSupplier->getNumberFormatSettings()->getPropertyValue(s_aNullDataProp) >>= m_aNullDate; - } - } - else - { - Reference<XNumberFormatsSupplier> xSupplier = calcFormatsSupplier(); - - m_bNumeric = getBOOL(getPropertyValue(PROPERTY_TREATASNUMERIC)); - m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), getINT32(aFmtKey)); - xSupplier->getNumberFormatSettings()->getPropertyValue(s_aNullDataProp) >>= m_aNullDate; - } - } - else - { // try to get some defaults ... - Reference<XNumberFormatsSupplier> xSupplier = calcFormatsSupplier(); - - m_bNumeric = getBOOL(getPropertyValue(PROPERTY_TREATASNUMERIC)); - m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), 0); - xSupplier->getNumberFormatSettings()->getPropertyValue(s_aNullDataProp) >>= m_aNullDate; - } - - OEditBaseModel::_loaded(rEvent); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::_unloaded() -{ - OEditBaseModel::_unloaded(); - if (m_xOriginalFormatter.is()) - { // unser aggregiertes Model hatte keinerlei Format-Informationen - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, makeAny(m_xOriginalFormatter)); - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATKEY, Any()); - setPropertyValue(PROPERTY_TREATASNUMERIC, makeAny((sal_Bool)m_bOriginalNumeric)); - m_xOriginalFormatter = NULL; - } - - m_nFieldType = DataType::OTHER; - m_nKeyType = NumberFormat::UNDEFINED; - m_aNullDate = DBTypeConversion::getStandardDate(); -} - -//------------------------------------------------------------------------------ -void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OEditBaseModel::write(_rxOutStream); - _rxOutStream->writeShort(0x0003); - - DBG_ASSERT(m_xAggregateSet.is(), "OFormattedModel::write : have no aggregate !"); - - // mein Format (evtl. void) in ein persistentes Format bringen (der Supplier zusammen mit dem Key ist es zwar auch, - // aber deswegen muessen wir ja nicht gleich den ganzen Supplier speichern, das waere ein klein wenig Overhead ;) - - Reference<XNumberFormatsSupplier> xSupplier; - Any aFmtKey; - sal_Bool bVoidKey = sal_True; - if (m_xAggregateSet.is()) - { - Any aSupplier = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATSSUPPLIER); - if (aSupplier.getValueType().getTypeClass() != TypeClass_VOID) - { - DBG_ASSERT(isAReference(aSupplier, static_cast<XNumberFormatsSupplier*>(NULL)), - "OFormattedModel::write : invalid formats supplier !"); - xSupplier = *(Reference<XNumberFormatsSupplier> *)aSupplier.getValue(); - } - - aFmtKey = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATKEY); - bVoidKey = (!xSupplier.is() || !aFmtKey.hasValue()) || (m_bLoaded && m_xOriginalFormatter.is()); - // (kein Fomatter und/oder Key) oder (loaded und faked Formatter) - } - - _rxOutStream->writeBoolean(!bVoidKey); - if (!bVoidKey) - { - // aus dem FormatKey und dem Formatter persistente Angaben basteln - - Any aKey = m_xAggregateSet->getPropertyValue(PROPERTY_FORMATKEY); - sal_Int32 nKey = aKey.hasValue() ? getINT32(aKey) : 0; - - Reference<XNumberFormats> xFormats = xSupplier->getNumberFormats(); - - ::rtl::OUString sFormatDescription; - LanguageType eFormatLanguage = LANGUAGE_DONTKNOW; - - static const ::rtl::OUString s_aLocaleProp = ::rtl::OUString::createFromAscii("Locale"); - Reference<com::sun::star::beans::XPropertySet> xFormat = xFormats->getByKey(nKey); - if (hasProperty(s_aLocaleProp, xFormat)) - { - Any aLocale = xFormat->getPropertyValue(s_aLocaleProp); - DBG_ASSERT(isA(aLocale, static_cast<Locale*>(NULL)), "OFormattedModel::write : invalid language property !"); - if (isA(aLocale, static_cast<Locale*>(NULL))) - { - Locale* pLocale = (Locale*)aLocale.getValue(); - eFormatLanguage = MsLangId::convertLocaleToLanguage( *pLocale ); - } - } - - static const ::rtl::OUString s_aFormatStringProp = ::rtl::OUString::createFromAscii("FormatString"); - if (hasProperty(s_aFormatStringProp, xFormat)) - xFormat->getPropertyValue(s_aFormatStringProp) >>= sFormatDescription; - - _rxOutStream->writeUTF(sFormatDescription); - _rxOutStream->writeLong((sal_Int32)eFormatLanguage); - } - - // version 2 : write the properties common to all OEditBaseModels - writeCommonEditProperties(_rxOutStream); - - // version 3 : write the effective value property of the aggregate - // Due to a bug within the UnoControlFormattedFieldModel implementation (our default aggregate) this props value isn't correctly read - // and this can't be corrected without being incompatible. - // so we have our own handling. - - // and to be a little bit more compatible we make the following section skippable - { - Reference< XDataOutputStream > xOut(_rxOutStream, UNO_QUERY); - OStreamSection aDownCompat(xOut); - - // a sub version within the skippable block - _rxOutStream->writeShort(0x0000); - - // version 0: the effective value of the aggregate - Any aEffectiveValue; - if (m_xAggregateSet.is()) - { - try { aEffectiveValue = m_xAggregateSet->getPropertyValue(PROPERTY_EFFECTIVE_VALUE); } catch(Exception&) { } - } - - { - OStreamSection aDownCompat2(xOut); - switch (aEffectiveValue.getValueType().getTypeClass()) - { - case TypeClass_STRING: - _rxOutStream->writeShort(0x0000); - _rxOutStream->writeUTF(::comphelper::getString(aEffectiveValue)); - break; - case TypeClass_DOUBLE: - _rxOutStream->writeShort(0x0001); - _rxOutStream->writeDouble(::comphelper::getDouble(aEffectiveValue)); - break; - default: // void and all unknown states - DBG_ASSERT(!aEffectiveValue.hasValue(), "FmXFormattedModel::write : unknown property value type !"); - _rxOutStream->writeShort(0x0002); - break; - } - } - } -} - -//------------------------------------------------------------------------------ -void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OEditBaseModel::read(_rxInStream); - sal_uInt16 nVersion = _rxInStream->readShort(); - - Reference<XNumberFormatsSupplier> xSupplier; - sal_Int32 nKey = -1; - switch (nVersion) - { - case 0x0001 : - case 0x0002 : - case 0x0003 : - { - sal_Bool bNonVoidKey = _rxInStream->readBoolean(); - if (bNonVoidKey) - { - // den String und die Language lesen .... - ::rtl::OUString sFormatDescription = _rxInStream->readUTF(); - LanguageType eDescriptionLanguage = (LanguageType)_rxInStream->readLong(); - - // und daraus von einem Formatter zu einem Key zusammenwuerfeln lassen ... - xSupplier = calcFormatsSupplier(); - // calcFormatsSupplier nimmt erst den vom Model, dann einen von der starform, dann einen ganz neuen .... - Reference<XNumberFormats> xFormats = xSupplier->getNumberFormats(); - - if (xFormats.is()) - { - Locale aDescriptionLanguage( - MsLangId::convertLanguageToLocale(eDescriptionLanguage)); - - nKey = xFormats->queryKey(sFormatDescription, aDescriptionLanguage, sal_False); - if (nKey == (sal_Int32)-1) - { // noch nicht vorhanden in meinem Formatter ... - nKey = xFormats->addNew(sFormatDescription, aDescriptionLanguage); - } - } - } - if ((nVersion == 0x0002) || (nVersion == 0x0003)) - readCommonEditProperties(_rxInStream); - - if (nVersion == 0x0003) - { // since version 3 there is a "skippable" block at this position - Reference< XDataInputStream > xIn(_rxInStream, UNO_QUERY); - OStreamSection aDownCompat(xIn); - - sal_Int16 nSubVersion = _rxInStream->readShort(); - - // version 0 and higher : the "effective value" property - Any aEffectiveValue; - { - OStreamSection aDownCompat2(xIn); - switch (_rxInStream->readShort()) - { - case 0: // String - aEffectiveValue <<= _rxInStream->readUTF(); - break; - case 1: // double - aEffectiveValue <<= (double)_rxInStream->readDouble(); - break; - case 2: - break; - case 3: - DBG_ERROR("FmXFormattedModel::read : unknown effective value type !"); - } - } - - // this property is only to be set if we have no control source : in all other cases the base class did a - // reset after it's read and this set the effective value to a default value - if (m_xAggregateSet.is() && (m_aControlSource.getLength() == 0)) - { - try - { - m_xAggregateSet->setPropertyValue(PROPERTY_EFFECTIVE_VALUE, aEffectiveValue); - } - catch(Exception&) - { - } - } - } - } - break; - default : - DBG_ERROR("OFormattedModel::read : unknown version !"); - // dann bleibt das Format des aggregierten Sets, wie es bei der Erzeugung ist : void - defaultCommonEditProperties(); - break; - } - - if ((nKey != -1) && m_xAggregateSet.is()) - { - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATSSUPPLIER, makeAny(xSupplier)); - m_xAggregateSet->setPropertyValue(PROPERTY_FORMATKEY, makeAny((sal_Int32)nKey)); - } - else - { - setPropertyToDefault(PROPERTY_FORMATSSUPPLIER); - setPropertyToDefault(PROPERTY_FORMATKEY); - } -} - -//------------------------------------------------------------------------------ -sal_Int16 OFormattedModel::getPersistenceFlags() const -{ - return (OEditBaseModel::getPersistenceFlags() & ~PF_HANDLE_COMMON_PROPS); - // a) we do our own call to writeCommonEditProperties -} - -//------------------------------------------------------------------------------ -sal_Bool OFormattedModel::_commit() -{ - Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OFormattedModel::nValueHandle ); - if (!compare(aNewValue, m_aSaveValue)) - { - // Leerstring + EmptyIsNull = void - if ( !aNewValue.hasValue() - || ( (aNewValue.getValueType().getTypeClass() == TypeClass_STRING) - && (getString(aNewValue).getLength() == 0) - && m_bEmptyIsNull - ) - ) - m_xColumnUpdate->updateNull(); - else - { - // als Value koennen nur double, string oder void auftreten - try - { - if (aNewValue.getValueType().getTypeClass() == TypeClass_DOUBLE) - { - DBTypeConversion::setValue(m_xColumnUpdate, m_aNullDate, getDouble(aNewValue), m_nKeyType); - } - else - { - DBG_ASSERT(aNewValue.getValueType().getTypeClass() == TypeClass_STRING, "OFormattedModel::_commit : invalud value type !"); - m_xColumnUpdate->updateString(getString(aNewValue)); - } - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void OFormattedModel::_onValueChanged() -{ - if (m_bNumeric) - m_aSaveValue <<= DBTypeConversion::getValue(m_xColumn, m_aNullDate, m_nKeyType); // #100056# OJ - else - m_aSaveValue <<= m_xColumn->getString(); - - if (m_xColumn->wasNull()) - m_aSaveValue.clear(); - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OFormattedModel::nValueHandle, m_aSaveValue); - } -} - -// XReset -//------------------------------------------------------------------------------ -void OFormattedModel::_reset( void ) -{ - if (!m_xAggregateSet.is()) - { - DBG_ERROR("OFormattedModel::_reset : no aggregate !"); - return; - } - Any aValue = m_xAggregateSet->getPropertyValue(PROPERTY_EFFECTIVE_DEFAULT); - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OFormattedModel::nValueHandle, aValue); - } -} - -//......................................................................... -} -//......................................................................... - - - - - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_FormattedFieldWrapper.cxx b/binfilter/bf_forms/source/component/forms_FormattedFieldWrapper.cxx deleted file mode 100644 index 68cfe206606c..000000000000 --- a/binfilter/bf_forms/source/component/forms_FormattedFieldWrapper.cxx +++ /dev/null @@ -1,407 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "FormattedFieldWrapper.hxx" - -#include <com/sun/star/util/XNumberFormatter.hpp> - -#include <com/sun/star/awt/XFocusListener.hpp> -#include <com/sun/star/awt/XKeyListener.hpp> -#include <com/sun/star/form/XChangeBroadcaster.hpp> - -#include <tools/link.hxx> - -#include "Edit.hxx" -#include "FormattedField.hxx" -#include "services.hxx" -#include <connectivity/dbtools.hxx> - -#include <vcl/svapp.hxx> - -#include <com/sun/star/io/XMarkableStream.hpp> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// OFormattedFieldWrapper -//================================================================== -DBG_NAME(OFormattedFieldWrapper) -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OFormattedFieldWrapper(_rxFactory, sal_True)); -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OFormattedFieldWrapper(_rxFactory, sal_False)); -} - -//------------------------------------------------------------------ -OFormattedFieldWrapper::OFormattedFieldWrapper(const Reference<XMultiServiceFactory>& _rxFactory, sal_Bool _bActAsFormatted) - :m_pEditPart(NULL) - ,m_xServiceFactory(_rxFactory) -{ - DBG_CTOR(OFormattedFieldWrapper, NULL); - - if (_bActAsFormatted) - { - increment(m_refCount); - { - // instantiate an FormattedModel - InterfaceRef xFormattedModel; - // (instantiate it directly ..., as the OFormattedModel isn't registered for any service names anymore) - OFormattedModel* pModel = new OFormattedModel(m_xServiceFactory); - query_interface(static_cast<XWeak*>(pModel), xFormattedModel); - - m_xAggregate = Reference<XAggregation> (xFormattedModel, UNO_QUERY); - DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::OFormattedFieldWrapper : the OFormattedModel didn't have an XAggregation interface !"); - - // _before_ setting the delegator, give it to the member references - query_interface(xFormattedModel, m_xFormattedPart); - m_pEditPart = new OEditModel(m_xServiceFactory); - m_pEditPart->acquire(); - } - if (m_xAggregate.is()) - { // has to be in it's own block because of the temporary variable created by *this - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); - } - decrement(m_refCount); - } -} - -//------------------------------------------------------------------ -OFormattedFieldWrapper::OFormattedFieldWrapper( const OFormattedFieldWrapper* _pCloneSource ) - :m_xServiceFactory( _pCloneSource->m_xServiceFactory ) - ,m_pEditPart( NULL ) -{ - Reference< XCloneable > xCloneAccess; - query_aggregation( _pCloneSource->m_xAggregate, xCloneAccess ); - - // clone the aggregate - if ( xCloneAccess.is() ) - { - increment( m_refCount ); - { - Reference< XCloneable > xClone = xCloneAccess->createClone(); - m_xAggregate = Reference< XAggregation >( xClone, UNO_QUERY ); - DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::OFormattedFieldWrapper : invalid aggregate clone!"); - - query_interface( Reference< XInterface >( xClone.get() ), m_xFormattedPart ); - - if ( _pCloneSource->m_pEditPart ) - m_pEditPart = new OEditModel( _pCloneSource->m_pEditPart, _pCloneSource->m_xServiceFactory ); - } - if ( m_xAggregate.is() ) - { // has to be in it's own block because of the temporary variable created by *this - m_xAggregate->setDelegator( static_cast< XWeak* >( this ) ); - } - decrement( m_refCount ); - } - else - { // the clone source does not yet have an aggregate -> we don't yet need one, too - } -} - -//------------------------------------------------------------------ -OFormattedFieldWrapper::~OFormattedFieldWrapper() -{ - // release the aggregated object (if any) - if (m_xAggregate.is()) - m_xAggregate->setDelegator(InterfaceRef ()); - - if (m_pEditPart) - m_pEditPart->release(); - - DBG_DTOR(OFormattedFieldWrapper, NULL); -} - -//------------------------------------------------------------------ -Any SAL_CALL OFormattedFieldWrapper::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn; - - if (_rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >(NULL) ) ) ) - { // a XTypeProvider interface needs a working aggregate - we don't want to give the type provider - // of our base class (OFormattedFieldWrapper_Base) to the caller as it supplies nearly nothing - ensureAggregate(); - if (m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - - if (!aReturn.hasValue()) - { - aReturn = OFormattedFieldWrapper_Base::queryAggregation(_rType); - - if ((_rType.equals( ::getCppuType( static_cast< Reference< XServiceInfo >* >(NULL) ) ) ) && aReturn.hasValue()) - { // somebody requested an XServiceInfo interface and our base class provided it - // check our aggregate if it has one, too - ensureAggregate(); - } - - if (!aReturn.hasValue()) - { - aReturn = ::cppu::queryInterface( _rType, - static_cast< XPersistObject* >( this ), - static_cast< XCloneable* >( this ) - ); - - if (!aReturn.hasValue()) - { - // somebody requests an interface other than the basics (XInterface) and other than - // the two we can supply without an aggregate. So ensure - // the aggregate exists. - ensureAggregate(); - if (m_xAggregate.is()) - aReturn = m_xAggregate->queryAggregation(_rType); - } - } - } - - return aReturn; -} - -//------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFormattedFieldWrapper::getServiceName() throw(RuntimeException) -{ - // return the old compatibility name for an EditModel - return FRM_COMPONENT_EDIT; -} - -//------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFormattedFieldWrapper::getImplementationName( ) throw (RuntimeException) -{ - return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.OFormattedFieldWrapper"); -} - -//------------------------------------------------------------------ -sal_Bool SAL_CALL OFormattedFieldWrapper::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) -{ - DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::supportsService: should never have made it 'til here without an aggregate!"); - Reference< XServiceInfo > xSI; - m_xAggregate->queryAggregation(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) >>= xSI; - return xSI->supportsService(_rServiceName); -} - -//------------------------------------------------------------------ -Sequence< ::rtl::OUString > SAL_CALL OFormattedFieldWrapper::getSupportedServiceNames( ) throw (RuntimeException) -{ - DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::getSupportedServiceNames: should never have made it 'til here without an aggregate!"); - Reference< XServiceInfo > xSI; - m_xAggregate->queryAggregation(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) >>= xSI; - return xSI->getSupportedServiceNames(); -} - -//------------------------------------------------------------------ -void SAL_CALL OFormattedFieldWrapper::write(const Reference<XObjectOutputStream>& _rxOutStream) throw( IOException, RuntimeException ) -{ - // can't write myself - ensureAggregate(); - - // if we act as real edit field, we can simple forward this write request - if (!m_xFormattedPart.is()) - { - Reference<XPersistObject> xAggregatePersistence; - query_aggregation(m_xAggregate, xAggregatePersistence); - DBG_ASSERT(xAggregatePersistence.is(), "OFormattedFieldWrapper::write : don't know how to handle this : can't write !"); - // oops ... We gave an XPersistObject interface to the caller but now we aren't an XPersistObject ... - if (xAggregatePersistence.is()) - xAggregatePersistence->write(_rxOutStream); - return; - } - - // else we have to write an edit part first - DBG_ASSERT(m_pEditPart, "OFormattedFieldWrapper::write : formatted part without edit part ?"); - - // for this we transfer the current props of the formatted part to the edit part - Reference<XPropertySet> xFormatProps(m_xFormattedPart, UNO_QUERY); - Reference<XPropertySet> xEditProps; - query_interface(static_cast<XWeak*>(m_pEditPart), xEditProps); - - Locale aAppLanguage = Application::GetSettings().GetUILocale(); - dbtools::TransferFormComponentProperties(xFormatProps, xEditProps, aAppLanguage); - - // then write the edit part, after switching to "fake mode" - m_pEditPart->enableFormattedWriteFake(); - m_pEditPart->write(_rxOutStream); - m_pEditPart->disableFormattedWriteFake(); - - // and finally write the formatted part we're really interested in - m_xFormattedPart->write(_rxOutStream); -} - -//------------------------------------------------------------------ -void SAL_CALL OFormattedFieldWrapper::read(const Reference<XObjectInputStream>& _rxInStream) throw( IOException, RuntimeException ) -{ - if (m_xAggregate.is()) - { // we alread did a decision if we're an EditModel or a FormattedModel - - // if we act as formatted, we have to read the edit part first - if (m_xFormattedPart.is()) - { - // two possible cases: - // a) the stuff was written by a version which didn't work with an Edit header (all intermediate - // versions >5.1 && <=568) - // b) it was written by a version using edit headers - // as we can distinguish a) from b) only after we have read the edit part, we need to remember the - // position - Reference<XMarkableStream> xInMarkable(_rxInStream, UNO_QUERY); - DBG_ASSERT(xInMarkable.is(), "OFormattedFieldWrapper::read : can only work with markable streams !"); - sal_Int32 nBeforeEditPart = xInMarkable->createMark(); - - m_pEditPart->read(_rxInStream); - // this only works because an edit model can read the stuff written by a formatted model (maybe with - // some assertions) , but not vice versa - if (!m_pEditPart->lastReadWasFormattedFake()) - { // case a), written with a version without the edit part fake, so seek to the start position, again - xInMarkable->jumpToMark(nBeforeEditPart); - } - xInMarkable->deleteMark(nBeforeEditPart); - } - - Reference<XPersistObject> xAggregatePersistence; - query_aggregation(m_xAggregate, xAggregatePersistence); - DBG_ASSERT(xAggregatePersistence.is(), "OFormattedFieldWrapper::read : don't know how to handle this : can't read !"); - // oops ... We gave an XPersistObject interface to the caller but now we aren't an XPersistObject ... - - if (xAggregatePersistence.is()) - xAggregatePersistence->read(_rxInStream); - return; - } - - // we have to decide from the data within the stream whether we should be an EditModel or a FormattedModel - OEditBaseModel* pNewAggregate = NULL; - - // let an OEditModel do the reading - OEditModel* pBasicReader = new OEditModel(m_xServiceFactory); - pBasicReader->read(_rxInStream); - - // was it really an edit model ? - if (!pBasicReader->lastReadWasFormattedFake()) - // yes -> all fine - pNewAggregate = pBasicReader; - else - { // no -> substitute it with a formatted model - - // let the formmatted model do the reading - OFormattedModel* pFormattedReader = new OFormattedModel(m_xServiceFactory); - pFormattedReader->read(_rxInStream); - - // for the next write (if any) : the FormattedModel and the EditModel parts - query_interface(static_cast<XWeak*>(pFormattedReader), m_xFormattedPart); - m_pEditPart = pBasicReader; - m_pEditPart->acquire(); - - // aggregate the formatted part below - pNewAggregate = pFormattedReader; - } - - // do the aggregation - increment(m_refCount); - { - query_interface(static_cast<XWeak*>(pNewAggregate), m_xAggregate); - DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::read : the OEditModel didn't have an XAggregation interface !"); - } - if (m_xAggregate.is()) - { // has to be in it's own block because of the temporary variable created by *this - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); - } - decrement(m_refCount); -} - -//------------------------------------------------------------------ -Reference< XCloneable > SAL_CALL OFormattedFieldWrapper::createClone( ) throw (RuntimeException) -{ - ensureAggregate(); - - return new OFormattedFieldWrapper( this ); -} - -//------------------------------------------------------------------ -void OFormattedFieldWrapper::ensureAggregate() -{ - if (m_xAggregate.is()) - return; - - increment(m_refCount); - { - // instantiate an EditModel (the only place where we are allowed to decide that we're an FormattedModel - // is in ::read) - InterfaceRef xEditModel = m_xServiceFactory->createInstance(FRM_SUN_COMPONENT_TEXTFIELD); - if (!xEditModel.is()) - { - // arghhh ... instantiate it directly ... it's dirty, but we really need this aggregate - OEditModel* pModel = new OEditModel(m_xServiceFactory); - query_interface(static_cast<XWeak*>(pModel), xEditModel); - } - - m_xAggregate = Reference<XAggregation> (xEditModel, UNO_QUERY); - DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::ensureAggregate : the OEditModel didn't have an XAggregation interface !"); - - { - Reference< XServiceInfo > xSI(m_xAggregate, UNO_QUERY); - if (!xSI.is()) - { - DBG_ERROR("OFormattedFieldWrapper::ensureAggregate: the aggregate has nbo XServiceInfo!"); - m_xAggregate.clear(); - } - } - } - if (m_xAggregate.is()) - { // has to be in it's own block because of the temporary variable created by *this - m_xAggregate->setDelegator(static_cast<XWeak*>(this)); - } - decrement(m_refCount); -} - -//......................................................................... -} -//......................................................................... - - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_FormsCollection.cxx b/binfilter/bf_forms/source/component/forms_FormsCollection.cxx deleted file mode 100644 index 9a3631ad40ab..000000000000 --- a/binfilter/bf_forms/source/component/forms_FormsCollection.cxx +++ /dev/null @@ -1,166 +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. - * - ************************************************************************/ - -#include "FormsCollection.hxx" - -#include "services.hxx" - - -#include <com/sun/star/form/XForm.hpp> -#include <rtl/logfile.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::container; -//------------------------------------------------------------------ -DBG_NAME(OFormsCollection) -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OFormsCollection_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OFormsCollection(_rxFactory)); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFormsCollection::getServiceName() throw(RuntimeException) -{ - return FRM_SUN_FORMS_COLLECTION; -} - -//------------------------------------------------------------------------------ -Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId( ) throw(RuntimeException) -{ - return OImplementationIds::getImplementationId(getTypes()); -} - -//------------------------------------------------------------------------------ -Sequence<Type> SAL_CALL OFormsCollection::getTypes() throw(RuntimeException) -{ - return concatSequences(OInterfaceContainer::getTypes(), FormsCollectionComponentBase::getTypes(), OFormsCollection_BASE::getTypes()); -} - -//------------------------------------------------------------------ -OFormsCollection::OFormsCollection(const Reference<XMultiServiceFactory>& _rxFactory) - :FormsCollectionComponentBase(m_aMutex) - ,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<Reference<XForm>*>(NULL))) -{ - DBG_CTOR(OFormsCollection, NULL); -} - -//------------------------------------------------------------------------------ -OFormsCollection::~OFormsCollection() -{ - DBG_DTOR(OFormsCollection, NULL); - if (!FormsCollectionComponentBase::rBHelper.bDisposed) - { - acquire(); - dispose(); - } -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType) throw(RuntimeException) -{ - Any aReturn = OFormsCollection_BASE::queryInterface(_rType); - if (!aReturn.hasValue()) - { - aReturn = OInterfaceContainer::queryInterface(_rType); - - if (!aReturn.hasValue()) - aReturn = FormsCollectionComponentBase::queryAggregation(_rType); - } - - return aReturn; -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OFormsCollection::getImplementationName() throw(RuntimeException) -{ - return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.OFormsCollection"); -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OFormsCollection::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) -{ - Sequence<rtl::OUString> aSupported = getSupportedServiceNames(); - const rtl::OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; - return sal_False; -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aReturn(2); - - aReturn.getArray()[0] = FRM_SUN_FORMS_COLLECTION; - aReturn.getArray()[1] = ::rtl::OUString::createFromAscii("com.sun.star.form.FormComponents"); - - return aReturn; -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OFormsCollection::disposing() -{ - { - RTL_LOGFILE_CONTEXT( aLogger, "forms::OFormsCollection::disposing" ); - OInterfaceContainer::disposing(); - } - FormsCollectionComponentBase::disposing(); - m_xParent = NULL; -} - -//XChild -//------------------------------------------------------------------------------ -void OFormsCollection::setParent(const InterfaceRef& Parent) throw( NoSupportException, RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_xParent = Parent; -} - -//------------------------------------------------------------------------------ -InterfaceRef OFormsCollection::getParent() throw( RuntimeException ) -{ - return m_xParent; -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Grid.cxx b/binfilter/bf_forms/source/component/forms_Grid.cxx deleted file mode 100644 index bf98ca87471b..000000000000 --- a/binfilter/bf_forms/source/component/forms_Grid.cxx +++ /dev/null @@ -1,1367 +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. - * - ************************************************************************/ - -#include "Grid.hxx" -#include "Columns.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> -#include <com/sun/star/form/XForm.hpp> -#include <com/sun/star/awt/FontRelief.hpp> -#include <com/sun/star/awt/FontEmphasisMark.hpp> - -#include "services.hxx" -#include "property.hrc" - -#include <comphelper/container.hxx> - -#include <vcl/svapp.hxx> - -#include <toolkit/helper/vclunohelper.hxx> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -#include <com/sun/star/io/XMarkableStream.hpp> - -namespace binfilter { - -using namespace ::com::sun::star::uno; - -// TODO : find a place for this ! -namespace internal -{ -//------------------------------------------------------------------ -// Vergleichen von Strings -static int -#if defined( WNT ) - __cdecl -#endif -#if defined( ICC ) && defined( OS2 ) -_Optlink -#endif - NameCompare(const void* pFirst, const void* pSecond) -{ - return ((::rtl::OUString*)pFirst)->compareTo(*(::rtl::OUString*)pSecond); -} - -//------------------------------------------------------------------ -sal_Int32 findPos(const ::rtl::OUString& aStr, const StringSequence& rList) -{ - const ::rtl::OUString* pStrList = rList.getConstArray(); - ::rtl::OUString* pResult = (::rtl::OUString*) bsearch(&aStr, (void*)pStrList, rList.getLength(), sizeof(::rtl::OUString), - &NameCompare); - - if (pResult) - return (pResult - pStrList); - else - return -1; -} - -} // namespace internal - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::view; - -const sal_uInt16 ROWHEIGHT = 0x0001; -const sal_uInt16 FONTTYPE = 0x0002; -const sal_uInt16 FONTSIZE = 0x0004; -const sal_uInt16 FONTATTRIBS = 0x0008; -const sal_uInt16 TABSTOP = 0x0010; -const sal_uInt16 TEXTCOLOR = 0x0020; -const sal_uInt16 FONTDESCRIPTOR = 0x0040; -const sal_uInt16 RECORDMARKER = 0x0080; -const sal_uInt16 BACKGROUNDCOLOR = 0x0100; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OGridControlModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OGridControlModel(_rxFactory)); -} - -DBG_NAME(OGridControlModel) -//------------------------------------------------------------------ -OGridControlModel::OGridControlModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OControlModel(_rxFactory, ::rtl::OUString()) - ,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<Reference<XPropertySet>*>(NULL))) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aSelectListeners(m_aMutex) - ,m_aResetListeners(m_aMutex) - ,m_aDefaultControl(FRM_CONTROL_GRID) // use the old control name for compytibility reasons - ,m_nFontEvent(0) - ,m_bEnable(sal_True) - ,m_bNavigation(sal_True) - ,m_nBorder(1) - ,m_bRecordMarker(sal_True) - ,m_bPrintable(sal_True) - ,m_bAlwaysShowCursor(sal_False) - ,m_bDisplaySynchron(sal_True) - ,m_nFontRelief(awt::FontRelief::NONE) - ,m_nFontEmphasis(awt::FontEmphasisMark::NONE) -{ - DBG_CTOR(OGridControlModel,NULL); - - m_nClassId = FormComponentType::GRIDCONTROL; -} - -//------------------------------------------------------------------ -OGridControlModel::OGridControlModel( const OGridControlModel* _pOriginal, const Reference< XMultiServiceFactory >& _rxFactory ) - :OControlModel( _pOriginal, _rxFactory ) - ,OInterfaceContainer( _rxFactory, m_aMutex, ::getCppuType( static_cast<Reference<XPropertySet>*>( NULL ) ) ) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aSelectListeners( m_aMutex ) - ,m_aResetListeners( m_aMutex ) -{ - DBG_CTOR(OGridControlModel,NULL); - - m_aDefaultControl = _pOriginal->m_aDefaultControl; - m_nFontEvent = _pOriginal->m_nFontEvent; - m_bEnable = _pOriginal->m_bEnable; - m_bNavigation = _pOriginal->m_bNavigation; - m_nBorder = _pOriginal->m_nBorder; - m_bRecordMarker = _pOriginal->m_bRecordMarker; - m_bPrintable = _pOriginal->m_bPrintable; - m_bAlwaysShowCursor = _pOriginal->m_bAlwaysShowCursor; - m_bDisplaySynchron = _pOriginal->m_bDisplaySynchron; - m_nFontRelief = _pOriginal->m_nFontRelief; - m_nFontEmphasis = _pOriginal->m_nFontEmphasis; - - // clone the columns - cloneColumns( _pOriginal ); - - // TODO: clone the events? -} - -//------------------------------------------------------------------ -OGridControlModel::~OGridControlModel() -{ - if (m_nFontEvent) - Application::RemoveUserEvent(m_nFontEvent); - - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR(OGridControlModel,NULL); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OGridControlModel ) - -//------------------------------------------------------------------------------ -void OGridControlModel::cloneColumns( const OGridControlModel* _pOriginalContainer ) -{ - try - { - Reference< XCloneable > xColCloneable; - - const OInterfaceArray::const_iterator pColumnStart = m_aItems.begin(); - const OInterfaceArray::const_iterator pColumnEnd = m_aItems.end(); - for ( OInterfaceArray::const_iterator pColumn = pColumnStart; pColumn != pColumnEnd; ++pColumn ) - { - // ask the col for a factory for the clone - xColCloneable = xColCloneable.query( *pColumn ); - DBG_ASSERT( xColCloneable.is(), "OGridControlModel::cloneColumns: column is not cloneable!" ); - - if ( xColCloneable.is() ) - { - // create a clone of the column - Reference< XCloneable > xColClone( xColCloneable->createClone() ); - DBG_ASSERT( xColClone.is(), "OGridControlModel::cloneColumns: invalid column clone!" ); - - if ( xColClone.is() ) - { - // insert this clone into our own container - insertByIndex( pColumn - pColumnStart, xColClone->queryInterface( m_aElementType ) ); - } - - } - } - } - catch( const Exception& ) - { - DBG_ERROR( "OGridControlModel::cloneColumns: caught an exception while cloning the columns!" ); - } -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OGridControlModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlModel")); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GRIDCONTROL; - return aSupported; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType ) throw (RuntimeException) -{ - Any aReturn = OGridControlModel_BASE::queryInterface(_rType); - - if ( !aReturn.hasValue() ) - { - aReturn = OControlModel::queryAggregation( _rType ); - if ( !aReturn.hasValue() ) - { - aReturn = OInterfaceContainer::queryInterface( _rType ); - if ( !aReturn.hasValue() ) - aReturn = OErrorBroadcaster::queryInterface( _rType ); - } - } - return aReturn; -} - -// XSQLErrorListener -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::errorOccured( const SQLErrorEvent& _rEvent ) throw (RuntimeException) -{ - // forward the errors which happened to my columns to my own listeners - onError( _rEvent ); -} - -// XChild -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::setParent(const InterfaceRef& Parent) throw(NoSupportException, RuntimeException) -{ - if (m_xParentFormLoadable.is()) - m_xParentFormLoadable->removeLoadListener(this); - - OControlModel::setParent(Parent); - - Reference< XForm > xForm(m_xParent, UNO_QUERY); - m_xParentFormLoadable = Reference< XLoadable > (xForm, UNO_QUERY); - if (m_xParentFormLoadable.is()) - m_xParentFormLoadable->addLoadListener(this); -} -//------------------------------------------------------------------------------ -Sequence< Type > SAL_CALL OGridControlModel::getTypes( ) throw(RuntimeException) -{ - return concatSequences( - concatSequences( - OControlModel::getTypes(), - OInterfaceContainer::getTypes(), - OErrorBroadcaster::getTypes() - ), - OGridControlModel_BASE::getTypes() - ); -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OGridControlModel::disposing() -{ - OControlModel::disposing(); - OErrorBroadcaster::disposing(); - OInterfaceContainer::disposing(); - - EventObject aEvt(static_cast<XWeak*>(this)); - m_aSelectListeners.disposeAndClear(aEvt); - m_aResetListeners.disposeAndClear(aEvt); -} - -// XEventListener -//------------------------------------------------------------------------------ -void OGridControlModel::disposing(const EventObject& _rEvent) throw( RuntimeException ) -{ - OControlModel::disposing( _rEvent ); - OInterfaceContainer::disposing( _rEvent ); -} - -// XSelectionSupplier -//----------------------------------------------------------------------------- -sal_Bool SAL_CALL OGridControlModel::select(const Any& rElement) throw(IllegalArgumentException, RuntimeException) -{ - Reference<XPropertySet> xSel; - if (rElement.hasValue() && !::cppu::extractInterface(xSel, rElement)) - { - throw IllegalArgumentException(); - } - InterfaceRef xMe = static_cast<XWeak*>(this); - - if (xSel.is()) - { - Reference<XChild> xAsChild(xSel, UNO_QUERY); - if (!xAsChild.is() || (xAsChild->getParent() != xMe)) - { - throw IllegalArgumentException(); - } - } - - if (xSel != m_xSelection) - { - m_xSelection = xSel; - EventObject aEvt(xMe); - m_aSelectListeners.notifyEach( - &XSelectionChangeListener::selectionChanged, aEvt); - return sal_True; - } - return sal_False; -} - -//----------------------------------------------------------------------------- -Any SAL_CALL OGridControlModel::getSelection() throw(RuntimeException) -{ - return makeAny(m_xSelection); -} - -//----------------------------------------------------------------------------- -void OGridControlModel::addSelectionChangeListener(const Reference< XSelectionChangeListener >& _rxListener) throw( RuntimeException ) -{ - m_aSelectListeners.addInterface(_rxListener); -} - -//----------------------------------------------------------------------------- -void OGridControlModel::removeSelectionChangeListener(const Reference< XSelectionChangeListener >& _rxListener) throw( RuntimeException ) -{ - m_aSelectListeners.removeInterface(_rxListener); -} - -// XGridColumnFactory -//------------------------------------------------------------------------------ -Reference<XPropertySet> SAL_CALL OGridControlModel::createColumn(const ::rtl::OUString& ColumnType) throw ( :: com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) -{ - const Sequence< ::rtl::OUString >& rColumnTypes = frm::getColumnTypes(); - return createColumn(::binfilter::internal::findPos(ColumnType, rColumnTypes));//STRIP008 return createColumn(::internal::findPos(ColumnType, rColumnTypes)); -} - -//------------------------------------------------------------------------------ -Reference<XPropertySet> OGridControlModel::createColumn(sal_Int32 nTypeId) const -{ - Reference<XPropertySet> xReturn; - switch (nTypeId) - { - case TYPE_CHECKBOX: xReturn = new CheckBoxColumn(OControlModel::m_xServiceFactory); break; - case TYPE_COMBOBOX: xReturn = new ComboBoxColumn(OControlModel::m_xServiceFactory); break; - case TYPE_CURRENCYFIELD: xReturn = new CurrencyFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_DATEFIELD: xReturn = new DateFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_LISTBOX: xReturn = new ListBoxColumn(OControlModel::m_xServiceFactory); break; - case TYPE_NUMERICFIELD: xReturn = new NumericFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_PATTERNFIELD: xReturn = new PatternFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_TEXTFIELD: xReturn = new TextFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_TIMEFIELD: xReturn = new TimeFieldColumn(OControlModel::m_xServiceFactory); break; - case TYPE_FORMATTEDFIELD: xReturn = new FormattedFieldColumn(OControlModel::m_xServiceFactory); break; - default: - DBG_ERROR("OGridControlModel::createColumn: Unknown Column"); - break; - } - return xReturn; -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OGridControlModel::getColumnTypes() throw ( ::com::sun::star::uno::RuntimeException) -{ - return frm::getColumnTypes(); -} - -// XReset -//----------------------------------------------------------------------------- -void SAL_CALL OGridControlModel::reset() throw ( ::com::sun::star::uno::RuntimeException) -{ - ::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners); - EventObject aEvt(static_cast<XWeak*>(this)); - sal_Bool bContinue = sal_True; - while (aIter.hasMoreElements() && bContinue) - bContinue =((XResetListener*)aIter.next())->approveReset(aEvt); - - if (bContinue) - { - _reset(); - m_aResetListeners.notifyEach(&XResetListener::resetted, aEvt); - } -} - -//----------------------------------------------------------------------------- -void SAL_CALL OGridControlModel::addResetListener(const Reference<XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException) -{ - m_aResetListeners.addInterface(_rxListener); -} - -//----------------------------------------------------------------------------- -void SAL_CALL OGridControlModel::removeResetListener(const Reference<XResetListener>& _rxListener) throw ( ::com::sun::star::uno::RuntimeException) -{ - m_aResetListeners.removeInterface(_rxListener); -} - -//----------------------------------------------------------------------------- -void OGridControlModel::_reset() -{ - Reference<XReset> xReset; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex( nIndex ) >>= xReset; - if (xReset.is()) - xReset->reset(); - } -} - -// XPropertySet -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OGridControlModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OGridControlModel::getInfoHelper() -{ - return *const_cast<OGridControlModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OGridControlModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - BEGIN_AGGREGATION_PROPERTY_HELPER(33, m_xAggregateSet) - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP3(TABSTOP, sal_Bool, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP2(HASNAVIGATION, sal_Bool, BOUND, MAYBEDEFAULT); - DECL_PROP1(ENABLED, sal_Bool, BOUND); - DECL_PROP1(BORDER, sal_Int16, BOUND); - DECL_PROP1(DEFAULTCONTROL, ::rtl::OUString, BOUND); - DECL_PROP3(TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP3(BACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP2(FONT, FontDescriptor, BOUND, MAYBEDEFAULT); - DECL_PROP3(ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND); - DECL_PROP1(FONT_NAME, ::rtl::OUString, MAYBEDEFAULT); - DECL_PROP1(FONT_STYLENAME, ::rtl::OUString, MAYBEDEFAULT); - DECL_PROP1(FONT_FAMILY, sal_Int16, MAYBEDEFAULT); - DECL_PROP1(FONT_CHARSET, sal_Int16, MAYBEDEFAULT); - DECL_PROP1(FONT_HEIGHT, float, MAYBEDEFAULT); - DECL_PROP1(FONT_WEIGHT, float, MAYBEDEFAULT); - DECL_PROP1(FONT_SLANT, sal_Int16, MAYBEDEFAULT); - DECL_PROP1(FONT_UNDERLINE, sal_Int16, MAYBEDEFAULT); - DECL_BOOL_PROP1(FONT_WORDLINEMODE, MAYBEDEFAULT); - DECL_PROP3(TEXTLINECOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP2(FONTEMPHASISMARK, sal_Int16, BOUND, MAYBEDEFAULT); - DECL_PROP2(FONTRELIEF, sal_Int16, BOUND, MAYBEDEFAULT); - DECL_PROP1(FONT_STRIKEOUT, sal_Int16, MAYBEDEFAULT); - DECL_PROP2(RECORDMARKER, sal_Bool, BOUND, MAYBEDEFAULT ); - DECL_PROP2(PRINTABLE, sal_Bool, BOUND, MAYBEDEFAULT ); - DECL_PROP4(CURSORCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID , TRANSIENT); - DECL_PROP3(ALWAYSSHOWCURSOR, sal_Bool, BOUND, MAYBEDEFAULT, TRANSIENT); - DECL_PROP3(DISPLAYSYNCHRON, sal_Bool, BOUND, MAYBEDEFAULT, TRANSIENT); - DECL_PROP2(HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT); - END_AGGREGATION_PROPERTY_HELPER(); -} - -//------------------------------------------------------------------------------ -void OGridControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_TEXTLINECOLOR: - rValue = m_aTextLineColor; - break; - case PROPERTY_ID_FONTEMPHASISMARK: - rValue <<= m_nFontEmphasis; - break; - case PROPERTY_ID_FONTRELIEF: - rValue <<= m_nFontRelief; - break; - case PROPERTY_ID_HELPTEXT: - rValue <<= m_sHelpText; - break; - case PROPERTY_ID_HELPURL: - rValue <<= m_sHelpURL; - break; - case PROPERTY_ID_DISPLAYSYNCHRON: - setBOOL(rValue, m_bDisplaySynchron); - break; - case PROPERTY_ID_ALWAYSSHOWCURSOR: - setBOOL(rValue, m_bAlwaysShowCursor); - break; - case PROPERTY_ID_CURSORCOLOR: - rValue = m_aCursorColor; - break; - case PROPERTY_ID_PRINTABLE: - setBOOL(rValue, m_bPrintable); - break; - case PROPERTY_ID_TABSTOP: - rValue = m_aTabStop; - break; - case PROPERTY_ID_HASNAVIGATION: - setBOOL(rValue, m_bNavigation); - break; - case PROPERTY_ID_RECORDMARKER: - setBOOL(rValue, m_bRecordMarker); - break; - case PROPERTY_ID_ENABLED: - setBOOL(rValue, m_bEnable); - break; - case PROPERTY_ID_BORDER: - rValue <<= (sal_Int16)m_nBorder; - break; - case PROPERTY_ID_DEFAULTCONTROL: - rValue <<= m_aDefaultControl; - break; - case PROPERTY_ID_TEXTCOLOR: - rValue = m_aTextColor; - break; - case PROPERTY_ID_BACKGROUNDCOLOR: - rValue = m_aBackgroundColor; - break; - case PROPERTY_ID_FONT: - rValue = makeAny(m_aFont); - break; - case PROPERTY_ID_ROWHEIGHT: - rValue = m_aRowHeight; - break; - case PROPERTY_ID_FONT_NAME: - rValue <<= m_aFont.Name; - break; - case PROPERTY_ID_FONT_STYLENAME: - rValue <<= m_aFont.StyleName; - break; - case PROPERTY_ID_FONT_FAMILY: - rValue <<= (sal_Int16)m_aFont.Family; - break; - case PROPERTY_ID_FONT_CHARSET: - rValue <<= (sal_Int16)m_aFont.CharSet; - break; - case PROPERTY_ID_FONT_HEIGHT: - rValue <<= (float)(m_aFont.Height); - break; - case PROPERTY_ID_FONT_WEIGHT: - rValue <<= (float)m_aFont.Weight; - break; - case PROPERTY_ID_FONT_SLANT: - rValue = makeAny(m_aFont.Slant); - break; - case PROPERTY_ID_FONT_UNDERLINE: - rValue <<= (sal_Int16)m_aFont.Underline; - break; - case PROPERTY_ID_FONT_STRIKEOUT: - rValue <<= (sal_Int16)m_aFont.Strikeout; - break; - case PROPERTY_ID_FONT_WORDLINEMODE: - rValue = ::cppu::bool2any(m_aFont.WordLineMode); - break; - default: - OControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OGridControlModel::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue, - sal_Int32 nHandle, const Any& rValue )throw( IllegalArgumentException ) -{ - sal_Bool bModified(sal_False); - switch (nHandle) - { - case PROPERTY_ID_TEXTLINECOLOR: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTextLineColor, ::getCppuType((const sal_Int32*)NULL)); - break; - case PROPERTY_ID_FONTEMPHASISMARK: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nFontEmphasis); - break; - case PROPERTY_ID_FONTRELIEF: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nFontRelief); - break; - case PROPERTY_ID_HELPTEXT: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sHelpText); - break; - case PROPERTY_ID_HELPURL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sHelpURL); - break; - case PROPERTY_ID_DISPLAYSYNCHRON: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bDisplaySynchron); - break; - case PROPERTY_ID_ALWAYSSHOWCURSOR: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAlwaysShowCursor); - break; - case PROPERTY_ID_CURSORCOLOR: - if (!rValue.hasValue() || !m_aCursorColor.hasValue()) - { - if (rValue.hasValue() && (TypeClass_LONG != rValue.getValueType().getTypeClass())) - { - throw IllegalArgumentException(); - } - rOldValue = m_aCursorColor; - rConvertedValue = rValue; - bModified = (rOldValue.getValue() != rConvertedValue.getValue()); - } - else - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getINT32(m_aCursorColor)); - break; - case PROPERTY_ID_PRINTABLE: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bPrintable); - break; - case PROPERTY_ID_TABSTOP: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTabStop, ::getBooleanCppuType()); - break; - case PROPERTY_ID_HASNAVIGATION: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bNavigation); - break; - case PROPERTY_ID_RECORDMARKER: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bRecordMarker); - break; - case PROPERTY_ID_ENABLED: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEnable); - break; - case PROPERTY_ID_BORDER: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nBorder); - break; - case PROPERTY_ID_DEFAULTCONTROL: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultControl); - break; - case PROPERTY_ID_TEXTCOLOR: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTextColor, ::getCppuType((const sal_Int32*)NULL)); - break; - case PROPERTY_ID_BACKGROUNDCOLOR: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aBackgroundColor, ::getCppuType((const sal_Int32*)NULL)); - break; - case PROPERTY_ID_FONT: - { - com::sun::star::uno::Any aAny(makeAny(m_aFont)); - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, aAny, ::getCppuType((const FontDescriptor*)NULL)); - } - break; - case PROPERTY_ID_ROWHEIGHT: - { - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aRowHeight, ::getCppuType((const sal_Int32*)NULL)); - - sal_Int32 nNewVal( 0 ); - if ( ( rConvertedValue >>= nNewVal ) && ( nNewVal <= 0 ) ) - { - rConvertedValue.clear(); - bModified = m_aRowHeight.hasValue(); - } - } - break; - case PROPERTY_ID_FONT_NAME: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.Name); - break; - case PROPERTY_ID_FONT_STYLENAME: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.StyleName); - break; - case PROPERTY_ID_FONT_FAMILY: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.Family); - break; - case PROPERTY_ID_FONT_CHARSET: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.CharSet); - break; - case PROPERTY_ID_FONT_HEIGHT: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, float(m_aFont.Height)); - break; - case PROPERTY_ID_FONT_WEIGHT: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.Weight); - break; - case PROPERTY_ID_FONT_SLANT: - bModified = tryPropertyValueEnum(rConvertedValue, rOldValue, rValue, m_aFont.Slant); - break; - case PROPERTY_ID_FONT_UNDERLINE: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.Underline); - break; - case PROPERTY_ID_FONT_STRIKEOUT: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.Strikeout); - break; - case PROPERTY_ID_FONT_WORDLINEMODE: - bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Bool)m_aFont.WordLineMode); - break; - default: - bModified = OControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue); - } - return bModified; -} - -//------------------------------------------------------------------------------ -void OGridControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw ( ::com::sun::star::uno::Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_TEXTLINECOLOR: - m_aTextLineColor = rValue; - break; - case PROPERTY_ID_FONTEMPHASISMARK: - rValue >>= m_nFontEmphasis; - break; - case PROPERTY_ID_FONTRELIEF: - rValue >>= m_nFontRelief; - break; - case PROPERTY_ID_HELPTEXT: - rValue >>= m_sHelpText; - break; - case PROPERTY_ID_HELPURL: - rValue >>= m_sHelpURL; - break; - case PROPERTY_ID_DISPLAYSYNCHRON: - m_bDisplaySynchron = getBOOL(rValue); - break; - case PROPERTY_ID_ALWAYSSHOWCURSOR: - m_bAlwaysShowCursor = getBOOL(rValue); - break; - case PROPERTY_ID_CURSORCOLOR: - m_aCursorColor = rValue; - break; - case PROPERTY_ID_PRINTABLE: - m_bPrintable = getBOOL(rValue); - break; - case PROPERTY_ID_TABSTOP: - m_aTabStop = rValue; - break; - case PROPERTY_ID_HASNAVIGATION: - m_bNavigation = getBOOL(rValue); - break; - case PROPERTY_ID_ENABLED: - m_bEnable = getBOOL(rValue); - break; - case PROPERTY_ID_RECORDMARKER: - m_bRecordMarker = getBOOL(rValue); - break; - case PROPERTY_ID_BORDER: - rValue >>= m_nBorder; - break; - case PROPERTY_ID_DEFAULTCONTROL: - rValue >>= m_aDefaultControl; - break; - case PROPERTY_ID_TEXTCOLOR: - m_aTextColor = rValue; - break; - case PROPERTY_ID_BACKGROUNDCOLOR: - m_aBackgroundColor = rValue; - break; - case PROPERTY_ID_FONT: - rValue >>= m_aFont; - break; - case PROPERTY_ID_FONT_NAME: - rValue >>= m_aFont.Name; - break; - case PROPERTY_ID_FONT_STYLENAME: - rValue >>= m_aFont.StyleName; - break; - case PROPERTY_ID_FONT_FAMILY: - m_aFont.Family = getINT16(rValue); - break; - case PROPERTY_ID_FONT_CHARSET: - m_aFont.CharSet = getINT16(rValue); - break; - case PROPERTY_ID_FONT_HEIGHT: - m_aFont.Height = sal_Int16(getFloat(rValue)); - break; - case PROPERTY_ID_FONT_WEIGHT: - rValue >>= m_aFont.Weight; - break; - case PROPERTY_ID_FONT_SLANT: - rValue >>= m_aFont.Slant; - break; - case PROPERTY_ID_FONT_UNDERLINE: - m_aFont.Underline = getINT16(rValue); - break; - case PROPERTY_ID_FONT_STRIKEOUT: - m_aFont.Strikeout = getINT16(rValue); - break; - case PROPERTY_ID_FONT_WORDLINEMODE: - m_aFont.WordLineMode = getBOOL(rValue); - break; - case PROPERTY_ID_ROWHEIGHT: - m_aRowHeight = rValue; - break; - default: - OControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue ); - } - - switch (nHandle) - { - case PROPERTY_ID_FONT: - if (m_nFontEvent) - { - Application::RemoveUserEvent(m_nFontEvent); - m_nFontEvent = 0; - } - break; - case PROPERTY_ID_FONT_NAME: - case PROPERTY_ID_FONT_STYLENAME: - case PROPERTY_ID_FONT_FAMILY: - case PROPERTY_ID_FONT_CHARSET: - case PROPERTY_ID_FONT_HEIGHT: - case PROPERTY_ID_FONT_WEIGHT: - case PROPERTY_ID_FONT_SLANT: - case PROPERTY_ID_FONT_UNDERLINE: - case PROPERTY_ID_FONT_STRIKEOUT: - case PROPERTY_ID_FONT_WORDLINEMODE: - if (m_nFontEvent) - Application::RemoveUserEvent(m_nFontEvent); - m_nFontEvent = Application::PostUserEvent( LINK(this, OGridControlModel, OnFontChanged) ); - break; - } -} - -//------------------------------------------------------------------------------ -IMPL_LINK( OGridControlModel, OnFontChanged, void*, EMPTYARG ) -{ - Any aOldVal; aOldVal <<= m_aOldFont; - Any aNewVal; aNewVal <<= m_aFont; - { - ::osl::MutexGuard aGuard(m_aMutex); - m_nFontEvent = 0; - m_aOldFont = m_aFont; - } - firePropertyChange(PROPERTY_ID_FONT, aNewVal, aOldVal); - return 1; -} - -//XPropertyState - -//------------------------------------------------------------------------------ -Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - Any aReturn; - switch (nHandle) - { - case PROPERTY_ID_FONT: - aReturn <<= ::comphelper::getDefaultFont(); - break; - - case PROPERTY_ID_DEFAULTCONTROL: - aReturn <<= ::rtl::OUString( FRM_CONTROL_GRID ); - break; - - case PROPERTY_ID_FONTEMPHASISMARK: - aReturn <<= awt::FontEmphasisMark::NONE; - break; - - case PROPERTY_ID_FONTRELIEF: - aReturn <<= awt::FontRelief::NONE; - break; - - case PROPERTY_ID_PRINTABLE: - case PROPERTY_ID_HASNAVIGATION: - case PROPERTY_ID_RECORDMARKER: - case PROPERTY_ID_DISPLAYSYNCHRON: - case PROPERTY_ID_ENABLED: - aReturn = makeBoolAny(sal_True); - break; - - case PROPERTY_ID_ALWAYSSHOWCURSOR: - case PROPERTY_ID_FONT_WORDLINEMODE: - aReturn = makeBoolAny(sal_False); - break; - - case PROPERTY_ID_HELPURL: - case PROPERTY_ID_HELPTEXT: - case PROPERTY_ID_FONT_NAME: - case PROPERTY_ID_FONT_STYLENAME: - aReturn <<= ::rtl::OUString(); - break; - - case PROPERTY_ID_BORDER: - case PROPERTY_ID_FONT_FAMILY: - case PROPERTY_ID_FONT_CHARSET: - case PROPERTY_ID_FONT_SLANT: - case PROPERTY_ID_FONT_UNDERLINE: - case PROPERTY_ID_FONT_STRIKEOUT: - aReturn <<= (sal_Int16)1; - break; - - case PROPERTY_ID_FONT_HEIGHT: - case PROPERTY_ID_FONT_WEIGHT: - aReturn <<= (float)0; - break; - - case PROPERTY_ID_TABSTOP: - case PROPERTY_ID_TEXTCOLOR: - case PROPERTY_ID_BACKGROUNDCOLOR: - case PROPERTY_ID_ROWHEIGHT: - case PROPERTY_ID_CURSORCOLOR: - case PROPERTY_ID_TEXTLINECOLOR: - // void - break; - - default: - aReturn = OControlModel::getPropertyDefaultByHandle(nHandle); - } - return aReturn; -} - -// XLoadListener -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::loaded(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; ++nIndex) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->loaded(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::unloaded(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->unloaded(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::reloading(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->reloading(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::unloading(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->unloading(rEvent); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGridControlModel::reloaded(const EventObject& rEvent) throw(RuntimeException) -{ - Reference<XLoadListener> xListener; - sal_Int32 nCount = getCount(); - for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++) - { - getByIndex(nIndex) >>= xListener; - if (xListener.is()) - xListener->reloaded(rEvent); - } -} - -//------------------------------------------------------------------------------ -OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxIFace) const -{ - OGridColumn* pImplementation = NULL; - Reference< XUnoTunnel > xUnoTunnel( _rxIFace, UNO_QUERY ); - if ( xUnoTunnel.is() ) - pImplementation = reinterpret_cast<OGridColumn*>(xUnoTunnel->getSomething(OGridColumn::getUnoTunnelImplementationId())); - - return pImplementation; -} - -//------------------------------------------------------------------------------ -void OGridControlModel::gotColumn(const Reference< XInterface >& _rxColumn) -{ - // if our form is already loaded, tell the column - // 18.05.2001 - 86558 - frank.schoenheit@germany.sun.com - if (m_xParentFormLoadable.is() && m_xParentFormLoadable->isLoaded()) - { - Reference< XLoadListener > xColumnLoadListener(_rxColumn, UNO_QUERY); - if (xColumnLoadListener.is()) - { // it's kind of a fake ... - EventObject aFakedLoadEvent; - aFakedLoadEvent.Source = m_xParentFormLoadable; - xColumnLoadListener->loaded(aFakedLoadEvent); - } - } -} - -//------------------------------------------------------------------------------ -void OGridControlModel::lostColumn(const Reference< XInterface >& _rxColumn) -{ - if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxColumn, UNO_QUERY).get()) - { // the currently selected element was replaced - m_xSelection.clear(); - EventObject aEvt(static_cast<XWeak*>(this)); - m_aSelectListeners.notifyEach( - &XSelectionChangeListener::selectionChanged, aEvt); - } -} - -//------------------------------------------------------------------------------ -void OGridControlModel::implRemoved(const InterfaceRef& _rxObject) -{ - OInterfaceContainer::implRemoved(_rxObject); - - Reference< XSQLErrorBroadcaster > xBroadcaster( _rxObject, UNO_QUERY ); - if ( xBroadcaster.is() ) - xBroadcaster->removeSQLErrorListener( this ); - - lostColumn(_rxObject); -} - -//------------------------------------------------------------------------------ -void OGridControlModel::implInserted( const ElementDescription* _pElement ) -{ - OInterfaceContainer::implInserted( _pElement ); - - Reference< XSQLErrorBroadcaster > xBroadcaster( _pElement->xInterface, UNO_QUERY ); - if ( xBroadcaster.is() ) - xBroadcaster->addSQLErrorListener( this ); - - gotColumn( _pElement->xInterface ); -} - -//------------------------------------------------------------------------------ -void OGridControlModel::implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement ) -{ - OInterfaceContainer::implReplaced( _rxReplacedObject, _pElement ); - lostColumn( _rxReplacedObject ); - gotColumn( _pElement->xInterface ); -} - -//------------------------------------------------------------------------------ -ElementDescription* OGridControlModel::createElementMetaData( ) -{ - return new ColumnDescription; -} - -//------------------------------------------------------------------------------ -void OGridControlModel::approveNewElement( const Reference< XPropertySet >& _rxObject, ElementDescription* _pElement ) -{ - OGridColumn* pCol = getColumnImplementation( _rxObject ); - if ( !pCol ) - throw IllegalArgumentException(); - - OInterfaceContainer::approveNewElement( _rxObject, _pElement ); - - // if we're here, the object passed all tests - if ( _pElement ) - static_cast< ColumnDescription* >( _pElement )->pColumn = pCol; -} - -// XPersistObject -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OGridControlModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_GRID; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void OGridControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OControlModel::write(_rxOutStream); - - Reference<XMarkableStream> xMark(_rxOutStream, UNO_QUERY); - - // 1. Version - _rxOutStream->writeShort(0x0008); - - // 2. Columns - sal_Int32 nLen = getCount(); - _rxOutStream->writeLong(nLen); - OGridColumn* pCol; - for (sal_Int32 i = 0; i < nLen; i++) - { - // zuerst den Servicenamen fuer das darunterliegende Model - pCol = getColumnImplementation(m_aItems[i]); - DBG_ASSERT(pCol != NULL, "OGridControlModel::write : such items should never reach it into my container !"); - - _rxOutStream << pCol->getModelName(); - - // dann das Object selbst - sal_Int32 nMark = xMark->createMark(); - sal_Int32 nObjLen = 0; - _rxOutStream->writeLong(nObjLen); - - // schreiben der Col - pCol->write(_rxOutStream); - - // feststellen der Laenge - nObjLen = xMark->offsetToMark(nMark) - 4; - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nObjLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); - } - - // 3. Events - writeEvents(_rxOutStream); - - // 4. Attribute - // Maskierung fuer alle any Typen - sal_uInt16 nAnyMask = 0; - if (m_aRowHeight.getValueType().getTypeClass() == TypeClass_LONG) - nAnyMask |= ROWHEIGHT; - if (!(m_aFont == getDefaultFont())) // have no !=, only a == - nAnyMask |= FONTATTRIBS | FONTSIZE | FONTTYPE | FONTDESCRIPTOR; - if (m_aTabStop.getValueType().getTypeClass() == TypeClass_BOOLEAN) - nAnyMask |= TABSTOP; - if (m_aTextColor.getValueType().getTypeClass() == TypeClass_LONG) - nAnyMask |= TEXTCOLOR; - if (m_aBackgroundColor.getValueType().getTypeClass() == TypeClass_LONG) - nAnyMask |= BACKGROUNDCOLOR; - if (!m_bRecordMarker) - nAnyMask |= RECORDMARKER; - - _rxOutStream->writeShort(nAnyMask); - - if (nAnyMask & ROWHEIGHT) - _rxOutStream->writeLong(getINT32(m_aRowHeight)); - - // alte Structuren - if (nAnyMask & FONTDESCRIPTOR) - { - // Attrib - _rxOutStream->writeShort( VCLUnoHelper::ConvertFontWeight( m_aFont.Weight ) ); - _rxOutStream->writeShort( m_aFont.Slant ); - _rxOutStream->writeShort( m_aFont.Underline ); - _rxOutStream->writeShort( m_aFont.Strikeout ); - _rxOutStream->writeShort( sal_Int16(m_aFont.Orientation * 10) ); - _rxOutStream->writeBoolean( m_aFont.Kerning ); - _rxOutStream->writeBoolean( m_aFont.WordLineMode ); - - // Size - _rxOutStream->writeLong( m_aFont.Width ); - _rxOutStream->writeLong( m_aFont.Height ); - _rxOutStream->writeShort( VCLUnoHelper::ConvertFontWidth( m_aFont.CharacterWidth ) ); - - // Type - _rxOutStream->writeUTF( m_aFont.Name ); - _rxOutStream->writeUTF( m_aFont.StyleName ); - _rxOutStream->writeShort( m_aFont.Family ); - _rxOutStream->writeShort( m_aFont.CharSet ); - _rxOutStream->writeShort( m_aFont.Pitch ); - } - - _rxOutStream << m_aDefaultControl; - _rxOutStream->writeShort(m_nBorder); - _rxOutStream->writeBoolean(m_bEnable); - - if (nAnyMask & TABSTOP) - _rxOutStream->writeBoolean(getBOOL(m_aTabStop)); - - _rxOutStream->writeBoolean(m_bNavigation); - - if (nAnyMask & TEXTCOLOR) - _rxOutStream->writeLong(getINT32(m_aTextColor)); - - // neu ab Version 6 - _rxOutStream << m_sHelpText; - - if (nAnyMask & FONTDESCRIPTOR) - _rxOutStream << m_aFont; - - if (nAnyMask & RECORDMARKER) - _rxOutStream->writeBoolean(m_bRecordMarker); - - // neu ab Version 7 - _rxOutStream->writeBoolean(m_bPrintable); - - // new since 8 - if (nAnyMask & BACKGROUNDCOLOR) - _rxOutStream->writeLong(getINT32(m_aBackgroundColor)); -} - -//------------------------------------------------------------------------------ -void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OControlModel::read(_rxInStream); - - Reference<XMarkableStream> xMark(_rxInStream, UNO_QUERY); - - // 1. Version - sal_Int16 nVersion = _rxInStream->readShort(); - - // 2. Einlesen der Spalten - sal_Int32 nLen = _rxInStream->readLong(); - if (nLen) - { - for (sal_Int32 i = 0; i < nLen; i++) - { - // Lesen des Modelnamen - - ::rtl::OUString sModelName; - _rxInStream >> sModelName; - - Reference<XPropertySet> xCol(createColumn(getColumnTypeByModelName(sModelName))); - DBG_ASSERT(xCol.is(), "OGridControlModel::read : unknown column type !"); - sal_Int32 nObjLen = _rxInStream->readLong(); - if (nObjLen) - { - sal_Int32 nMark = xMark->createMark(); - if (xCol.is()) - { - OGridColumn* pCol = getColumnImplementation(xCol); - pCol->read(_rxInStream); - } - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nObjLen); - xMark->deleteMark(nMark); - } - - if ( xCol.is() ) - implInsert( i, xCol, sal_False, NULL, sal_False ); - } - } - - // In der Basisimplementierung werden die Events nur gelesen, Elemente im Container existieren - // da aber vor TF_ONE fuer das GridControl immer Events geschrieben wurden, muessen sie auch immer - // mit gelesen werden - sal_Int32 nObjLen = _rxInStream->readLong(); - if (nObjLen) - { - sal_Int32 nMark = xMark->createMark(); - Reference<XPersistObject> xObj(m_xEventAttacher, UNO_QUERY); - if (xObj.is()) - xObj->read(_rxInStream); - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nObjLen); - xMark->deleteMark(nMark); - } - - // Attachement lesen - for (sal_Int32 i = 0; i < nLen; i++) - { - InterfaceRef xIfc(m_aItems[i], UNO_QUERY); - Reference<XPropertySet> xSet(xIfc, UNO_QUERY); - Any aHelper; - aHelper <<= xSet; - m_xEventAttacher->attach( i, xIfc, aHelper ); - } - - // 4. Einlesen der Attribute - if (nVersion == 1) - return; - - // Maskierung fuer any - sal_uInt16 nAnyMask = _rxInStream->readShort(); - - if (nAnyMask & ROWHEIGHT) - { - sal_Int32 nValue = _rxInStream->readLong(); - m_aRowHeight <<= (sal_Int32)nValue; - } - - if (nAnyMask & FONTATTRIBS) - { - m_aFont.Weight = (float)VCLUnoHelper::ConvertFontWeight( _rxInStream->readShort() ); - - m_aFont.Slant = (FontSlant)_rxInStream->readShort(); - m_aFont.Underline = _rxInStream->readShort(); - m_aFont.Strikeout = _rxInStream->readShort(); - m_aFont.Orientation = ( (float)_rxInStream->readShort() ) / 10; - m_aFont.Kerning = _rxInStream->readBoolean(); - m_aFont.WordLineMode = _rxInStream->readBoolean(); - } - if (nAnyMask & FONTSIZE) - { - m_aFont.Width = (sal_Int16)_rxInStream->readLong(); - m_aFont.Height = (sal_Int16)_rxInStream->readLong(); - m_aFont.CharacterWidth = (float)VCLUnoHelper::ConvertFontWidth( _rxInStream->readShort() ); - } - if (nAnyMask & FONTTYPE) - { - m_aFont.Name = _rxInStream->readUTF(); - m_aFont.StyleName = _rxInStream->readUTF(); - m_aFont.Family = _rxInStream->readShort(); - m_aFont.CharSet = _rxInStream->readShort(); - m_aFont.Pitch = _rxInStream->readShort(); - } - - // Name - _rxInStream >> m_aDefaultControl; - m_nBorder = _rxInStream->readShort(); - m_bEnable = _rxInStream->readBoolean(); - - if (nAnyMask & TABSTOP) - { - m_aTabStop = makeBoolAny(_rxInStream->readBoolean()); - } - - if (nVersion > 3) - m_bNavigation = _rxInStream->readBoolean(); - - if (nAnyMask & TEXTCOLOR) - { - sal_Int32 nValue = _rxInStream->readLong(); - m_aTextColor <<= (sal_Int32)nValue; - } - - // neu ab Version 6 - if (nVersion > 5) - _rxInStream >> m_sHelpText; - - if (nAnyMask & FONTDESCRIPTOR) - { - _rxInStream >> m_aFont; - } - - m_aOldFont = m_aFont; - - if (nAnyMask & RECORDMARKER) - m_bRecordMarker = _rxInStream->readBoolean(); - - // neu ab Version 7 - if (nVersion > 6) - m_bPrintable = _rxInStream->readBoolean(); - - if (nAnyMask & BACKGROUNDCOLOR) - { - sal_Int32 nValue = _rxInStream->readLong(); - m_aBackgroundColor <<= (sal_Int32)nValue; - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_GroupBox.cxx b/binfilter/bf_forms/source/component/forms_GroupBox.cxx deleted file mode 100644 index 45e47f29ddec..000000000000 --- a/binfilter/bf_forms/source/component/forms_GroupBox.cxx +++ /dev/null @@ -1,203 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "GroupBox.hxx" -#include "property.hrc" -#include "services.hxx" - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <comphelper/property.hxx> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// OGroupBoxModel -//================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OGroupBoxModel(_rxFactory)); -} - -//------------------------------------------------------------------ -DBG_NAME( OGroupBoxModel ) -//------------------------------------------------------------------ -OGroupBoxModel::OGroupBoxModel(const Reference<starlang::XMultiServiceFactory>& _rxFactory) - :OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX) -{ - DBG_CTOR( OGroupBoxModel, NULL ); - m_nClassId = FormComponentType::GROUPBOX; -} - -//------------------------------------------------------------------ -OGroupBoxModel::OGroupBoxModel( const OGroupBoxModel* _pOriginal, const Reference<starlang::XMultiServiceFactory>& _rxFactory ) - :OControlModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OGroupBoxModel, NULL ); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX; - return aSupported; -} - -//------------------------------------------------------------------ -OGroupBoxModel::~OGroupBoxModel() -{ - DBG_DTOR( OGroupBoxModel, NULL ); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OGroupBoxModel ) - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OGroupBoxModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& OGroupBoxModel::getInfoHelper() -{ - return *const_cast<OGroupBoxModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OGroupBoxModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(3) - // don't want to have the TabStop property - RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP); - - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OGroupBoxModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_GROUPBOX; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGroupBoxModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - OControlModel::write(_rxOutStream); - - // Version - _rxOutStream->writeShort(0x0002); - writeHelpTextCompatibly(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OGroupBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException) -{ - OControlModel::read( _rxInStream ); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !"); - // ups, ist das Englisch richtig ? ;) - - if (nVersion == 2) - readHelpTextCompatibly(_rxInStream); - - if (nVersion > 0x0002) - { - DBG_ERROR("OGroupBoxModel::read : unknown version !"); - } -}; - -//================================================================== -// OGroupBoxControl -//================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OGroupBoxControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -OGroupBoxControl::OGroupBoxControl(const Reference<starlang::XMultiServiceFactory>& _rxFactory) - :OControl(_rxFactory, VCL_CONTROL_GROUPBOX) -{ -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported = OControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX; - return aSupported; -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_GroupManager.cxx b/binfilter/bf_forms/source/component/forms_GroupManager.cxx deleted file mode 100644 index a2ddb769ed83..000000000000 --- a/binfilter/bf_forms/source/component/forms_GroupManager.cxx +++ /dev/null @@ -1,465 +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. - * - ************************************************************************/ - -#include "GroupManager.hxx" -#include "DatabaseForm.hxx" - - -#include <comphelper/property.hxx> - -#include <tools/solar.h> - -#include "property.hrc" - -#include <algorithm> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//======================================================================== -// class OGroupCompAcc -//======================================================================== -//------------------------------------------------------------------ -OGroupCompAcc::OGroupCompAcc(const Reference<XPropertySet>& rxElement, const OGroupComp& _rGroupComp ) - :m_xComponent( rxElement ) - ,m_aGroupComp( _rGroupComp ) -{ -} - -//------------------------------------------------------------------ -sal_Bool OGroupCompAcc::operator==( const OGroupCompAcc& rCompAcc ) const -{ - return (m_xComponent == rCompAcc.GetComponent()); -} - -//------------------------------------------------------------------ -class OGroupCompAccLess : public ::std::binary_function<OGroupCompAcc, OGroupCompAcc, sal_Bool> -{ -public: - sal_Bool operator() (const OGroupCompAcc& lhs, const OGroupCompAcc& rhs) const - { - return - reinterpret_cast<sal_Int64>(lhs.m_xComponent.get()) - < reinterpret_cast<sal_Int64>(rhs.m_xComponent.get()); - } -}; - -//======================================================================== -// class OGroupComp -//======================================================================== - -//------------------------------------------------------------------ -OGroupComp::OGroupComp() - :m_nTabIndex( 0 ) - ,m_nPos( -1 ) -{ -} - -//------------------------------------------------------------------ -OGroupComp::OGroupComp(const OGroupComp& _rSource) - :m_aName( _rSource.m_aName ) - ,m_xComponent( _rSource.m_xComponent ) - ,m_nTabIndex( _rSource.m_nTabIndex ) - ,m_nPos( _rSource.m_nPos ) - ,m_xControlModel(_rSource.m_xControlModel) -{ -} - -//------------------------------------------------------------------ -OGroupComp::OGroupComp(const Reference<XPropertySet>& rxSet, sal_Int32 nInsertPos ) - :m_xComponent( rxSet ) - ,m_nTabIndex(0) - ,m_nPos( nInsertPos ) - ,m_xControlModel(rxSet,UNO_QUERY) -{ - if (m_xComponent.is()) - { - if (hasProperty( PROPERTY_TABINDEX, m_xComponent ) ) - // Indices kleiner 0 werden wie 0 behandelt - m_nTabIndex = Max(getINT16(m_xComponent->getPropertyValue( PROPERTY_TABINDEX )) , sal_Int16(0)); - - m_xComponent->getPropertyValue( PROPERTY_NAME ) >>= m_aName; - } -} - -//------------------------------------------------------------------ -sal_Bool OGroupComp::operator==( const OGroupComp& rComp ) const -{ - return m_nTabIndex == rComp.GetTabIndex() && m_nPos == rComp.GetPos(); -} - -//------------------------------------------------------------------ -class OGroupCompLess : public ::std::binary_function<OGroupComp, OGroupComp, sal_Bool> -{ -public: - sal_Bool operator() (const OGroupComp& lhs, const OGroupComp& rhs) const - { - sal_Bool bResult; - // TabIndex von 0 wird hinten einsortiert - if (lhs.m_nTabIndex == rhs.GetTabIndex()) - bResult = lhs.m_nPos < rhs.GetPos(); - else if (lhs.m_nTabIndex && rhs.GetTabIndex()) - bResult = lhs.m_nTabIndex < rhs.GetTabIndex(); - else - bResult = lhs.m_nTabIndex != 0; - return bResult; - } -}; - -//======================================================================== -// class OGroup -//======================================================================== - -DBG_NAME(OGroup) -//------------------------------------------------------------------ -OGroup::OGroup( const ::rtl::OUString& rGroupName ) - :m_aGroupName( rGroupName ) - ,m_nInsertPos(0) -{ - DBG_CTOR(OGroup,NULL); -} - -#ifdef DBG_UTIL -//------------------------------------------------------------------ -OGroup::OGroup( const OGroup& _rSource ) - :m_aGroupName(_rSource.m_aGroupName) - ,m_nInsertPos(_rSource.m_nInsertPos) - ,m_aCompArray(_rSource.m_aCompArray) - ,m_aCompAccArray(_rSource.m_aCompAccArray) -{ - DBG_CTOR(OGroup,NULL); -} -#endif - -//------------------------------------------------------------------ -OGroup::~OGroup() -{ - DBG_DTOR(OGroup,NULL); -} - -//------------------------------------------------------------------ -void OGroup::InsertComponent( const Reference<XPropertySet>& xSet ) -{ - OGroupComp aNewGroupComp( xSet, m_nInsertPos ); - sal_Int32 nPosInserted = insert_sorted(m_aCompArray, aNewGroupComp, OGroupCompLess()); - - OGroupCompAcc aNewGroupCompAcc( xSet, m_aCompArray[nPosInserted] ); - insert_sorted(m_aCompAccArray, aNewGroupCompAcc, OGroupCompAccLess()); - m_nInsertPos++; -} - -//------------------------------------------------------------------ -void OGroup::RemoveComponent( const Reference<XPropertySet>& rxElement ) -{ - sal_Int32 nGroupCompAccPos; - OGroupCompAcc aSearchCompAcc( rxElement, OGroupComp() ); - if ( seek_entry(m_aCompAccArray, aSearchCompAcc, nGroupCompAccPos, OGroupCompAccLess()) ) - { - OGroupCompAcc& aGroupCompAcc = m_aCompAccArray[nGroupCompAccPos]; - const OGroupComp& aGroupComp = aGroupCompAcc.GetGroupComponent(); - - sal_Int32 nGroupCompPos; - if ( seek_entry(m_aCompArray, aGroupComp, nGroupCompPos, OGroupCompLess()) ) - { - m_aCompAccArray.erase( m_aCompAccArray.begin() + nGroupCompAccPos ); - m_aCompArray.erase( m_aCompArray.begin() + nGroupCompPos ); - - /*============================================================ - Durch das Entfernen der GroupComp ist die Einfuegeposition - ungueltig geworden. Sie braucht hier aber nicht angepasst werden, - da sie fortlaufend vergeben wird und damit immer - aufsteigend eindeutig ist. - ============================================================*/ - } - else - { - DBG_ERROR( "OGroup::RemoveComponent: Component nicht in Gruppe" ); - } - } - else - { - DBG_ERROR( "OGroup::RemoveComponent: Component nicht in Gruppe" ); - } -} - -//------------------------------------------------------------------ -sal_Bool OGroup::operator==( const OGroup& rGroup ) const -{ - return m_aGroupName.equals(rGroup.GetGroupName()); -} - -//------------------------------------------------------------------ -class OGroupLess : public ::std::binary_function<OGroup, OGroup, sal_Bool> -{ -public: - sal_Bool operator() (const OGroup& lhs, const OGroup& rhs) const - { - return lhs.m_aGroupName < rhs.m_aGroupName; - } -}; - -//------------------------------------------------------------------ -Sequence< Reference<XControlModel> > OGroup::GetControlModels() const -{ - sal_Int32 nLen = m_aCompArray.size(); - Sequence<Reference<XControlModel> > aControlModelSeq( nLen ); - Reference<XControlModel>* pModels = aControlModelSeq.getArray(); - - ConstOGroupCompArrIterator aGroupComps = m_aCompArray.begin(); - for (sal_Int32 i = 0; i < nLen; ++i, ++pModels, ++aGroupComps) - { - *pModels = aGroupComps->GetControlModel(); - } - return aControlModelSeq; -} - -DBG_NAME(OGroupManager) -//------------------------------------------------------------------ -OGroupManager::OGroupManager(const Reference< XContainer >& _rxContainer) - :m_pCompGroup(new OGroup(ALL_COMPONENTS_GROUP_NAME)) - ,m_xContainer(_rxContainer) -{ - DBG_CTOR(OGroupManager,NULL); - - increment(m_refCount); - { - _rxContainer->addContainerListener(this); - } - decrement(m_refCount); -} - -//------------------------------------------------------------------ -OGroupManager::~OGroupManager() -{ - DBG_DTOR(OGroupManager,NULL); - // Alle Components und CompGroup loeschen - delete m_pCompGroup; -} - -// XPropertyChangeListener -//------------------------------------------------------------------ -void OGroupManager::disposing(const EventObject& evt) throw( RuntimeException ) -{ - Reference<XContainer> xContainer(evt.Source, UNO_QUERY); - if (xContainer.get() == m_xContainer.get()) - { - DELETEZ(m_pCompGroup); - - //////////////////////////////////////////////////////////////// - // Gruppen loeschen - m_aGroupArr.clear(); - m_xContainer.clear(); - } -} -// ----------------------------------------------------------------------------- -void OGroupManager::removeFromGroupMap(const ::rtl::OUString& _sGroupName,const Reference<XPropertySet>& _xSet) -{ - // Component aus CompGroup entfernen - m_pCompGroup->RemoveComponent( _xSet ); - - OGroupArr::iterator aFind = m_aGroupArr.find(_sGroupName); - - if ( aFind != m_aGroupArr.end() ) - { - // Gruppe vorhanden - aFind->second.RemoveComponent( _xSet ); - - // Wenn Anzahl der Gruppenelemente == 1 ist, Gruppe deaktivieren - if ( aFind->second.Count() == 1 ) - { - OActiveGroups::iterator aActiveFind = ::std::find(m_aActiveGroupMap.begin(),m_aActiveGroupMap.end(),aFind); - if ( aActiveFind != m_aActiveGroupMap.end() ) - m_aActiveGroupMap.erase(aActiveFind); - } - } - - - // Bei Component als PropertyChangeListener abmelden - _xSet->removePropertyChangeListener( PROPERTY_NAME, this ); - if (hasProperty(PROPERTY_TABINDEX, _xSet)) - _xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this ); -} -//------------------------------------------------------------------ -void SAL_CALL OGroupManager::propertyChange(const PropertyChangeEvent& evt) throw ( ::com::sun::star::uno::RuntimeException) -{ - Reference<XPropertySet> xSet(evt.Source, UNO_QUERY); - - // Component aus Gruppe entfernen - ::rtl::OUString sGroupName; - if (evt.PropertyName == PROPERTY_NAME) - evt.OldValue >>= sGroupName; - else - xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; - - removeFromGroupMap(sGroupName,xSet); - - // Component neu einordnen - InsertElement( xSet ); -} - -// XContainerListener -//------------------------------------------------------------------ -void SAL_CALL OGroupManager::elementInserted(const ContainerEvent& Event) throw ( ::com::sun::star::uno::RuntimeException) -{ - Reference< XPropertySet > xProps; - Event.Element >>= xProps; - if ( xProps.is() ) - InsertElement( xProps ); -} - -//------------------------------------------------------------------ -void SAL_CALL OGroupManager::elementRemoved(const ContainerEvent& Event) throw ( ::com::sun::star::uno::RuntimeException) -{ - Reference<XPropertySet> xProps; - Event.Element >>= xProps; - if ( xProps.is() ) - RemoveElement( xProps ); -} - -//------------------------------------------------------------------ -void SAL_CALL OGroupManager::elementReplaced(const ContainerEvent& Event) throw ( ::com::sun::star::uno::RuntimeException) -{ - Reference<XPropertySet> xProps; - Event.ReplacedElement >>= xProps; - if ( xProps.is() ) - RemoveElement( xProps ); - - xProps.clear(); - Event.Element >>= xProps; - if ( xProps.is() ) - InsertElement( xProps ); -} - -// Other functions -//------------------------------------------------------------------ -Sequence<Reference<XControlModel> > OGroupManager::getControlModels() -{ - return m_pCompGroup->GetControlModels(); -} - -//------------------------------------------------------------------ -sal_Int32 OGroupManager::getGroupCount() -{ - return m_aActiveGroupMap.size(); -} - -//------------------------------------------------------------------ -void OGroupManager::getGroup(sal_Int32 nGroup, Sequence< Reference<XControlModel> >& _rGroup, ::rtl::OUString& _rName) -{ - OSL_ENSURE(nGroup >= 0 && nGroup < m_aActiveGroupMap.size(),"OGroupManager::getGroup: Invalid group index!"); - OGroupArr::iterator aGroupPos = m_aActiveGroupMap[nGroup]; - _rName = aGroupPos->second.GetGroupName(); - _rGroup = aGroupPos->second.GetControlModels(); -} - -//------------------------------------------------------------------ -void OGroupManager::getGroupByName(const ::rtl::OUString& _rName, Sequence< Reference<XControlModel> >& _rGroup) -{ - OGroupArr::iterator aFind = m_aGroupArr.find(_rName); - if ( aFind != m_aGroupArr.end() ) - _rGroup = aFind->second.GetControlModels(); -} - -//------------------------------------------------------------------ -void OGroupManager::InsertElement( const Reference<XPropertySet>& xSet ) -{ - // Nur ControlModels - Reference<XControlModel> xControl(xSet, UNO_QUERY); - if (!xControl.is() ) - return; - - // Component in CompGroup aufnehmen - m_pCompGroup->InsertComponent( xSet ); - - // Component in Gruppe aufnehmen - ::rtl::OUString sGroupName; - xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; - - OGroupArr::iterator aFind = m_aGroupArr.find(sGroupName); - - if ( aFind == m_aGroupArr.end() ) - { - aFind = m_aGroupArr.insert(OGroupArr::value_type(sGroupName,OGroup(sGroupName))).first; - } - - aFind->second.InsertComponent( xSet ); - - - // Wenn Anzahl der Gruppenelemente == 2 ist, Gruppe aktivieren - if ( aFind->second.Count() == 2 ) - { - m_aActiveGroupMap.push_back( aFind ); - } - - - // Bei Component als PropertyChangeListener anmelden - xSet->addPropertyChangeListener( PROPERTY_NAME, this ); - - // Tabindex muss nicht jeder unterstuetzen - if (hasProperty(PROPERTY_TABINDEX, xSet)) - xSet->addPropertyChangeListener( PROPERTY_TABINDEX, this ); - -} - -//------------------------------------------------------------------ -void OGroupManager::RemoveElement( const Reference<XPropertySet>& xSet ) -{ - // Nur ControlModels - Reference<XControlModel> xControl(xSet, UNO_QUERY); - if (!xControl.is() ) - return; - - // Component aus Gruppe entfernen - ::rtl::OUString sGroupName; - xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName; - - removeFromGroupMap(sGroupName,xSet); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Hidden.cxx b/binfilter/bf_forms/source/component/forms_Hidden.cxx deleted file mode 100644 index adbc21267abc..000000000000 --- a/binfilter/bf_forms/source/component/forms_Hidden.cxx +++ /dev/null @@ -1,212 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Hidden.hxx" -#include "property.hrc" -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OHiddenModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OHiddenModel(_rxFactory)); -} - -//------------------------------------------------------------------ -DBG_NAME( OHiddenModel ) -//------------------------------------------------------------------ -OHiddenModel::OHiddenModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OControlModel(_rxFactory, ::rtl::OUString()) -{ - DBG_CTOR( OHiddenModel, NULL ); - m_nClassId = FormComponentType::HIDDENCONTROL; -} - -//------------------------------------------------------------------ -OHiddenModel::OHiddenModel( const OHiddenModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OControlModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OHiddenModel, NULL ); - m_sHiddenValue = _pOriginal->m_sHiddenValue; -} - -//------------------------------------------------------------------------------ -OHiddenModel::~OHiddenModel( ) -{ - DBG_CTOR( OHiddenModel, NULL ); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OHiddenModel ) - -//------------------------------------------------------------------------------ -void OHiddenModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const -{ - switch (_nHandle) - { - case PROPERTY_ID_HIDDEN_VALUE : _rValue <<= m_sHiddenValue; break; - default: - OControlModel::getFastPropertyValue(_rValue, _nHandle); - } -} - -//------------------------------------------------------------------------------ -void OHiddenModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::uno::Exception) -{ - switch (_nHandle) - { - case PROPERTY_ID_HIDDEN_VALUE : - DBG_ASSERT(_rValue.getValueType().getTypeClass() == TypeClass_STRING, "OHiddenModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_sHiddenValue; - break; - default: - OControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OHiddenModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_HIDDEN_VALUE : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_sHiddenValue); - break; - default: - bModified = OControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OHiddenModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& OHiddenModel::getInfoHelper() -{ - return *const_cast<OHiddenModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OHiddenModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - BEGIN_AGGREGATION_PROPERTY_HELPER(4, m_xAggregateSet) - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(HIDDEN_VALUE, ::rtl::OUString, BOUND); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - END_AGGREGATION_PROPERTY_HELPER(); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OHiddenModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) -{ - StringSequence aSupported( 2 ); - aSupported[ 0 ] = FRM_SUN_COMPONENT_HIDDENCONTROL; - aSupported[ 1 ] = FRM_SUN_FORMCOMPONENT; - return aSupported; -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OHiddenModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_HIDDEN; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OHiddenModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - // Version - _rxOutStream->writeShort(0x0002); - - // Wert - _rxOutStream << m_sHiddenValue; - - OControlModel::write(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OHiddenModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException) -{ - // Version - UINT16 nVersion = _rxInStream->readShort(); - - // Name - DBG_ASSERT(nVersion != 1, "OHiddenModel::read : this version is obsolete !"); - switch (nVersion) - { - case 1 : { ::rtl::OUString sDummy; _rxInStream >> sDummy; _rxInStream >> m_sHiddenValue; } break; - case 2 : _rxInStream >> m_sHiddenValue; break; - default : DBG_ERROR("OHiddenModel::read : unknown version !"); m_sHiddenValue = ::rtl::OUString(); - } - OControlModel::read(_rxInStream); -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Image.cxx b/binfilter/bf_forms/source/component/forms_Image.cxx deleted file mode 100644 index c4e8795442f2..000000000000 --- a/binfilter/bf_forms/source/component/forms_Image.cxx +++ /dev/null @@ -1,915 +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. - * - ************************************************************************/ - -#include "Image.hxx" - -#include <com/sun/star/form/XSubmit.hpp> -#include <com/sun/star/awt/SystemPointer.hpp> -#include <com/sun/star/frame/XDispatchProvider.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/awt/XActionListener.hpp> - -#include <tools/urlobj.hxx> -#include <vcl/svapp.hxx> -#include <bf_sfx2/docfile.hxx> -#include <bf_sfx2/objsh.hxx> -#include <osl/mutex.hxx> - -#include "services.hxx" -#include <comphelper/container.hxx> - -#include <comphelper/property.hxx> - -namespace binfilter { - -#define LOCAL_URL_PREFIX '#' - -//......................................................................... -namespace frm -{ -//......................................................................... - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::frame; - - -//================================================================== -// OImageControl -//================================================================== -//------------------------------------------------------------------------------ -Sequence<Type> OImageControl::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - aTypes = concatSequences(OControl::_getTypes(), OImageControl_BASE::getTypes()); - return aTypes; -} - -//------------------------------------------------------------------------------ -OImageControl::OImageControl(const Reference<XMultiServiceFactory>& _rxFactory, const ::rtl::OUString& _aService) - :OControl(_rxFactory, _aService) - ,m_aApproveActionListeners(m_aMutex) - ,m_aActionListeners(m_aMutex) - ,m_pThread(NULL) -{ -} - -//------------------------------------------------------------------------------ -OImageControl::~OImageControl() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } -} - -// UNO Anbindung -//------------------------------------------------------------------------------ -Any SAL_CALL OImageControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = OImageControl_BASE::queryInterface(_rType); - return aReturn; -} - -// XApproveActionBroadcaster -//------------------------------------------------------------------------------ -void OImageControl::addApproveActionListener( - const Reference<XApproveActionListener>& l) throw( RuntimeException ) -{ - m_aApproveActionListeners.addInterface(l); -} - -//------------------------------------------------------------------------------ -void OImageControl::removeApproveActionListener( - const Reference<XApproveActionListener>& l) throw( RuntimeException ) -{ - m_aApproveActionListeners.removeInterface(l); -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OImageControl::disposing() -{ - EventObject aEvt(static_cast<XWeak*>(this)); - m_aApproveActionListeners.disposeAndClear(aEvt); - m_aActionListeners.disposeAndClear(aEvt); - - { - ::osl::MutexGuard aGuard( m_aMutex ); - if( m_pThread ) - { - m_pThread->release(); - m_pThread = NULL; - } - } - - OControl::disposing(); -} - -//------------------------------------------------------------------------------ -void OImageControl::propertyChange( const PropertyChangeEvent& rEvt ) - throw( RuntimeException ) -{ - Reference<XWindowPeer> xPeer(getPeer()); - if (!xPeer.is()) - return; - - // Wenn eine URL gesetzt worden ist, muss die Hand angezeigt werden - if( ( rEvt.PropertyName == PROPERTY_TARGET_URL ) && - ( rEvt.NewValue.getValueType().getTypeClass() == TypeClass_STRING ) ) - { - - Reference<XPointer> xPoint( - m_xServiceFactory->createInstance(SRV_AWT_POINTER), UNO_QUERY); - if (xPoint.is()) - if (getString(rEvt.NewValue).getLength()) - xPoint->setType(SystemPointer::REFHAND); - else - xPoint->setType(SystemPointer::ARROW); - - xPeer->setPointer(xPoint); - } -} - -// XControl -//------------------------------------------------------------------------------ -void SAL_CALL OImageControl::createPeer(const Reference<XToolkit>& _rxToolkit, const Reference<XWindowPeer>& Parent) throw( RuntimeException ) -{ - OControl::createPeer(_rxToolkit, Parent); - Reference<XWindowPeer> xPeer = getPeer(); - - // Pointer umsetzen - if (!xPeer.is()) - return; - - Reference<XFastPropertySet> xSet(getModel(), UNO_QUERY); - if (xSet.is()) - { - // ist eine TargetUrl gesetzt, wird die Refhand verwendet - if (getString(xSet->getFastPropertyValue(PROPERTY_ID_TARGET_URL)).getLength()) - { - Reference<XPointer> xPoint( - m_xServiceFactory->createInstance(SRV_AWT_POINTER), UNO_QUERY); - if (xPoint.is()) - xPoint->setType(SystemPointer::REFHAND); - xPeer->setPointer(xPoint); - } - } - - // the following is not necessary anymore. The aggregated control (from the toolkit project) - // itself will register as image consumer at the image producer, so there's no need to do this ourself. - // This holds since our model is an XImageProducer itself, and thus hiding the XImageProducer of the aggregated - // model. Before, we had two ImageProducers working in parallel. - // 2003-05-15 - 109591 - fs@openoffice.org - -/* - // dem ImageProducer einen neuen Consumer bekannt geben - Reference<XImageProducerSupplier> xImgSrc(getModel(), UNO_QUERY); - if (!xImgSrc.is()) - return; - - Reference<XImageProducer> xImgProd = xImgSrc->getImageProducer(); - Reference<XImageConsumer> xImgCons(xPeer, UNO_QUERY); - - xImgProd->addConsumer(xImgCons); - xImgProd->startProduction(); -*/ -} - -//------------------------------------------------------------------------------ -sal_Bool OImageControl::setModel(const Reference<XControlModel>& Model) throw ( RuntimeException) -{ - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (xSet.is()) - xSet->removePropertyChangeListener(PROPERTY_TARGET_URL, this); - - sal_Bool bRes = OControl::setModel(Model); - if (bRes) - { - xSet = Reference<XPropertySet> (Model, UNO_QUERY); - if (xSet.is()) - xSet->addPropertyChangeListener(PROPERTY_TARGET_URL, this); - } - return bRes; -} - -//------------------------------------------------------------------------------ -Reference< XModel > OImageControl::getXModel(const InterfaceRef& xIface) const -{ - Reference< XModel > xModel(xIface, UNO_QUERY); - if (xModel.is()) - return xModel; - else - { - Reference<XChild> xChild(xIface, UNO_QUERY); - if (xChild.is()) - { - InterfaceRef xParent = xChild->getParent(); - return getXModel(xParent); - } - else - return NULL; - } -} - -//------------------------------------------------------------------------------ -// Diese Methode wird auch aus einem Thread gerufen und muss deshalb -// thread-safe sein. -void OImageControl::actionPerformed_Impl(sal_Bool bNotifyListener, const ::com::sun::star::awt::MouseEvent& rEvt) -{ - if( bNotifyListener ) - { - sal_Bool bCanceled = sal_False; - ::cppu::OInterfaceIteratorHelper aIter(m_aApproveActionListeners); - EventObject aEvt(static_cast<XWeak*>(this)); - while( !bCanceled && aIter.hasMoreElements() ) - { - XInterface *pNext = aIter.next(); - // Jede approveAction-Methode muss thread-safe sein!!! - if( !((XApproveActionListener*)pNext)->approveAction(aEvt) ) - bCanceled = sal_True; - } - - if (bCanceled) - return; - } - - // Ob der Rest des Codes Thread-Safe ist weiss man nicht genau. Deshalb - // wird das meiste bei gelocktem Solar-Mutex erledigen. - Reference<XPropertySet> xSet; - InterfaceRef xParent; - FormButtonType eButtonType; - { - SolarMutexGuard aGuard; - - // Parent holen - Reference<XFormComponent> xComp(getModel(), UNO_QUERY); - if (!xComp.is()) - return; - - xParent = xComp->getParent(); - if (!xParent.is()) - return; - - // Welchen ButtonType haben wir? - if (!query_interface((Reference< XInterface >)xComp, xSet)) - return; - eButtonType = *(FormButtonType*)xSet->getPropertyValue(PROPERTY_BUTTONTYPE).getValue(); - } - - switch (eButtonType) - { - case FormButtonType_RESET: - { - // reset-Methoden muessen thread-safe sein! - Reference<XReset> xReset(xParent, UNO_QUERY); - if (!xReset.is()) - return; - - xReset->reset(); - } - break; - - case FormButtonType_SUBMIT: - { - // submit-Methoden muessen thread-safe sein! - Reference<XSubmit> xSubmit(xParent, UNO_QUERY); - if (!xSubmit.is()) - return; - - xSubmit->submit(this, rEvt); - } - break; - - case FormButtonType_URL: - { - SolarMutexGuard aGuard; - - Reference< XModel > xModel = getXModel(xParent); - if (!xModel.is()) - return; - - /////////////////////////////////////////////////////////////////////// - // Jetzt URL ausfuehren - Reference< XController > xController = xModel->getCurrentController(); - if (!xController.is()) - return; - - Reference< XFrame > xFrame = xController->getFrame(); - if( !xFrame.is() ) - return; - - URL aURL; - aURL.Complete = - getString(xSet->getPropertyValue(PROPERTY_TARGET_URL)); - - if (aURL.Complete.getLength() && (LOCAL_URL_PREFIX == aURL.Complete.getStr()[0])) - { // the URL contains a local URL only. Since the URLTransformer does not handle this case correctly - // (it can't: it does not know the document URL), we have to take care for this ourself. - // The real solution would be to not allow such relative URLs (there is a rule that at runtime, all - // URLs have to be absolute), but for compatibility reasons this is no option. - // The more as the user does not want to see a local URL as "file://<path>/<document>#mark" if it - // could be "#mark" as well. - // If we someday say that this hack (yes, it's kind of a hack) is not sustainable anymore, the complete - // solutiuon would be: - // * recognize URLs consisting of a mark only while _reading_ the document - // * for this, allow the INetURLObject (which at the moment is invoked when reading URLs) to - // transform such mark-only URLs into correct absolute URLs - // * at the UI, show only the mark - // * !!!! recognize every SAVEAS on the document, so the absolute URL can be adjusted. This seems - // rather impossible !!! - // 89752 - 23.07.2001 - frank.schoenheit@sun.com - aURL.Mark = aURL.Complete; - aURL.Complete = xModel->getURL(); - aURL.Complete += aURL.Mark; - } - - Reference<XURLTransformer> - xTransformer(m_xServiceFactory->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer")), UNO_QUERY); - - sal_Bool bDispatchUrlInternal = sal_False; - xSet->getPropertyValue(PROPERTY_DISPATCHURLINTERNAL) >>= bDispatchUrlInternal; - if ( bDispatchUrlInternal ) - { - if ( xTransformer.is() ) - xTransformer->parseSmart( aURL, ::rtl::OUString::createFromAscii(INET_FILE_SCHEME) ); - - ::rtl::OUString aTargetFrame; - xSet->getPropertyValue(PROPERTY_TARGET_FRAME) >>= aTargetFrame; - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch( aURL, aTargetFrame, - FrameSearchFlag::SELF | FrameSearchFlag::PARENT | - FrameSearchFlag::SIBLINGS | FrameSearchFlag::CREATE ); - - Sequence<PropertyValue> aArgs(1); - PropertyValue& rProp = aArgs.getArray()[0]; - rProp.Name = ::rtl::OUString::createFromAscii("Referer"); - rProp.Value <<= xModel->getURL(); - - if (xDisp.is()) - xDisp->dispatch( aURL, aArgs ); - } - else - { - ::com::sun::star::util::URL aHyperLink; - aHyperLink.Complete = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:OpenHyperlink")); - if (xTransformer.is()) - xTransformer->parseStrict( aHyperLink ); - - Reference< XDispatch > xDisp = Reference< XDispatchProvider > (xFrame,UNO_QUERY)->queryDispatch(aHyperLink, ::rtl::OUString() , 0); - - if ( xDisp.is() ) - { - Sequence<PropertyValue> aProps(3); - aProps[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("URL")); - aProps[0].Value <<= aURL.Complete; - - aProps[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FrameName")); - aProps[1].Value = xSet->getPropertyValue(PROPERTY_TARGET_FRAME); - - aProps[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")); - aProps[2].Value <<= xModel->getURL(); - - xDisp->dispatch( aHyperLink, aProps ); - } - } - } break; - default: - { - // notify the action listeners for a push button - ActionEvent aEvt(static_cast<XWeak*>(this), m_aActionCommand); - m_aActionListeners.notifyEach( - &XActionListener::actionPerformed, aEvt); - } - } -} - - -//================================================================== -// OImageModel -//================================================================== -//------------------------------------------------------------------------------ -Sequence<Type> OImageModel::_getTypes() -{ - return concatSequences( - OControlModel::_getTypes(), - OImageModel_Base::getTypes() - ); -} - -//------------------------------------------------------------------ -DBG_NAME( OImageModel ) -//------------------------------------------------------------------ -OImageModel::OImageModel( const Reference< XMultiServiceFactory >& _rxFactory, const ::rtl::OUString& _rUnoControlModelTypeName, - const ::rtl::OUString& rDefault, const sal_Bool _bSetDelegator ) - :OControlModel( _rxFactory, _rUnoControlModelTypeName, rDefault, _bSetDelegator ) - ,OPropertyChangeListener(m_aMutex) - ,m_pProducer( NULL ) - ,m_pMedium(NULL) - ,m_bDownloading(sal_False) - ,m_bProdStarted(sal_False) - ,m_bDispatchUrlInternal(sal_False) -{ - DBG_CTOR( OImageModel, NULL ); - implConstruct(); - m_eButtonType = FormButtonType_PUSH; -} - -//------------------------------------------------------------------ -OImageModel::OImageModel( const OImageModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory, const sal_Bool _bSetDelegator ) - :OControlModel( _pOriginal, _rxFactory, _bSetDelegator ) - ,OPropertyChangeListener( m_aMutex ) - ,m_pProducer( NULL ) - ,m_pMedium( NULL ) - ,m_bDownloading( sal_False ) - ,m_bProdStarted( sal_False ) - ,m_bDispatchUrlInternal(sal_False) -{ - DBG_CTOR( OImageModel, NULL ); - implConstruct(); - - // copy properties - m_eButtonType = _pOriginal->m_eButtonType; - m_sTargetURL = _pOriginal->m_sTargetURL; - m_sTargetFrame = _pOriginal->m_sTargetFrame; - m_bDispatchUrlInternal = _pOriginal->m_bDispatchUrlInternal; -} - -//------------------------------------------------------------------------------ -void OImageModel::implInitializeImageURL( ) -{ - osl_incrementInterlockedCount( &m_refCount ); - { - // simulate a propertyChanged event for the ImageURL - // 2003-05-15 - #109591# - fs@openoffice.org - Any aImageURL; - getFastPropertyValue( aImageURL, PROPERTY_ID_IMAGE_URL ); - _propertyChanged( PropertyChangeEvent( *this, PROPERTY_IMAGE_URL, sal_False, PROPERTY_ID_IMAGE_URL, Any( ), aImageURL ) ); - } - osl_decrementInterlockedCount( &m_refCount ); -} - -//------------------------------------------------------------------------------ -void OImageModel::implConstruct() -{ - m_pProducer = new ImageProducer; - increment( m_refCount ); - { - m_xProducer = m_pProducer; - - if ( m_xAggregateSet.is() ) - { - OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet ); - pMultiplexer->addProperty( PROPERTY_IMAGE_URL ); - } - } - decrement(m_refCount); -} - -//------------------------------------------------------------------------------ -OImageModel::~OImageModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - DBG_ASSERT(m_pMedium == NULL, "OImageModel::~OImageModel : leaving a memory leak ..."); - // spaetestens im dispose sollte das aufgeraeumt worden sein - - DBG_DTOR( OImageModel, NULL ); -} - -// XImageProducer -//-------------------------------------------------------------------- -void SAL_CALL OImageModel::addConsumer( const Reference< XImageConsumer >& _rxConsumer ) throw (RuntimeException) -{ - GetImageProducer()->addConsumer( _rxConsumer ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageModel::removeConsumer( const Reference< XImageConsumer >& _rxConsumer ) throw (RuntimeException) -{ - GetImageProducer()->removeConsumer( _rxConsumer ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageModel::startProduction( ) throw (RuntimeException) -{ - GetImageProducer()->startProduction(); -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OImageModel::disposing() -{ - OControlModel::disposing(); - if (m_pMedium) - { - delete m_pMedium; - m_pMedium = NULL; - } - - m_xProducer = NULL; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OImageModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - // order matters: - // we definately want to "overload" the XImageProducer interface of our aggregate, - // thus check OImageModel_Base (which provides this) first - Any aReturn = OImageModel_Base::queryInterface( _rType ); - - // BUT: _don't_ let it feel responsible for the XTypeProvider interface - // (as this is implemented by our base class in the proper way) - if ( _rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >( NULL ) ) ) - || !aReturn.hasValue() - ) - aReturn = OControlModel::queryAggregation( _rType ); - - return aReturn; -} - -//------------------------------------------------------------------------------ -void OImageModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const -{ - switch (nHandle) - { - case PROPERTY_ID_BUTTONTYPE : rValue <<= m_eButtonType; break; - case PROPERTY_ID_TARGET_URL : rValue <<= m_sTargetURL; break; - case PROPERTY_ID_TARGET_FRAME : rValue <<= m_sTargetFrame; break; - case PROPERTY_ID_DISPATCHURLINTERNAL : rValue <<= m_bDispatchUrlInternal; break; - default: - OControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -void OImageModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw ( Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_BUTTONTYPE : - DBG_ASSERT(isA(rValue, static_cast<FormButtonType*>(NULL)), "OImageModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_eButtonType; - break; - - case PROPERTY_ID_TARGET_URL : - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "OImageModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_sTargetURL; - break; - - case PROPERTY_ID_TARGET_FRAME : - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "OImageModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_sTargetFrame; - break; - - case PROPERTY_ID_DISPATCHURLINTERNAL: - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, "OImageModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_bDispatchUrlInternal; - break; - - default: - OControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OImageModel::convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) - throw( IllegalArgumentException ) -{ - switch (nHandle) - { - case PROPERTY_ID_BUTTONTYPE : - return tryPropertyValueEnum( rConvertedValue, rOldValue, rValue, m_eButtonType ); - - case PROPERTY_ID_TARGET_URL : - return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sTargetURL); - - case PROPERTY_ID_TARGET_FRAME : - return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sTargetFrame); - - case PROPERTY_ID_DISPATCHURLINTERNAL : - return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bDispatchUrlInternal); - - default: - return OControlModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue); - } -} - -//------------------------------------------------------------------------------ -void OImageModel::StartProduction() -{ - ImageProducer *pImgProd = GetImageProducer(); - if (!m_pMedium) - { - // caution: the medium may be NULL if somebody gave us a invalid URL to work with - // 11/24/2000 - 79667 - FS - pImgProd->SetImage(String()); - m_bDownloading = sal_False; - return; - } - - if (m_pMedium->GetErrorCode()==0) - { - SvStream* pStream = m_pMedium->GetInStream(); - - pImgProd->SetImage(*pStream); - pImgProd->startProduction(); - m_bProdStarted = sal_True; - } - else - { - pImgProd->SetImage(String()); - delete m_pMedium; - m_pMedium = 0; - m_bDownloading = sal_False; - } -} - -//------------------------------------------------------------------------------ -void OImageModel::SetURL( const ::rtl::OUString& rURL ) -{ - if (m_pMedium || !rURL.getLength()) - { - // Den Stream am Producer freigeben, bevor das Medium geloscht wird. - GetImageProducer()->SetImage(String()); - delete m_pMedium; - m_pMedium = NULL; - } - - // the SfxMedium is not allowed to be created with an invalid URL, so we have to check this first - // 23.01.2001 - 81927 - FS - INetURLObject aUrl(rURL); - if (INET_PROT_NOT_VALID == aUrl.GetProtocol()) - // we treat an invalid URL like we would treat no URL - return; - - if (rURL.getLength()) - { - if (m_pMedium) - delete m_pMedium; - - m_pMedium = new SfxMedium(rURL, STREAM_STD_READ, sal_False); - m_pMedium->SetTransferPriority(SFX_TFPRIO_VISIBLE_HIGHRES_GRAPHIC); - m_pMedium->SetDataAvailableLink( - STATIC_LINK(this, OImageModel, DataAvailableLink)); - - // Das XModel suchen, um an die Object-Shell oder zumindest den - // Referer zu gelangen. - // Das Model findet man allerdings nur beim Laden von HTML-Dokumenten - // und dann, wenn die URL in einem bereits geladenen Dokument - // geaendert wird. Waehrend des Ladens kommt man nicht an das - // Model ran. - Reference< XModel > xModel; - InterfaceRef xIfc( *this ); - while( !xModel.is() && xIfc.is() ) - { - Reference<XChild> xChild( xIfc, UNO_QUERY ); - xIfc = xChild->getParent(); - query_interface(xIfc, xModel); - } - - // Die Object-Shell suchen, indem wir - // ueber alle Object-Shells iterieren und deren XModel mit dem - // eigenen vergleichen. Als Optimierung probieren wir aber erstmal - // die aktuelle Object-Shell. - // wir unser XModel mit dem aller Object - SfxObjectShell *pObjSh = 0; - - if( xModel.is() ) - { - SfxObjectShell *pTestObjSh = SfxObjectShell::Current(); - if( pTestObjSh ) - { - Reference< XModel > xTestModel = pTestObjSh->GetModel(); - if( xTestModel == xModel ) - pObjSh = pTestObjSh; - } - if( !pObjSh ) - { - SfxObjectShell *pTestObjSh = SfxObjectShell::GetFirst(); - while( !pObjSh && pTestObjSh ) - { - Reference< XModel > xTestModel = pTestObjSh->GetModel(); - if( xTestModel == xModel ) - pObjSh = pTestObjSh; - else - pTestObjSh = SfxObjectShell::GetNext( *pTestObjSh ); - } - } - } - -#ifdef USE_REGISTER_TRANSFER - if( pObjSh ) - { - // Medium registrieren, damit abgebrochen werden kann - pObjSh->RegisterTransfer( *m_pMedium ); - - // Target-Frame uebertragen, damit auch javascript:-URLs - // "geladen" werden koennen. - } - else - { - // Keine Object-Shell, aber ein Medium? Dann uebernehmen wir - // zumindest den Referer. - if( xModel.is() ) - { - ::rtl::OUString sReferer( xModel->getURL() ); - if( sReferer.getLength() ) - m_pMedium->SetReferer( OUStringToString(sReferer, CHARSET_SYSTEM) ); - } - - // Keinen Eintrag im Roter Button Menu - m_pMedium->SetDontCreateCancellable(); - } -#else - if( pObjSh ) - { - m_pMedium->SetUsesCache( !pObjSh->IsReloading() ); - - // Target-Frame uebertragen, damit auch javascript:-URLs - // "geladen" werden koennen. - } - - if( xModel.is() ) - { - ::rtl::OUString sReferer( xModel->getURL() ); - if( sReferer.getLength() ) - m_pMedium->SetReferer( sReferer ); - } - - // Keinen Eintrag im Roter Button Menu - m_pMedium->SetDontCreateCancellable(); -#endif - - // Downloading-Flag auf sal_True setzen. Es werden dann auch - // Data-Available-Links, wenn wir in den Pending-Staus gelangen. - m_bDownloading = sal_True; - m_bProdStarted = sal_False; - - // Download anstossen (Achtung: Kann auch synchron sein). - m_pMedium->DownLoad(STATIC_LINK(this, OImageModel, DownloadDoneLink)); - } - else - { - GetImageProducer()->startProduction(); - } -} - -//------------------------------------------------------------------------------ -void OImageModel::DataAvailable() -{ - if (!m_bProdStarted) - StartProduction(); - - GetImageProducer()->NewDataAvailable(); -} - -//------------------------------------------------------------------------------ -void OImageModel::DownloadDone() -{ - DataAvailable(); - m_bDownloading = sal_False; -} - -//------------------------------------------------------------------------------ -IMPL_STATIC_LINK( OImageModel, DownloadDoneLink, void*, EMPTYARG ) -{ - ::osl::MutexGuard aGuard( pThis->m_aMutex ); - pThis->DownloadDone(); - return 0; -} - -//------------------------------------------------------------------------------ -IMPL_STATIC_LINK( OImageModel, DataAvailableLink, void*, EMPTYARG ) -{ - ::osl::MutexGuard aGuard( pThis->m_aMutex ); - pThis->DataAvailable(); - return 0; -} - -//------------------------------------------------------------------------------ -void OImageModel::_propertyChanged( const PropertyChangeEvent& rEvt ) - throw( RuntimeException ) -{ - // Wenn eine URL gesetzt worden ist, muss die noch an den ImageProducer - // weitergereicht werden. - ::osl::MutexGuard aGuard(m_aMutex); - SetURL( getString(rEvt.NewValue) ); -} -// ----------------------------------------------------------------------------- -void SAL_CALL OImageModel::read(const Reference< XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException) -{ - OControlModel::read(_rxInStream); - m_bDispatchUrlInternal = sal_True; -} -// ----------------------------------------------------------------------------- -PropertyState OImageModel::getPropertyStateByHandle(sal_Int32 nHandle) -{ - PropertyState eState; - switch (nHandle) - { - case PROPERTY_ID_DISPATCHURLINTERNAL: - if ( m_bDispatchUrlInternal ) - eState = PropertyState_DIRECT_VALUE; - else - eState = PropertyState_DEFAULT_VALUE; - break; - default: - eState = OControlModel::getPropertyStateByHandle(nHandle); - } - return eState; -} -// ----------------------------------------------------------------------------- -void OImageModel::setPropertyToDefaultByHandle(sal_Int32 nHandle) -{ - switch (nHandle) - { - case PROPERTY_ID_DISPATCHURLINTERNAL: - setFastPropertyValue(nHandle, makeAny(sal_False)); - break; - default: - OControlModel::setPropertyToDefaultByHandle(nHandle); - } -} -// ----------------------------------------------------------------------------- -Any OImageModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const -{ - switch (nHandle) - { - case PROPERTY_ID_DISPATCHURLINTERNAL: - return makeAny(sal_False); - break; - default: - return OControlModel::getPropertyDefaultByHandle(nHandle); - } -} -// ----------------------------------------------------------------------------- - -//================================================================== -// OImageControlThread_Impl -//================================================================== -//------------------------------------------------------------------ -EventObject* OImageControlThread_Impl::cloneEvent( const EventObject* _pEvt ) const -{ - return new EventObject( *_pEvt ); -} - -//------------------------------------------------------------------ -void OImageControlThread_Impl::processEvent( ::cppu::OComponentHelper *pCompImpl, - const EventObject* pEvt, - const Reference<XControl>&, - sal_Bool ) -{ - ((OImageControl *)pCompImpl)->actionPerformed_Impl( sal_True, *(::com::sun::star::awt::MouseEvent *)pEvt ); -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_ImageButton.cxx b/binfilter/bf_forms/source/component/forms_ImageButton.cxx deleted file mode 100644 index d45751c41928..000000000000 --- a/binfilter/bf_forms/source/component/forms_ImageButton.cxx +++ /dev/null @@ -1,298 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "ImageButton.hxx" - -#include <tools/urlobj.hxx> - -#include <com/sun/star/awt/MouseButton.hpp> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - - -#include "services.hxx" - -#include "bf_so3/staticbaseurl.hxx" -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -//= OImageButtonModel -//================================================================== -DBG_NAME(OImageButtonModel) -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OImageButtonModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OImageButtonModel(_rxFactory)); -} - -//------------------------------------------------------------------ -OImageButtonModel::OImageButtonModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OImageModel(_rxFactory, VCL_CONTROLMODEL_IMAGEBUTTON, FRM_CONTROL_IMAGEBUTTON) - // use the old control name for compytibility reasons -{ - DBG_CTOR(OImageButtonModel, NULL); - m_nClassId = FormComponentType::IMAGEBUTTON; -} - -//------------------------------------------------------------------ -OImageButtonModel::OImageButtonModel( const OImageButtonModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory) - :OImageModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR(OImageButtonModel, NULL); - implInitializeImageURL(); -} - -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OImageButtonModel ) - -//------------------------------------------------------------------------------ -OImageButtonModel::~OImageButtonModel() -{ - DBG_DTOR(OImageButtonModel, NULL); -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OImageButtonModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OImageButtonModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_IMAGEBUTTON; - return aSupported; -} - -//------------------------------------------------------------------------------ -void OImageButtonModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(8) - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(BUTTONTYPE, FormButtonType, BOUND); - DECL_PROP1(DISPATCHURLINTERNAL, sal_Bool, BOUND); - DECL_PROP1(TARGET_URL, ::rtl::OUString, BOUND); - DECL_PROP1(TARGET_FRAME, ::rtl::OUString, BOUND); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OImageButtonModel::getInfoHelper() -{ - return *const_cast<OImageButtonModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString OImageButtonModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_IMAGEBUTTON; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void OImageButtonModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OControlModel::write(_rxOutStream); - - // Version - _rxOutStream->writeShort(0x0003); - _rxOutStream->writeShort((sal_uInt16)m_eButtonType); - - ::rtl::OUString sTmp(INetURLObject::decode(::binfilter::StaticBaseUrl::AbsToRel(m_sTargetURL), '%', INetURLObject::DECODE_UNAMBIGUOUS)); - _rxOutStream << sTmp; - _rxOutStream << m_sTargetFrame; - writeHelpTextCompatibly(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void OImageButtonModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OControlModel::read(_rxInStream); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - - switch (nVersion) - { - case 0x0001: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - } - break; - case 0x0002: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - ::rtl::OUString sTmp; - _rxInStream >> sTmp; - m_sTargetURL = ::binfilter::StaticBaseUrl::RelToAbs( sTmp ); - _rxInStream >> m_sTargetFrame; - } - break; - case 0x0003: - { - m_eButtonType = (FormButtonType)_rxInStream->readShort(); - ::rtl::OUString sTmp; - _rxInStream >> sTmp; - m_sTargetURL = ::binfilter::StaticBaseUrl::RelToAbs( sTmp ); - _rxInStream >> m_sTargetFrame; - readHelpTextCompatibly(_rxInStream); - } - break; - - default : - DBG_ERROR("OImageButtonModel::read : unknown version !"); - m_eButtonType = FormButtonType_PUSH; - m_sTargetURL = ::rtl::OUString(); - m_sTargetFrame = ::rtl::OUString(); - break; - } -} - -//================================================================== -// OImageButtonControl -//================================================================== -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OImageButtonControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OImageButtonControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OImageButtonControl::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - aTypes = concatSequences(OImageControl::_getTypes(), OImageButtonControl_BASE::getTypes()); - return aTypes; -} - -//------------------------------------------------------------------------------ -StringSequence OImageButtonControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_IMAGEBUTTON; - return aSupported; -} - -//------------------------------------------------------------------------------ -OImageButtonControl::OImageButtonControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OImageControl(_rxFactory, VCL_CONTROL_IMAGEBUTTON) -{ - increment(m_refCount); - { - // als MouseListener anmelden - Reference<XWindow> xComp; - query_aggregation( m_xAggregate, xComp); - if (xComp.is()) - xComp->addMouseListener((XMouseListener*)this); - } - // Refcount bei 1 fuer angemeldeten Listener - sal_Int32 n = decrement(m_refCount); -} - -// UNO Anbindung -//------------------------------------------------------------------------------ -Any SAL_CALL OImageButtonControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OImageControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = OImageButtonControl_BASE::queryInterface(_rType); - - return aReturn; -} - -//------------------------------------------------------------------------------ -void OImageButtonControl::mousePressed(const MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) -{ - ////////////////////////////////////////////////////////////////////// - // Nur linke Maustaste - if (e.Buttons != MouseButton::LEFT) - return; - - ::osl::ClearableMutexGuard aGuard( m_aMutex ); - if( m_aApproveActionListeners.getLength() ) - { - // Wenn es ApproveAction-Lisener gibt, muss ein eigener Thread - // aufgemacht werden. - if( !m_pThread ) - { - m_pThread = new OImageControlThread_Impl( this ); - m_pThread->acquire(); - m_pThread->create(); - } - m_pThread->OComponentEventThread::addEvent( &e ); - } - else - { - // Sonst nicht. Dann darf man aber auf keinen Fal die Listener - // benachrichtigen, auch dann nicht, wenn er spaeter hinzukommt. - aGuard.clear(); - actionPerformed_Impl( sal_False, e ); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_ImageControl.cxx b/binfilter/bf_forms/source/component/forms_ImageControl.cxx deleted file mode 100644 index 52dd8339d56f..000000000000 --- a/binfilter/bf_forms/source/component/forms_ImageControl.cxx +++ /dev/null @@ -1,743 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "ImageControl.hxx" - -#include "property.hrc" -#include "frm_resource.hrc" -#include "frm_resource.hxx" -#include "services.hxx" -#include <com/sun/star/awt/XPopupMenu.hpp> -#include <com/sun/star/awt/PopupMenuDirection.hpp> - -#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> -#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> -#include <com/sun/star/sdbc/DataType.hpp> -#include <com/sun/star/awt/MouseButton.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/io/XActiveDataSink.hpp> - - -#include <unotools/streamhelper.hxx> -#include <unotools/ucbstreamhelper.hxx> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -namespace binfilter { - -#define ID_OPEN_GRAPHICS 1 -#define ID_CLEAR_GRAPHICS 2 - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::ui::dialogs; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// OImageControlModel -//================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OImageControlModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OImageControlModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OImageControlModel::_getTypes() -{ - return concatSequences( - OBoundControlModel::_getTypes(), - OImageControlModel_Base::getTypes() - ); -} - -DBG_NAME(OImageControlModel) -//------------------------------------------------------------------ -OImageControlModel::OImageControlModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_CONTROL_IMAGECONTROL, sal_False, sal_False) - // use the old control name for compytibility reasons - ,OPropertyChangeListener( m_aMutex ) - ,m_pImageProducer( new ImageProducer ) - ,m_bReadOnly( sal_False ) - ,m_pAggregatePropertyMultiplexer( NULL ) -{ - DBG_CTOR( OImageControlModel, NULL ); - m_nClassId = FormComponentType::IMAGECONTROL; - - implConstruct(); -} - -//------------------------------------------------------------------ -OImageControlModel::OImageControlModel( const OImageControlModel* _pOriginal, const Reference< XMultiServiceFactory >& _rxFactory ) - :OBoundControlModel( _pOriginal, _rxFactory, sal_False, sal_False ) - // use the old control name for compytibility reasons - ,OPropertyChangeListener( m_aMutex ) - ,m_pImageProducer( NULL ) - ,m_pAggregatePropertyMultiplexer( NULL ) -{ - DBG_CTOR( OImageControlModel, NULL ); - implConstruct(); - m_bReadOnly = _pOriginal->m_bReadOnly; - - osl_incrementInterlockedCount( &m_refCount ); - { - // simulate a propertyChanged event for the ImageURL - // 2003-05-15 - #109591# - fs@openoffice.org - Any aImageURL; - getFastPropertyValue( aImageURL, PROPERTY_ID_IMAGE_URL ); - _propertyChanged( PropertyChangeEvent( *this, PROPERTY_IMAGE_URL, sal_False, PROPERTY_ID_IMAGE_URL, Any( ), aImageURL ) ); - } - osl_decrementInterlockedCount( &m_refCount ); -} - -//------------------------------------------------------------------ -void OImageControlModel::implConstruct() -{ - m_pImageProducer = new ImageProducer; - m_xImageProducer = m_pImageProducer; - m_sDataFieldConnectivityProperty = PROPERTY_IMAGE_URL; - - increment(m_refCount); - if ( m_xAggregateSet.is() ) - { - m_pAggregatePropertyMultiplexer = new OPropertyChangeMultiplexer( this, m_xAggregateSet, sal_False ); - m_pAggregatePropertyMultiplexer->acquire(); - m_pAggregatePropertyMultiplexer->addProperty( PROPERTY_IMAGE_URL ); - } - decrement(m_refCount); - - doSetDelegator(); -} - -//------------------------------------------------------------------ -OImageControlModel::~OImageControlModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - doResetDelegator(); - - if (m_pAggregatePropertyMultiplexer) - { - m_pAggregatePropertyMultiplexer->dispose(); - m_pAggregatePropertyMultiplexer->release(); - m_pAggregatePropertyMultiplexer = NULL; - } - - DBG_DTOR(OImageControlModel,NULL); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OImageControlModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence OImageControlModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_IMAGECONTROL; - return aSupported; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OImageControlModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - // oder matters: we want to "override" the XImageProducer interface of the aggreate with out - // own XImageProducer interface, thus we need to query OImageControlModel_Base first - Any aReturn = OImageControlModel_Base::queryInterface( _rType ); - - // BUT: _don't_ let it feel responsible for the XTypeProvider interface - // (as this is implemented by our base class in the proper way) - if ( _rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >( NULL ) ) ) - || !aReturn.hasValue() - ) - aReturn = OBoundControlModel::queryAggregation( _rType ); - - return aReturn; -} - -//------------------------------------------------------------------------------ -sal_Bool OImageControlModel::_approve(sal_Int32 _nColumnType) -{ - // zulaessing sind die binary Typen, OTHER- und LONGVARCHAR-Felder - if ((_nColumnType == DataType::BINARY) || (_nColumnType == DataType::VARBINARY) - || (_nColumnType == DataType::LONGVARBINARY) || (_nColumnType == DataType::OTHER) - || (_nColumnType == DataType::LONGVARCHAR)) - return sal_True; - - return sal_False; -} - - -//------------------------------------------------------------------------------ -void OImageControlModel::_propertyChanged( const PropertyChangeEvent& rEvt ) - throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard(m_aMutex); - - // Wenn eine URL gesetzt worden ist, muss die noch an den ImageProducer - // weitergereicht werden. - // xInStream erzeugen - - Reference<XActiveDataSink> xSink( - m_xServiceFactory->createInstance( - ::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), UNO_QUERY); - if (!xSink.is()) - return; - - // SvStream am xInStream setzen - String aPath = getString(rEvt.NewValue); - - SvStream* pFileStream = ::utl::UcbStreamHelper::CreateStream(aPath, STREAM_READ); - sal_Bool bSetNull = (NULL == pFileStream) || (ERRCODE_NONE != pFileStream->GetErrorCode()); - - if (!bSetNull) - { - // get the size of the stream - pFileStream->Seek(STREAM_SEEK_TO_END); - sal_Int32 nSize = (sal_Int32)pFileStream->Tell(); - if (pFileStream->GetBufferSize() < 8192) - pFileStream->SetBufferSize(8192); - pFileStream->Seek(STREAM_SEEK_TO_BEGIN); - - Reference<XInputStream> xInput - (new ::utl::OInputStreamHelper(new SvLockBytes(pFileStream, sal_True), - nSize)); - xSink->setInputStream(xInput); - Reference<XInputStream> xInStream(xSink, UNO_QUERY); - if (m_xColumnUpdate.is()) - m_xColumnUpdate->updateBinaryStream(xInStream, xInput->available()); - else - { - GetImageProducer()->setImage( xInStream ); - GetImageProducer()->startProduction(); - } - - // usually the setBinaryStream should close the input, but just in case .... - try - { - xInStream->closeInput(); - } - catch (NotConnectedException&) - { - } - } - else - { - if (m_xColumnUpdate.is()) - m_xColumnUpdate->updateNull(); - - Reference< com::sun::star::io::XInputStream > xNull; - GetImageProducer()->setImage(xNull); - GetImageProducer()->startProduction(); - - delete pFileStream; - } -} - -//------------------------------------------------------------------------------ -void OImageControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const -{ - switch (nHandle) - { - case PROPERTY_ID_READONLY : rValue <<= (sal_Bool)m_bReadOnly; break; - default: - OBoundControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -void OImageControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw ( ::com::sun::star::uno::Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_READONLY : - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_BOOLEAN, "OImageControlModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - m_bReadOnly = getBOOL(rValue); - break; - - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue); - } -} - -//------------------------------------------------------------------------------ -sal_Bool OImageControlModel::convertFastPropertyValue(Any& rConvertedValue, Any& rOldValue, sal_Int32 nHandle, const Any& rValue) - throw( IllegalArgumentException ) -{ - switch (nHandle) - { - case PROPERTY_ID_READONLY : - return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bReadOnly); - - default: - return OBoundControlModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue); - } -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OImageControlModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo(createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void OImageControlModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(8) -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_IMAGE_URL, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_BOOL_PROP1(READONLY, BOUND); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OImageControlModel::getInfoHelper() -{ - return *const_cast<OImageControlModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString OImageControlModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_IMAGECONTROL; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void OImageControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - // Basisklasse - OBoundControlModel::write(_rxOutStream); - // Version - _rxOutStream->writeShort(0x0003); - // Name - _rxOutStream->writeBoolean(m_bReadOnly); - writeHelpTextCompatibly(_rxOutStream); - // from version 0x0003 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void OImageControlModel::read(const Reference<XObjectInputStream>& _rxInStream) throw ( ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException) -{ - OBoundControlModel::read(_rxInStream); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - switch (nVersion) - { - case 0x0001: - m_bReadOnly = _rxInStream->readBoolean(); - break; - case 0x0002: - m_bReadOnly = _rxInStream->readBoolean(); - readHelpTextCompatibly(_rxInStream); - break; - case 0x0003: - m_bReadOnly = _rxInStream->readBoolean(); - readHelpTextCompatibly(_rxInStream); - readCommonProperties(_rxInStream); - break; - default : - DBG_ERROR("OImageControlModel::read : unknown version !"); - m_bReadOnly = sal_False; - defaultCommonProperties(); - break; - } - // Nach dem Lesen die Defaultwerte anzeigen - if (m_aControlSource.getLength()) - { // (not if we don't have a control source - the "State" property acts like it is persistent, then - ::osl::MutexGuard aGuard(m_aMutex); // _reset expects this mutex guarding - _reset(); - } -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void OImageControlModel::_onValueChanged() -{ - UpdateFromField(); -} - -//------------------------------------------------------------------------------ -Any OImageControlModel::_getControlValue() const -{ - // hier macht ein Vergleich keinen Sinn, daher void siehe OBoundControlModel - return Any(); -} - -// OComponentHelper -//------------------------------------------------------------------ -void OImageControlModel::disposing() -{ - if (m_pAggregatePropertyMultiplexer) - m_pAggregatePropertyMultiplexer->dispose(); - - OBoundControlModel::disposing(); - - Reference<XInputStream> xInStream; - GetImageProducer()->setImage( xInStream ); - m_xImageProducer->startProduction(); -} - -//------------------------------------------------------------------------------ -void OImageControlModel::_reset() -{ - if(getField().is()) // only reset when we are connected to a column - { - Reference<XInputStream> xDummy; - GetImageProducer()->setImage(xDummy); - Reference<XImageProducer> xProducer = m_xImageProducer; - { // release our mutex once (it's acquired in the calling method !), as starting the image production may - // result in the locking of the solar mutex (unfortunally the default implementation of our aggregate, - // VCLXImageControl, does this locking) - // FS - 74438 - 30.03.00 - MutexRelease aRelease(m_aMutex); - xProducer->startProduction(); - } - } -} - -// Helper functions -//------------------------------------------------------------------------------ -void OImageControlModel::UpdateFromField() -{ - Reference<XInputStream> xInStream = m_xColumn->getBinaryStream(); - GetImageProducer()->setImage(xInStream); - GetImageProducer()->startProduction(); -} - -//-------------------------------------------------------------------- -Reference< XImageProducer > SAL_CALL OImageControlModel::getImageProducer() throw ( RuntimeException) -{ - return this; -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageControlModel::addConsumer( const Reference< XImageConsumer >& _rxConsumer ) throw (RuntimeException) -{ - GetImageProducer()->addConsumer( _rxConsumer ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageControlModel::removeConsumer( const Reference< XImageConsumer >& _rxConsumer ) throw (RuntimeException) -{ - GetImageProducer()->removeConsumer( _rxConsumer ); -} - -//-------------------------------------------------------------------- -void SAL_CALL OImageControlModel::startProduction( ) throw (RuntimeException) -{ - GetImageProducer()->startProduction(); -} - - -//================================================================== -// OImageControlControl -//================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OImageControlControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OImageControlControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OImageControlControl::_getTypes() -{ - static Sequence<Type> aTypes; - if (!aTypes.getLength()) - { - // my base class - Sequence<Type> aBaseClassTypes = OBoundControl::_getTypes(); - - Sequence<Type> aOwnTypes(1); - Type* pOwnTypes = aOwnTypes.getArray(); - pOwnTypes[0] = getCppuType((Reference<XMouseListener>*)NULL); - - aTypes = concatSequences(aBaseClassTypes, aOwnTypes); - } - return aTypes; -} - -//------------------------------------------------------------------------------ -OImageControlControl::OImageControlControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_IMAGECONTROL) -{ - increment(m_refCount); - { - // als Focus- und MouseListener anmelden - Reference<XWindow> xComp; - query_aggregation( m_xAggregate, xComp); - if (xComp.is()) - xComp->addMouseListener(this); - } - // Refcount bei 1 fuer den Listener - sal_Int32 n = decrement(m_refCount); -} - -// UNO Anbindung -//------------------------------------------------------------------------------ -Any SAL_CALL OImageControlControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = ::cppu::queryInterface(_rType - ,static_cast<XMouseListener*>(this) - ); - - return aReturn; -} - -//------------------------------------------------------------------------------ -StringSequence OImageControlControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_IMAGECONTROL; - return aSupported; -} - -// XControl -//------------------------------------------------------------------------------ -void SAL_CALL OImageControlControl::createPeer(const Reference<XToolkit>& _rxToolkit, const Reference<XWindowPeer>& Parent) throw( RuntimeException ) -{ - OBoundControl::createPeer(_rxToolkit, Parent); - // the following is not necessary anymore. The aggregated control (from the toolkit project) - // itself will register as image consumer at the image producer, so there's no need to do this ourself. - // This holds since our model is an XImageProducer itself, and thus hiding the XImageProducer of the aggregated - // model. Before, we had two ImageProducers working in parallel. - // 2003-05-15 - 109591 - fs@openoffice.org - -/** - if (!m_xControl.is()) - return; - - // ImageConsumer vom Control holen - Reference<XWindowPeer> xPeer = m_xControl->getPeer(); - Reference<XImageConsumer> xImageConsumer(xPeer, UNO_QUERY); - if (!xImageConsumer.is()) - return; - - // ImageConsumer am Imageproducer setzen - Reference<XImageProducerSupplier> xImageSource(m_xControl->getModel(), UNO_QUERY); - if (!xImageSource.is()) - return; - Reference<XImageProducer> xImageProducer = xImageSource->getImageProducer(); - - xImageProducer->addConsumer(xImageConsumer); - xImageProducer->startProduction(); -*/ -} - -//------------------------------------------------------------------------------ -void OImageControlControl::implClearGraphics() -{ - Reference< XPropertySet > xSet( getModel(), UNO_QUERY ); - if ( xSet.is() ) - xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString() ) ); -} - -//------------------------------------------------------------------------------ -void OImageControlControl::implInsertGraphics() -{ -// Reference< XPropertySet > xSet( getModel(), UNO_QUERY ); -// if ( !xSet.is() ) -// return; - -// ::rtl::OUString sTitle = FRM_RES_STRING(RID_STR_IMPORT_GRAPHIC); -// // build some arguments for the upcoming dialog -// try -// { -// ::binfilter::sfx2::FileDialogHelper aDialog( ::binfilter::sfx2::FILEOPEN_LINK_PREVIEW, SFXWB_GRAPHIC );//STRIP008 ::sfx2::FileDialogHelper aDialog( ::sfx2::FILEOPEN_LINK_PREVIEW, SFXWB_GRAPHIC ); -// aDialog.SetTitle( sTitle ); - -// Reference< XFilePickerControlAccess > xController(aDialog.GetFilePicker(), UNO_QUERY); -// DBG_ASSERT( xController.is(), "OImageControlControl::implInsertGraphics: invalid file picker!" ); -// if ( xController.is() ) -// { -// xController->setValue(ExtendedFilePickerElementIds::CHECKBOX_PREVIEW, 0, ::cppu::bool2any(sal_True)); -// xController->enableControl(ExtendedFilePickerElementIds::CHECKBOX_LINK, sal_False); -// } - -// if ( ERRCODE_NONE == aDialog.Execute() ) -// { -// // reset the url property in case it already has the value we're about to set - in this case -// // our propertyChanged would not get called without this. -// implClearGraphics(); - -// xSet->setPropertyValue( PROPERTY_IMAGE_URL, makeAny( ::rtl::OUString( aDialog.GetPath() ) ) ); -// } -// } -// catch(Exception&) -// { -// DBG_ERROR("OImageControlControl::implInsertGraphics: caught an exception while attempting to execute the FilePicker!"); -// } -} - -// MouseListener -//------------------------------------------------------------------------------ -void OImageControlControl::mousePressed(const ::com::sun::star::awt::MouseEvent& e) throw ( ::com::sun::star::uno::RuntimeException) -{ - ////////////////////////////////////////////////////////////////////// - // Nur linke Maustaste - if (e.Buttons != MouseButton::LEFT) - return; - - // is this a request for a context menu? - if ( e.PopupTrigger ) - { - Reference< XPopupMenu > xMenu( m_xServiceFactory->createInstance( ::rtl::OUString::createFromAscii( "com.sun.star.awt.PopupMenu" ) ), UNO_QUERY ); - DBG_ASSERT( xMenu.is(), "OImageControlControl::mousePressed: could not create a popup menu!" ); - - Reference< XWindowPeer > xWindowPeer = getPeer(); - DBG_ASSERT( xWindowPeer.is(), "OImageControlControl::mousePressed: no window!" ); - - if ( xMenu.is() && xWindowPeer.is() ) - { - xMenu->insertItem( ID_OPEN_GRAPHICS, FRM_RES_STRING( RID_STR_OPEN_GRAPHICS ), 0, 0 ); - xMenu->insertItem( ID_CLEAR_GRAPHICS, FRM_RES_STRING( RID_STR_CLEAR_GRAPHICS ), 0, 1 ); - - // check if the ImageURL is empty - ::rtl::OUString sCurrentURL; - Reference< XPropertySet > xSet( getModel(), UNO_QUERY ); - if ( xSet.is() ) - xSet->getPropertyValue( PROPERTY_IMAGE_URL ) >>= sCurrentURL; - if ( 0 == sCurrentURL.getLength() ) - xMenu->enableItem( ID_CLEAR_GRAPHICS, sal_False ); - - awt::Rectangle aRect( e.X, e.Y, 0, 0 ); - if ( ( e.X < 0 ) || ( e.Y < 0 ) ) - { // context menu triggered by keyboard - // position it in the center of the control - // 102205 - 16.08.2002 - fs@openoffice.org - Reference< XWindow > xWindow( static_cast< ::cppu::OWeakObject* >( this ), UNO_QUERY ); - OSL_ENSURE( xWindow.is(), "OImageControlControl::mousePressed: me not a window? How this?" ); - if ( xWindow.is() ) - { - awt::Rectangle aPosSize = xWindow->getPosSize(); - aRect.X = aPosSize.Width / 2; - aRect.Y = aPosSize.Height / 2; - } - } - - const sal_Int16 nResult = xMenu->execute( xWindowPeer, aRect, PopupMenuDirection::EXECUTE_DEFAULT ); - - switch ( nResult ) - { - case ID_OPEN_GRAPHICS: - implInsertGraphics(); - break; - - case ID_CLEAR_GRAPHICS: - implClearGraphics(); - break; - } - } - } - else - { - ////////////////////////////////////////////////////////////////////// - // Doppelclick - if (e.ClickCount == 2) - { - - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (!xSet.is()) - return; - - // wenn Control nicht gebunden ist, kein Dialog (da die zu schickende URL hinterher sowieso - // versanden wuerde) - // FS - #64946# - 19.04.99 - Reference<XPropertySet> xBoundField; - if (hasProperty(PROPERTY_BOUNDFIELD, xSet)) - ::cppu::extractInterface(xBoundField, xSet->getPropertyValue(PROPERTY_BOUNDFIELD)); - if (!xBoundField.is()) - { - // but only if our IMAGE_URL property is handled as if it is transient, which is equivalent to - // an empty control source - if (!hasProperty(PROPERTY_CONTROLSOURCE, xSet) || (::comphelper::getString(xSet->getPropertyValue(PROPERTY_CONTROLSOURCE)).getLength() != 0)) - return; - } - - sal_Bool bReadOnly; - xSet->getPropertyValue(PROPERTY_READONLY) >>= bReadOnly; - if (bReadOnly) - return; - - implInsertGraphics(); - } - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_ListBox.cxx b/binfilter/bf_forms/source/component/forms_ListBox.cxx deleted file mode 100644 index c7077fbc40f8..000000000000 --- a/binfilter/bf_forms/source/component/forms_ListBox.cxx +++ /dev/null @@ -1,1277 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "ListBox.hxx" -#include "property.hrc" -#include "services.hxx" -#include "frm_resource.hxx" -#include "frm_resource.hrc" -#include "BaseListBox.hxx" -#include <comphelper/container.hxx> -#include <comphelper/numbers.hxx> -#include <connectivity/dbconversion.hxx> - -#include <com/sun/star/util/XNumberFormatTypes.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp> -#include <com/sun/star/sdb/XQueriesSupplier.hpp> -#include <com/sun/star/util/NumberFormat.hpp> -#include <com/sun/star/awt/XListBox.hpp> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/sdbc/XConnection.hpp> -#include <com/sun/star/sdb/CommandType.hpp> -#include <connectivity/dbtools.hxx> -#include <vcl/svapp.hxx> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <comphelper/property.hxx> - -#include <com/sun/star/sdbcx/XColumnsSupplier.hpp> - -namespace binfilter { - - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; -using namespace ::dbtools; - -//================================================================== -//= OListBoxModel -//================================================================== -sal_Int32 OListBoxModel::nSelectHandle = -1; -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OListBoxModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OListBoxModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence< Type> OListBoxModel::_getTypes() -{ - return ::comphelper::concatSequences( - OBoundControlModel::_getTypes(), - OListBoxModel_BASE::getTypes(), - OErrorBroadcaster::getTypes() - ); -} - - -DBG_NAME(OListBoxModel) -//------------------------------------------------------------------ -OListBoxModel::OListBoxModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_LISTBOX, FRM_CONTROL_LISTBOX) - // use the old control name for compytibility reasons - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aRefreshListeners(m_aMutex) - ,m_bBoundComponent(sal_False) - ,m_nNULLPos(-1) -{ - DBG_CTOR(OListBoxModel,NULL); - - m_nClassId = FormComponentType::LISTBOX; - m_eListSourceType = ListSourceType_VALUELIST; - m_aBoundColumn <<= (sal_Int16)1; - m_sDataFieldConnectivityProperty = PROPERTY_SELECT_SEQ; - if (OListBoxModel::nSelectHandle == -1) - OListBoxModel::nSelectHandle = getOriginalHandle(PROPERTY_ID_SELECT_SEQ); -} - -//------------------------------------------------------------------ -OListBoxModel::OListBoxModel( const OListBoxModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OBoundControlModel( _pOriginal, _rxFactory ) - ,OErrorBroadcaster( OComponentHelper::rBHelper ) - ,m_aRefreshListeners( m_aMutex ) - ,m_bBoundComponent(sal_False) - ,m_nNULLPos(-1) -{ - DBG_CTOR(OListBoxModel,NULL); - m_eListSourceType = _pOriginal->m_eListSourceType; - m_aBoundColumn = _pOriginal->m_aBoundColumn; -} - -//------------------------------------------------------------------ -OListBoxModel::~OListBoxModel() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR(OListBoxModel,NULL); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OListBoxModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OListBoxModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_LISTBOX; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_LISTBOX; - return aSupported; -} - -//------------------------------------------------------------------------------ -Any SAL_CALL OListBoxModel::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControlModel::queryAggregation( _rType ); - if ( !aReturn.hasValue() ) - aReturn = OListBoxModel_BASE::queryInterface( _rType ); - if ( !aReturn.hasValue() ) - aReturn = OErrorBroadcaster::queryInterface( _rType ); - return aReturn; -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OListBoxModel::disposing() -{ - EventObject aEvt( static_cast< XWeak* >( this ) ); - m_aRefreshListeners.disposeAndClear(aEvt); - - OBoundControlModel::disposing(); - OErrorBroadcaster::disposing(); -} - -// XRefreshable -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxModel::addRefreshListener(const Reference<XRefreshListener>& _rxListener) throw(RuntimeException) -{ - m_aRefreshListeners.addInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxModel::removeRefreshListener(const Reference<XRefreshListener>& _rxListener) throw(RuntimeException) -{ - m_aRefreshListeners.removeInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxModel::refresh() throw(RuntimeException) -{ - { - ::osl::MutexGuard aGuard(m_aMutex); - if (m_eListSourceType != ListSourceType_VALUELIST) - { - if (getField().is()) - m_aValueSeq = StringSequence(); - - if (m_xCursor.is()) - loadData(); - } - } - - EventObject aEvt(static_cast< XWeak*>(this)); - m_aRefreshListeners.notifyEach(&XRefreshListener::refreshed, aEvt); -} - -//------------------------------------------------------------------------------ -void OListBoxModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const -{ - switch (_nHandle) - { - case PROPERTY_ID_BOUNDCOLUMN: - _rValue <<= m_aBoundColumn; - break; - - case PROPERTY_ID_LISTSOURCETYPE: - _rValue <<= m_eListSourceType; - break; - - case PROPERTY_ID_LISTSOURCE: - _rValue <<= m_aListSourceSeq; - break; - - case PROPERTY_ID_VALUE_SEQ: - _rValue <<= m_aValueSeq; - break; - - case PROPERTY_ID_DEFAULT_SELECT_SEQ: - _rValue <<= m_aDefaultSelectSeq; - break; - - default: - OBoundControlModel::getFastPropertyValue(_rValue, _nHandle); - } -} - -//------------------------------------------------------------------------------ -void OListBoxModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw (com::sun::star::uno::Exception) -{ - switch (_nHandle) - { - case PROPERTY_ID_BOUNDCOLUMN : - DBG_ASSERT((_rValue.getValueType().getTypeClass() == TypeClass_SHORT) || (_rValue.getValueType().getTypeClass() == TypeClass_VOID), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - m_aBoundColumn = _rValue; - break; - - case PROPERTY_ID_LISTSOURCETYPE : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<ListSourceType*>(NULL))), - "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_eListSourceType; - break; - - case PROPERTY_ID_LISTSOURCE : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aListSourceSeq; - - if (m_eListSourceType == ListSourceType_VALUELIST) - m_aValueSeq = m_aListSourceSeq; - else if (m_xCursor.is() && !getField().is()) // Listbox bereits mit Datenbank verbunden - // Aenderung der Datenquelle -> neu laden - loadData(); - - break; - - case PROPERTY_ID_VALUE_SEQ : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast<StringSequence*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aValueSeq; - break; - - case PROPERTY_ID_DEFAULT_SELECT_SEQ : - DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast< Sequence<sal_Int16>*>(NULL))), - "OListBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - _rValue >>= m_aDefaultSelectSeq; - - DBG_ASSERT(m_xAggregateFastSet.is(), "OListBoxModel::setFastPropertyValue_NoBroadcast(DEFAULT_SELECT_SEQ) : invalid aggregate !"); - if (m_xAggregateFastSet.is()) - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OListBoxModel::nSelectHandle, _rValue); - } - break; - - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); - } - - if (PROPERTY_ID_STRINGITEMLIST == _nHandle) - _reset(); -} - -//------------------------------------------------------------------------------ -sal_Bool OListBoxModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_BOUNDCOLUMN : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aBoundColumn, ::getCppuType(reinterpret_cast<sal_Int16*>(NULL))); - break; - - case PROPERTY_ID_LISTSOURCETYPE: - bModified = tryPropertyValueEnum(_rConvertedValue, _rOldValue, _rValue, m_eListSourceType); - break; - - case PROPERTY_ID_LISTSOURCE: - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aListSourceSeq); - break; - - case PROPERTY_ID_VALUE_SEQ : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aValueSeq); - break; - - case PROPERTY_ID_DEFAULT_SELECT_SEQ : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_aDefaultSelectSeq); - break; - - default: - return OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - } - return bModified; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OListBoxModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& OListBoxModel::getInfoHelper() -{ - return *const_cast<OListBoxModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void OListBoxModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(13) - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP2(BOUNDCOLUMN, sal_Int16, BOUND, MAYBEVOID); - DECL_PROP1(LISTSOURCETYPE, ListSourceType, BOUND); - DECL_PROP1(LISTSOURCE, StringSequence, BOUND); - DECL_PROP3(VALUE_SEQ, StringSequence, BOUND, READONLY, TRANSIENT); - DECL_PROP1(DEFAULT_SELECT_SEQ, Sequence<sal_Int16>, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OListBoxModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_LISTBOX; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxModel::write(const Reference<stario::XObjectOutputStream>& _rxOutStream) - throw(stario::IOException, RuntimeException) -{ - OBoundControlModel::write(_rxOutStream); - - // Dummy-Seq, um Kompatible zu bleiben, wenn SelectSeq nicht mehr gespeichert wird - Sequence<sal_Int16> aDummySeq; - - // Version - // Version 0x0002: ListSource wird StringSeq - _rxOutStream->writeShort(0x0004); - - // Maskierung fuer any - sal_uInt16 nAnyMask = 0; - if (m_aBoundColumn.getValueType().getTypeClass() != TypeClass_VOID) - nAnyMask |= BOUNDCOLUMN; - - _rxOutStream << nAnyMask; - - _rxOutStream << m_aListSourceSeq; - _rxOutStream << (sal_Int16)m_eListSourceType; - _rxOutStream << aDummySeq; - _rxOutStream << m_aDefaultSelectSeq; - - if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) - { - sal_Int16 nBoundColumn; - m_aBoundColumn >>= nBoundColumn; - _rxOutStream << nBoundColumn; - } - writeHelpTextCompatibly(_rxOutStream); - - // from version 0x0004 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxModel::read(const Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, RuntimeException) -{ - // Bei manchen Variblen muessen Abhaengigkeiten beruecksichtigt werden. - // Deshalb muessen sie explizit ueber setPropertyValue() gesetzt werden. - - OBoundControlModel::read(_rxInStream); - ::osl::MutexGuard aGuard(m_aMutex); - - // Version - sal_uInt16 nVersion = _rxInStream->readShort(); - DBG_ASSERT(nVersion > 0, "OListBoxModel::read : version 0 ? this should never have been written !"); - - if (nVersion > 0x0004) - { - DBG_ERROR("OListBoxModel::read : invalid (means unknown) version !"); - m_aListSourceSeq.realloc(0); - m_aBoundColumn <<= (sal_Int16)0; - m_aValueSeq.realloc(0); - m_eListSourceType = ListSourceType_VALUELIST; - m_aDefaultSelectSeq.realloc(0); - defaultCommonProperties(); - return; - } - - // Maskierung fuer any - sal_uInt16 nAnyMask; - _rxInStream >> nAnyMask; - - // ListSourceSeq - StringSequence aListSourceSeq; - if (nVersion == 0x0001) - { - // ListSourceSeq aus String zusammenstellen; - ::rtl::OUString sListSource; - _rxInStream >> sListSource; - - sal_Int32 nTokens = 1; - const sal_Unicode* pStr = sListSource.getStr(); - while ( *pStr ) - { - if ( *pStr == ';' ) - nTokens++; - pStr++; - } - aListSourceSeq.realloc( nTokens ); - for (sal_uInt16 i=0; i<nTokens; ++i) - { - sal_Int32 nTmp = 0; - aListSourceSeq.getArray()[i] = sListSource.getToken(i,';',nTmp); - } - } - else - _rxInStream >> aListSourceSeq; - - sal_Int16 nListSourceType; - _rxInStream >> nListSourceType; - m_eListSourceType = (ListSourceType)nListSourceType; - Any aListSourceSeqAny; - aListSourceSeqAny <<= aListSourceSeq; - - setFastPropertyValue(PROPERTY_ID_LISTSOURCE, aListSourceSeqAny ); - - // Dummy-Seq, um Kompatible zu bleiben, wenn SelectSeq nicht mehr gespeichert wird - Sequence<sal_Int16> aDummySeq; - _rxInStream >> aDummySeq; - - // DefaultSelectSeq - Sequence<sal_Int16> aDefaultSelectSeq; - _rxInStream >> aDefaultSelectSeq; - Any aDefaultSelectSeqAny; - aDefaultSelectSeqAny <<= aDefaultSelectSeq; - setFastPropertyValue(PROPERTY_ID_DEFAULT_SELECT_SEQ, aDefaultSelectSeqAny); - - // BoundColumn - if ((nAnyMask & BOUNDCOLUMN) == BOUNDCOLUMN) - { - sal_Int16 nValue; - _rxInStream >> nValue; - m_aBoundColumn <<= nValue; - } - - if (nVersion > 2) - readHelpTextCompatibly(_rxInStream); - - // Stringliste muss gelehrt werden, wenn nicht ueber WerteListe gefuellt wird - // dieses kann der Fall sein wenn im alive modus gespeichert wird - if (m_eListSourceType != ListSourceType_VALUELIST && m_xAggregateSet.is()) - { - StringSequence aSequence; - setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aSequence)); - } - - if (nVersion > 3) - readCommonProperties(_rxInStream); - - // Nach dem Lesen die Defaultwerte anzeigen - if (m_aControlSource.getLength()) - // (not if we don't have a control source - the "State" property acts like it is persistent, then - _reset(); -} - -//------------------------------------------------------------------------------ -void OListBoxModel::loadData() -{ - DBG_ASSERT(m_eListSourceType != ListSourceType_VALUELIST, "fuer Werteliste kein Laden aus der Datenbank"); - - m_nNULLPos = -1; - m_bBoundComponent = sal_False; - - // Connection holen - Reference<XRowSet> xForm(m_xCursor, UNO_QUERY); - if (!xForm.is()) - return; - Reference<XConnection> xConnection = getConnection(xForm); - if (!xConnection.is()) - return; - - // we need a com::sun::star::sdb::Connection for some of the code below ... - Reference<XServiceInfo> xServiceInfo(xConnection, UNO_QUERY); - if (!xServiceInfo.is() || !xServiceInfo->supportsService(SRV_SDB_CONNECTION)) - { - DBG_ERROR("OListBoxModel::loadData : invalid connection !"); - return; - } - - Reference< XRowSet > xContentRowSet(m_xServiceFactory->createInstance(SRV_SDB_ROWSET), UNO_QUERY); - Reference< XPropertySet > xContentSetProperties(xContentRowSet, UNO_QUERY); - Reference<XResultSet> xListCursor(xContentSetProperties, UNO_QUERY); - if (!xListCursor.is()) - { - DBG_ERROR("OListBoxModel::loadData: could not instantiate a RowSet!"); - return; - } - - // Wenn der ListSourceType keine Werteliste ist, - // muss die String-Seq zu einem String zusammengefasst werden - ::rtl::OUString sListSource; - const ::rtl::OUString* pustrListSouceStrings = m_aListSourceSeq.getConstArray(); - sal_Int32 i; - for (i=0; i<m_aListSourceSeq.getLength(); ++i) - sListSource = sListSource + pustrListSouceStrings[i]; - if (!sListSource.getLength()) - return; - - sal_Int16 nBoundColumn = 0; - if (m_aBoundColumn.getValueType().getTypeClass() == TypeClass_SHORT) - m_aBoundColumn >>= nBoundColumn; - - try - { - sal_Bool bExecute = sal_False; - switch (m_eListSourceType) - { - case ListSourceType_TABLEFIELDS: - // don't work with a statement here, the fields will be collected below - break; - case ListSourceType_TABLE: - { - Reference<XNameAccess> xFieldsByName = getTableFields(xConnection, sListSource); - Reference<XIndexAccess> xFieldsByIndex(xFieldsByName, UNO_QUERY); - - // do we have a bound column if yes we have to select it - // and the displayed column is the first column othwhise we act as a combobox - ::rtl::OUString aFieldName; - ::rtl::OUString aBoundFieldName; - - if ((nBoundColumn > 0) && xFieldsByIndex.is()) - { - if (xFieldsByIndex->getCount() <= nBoundColumn) - break; - - Reference<XPropertySet> xFieldAsSet; - xFieldsByIndex->getByIndex(nBoundColumn) >>= xFieldAsSet; - xFieldAsSet->getPropertyValue(PROPERTY_NAME) >>= aBoundFieldName; - nBoundColumn = 1; - - xFieldsByIndex->getByIndex(0) >>= xFieldAsSet; - xFieldAsSet->getPropertyValue(PROPERTY_NAME) >>= aFieldName; - } - else if (xFieldsByName.is()) - { - if (xFieldsByName->hasByName(m_aControlSource)) - aFieldName = m_aControlSource; - else - { - // otherwise look for the alias - Reference<XSQLQueryComposerFactory> xFactory(xConnection, UNO_QUERY); - if (!xFactory.is()) - break; - - Reference<XSQLQueryComposer> xComposer = xFactory->createQueryComposer(); - try - { - Reference<XPropertySet> xFormAsSet(xForm, UNO_QUERY); - ::rtl::OUString aStatement; - xFormAsSet->getPropertyValue(PROPERTY_ACTIVECOMMAND) >>= aStatement; - xComposer->setQuery(aStatement); - } - catch(Exception&) - { - disposeComponent(xComposer); - break; - } - - // search the field - Reference<XColumnsSupplier> xSupplyFields(xComposer, UNO_QUERY); - DBG_ASSERT(xSupplyFields.is(), "OListBoxModel::loadData : invalid query composer !"); - - Reference<XNameAccess> xFieldNames = xSupplyFields->getColumns(); - if (xFieldNames->hasByName(m_aControlSource)) - { - Reference<XPropertySet> xComposerFieldAsSet; - xFieldNames->getByName(m_aControlSource) >>= xComposerFieldAsSet; - if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet)) - xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName; - } - disposeComponent(xComposer); - } - } - if (!aFieldName.getLength()) - break; - - Reference<XDatabaseMetaData> xMeta = xConnection->getMetaData(); - ::rtl::OUString aQuote = xMeta->getIdentifierQuoteString(); - ::rtl::OUString aStatement = ::rtl::OUString::createFromAscii("SELECT "); - if (!aBoundFieldName.getLength()) // act like a combobox - aStatement += ::rtl::OUString::createFromAscii("DISTINCT "); - - aStatement += quoteName(aQuote,aFieldName); - if (aBoundFieldName.getLength()) - { - aStatement += ::rtl::OUString::createFromAscii(", "); - aStatement += quoteName(aQuote, aBoundFieldName); - } - aStatement += ::rtl::OUString::createFromAscii(" FROM "); - aStatement += quoteTableName(xMeta, sListSource,::dbtools::eInDataManipulation); - - xContentSetProperties->setPropertyValue(PROPERTY_COMMAND, makeAny(aStatement)); - bExecute = sal_True; - } break; - case ListSourceType_QUERY: - { - Reference<XQueriesSupplier> xSupplyQueries(xConnection, UNO_QUERY); - Reference<XPropertySet> xQuery(*(InterfaceRef*)xSupplyQueries->getQueries()->getByName(sListSource).getValue(), UNO_QUERY); - xContentSetProperties->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, xQuery->getPropertyValue(PROPERTY_ESCAPE_PROCESSING)); - - xContentSetProperties->setPropertyValue(PROPERTY_COMMAND, xQuery->getPropertyValue(PROPERTY_COMMAND)); - bExecute = sal_True; - } break; - default: - { - if (ListSourceType_SQLPASSTHROUGH == m_eListSourceType) - xContentSetProperties->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, ::cppu::bool2any((sal_False))); - xContentSetProperties->setPropertyValue(PROPERTY_COMMAND, makeAny(sListSource)); - bExecute = sal_True; - } - } - - if (bExecute) - { - Reference< XPropertySet > xFormProps(xForm, UNO_QUERY); - - xContentSetProperties->setPropertyValue( PROPERTY_COMMANDTYPE, makeAny( CommandType::COMMAND ) ); - xContentSetProperties->setPropertyValue( PROPERTY_DATASOURCE, xFormProps->getPropertyValue( PROPERTY_DATASOURCE ) ); - - // try to give the row set the connection of our form - this saves the rowset from creating an own one - xContentSetProperties->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, xFormProps->getPropertyValue( PROPERTY_ACTIVE_CONNECTION ) ); - - xContentRowSet->execute(); - } - } - catch(SQLException& eSQL) - { - onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST)); - disposeComponent(xListCursor); - return; - } - catch(Exception& eUnknown) - { - eUnknown; - disposeComponent(xListCursor); - return; - } - - if (ListSourceType_TABLEFIELDS != m_eListSourceType && !xListCursor.is()) - // something went wrong ... - return; - - // Anzeige- und Werteliste fuellen - ::std::vector< ::rtl::OUString > aValueList, aStringList; - aValueList.reserve(16); - aStringList.reserve(16); - sal_Bool bUseNULL = getField().is() && !m_bRequired; - try - { - switch (m_eListSourceType) - { - case ListSourceType_SQL: - case ListSourceType_SQLPASSTHROUGH: - case ListSourceType_TABLE: - case ListSourceType_QUERY: - { - // Feld der 1. Column des ResultSets holen - Reference<XColumnsSupplier> xSupplyCols(xListCursor, UNO_QUERY); - DBG_ASSERT(xSupplyCols.is(), "OListBoxModel::loadData : cursor supports the row set service but is no column supplier ??!"); - Reference<XIndexAccess> xColumns; - if (xSupplyCols.is()) - { - xColumns = Reference<XIndexAccess>(xSupplyCols->getColumns(), UNO_QUERY); - DBG_ASSERT(xColumns.is(), "OListBoxModel::loadData : no columns supplied by the row set !"); - } - Reference<XColumn> xDataField; - if (xColumns.is()) - xColumns->getByIndex(0) >>= xDataField; - if (!xDataField.is()) - { - disposeComponent(xListCursor); - return; - } - - Reference<XNumberFormatsSupplier> xSupplier = getNumberFormats(xConnection, sal_False, m_xServiceFactory); - - ::com::sun::star::util::Date aNullDate(DBTypeConversion::getStandardDate()); - sal_Int32 nFormatKey = 0; - sal_Int32 nFieldType = DataType::OTHER; - sal_Int16 nKeyType = NumberFormat::UNDEFINED; - sal_Bool bHaveFormat = sal_False; - Reference<XPropertySet> xFieldAsSet(xDataField, UNO_QUERY); - try - { - xFieldAsSet->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType; - bHaveFormat = (xFieldAsSet->getPropertyValue(PROPERTY_FORMATKEY) >>= nFormatKey); - } - catch(Exception&) - { - DBG_ERROR("OListBoxModel::loadData: could not obtain the field type and/or format key of the bound column!"); - } - - if (!bHaveFormat) - { - Locale aAppLanguage = Application::GetSettings().GetUILocale(); - if (xSupplier.is()) - { - Reference< XNumberFormatTypes > xNumTypes(xSupplier->getNumberFormats(), UNO_QUERY); - if (xNumTypes.is()) - nFormatKey = getDefaultNumberFormat(xFieldAsSet, xNumTypes, aAppLanguage); - } - } - - Reference<XNumberFormatter> xFormatter; - if (xSupplier.is()) - { - xFormatter = Reference<XNumberFormatter>( - m_xServiceFactory->createInstance(FRM_NUMBER_FORMATTER), - UNO_QUERY - ); - if (xFormatter.is()) - { - xFormatter->attachNumberFormatsSupplier(xSupplier); - xFormatter->getNumberFormatsSupplier()->getNumberFormatSettings()->getPropertyValue( - ::rtl::OUString::createFromAscii("NullDate")) >>= aNullDate; - nKeyType = getNumberFormatType(xFormatter->getNumberFormatsSupplier()->getNumberFormats(), nFormatKey); - } - } - - // Feld der BoundColumn des ResultSets holen - Reference<XColumn> xBoundField; - if ((nBoundColumn > 0) && m_xColumn.is()) - // don't look for a bound column if we're not connected to a field - xColumns->getByIndex(nBoundColumn) >>= xBoundField; - m_bBoundComponent = xBoundField.is(); - - // Ist die LB an ein Feld gebunden und sind Leereintraege zulaessig - // dann wird die Position fuer einen Leereintrag gemerkt - - ::rtl::OUString aStr; - sal_Int16 i = 0; - // per definitionem the list cursor is positioned _before_ the first row at the moment - while (xListCursor->next() && (i++<SHRT_MAX)) // max anzahl eintraege - { - aStr = DBTypeConversion::getValue(xDataField, - xFormatter, - aNullDate, - nFormatKey, - nKeyType); - - aStringList.push_back(aStr); - - if (m_bBoundComponent) - { - aStr = xBoundField->getString(); - aValueList.push_back(aStr); - } - - if (bUseNULL && (m_nNULLPos == -1) && !aStr.getLength()) - m_nNULLPos = (sal_Int16)aStringList.size() - 1; - } - } - break; - - case ListSourceType_TABLEFIELDS: - { - Reference<XNameAccess> xFieldNames = getTableFields(xConnection, sListSource); - if (xFieldNames.is()) - { - StringSequence seqNames = xFieldNames->getElementNames(); - sal_Int32 nFieldsCount = seqNames.getLength(); - const ::rtl::OUString* pustrNames = seqNames.getConstArray(); - - for (sal_Int32 k=0; k<nFieldsCount; ++k, ++pustrNames) - aStringList.push_back(*pustrNames); - } - } - break; - } - } - catch(SQLException& eSQL) - { - onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST)); - disposeComponent(xListCursor); - return; - } - catch(Exception& eUnknown) - { - eUnknown; - disposeComponent(xListCursor); - return; - } - - - // Value-Sequence erzeugen - // NULL eintrag hinzufuegen - if (bUseNULL && m_nNULLPos == -1) - { - if (m_bBoundComponent) - aValueList.insert(aValueList.begin(), ::rtl::OUString()); - - aStringList.insert(aStringList.begin(), ::rtl::OUString()); - m_nNULLPos = 0; - } - - m_aValueSeq.realloc(aValueList.size()); - ::rtl::OUString* pustrValues = m_aValueSeq.getArray(); - for (i = 0; i < (sal_Int32)aValueList.size(); ++i) - pustrValues[i] = aValueList[i]; - - // String-Sequence fuer ListBox erzeugen - StringSequence aStringSeq(aStringList.size()); - ::rtl::OUString* pustrStrings = aStringSeq.getArray(); - for (i = 0; i < (sal_Int32)aStringList.size(); ++i) - pustrStrings[i] = aStringList[i]; - - setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aStringSeq)); - - - // Statement + Cursor zerstoeren - disposeComponent(xListCursor); -} - -//------------------------------------------------------------------------------ -void OListBoxModel::_loaded(const EventObject& rEvent) -{ - // an Felder gebundene Listboxen haben keine Multiselektion - if (getField().is()) - { - setFastPropertyValue(PROPERTY_ID_MULTISELECTION, ::cppu::bool2any((sal_False))); - } - - if (m_eListSourceType != ListSourceType_VALUELIST) - { - if (getField().is()) - m_aValueSeq = StringSequence(); - - if (m_xCursor.is()) - loadData(); - } -} - -//------------------------------------------------------------------------------ -void OListBoxModel::_unloaded() -{ - if (m_eListSourceType != ListSourceType_VALUELIST) - { - m_aValueSeq = StringSequence(); - m_nNULLPos = -1; - m_bBoundComponent = sal_False; - - StringSequence aSequence; - setFastPropertyValue(PROPERTY_ID_STRINGITEMLIST, makeAny(aSequence)); - } -} - -//------------------------------------------------------------------------------ -StringSequence OListBoxModel::GetCurValueSeq() const -{ - StringSequence aCurValues; - - // Aus den selektierten Indizes Werte-Sequence aufbauen - DBG_ASSERT(m_xAggregateFastSet.is(), "OListBoxModel::GetCurValueSeq : invalid aggregate !"); - if (!m_xAggregateFastSet.is()) - return aCurValues; - Any aTmp = m_xAggregateFastSet->getFastPropertyValue(OListBoxModel::nSelectHandle); - - Sequence<sal_Int16> aSelectSeq; aTmp >>= aSelectSeq; - const sal_Int16 *pSels = aSelectSeq.getConstArray(); - sal_uInt32 nSelCount = aSelectSeq.getLength(); - - if (nSelCount) - { - const ::rtl::OUString *pVals = NULL; - sal_Int32 nValCnt = 0; - if (m_aValueSeq.getLength()) - { - pVals = m_aValueSeq.getConstArray(); - nValCnt = m_aValueSeq.getLength(); - } - else - { - aTmp = const_cast<OListBoxModel*>(this)->OPropertySetAggregationHelper::getFastPropertyValue(PROPERTY_ID_STRINGITEMLIST); - pVals = (*(StringSequence*)aTmp.getValue()).getConstArray(); - nValCnt = (*(StringSequence*)aTmp.getValue()).getLength(); - } - - if (nSelCount > 1) - { - // Einfach- oder Mehrfach-Selektion - sal_Bool bMultiSel; - const_cast<OListBoxModel*>(this)->OPropertySetAggregationHelper::getFastPropertyValue(PROPERTY_ID_MULTISELECTION) >>= bMultiSel; - if (bMultiSel) - nSelCount = 1; - } - - // ist der Eintrag fuer NULL selektiert ? - // dann leere Selektion liefern - if (m_nNULLPos != -1 && nSelCount == 1 && pSels[0] == m_nNULLPos) - nSelCount = 0; - - aCurValues.realloc(nSelCount); - ::rtl::OUString *pCurVals = aCurValues.getArray(); - - for (sal_uInt16 i = 0; i < nSelCount; i++) - { - if (pSels[i] < nValCnt) - pCurVals[i] = pVals[pSels[i]]; - } - } - return aCurValues; -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool OListBoxModel::_commit() -{ - // derzeitige Selectionsliste - Any aNewValue; - StringSequence aCurValueSeq = GetCurValueSeq(); - if (aCurValueSeq.getLength()) - aNewValue <<= aCurValueSeq.getConstArray()[0]; - - if (!compare(aNewValue, m_aSaveValue)) - { - if (!aNewValue.hasValue()) - m_xColumnUpdate->updateNull(); - else - { - try - { - ::rtl::OUString sNewValue; - aNewValue >>= sNewValue; - m_xColumnUpdate->updateString(sNewValue); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -// XPropertiesChangeListener -//------------------------------------------------------------------------------ -void OListBoxModel::_onValueChanged() -{ - DBG_ASSERT(m_xAggregateFastSet.is() && m_xAggregateSet.is(), "OListBoxModel::_onValueChanged : invalid aggregate !"); - if (!m_xAggregateFastSet.is() || !m_xAggregateSet.is()) - return; - - Sequence<sal_Int16> aSelSeq; - - // Bei NULL-Eintraegen Selektion aufheben! - ::rtl::OUString sValue = m_xColumn->getString(); - if (m_xColumn->wasNull()) - { - m_aSaveValue.clear(); - if (m_nNULLPos != -1) - { - aSelSeq.realloc(1); - aSelSeq.getArray()[0] = m_nNULLPos; - } - } - else - { - m_aSaveValue <<= sValue; - - // In der Werteliste nur einzelne Werte suchen, wenn das Control mit einem Datenbankfeld verbunden ist - if (m_aValueSeq.getLength()) // WerteListe - aSelSeq = findValue(m_aValueSeq, sValue, m_bBoundComponent); - else - { - StringSequence aStringSeq; m_xAggregateSet->getPropertyValue(PROPERTY_STRINGITEMLIST) >>= aStringSeq; - aSelSeq = findValue(aStringSeq, sValue, m_bBoundComponent); - } - } - Any aSelectAny; - aSelectAny <<= aSelSeq; - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OListBoxModel::nSelectHandle, aSelectAny ); - } -} - -// XReset -//------------------------------------------------------------------------------ -void OListBoxModel::_reset( void ) -{ - DBG_ASSERT(m_xAggregateFastSet.is() && m_xAggregateSet.is(), "OListBoxModel::reset : invalid aggregate !"); - if (!m_xAggregateFastSet.is() || !m_xAggregateSet.is()) - return; - - Any aValue; - if (m_aDefaultSelectSeq.getLength()) - aValue <<= m_aDefaultSelectSeq; - else if (m_nNULLPos != -1) // gebundene Listbox - { - Sequence<sal_Int16> aSeq(1); - aSeq.getArray()[0] = m_nNULLPos; - aValue <<= aSeq; - } - else - { - Sequence<sal_Int16> aSeq; - aValue <<= aSeq; - } - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OListBoxModel::nSelectHandle, aValue); - } -} - -//================================================================== -// OListBoxControl -//================================================================== - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OListBoxControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new OListBoxControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence< Type> OListBoxControl::_getTypes() -{ - static Sequence< Type> aTypes; - if (!aTypes.getLength()) - aTypes = concatSequences(OBoundControl::_getTypes(), OListBoxControl_BASE::getTypes()); - return aTypes; -} - -//------------------------------------------------------------------ -Any SAL_CALL OListBoxControl::queryAggregation(const Type& _rType) throw (RuntimeException) -{ - Any aReturn = OBoundControl::queryAggregation(_rType); - if (!aReturn.hasValue()) - aReturn = OListBoxControl_BASE::queryInterface(_rType); - - return aReturn; -} - -DBG_NAME(OListBoxControl) -//------------------------------------------------------------------------------ -OListBoxControl::OListBoxControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_LISTBOX) - ,m_aChangeListeners(m_aMutex) -{ - DBG_CTOR(OListBoxControl,NULL); - - increment(m_refCount); - { - // als FocusListener anmelden - Reference<XWindow> xComp; - if (query_aggregation(m_xAggregate, xComp)) - xComp->addFocusListener(this); - - // als ItemListener anmelden - Reference<XListBox> xListbox; - if (query_aggregation(m_xAggregate, xListbox)) - xListbox->addItemListener(this); - } - // Refcount bei 2 fuer angemeldete Listener - decrement(m_refCount); - - m_aChangeTimer.SetTimeout(500); - m_aChangeTimer.SetTimeoutHdl(LINK(this,OListBoxControl,OnTimeout)); -} - -//------------------------------------------------------------------------------ -OListBoxControl::~OListBoxControl() -{ - if (!OComponentHelper::rBHelper.bDisposed) - { - acquire(); - dispose(); - } - - DBG_DTOR(OListBoxControl,NULL); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OListBoxControl::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_LISTBOX; - return aSupported; -} - - -// XFocusListener -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxControl::focusGained(const FocusEvent& _rEvent) throw(RuntimeException) -{ - ::osl::MutexGuard aGuard(m_aMutex); - if (m_aChangeListeners.getLength()) // only if there are listeners - { - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (xSet.is()) - { - // memorize the current selection for posting the change event - m_aCurrentSelection = xSet->getPropertyValue(PROPERTY_SELECT_SEQ); - } - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxControl::focusLost(const FocusEvent& _rEvent) throw(RuntimeException) -{ - m_aCurrentSelection.clear(); -} - -// XItemListener -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxControl::itemStateChanged(const ItemEvent& _rEvent) throw(RuntimeException) -{ - // call the changelistener delayed - ::osl::ClearableMutexGuard aGuard(m_aMutex); - if (m_aChangeTimer.IsActive()) - { - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - m_aCurrentSelection = xSet->getPropertyValue(PROPERTY_SELECT_SEQ); - - m_aChangeTimer.Stop(); - m_aChangeTimer.Start(); - } - else - { - if (m_aChangeListeners.getLength() && m_aCurrentSelection.hasValue()) - { - Reference<XPropertySet> xSet(getModel(), UNO_QUERY); - if (xSet.is()) - { - // Has the selection been changed? - sal_Bool bModified(sal_False); - Any aValue = xSet->getPropertyValue(PROPERTY_SELECT_SEQ); - - Sequence<sal_Int16>& rSelection = *(Sequence<sal_Int16> *)aValue.getValue(); - Sequence<sal_Int16>& rOldSelection = *(Sequence<sal_Int16> *)m_aCurrentSelection.getValue(); - sal_Int32 nLen = rSelection.getLength(); - if (nLen != rOldSelection.getLength()) - bModified = sal_True; - else - { - const sal_Int16* pVal = rSelection.getConstArray(); - const sal_Int16* pCompVal = rOldSelection.getConstArray(); - - while (nLen-- && !bModified) - bModified = pVal[nLen] != pCompVal[nLen]; - } - - if (bModified) - { - m_aCurrentSelection = aValue; - m_aChangeTimer.Start(); - } - } - } - else if (m_aCurrentSelection.hasValue()) - m_aCurrentSelection.clear(); - } -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxControl::disposing(const EventObject& _rSource) throw (RuntimeException) -{ - OBoundControl::disposing(_rSource); -} - -// XChangeBroadcaster -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxControl::addChangeListener(const Reference<XChangeListener>& _rxListener) throw(RuntimeException) -{ - m_aChangeListeners.addInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OListBoxControl::removeChangeListener(const Reference<XChangeListener>& _rxListener) throw(RuntimeException) -{ - m_aChangeListeners.removeInterface(_rxListener); -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OListBoxControl::disposing() -{ - if (m_aChangeTimer.IsActive()) - m_aChangeTimer.Stop(); - - EventObject aEvt(static_cast< XWeak*>(this)); - m_aChangeListeners.disposeAndClear(aEvt); - - OBoundControl::disposing(); -} - -//------------------------------------------------------------------------------ -IMPL_LINK(OListBoxControl, OnTimeout, void*, EMPTYTAG) -{ - EventObject aEvt(static_cast< XWeak*>(this)); - m_aChangeListeners.notifyEach(&XChangeListener::changed, aEvt); - return 1; -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Numeric.cxx b/binfilter/bf_forms/source/component/forms_Numeric.cxx deleted file mode 100644 index 0cee3d764d4f..000000000000 --- a/binfilter/bf_forms/source/component/forms_Numeric.cxx +++ /dev/null @@ -1,257 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Numeric.hxx" - - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// ONumericControl -//================================================================== - -//------------------------------------------------------------------ -ONumericControl::ONumericControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_NUMERICFIELD) -{ -} - -//------------------------------------------------------------------------------ -StringSequence ONumericControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_NUMERICFIELD; - return aSupported; -} - - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL ONumericControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new ONumericControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> ONumericControl::_getTypes() -{ - return OBoundControl::_getTypes(); -} - -//================================================================== -// ONumericModel -//================================================================== -sal_Int32 ONumericModel::nValueHandle = -1; -//------------------------------------------------------------------ -InterfaceRef SAL_CALL ONumericModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new ONumericModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> ONumericModel::_getTypes() -{ - return OEditBaseModel::_getTypes(); -} - -//------------------------------------------------------------------ -DBG_NAME( ONumericModel ) -//------------------------------------------------------------------ -ONumericModel::ONumericModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_NUMERICFIELD, FRM_CONTROL_NUMERICFIELD) - // use the old control name for compytibility reasons -{ - DBG_CTOR( ONumericModel, NULL ); - - m_nClassId = FormComponentType::NUMERICFIELD; - m_sDataFieldConnectivityProperty = PROPERTY_VALUE; - if (ONumericModel::nValueHandle == -1) - ONumericModel::nValueHandle = getOriginalHandle(PROPERTY_ID_VALUE); -} - -//------------------------------------------------------------------ -ONumericModel::ONumericModel( const ONumericModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( ONumericModel, NULL ); -} - -//------------------------------------------------------------------ -ONumericModel::~ONumericModel() -{ - DBG_DTOR( ONumericModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( ONumericModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence ONumericModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_NUMERICFIELD; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_NUMERICFIELD; - return aSupported; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL ONumericModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void ONumericModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(9) - // Value auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_VALUE, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP3(DEFAULT_VALUE, double, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet,BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& ONumericModel::getInfoHelper() -{ - return *const_cast<ONumericModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL ONumericModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_NUMERICFIELD; // old (non-sun) name for compatibility ! -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool ONumericModel::_commit() -{ - Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( ONumericModel::nValueHandle ); - if (!compare(aNewValue, m_aSaveValue)) - { - if (!aNewValue.hasValue()) - m_xColumnUpdate->updateNull(); - else - { - try - { - m_xColumnUpdate->updateDouble(getDouble(aNewValue)); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -void ONumericModel::_onValueChanged() -{ - m_aSaveValue <<= (double)m_xColumn->getDouble(); - if (m_xColumn->wasNull()) - m_aSaveValue.clear(); - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(ONumericModel::nValueHandle, m_aSaveValue); - } -} - -// XReset -//------------------------------------------------------------------------------ -void ONumericModel::_reset() -{ - Any aValue; - if (m_aDefault.getValueType().getTypeClass() == TypeClass_DOUBLE) - aValue = m_aDefault; - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(ONumericModel::nValueHandle, aValue); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Pattern.cxx b/binfilter/bf_forms/source/component/forms_Pattern.cxx deleted file mode 100644 index 2cf8ede0fcdd..000000000000 --- a/binfilter/bf_forms/source/component/forms_Pattern.cxx +++ /dev/null @@ -1,252 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Pattern.hxx" - - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -// OPatternControl -//================================================================== -//------------------------------------------------------------------ -OPatternControl::OPatternControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_PATTERNFIELD) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OPatternControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OPatternControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OPatternControl::_getTypes() -{ - return OBoundControl::_getTypes(); -} - -//------------------------------------------------------------------------------ -StringSequence OPatternControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_PATTERNFIELD; - return aSupported; -} - -//================================================================== -// OPatternModel -//================================================================== -sal_Int32 OPatternModel::nTextHandle = -1; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OPatternModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OPatternModel(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OPatternModel::_getTypes() -{ - return OEditBaseModel::_getTypes(); -} - -//------------------------------------------------------------------ -DBG_NAME( OPatternModel ) -//------------------------------------------------------------------ -OPatternModel::OPatternModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_PATTERNFIELD, FRM_CONTROL_PATTERNFIELD) - // use the old control name for compytibility reasons -{ - DBG_CTOR( OPatternModel, NULL ); - - m_nClassId = FormComponentType::PATTERNFIELD; - m_sDataFieldConnectivityProperty = PROPERTY_TEXT; - if (OPatternModel::nTextHandle == -1) - OPatternModel::nTextHandle = getOriginalHandle(PROPERTY_ID_TEXT); -} - -//------------------------------------------------------------------ -OPatternModel::OPatternModel( const OPatternModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) -{ - DBG_CTOR( OPatternModel, NULL ); -} - -//------------------------------------------------------------------ -OPatternModel::~OPatternModel() -{ - DBG_DTOR( OPatternModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OPatternModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OPatternModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_PATTERNFIELD; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_PATTERNFIELD; - return aSupported; -} - - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OPatternModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void OPatternModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(11) - // Text auf transient setzen -// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, PropertyAttribute::TRANSIENT, 0); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP2(DEFAULT_TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT); - DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_PROP2(FILTERPROPOSAL, sal_Bool, BOUND, MAYBEDEFAULT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OPatternModel::getInfoHelper() -{ - return *const_cast<OPatternModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OPatternModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_PATTERNFIELD; // old (non-sun) name for compatibility ! -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool OPatternModel::_commit() -{ - ::rtl::OUString aNewValue = getString(m_xAggregateFastSet->getFastPropertyValue( OPatternModel::nTextHandle )); - if (aNewValue != m_aSaveValue) - { - if (!aNewValue.getLength() && !m_bRequired && m_bEmptyIsNull) - m_xColumnUpdate->updateNull(); - else - { - try - { - m_xColumnUpdate->updateString(aNewValue); - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void OPatternModel::_onValueChanged() -{ - m_aSaveValue = m_xColumn->getString(); - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OPatternModel::nTextHandle, makeAny(m_aSaveValue)); - } -} - -// XReset -//------------------------------------------------------------------------------ -void OPatternModel::_reset( void ) -{ - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OPatternModel::nTextHandle, makeAny(m_aDefaultText)); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_RadioButton.cxx b/binfilter/bf_forms/source/component/forms_RadioButton.cxx deleted file mode 100644 index 2e705fdfa998..000000000000 --- a/binfilter/bf_forms/source/component/forms_RadioButton.cxx +++ /dev/null @@ -1,535 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "RadioButton.hxx" -#include "property.hrc" -#include "services.hxx" - -#include <com/sun/star/container/XIndexAccess.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include <com/sun/star/form/FormComponentType.hpp> - -#include <comphelper/property.hxx> - -namespace binfilter { - -//......................................................................... -namespace frm -{ -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -//using namespace ::com::sun::star::sdbcx; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::util; - -//================================================================== -//------------------------------------------------------------------------------ -InterfaceRef SAL_CALL ORadioButtonControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new ORadioButtonControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL ORadioButtonControl::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_RADIOBUTTON; - return aSupported; -} - - -//------------------------------------------------------------------ -ORadioButtonControl::ORadioButtonControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_RADIOBUTTON) -{ -} - -//------------------------------------------------------------------ -void SAL_CALL ORadioButtonControl::createPeer(const Reference<starawt::XToolkit>& _rxToolkit, const Reference<starawt::XWindowPeer>& _rxParent) throw (RuntimeException) -{ - OBoundControl::createPeer(_rxToolkit, _rxParent); - - // switch off the auto-toggle, we do this ourself .... - // (formerly this switch-off was done in the toolkit - but the correct place is here ...) -// Reference< XVclWindowPeer > xVclWindowPeer( getPeer(), UNO_QUERY ); -// if (xVclWindowPeer.is()) -// xVclWindowPeer->setProperty(::rtl::OUString::createFromAscii("AutoToggle"), ::cppu::bool2any(sal_False)); - // new order: do _not_ switch off the auto toggle because: - // * today, it is not necessary anymore to handle the toggling ourself (everything works fine without it) - // * without auto toggle, the AccessibleEvents as fired by the radio buttons are - // a. newly checked button: "unchecked"->"checked" - // b. previously checked button: "checked"->"unchecked" - // This is deadly for AT-tools, which then get the "unchecked" event _immediately_ after the "checked" event, - // and only read the latter. This makes radio buttons pretty unusable in form documents. - // So we switched AutoToggle _on_, again, because then VCL can handle the notifications, and will send - // them in the proper order. -} - -//================================================================== -InterfaceRef SAL_CALL ORadioButtonModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException) -{ - return *(new ORadioButtonModel(_rxFactory)); -} - -//------------------------------------------------------------------ -DBG_NAME( ORadioButtonModel ) -//------------------------------------------------------------------ -ORadioButtonModel::ORadioButtonModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_RADIOBUTTON, FRM_CONTROL_RADIOBUTTON, sal_False) - // use the old control name for compytibility reasons - ,OPropertyChangeListener(m_aMutex) - ,m_bInReset(sal_False) -{ - DBG_CTOR( ORadioButtonModel, NULL ); - - m_nClassId = FormComponentType::RADIOBUTTON; - m_nDefaultChecked = RB_NOCHECK; - m_aLabelServiceName = FRM_SUN_COMPONENT_GROUPBOX; - m_sDataFieldConnectivityProperty = PROPERTY_STATE; - - implConstruct(); -} - -//------------------------------------------------------------------ -ORadioButtonModel::ORadioButtonModel( const ORadioButtonModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OBoundControlModel( _pOriginal, _rxFactory, sal_False) - ,OPropertyChangeListener( m_aMutex ) - ,m_bInReset( sal_False ) -{ - DBG_CTOR( ORadioButtonModel, NULL ); - - m_nDefaultChecked = _pOriginal->m_nDefaultChecked; - m_sReferenceValue = _pOriginal->m_sReferenceValue; - - implConstruct(); -} - -//------------------------------------------------------------------------------ -ORadioButtonModel::~ORadioButtonModel() -{ - DBG_DTOR( ORadioButtonModel, NULL ); -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::implConstruct() -{ - increment(m_refCount); - if (m_xAggregateSet.is()) - { - OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet); - pMultiplexer->addProperty(PROPERTY_STATE); - } - decrement(m_refCount); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( ORadioButtonModel ) - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL ORadioButtonModel::getSupportedServiceNames() throw(RuntimeException) -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString* pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_RADIOBUTTON; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_RADIOBUTTON; - return aSupported; -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle) const -{ - switch (nHandle) - { - case PROPERTY_ID_REFVALUE : rValue <<= m_sReferenceValue; break; - case PROPERTY_ID_DEFAULTCHECKED : rValue <<= m_nDefaultChecked; break; - default: - OBoundControlModel::getFastPropertyValue(rValue, nHandle); - } -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, const Any& rValue) -{ - // mein Name - ::rtl::OUString sMyName(m_aName); - - // meine Siblings durchiterieren - Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY); - if (xIndexAccess.is()) - { - Reference<XPropertySet> xMyProps; - query_interface(static_cast<XWeak*>(this), xMyProps); - ::rtl::OUString sCurrentName; - for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i) - { - Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY); - if (!xSiblingProperties.is()) - continue; - if (xMyProps == xSiblingProperties) - continue; // mich selber nicht umsetzen - - // nur wenn es ein Radio-Button ist - if (!hasProperty(PROPERTY_CLASSID, xSiblingProperties)) - continue; - sal_Int16 nType; - xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType; - if (nType != FormComponentType::RADIOBUTTON) - continue; - - // das 'zur selben Gruppe gehoeren' wird am Namen festgemacht - xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sCurrentName; - if (sCurrentName == sMyName) - xSiblingProperties->setPropertyValue(rPropName, rValue); - } - } -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const Any& rValue) throw (Exception) -{ - switch (nHandle) - { - case PROPERTY_ID_REFVALUE : - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "ORadioButtonModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_sReferenceValue; - break; - - case PROPERTY_ID_DEFAULTCHECKED : - DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_SHORT, "ORadioButtonModel::setFastPropertyValue_NoBroadcast : invalid type !" ); - rValue >>= m_nDefaultChecked; - _reset(); - break; - - default: - OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue); - } - - // if the label control changed ... - if (nHandle == PROPERTY_ID_CONTROLLABEL) - { // ... forward this to our siblings - SetSiblingPropsTo(PROPERTY_CONTROLLABEL, rValue); - } - - // wenn sich die ControlSource-Eigenschaft geaendert hat ... - if (nHandle == PROPERTY_ID_CONTROLSOURCE) - { // ... muss ich allen meinen Siblings, die in der selben RadioButton-Gruppe sind wie ich, auch die - // neue ControlSource mitgeben - SetSiblingPropsTo(PROPERTY_CONTROLSOURCE, rValue); - } - - // die andere Richtung : wenn sich mein Name aendert ... - if (nHandle == PROPERTY_ID_NAME) - { - // ... muss ich testen, ob ich Siblings mit dem selben Namen habe, damit ich deren ControlSource uebernehmen kann - Reference<XIndexAccess> xIndexAccess(getParent(), UNO_QUERY); - if (xIndexAccess.is()) - { - ::rtl::OUString sName; - ::rtl::OUString sControlSource; - - Reference<XPropertySet> xMyProps; - query_interface(static_cast<XWeak*>(this), xMyProps); - for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i) - { - Reference<XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), UNO_QUERY); - if (!xSiblingProperties.is()) - continue; - - if (xMyProps == xSiblingProperties) - // nur wenn ich nicht mich selber gefunden habe - continue; - - sal_Int16 nType; - xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType; - if (nType != FormComponentType::RADIOBUTTON) - // nur Radio-Buttons - continue; - - xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sName; - // Control, das zur gleichen Gruppe gehoert ? - if (rValue == sName) - { - setPropertyValue(PROPERTY_CONTROLSOURCE, xSiblingProperties->getPropertyValue(PROPERTY_CONTROLSOURCE)); - break; - } - } - } - } - - if (nHandle == PROPERTY_ID_DEFAULTCHECKED) - { - sal_Int16 nValue; - rValue >>= nValue; - if (1 == nValue) - { // bei allen Radios der selben Gruppe das 'default checked' ruecksetzen, denn wie schon der highlander wusste : - // es kann nur einen geben. - Any aZero; - nValue = 0; - aZero <<= nValue; - SetSiblingPropsTo(PROPERTY_DEFAULTCHECKED, aZero); - } - } -} - -//------------------------------------------------------------------------------ -sal_Bool ORadioButtonModel::convertFastPropertyValue( - Any& _rConvertedValue, Any& _rOldValue, sal_Int32 _nHandle, const Any& _rValue) - throw (IllegalArgumentException) -{ - sal_Bool bModified(sal_False); - switch (_nHandle) - { - case PROPERTY_ID_REFVALUE : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_sReferenceValue); - break; - case PROPERTY_ID_DEFAULTCHECKED : - bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_nDefaultChecked); - break; - default: - bModified = OBoundControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue); - break; - } - return bModified; -} - -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL ORadioButtonModel::getPropertySetInfo() throw(RuntimeException) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -cppu::IPropertyArrayHelper& ORadioButtonModel::getInfoHelper() -{ - return *const_cast<ORadioButtonModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(10) - // the "State" property is transient, so change this - // ModifyPropertyAttributes(_rAggregateProps, PROPERTY_STATE, PropertyAttribute::TRANSIENT, 0); - - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP1(REFVALUE, ::rtl::OUString, BOUND); - DECL_PROP1(DEFAULTCHECKED, sal_Int16, BOUND); - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL ORadioButtonModel::getServiceName() throw(RuntimeException) -{ - return FRM_COMPONENT_RADIOBUTTON; // old (non-sun) name for compatibility ! -} - -//------------------------------------------------------------------------------ -void SAL_CALL ORadioButtonModel::write(const Reference<XObjectOutputStream>& _rxOutStream) - throw(IOException, RuntimeException) -{ - OBoundControlModel::write(_rxOutStream); - - // Version - _rxOutStream->writeShort(0x0003); - - // Properties - _rxOutStream << m_sReferenceValue; - _rxOutStream << (sal_Int16)m_nDefaultChecked; - writeHelpTextCompatibly(_rxOutStream); - - // from version 0x0003 : common properties - writeCommonProperties(_rxOutStream); -} - -//------------------------------------------------------------------------------ -void SAL_CALL ORadioButtonModel::read(const Reference<XObjectInputStream>& _rxInStream) throw(IOException, RuntimeException) -{ - OBoundControlModel::read(_rxInStream); - ::osl::MutexGuard aGuard(m_aMutex); - - // Version - UINT16 nVersion = _rxInStream->readShort(); - - switch (nVersion) - { - case 0x0001 : _rxInStream >> m_sReferenceValue; _rxInStream >> m_nDefaultChecked; break; - case 0x0002 : - _rxInStream >> m_sReferenceValue; - _rxInStream >> m_nDefaultChecked; - readHelpTextCompatibly(_rxInStream); - break; - case 0x0003 : - _rxInStream >> m_sReferenceValue; - _rxInStream >> m_nDefaultChecked; - readHelpTextCompatibly(_rxInStream); - readCommonProperties(_rxInStream); - break; - default : - DBG_ERROR("ORadioButtonModel::read : unknown version !"); - m_sReferenceValue = ::rtl::OUString(); - m_nDefaultChecked = 0; - defaultCommonProperties(); - break; - } - // Nach dem Lesen die Defaultwerte anzeigen - if (m_aControlSource.getLength()) - // (not if we don't have a control source - the "State" property acts like it is persistent, then - _reset(); -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::_propertyChanged(const PropertyChangeEvent& _rEvent) throw(RuntimeException) -{ - if (_rEvent.PropertyName.equals(PROPERTY_STATE)) - { - if (_rEvent.NewValue == (sal_Int16)1) - { - // wenn sich mein Status auf 'checked' geaendert hat, muss ich alle meine Siblings, die in der selben Gruppe - // sind wie ich, entsprechend zuruecksetzen - Any aZero; - aZero <<= (sal_Int16)0; - - SetSiblingPropsTo(PROPERTY_STATE, aZero); - ::osl::MutexGuard aGuard(m_aMutex); - - // as we aren't commitable we have to take care of the field we are bound to ourself - Reference<XPropertySet> xField = getField(); - if (xField.is() && !m_bInReset) - { - xField->setPropertyValue(PROPERTY_VALUE, makeAny(m_sReferenceValue)); - } - } - } -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::_onValueChanged() -{ - Any aValue; - aValue <<= (sal_Int16)((m_xColumn->getString() == m_sReferenceValue) ? RB_CHECK : RB_NOCHECK); - m_bInReset = sal_True; - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateSet->setPropertyValue(PROPERTY_STATE, aValue); - } - m_bInReset = sal_False; -} - -//------------------------------------------------------------------------------ -Any ORadioButtonModel::_getControlValue() const -{ - return m_xAggregateSet->getPropertyValue(PROPERTY_STATE); -} - -//------------------------------------------------------------------------------ -void ORadioButtonModel::_reset( void ) -{ - Any aValue; - aValue <<= (sal_Int16)m_nDefaultChecked; - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateSet->setPropertyValue(PROPERTY_STATE, aValue); - } -} - -//----------------------------------------------------------------------------- -sal_Bool ORadioButtonModel::_commit() -{ - if (!m_bInReset) - // normally we don't have a commit as we forward all state changes immediately to our field we're bound to - return sal_True; - - // we're in reset, so this commit means "put the value into the field you're bound to" - // 72769 - 08.02.00 - FS - Reference<XPropertySet> xField = getField(); - DBG_ASSERT(xField.is(), "ORadioButtonModel::_commit : committing while resetting, but not bound ?"); - if (xField.is()) - { - try - { - sal_Int16 nValue; - m_xAggregateSet->getPropertyValue(PROPERTY_STATE) >>= nValue; - if (nValue == 1) - xField->setPropertyValue(PROPERTY_VALUE, makeAny(m_sReferenceValue)); - } - catch(Exception&) - { - DBG_ERROR("ORadioButtonModel::_commit : could not commit !"); - } - } - return sal_True; -} - -//----------------------------------------------------------------------------- -void ORadioButtonModel::reset(void) throw (RuntimeException) -{ - m_bInReset = sal_True; - OBoundControlModel::reset(); - m_bInReset = sal_False; -} - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_Time.cxx b/binfilter/bf_forms/source/component/forms_Time.cxx deleted file mode 100644 index 01d453fc10e1..000000000000 --- a/binfilter/bf_forms/source/component/forms_Time.cxx +++ /dev/null @@ -1,355 +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. - * - ************************************************************************/ - -#include <comphelper/proparrhlp.hxx> - -#include "Time.hxx" - -#include <tools/time.hxx> -#include <connectivity/dbconversion.hxx> - -#include <com/sun/star/sdbc/DataType.hpp> - -#include <com/sun/star/beans/PropertyAttribute.hpp> - -#include "services.hxx" - -#include <com/sun/star/form/FormComponentType.hpp> - -namespace binfilter { - -using namespace dbtools; - -//......................................................................... -namespace frm -{ -//......................................................................... -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::sdb; -using namespace ::com::sun::star::sdbc; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::form; -using namespace ::com::sun::star::util; -using namespace ::com::sun::star::awt; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::lang; - -//================================================================== -//= -//================================================================== - -//================================================================== -//= OTimeControl -//================================================================== -//------------------------------------------------------------------ -OTimeControl::OTimeControl(const Reference<XMultiServiceFactory>& _rxFactory) - :OBoundControl(_rxFactory, VCL_CONTROL_TIMEFIELD) -{ -} - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OTimeControl_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OTimeControl(_rxFactory)); -} - -//------------------------------------------------------------------------------ -Sequence<Type> OTimeControl::_getTypes() -{ - return OBoundControl::_getTypes(); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OTimeControl::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControl::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 1); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_TIMEFIELD; - return aSupported; -} - -//================================================================== -//= OTimeModel -//================================================================== -sal_Int32 OTimeModel::nTimeHandle = -1; - -//------------------------------------------------------------------ -InterfaceRef SAL_CALL OTimeModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory) -{ - return *(new OTimeModel(_rxFactory)); -} - -// XServiceInfo -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OTimeModel::getSupportedServiceNames() throw() -{ - StringSequence aSupported = OBoundControlModel::getSupportedServiceNames(); - aSupported.realloc(aSupported.getLength() + 2); - - ::rtl::OUString*pArray = aSupported.getArray(); - pArray[aSupported.getLength()-2] = FRM_SUN_COMPONENT_DATABASE_TIMEFIELD; - pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_TIMEFIELD; - return aSupported; -} - -//------------------------------------------------------------------------------ -Sequence<Type> OTimeModel::_getTypes() -{ - return OBoundControlModel::_getTypes(); -} - -//------------------------------------------------------------------ -DBG_NAME( OTimeModel ) -//------------------------------------------------------------------ -OTimeModel::OTimeModel(const Reference<XMultiServiceFactory>& _rxFactory) - :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_TIMEFIELD, FRM_CONTROL_TIMEFIELD ) - // use the old control name for compytibility reasons - ,OLimitedFormats(_rxFactory, FormComponentType::TIMEFIELD) -{ - DBG_CTOR( OTimeModel, NULL ); - - m_nClassId = FormComponentType::TIMEFIELD; - m_sDataFieldConnectivityProperty = PROPERTY_TIME; - if (OTimeModel::nTimeHandle == -1) - OTimeModel::nTimeHandle = getOriginalHandle(PROPERTY_ID_TIME); - - setAggregateSet(m_xAggregateFastSet, getOriginalHandle(PROPERTY_ID_TIMEFORMAT)); -} - -//------------------------------------------------------------------------------ -OTimeModel::OTimeModel( const OTimeModel* _pOriginal, const Reference<XMultiServiceFactory>& _rxFactory ) - :OEditBaseModel( _pOriginal, _rxFactory ) - ,OLimitedFormats( _rxFactory, FormComponentType::TIMEFIELD ) -{ - DBG_CTOR( OTimeModel, NULL ); - - setAggregateSet( m_xAggregateFastSet, getOriginalHandle( PROPERTY_ID_TIMEFORMAT ) ); -} - -//------------------------------------------------------------------------------ -OTimeModel::~OTimeModel( ) -{ - setAggregateSet(Reference< XFastPropertySet >(), -1); - DBG_DTOR( OTimeModel, NULL ); -} - -// XCloneable -//------------------------------------------------------------------------------ -IMPLEMENT_DEFAULT_CLONING( OTimeModel ) - -//------------------------------------------------------------------------------ -::rtl::OUString SAL_CALL OTimeModel::getServiceName() throw ( ::com::sun::star::uno::RuntimeException) -{ - return FRM_COMPONENT_TIMEFIELD; // old (non-sun) name for compatibility ! -} - -// XPropertySet -//------------------------------------------------------------------------------ -Reference<XPropertySetInfo> SAL_CALL OTimeModel::getPropertySetInfo() throw( RuntimeException ) -{ - Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); - return xInfo; -} - -//------------------------------------------------------------------------------ -void OTimeModel::fillProperties( - Sequence< Property >& _rProps, - Sequence< Property >& _rAggregateProps ) const -{ - FRM_BEGIN_PROP_HELPER(11) - DECL_PROP1(NAME, ::rtl::OUString, BOUND); - DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT); - DECL_PROP3(DEFAULT_TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID); - DECL_PROP1(TAG, ::rtl::OUString, BOUND); - DECL_PROP1(TABINDEX, sal_Int16, BOUND); - DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND); - DECL_IFACE_PROP3(BOUNDFIELD, XPropertySet, BOUND,READONLY, TRANSIENT); - DECL_IFACE_PROP2(CONTROLLABEL, XPropertySet, BOUND, MAYBEVOID); - DECL_PROP2(CONTROLSOURCEPROPERTY, ::rtl::OUString, READONLY, TRANSIENT); - DECL_PROP1(FORMATKEY, sal_Int32, TRANSIENT); - DECL_IFACE_PROP2(FORMATSSUPPLIER, XNumberFormatsSupplier, READONLY, TRANSIENT); - FRM_END_PROP_HELPER(); -} - -//------------------------------------------------------------------------------ -::cppu::IPropertyArrayHelper& OTimeModel::getInfoHelper() -{ - return *const_cast<OTimeModel*>(this)->getArrayHelper(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OTimeModel::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle ) const -{ - switch (_nHandle) - { - case PROPERTY_ID_FORMATKEY: - getFormatKeyPropertyValue(_rValue); - break; - case PROPERTY_ID_FORMATSSUPPLIER: - _rValue <<= getFormatsSupplier(); - break; - default: - OEditBaseModel::getFastPropertyValue(_rValue, _nHandle); - break; - } -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OTimeModel::convertFastPropertyValue(Any& _rConvertedValue, Any& _rOldValue, - sal_Int32 _nHandle, const Any& _rValue ) throw(IllegalArgumentException) -{ - if (PROPERTY_ID_FORMATKEY == _nHandle) - return convertFormatKeyPropertyValue(_rConvertedValue, _rOldValue, _rValue); - else - return OEditBaseModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue ); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OTimeModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const Any& _rValue) throw ( ::com::sun::star::uno::Exception) -{ - if (PROPERTY_ID_FORMATKEY == _nHandle) - setFormatKeyPropertyValue(_rValue); - else - OEditBaseModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue); -} - -// XLoadListener -//------------------------------------------------------------------------------ -void OTimeModel::_loaded(const EventObject& rEvent) -{ - OBoundControlModel::_loaded(rEvent); - Reference<XPropertySet> xField = getField(); - if (xField.is()) - { - m_bDateTimeField = sal_False; - try - { - sal_Int32 nFieldType; - xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType; - m_bDateTimeField = (nFieldType == DataType::TIMESTAMP); - } - catch(Exception&) - { - } - } -} - -// XBoundComponent -//------------------------------------------------------------------------------ -sal_Bool OTimeModel::_commit() -{ - Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OTimeModel::nTimeHandle ); - if (!compare(aNewValue, m_aSaveValue)) - { - if (!aNewValue.hasValue()) - m_xColumnUpdate->updateNull(); - else - { - try - { - util::Time aTime; - if (!(aNewValue >>= aTime)) - { - sal_Int32 nAsInt(0); - aNewValue >>= nAsInt; - aTime = DBTypeConversion::toTime(nAsInt); - } - - if (!m_bDateTimeField) - m_xColumnUpdate->updateTime(aTime); - else - { - util::DateTime aDateTime = m_xColumn->getTimestamp(); - aDateTime.HundredthSeconds = aTime.HundredthSeconds; - aDateTime.Seconds = aTime.Seconds; - aDateTime.Minutes = aTime.Minutes; - aDateTime.Hours = aTime.Hours; - m_xColumnUpdate->updateTimestamp(aDateTime); - } - } - catch(Exception&) - { - return sal_False; - } - } - m_aSaveValue = aNewValue; - } - return sal_True; -} - -//------------------------------------------------------------------------------ -void OTimeModel::_onValueChanged() -{ - util::Time aTime = m_xColumn->getTime(); - if (m_xColumn->wasNull()) - m_aSaveValue.clear(); - else - // the aggregated set expects an Int32 as value ... - m_aSaveValue <<= DBTypeConversion::toINT32(aTime); - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OTimeModel::nTimeHandle, m_aSaveValue); - } -} - -//------------------------------------------------------------------------------ -void OTimeModel::_reset() -{ - Any aValue; - if (m_aDefault.getValueType().getTypeClass() == TypeClass_LONG) - aValue = m_aDefault; - else - { // aktuelles Datum einstellen - ::Time aCurrentTime; - aValue <<= (sal_Int32)aCurrentTime.GetTime(); - } - - { // release our mutex once (it's acquired in the calling method !), as setting aggregate properties - // may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with - // our own mutex locked - // FS - 72451 - 31.01.00 - MutexRelease aRelease(m_aMutex); - m_xAggregateFastSet->setFastPropertyValue(OTimeModel::nTimeHandle, aValue); - } -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_cloneable.cxx b/binfilter/bf_forms/source/component/forms_cloneable.cxx deleted file mode 100644 index 3bba53af9151..000000000000 --- a/binfilter/bf_forms/source/component/forms_cloneable.cxx +++ /dev/null @@ -1,71 +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. - * - ************************************************************************/ - -#include "cloneable.hxx" - -#include <com/sun/star/util/XCloneable.hpp> -#include <comphelper/uno3.hxx> -#include <tools/debug.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - using namespace ::comphelper; - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::util; - - //==================================================================== - //= OCloneableAggregation - //==================================================================== - //------------------------------------------------------------------ - Reference< XAggregation > OCloneableAggregation::createAggregateClone( const OCloneableAggregation* _pOriginal ) - { - Reference< XCloneable > xAggregateCloneable; // will be the aggregates XCloneable - Reference< XAggregation > xAggregateClone; // will be the aggregates clone - - if ( query_aggregation( _pOriginal->m_xAggregate, xAggregateCloneable ) ) - { - xAggregateClone = xAggregateClone.query( xAggregateCloneable->createClone() ); - DBG_ASSERT( xAggregateClone.is(), "OCloneableAggregation::createAggregateClone: invalid clone returned by the aggregate!" ); - } - else - DBG_ASSERT( !_pOriginal->m_xAggregate.is(), "OCloneableAggregation::createAggregateClone: aggregate is not cloneable!" ); - - return xAggregateClone; - } - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_errorbroadcaster.cxx b/binfilter/bf_forms/source/component/forms_errorbroadcaster.cxx deleted file mode 100644 index fde9e77f8f0e..000000000000 --- a/binfilter/bf_forms/source/component/forms_errorbroadcaster.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. - * - ************************************************************************/ - -#include "errorbroadcaster.hxx" -#include <connectivity/dbtools.hxx> -#include <com/sun/star/sdb/SQLContext.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::sdbc; - using namespace ::com::sun::star::sdb; - using namespace ::dbtools; - - //===================================================================== - //= OErrorBroadcaster - //===================================================================== - //--------------------------------------------------------------------- - OErrorBroadcaster::OErrorBroadcaster( ::cppu::OBroadcastHelper& _rBHelper ) - :m_rBHelper( _rBHelper ) - ,m_aErrorListeners( _rBHelper.rMutex ) - { - } - - //--------------------------------------------------------------------- - OErrorBroadcaster::~OErrorBroadcaster( ) - { - OSL_ENSURE( m_rBHelper.bDisposed || m_rBHelper.bInDispose, - "OErrorBroadcaster::~OErrorBroadcaster: not disposed!" ); - // herein, we don't have a chance to do the dispose ourself .... - - OSL_ENSURE( 0 == m_aErrorListeners.getLength(), - "OErrorBroadcaster::~OErrorBroadcaster: still have listeners!" ); - // either we're not disposed, or the derived class did not call our dispose from within their dispose - } - - //--------------------------------------------------------------------- - void SAL_CALL OErrorBroadcaster::disposing() - { - EventObject aDisposeEvent( static_cast< XSQLErrorBroadcaster* >( this ) ); - m_aErrorListeners.disposeAndClear( aDisposeEvent ); - } - - //------------------------------------------------------------------------------ - void SAL_CALL OErrorBroadcaster::onError( const SQLException& _rException, const ::rtl::OUString& _rContextDescription ) - { - OSL_ENSURE( false, "OErrorBroadcaster::onError: dead code!" ); - } - - //------------------------------------------------------------------------------ - void SAL_CALL OErrorBroadcaster::onError( const ::com::sun::star::sdb::SQLErrorEvent& _rError ) - { - if ( m_aErrorListeners.getLength() ) - { - - ::cppu::OInterfaceIteratorHelper aIter( m_aErrorListeners ); - while ( aIter.hasMoreElements() ) - static_cast< XSQLErrorListener* >( aIter.next() )->errorOccured( _rError ); - } - } - - //------------------------------------------------------------------------------ - void SAL_CALL OErrorBroadcaster::addSQLErrorListener( const Reference< XSQLErrorListener >& _rxListener ) throw( RuntimeException ) - { - m_aErrorListeners.addInterface( _rxListener ); - } - - //------------------------------------------------------------------------------ - void SAL_CALL OErrorBroadcaster::removeSQLErrorListener( const Reference< XSQLErrorListener >& _rxListener ) throw( RuntimeException ) - { - m_aErrorListeners.removeInterface( _rxListener ); - } - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/forms_imgprod.cxx b/binfilter/bf_forms/source/component/forms_imgprod.cxx deleted file mode 100644 index 576e1d241a25..000000000000 --- a/binfilter/bf_forms/source/component/forms_imgprod.cxx +++ /dev/null @@ -1,658 +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. - * - ************************************************************************/ - -#include "imgprod.hxx" - -#include <vcl/bmpacc.hxx> -#include <vcl/cvtgrf.hxx> -#include <vcl/svapp.hxx> -#include <unotools/ucbstreamhelper.hxx> -#include <bf_svtools/filter.hxx> - -#include <com/sun/star/io/XInputStream.hpp> - -#include "bf_svtools/imageresourceaccess.hxx" - -#include <comphelper/processfactory.hxx> - -// -------------------- -// - ImgProdLockBytes - -// -------------------- - -class ImgProdLockBytes : public SvLockBytes -{ - ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xStmRef; - ::com::sun::star::uno::Sequence<sal_Int8> maSeq; - - ImgProdLockBytes() {}; - -public: - - ImgProdLockBytes( SvStream* pStm, sal_Bool bOwner ); - ImgProdLockBytes( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStreamRef ); - virtual ~ImgProdLockBytes(); - - virtual ErrCode ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, sal_Size* pRead ) const; - virtual ErrCode WriteAt( sal_Size nPos, const void* pBuffer, sal_Size nCount, sal_Size* pWritten ); - virtual ErrCode Flush() const; - virtual ErrCode SetSize( sal_Size nSize ); - virtual ErrCode Stat( SvLockBytesStat*, SvLockBytesStatFlag ) const; -}; - -// ------------------------------------------------------------------------ - -ImgProdLockBytes::ImgProdLockBytes( SvStream* pStm, sal_Bool bOwner ) : - SvLockBytes( pStm, bOwner ) -{ -} - -// ------------------------------------------------------------------------ - -ImgProdLockBytes::ImgProdLockBytes( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStmRef ) : - xStmRef( rStmRef ) -{ - if( xStmRef.is() ) - { - const sal_uInt32 nBytesToRead = 65535; - sal_uInt32 nRead; - - do - { - ::com::sun::star::uno::Sequence< sal_Int8 > aReadSeq; - - nRead = xStmRef->readSomeBytes( aReadSeq, nBytesToRead ); - - if( nRead ) - { - const sal_uInt32 nOldLength = maSeq.getLength(); - maSeq.realloc( nOldLength + nRead ); - rtl_copyMemory( maSeq.getArray() + nOldLength, aReadSeq.getConstArray(), aReadSeq.getLength() ); - } - } - while( nBytesToRead == nRead ); - } -} - -// ------------------------------------------------------------------------ - -ImgProdLockBytes::~ImgProdLockBytes() -{ -} - -// ------------------------------------------------------------------------ - -ErrCode ImgProdLockBytes::ReadAt( sal_Size nPos, void* pBuffer, sal_Size nCount, sal_Size* pRead ) const -{ - if( GetStream() ) - { - ( (SvStream*) GetStream() )->ResetError(); - const ErrCode nErr = SvLockBytes::ReadAt( nPos, pBuffer, nCount, pRead ); - ( (SvStream*) GetStream() )->ResetError(); - return nErr; - } - else - { - const sal_Size nSeqLen = maSeq.getLength(); - ErrCode nErr = ERRCODE_NONE; - - if( nPos < nSeqLen ) - { - if( ( nPos + nCount ) > nSeqLen ) - nCount = nSeqLen - nPos; - - memcpy( pBuffer, maSeq.getConstArray() + nPos, nCount ); - *pRead = nCount; - } - else - *pRead = 0UL; - - return nErr; - } -} - -// ------------------------------------------------------------------------ - -ErrCode ImgProdLockBytes::WriteAt( sal_Size nPos, const void* pBuffer, sal_Size nCount, sal_Size* pWritten ) -{ - if( GetStream() ) - return SvLockBytes::WriteAt( nPos, pBuffer, nCount, pWritten ); - else - { - DBG_ASSERT( xStmRef.is(), "ImgProdLockBytes::WriteAt: xInputStream has no reference..." ); - return ERRCODE_IO_CANTWRITE; - } -} - -// ------------------------------------------------------------------------ - -ErrCode ImgProdLockBytes::Flush() const -{ - return ERRCODE_NONE; -} - -// ------------------------------------------------------------------------ - -ErrCode ImgProdLockBytes::SetSize( sal_Size nSize ) -{ - if( GetStream() ) - return SvLockBytes::SetSize( nSize ); - else - { - DBG_ERROR( "ImgProdLockBytes::SetSize not supported for xInputStream..." ); - return ERRCODE_IO_CANTWRITE; - } -} - -// ------------------------------------------------------------------------ - -ErrCode ImgProdLockBytes::Stat( SvLockBytesStat* pStat, SvLockBytesStatFlag eFlag ) const -{ - if( GetStream() ) - return SvLockBytes::Stat( pStat, eFlag ); - else - { - DBG_ASSERT( xStmRef.is(), "ImgProdLockBytes::Stat: xInputStream has no reference..." ); - pStat->nSize = maSeq.getLength(); - return ERRCODE_NONE; - } -} - -// ----------------- -// - ImageProducer - -// ----------------- - -ImageProducer::ImageProducer() : - mpStm ( NULL ), - mpFilter ( NULL ), - mnStatus ( 0UL ), - mbConsInit ( sal_False ), - mnLastError ( 0UL ), - mbAsync ( sal_False ) -{ - mpGraphic = new Graphic; - DBG_ASSERT( Application::GetFilterHdl().IsSet(), "ImageProducer::ImageProducer(): No filter handler set" ); -} - -// ------------------------------------------------------------ - -ImageProducer::~ImageProducer() -{ - delete mpGraphic; - mpGraphic = NULL; - - delete mpFilter; - mpFilter = NULL; - - delete mpStm; - mpStm = NULL; - - for( void* pCons = maConsList.First(); pCons; pCons = maConsList.Next() ) - delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons; -} - -// ------------------------------------------------------------ - -// ::com::sun::star::uno::XInterface -::com::sun::star::uno::Any ImageProducer::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::XInitialization*, this ), - SAL_STATIC_CAST( ::com::sun::star::awt::XImageProducer*, this ) ); - return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); -} - -// ------------------------------------------------------------ - -void ImageProducer::addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException) -{ - DBG_ASSERT( rxConsumer.is(), "::AddConsumer(...): No consumer referenced!" ); - if( rxConsumer.is() ) - maConsList.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( rxConsumer ), LIST_APPEND ); -} - -// ------------------------------------------------------------ - -void ImageProducer::removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException) -{ - for( sal_uInt32 n = maConsList.Count(); n; ) - { - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > * pRef = (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) maConsList.GetObject( --n ); - - if( *pRef == rxConsumer ) - { - delete pRef; - maConsList.Remove( n ); - break; - } - } -} - -// ------------------------------------------------------------ - -void ImageProducer::SetImage( const ::rtl::OUString& rPath ) -{ - maURL = rPath; - mpGraphic->Clear(); - mbConsInit = sal_False; - mbAsync = sal_False; - delete mpStm; - - if ( ::binfilter::ImageResourceAccess::isImageResourceURL( maURL ) ) - { - mpStm = ::binfilter::ImageResourceAccess::getImageStream( ::comphelper::getProcessServiceFactory(), maURL ); - } - else if( maURL.getLength() ) - { - SvStream* pIStm = ::utl::UcbStreamHelper::CreateStream( maURL, STREAM_STD_READ ); - mpStm = pIStm ? new SvStream( new ImgProdLockBytes( pIStm, sal_True ) ) : NULL; - } - else - mpStm = NULL; -} - -// ------------------------------------------------------------ - -void ImageProducer::SetImage( SvStream& rStm ) -{ - maURL = ::rtl::OUString(); - mpGraphic->Clear(); - mbConsInit = sal_False; - mbAsync = sal_False; - - delete mpStm; - mpStm = new SvStream( new ImgProdLockBytes( &rStm, sal_False ) ); -} - -// ------------------------------------------------------------ - -void ImageProducer::setImage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rInputStmRef ) -{ - maURL = ::rtl::OUString(); - mpGraphic->Clear(); - mbConsInit = sal_False; - mbAsync = sal_False; - delete mpStm; - - if( rInputStmRef.is() ) - mpStm = new SvStream( new ImgProdLockBytes( rInputStmRef ) ); - else - mpStm = NULL; -} - -// ------------------------------------------------------------ - -void ImageProducer::NewDataAvailable() -{ - if( ( GRAPHIC_NONE == mpGraphic->GetType() ) || mpGraphic->GetContext() ) - startProduction(); -} - -// ------------------------------------------------------------ - -void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException) -{ - ResetLastError(); - - if( maConsList.Count() ) - { - bool bNotifyEmptyGraphics = false; - - // valid stream or filled graphic? => update consumers - if( mpStm || ( mpGraphic->GetType() != GRAPHIC_NONE ) ) - { - // if we already have a graphic, we don't have to import again; - // graphic is cleared if a new Stream is set - if( ( mpGraphic->GetType() == GRAPHIC_NONE ) || mpGraphic->GetContext() ) - { - if( !ImplImportGraphic( *mpGraphic ) && maErrorHdl.IsSet() ) - maErrorHdl.Call( this ); - } - - if( mpGraphic->GetType() != GRAPHIC_NONE ) - ImplUpdateData( *mpGraphic ); - else - bNotifyEmptyGraphics = true; - } - else - bNotifyEmptyGraphics = true; - - if ( bNotifyEmptyGraphics ) - { - // reset image - List aTmp; - void* pCons; - - // create temporary list to hold interfaces - for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() ) - aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND ); - - // iterate through interfaces - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - { - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->init( 0, 0 ); - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this ); - } - - // delete interfaces in temporary list - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons; - } - } -} - -// ------------------------------------------------------------ - -sal_Bool ImageProducer::ImplImportGraphic( Graphic& rGraphic ) -{ - int nFilter = GRFILTER_FORMAT_DONTKNOW; - short nRet; - sal_Bool bRet = sal_False; - - if( ERRCODE_IO_PENDING == mpStm->GetError() ) - mpStm->ResetError(); - - mpStm->Seek( 0UL ); - - if( mpFilter ) - nRet = mpFilter->ImportGraphic( rGraphic, String(), *mpStm, nFilter ); - else - { - if( GraphicConverter::Import( *mpStm, rGraphic ) == ERRCODE_NONE ) - nRet = GRFILTER_OK; - else - nRet = GRFILTER_FILTERERROR; - } - - if( ERRCODE_IO_PENDING == mpStm->GetError() ) - mpStm->ResetError(); - - if( nRet == GRFILTER_OK ) - bRet = sal_True; - else - mnLastError = nRet; - - return bRet; -} - -// ------------------------------------------------------------ - -void ImageProducer::ImplUpdateData( const Graphic& rGraphic ) -{ - // asynchronous? - if( mpGraphic->GetContext() ) - mbAsync = sal_True; - - ImplInitConsumer( rGraphic ); - - if( mbConsInit && maConsList.Count() ) - { - List aTmp; - void* pCons; - - ImplUpdateConsumer( rGraphic ); - mbConsInit = sal_False; - - // create temporary list to hold interfaces - for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() ) - aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND ); - - // iterate through interfaces - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( mnStatus = ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this ); - - // delete interfaces in temporary list - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons; - } -} - -// ------------------------------------------------------------ - -void ImageProducer::ImplInitConsumer( const Graphic& rGraphic ) -{ - Bitmap aBmp( rGraphic.GetBitmapEx().GetBitmap() ); - BitmapReadAccess* pBmpAcc = aBmp.AcquireReadAccess(); - - if( pBmpAcc ) - { - List aTmp; - void * pCons; - sal_uInt16 nPalCount = 0; - const sal_uInt16 nBitCount = pBmpAcc->GetBitCount(); - sal_uInt32 nRMask = 0; - sal_uInt32 nGMask = 0; - sal_uInt32 nBMask = 0; - sal_uInt32 nAMask = 0; - ::com::sun::star::uno::Sequence< sal_Int32 > aRGBPal; - - if( pBmpAcc->HasPalette() ) - { - nPalCount = pBmpAcc->GetPaletteEntryCount(); - - if( nPalCount ) - { - aRGBPal = ::com::sun::star::uno::Sequence< sal_Int32 >( nPalCount + 1 ); - - sal_Int32* pTmp = aRGBPal.getArray(); - - for( sal_uInt32 i = 0; i < nPalCount; i++, pTmp++ ) - { - const BitmapColor& rCol = pBmpAcc->GetPaletteColor( (sal_uInt16) i ); - - *pTmp = ( (sal_Int32) rCol.GetRed() ) << (sal_Int32) 24L; - *pTmp |= ( (sal_Int32) rCol.GetGreen() ) << (sal_Int32) 16L; - *pTmp |= ( (sal_Int32) rCol.GetBlue() ) << (sal_Int32) 8L; - *pTmp |= (sal_Int32) 0x000000ffL; - } - - if( rGraphic.IsTransparent() ) - { - // append transparent entry - *pTmp = (sal_Int32) 0xffffff00L; - mnTransIndex = nPalCount; - nPalCount++; - } - else - mnTransIndex = 0; - - } - } - else - { - nRMask = 0xff000000UL; - nGMask = 0x00ff0000UL; - nBMask = 0x0000ff00UL; - nAMask = 0x000000ffUL; - } - - // create temporary list to hold interfaces - for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() ) - aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND ); - - // iterate through interfaces - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - { - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->init( pBmpAcc->Width(), pBmpAcc->Height() ); - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setColorModel( pBmpAcc->GetBitCount(), - aRGBPal, nRMask, nGMask, nBMask, nAMask ); - } - - // delete interfaces in temporary list - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons; - - aBmp.ReleaseAccess( pBmpAcc ); - mbConsInit = sal_True; - } -} - -// ------------------------------------------------------------ - -void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic ) -{ - BitmapEx aBmpEx( rGraphic.GetBitmapEx() ); - Bitmap aBmp( aBmpEx.GetBitmap() ); - BitmapReadAccess* pBmpAcc = aBmp.AcquireReadAccess(); - - if( pBmpAcc ) - { - List aTmp; - void* pCons; - Bitmap aMask( aBmpEx.GetMask() ); - BitmapReadAccess* pMskAcc = !!aMask ? aMask.AcquireReadAccess() : NULL; - const long nWidth = pBmpAcc->Width(); - const long nHeight = pBmpAcc->Height(); - const long nStartX = 0L; - const long nEndX = nWidth - 1L; - const long nStartY = 0L; - const long nEndY = nHeight - 1L; - const long nPartWidth = nEndX - nStartX + 1; - const long nPartHeight = nEndY - nStartY + 1; - - if( !pMskAcc ) - { - aMask = Bitmap( aBmp.GetSizePixel(), 1 ); - aMask.Erase( COL_BLACK ); - pMskAcc = aMask.AcquireReadAccess(); - } - - // create temporary list to hold interfaces - for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() ) - aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND ); - - if( pBmpAcc->HasPalette() ) - { - const BitmapColor aWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); - - if( mnTransIndex < 256 ) - { - ::com::sun::star::uno::Sequence<sal_Int8> aData( nPartWidth * nPartHeight ); - sal_Int8* pTmp = aData.getArray(); - - for( long nY = nStartY; nY <= nEndY; nY++ ) - { - for( long nX = nStartX; nX <= nEndX; nX++ ) - { - if( pMskAcc->GetPixel( nY, nX ) == aWhite ) - *pTmp++ = mnTransIndex; - else - *pTmp++ = pBmpAcc->GetPixel( nY, nX ).GetIndex(); - } - } - - // iterate through interfaces - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setPixelsByBytes( nStartX, nStartY, nPartWidth, nPartHeight, - aData, 0UL, nPartWidth ); - } - else - { - ::com::sun::star::uno::Sequence<sal_Int32> aData( nPartWidth * nPartHeight ); - sal_Int32* pTmp = aData.getArray(); - - for( long nY = nStartY; nY <= nEndY; nY++ ) - { - for( long nX = nStartX; nX <= nEndX; nX++ ) - { - if( pMskAcc->GetPixel( nY, nX ) == aWhite ) - *pTmp++ = mnTransIndex; - else - *pTmp++ = pBmpAcc->GetPixel( nY, nX ).GetIndex(); - } - } - - // iterate through interfaces - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight, - aData, 0UL, nPartWidth ); - } - } - else - { - ::com::sun::star::uno::Sequence<sal_Int32> aData( nPartWidth * nPartHeight ); - const BitmapColor aWhite( pMskAcc->GetBestMatchingColor( Color( COL_WHITE ) ) ); - sal_Int32* pTmp = aData.getArray(); - - for( long nY = nStartY; nY <= nEndY; nY++ ) - { - for( long nX = nStartX; nX <= nEndX; nX++, pTmp++ ) - { - const BitmapColor aCol( pBmpAcc->GetPixel( nY, nX ) ); - - *pTmp = ( (sal_Int32) aCol.GetRed() ) << (sal_Int32) 24L; - *pTmp |= ( (sal_Int32) aCol.GetGreen() ) << (sal_Int32) 16L; - *pTmp |= ( (sal_Int32) aCol.GetBlue() ) << (sal_Int32) 8L; - - if( pMskAcc->GetPixel( nY, nX ) != aWhite ) - *pTmp |= 0x000000ffUL; - } - } - - // iterate through interfaces - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight, - aData, 0UL, nPartWidth ); - } - - // delete interfaces in temporary list - for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() ) - delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons; - - aBmp.ReleaseAccess( pBmpAcc ); - aMask.ReleaseAccess( pMskAcc ); - } -} - -void ImageProducer::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) -{ - if ( aArguments.getLength() == 1 ) - { - ::com::sun::star::uno::Any aArg = aArguments.getConstArray()[0]; - rtl::OUString aURL; - if ( aArg >>= aURL ) - { - SetImage( aURL ); - } - } -} - -namespace binfilter -{ -namespace frm -{ -::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > -SAL_CALL ImageProducer_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 ImageProducer ); -} -} // namespace frm -} // namespace binfilter - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/imgprod.hxx b/binfilter/bf_forms/source/component/imgprod.hxx deleted file mode 100644 index 29bf4ede3606..000000000000 --- a/binfilter/bf_forms/source/component/imgprod.hxx +++ /dev/null @@ -1,129 +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. - * - ************************************************************************/ - -#ifndef _PRODUCE_HXX -#define _PRODUCE_HXX - -#include <tools/link.hxx> -#include <tools/string.hxx> -#include <tools/list.hxx> - -#include <com/sun/star/awt/ImageStatus.hpp> -#include <com/sun/star/awt/XImageConsumer.hpp> -#include <com/sun/star/awt/XImageProducer.hpp> -#include <com/sun/star/lang/XInitialization.hpp> - -#include <cppuhelper/weak.hxx> - - -// ----------------- -// - ImageProducer - -// ----------------- - - - -class SvStream; -class ImageConsumer; -class Graphic; -namespace binfilter -{ -class GraphicFilter; -} - -namespace com { namespace sun { namespace star { namespace io { - class XInputStream; -}}}} - - -class ImageProducer : public ::com::sun::star::awt::XImageProducer, - public ::com::sun::star::lang::XInitialization, - public ::cppu::OWeakObject -{ -private: - - ::rtl::OUString maURL; - List maConsList; - Graphic* mpGraphic; - SvStream* mpStm; - binfilter::GraphicFilter* mpFilter; - sal_uInt32 mnTransIndex; - sal_uInt32 mnStatus; - sal_Bool mbConsInit; - sal_Bool mbStmDel; - Link maErrorHdl; - sal_uInt32 mnLastError; - - sal_uInt32 mnExtra2; - - sal_Bool mbAsync; - sal_Bool mbExtra1; - sal_Bool mbExtra2; - sal_Bool mbExtra3; - - sal_Bool ImplImportGraphic( Graphic& rGraphic ); - void ImplUpdateData( const Graphic& rGraphic ); - void ImplInitConsumer( const Graphic& rGraphic ); - void ImplUpdateConsumer( const Graphic& rGraphic ); - -public: - - ImageProducer(); - ~ImageProducer(); - - void SetImage( const ::rtl::OUString& rPath ); - void SetImage( SvStream& rStm ); - - void SetErrorHandler( const Link& rErrorHdl ) { maErrorHdl = rErrorHdl; } - const Link& GetErrorHandler() const { return maErrorHdl; } - - sal_uInt32 GetLastError() const { return mnLastError; } - void ResetLastError() { mnLastError = 0; } - - void NewDataAvailable(); - - // ::com::sun::star::uno::XInterface - ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL acquire() throw() { OWeakObject::acquire(); } - void SAL_CALL release() throw() { OWeakObject::release(); } - - // MT: ??? - void setImage( ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > & rStmRef ); - - // ::com::sun::star::awt::XImageProducer - void SAL_CALL addConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException); - void SAL_CALL startProduction( ) throw(::com::sun::star::uno::RuntimeException); - - // ::com::sun::star::lang::XInitialization - void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - -}; - -#endif // _PRODUCE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/component/makefile.mk b/binfilter/bf_forms/source/component/makefile.mk deleted file mode 100644 index 75bcadc4d356..000000000000 --- a/binfilter/bf_forms/source/component/makefile.mk +++ /dev/null @@ -1,123 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE - -PRJ=..$/..$/.. -BFPRJ=..$/.. - -PRJNAME=binfilter -TARGET=forms_component - -#GEN_HID=TRUE -#GEN_HID_OTHER=TRUE -NO_HIDS=TRUE - -ENABLE_EXCEPTIONS=TRUE - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -INC+= -I$(PRJ)$/inc$/bf_forms -# --- Types ------------------------------------- - -INCPRE+=$(SOLARINCDIR)$/offuh - -# --- Files ------------------------------------- - -CXXFILES= forms_Grid.cxx \ - forms_Columns.cxx\ - forms_DatabaseForm.cxx \ - forms_GroupManager.cxx \ - forms_FormsCollection.cxx \ - forms_EventThread.cxx \ - forms_File.cxx \ - forms_Edit.cxx \ - forms_EditBase.cxx \ - forms_Numeric.cxx \ - forms_Pattern.cxx \ - forms_Currency.cxx \ - forms_Date.cxx \ - forms_Time.cxx \ - forms_FormattedField.cxx \ - forms_FormattedFieldWrapper.cxx \ - forms_ListBox.cxx \ - forms_ComboBox.cxx \ - forms_GroupBox.cxx \ - forms_Hidden.cxx \ - forms_CheckBox.cxx \ - forms_RadioButton.cxx \ - forms_FixedText.cxx \ - forms_FormComponent.cxx \ - forms_Image.cxx \ - forms_Button.cxx \ - forms_ImageButton.cxx \ - forms_ImageControl.cxx \ - forms_cloneable.cxx \ - forms_imgprod.cxx - -.IF "$(COM)"=="GCC" -NOOPTFILES= $(SLO)$/forms_EventThread.obj -.ENDIF - -SLOFILES= $(SLO)$/forms_Grid.obj \ - $(SLO)$/forms_Columns.obj \ - $(SLO)$/forms_DatabaseForm.obj \ - $(SLO)$/forms_GroupManager.obj \ - $(SLO)$/forms_FormsCollection.obj \ - $(SLO)$/forms_EventThread.obj \ - $(SLO)$/forms_File.obj \ - $(SLO)$/forms_Edit.obj \ - $(SLO)$/forms_EditBase.obj \ - $(SLO)$/forms_Numeric.obj \ - $(SLO)$/forms_Pattern.obj \ - $(SLO)$/forms_Currency.obj \ - $(SLO)$/forms_Date.obj \ - $(SLO)$/forms_Time.obj \ - $(SLO)$/forms_FormattedField.obj \ - $(SLO)$/forms_FormattedFieldWrapper.obj \ - $(SLO)$/forms_ListBox.obj \ - $(SLO)$/forms_ComboBox.obj \ - $(SLO)$/forms_GroupBox.obj \ - $(SLO)$/forms_Hidden.obj \ - $(SLO)$/forms_CheckBox.obj \ - $(SLO)$/forms_RadioButton.obj \ - $(SLO)$/forms_FixedText.obj \ - $(SLO)$/forms_FormComponent.obj \ - $(SLO)$/forms_Image.obj \ - $(SLO)$/forms_Button.obj \ - $(SLO)$/forms_ImageButton.obj \ - $(SLO)$/forms_ImageControl.obj \ - $(SLO)$/forms_errorbroadcaster.obj \ - $(SLO)$/forms_cloneable.obj \ - $(SLO)$/forms_Filter.obj \ - $(SLO)$/forms_imgprod.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/binfilter/bf_forms/source/inc/InterfaceContainer.hxx b/binfilter/bf_forms/source/inc/InterfaceContainer.hxx deleted file mode 100644 index 0b6df2984cbd..000000000000 --- a/binfilter/bf_forms/source/inc/InterfaceContainer.hxx +++ /dev/null @@ -1,296 +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. - * - ************************************************************************/ - -#ifndef _FRM_INTERFACE_CONTAINER_HXX_ -#define _FRM_INTERFACE_CONTAINER_HXX_ - -#include <hash_map> - -#include <comphelper/stl_types.hxx> -#include <comphelper/uno3.hxx> - -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/container/XEnumerationAccess.hpp> -#include <com/sun/star/io/XPersistObject.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/script/XEventAttacherManager.hpp> -#include <com/sun/star/container/XContainer.hpp> -#include <com/sun/star/container/XIndexContainer.hpp> -#include <com/sun/star/form/XFormComponent.hpp> - - -#include <cppuhelper/component.hxx> -#include <cppuhelper/implbase7.hxx> -namespace binfilter { - - using namespace ::comphelper; - -//......................................................................... -namespace frm -{ -//......................................................................... - - -//================================================================== - struct ElementDescription - { - public: - ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInterface; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropertySet; - ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild > xChild; - ::com::sun::star::uno::Any aElementTypeInterface; - - public: - ElementDescription( ); - virtual ~ElementDescription(); - - private: - ElementDescription( const ElementDescription& ); // never implemented - ElementDescription& operator=( const ElementDescription& ); // never implemented - }; - -typedef ::std::vector<InterfaceRef> OInterfaceArray; -typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::comphelper::UStringHash, ::comphelper::UStringEqual> OInterfaceMap; - -//================================================================== -// OInterfaceContainer -// implements a container for form components -//================================================================== -typedef ::cppu::ImplHelper7< ::com::sun::star::container::XNameContainer, - ::com::sun::star::container::XIndexContainer, - ::com::sun::star::container::XContainer, - ::com::sun::star::container::XEnumerationAccess, - ::com::sun::star::script::XEventAttacherManager, - ::com::sun::star::beans::XPropertyChangeListener, - ::com::sun::star::io::XPersistObject > OInterfaceContainer_BASE; - -class OInterfaceContainer : public OInterfaceContainer_BASE -{ -protected: - OInterfaceArray m_aItems; - OInterfaceMap m_aMap; - ::cppu::OInterfaceContainerHelper m_aContainerListeners; - - ::osl::Mutex& m_rMutex; - ::com::sun::star::uno::Type m_aElementType; - - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory> m_xServiceFactory; - - - // EventManager - ::com::sun::star::uno::Reference< ::com::sun::star::script::XEventAttacherManager> m_xEventAttacher; - -public: - OInterfaceContainer( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory, - ::osl::Mutex& _rMutex, - const ::com::sun::star::uno::Type& _rElementType); - -public: -// ::com::sun::star::io::XPersistObject - virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(::com::sun::star::uno::RuntimeException) = 0; - virtual void SAL_CALL write( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream >& OutStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL read( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream >& InStream ) throw(::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::lang::XEventListener - virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& _rSource) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::beans::XPropertyChangeListener - virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw (::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XElementAccess - virtual ::com::sun::star::uno::Type SAL_CALL getElementType() throw(::com::sun::star::uno::RuntimeException) ; - virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XEnumerationAccess - virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration> SAL_CALL createEnumeration() throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XNameAccess - virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual StringSequence SAL_CALL getElementNames( ) throw(::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XNameReplace - virtual void SAL_CALL replaceByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XNameContainer - virtual void SAL_CALL insertByName(const ::rtl::OUString& Name, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::ElementExistException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeByName(const ::rtl::OUString& Name) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XIndexAccess - virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Any SAL_CALL getByIndex(sal_Int32 _nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XIndexReplace - virtual void SAL_CALL replaceByIndex(sal_Int32 _nIndex, const ::com::sun::star::uno::Any& _rElement) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XIndexContainer - virtual void SAL_CALL insertByIndex(sal_Int32 _nIndex, const ::com::sun::star::uno::Any& Element) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeByIndex(sal_Int32 _nIndex) throw(::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::container::XContainer - virtual void SAL_CALL addContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeContainerListener(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener>& _rxListener) throw(::com::sun::star::uno::RuntimeException); - -// ::com::sun::star::script::XEventAttacherManager - virtual void SAL_CALL registerScriptEvent( sal_Int32 nIndex, const ::com::sun::star::script::ScriptEventDescriptor& aScriptEvent ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL registerScriptEvents( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor >& aScriptEvents ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL revokeScriptEvents( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL insertEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::script::ScriptEventDescriptor > SAL_CALL getScriptEvents( sal_Int32 Index ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL attach( sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xObject, const ::com::sun::star::uno::Any& aHelper ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::ServiceNotRegisteredException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL detach( sal_Int32 nIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xObject ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL addScriptListener( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xListener ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL removeScriptListener( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& Listener ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); - -protected: - // helper - virtual void SAL_CALL disposing(); - virtual void removeElementsNoEvents(sal_Int32 nIndex); - - /** to be overridden if elements which are to be inserted into the container shall be checked - - <p>the ElementDescription given can be used to cache information about the object - it will be passed - later on to implInserted/implReplaced.</p> - */ - virtual void approveNewElement( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject, - ElementDescription* _pElement - ); - - virtual ElementDescription* createElementMetaData( ); - - /** inserts an object into our internal structures - - @param _nIndex - the index at which position it should be inserted - @param _bEvents - if <TRUE/>, event knittings will be done - @param _pApprovalResult - must contain the result of an approveNewElement call. Can be <NULL/>, in this case, the approval - is done within implInsert. - @param _bFire - if <TRUE/>, a notification about the insertion will be fired - */ - void implInsert( - sal_Int32 _nIndex, - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObject, - sal_Bool _bEvents /* = sal_True */, - ElementDescription* _pApprovalResult /* = NULL */ , - sal_Bool _bFire /* = sal_True */ - ) throw(::com::sun::star::lang::IllegalArgumentException); - - // called after the object is inserted, but before the "real listeners" are notified - virtual void implInserted( const ElementDescription* _pElement ) { } - // called after the object is removed, but before the "real listeners" are notified - virtual void implRemoved(const InterfaceRef& _rxObject) { } - // called after an object was replaced, but before the "real listeners" are notified - virtual void implReplaced( const InterfaceRef& _rxReplacedObject, const ElementDescription* _pElement ) { } - - void SAL_CALL writeEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectOutputStream>& _rxOutStream); - void SAL_CALL readEvents(const ::com::sun::star::uno::Reference< ::com::sun::star::io::XObjectInputStream>& _rxInStream); - - /** replace an element, specified by position - - @precond <arg>_nIndex</arg> is a valid index - @precond our mutex is locked exactly once, by the guard specified with <arg>_rClearBeforeNotify</arg> - - */ - void implReplaceByIndex( - const sal_Int32 _nIndex, - const ::com::sun::star::uno::Any& _rNewElement, - ::osl::ClearableMutexGuard& _rClearBeforeNotify - ); - - /** removes an element, specified by position - - @precond <arg>_nIndex</arg> is a valid index - @precond our mutex is locked exactly once, by the guard specified with <arg>_rClearBeforeNotify</arg> - - */ - void implRemoveByIndex( - const sal_Int32 _nIndex, - ::osl::ClearableMutexGuard& _rClearBeforeNotify - ); - - /** validates the given index - @throws ::com::sun::star::lang::IndexOutOfBoundsException - if the given index does not denote a valid position in our childs array - */ - void implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ); - -private: - // the runtime event format has changed from version SO5.2 to OOo - enum EventFormat - { - efVersionSO5x, - efVersionSO6x - }; - void transformEvents( const EventFormat _eTargetFormat ); -}; - -//================================================================== -//= OFormComponents -//================================================================== -typedef ::cppu::ImplHelper1< ::com::sun::star::form::XFormComponent> OFormComponents_BASE; -typedef ::cppu::OComponentHelper FormComponentsBase; - // else MSVC kills itself on some statements -class OFormComponents : public FormComponentsBase, - public OInterfaceContainer, - public OFormComponents_BASE -{ -protected: - ::osl::Mutex m_aMutex; - ::comphelper::InterfaceRef m_xParent; - -public: - OFormComponents(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory); - virtual ~OFormComponents(); - - DECLARE_UNO3_AGG_DEFAULTS(OFormComponents, FormComponentsBase); - - virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation(const ::com::sun::star::uno::Type& _rType) throw(::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException); - -// OComponentHelper - virtual void SAL_CALL disposing(); - -// ::com::sun::star::form::XFormComponent - virtual ::comphelper::InterfaceRef SAL_CALL getParent() throw(::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL setParent(const ::comphelper::InterfaceRef& Parent) throw(::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); -}; -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_INTERFACE_CONTAINER_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/formsmodule.hxx b/binfilter/bf_forms/source/inc/formsmodule.hxx deleted file mode 100644 index 6a889afe1c3c..000000000000 --- a/binfilter/bf_forms/source/inc/formsmodule.hxx +++ /dev/null @@ -1,222 +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. - * - ************************************************************************/ - -#ifndef FORMS_MODULE_HXX -#define FORMS_MODULE_HXX - -#include <cppuhelper/factory.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -typedef ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > (SAL_CALL *FactoryInstantiation) - ( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rServiceManager, - const ::rtl::OUString & _rComponentName, - ::cppu::ComponentInstantiation _pCreateFunction, - const ::com::sun::star::uno::Sequence< ::rtl::OUString > & _rServiceNames, - rtl_ModuleCount* _pModuleCounter - ); - - //========================================================================= - //= OFormsModule - //========================================================================= - class OFormsModule - { - private: - OFormsModule(); - // not implemented. OFormsModule is a static class - - protected: - // auto registration administration - static ::com::sun::star::uno::Sequence< ::rtl::OUString >* - s_pImplementationNames; - static ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > >* - s_pSupportedServices; - static ::com::sun::star::uno::Sequence< sal_Int64 >* - s_pCreationFunctionPointers; - static ::com::sun::star::uno::Sequence< sal_Int64 >* - s_pFactoryFunctionPointers; - - public: - /** register a component implementing a service with the given data. - @param _rImplementationName - the implementation name of the component - @param _rServiceNames - the services the component supports - @param _pCreateFunction - a function for creating an instance of the component - @param _pFactoryFunction - a function for creating a factory for that component - @see revokeComponent - */ - static void registerComponent( - const ::rtl::OUString& _rImplementationName, - const ::com::sun::star::uno::Sequence< ::rtl::OUString >& _rServiceNames, - ::cppu::ComponentInstantiation _pCreateFunction, - FactoryInstantiation _pFactoryFunction); - - /** revoke the registration for the specified component - @param _rImplementationName - the implementation name of the component - */ - static void revokeComponent( - const ::rtl::OUString& _rImplementationName); - - /** write the registration information of all known components - <p>writes the registration information of all components which are currently registered into the - specified registry.<p/> - <p>Usually used from within component_writeInfo.<p/> - @param _rxServiceManager - the service manager - @param _rRootKey - the registry key under which the information will be stored - @return - sal_True if the registration of all implementations was successfull, sal_False otherwise - */ - static sal_Bool writeComponentInfos( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager, - const ::com::sun::star::uno::Reference< ::com::sun::star::registry::XRegistryKey >& _rRootKey); - - /** creates a Factory for the component with the given implementation name. - <p>Usually used from within component_getFactory.<p/> - @param _rxServiceManager - a pointer to an XMultiServiceFactory interface as got in component_getFactory - @param _pImplementationName - the implementation name of the component - @return - the XInterface access to a factory for the component - */ - static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getComponentFactory( - const ::rtl::OUString& _rImplementationName, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceManager - ); - - private: - /** ensure that the impl class exists - @precond m_aMutex is guarded when this method gets called - */ - static void ensureImpl(); - }; - - //========================================================================== - //= OMultiInstanceAutoRegistration - //========================================================================== - template <class TYPE> - class OMultiInstanceAutoRegistration - { - public: - /** automatically registeres a multi instance component - <p>Assumed that the template argument has the three methods - <ul> - <li><code>static ::rtl::OUString getImplementationName_Static()</code><li/> - <li><code>static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()</code><li/> - <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code> - </li> - <ul/> - the instantiation of this object will automatically register the class via <method>OFormsModule::registerComponent</method>. - <p/> - <p>The factory creation function used is <code>::cppu::createSingleFactory</code>.</p> - - @see OOneInstanceAutoRegistration - */ - OMultiInstanceAutoRegistration(); - ~OMultiInstanceAutoRegistration(); - }; - - template <class TYPE> - OMultiInstanceAutoRegistration<TYPE>::OMultiInstanceAutoRegistration() - { - OFormsModule::registerComponent( - TYPE::getImplementationName_Static(), - TYPE::getSupportedServiceNames_Static(), - TYPE::Create, - ::cppu::createSingleFactory - ); - } - - template <class TYPE> - OMultiInstanceAutoRegistration<TYPE>::~OMultiInstanceAutoRegistration() - { - OFormsModule::revokeComponent(TYPE::getImplementationName_Static()); - } - - //========================================================================== - //= OOneInstanceAutoRegistration - //========================================================================== - template <class TYPE> - class OOneInstanceAutoRegistration - { - public: - /** automatically registeres a single instance component - <p>Assumed that the template argument has the three methods - <ul> - <li><code>static ::rtl::OUString getImplementationName_Static()</code><li/> - <li><code>static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static()</code><li/> - <li><code>static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > - Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&)</code> - </li> - <ul/> - the instantiation of this object will automatically register the class via <method>OFormsModule::registerComponent</method>. - <p/> - The factory creation function used is <code>::cppu::createOneInstanceFactory</code>. - @see OOneInstanceAutoRegistration - */ - OOneInstanceAutoRegistration(); - ~OOneInstanceAutoRegistration(); - }; - - template <class TYPE> - OOneInstanceAutoRegistration<TYPE>::OOneInstanceAutoRegistration() - { - OFormsModule::registerComponent( - TYPE::getImplementationName_Static(), - TYPE::getSupportedServiceNames_Static(), - TYPE::Create, - ::cppu::createOneInstanceFactory - ); - } - - template <class TYPE> - OOneInstanceAutoRegistration<TYPE>::~OOneInstanceAutoRegistration() - { - OFormsModule::revokeComponent(TYPE::getImplementationName_Static()); - } - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // FORMS_MODULE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/frm_resource.hrc b/binfilter/bf_forms/source/inc/frm_resource.hrc deleted file mode 100644 index 2f629a258a3f..000000000000 --- a/binfilter/bf_forms/source/inc/frm_resource.hrc +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#ifndef _FRM_RESOURCE_HRC_ -#define _FRM_RESOURCE_HRC_ - -#ifndef _SOLAR_HRC -#include <bf_svtools/solar.hrc> -#endif - -//------------------------------------------------------------------------------ -#define RID_FRM_STRINGS_START RID_FORMLAYER_START - - - -//------------------------------------------------------------------------------ -//- String-IDs -#define RID_BASELISTBOX_ERROR_FILLLIST ( RID_FRM_STRINGS_START + 0 ) -#define RID_STR_IMPORT_GRAPHIC ( RID_FRM_STRINGS_START + 1 ) -#define RID_STR_CONTROL_SUBSTITUTED_NAME ( RID_FRM_STRINGS_START + 2 ) -#define RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN ( RID_FRM_STRINGS_START + 3 ) -#define RID_STR_READERROR ( RID_FRM_STRINGS_START + 4 ) -#define RID_STR_CONNECTERROR ( RID_FRM_STRINGS_START + 5 ) -#define RID_ERR_LOADING_FORM ( RID_FRM_STRINGS_START + 6 ) -#define RID_ERR_REFRESHING_FORM ( RID_FRM_STRINGS_START + 7 ) -#define RID_STR_ERR_INSERTRECORD ( RID_FRM_STRINGS_START + 8 ) -#define RID_STR_ERR_UPDATERECORD ( RID_FRM_STRINGS_START + 9 ) -#define RID_STR_ERR_DELETERECORD ( RID_FRM_STRINGS_START + 10 ) -#define RID_STR_ERR_DELETERECORDS ( RID_FRM_STRINGS_START + 11 ) -#define RID_STR_NEED_NON_NULL_OBJECT ( RID_FRM_STRINGS_START + 12 ) -#define RID_STR_OPEN_GRAPHICS ( RID_FRM_STRINGS_START + 13 ) -#define RID_STR_CLEAR_GRAPHICS ( RID_FRM_STRINGS_START + 14 ) -#define RID_STR_INVALIDSTREAM ( RID_FRM_STRINGS_START + 15 ) -#define RID_STR_SYNTAXERROR ( RID_FRM_STRINGS_START + 16 ) - -#endif // _FRM_RESOURCE_HRC_ - diff --git a/binfilter/bf_forms/source/inc/frm_resource.hxx b/binfilter/bf_forms/source/inc/frm_resource.hxx deleted file mode 100644 index 02b657fbae42..000000000000 --- a/binfilter/bf_forms/source/inc/frm_resource.hxx +++ /dev/null @@ -1,81 +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. - * - ************************************************************************/ - -#ifndef _FRM_RESOURCE_HXX_ -#define _FRM_RESOURCE_HXX_ - -#include <rtl/ustring.hxx> -class SimpleResMgr; -namespace binfilter { - -//......................................................................... -namespace frm -{ - -#define FRM_RES_STRING(id) ResourceManager::loadString(id) - - //================================================================== - //= ResourceManager - //= handling ressources within the FormLayer library - //================================================================== - class ResourceManager - { - static SimpleResMgr* m_pImpl; - - private: - // no instantiation allowed - ResourceManager() { } - ~ResourceManager() { } - - // we'll instantiate one static member of the following class, which, in it's dtor, - // ensures that m_pImpl will be deleted - class EnsureDelete - { - public: - EnsureDelete() { } - ~EnsureDelete(); - }; - friend class EnsureDelete; - - protected: - static void ensureImplExists(); - - public: - /** loads the string with the specified resource id from the FormLayer resource file - */ - static ::rtl::OUString loadString(sal_uInt16 _nResId); - }; - -//......................................................................... -} -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_RESOURCE_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/ids.hxx b/binfilter/bf_forms/source/inc/ids.hxx deleted file mode 100644 index bcdca5c717fc..000000000000 --- a/binfilter/bf_forms/source/inc/ids.hxx +++ /dev/null @@ -1,40 +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. - * - ************************************************************************/ - -#ifndef _FRM_IDS_HXX_ -#define _FRM_IDS_HXX_ - -#include <bf_svtools/idhelper.hxx> -namespace binfilter { - -DECLARE_IMPLEMENTATIONID_HELPER_SMALL(frm, OImplementationIds) - -}//end of namespace binfilter -#endif // _FRM_IDS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/limitedformats.hxx b/binfilter/bf_forms/source/inc/limitedformats.hxx deleted file mode 100644 index 09fe1263de27..000000000000 --- a/binfilter/bf_forms/source/inc/limitedformats.hxx +++ /dev/null @@ -1,108 +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. - * - ************************************************************************/ - -#ifndef _FORMS_LIMITED_FORMATS_HXX_ -#define _FORMS_LIMITED_FORMATS_HXX_ - -#include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/beans/XFastPropertySet.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - //===================================================================== - //= OLimitedFormats - //===================================================================== - /** maintains translation tables format key <-> enum value - <p>Used for controls which provide a limited number for (standard) formats, which - should be available as format keys.</p> - */ - class OLimitedFormats - { - private: - static sal_Int32 s_nInstanceCount; - static ::osl::Mutex s_aMutex; - static ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > - s_xStandardFormats; - - protected: - sal_Int32 m_nFormatEnumPropertyHandle; - const sal_Int16 m_nTableId; - ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet > - m_xAggregate; - - protected: - /** ctor - <p>The class id is used to determine the translation table to use. All instances which - pass the same value here share one table.</p> - */ - OLimitedFormats( - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, - const sal_Int16 _nClassId - ); - ~OLimitedFormats(); - - protected: - void setAggregateSet( - const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XFastPropertySet >& _rxAggregate, - sal_Int32 _nOriginalPropertyHandle - ); - - protected: - void getFormatKeyPropertyValue( ::com::sun::star::uno::Any& _rValue ) const; - sal_Bool convertFormatKeyPropertyValue( - ::com::sun::star::uno::Any& _rConvertedValue, - ::com::sun::star::uno::Any& _rOldValue, - const ::com::sun::star::uno::Any& _rNewValue - ); - void setFormatKeyPropertyValue( const ::com::sun::star::uno::Any& _rNewValue ); - // setFormatKeyPropertyValue should only be called with a value got from convertFormatKeyPropertyValue! - - ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > - getFormatsSupplier() const { return s_xStandardFormats; } - - private: - void acquireSupplier(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); - void releaseSupplier(); - - static void ensureTableInitialized(const sal_Int16 _nTableId); - static void clearTable(const sal_Int16 _nTableId); - }; - -//......................................................................... -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FORMS_LIMITED_FORMATS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/property.hrc b/binfilter/bf_forms/source/inc/property.hrc deleted file mode 100644 index 3931a25e8d43..000000000000 --- a/binfilter/bf_forms/source/inc/property.hrc +++ /dev/null @@ -1,405 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ -#ifndef _FRM_PROPERTY_HRC_ -#define _FRM_PROPERTY_HRC_ - -#ifndef _RTL_USTRING_HXX_ -#include <rtl/ustring.hxx> -#endif - -#ifndef _FRM_STRINGS_HXX_ -#include "strings.hxx" -#endif - -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -// PropertyId's, welche eine Zuordnung zu einen PropertyName haben -#define PROPERTY_ID_START 0 - -#define PROPERTY_ID_NAME (PROPERTY_ID_START + 1) -#define PROPERTY_ID_TABINDEX (PROPERTY_ID_START + 2) -#define PROPERTY_ID_CONTROLSOURCE (PROPERTY_ID_START + 3) -#define PROPERTY_ID_MASTERFIELDS (PROPERTY_ID_START + 4) -#define PROPERTY_ID_DATASOURCE (PROPERTY_ID_START + 6) -#define PROPERTY_ID_CLASSID (PROPERTY_ID_START + 9) -#define PROPERTY_ID_CURSORTYPE (PROPERTY_ID_START + 10) -#define PROPERTY_ID_READONLY (PROPERTY_ID_START + 11) -#define PROPERTY_ID_NAVIGATION (PROPERTY_ID_START + 13) -#define PROPERTY_ID_CYCLE (PROPERTY_ID_START + 14) -#define PROPERTY_ID_ALLOWADDITIONS (PROPERTY_ID_START + 15) -#define PROPERTY_ID_ALLOWEDITS (PROPERTY_ID_START + 16) -#define PROPERTY_ID_ALLOWDELETIONS (PROPERTY_ID_START + 17) -#define PROPERTY_ID_CACHESIZE (PROPERTY_ID_START + 19) -#define PROPERTY_ID_LASTDIRTY (PROPERTY_ID_START + 24) -#define PROPERTY_ID_VALUE (PROPERTY_ID_START + 31) // INT32 -#define PROPERTY_ID_FORMATKEY (PROPERTY_ID_START + 33) // UINT32 -#define PROPERTY_ID_SIZE (PROPERTY_ID_START + 37) // UINT32 - // free -#define PROPERTY_ID_WIDTH (PROPERTY_ID_START + 42) // UINT16 -#define PROPERTY_ID_DEFAULTCONTROL (PROPERTY_ID_START + 43) // string -#define PROPERTY_ID_BOUNDCOLUMN (PROPERTY_ID_START + 44) // UINT16 may be null -#define PROPERTY_ID_LISTSOURCETYPE (PROPERTY_ID_START + 45) // UINT16 -#define PROPERTY_ID_LISTSOURCE (PROPERTY_ID_START + 46) // string - // free -#define PROPERTY_ID_TEXT (PROPERTY_ID_START + 48) // string -#define PROPERTY_ID_STRINGITEMLIST (PROPERTY_ID_START + 49) // wsstringsequence -#define PROPERTY_ID_LABEL (PROPERTY_ID_START + 50) // string -#define PROPERTY_ID_STATE (PROPERTY_ID_START + 52) // UINT16 - // free -#define PROPERTY_ID_FONT (PROPERTY_ID_START + 54) // font -#define PROPERTY_ID_HASNAVIGATION (PROPERTY_ID_START + 55) -#define PROPERTY_ID_ROWHEIGHT (PROPERTY_ID_START + 57) // UINT16 -#define PROPERTY_ID_BACKGROUNDCOLOR (PROPERTY_ID_START + 58) // UINT32 -#define PROPERTY_ID_FILLCOLOR (PROPERTY_ID_START + 59) // UINT32 -#define PROPERTY_ID_TEXTCOLOR (PROPERTY_ID_START + 60) // UINT32 -#define PROPERTY_ID_LINECOLOR (PROPERTY_ID_START + 61) // UINT32 -#define PROPERTY_ID_BORDER (PROPERTY_ID_START + 62) // UINT16 -#define PROPERTY_ID_ALIGN (PROPERTY_ID_START + 63) // UINT16 -#define PROPERTY_ID_DROPDOWN (PROPERTY_ID_START + 64) // BOOL -#define PROPERTY_ID_MULTI (PROPERTY_ID_START + 65) // BOOL -#define PROPERTY_ID_HSCROLL (PROPERTY_ID_START + 66) // BOOL -#define PROPERTY_ID_VSCROLL (PROPERTY_ID_START + 67) // BOOL -#define PROPERTY_ID_TABSTOP (PROPERTY_ID_START + 68) // BOOL -#define PROPERTY_ID_REFVALUE (PROPERTY_ID_START + 69) // ::rtl::OUString -#define PROPERTY_ID_BUTTONTYPE (PROPERTY_ID_START + 70) // UINT16 -#define PROPERTY_ID_DEFAULT_TEXT (PROPERTY_ID_START + 71) // ::rtl::OUString -#define PROPERTY_ID_SUBMIT_ACTION (PROPERTY_ID_START + 72) // string -#define PROPERTY_ID_SUBMIT_METHOD (PROPERTY_ID_START + 73) // FmSubmitMethod -#define PROPERTY_ID_SUBMIT_ENCODING (PROPERTY_ID_START + 74) // FmSubmitEncoding -#define PROPERTY_ID_DEFAULT_VALUE (PROPERTY_ID_START + 75) // ::rtl::OUString -#define PROPERTY_ID_SUBMIT_TARGET (PROPERTY_ID_START + 76) // ::rtl::OUString -#define PROPERTY_ID_DEFAULTCHECKED (PROPERTY_ID_START + 77) // UINT16 -#define PROPERTY_ID_VALUE_SEQ (PROPERTY_ID_START + 78) // StringSeq -#define PROPERTY_ID_IMAGE_URL (PROPERTY_ID_START + 79) // ::rtl::OUString -#define PROPERTY_ID_SELECT_SEQ (PROPERTY_ID_START + 91) // INT16Seq -#define PROPERTY_ID_DEFAULT_SELECT_SEQ (PROPERTY_ID_START + 92) // INT16Seq -#define PROPERTY_ID_MULTISELECTION (PROPERTY_ID_START + 93) // BOOL -#define PROPERTY_ID_MULTILINE (PROPERTY_ID_START + 94) // BOOL -#define PROPERTY_ID_DATE (PROPERTY_ID_START + 95) // UINT32 -#define PROPERTY_ID_DATEMIN (PROPERTY_ID_START + 96) // UINT32 -#define PROPERTY_ID_DATEMAX (PROPERTY_ID_START + 97) // UINT32 -#define PROPERTY_ID_DATEFORMAT (PROPERTY_ID_START + 98) // UINT16 -#define PROPERTY_ID_TIME (PROPERTY_ID_START + 99) // UINT32 -#define PROPERTY_ID_TIMEMIN (PROPERTY_ID_START +100) // UINT32 -#define PROPERTY_ID_TIMEMAX (PROPERTY_ID_START +101) // UINT32 -#define PROPERTY_ID_TIMEFORMAT (PROPERTY_ID_START +102) // UINT16 -#define PROPERTY_ID_VALUEMIN (PROPERTY_ID_START +103) // INT32 -#define PROPERTY_ID_VALUEMAX (PROPERTY_ID_START +104) // INT32 -#define PROPERTY_ID_VALUESTEP (PROPERTY_ID_START +105) // INT32 -#define PROPERTY_ID_CURRENCYSYMBOL (PROPERTY_ID_START +106) // ::rtl::OUString -#define PROPERTY_ID_EDITMASK (PROPERTY_ID_START +107) // ::rtl::OUString -#define PROPERTY_ID_LITERALMASK (PROPERTY_ID_START +108) // ::rtl::OUString -#define PROPERTY_ID_ENABLED (PROPERTY_ID_START +109) // BOOL -#define PROPERTY_ID_AUTOCOMPLETE (PROPERTY_ID_START +110) // BOOL -#define PROPERTY_ID_LINECOUNT (PROPERTY_ID_START +111) // UINT16 -#define PROPERTY_ID_MAXTEXTLEN (PROPERTY_ID_START +112) // UINT16 -#define PROPERTY_ID_SPIN (PROPERTY_ID_START +113) // BOOL -#define PROPERTY_ID_STRICTFORMAT (PROPERTY_ID_START +114) // BOOL -#define PROPERTY_ID_SHOWTHOUSANDSEP (PROPERTY_ID_START +115) // BOOL -#define PROPERTY_ID_HARDLINEBREAKS (PROPERTY_ID_START +116) // BOOL -#define PROPERTY_ID_PRINTABLE (PROPERTY_ID_START +117) // BOOL -#define PROPERTY_ID_TARGET_URL (PROPERTY_ID_START +118) // ::rtl::OUString -#define PROPERTY_ID_TARGET_FRAME (PROPERTY_ID_START +119) // ::rtl::OUString -#define PROPERTY_ID_TAG (PROPERTY_ID_START +120) // ::rtl::OUString -#define PROPERTY_ID_ECHO_CHAR (PROPERTY_ID_START +121) // UINT16 -#define PROPERTY_ID_EMPTY_IS_NULL (PROPERTY_ID_START +126) // Bool -#define PROPERTY_ID_DECIMAL_ACCURACY (PROPERTY_ID_START +127) // UINT16 -#define PROPERTY_ID_DATE_SHOW_CENTURY (PROPERTY_ID_START +128) // Bool -#define PROPERTY_ID_TRISTATE (PROPERTY_ID_START +129) // Bool -#define PROPERTY_ID_DEFAULT_BUTTON (PROPERTY_ID_START +130) // Bool -#define PROPERTY_ID_HIDDEN_VALUE (PROPERTY_ID_START +131) // ::rtl::OUString -#define PROPERTY_ID_DECIMALS (PROPERTY_ID_START +132) // UINT16 -#define PROPERTY_ID_AUTOINCREMENT (PROPERTY_ID_START +133) // UINT16 -#define PROPERTY_ID_FILTER_CRITERIA (PROPERTY_ID_START +135) // ::rtl::OUString -#define PROPERTY_ID_QUERY (PROPERTY_ID_START +137) // ::rtl::OUString -#define PROPERTY_ID_DEFAULT_LONG_VALUE (PROPERTY_ID_START +138) // Double -#define PROPERTY_ID_DEFAULT_DATE (PROPERTY_ID_START +139) // UINT32 -#define PROPERTY_ID_DEFAULT_TIME (PROPERTY_ID_START +140) -#define PROPERTY_ID_HELPTEXT (PROPERTY_ID_START +141) -#define PROPERTY_ID_FONT_NAME (PROPERTY_ID_START +142) -#define PROPERTY_ID_FONT_STYLENAME (PROPERTY_ID_START +143) -#define PROPERTY_ID_FONT_FAMILY (PROPERTY_ID_START +144) -#define PROPERTY_ID_FONT_CHARSET (PROPERTY_ID_START +145) -#define PROPERTY_ID_FONT_HEIGHT (PROPERTY_ID_START +146) -#define PROPERTY_ID_FONT_WEIGHT (PROPERTY_ID_START +147) -#define PROPERTY_ID_FONT_SLANT (PROPERTY_ID_START +148) -#define PROPERTY_ID_FONT_UNDERLINE (PROPERTY_ID_START +149) -#define PROPERTY_ID_FONT_STRIKEOUT (PROPERTY_ID_START +150) -#define PROPERTY_ID_ISPASSTHROUGH (PROPERTY_ID_START +151) -#define PROPERTY_ID_HELPURL (PROPERTY_ID_START +152) // ::rtl::OUString -#define PROPERTY_ID_RECORDMARKER (PROPERTY_ID_START +153) -#define PROPERTY_ID_BOUNDFIELD (PROPERTY_ID_START +154) -#define PROPERTY_ID_FORMATSSUPPLIER (PROPERTY_ID_START +155) // XNumberFormatsSupplier -#define PROPERTY_ID_TREATASNUMERIC (PROPERTY_ID_START +156) // BOOL -#define PROPERTY_ID_EFFECTIVE_VALUE (PROPERTY_ID_START +157) // ANY (string or double) -#define PROPERTY_ID_EFFECTIVE_DEFAULT (PROPERTY_ID_START +158) // dito -#define PROPERTY_ID_EFFECTIVE_MIN (PROPERTY_ID_START +159) // dito -#define PROPERTY_ID_EFFECTIVE_MAX (PROPERTY_ID_START +160) // dito -#define PROPERTY_ID_HIDDEN (PROPERTY_ID_START +161) // BOOL -#define PROPERTY_ID_FILTERPROPOSAL (PROPERTY_ID_START +162) // BOOL -#define PROPERTY_ID_FIELDSOURCE (PROPERTY_ID_START +163) // String -#define PROPERTY_ID_TABLENAME (PROPERTY_ID_START +164) // String -#define PROPERTY_ID_FILTERSUPPLIER (PROPERTY_ID_START +165) // XIndexAccess -#define PROPERTY_ID_CURRENTFILTER (PROPERTY_ID_START +166) // INT32 -#define PROPERTY_ID_SELECTED_FIELDS (PROPERTY_ID_START +167) -#define PROPERTY_ID_SELECTED_TABLES (PROPERTY_ID_START +168) -#define PROPERTY_ID_THREADSAFE (PROPERTY_ID_START +169) // BOOL -#define PROPERTY_ID_CONTROLLABEL (PROPERTY_ID_START +171) // XPropertySet -#define PROPERTY_ID_CURRSYM_POSITION (PROPERTY_ID_START +172) // String -#define PROPERTY_ID_SOURCE (PROPERTY_ID_START +173) // XInterface -#define PROPERTY_ID_CURSORCOLOR (PROPERTY_ID_START +174) // INT32 -#define PROPERTY_ID_ALWAYSSHOWCURSOR (PROPERTY_ID_START +175) // BOOL -#define PROPERTY_ID_DISPLAYSYNCHRON (PROPERTY_ID_START +176) // BOOL - -#define PROPERTY_ID_ISMODIFIED (PROPERTY_ID_START +177) // BOOL -#define PROPERTY_ID_ISNEW (PROPERTY_ID_START +178) // BOOL -#define PROPERTY_ID_PRIVILEGES (PROPERTY_ID_START +179) // INT32 -#define PROPERTY_ID_DETAILFIELDS (PROPERTY_ID_START +180) // Sequence< ::rtl::OUString > -#define PROPERTY_ID_COMMAND (PROPERTY_ID_START +181) // String -#define PROPERTY_ID_COMMANDTYPE (PROPERTY_ID_START +182) // INT32 (com::sun::star::sdb::CommandType) -#define PROPERTY_ID_RESULTSET_CONCURRENCY (PROPERTY_ID_START +183)// INT32 (com::sun::star::sdbc::ResultSetConcurrency) -#define PROPERTY_ID_INSERTONLY (PROPERTY_ID_START +184) // BOOL -#define PROPERTY_ID_RESULTSET_TYPE (PROPERTY_ID_START +185) // INT32 (com::sun::star::sdbc::ResultSetType) -#define PROPERTY_ID_ESCAPE_PROCESSING (PROPERTY_ID_START +186) // BOOL -#define PROPERTY_ID_APPLYFILTER (PROPERTY_ID_START +187) // BOOL - -#define PROPERTY_ID_ISNULLABLE (PROPERTY_ID_START +188) // BOOL -#define PROPERTY_ID_ACTIVECOMMAND (PROPERTY_ID_START +189) // String -#define PROPERTY_ID_ISCURRENCY (PROPERTY_ID_START +190) // BOOL -#define PROPERTY_ID_URL (PROPERTY_ID_START +192) // String -#define PROPERTY_ID_TITLE (PROPERTY_ID_START +193) // String -#define PROPERTY_ID_ACTIVE_CONNECTION (PROPERTY_ID_START +194) // com::sun::star::sdbc::XConnection -#define PROPERTY_ID_SCALE (PROPERTY_ID_START +195) // INT32 -#define PROPERTY_ID_SORT (PROPERTY_ID_START +196) // String - -#define PROPERTY_ID_ROWCOUNT (PROPERTY_ID_START +197) -#define PROPERTY_ID_ROWCOUNTFINAL (PROPERTY_ID_START +198) -#define PROPERTY_ID_FETCHSIZE (PROPERTY_ID_START +199) -#define PROPERTY_ID_STATEMENT (PROPERTY_ID_START +200) -#define PROPERTY_ID_SEARCHABLE (PROPERTY_ID_START +201) -#define PROPERTY_ID_ISREADONLY (PROPERTY_ID_START +202) -#define PROPERTY_ID_ISREQUIRED (PROPERTY_ID_START +203) -#define PROPERTY_ID_FIELDTYPE (PROPERTY_ID_START +204) -#define PROPERTY_ID_COLUMNSERVICENAME (PROPERTY_ID_START +205) -#define PROPERTY_ID_CONTROLSOURCEPROPERTY (PROPERTY_ID_START +206) -#define PROPERTY_ID_REALNAME (PROPERTY_ID_START +207) -#define PROPERTY_ID_FONT_WORDLINEMODE (PROPERTY_ID_START +208) -#define PROPERTY_ID_TEXTLINECOLOR (PROPERTY_ID_START +209) -#define PROPERTY_ID_FONTEMPHASISMARK (PROPERTY_ID_START +210) -#define PROPERTY_ID_FONTRELIEF (PROPERTY_ID_START +211) - -#define PROPERTY_ID_DISPATCHURLINTERNAL (PROPERTY_ID_START +212) // BOOL - -#define PROPERTY_ID_PERSISTENCE_MAXTEXTLENGTH (PROPERTY_ID_START +213) // sal_Int16 - - -// start ID fuer aggregierte Properties -#define PROPERTY_ID_AGGREGATE_ID (PROPERTY_ID_START + 10000) - -// extern declaration fuer vordefinierte Strings, laengst nicht vollstaendig -DECLARE_CONSTASCII_USTRING(PROPERTY_NAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_TAG); -DECLARE_CONSTASCII_USTRING(PROPERTY_TABINDEX); -DECLARE_CONSTASCII_USTRING(PROPERTY_CLASSID); -DECLARE_CONSTASCII_USTRING(PROPERTY_ALIGN); -DECLARE_CONSTASCII_USTRING(PROPERTY_ROWCOUNT); -DECLARE_CONSTASCII_USTRING(PROPERTY_ROWCOUNTFINAL); -DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHSIZE); -DECLARE_CONSTASCII_USTRING(PROPERTY_VALUE); -DECLARE_CONSTASCII_USTRING(PROPERTY_VALUEMIN); -DECLARE_CONSTASCII_USTRING(PROPERTY_VALUEMAX); -DECLARE_CONSTASCII_USTRING(PROPERTY_VALUESTEP); -DECLARE_CONSTASCII_USTRING(PROPERTY_TEXT); -DECLARE_CONSTASCII_USTRING(PROPERTY_LABEL); -DECLARE_CONSTASCII_USTRING(PROPERTY_NAVIGATION); -DECLARE_CONSTASCII_USTRING(PROPERTY_CYCLE); -DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCE); -DECLARE_CONSTASCII_USTRING(PROPERTY_ENABLED); -DECLARE_CONSTASCII_USTRING(PROPERTY_SPIN); -DECLARE_CONSTASCII_USTRING(PROPERTY_READONLY); -DECLARE_CONSTASCII_USTRING(PROPERTY_FILTER_CRITERIA); -DECLARE_CONSTASCII_USTRING(PROPERTY_AUTOINCREMENT); -DECLARE_CONSTASCII_USTRING(PROPERTY_CACHESIZE); -DECLARE_CONSTASCII_USTRING(PROPERTY_LASTDIRTY); -DECLARE_CONSTASCII_USTRING(PROPERTY_STATEMENT); -DECLARE_CONSTASCII_USTRING(PROPERTY_WIDTH); -DECLARE_CONSTASCII_USTRING(PROPERTY_SEARCHABLE); -DECLARE_CONSTASCII_USTRING(PROPERTY_MULTILINE); -DECLARE_CONSTASCII_USTRING(PROPERTY_TARGET_URL); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL); -DECLARE_CONSTASCII_USTRING(PROPERTY_MAXTEXTLEN); -DECLARE_CONSTASCII_USTRING(PROPERTY_SIZE); -DECLARE_CONSTASCII_USTRING(PROPERTY_DATE); -DECLARE_CONSTASCII_USTRING(PROPERTY_TIME); -DECLARE_CONSTASCII_USTRING(PROPERTY_STATE); -DECLARE_CONSTASCII_USTRING(PROPERTY_TRISTATE); -DECLARE_CONSTASCII_USTRING(PROPERTY_HIDDEN_VALUE); -DECLARE_CONSTASCII_USTRING(PROPERTY_TARGET_FRAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_BUTTONTYPE); -DECLARE_CONSTASCII_USTRING(PROPERTY_STRINGITEMLIST); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_TEXT); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTCHECKED); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_DATE); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_TIME); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_VALUE); -DECLARE_CONSTASCII_USTRING(PROPERTY_FORMATKEY); -DECLARE_CONSTASCII_USTRING(PROPERTY_FORMATSSUPPLIER); -DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_ACTION); -DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_TARGET); -DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_METHOD); -DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_ENCODING); -DECLARE_CONSTASCII_USTRING(PROPERTY_IMAGE_URL); -DECLARE_CONSTASCII_USTRING(PROPERTY_EMPTY_IS_NULL); -DECLARE_CONSTASCII_USTRING(PROPERTY_LISTSOURCETYPE); -DECLARE_CONSTASCII_USTRING(PROPERTY_LISTSOURCE); -DECLARE_CONSTASCII_USTRING(PROPERTY_SELECT_SEQ); -DECLARE_CONSTASCII_USTRING(PROPERTY_VALUE_SEQ); -DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_SELECT_SEQ); -DECLARE_CONSTASCII_USTRING(PROPERTY_MULTISELECTION); -DECLARE_CONSTASCII_USTRING(PROPERTY_DECIMAL_ACCURACY); -DECLARE_CONSTASCII_USTRING(PROPERTY_EDITMASK); -DECLARE_CONSTASCII_USTRING(PROPERTY_ISREADONLY); -DECLARE_CONSTASCII_USTRING(PROPERTY_ISREQUIRED); -DECLARE_CONSTASCII_USTRING(PROPERTY_FIELDTYPE); -DECLARE_CONSTASCII_USTRING(PROPERTY_DECIMALS); -DECLARE_CONSTASCII_USTRING(PROPERTY_REFVALUE); -DECLARE_CONSTASCII_USTRING(PROPERTY_STRICTFORMAT); -DECLARE_CONSTASCII_USTRING(PROPERTY_DATASOURCE); -DECLARE_CONSTASCII_USTRING(PROPERTY_ALLOWADDITIONS); -DECLARE_CONSTASCII_USTRING(PROPERTY_ALLOWEDITS); -DECLARE_CONSTASCII_USTRING(PROPERTY_ALLOWDELETIONS); -DECLARE_CONSTASCII_USTRING(PROPERTY_MASTERFIELDS); -DECLARE_CONSTASCII_USTRING(PROPERTY_ISPASSTHROUGH); -DECLARE_CONSTASCII_USTRING(PROPERTY_QUERY); -DECLARE_CONSTASCII_USTRING(PROPERTY_LITERALMASK); -DECLARE_CONSTASCII_USTRING(PROPERTY_SHOWTHOUSANDSEP); -DECLARE_CONSTASCII_USTRING(PROPERTY_CURRENCYSYMBOL); -DECLARE_CONSTASCII_USTRING(PROPERTY_DATEFORMAT); -DECLARE_CONSTASCII_USTRING(PROPERTY_DATEMIN); -DECLARE_CONSTASCII_USTRING(PROPERTY_DATEMAX); -DECLARE_CONSTASCII_USTRING(PROPERTY_DATE_SHOW_CENTURY); -DECLARE_CONSTASCII_USTRING(PROPERTY_TIMEFORMAT); -DECLARE_CONSTASCII_USTRING(PROPERTY_TIMEMIN); -DECLARE_CONSTASCII_USTRING(PROPERTY_TIMEMAX); -DECLARE_CONSTASCII_USTRING(PROPERTY_LINECOUNT); -DECLARE_CONSTASCII_USTRING(PROPERTY_BOUNDCOLUMN); -DECLARE_CONSTASCII_USTRING(PROPERTY_HASNAVIGATION); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT); -DECLARE_CONSTASCII_USTRING(PROPERTY_BACKGROUNDCOLOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_FILLCOLOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_TEXTCOLOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_LINECOLOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_BORDER); -DECLARE_CONSTASCII_USTRING(PROPERTY_DROPDOWN); -DECLARE_CONSTASCII_USTRING(PROPERTY_MULTI); -DECLARE_CONSTASCII_USTRING(PROPERTY_HSCROLL); -DECLARE_CONSTASCII_USTRING(PROPERTY_VSCROLL); -DECLARE_CONSTASCII_USTRING(PROPERTY_TABSTOP); -DECLARE_CONSTASCII_USTRING(PROPERTY_AUTOCOMPLETE); -DECLARE_CONSTASCII_USTRING(PROPERTY_HARDLINEBREAKS); -DECLARE_CONSTASCII_USTRING(PROPERTY_PRINTABLE); -DECLARE_CONSTASCII_USTRING(PROPERTY_ECHO_CHAR); -DECLARE_CONSTASCII_USTRING(PROPERTY_ROWHEIGHT); -DECLARE_CONSTASCII_USTRING(PROPERTY_HELPTEXT); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_NAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_STYLENAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_FAMILY); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_CHARSET); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_HEIGHT); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_WEIGHT); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_SLANT); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_UNDERLINE); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_WORDLINEMODE); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_STRIKEOUT); -DECLARE_CONSTASCII_USTRING(PROPERTY_TEXTLINECOLOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONTEMPHASISMARK); -DECLARE_CONSTASCII_USTRING(PROPERTY_FONTRELIEF); -DECLARE_CONSTASCII_USTRING(PROPERTY_HELPURL); -DECLARE_CONSTASCII_USTRING(PROPERTY_RECORDMARKER); -DECLARE_CONSTASCII_USTRING(PROPERTY_BOUNDFIELD); -DECLARE_CONSTASCII_USTRING(PROPERTY_TREATASNUMERIC); -DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_VALUE); -DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_DEFAULT); -DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MIN); -DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MAX); -DECLARE_CONSTASCII_USTRING(PROPERTY_HIDDEN); -DECLARE_CONSTASCII_USTRING(PROPERTY_FILTERPROPOSAL); -DECLARE_CONSTASCII_USTRING(PROPERTY_FIELDSOURCE); -DECLARE_CONSTASCII_USTRING(PROPERTY_TABLENAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_FILTERSUPPLIER); -DECLARE_CONSTASCII_USTRING(PROPERTY_CURRENTFILTER); -DECLARE_CONSTASCII_USTRING(PROPERTY_SELECTED_FIELDS); -DECLARE_CONSTASCII_USTRING(PROPERTY_SELECTED_TABLES); -DECLARE_CONSTASCII_USTRING(PROPERTY_THREADSAFE); -DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLLABEL); -DECLARE_CONSTASCII_USTRING(PROPERTY_CURRSYM_POSITION); -DECLARE_CONSTASCII_USTRING(PROPERTY_SOURCE); -DECLARE_CONSTASCII_USTRING(PROPERTY_CURSORCOLOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_ALWAYSSHOWCURSOR); -DECLARE_CONSTASCII_USTRING(PROPERTY_DISPLAYSYNCHRON); - -DECLARE_CONSTASCII_USTRING(PROPERTY_ISMODIFIED); -DECLARE_CONSTASCII_USTRING(PROPERTY_ISNEW); -DECLARE_CONSTASCII_USTRING(PROPERTY_PRIVILEGES); -DECLARE_CONSTASCII_USTRING(PROPERTY_DETAILFIELDS); -DECLARE_CONSTASCII_USTRING(PROPERTY_COMMAND); -DECLARE_CONSTASCII_USTRING(PROPERTY_COMMANDTYPE); -DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSET_CONCURRENCY); -DECLARE_CONSTASCII_USTRING(PROPERTY_INSERTONLY); -DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSET_TYPE); -DECLARE_CONSTASCII_USTRING(PROPERTY_ESCAPE_PROCESSING); -DECLARE_CONSTASCII_USTRING(PROPERTY_APPLYFILTER); - -DECLARE_CONSTASCII_USTRING(PROPERTY_ISNULLABLE); -DECLARE_CONSTASCII_USTRING(PROPERTY_ACTIVECOMMAND); -DECLARE_CONSTASCII_USTRING(PROPERTY_ISCURRENCY); -DECLARE_CONSTASCII_USTRING(PROPERTY_URL); -DECLARE_CONSTASCII_USTRING(PROPERTY_TITLE); -DECLARE_CONSTASCII_USTRING(PROPERTY_ACTIVE_CONNECTION); -DECLARE_CONSTASCII_USTRING(PROPERTY_SCALE); -DECLARE_CONSTASCII_USTRING(PROPERTY_SORT); -DECLARE_CONSTASCII_USTRING(PROPERTY_COLUMNSERVICENAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCEPROPERTY); -DECLARE_CONSTASCII_USTRING(PROPERTY_REALNAME); -DECLARE_CONSTASCII_USTRING(PROPERTY_USER); -DECLARE_CONSTASCII_USTRING(PROPERTY_PASSWORD); -DECLARE_CONSTASCII_USTRING(PROPERTY_DISPATCHURLINTERNAL); - -DECLARE_CONSTASCII_USTRING(PROPERTY_PERSISTENCE_MAXTEXTLENGTH); - -//......................................................................... -} -//......................................................................... -}// namespace binfilter - -#endif // _FRM_PROPERTY_HRC_ - diff --git a/binfilter/bf_forms/source/inc/property.hxx b/binfilter/bf_forms/source/inc/property.hxx deleted file mode 100644 index 8671674ebc9a..000000000000 --- a/binfilter/bf_forms/source/inc/property.hxx +++ /dev/null @@ -1,209 +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. - * - ************************************************************************/ - -#ifndef _FRM_PROPERTY_HXX_ -#define _FRM_PROPERTY_HXX_ - - - -#include <comphelper/propagg.hxx> -#include <comphelper/stl_types.hxx> -namespace binfilter { - - using namespace ::comphelper; - -//========================================================================= -//= property helper classes -//========================================================================= - -//... namespace frm ....................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= assigment property handle <-> property name -//= used by the PropertySetAggregationHelper -//================================================================== - -class PropertyInfoService -{ - //.................................................................. - struct PropertyAssignment - { - ::rtl::OUString sName; - sal_Int32 nHandle; - - PropertyAssignment() { nHandle = -1; } - PropertyAssignment(const PropertyAssignment& _rSource) - :sName(_rSource.sName), nHandle(_rSource.nHandle) { } - PropertyAssignment(const ::rtl::OUString& _rName, sal_Int32 _nHandle) - :sName(_rName), nHandle(_nHandle) { } - - }; - - DECLARE_STL_VECTOR(PropertyAssignment, PropertyMap); - static PropertyMap s_AllKnownProperties; - - //.................................................................. - // comparing two PropertyAssignment's -public: - typedef PropertyAssignment PUBLIC_SOLARIS_COMPILER_HACK; - // did not get the following compiled under with SUNPRO 5 without this - // public typedef -private: - friend struct PropertyAssignmentNameCompareLess; - typedef ::std::binary_function< PUBLIC_SOLARIS_COMPILER_HACK, PUBLIC_SOLARIS_COMPILER_HACK, sal_Bool > PropertyAssignmentNameCompareLess_Base; - struct PropertyAssignmentNameCompareLess : public PropertyAssignmentNameCompareLess_Base - { - inline sal_Bool operator() (const PUBLIC_SOLARIS_COMPILER_HACK& _rL, const PUBLIC_SOLARIS_COMPILER_HACK& _rR) const - { - return (_rL.sName.compareTo(_rR.sName) < 0); - } - }; - -public: - PropertyInfoService() { } - -public: - static sal_Int32 getPropertyId(const ::rtl::OUString& _rName); - static ::rtl::OUString getPropertyName(sal_Int32 _nHandle); - -private: - static void initialize(); -}; - -//.................................................................. -// a class implementing the comphelper::IPropertyInfoService -class ConcretInfoService : public ::comphelper::IPropertyInfoService -{ -public: - virtual sal_Int32 getPreferedPropertyId(const ::rtl::OUString& _rName); -}; - -//------------------------------------------------------------------------------ -#define DECL_PROP_IMPL(varname, type) \ - pProps[nPos++] = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type* >(NULL)), - -//------------------------------------------------------------------------------ -#define DECL_BOOL_PROP_IMPL(varname) \ -pProps[nPos++] = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getBooleanCppuType(), - -//------------------------------------------------------------------------------ -#define DECL_IFACE_PROP_IMPL(varname, type) \ -pProps[nPos++] = com::sun::star::beans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< com::sun::star::uno::Reference< type >* >(NULL)), - -//------------------------------------------------------------------------------ -#define BEGIN_AGGREGATION_PROPERTY_HELPER(count, aggregate) \ - _rProps.realloc(count); \ - com::sun::star::beans::Property* pProps = _rProps.getArray(); \ - sal_Int32 nPos = 0; \ - \ - if (aggregate.is()) \ - _rAggregateProps = aggregate->getPropertySetInfo()->getProperties(); \ - -//------------------------------------------------------------------------------ -#define BEGIN_PROPERTY_ARRAY_HELPER(count) \ - staruno::Sequence<starbeans::Property> aProps(count); \ - starbeans::Property* pProps = aProps.getArray(); \ - sal_Int32 nPos = 0; \ - -// === -//------------------------------------------------------------------------------ -#define DECL_PROP0(varname, type) \ - DECL_PROP_IMPL(varname, type) 0) - -//------------------------------------------------------------------------------ -#define DECL_PROP1(varname, type, attrib1) \ - DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1) - -//------------------------------------------------------------------------------ -#define DECL_PROP2(varname, type, attrib1, attrib2) \ - DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2) - -//------------------------------------------------------------------------------ -#define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \ - DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3) - -//------------------------------------------------------------------------------ -#define DECL_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \ - DECL_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2 | com::sun::star::beans::PropertyAttribute::attrib3 | com::sun::star::beans::PropertyAttribute::attrib4) - -// === some property types require special handling -// === such as interfaces -//------------------------------------------------------------------------------ -#define DECL_IFACE_PROP0(varname, type) \ - DECL_IFACE_PROP_IMPL(varname, type) 0) - -//------------------------------------------------------------------------------ -#define DECL_IFACE_PROP1(varname, type, attrib1) \ - DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1) - -//------------------------------------------------------------------------------ -#define DECL_IFACE_PROP2(varname, type, attrib1, attrib2) \ - DECL_IFACE_PROP_IMPL(varname, type) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2) - -//------------------------------------------------------------------------------ -#define DECL_IFACE_PROP3(varname, type, attrib1, attrib2, attrib3) \ - DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3) - -//------------------------------------------------------------------------------ -#define DECL_IFACE_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \ - DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3 | PropertyAttribute::attrib4) - -// === or Boolean properties -//------------------------------------------------------------------------------ -#define DECL_BOOL_PROP0(varname) \ - DECL_BOOL_PROP_IMPL(varname) 0) - -//------------------------------------------------------------------------------ -#define DECL_BOOL_PROP1(varname, attrib1) \ - DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1) - -//------------------------------------------------------------------------------ -#define DECL_BOOL_PROP2(varname, attrib1, attrib2) \ - DECL_BOOL_PROP_IMPL(varname) com::sun::star::beans::PropertyAttribute::attrib1 | com::sun::star::beans::PropertyAttribute::attrib2) - -// === -//------------------------------------------------------------------------------ -#define END_AGGREGATION_PROPERTY_HELPER() \ - DBG_ASSERT(nPos == _rProps.getLength(), "<...>::getInfohelper : forgot to adjust the count ?"); \ - -//------------------------------------------------------------------------------ -#define END_PROPERTY_ARRAY_HELPER() \ - DBG_ASSERT(nPos == aProps.getLength(), "<...>::getInfohelper : forgot to adjust the count ?"); \ - return new ::cppu::OPropertyArrayHelper(aProps); - -//......................................................................... -} -//... namespace frm ....................................................... - -}//end of namespace binfilter -#endif // _FRM_PROPERTY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/services.hxx b/binfilter/bf_forms/source/inc/services.hxx deleted file mode 100644 index 2cdcb251847c..000000000000 --- a/binfilter/bf_forms/source/inc/services.hxx +++ /dev/null @@ -1,213 +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. - * - ************************************************************************/ - -#ifndef _FRM_SERVICES_HXX_ -#define _FRM_SERVICES_HXX_ - -#include <rtl/ustring.hxx> - -#include "strings.hxx" -namespace binfilter { - -//... namespace frm ....................................................... -namespace frm -{ -//......................................................................... - -// alle serviceNamen -DECLARE_CONSTASCII_USTRING(FRM_NUMBER_FORMATTER); -DECLARE_CONSTASCII_USTRING(FRM_NUMBER_FORMATS_SUPPLIER); - -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_EDIT); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_LISTBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_COMBOBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_RADIOBUTTON); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_GROUPBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_FIXEDTEXT); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_COMMANDBUTTON); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_CHECKBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_IMAGEBUTTON); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_FILECONTROL); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_DATEFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_FORMATTEDFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROL_IMAGECONTROL); - -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_EDIT); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_LISTBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMBOBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_RADIOBUTTON); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_GROUPBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_FIXEDTEXT); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMMANDBUTTON); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_CHECKBOX); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGEBUTTON); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_FILECONTROL); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_DATEFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_FORMATTEDFIELD); -DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGECONTROL); - -DECLARE_CONSTASCII_USTRING(AWT_CONTROL_TEXTFIELD); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FORM); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_EDIT); // alter service name (5.0) -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_TEXTFIELD); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_LISTBOX); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_COMBOBOX); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_RADIOBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_GROUPBOX); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FIXEDTEXT); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_COMMANDBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_CHECKBOX); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_GRID); // alter service name (5.0) -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_GRIDCONTROL); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_IMAGEBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FILECONTROL); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_DATEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FORMATTEDFIELD); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_HIDDEN); // alter service name (5.0) -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_HIDDENCONTROL); - -DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_IMAGECONTROL); - -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_LISTBOX); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_RADIOBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_COMBOBOX); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_GROUPBOX); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_CHECKBOX); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_FIXEDTEXT); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_COMMANDBUTTON); - -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_GRID); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_GRIDCONTROL); - -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_IMAGEBUTTON); - -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_EDIT); // alt -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_TEXTFIELD); - -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_DATEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_FILECONTROL); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_IMAGECONTROL); -DECLARE_CONSTASCII_USTRING(FRM_CONTROL_FORMATTEDFIELD); - -DECLARE_CONSTASCII_USTRING(SRV_SDB_ROWSET); -DECLARE_CONSTASCII_USTRING(SRV_SDB_CONNECTION); -DECLARE_CONSTASCII_USTRING(SRV_SDBC_STATEMENT); - -DECLARE_CONSTASCII_USTRING(SRV_AWT_POINTER); -DECLARE_CONSTASCII_USTRING(SRV_AWT_IMAGEPRODUCER); - - -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORM); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HTMLFORM); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATAFORM); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TEXTFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_LISTBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMBOBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_RADIOBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GROUPBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FIXEDTEXT); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMMANDBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CHECKBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GRIDCONTROL); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_IMAGEBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FILECONTROL); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HIDDENCONTROL); -DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORMATTEDFIELD); - -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_IMAGECONTROL ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_RADIOBUTTON ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_CHECKBOX ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_LISTBOX ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_COMBOBOX ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_TEXTFIELD ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_DATEFIELD ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_TIMEFIELD ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_NUMERICFIELD ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD ); -DECLARE_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_PATTERNFIELD ); - -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_TEXTFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_LISTBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMBOBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_RADIOBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_GROUPBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_FIXEDTEXT); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMMANDBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_CHECKBOX); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_GRIDCONTROL); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGEBUTTON); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_TIMEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_DATEFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_NUMERICFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_CURRENCYFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_PATTERNFIELD); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGECONTROL); -DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_FORMATTEDFIELD); - -DECLARE_CONSTASCII_USTRING(FRM_SUN_FORMS_COLLECTION); -DECLARE_CONSTASCII_USTRING(FRM_SUN_INTERNATIONAL_INFO); - - -DECLARE_CONSTASCII_USTRING(FRM_SUN_FORMCOMPONENT); - - -//......................................................................... -} -//... namespace frm ....................................................... - -}//end of namespace binfilter -#endif // _FRM_SERVICES_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/inc/strings.hxx b/binfilter/bf_forms/source/inc/strings.hxx deleted file mode 100644 index 8a7be4899c1d..000000000000 --- a/binfilter/bf_forms/source/inc/strings.hxx +++ /dev/null @@ -1,88 +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. - * - ************************************************************************/ - -#ifndef _FRM_STRINGS_HXX_ -#define _FRM_STRINGS_HXX_ - -namespace binfilter { -//......................................................................... -namespace frm -{ -//......................................................................... - -struct ConstAsciiString -{ - const sal_Char* ascii; - sal_Int32 length; - - inline operator const ::rtl::OUString () const; - inline operator const sal_Char* () const { return ascii; } - - inline ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength); - inline ~ConstAsciiString(); - -private: - mutable ::rtl::OUString* ustring; -}; - -//------------------------------------------------------------ -inline ConstAsciiString::ConstAsciiString(const sal_Char* _pAsciiZeroTerminated, const sal_Int32 _nLength) - :ascii(_pAsciiZeroTerminated) - ,length(_nLength) - ,ustring(NULL) -{ -} - -//------------------------------------------------------------ -inline ConstAsciiString::~ConstAsciiString() -{ - delete ustring; - ustring = NULL; -} - -//------------------------------------------------------------ -inline ConstAsciiString::operator const ::rtl::OUString () const -{ - if (!ustring) - ustring = new ::rtl::OUString(ascii, length, RTL_TEXTENCODING_ASCII_US); - return *ustring; -} - -#define DECLARE_CONSTASCII_USTRING(name) \ - extern ::binfilter::frm::ConstAsciiString name - -#define IMPLEMENT_CONSTASCII_USTRING(name, asciivalue) \ - ::binfilter::frm::ConstAsciiString name(asciivalue, sizeof(asciivalue) - 1) - -} // namespace frm -//......................................................................... - -}//end of namespace binfilter -#endif // _FRM_STRINGS_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/forms_InterfaceContainer.cxx b/binfilter/bf_forms/source/misc/forms_InterfaceContainer.cxx deleted file mode 100644 index 40c9c7503c22..000000000000 --- a/binfilter/bf_forms/source/misc/forms_InterfaceContainer.cxx +++ /dev/null @@ -1,1098 +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. - * - ************************************************************************/ - -#include "InterfaceContainer.hxx" - -#include <comphelper/eventattachermgr.hxx> -#include <comphelper/enumhelper.hxx> -#include <comphelper/property.hxx> -#include <comphelper/container.hxx> - -#include "property.hrc" -#include "services.hxx" -#include "frm_resource.hrc" -#include "frm_resource.hxx" - -#include <com/sun/star/io/XMarkableStream.hpp> -#include <com/sun/star/io/WrongFormatException.hpp> -#include <com/sun/star/container/XNamed.hpp> - -#include <tools/debug.hxx> - -#include <algorithm> -#include <memory> - -#include <rtl/logfile.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::script; -using namespace ::com::sun::star::io; -using namespace ::com::sun::star::form; -using namespace ::std; - - //--------------------------------------------------------------------- - static void lcl_throwIllegalArgumentException() - { - throw IllegalArgumentException(); - } - -//================================================================== -//= ElementDescription -//================================================================== -//------------------------------------------------------------------ -ElementDescription::ElementDescription( ) -{ -} - -//------------------------------------------------------------------ -ElementDescription::~ElementDescription() -{ -} - -//================================================================== -//= OInterfaceContainer -//================================================================== -//------------------------------------------------------------------ -OInterfaceContainer::OInterfaceContainer( - const Reference<XMultiServiceFactory>& _rxFactory, - ::osl::Mutex& _rMutex, - const Type& _rElementType) - :m_rMutex(_rMutex) - ,m_aContainerListeners(_rMutex) - ,m_aElementType(_rElementType) - ,m_xServiceFactory(_rxFactory) -{ - m_xEventAttacher = ::comphelper::createEventAttacherManager(m_xServiceFactory); -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::disposing() -{ - // dispose aller elemente - for (sal_Int32 i = m_aItems.size(); i > 0; --i) - { - Reference<XPropertySet> xSet(m_aItems[i - 1], UNO_QUERY); - if (xSet.is()) - xSet->removePropertyChangeListener(PROPERTY_NAME, this); - - // Eventverknuepfungen aufheben - InterfaceRef xIfc(xSet, UNO_QUERY); - m_xEventAttacher->detach(i - 1, xIfc); - m_xEventAttacher->removeEntry(i - 1); - - Reference<XComponent> xComponent(xSet, UNO_QUERY); - if (xComponent.is()) - xComponent->dispose(); - } - m_aMap.clear(); - m_aItems.clear(); - - EventObject aEvt(static_cast<XContainer*>(this)); - m_aContainerListeners.disposeAndClear(aEvt); -} - -// XPersistObject -//------------------------------------------------------------------------------ -namespace -{ - //.......................................................................... - void lcl_saveEvents( ::std::vector< Sequence< ScriptEventDescriptor > >& _rSave, - const Reference< XEventAttacherManager >& _rxManager, const sal_Int32 _nItemCount ) - { - // reserve the space needed - _rSave.reserve( _nItemCount ); - - // copy the events - for (sal_Int32 i=0; i<_nItemCount; ++i) { - _rSave.push_back(_rxManager->getScriptEvents( i )); - } - - } - - //.......................................................................... - void lcl_restoreEvents( const ::std::vector< Sequence< ScriptEventDescriptor > >& _rSave, - const Reference< XEventAttacherManager >& _rxManager ) - { - ::std::vector< Sequence< ScriptEventDescriptor > >::const_iterator aLoop = _rSave.begin(); - ::std::vector< Sequence< ScriptEventDescriptor > >::const_iterator aEnd = _rSave.end(); - for ( sal_Int32 i=0; aLoop != aEnd; ++aLoop, ++i ) - { - _rxManager->revokeScriptEvents( i ); - _rxManager->registerScriptEvents( i, *aLoop ); - } - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::writeEvents(const Reference<XObjectOutputStream>& _rxOutStream) -{ - // We're writing a document in SO 5.2 format (or even from earlier versions) - // -> convert the events from the new runtime format to the format of the 5.2 files - // but before, remember the current script events set for our children - ::std::vector< Sequence< ScriptEventDescriptor > > aSave; - lcl_saveEvents( aSave, m_xEventAttacher, m_aItems.size() ); - - transformEvents( efVersionSO5x ); - - try - { - Reference<XMarkableStream> xMark(_rxOutStream, UNO_QUERY); - sal_Int32 nMark = xMark->createMark(); - - sal_Int32 nObjLen = 0; - _rxOutStream->writeLong(nObjLen); - - Reference<XPersistObject> xScripts(m_xEventAttacher, UNO_QUERY); - if (xScripts.is()) - xScripts->write(_rxOutStream); - - // feststellen der Laenge - nObjLen = xMark->offsetToMark(nMark) - 4; - xMark->jumpToMark(nMark); - _rxOutStream->writeLong(nObjLen); - xMark->jumpToFurthest(); - xMark->deleteMark(nMark); - } - catch( const Exception& ) - { - // restore the events - lcl_restoreEvents( aSave, m_xEventAttacher ); - throw; - } - - // restore the events - lcl_restoreEvents( aSave, m_xEventAttacher ); -} - -//------------------------------------------------------------------------------ -struct TransformEventTo52Format : public ::std::unary_function< ScriptEventDescriptor, void > -{ - void operator()( ScriptEventDescriptor& _rDescriptor ) - { - if ( 0 == _rDescriptor.ScriptType.compareToAscii( "StarBasic" ) ) - { // it's a starbasic macro - sal_Int32 nPrefixLength = _rDescriptor.ScriptCode.indexOf( ':' ); - if ( 0 <= nPrefixLength ) - { // the macro name does not already contain a : -#ifdef DBG_UTIL - const ::rtl::OUString sPrefix = _rDescriptor.ScriptCode.copy( 0, nPrefixLength ); - DBG_ASSERT( 0 == sPrefix.compareToAscii( "document" ) - || 0 == sPrefix.compareToAscii( "application" ), - "TransformEventTo52Format: invalid (unknown) prefix!" ); -#endif - // cut the prefix - _rDescriptor.ScriptCode = _rDescriptor.ScriptCode.copy( nPrefixLength + 1 ); - } - } - } -}; - -//------------------------------------------------------------------------------ -struct TransformEventTo60Format : public ::std::unary_function< ScriptEventDescriptor, void > -{ - void operator()( ScriptEventDescriptor& _rDescriptor ) - { - if ( 0 == _rDescriptor.ScriptType.compareToAscii( "StarBasic" ) ) - { // it's a starbasic macro - if ( _rDescriptor.ScriptCode.indexOf( ':' ) < 0 ) - { // the macro name does not already contain a : - // -> default the type to "document" - ::rtl::OUString sNewScriptCode( RTL_CONSTASCII_USTRINGPARAM( "document:" ) ); - sNewScriptCode += _rDescriptor.ScriptCode; - _rDescriptor.ScriptCode = sNewScriptCode; - } - } - } -}; - -//------------------------------------------------------------------------------ -void OInterfaceContainer::transformEvents( const EventFormat _eTargetFormat ) -{ - try - { - // loop through all our children - sal_Int32 nItems = m_aItems.size(); - Sequence< ScriptEventDescriptor > aChildEvents; - - for (sal_Int32 i=0; i<nItems; ++i) - { - // get the script events for this object - aChildEvents = m_xEventAttacher->getScriptEvents( i ); - - if ( aChildEvents.getLength() ) - { - // the "iterators" for the events for this child - ScriptEventDescriptor* pChildEvents = aChildEvents.getArray(); - ScriptEventDescriptor* pChildEventsEnd = pChildEvents + aChildEvents.getLength(); - - // do the transformation - if ( efVersionSO6x == _eTargetFormat ) - ::std::for_each( pChildEvents, pChildEventsEnd, TransformEventTo60Format() ); - else - ::std::for_each( pChildEvents, pChildEventsEnd, TransformEventTo52Format() ); - - // revoke the script events - m_xEventAttacher->revokeScriptEvents( i ); - // and re-register them - m_xEventAttacher->registerScriptEvents( i, aChildEvents ); - } - } - } - catch( const Exception& e ) - { - e; // make compiler happy - DBG_ERROR( "OInterfaceContainer::transformEvents: caught an exception!" ); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::readEvents(const Reference<XObjectInputStream>& _rxInStream) -{ - ::osl::MutexGuard aGuard( m_rMutex ); - - // Scripting Info lesen - Reference<XMarkableStream> xMark(_rxInStream, UNO_QUERY); - sal_Int32 nObjLen = _rxInStream->readLong(); - if (nObjLen) - { - sal_Int32 nMark = xMark->createMark(); - Reference<XPersistObject> xObj(m_xEventAttacher, UNO_QUERY); - if (xObj.is()) - xObj->read(_rxInStream); - xMark->jumpToMark(nMark); - _rxInStream->skipBytes(nObjLen); - xMark->deleteMark(nMark); - } - - // Attachement lesen - OInterfaceArray::const_iterator aAttach = m_aItems.begin(); - OInterfaceArray::const_iterator aAttachEnd = m_aItems.end(); - for ( sal_Int32 i=0; aAttach != aAttachEnd; ++aAttach, ++i ) - { - Reference< XInterface > xAsIFace( *aAttach, UNO_QUERY ); // important to normalize this .... - Reference< XPropertySet > xAsSet( xAsIFace, UNO_QUERY ); - m_xEventAttacher->attach( i, xAsIFace, makeAny( xAsSet ) ); - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::write( const Reference< XObjectOutputStream >& _rxOutStream ) throw(IOException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_rMutex ); - sal_Int32 nLen = m_aItems.size(); - - // schreiben der laenge - _rxOutStream->writeLong(nLen); - - if (nLen) - { - // 1. Version - _rxOutStream->writeShort(0x0001); - - // 2. Objekte - for (sal_Int32 i = 0; i < nLen; i++) - { - Reference<XPersistObject> xObj(m_aItems[i], UNO_QUERY); - if (xObj.is()) - _rxOutStream->writeObject(xObj); - else - { - // ::com::sun::star::chaos::Error - } - } - - // 3. Scripts - writeEvents(_rxOutStream); - } -} - -//------------------------------------------------------------------------------ -namespace -{ - Reference< XPersistObject > lcl_createPlaceHolder( const Reference< XMultiServiceFactory >& _rxORB ) - { - Reference< XPersistObject > xObject( _rxORB->createInstance( FRM_COMPONENT_HIDDENCONTROL ), UNO_QUERY ); - DBG_ASSERT( xObject.is(), "lcl_createPlaceHolder: could not create a substitute for the unknown object!" ); - if ( xObject.is() ) - { - // set some properties describing what we did - Reference< XPropertySet > xObjProps( xObject, UNO_QUERY ); - if ( xObject.is() ) - { - try - { - xObjProps->setPropertyValue( PROPERTY_NAME, makeAny( FRM_RES_STRING( RID_STR_CONTROL_SUBSTITUTED_NAME ) ) ); - xObjProps->setPropertyValue( PROPERTY_TAG, makeAny( FRM_RES_STRING( RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN ) ) ); - } - catch(Exception&) - { - } - } - } - return xObject; - } -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::read( const Reference< XObjectInputStream >& _rxInStream ) throw(IOException, RuntimeException) -{ - ::osl::MutexGuard aGuard( m_rMutex ); - - // after ::read the object is expected to be in the state it was when ::write was called, so we have - // to empty ourself here - // FS - 71598 - 12.01.00 - while (getCount()) - removeByIndex(0); - - // Schreibt nur in Abhaengigkeit der Laenge - sal_Int32 nLen = _rxInStream->readLong(); - - if (nLen) - { - // 1. Version - sal_uInt16 nVersion = _rxInStream->readShort(); - - // 2. Objekte - for (sal_Int32 i = 0; i < nLen; i++) - { - Reference<XPersistObject> xObj; - try - { - xObj = _rxInStream->readObject(); - } - catch(WrongFormatException& e) - { - e; // make compiler happy - // the object could not be read - // create a object (so the readEvents below will assign the events to the right controls) - xObj = lcl_createPlaceHolder( m_xServiceFactory ); - if ( !xObj.is() ) - // couldn't handle it - throw; - // 72133 - 09.02.00 - FS - } - catch(Exception&) - { - // unsere Map leeren - while (!m_aItems.empty()) - removeElementsNoEvents(0); - - // und die Exception nach aussen - throw; - } - - if ( xObj.is() ) - { - Reference< XPropertySet > xElement( xObj, UNO_QUERY ); - try - { - implInsert( - m_aItems.size(), // position - xElement, // element to insert - sal_False, // no event attacher manager handling - NULL, // not yet approved - let implInsert do it - sal_True // fire the event - ); - } - catch( const Exception& ) - { - DBG_ERROR( "OInterfaceContainerHelper::read: reading succeeded, but not inserting!" ); - // create a placeholder - xElement = xElement.query( lcl_createPlaceHolder( m_xServiceFactory ) ); - if ( !xElement.is() ) - // couldn't handle it - throw; - // insert the placeholder - implInsert( m_aItems.size(), xElement, sal_False, NULL, sal_True ); - } - } - } - - readEvents(_rxInStream); - } - else - m_xEventAttacher = ::comphelper::createEventAttacherManager( m_xServiceFactory ); -} - -// XContainer -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::addContainerListener(const Reference<XContainerListener>& _rxListener) throw( RuntimeException ) -{ - m_aContainerListeners.addInterface(_rxListener); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::removeContainerListener(const Reference<XContainerListener>& _rxListener) throw( RuntimeException ) -{ - m_aContainerListeners.removeInterface(_rxListener); -} - -// XEventListener -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::disposing(const EventObject& _rSource) throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_rMutex ); - - Reference< XInterface > xSource( _rSource.Source, UNO_QUERY ); - // normalized source - - OInterfaceArray::iterator j; - for ( j = m_aItems.begin(); j != m_aItems.end(); ++j ) - { - DBG_ASSERT( j->get() == Reference< XInterface >( *j, UNO_QUERY ).get(), - "OInterfaceContainer::disposing: vector element not normalized!" ); - - if ( xSource.get() == j->get() ) - // found the element - break; - } - - if ( m_aItems.end() != j ) - { - OInterfaceMap::iterator i = m_aMap.begin(); - while ( i != m_aMap.end() ) - { - DBG_ASSERT( i->second.get() == Reference< XInterface >( i->second, UNO_QUERY ).get(), - "OInterfaceContainer::disposing: map element not normalized!" ); - - if ( i->second.get() == _rSource.Source.get() ) - // found it - break; - - ++i; - } - - m_aMap.erase(i); - m_aItems.erase(j); - } -} - -// XPropertyChangeListener -//------------------------------------------------------------------------------ -void OInterfaceContainer::propertyChange(const PropertyChangeEvent& evt) -throw (::com::sun::star::uno::RuntimeException) { - if (evt.PropertyName == PROPERTY_NAME) - { - ::osl::MutexGuard aGuard( m_rMutex ); - OInterfaceMap::iterator i = find(m_aMap.begin(), m_aMap.end(), - pair<const ::rtl::OUString, InterfaceRef >(::comphelper::getString(evt.OldValue),evt.Source)); - if (i != m_aMap.end()) - { - InterfaceRef xCorrectType((*i).second); - m_aMap.erase(i); - m_aMap.insert(pair<const ::rtl::OUString, InterfaceRef >(::comphelper::getString(evt.NewValue),xCorrectType)); - } - } -} - -// XElementAccess -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OInterfaceContainer::hasElements() throw( RuntimeException ) -{ - return !m_aMap.empty(); -} - -//------------------------------------------------------------------------------ -Type SAL_CALL OInterfaceContainer::getElementType() throw(RuntimeException) -{ - return m_aElementType; -} - -// XEnumerationAccess -//------------------------------------------------------------------------------ -Reference<XEnumeration> SAL_CALL OInterfaceContainer::createEnumeration() throw( RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_rMutex ); - return new ::comphelper::OEnumerationByIndex(static_cast<XIndexAccess*>(this)); -} - -// XNameAccess -//------------------------------------------------------------------------------ -Any SAL_CALL OInterfaceContainer::getByName( const ::rtl::OUString& _rName ) throw(NoSuchElementException, WrappedTargetException, RuntimeException) -{ - pair <OInterfaceMap::iterator, - OInterfaceMap::iterator> aPair = m_aMap.equal_range(_rName); - - if (aPair.first == aPair.second) - throw NoSuchElementException(); - - return (*aPair.first).second->queryInterface( m_aElementType ); -} - -//------------------------------------------------------------------------------ -StringSequence SAL_CALL OInterfaceContainer::getElementNames() throw(RuntimeException) -{ - StringSequence aNameList(m_aItems.size()); - ::rtl::OUString* pStringArray = aNameList.getArray(); - - for (OInterfaceMap::const_iterator i = m_aMap.begin(); i != m_aMap.end(); ++i, ++pStringArray) - { - *pStringArray = (*i).first; - } - return aNameList; -} - -//------------------------------------------------------------------------------ -sal_Bool SAL_CALL OInterfaceContainer::hasByName( const ::rtl::OUString& _rName ) throw(RuntimeException) -{ - pair <OInterfaceMap::iterator, - OInterfaceMap::iterator> aPair = m_aMap.equal_range(_rName); - return aPair.first != aPair.second; -} - -// XIndexAccess -//------------------------------------------------------------------------------ -sal_Int32 OInterfaceContainer::getCount() throw( RuntimeException ) -{ - return m_aItems.size(); -} - -//------------------------------------------------------------------------------ -Any OInterfaceContainer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - if (_nIndex < 0 || (_nIndex >= (sal_Int32)m_aItems.size())) - throw IndexOutOfBoundsException(); - - return m_aItems[_nIndex]->queryInterface( m_aElementType ); -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::approveNewElement( const Reference< XPropertySet >& _rxObject, ElementDescription* _pElement ) -{ - // it has to be non-NULL - if ( !_rxObject.is() ) - throw IllegalArgumentException(FRM_RES_STRING(RID_STR_NEED_NON_NULL_OBJECT), static_cast<XContainer*>(this), 1); - - // it has to support our element type interface - Any aCorrectType = _rxObject->queryInterface( m_aElementType ); - if ( !aCorrectType.hasValue() ) - lcl_throwIllegalArgumentException(); - - // it has to have a "Name" property - if ( !hasProperty( PROPERTY_NAME, _rxObject ) ) - lcl_throwIllegalArgumentException(); - - // it has to be a child, and it must not have a parent already - Reference< XChild > xChild( _rxObject, UNO_QUERY ); - if ( !xChild.is() || xChild->getParent().is() ) - { -#ifdef FS_PRIV_DEBUG - ::rtl::OUString sChildName, sParentName; - Reference< XNamed > xNamed( xChild, UNO_QUERY ); - if ( xNamed.is() ) - sChildName = xNamed->getName(); - if ( xChild.is() ) - { - xNamed = xNamed.query( xChild->getParent() ); - if ( xNamed.is() ) - sParentName = xNamed->getName(); - } -#endif - lcl_throwIllegalArgumentException(); - } - - // passed all tests. cache the information we have so far - DBG_ASSERT( _pElement, "OInterfaceContainer::approveNewElement: invalid event descriptor!" ); - if ( _pElement ) - { - _pElement->xPropertySet = _rxObject; - _pElement->xChild = xChild; - _pElement->aElementTypeInterface = aCorrectType; - _pElement->xInterface = Reference< XInterface >( _rxObject, UNO_QUERY ); // normalized XInterface - } -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::implInsert(sal_Int32 _nIndex, const Reference< XPropertySet >& _rxElement, - sal_Bool _bEvents, ElementDescription* _pApprovalResult, sal_Bool _bFire ) throw( IllegalArgumentException ) -{ - RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert" ); - - ::osl::ClearableMutexGuard aGuard( m_rMutex ); - - ::std::auto_ptr< ElementDescription > aAutoDeleteMetaData; - ElementDescription* pElementMetaData = _pApprovalResult; - if ( !pElementMetaData ) - { // not yet approved by the caller -> do ourself - pElementMetaData = createElementMetaData(); - DBG_ASSERT( pElementMetaData, "OInterfaceContainer::implInsert: createElementMetaData returned nonsense!" ); - - // ensure that the meta data structure will be deleted later on - aAutoDeleteMetaData = ::std::auto_ptr< ElementDescription >( pElementMetaData ); - - // will throw an exception if necessary - approveNewElement( _rxElement, pElementMetaData ); - } - - - // approveNewElement (no matter if called here or outside) has ensure that all relevant interfaces - // exist - - // set the name, and add as change listener for the name - ::rtl::OUString sName; - _rxElement->getPropertyValue(PROPERTY_NAME) >>= sName; - _rxElement->addPropertyChangeListener(PROPERTY_NAME, this); - - // insert the object into our internal structures - if (_nIndex > (sal_Int32)m_aItems.size()) // ermitteln des tatsaechlichen Indexs - { - _nIndex = m_aItems.size(); - m_aItems.push_back( pElementMetaData->xInterface ); - } - else - m_aItems.insert( m_aItems.begin() + _nIndex, pElementMetaData->xInterface ); - - m_aMap.insert( pair< const ::rtl::OUString, InterfaceRef >( sName, pElementMetaData->xInterface ) ); - - // announce ourself as parent to the new element - { - RTL_LOGFILE_CONTEXT( aLogger, "forms::OInterfaceContainer::implInsert::settingParent" ); - pElementMetaData->xChild->setParent(static_cast<XContainer*>(this)); - } - - // handle the events - if (_bEvents) - { - m_xEventAttacher->insertEntry(_nIndex); - m_xEventAttacher->attach( _nIndex, pElementMetaData->xInterface, makeAny( _rxElement ) ); - } - - // notify derived classes - implInserted( pElementMetaData ); - - // fire the notification about the change - if ( _bFire ) - { - // notify listeners - ContainerEvent aEvt; - aEvt.Source = static_cast<XContainer*>(this); - aEvt.Accessor <<= _nIndex; - aEvt.Element = pElementMetaData->aElementTypeInterface; - - aGuard.clear(); - m_aContainerListeners.notifyEach( - &XContainerListener::elementInserted, aEvt); - } -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::removeElementsNoEvents(sal_Int32 nIndex) -{ - OInterfaceArray::iterator i = m_aItems.begin() + nIndex; - InterfaceRef xElement(*i); - - OInterfaceMap::iterator j = m_aMap.begin(); - while (j != m_aMap.end() && (*j).second != xElement) ++j; - - m_aItems.erase(i); - m_aMap.erase(j); - - Reference<XPropertySet> xSet(xElement, UNO_QUERY); - if (xSet.is()) - xSet->removePropertyChangeListener(PROPERTY_NAME, this); - - Reference<XChild> xChild(xElement, UNO_QUERY); - if (xChild.is()) - xChild->setParent(InterfaceRef ()); -} - -// XIndexContainer -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::insertByIndex( sal_Int32 _nIndex, const Any& _rElement ) throw(IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException) -{ - Reference< XPropertySet > xElement; - _rElement >>= xElement; - implInsert( _nIndex, xElement, sal_True /* event handling */ , NULL /* not yet approved */ , sal_True /* notification */ ); -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::implReplaceByIndex( const sal_Int32 _nIndex, const Any& _rNewElement, ::osl::ClearableMutexGuard& _rClearBeforeNotify ) -{ - OSL_PRECOND( ( _nIndex >= 0 ) && ( _nIndex < (sal_Int32)m_aItems.size() ), "OInterfaceContainer::implReplaceByIndex: precondition not met (index)!" ); - - // approve the new object - ::std::auto_ptr< ElementDescription > aElementMetaData( createElementMetaData() ); - DBG_ASSERT( aElementMetaData.get(), "OInterfaceContainer::implReplaceByIndex: createElementMetaData returned nonsense!" ); - { - Reference< XPropertySet > xElementProps; - _rNewElement >>= xElementProps; - approveNewElement( xElementProps, aElementMetaData.get() ); - } - - // get the old element - InterfaceRef xOldElement( m_aItems[ _nIndex ] ); - DBG_ASSERT( xOldElement.get() == Reference< XInterface >( xOldElement, UNO_QUERY ).get(), - "OInterfaceContainer::implReplaceByIndex: elements should be held normalized!" ); - - // locate the old element in the map - OInterfaceMap::iterator j = m_aMap.begin(); - while ( ( j != m_aMap.end() ) && ( j->second.get() != xOldElement.get() ) ) - ++j; - - // remove event knittings - InterfaceRef xIfc(xOldElement, UNO_QUERY);// wichtig - m_xEventAttacher->detach(_nIndex, xIfc); - m_xEventAttacher->removeEntry(_nIndex); - - // don't listen for property changes anymore - Reference<XPropertySet> xSet( xOldElement, UNO_QUERY ); - if (xSet.is()) - xSet->removePropertyChangeListener(PROPERTY_NAME, this); - - // give the old element a new (void) parent - Reference<XChild> xChild(xOldElement, UNO_QUERY); - if (xChild.is()) - xChild->setParent(InterfaceRef ()); - - // remove the old one - m_aMap.erase(j); - - // examine the new element - ::rtl::OUString sName; - DBG_ASSERT( aElementMetaData.get()->xPropertySet.is(), "OInterfaceContainer::implReplaceByIndex: what did approveNewElement do?" ); - - aElementMetaData.get()->xPropertySet->getPropertyValue(PROPERTY_NAME) >>= sName; - aElementMetaData.get()->xPropertySet->addPropertyChangeListener(PROPERTY_NAME, this); - - // insert the new one - m_aMap.insert( pair<const ::rtl::OUString, InterfaceRef >( sName, aElementMetaData.get()->xInterface ) ); - m_aItems[ _nIndex ] = aElementMetaData.get()->xInterface; - - aElementMetaData.get()->xChild->setParent(static_cast<XContainer*>(this)); - - m_xEventAttacher->insertEntry(_nIndex); - m_xEventAttacher->attach( _nIndex, aElementMetaData.get()->xInterface, makeAny( aElementMetaData.get()->xPropertySet ) ); - - implReplaced( xOldElement, aElementMetaData.get() ); - - // benachrichtigen - ContainerEvent aEvt; - aEvt.Source = static_cast<XContainer*>(this); - aEvt.Accessor <<= _nIndex; - aEvt.Element = aElementMetaData.get()->aElementTypeInterface; - aEvt.ReplacedElement = xOldElement->queryInterface( m_aElementType ); - - _rClearBeforeNotify.clear(); - m_aContainerListeners.notifyEach( - &XContainerListener::elementReplaced, aEvt); -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::implCheckIndex( const sal_Int32 _nIndex ) SAL_THROW( ( ::com::sun::star::lang::IndexOutOfBoundsException ) ) -{ - if (_nIndex < 0 || _nIndex >= (sal_Int32)m_aItems.size()) - throw IndexOutOfBoundsException(); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::replaceByIndex(sal_Int32 _nIndex, const Any& Element) throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - ::osl::ClearableMutexGuard aGuard( m_rMutex ); - // check the index - implCheckIndex( _nIndex ); - // do the replace - implReplaceByIndex( _nIndex, Element, aGuard ); -} - -//------------------------------------------------------------------------------ -void OInterfaceContainer::implRemoveByIndex( const sal_Int32 _nIndex, ::osl::ClearableMutexGuard& _rClearBeforeNotify ) -{ - OSL_PRECOND( ( _nIndex >= 0 ) && ( _nIndex < (sal_Int32)m_aItems.size() ), "OInterfaceContainer::implRemoveByIndex: precondition not met (index)!" ); - - OInterfaceArray::iterator i = m_aItems.begin() + _nIndex; - InterfaceRef xElement(*i); - - OInterfaceMap::iterator j = m_aMap.begin(); - while (j != m_aMap.end() && (*j).second != xElement) ++j; - - m_aItems.erase(i); - m_aMap.erase(j); - - // Eventverknuepfungen aufheben - InterfaceRef xIfc(xElement, UNO_QUERY);// wichtig - m_xEventAttacher->detach(_nIndex, xIfc); - m_xEventAttacher->removeEntry(_nIndex); - - Reference<XPropertySet> xSet(xElement, UNO_QUERY); - if (xSet.is()) - xSet->removePropertyChangeListener(PROPERTY_NAME, this); - - Reference<XChild> xChild(xElement, UNO_QUERY); - if (xChild.is()) - xChild->setParent(InterfaceRef ()); - - // notify derived classes - implRemoved(xElement); - - // notify listeners - ContainerEvent aEvt; - aEvt.Source = static_cast<XContainer*>(this); - aEvt.Element = xElement->queryInterface( m_aElementType ); - aEvt.Accessor <<= _nIndex; - - _rClearBeforeNotify.clear(); - m_aContainerListeners.notifyEach(&XContainerListener::elementRemoved, aEvt); -} - -//------------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::removeByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - ::osl::ClearableMutexGuard aGuard( m_rMutex ); - // check the index - implCheckIndex( _nIndex ); - // do the removal - implRemoveByIndex( _nIndex, aGuard ); -} - -//------------------------------------------------------------------------ -ElementDescription* OInterfaceContainer::createElementMetaData( ) -{ - return new ElementDescription; -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::insertByName(const ::rtl::OUString& _rName, const Any& _rElement) throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException ) -{ - Reference< XPropertySet > xElementProps; - - ::std::auto_ptr< ElementDescription > aElementMetaData( createElementMetaData() ); - DBG_ASSERT( aElementMetaData.get(), "OInterfaceContainer::insertByName: createElementMetaData returned nonsense!" ); - - // ensure the correct name of the element - try - { - _rElement >>= xElementProps; - approveNewElement( xElementProps, aElementMetaData.get() ); - - xElementProps->setPropertyValue( PROPERTY_NAME, makeAny( _rName ) ); - } - catch( const IllegalArgumentException& ) - { - throw; // allowed to leave - } - catch( const ElementExistException& ) - { - throw; // allowed to leave - } - catch( const Exception& ) - { - DBG_ERROR( "OInterfaceContainer::insertByName: caught an exception!" ); - } - implInsert( m_aItems.size(), xElementProps, sal_True, aElementMetaData.get(), sal_True ); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::replaceByName(const ::rtl::OUString& Name, const Any& Element) throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException ) -{ - ::osl::ClearableMutexGuard aGuard( m_rMutex ); - pair <OInterfaceMap::iterator, - OInterfaceMap::iterator> aPair = m_aMap.equal_range(Name); - if (aPair.first == aPair.second) - throw NoSuchElementException(); - - if (Element.getValueType().getTypeClass() != TypeClass_INTERFACE) - lcl_throwIllegalArgumentException(); - - Reference<XPropertySet> xSet; - Element >>= xSet; - if (xSet.is()) - { - if (!hasProperty(PROPERTY_NAME, xSet)) - lcl_throwIllegalArgumentException(); - - xSet->setPropertyValue(PROPERTY_NAME, makeAny(Name)); - } - - // determine the element pos - sal_Int32 nPos = find(m_aItems.begin(), m_aItems.end(), (*aPair.first).second) - m_aItems.begin(); - - implReplaceByIndex( nPos, Element, aGuard ); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::removeByName(const ::rtl::OUString& Name) throw( NoSuchElementException, WrappedTargetException, RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_rMutex ); - pair <OInterfaceMap::iterator, - OInterfaceMap::iterator> aPair = m_aMap.equal_range(Name); - if (aPair.first == aPair.second) - throw NoSuchElementException(); - - sal_Int32 nPos = find(m_aItems.begin(), m_aItems.end(), (*aPair.first).second) - m_aItems.begin(); - removeByIndex(nPos); -} - - -// XEventAttacherManager -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::registerScriptEvent( sal_Int32 nIndex, const ScriptEventDescriptor& aScriptEvent ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->registerScriptEvent(nIndex, aScriptEvent); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::registerScriptEvents( sal_Int32 nIndex, const Sequence< ScriptEventDescriptor >& aScriptEvents ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->registerScriptEvents(nIndex, aScriptEvents); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->revokeScriptEvent(nIndex, - aListenerType, aEventMethod, aRemoveListenerParam ); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::revokeScriptEvents( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->revokeScriptEvents(nIndex); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::insertEntry( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->insertEntry(nIndex); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::removeEntry( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->removeEntry(nIndex); -} - -//------------------------------------------------------------------------ -Sequence< ScriptEventDescriptor > SAL_CALL OInterfaceContainer::getScriptEvents( sal_Int32 nIndex ) throw(IllegalArgumentException, RuntimeException) -{ - return m_xEventAttacher->getScriptEvents(nIndex); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::attach( sal_Int32 nIndex, const Reference< XInterface >& xObject, const Any& aHelper ) throw(IllegalArgumentException, ServiceNotRegisteredException, RuntimeException) -{ - m_xEventAttacher->attach(nIndex, xObject, aHelper); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::detach( sal_Int32 nIndex, const Reference< XInterface >& xObject ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->detach(nIndex, xObject); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::addScriptListener( const Reference< XScriptListener >& xListener ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->addScriptListener(xListener); -} - -//------------------------------------------------------------------------ -void SAL_CALL OInterfaceContainer::removeScriptListener( const Reference< XScriptListener >& xListener ) throw(IllegalArgumentException, RuntimeException) -{ - m_xEventAttacher->removeScriptListener(xListener); -} - -//================================================================== -//= OFormComponents -//================================================================== -//------------------------------------------------------------------------------ -Any SAL_CALL OFormComponents::queryAggregation(const Type& _rType) throw(RuntimeException) -{ - Any aReturn = OFormComponents_BASE::queryInterface(_rType); - if (!aReturn.hasValue()) - { - aReturn = OInterfaceContainer::queryInterface(_rType); - - if (!aReturn.hasValue()) - aReturn = FormComponentsBase::queryAggregation(_rType); - } - - return aReturn; -} - -//------------------------------------------------------------------ -Sequence<Type> SAL_CALL OFormComponents::getTypes() throw(RuntimeException) -{ - return ::comphelper::concatSequences(OInterfaceContainer::getTypes(), FormComponentsBase::getTypes(), OFormComponents_BASE::getTypes()); -} - -//------------------------------------------------------------------------------ -OFormComponents::OFormComponents(const Reference<XMultiServiceFactory>& _rxFactory) - :FormComponentsBase(m_aMutex) - ,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<Reference<XFormComponent>*>(NULL))) -{ -} - -//------------------------------------------------------------------------------ -OFormComponents::~OFormComponents() -{ - if (!FormComponentsBase::rBHelper.bDisposed) - { - acquire(); - dispose(); - } -} - -// OComponentHelper -//------------------------------------------------------------------------------ -void OFormComponents::disposing() -{ - OInterfaceContainer::disposing(); - FormComponentsBase::disposing(); - m_xParent = NULL; -} - -//XChild -//------------------------------------------------------------------------------ -void OFormComponents::setParent(const InterfaceRef& Parent) throw( NoSupportException, RuntimeException ) -{ - ::osl::MutexGuard aGuard( m_aMutex ); - m_xParent = Parent; -} - -//------------------------------------------------------------------------------ -InterfaceRef OFormComponents::getParent() throw( RuntimeException ) -{ - return m_xParent; -} - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/forms_formsmodule.cxx b/binfilter/bf_forms/source/misc/forms_formsmodule.cxx deleted file mode 100644 index 833b392a149a..000000000000 --- a/binfilter/bf_forms/source/misc/forms_formsmodule.cxx +++ /dev/null @@ -1,236 +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. - * - ************************************************************************/ - -#include "formsmodule.hxx" - -#include <comphelper/sequence.hxx> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::registry; - using namespace ::comphelper; - using namespace ::cppu; - - //========================================================================= - //= OFormsModule - //========================================================================= - - //-------------------------------------------------------------------------- - //- registration helper - //-------------------------------------------------------------------------- - - Sequence< ::rtl::OUString >* OFormsModule::s_pImplementationNames = NULL; - Sequence< Sequence< ::rtl::OUString > >* OFormsModule::s_pSupportedServices = NULL; - Sequence< sal_Int64 >* OFormsModule::s_pCreationFunctionPointers = NULL; - Sequence< sal_Int64 >* OFormsModule::s_pFactoryFunctionPointers = NULL; - - //-------------------------------------------------------------------------- - void OFormsModule::registerComponent( - const ::rtl::OUString& _rImplementationName, - const Sequence< ::rtl::OUString >& _rServiceNames, - ComponentInstantiation _pCreateFunction, - FactoryInstantiation _pFactoryFunction) - { - if (!s_pImplementationNames) - { - OSL_ENSURE(!s_pSupportedServices && !s_pCreationFunctionPointers && !s_pFactoryFunctionPointers, - "OFormsModule::registerComponent : inconsistent state (the pointers (1)) !"); - s_pImplementationNames = new Sequence< ::rtl::OUString >; - s_pSupportedServices = new Sequence< Sequence< ::rtl::OUString > >; - s_pCreationFunctionPointers = new Sequence< sal_Int64 >; - s_pFactoryFunctionPointers = new Sequence< sal_Int64 >; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OFormsModule::registerComponent : inconsistent state (the pointers (2)) !"); - - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OFormsModule::registerComponent : inconsistent state !"); - - sal_Int32 nOldLen = s_pImplementationNames->getLength(); - s_pImplementationNames->realloc(nOldLen + 1); - s_pSupportedServices->realloc(nOldLen + 1); - s_pCreationFunctionPointers->realloc(nOldLen + 1); - s_pFactoryFunctionPointers->realloc(nOldLen + 1); - - s_pImplementationNames->getArray()[nOldLen] = _rImplementationName; - s_pSupportedServices->getArray()[nOldLen] = _rServiceNames; - s_pCreationFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pCreateFunction); - s_pFactoryFunctionPointers->getArray()[nOldLen] = reinterpret_cast<sal_Int64>(_pFactoryFunction); - } - - //-------------------------------------------------------------------------- - void OFormsModule::revokeComponent(const ::rtl::OUString& _rImplementationName) - { - if (!s_pImplementationNames) - { - OSL_ASSERT("OFormsModule::revokeComponent : have no class infos ! Are you sure called this method at the right time ?"); - return; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OFormsModule::revokeComponent : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OFormsModule::revokeComponent : inconsistent state !"); - - sal_Int32 nLen = s_pImplementationNames->getLength(); - const ::rtl::OUString* pImplNames = s_pImplementationNames->getConstArray(); - for (sal_Int32 i=0; i<nLen; ++i, ++pImplNames) - { - if (pImplNames->equals(_rImplementationName)) - { - removeElementAt(*s_pImplementationNames, i); - removeElementAt(*s_pSupportedServices, i); - removeElementAt(*s_pCreationFunctionPointers, i); - removeElementAt(*s_pFactoryFunctionPointers, i); - break; - } - } - - if (s_pImplementationNames->getLength() == 0) - { - delete s_pImplementationNames; s_pImplementationNames = NULL; - delete s_pSupportedServices; s_pSupportedServices = NULL; - delete s_pCreationFunctionPointers; s_pCreationFunctionPointers = NULL; - delete s_pFactoryFunctionPointers; s_pFactoryFunctionPointers = NULL; - } - } - - //-------------------------------------------------------------------------- - sal_Bool OFormsModule::writeComponentInfos( - const Reference< XMultiServiceFactory >& /*_rxServiceManager*/, - const Reference< XRegistryKey >& _rxRootKey) - { - OSL_ENSURE(_rxRootKey.is(), "OFormsModule::writeComponentInfos : invalid argument !"); - - if (!s_pImplementationNames) - { - OSL_ASSERT("OFormsModule::writeComponentInfos : have no class infos ! Are you sure called this method at the right time ?"); - return sal_True; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OFormsModule::writeComponentInfos : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OFormsModule::writeComponentInfos : inconsistent state !"); - - sal_Int32 nLen = s_pImplementationNames->getLength(); - const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); - const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); - - ::rtl::OUString sRootKey("/", 1, RTL_TEXTENCODING_ASCII_US); - for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices) - { - ::rtl::OUString aMainKeyName(sRootKey); - aMainKeyName += *pImplName; - aMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES"); - - try - { - Reference< XRegistryKey > xNewKey( _rxRootKey->createKey(aMainKeyName) ); - - const ::rtl::OUString* pService = pServices->getConstArray(); - for (sal_Int32 j=0; j<pServices->getLength(); ++j, ++pService) - xNewKey->createKey(*pService); - } - catch(Exception&) - { - OSL_ASSERT("OFormsModule::writeComponentInfos : something went wrong while creating the keys !"); - return sal_False; - } - } - - return sal_True; - } - - //-------------------------------------------------------------------------- - Reference< XInterface > OFormsModule::getComponentFactory( - const ::rtl::OUString& _rImplementationName, - const Reference< XMultiServiceFactory >& _rxServiceManager) - { - OSL_ENSURE(_rxServiceManager.is(), "OFormsModule::getComponentFactory : invalid argument (service manager) !"); - OSL_ENSURE(_rImplementationName.getLength(), "OFormsModule::getComponentFactory : invalid argument (implementation name) !"); - - if (!s_pImplementationNames) - { - OSL_ASSERT("OFormsModule::getComponentFactory : have no class infos ! Are you sure called this method at the right time ?"); - return NULL; - } - OSL_ENSURE(s_pImplementationNames && s_pSupportedServices && s_pCreationFunctionPointers && s_pFactoryFunctionPointers, - "OFormsModule::getComponentFactory : inconsistent state (the pointers) !"); - OSL_ENSURE( (s_pImplementationNames->getLength() == s_pSupportedServices->getLength()) - && (s_pImplementationNames->getLength() == s_pCreationFunctionPointers->getLength()) - && (s_pImplementationNames->getLength() == s_pFactoryFunctionPointers->getLength()), - "OFormsModule::getComponentFactory : inconsistent state !"); - - - Reference< XInterface > xReturn; - - - sal_Int32 nLen = s_pImplementationNames->getLength(); - const ::rtl::OUString* pImplName = s_pImplementationNames->getConstArray(); - const Sequence< ::rtl::OUString >* pServices = s_pSupportedServices->getConstArray(); - const sal_Int64* pComponentFunction = s_pCreationFunctionPointers->getConstArray(); - const sal_Int64* pFactoryFunction = s_pFactoryFunctionPointers->getConstArray(); - - for (sal_Int32 i=0; i<nLen; ++i, ++pImplName, ++pServices, ++pComponentFunction, ++pFactoryFunction) - { - if (pImplName->equals(_rImplementationName)) - { - const FactoryInstantiation FactoryInstantiationFunction = reinterpret_cast<const FactoryInstantiation>(*pFactoryFunction); - const ComponentInstantiation ComponentInstantiationFunction = reinterpret_cast<const ComponentInstantiation>(*pComponentFunction); - - xReturn = FactoryInstantiationFunction( _rxServiceManager, *pImplName, ComponentInstantiationFunction, *pServices, NULL); - if (xReturn.is()) - { - xReturn->acquire(); - return xReturn.get(); - } - } - } - - return NULL; - } - - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/forms_ids.cxx b/binfilter/bf_forms/source/misc/forms_ids.cxx deleted file mode 100644 index 55d2dbeabda4..000000000000 --- a/binfilter/bf_forms/source/misc/forms_ids.cxx +++ /dev/null @@ -1,38 +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. - * - ************************************************************************/ - - -#include "ids.hxx" -namespace binfilter { - -IMPLEMENT_IMPLEMENTATIONID_HELPER_SMALL(frm, OImplementationIds) - - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/forms_limitedformats.cxx b/binfilter/bf_forms/source/misc/forms_limitedformats.cxx deleted file mode 100644 index 28b9930f5638..000000000000 --- a/binfilter/bf_forms/source/misc/forms_limitedformats.cxx +++ /dev/null @@ -1,406 +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. - * - ************************************************************************/ - -#include "limitedformats.hxx" -#include "services.hxx" -#include <osl/diagnose.h> -#include <comphelper/types.hxx> -#include <comphelper/extract.hxx> -#include <com/sun/star/form/FormComponentType.hpp> -namespace binfilter { - -//......................................................................... -namespace frm -{ -//......................................................................... - - using namespace ::com::sun::star::uno; - using namespace ::com::sun::star::util; - using namespace ::com::sun::star::lang; - using namespace ::com::sun::star::form; - using namespace ::com::sun::star::beans; - - sal_Int32 OLimitedFormats::s_nInstanceCount(0); - ::osl::Mutex OLimitedFormats::s_aMutex; - Reference< XNumberFormatsSupplier > OLimitedFormats::s_xStandardFormats; - - //===================================================================== - //= - //===================================================================== - //--------------------------------------------------------------------- - enum LocaleType - { - ltEnglishUS, - ltGerman, - ltSystem - }; - - //--------------------------------------------------------------------- - static const Locale& getLocale(LocaleType _eType) - { - static const Locale s_aEnglishUS( ::rtl::OUString::createFromAscii("en"), ::rtl::OUString::createFromAscii("us"), ::rtl::OUString() ); - static const Locale s_aGerman( ::rtl::OUString::createFromAscii("de"), ::rtl::OUString::createFromAscii("DE"), ::rtl::OUString() ); - static const ::rtl::OUString s_sEmptyString; - static const Locale s_aSystem( s_sEmptyString, s_sEmptyString, s_sEmptyString ); - - switch (_eType) - { - case ltEnglishUS: - return s_aEnglishUS; - - case ltGerman: - return s_aGerman; - - case ltSystem: - return s_aSystem; - } - - OSL_ENSURE(sal_False, "getLocale: invalid enum value!"); - return s_aSystem; - } - - //--------------------------------------------------------------------- - struct FormatEntry - { - const sal_Char* pDescription; - sal_Int32 nKey; - LocaleType eLocale; - }; - - //--------------------------------------------------------------------- - static const FormatEntry* lcl_getFormatTable(sal_Int16 nTableId) - { - switch (nTableId) - { - case FormComponentType::TIMEFIELD: - { - static FormatEntry s_aFormats[] = { - { "HH:MM", -1, ltEnglishUS }, - { "HH:MM:SS", -1, ltEnglishUS }, - { "HH:MM AM/PM", -1, ltEnglishUS }, - { "HH:MM:SS AM/PM", -1, ltEnglishUS }, - { NULL, -1 } - }; - // don't switch this table here to const. The compiler could be tempted to really place this - // in a non-writeable segment, but we want to fill in the format keys later .... - return s_aFormats; - } - break; - case FormComponentType::DATEFIELD: - { - static FormatEntry s_aFormats[] = { - { "T-M-JJ", -1, ltGerman }, - { "TT-MM-JJ", -1, ltGerman }, - { "TT-MM-JJJJ", -1, ltGerman }, - { "NNNNT. MMMM JJJJ", -1, ltGerman }, - - { "DD/MM/YY", -1, ltEnglishUS }, - { "MM/DD/YY", -1, ltEnglishUS }, - { "YY/MM/DD", -1, ltEnglishUS }, - { "DD/MM/YYYY", -1, ltEnglishUS }, - { "MM/DD/YYYY", -1, ltEnglishUS }, - { "YYYY/MM/DD", -1, ltEnglishUS }, - - { "JJ-MM-TT", -1, ltGerman }, - { "JJJJ-MM-TT", -1, ltGerman }, - - { NULL, -1 } - }; - return s_aFormats; - } - } - - OSL_ENSURE(sal_False, "lcl_getFormatTable: invalid id!"); - return NULL; - } - - //===================================================================== - //= OLimitedFormats - //===================================================================== - //--------------------------------------------------------------------- - OLimitedFormats::OLimitedFormats(const Reference< XMultiServiceFactory >& _rxORB, const sal_Int16 _nClassId) - :m_nTableId(_nClassId) - ,m_nFormatEnumPropertyHandle(-1) - { - OSL_ENSURE(_rxORB.is(), "OLimitedFormats::OLimitedFormats: invalid service factory!"); - acquireSupplier(_rxORB); - ensureTableInitialized(m_nTableId); - } - - //--------------------------------------------------------------------- - OLimitedFormats::~OLimitedFormats() - { - releaseSupplier(); - } - - //--------------------------------------------------------------------- - void OLimitedFormats::ensureTableInitialized(const sal_Int16 _nTableId) - { - const FormatEntry* pFormatTable = lcl_getFormatTable(_nTableId); - if (-1 == pFormatTable->nKey) - { - ::osl::MutexGuard aGuard(s_aMutex); - if (-1 == pFormatTable->nKey) - { - // initialize the keys - Reference<XNumberFormats> xStandardFormats; - if (s_xStandardFormats.is()) - xStandardFormats = s_xStandardFormats->getNumberFormats(); - OSL_ENSURE(xStandardFormats.is(), "OLimitedFormats::ensureTableInitialized: don't have a formats supplier!"); - - if (xStandardFormats.is()) - { - // loop through the table - FormatEntry* pLoopFormats = const_cast<FormatEntry*>(pFormatTable); - while (pLoopFormats->pDescription) - { - // get the key for the description - pLoopFormats->nKey = xStandardFormats->queryKey( - ::rtl::OUString::createFromAscii(pLoopFormats->pDescription), - getLocale(pLoopFormats->eLocale), - sal_False - ); - - if (-1 == pLoopFormats->nKey) - { - pLoopFormats->nKey = xStandardFormats->addNew( - ::rtl::OUString::createFromAscii(pLoopFormats->pDescription), - getLocale(pLoopFormats->eLocale) - ); -#ifdef DBG_UTIL - try - { - xStandardFormats->getByKey(pLoopFormats->nKey); - } - catch(const Exception&) - { - OSL_ENSURE(sal_False, "OLimitedFormats::ensureTableInitialized: adding the key to the formats collection failed!"); - } -#endif - } - - // next - ++pLoopFormats; - } - } - } - } - } - - //--------------------------------------------------------------------- - void OLimitedFormats::clearTable(const sal_Int16 _nTableId) - { - ::osl::MutexGuard aGuard(s_aMutex); - const FormatEntry* pFormats = lcl_getFormatTable(_nTableId); - FormatEntry* pResetLoop = const_cast<FormatEntry*>(pFormats); - while (pResetLoop->pDescription) - { - pResetLoop->nKey = -1; - ++pResetLoop; - } - } - - //--------------------------------------------------------------------- - void OLimitedFormats::setAggregateSet(const Reference< XFastPropertySet >& _rxAggregate, sal_Int32 _nOriginalPropertyHandle) - { - // changes (NULL -> not NULL) and (not NULL -> NULL) are allowed - OSL_ENSURE(!m_xAggregate.is() || !_rxAggregate.is(), "OLimitedFormats::setAggregateSet: already have an aggregate!"); - OSL_ENSURE(_rxAggregate.is() || m_xAggregate.is(), "OLimitedFormats::setAggregateSet: invalid new aggregate!"); - - m_xAggregate = _rxAggregate; - m_nFormatEnumPropertyHandle = _nOriginalPropertyHandle; -#ifdef DBG_UTIL - if (m_xAggregate.is()) - { - try - { - m_xAggregate->getFastPropertyValue(m_nFormatEnumPropertyHandle); - } - catch(const Exception&) - { - OSL_ENSURE(sal_False, "OLimitedFormats::setAggregateSet: invalid handle!"); - } - } -#endif - } - - //--------------------------------------------------------------------- - void OLimitedFormats::getFormatKeyPropertyValue( Any& _rValue ) const - { - _rValue.clear(); - - OSL_ENSURE(m_xAggregate.is() && (-1 != m_nFormatEnumPropertyHandle), "OLimitedFormats::getFormatKeyPropertyValue: not initialized!"); - if (m_xAggregate.is()) - { - // get the aggregate's enum property value - Any aEnumPropertyValue = m_xAggregate->getFastPropertyValue(m_nFormatEnumPropertyHandle); - sal_Int32 nValue = -1; - ::cppu::enum2int(nValue, aEnumPropertyValue); - - // get the translation table - const FormatEntry* pFormats = lcl_getFormatTable(m_nTableId); - - // seek to the nValue'th entry - sal_Int32 nLookup = 0; - for ( ; - (NULL != pFormats->pDescription) && (nLookup < nValue); - ++pFormats, ++nLookup - ) - ; - OSL_ENSURE(NULL != pFormats->pDescription, "OLimitedFormats::getFormatKeyPropertyValue: did not find the value!"); - if (pFormats->pDescription) - _rValue <<= pFormats->nKey; - } - - // TODO: should use a standard format for the control type we're working for - } - - //--------------------------------------------------------------------- - sal_Bool OLimitedFormats::convertFormatKeyPropertyValue(Any& _rConvertedValue, Any& _rOldValue, const Any& _rNewValue) - { - OSL_ENSURE(m_xAggregate.is() && (-1 != m_nFormatEnumPropertyHandle), "OLimitedFormats::convertFormatKeyPropertyValue: not initialized!"); - - if (m_xAggregate.is()) - { - // the new format key to set - sal_Int32 nNewFormat = 0; - if (!(_rNewValue >>= nNewFormat)) - throw IllegalArgumentException(); - - // get the old (enum) value from the aggregate - Any aEnumPropertyValue = m_xAggregate->getFastPropertyValue(m_nFormatEnumPropertyHandle); - sal_Int32 nOldEnumValue = -1; - ::cppu::enum2int(nOldEnumValue, aEnumPropertyValue); - - // get the translation table - const FormatEntry* pFormats = lcl_getFormatTable(m_nTableId); - - _rOldValue.clear(); - _rConvertedValue.clear(); - - // look for the entry with the given format key - sal_Int32 nTablePosition = 0; - for ( ; - (NULL != pFormats->pDescription) && (nNewFormat != pFormats->nKey); - ++pFormats, ++nTablePosition - ) - { - if (nTablePosition == nOldEnumValue) - _rOldValue <<= pFormats->nKey; - } - - sal_Bool bFoundIt = (NULL != pFormats->pDescription); - sal_Bool bModified = sal_False; - if (bFoundIt) - { - _rConvertedValue <<= (sal_Int16)nTablePosition; - bModified = nTablePosition != nOldEnumValue; - } - - if (!_rOldValue.hasValue()) - { // did not reach the end of the table (means we found nNewFormat) - // -> go to the end to ensure that _rOldValue is set - while (pFormats->pDescription) - { - if (nTablePosition == nOldEnumValue) - { - _rOldValue <<= pFormats->nKey; - break; - } - - ++pFormats; - ++nTablePosition; - } - } - - OSL_ENSURE(_rOldValue.hasValue(), "OLimitedFormats::convertFormatKeyPropertyValue: did not find the old enum value in the table!"); - - if (!bFoundIt) - { // somebody gave us an format which we can't translate - ::rtl::OUString sMessage = ::rtl::OUString::createFromAscii("This control supports only a very limited number of formats."); - throw IllegalArgumentException(sMessage, NULL, 2); - } - - return bModified; - } - - return sal_False; - } - - //--------------------------------------------------------------------- - void OLimitedFormats::setFormatKeyPropertyValue( const Any& _rNewValue ) - { - OSL_ENSURE(m_xAggregate.is() && (-1 != m_nFormatEnumPropertyHandle), "OLimitedFormats::setFormatKeyPropertyValue: not initialized!"); - - if (m_xAggregate.is()) - { // this is to be called after convertFormatKeyPropertyValue, where - // we translated the format key into a enum value. - // So now we can simply forward this enum value to our aggreate - m_xAggregate->setFastPropertyValue(m_nFormatEnumPropertyHandle, _rNewValue); - } - } - - //--------------------------------------------------------------------- - void OLimitedFormats::acquireSupplier(const Reference< XMultiServiceFactory >& _rxORB) - { - ::osl::MutexGuard aGuard(s_aMutex); - if ((1 == ++s_nInstanceCount) && _rxORB.is()) - { // create the standard formatter - - Sequence< Any > aInit(1); - aInit[0] <<= getLocale(ltEnglishUS); - - Reference< XInterface > xSupplier = _rxORB->createInstanceWithArguments(FRM_NUMBER_FORMATS_SUPPLIER, aInit); - OSL_ENSURE(xSupplier.is(), "OLimitedFormats::OLimitedFormats: could not create a formats supplier!"); - - s_xStandardFormats = Reference< XNumberFormatsSupplier >(xSupplier, UNO_QUERY); - OSL_ENSURE(s_xStandardFormats.is() || !xSupplier.is(), "OLimitedFormats::OLimitedFormats: missing an interface!"); - } - } - - //--------------------------------------------------------------------- - void OLimitedFormats::releaseSupplier() - { - ::osl::MutexGuard aGuard(s_aMutex); - if (0 == --s_nInstanceCount) - { - ::comphelper::disposeComponent(s_xStandardFormats); - s_xStandardFormats = NULL; - - clearTable(FormComponentType::TIMEFIELD); - clearTable(FormComponentType::DATEFIELD); - } - } - -//......................................................................... -} // namespace frm -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/forms_property.cxx b/binfilter/bf_forms/source/misc/forms_property.cxx deleted file mode 100644 index 554a2e4a6034..000000000000 --- a/binfilter/bf_forms/source/misc/forms_property.cxx +++ /dev/null @@ -1,444 +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. - * - ************************************************************************/ - -#include "property.hxx" -#include "property.hrc" - - - - -#include <algorithm> -namespace binfilter { - -//... namespace frm ....................................................... -namespace frm -{ -//......................................................................... - -//================================================================== -//= PropertyInfoService -//================================================================== -PropertyInfoService::PropertyMap PropertyInfoService::s_AllKnownProperties; -//------------------------------------------------------------------ -sal_Int32 PropertyInfoService::getPropertyId(const ::rtl::OUString& _rName) -{ - initialize(); - - PropertyAssignment aCompareName(_rName, -1); - - ::std::pair<PropertyMapIterator,PropertyMapIterator> aPair = ::std::equal_range( - s_AllKnownProperties.begin(), - s_AllKnownProperties.end(), - aCompareName, - PropertyAssignmentNameCompareLess()); - - sal_Int32 nHandle = -1; - if (aPair.first != aPair.second) - { // we found something _and_ we have an identity - nHandle = aPair.first->nHandle; - } - - return nHandle; -} - -//------------------------------------------------------------------ -sal_Int32 ConcretInfoService::getPreferedPropertyId(const ::rtl::OUString& _rName) -{ - return PropertyInfoService::getPropertyId(_rName); -} - -//------------------------------------------------------------------ -#define ADD_PROP_ASSIGNMENT(varname) \ - s_AllKnownProperties.push_back(PropertyAssignment(PROPERTY_##varname, PROPERTY_ID_##varname)) -//.................................................................. -void PropertyInfoService::initialize() -{ - if (!s_AllKnownProperties.empty()) - return; - - s_AllKnownProperties.reserve(220); - - ADD_PROP_ASSIGNMENT(NAME); - ADD_PROP_ASSIGNMENT(TAG); - ADD_PROP_ASSIGNMENT(TABINDEX); - ADD_PROP_ASSIGNMENT(CLASSID); - ADD_PROP_ASSIGNMENT(ALIGN); - ADD_PROP_ASSIGNMENT(ROWCOUNT); - ADD_PROP_ASSIGNMENT(ROWCOUNTFINAL); - ADD_PROP_ASSIGNMENT(FETCHSIZE); - ADD_PROP_ASSIGNMENT(VALUE); - ADD_PROP_ASSIGNMENT(VALUEMIN); - ADD_PROP_ASSIGNMENT(VALUEMAX); - ADD_PROP_ASSIGNMENT(VALUESTEP); - ADD_PROP_ASSIGNMENT(TEXT); - ADD_PROP_ASSIGNMENT(LABEL); - ADD_PROP_ASSIGNMENT(NAVIGATION); - ADD_PROP_ASSIGNMENT(CYCLE); - ADD_PROP_ASSIGNMENT(CONTROLSOURCE); - ADD_PROP_ASSIGNMENT(ENABLED); - ADD_PROP_ASSIGNMENT(SPIN); - ADD_PROP_ASSIGNMENT(READONLY); - ADD_PROP_ASSIGNMENT(FILTER_CRITERIA); - ADD_PROP_ASSIGNMENT(AUTOINCREMENT); - ADD_PROP_ASSIGNMENT(CACHESIZE); - ADD_PROP_ASSIGNMENT(LASTDIRTY); - ADD_PROP_ASSIGNMENT(STATEMENT); - ADD_PROP_ASSIGNMENT(WIDTH); - ADD_PROP_ASSIGNMENT(SEARCHABLE); - ADD_PROP_ASSIGNMENT(MULTILINE); - ADD_PROP_ASSIGNMENT(TARGET_URL); - ADD_PROP_ASSIGNMENT(DEFAULTCONTROL); - ADD_PROP_ASSIGNMENT(MAXTEXTLEN); - ADD_PROP_ASSIGNMENT(SIZE); - ADD_PROP_ASSIGNMENT(DATE); - ADD_PROP_ASSIGNMENT(TIME); - ADD_PROP_ASSIGNMENT(STATE); - ADD_PROP_ASSIGNMENT(TRISTATE); - ADD_PROP_ASSIGNMENT(HIDDEN_VALUE); - ADD_PROP_ASSIGNMENT(TARGET_FRAME); - ADD_PROP_ASSIGNMENT(BUTTONTYPE); - ADD_PROP_ASSIGNMENT(STRINGITEMLIST); - ADD_PROP_ASSIGNMENT(DEFAULT_TEXT); - ADD_PROP_ASSIGNMENT(DEFAULTCHECKED); - ADD_PROP_ASSIGNMENT(DEFAULT_DATE); - ADD_PROP_ASSIGNMENT(DEFAULT_TIME); - ADD_PROP_ASSIGNMENT(DEFAULT_VALUE); - ADD_PROP_ASSIGNMENT(FORMATKEY); - ADD_PROP_ASSIGNMENT(FORMATSSUPPLIER); - ADD_PROP_ASSIGNMENT(SUBMIT_ACTION); - ADD_PROP_ASSIGNMENT(SUBMIT_TARGET); - ADD_PROP_ASSIGNMENT(SUBMIT_METHOD); - ADD_PROP_ASSIGNMENT(SUBMIT_ENCODING); - ADD_PROP_ASSIGNMENT(IMAGE_URL); - ADD_PROP_ASSIGNMENT(EMPTY_IS_NULL); - ADD_PROP_ASSIGNMENT(LISTSOURCETYPE); - ADD_PROP_ASSIGNMENT(LISTSOURCE); - ADD_PROP_ASSIGNMENT(SELECT_SEQ); - ADD_PROP_ASSIGNMENT(VALUE_SEQ); - ADD_PROP_ASSIGNMENT(DEFAULT_SELECT_SEQ); - ADD_PROP_ASSIGNMENT(MULTISELECTION); - ADD_PROP_ASSIGNMENT(DECIMAL_ACCURACY); - ADD_PROP_ASSIGNMENT(EDITMASK); - ADD_PROP_ASSIGNMENT(ISREADONLY); - ADD_PROP_ASSIGNMENT(ISREQUIRED); - ADD_PROP_ASSIGNMENT(FIELDTYPE); - ADD_PROP_ASSIGNMENT(DECIMALS); - ADD_PROP_ASSIGNMENT(REFVALUE); - ADD_PROP_ASSIGNMENT(STRICTFORMAT); - ADD_PROP_ASSIGNMENT(DATASOURCE); - ADD_PROP_ASSIGNMENT(ALLOWADDITIONS); - ADD_PROP_ASSIGNMENT(ALLOWEDITS); - ADD_PROP_ASSIGNMENT(ALLOWDELETIONS); - ADD_PROP_ASSIGNMENT(MASTERFIELDS); - ADD_PROP_ASSIGNMENT(ISPASSTHROUGH); - ADD_PROP_ASSIGNMENT(QUERY); - ADD_PROP_ASSIGNMENT(LITERALMASK); - ADD_PROP_ASSIGNMENT(SHOWTHOUSANDSEP); - ADD_PROP_ASSIGNMENT(CURRENCYSYMBOL); - ADD_PROP_ASSIGNMENT(DATEFORMAT); - ADD_PROP_ASSIGNMENT(DATEMIN); - ADD_PROP_ASSIGNMENT(DATEMAX); - ADD_PROP_ASSIGNMENT(DATE_SHOW_CENTURY); - ADD_PROP_ASSIGNMENT(TIMEFORMAT); - ADD_PROP_ASSIGNMENT(TIMEMIN); - ADD_PROP_ASSIGNMENT(TIMEMAX); - ADD_PROP_ASSIGNMENT(LINECOUNT); - ADD_PROP_ASSIGNMENT(BOUNDCOLUMN); - ADD_PROP_ASSIGNMENT(HASNAVIGATION); - ADD_PROP_ASSIGNMENT(FONT); - ADD_PROP_ASSIGNMENT(BACKGROUNDCOLOR); - ADD_PROP_ASSIGNMENT(FILLCOLOR); - ADD_PROP_ASSIGNMENT(TEXTCOLOR); - ADD_PROP_ASSIGNMENT(LINECOLOR); - ADD_PROP_ASSIGNMENT(BORDER); - ADD_PROP_ASSIGNMENT(DROPDOWN); - ADD_PROP_ASSIGNMENT(MULTI); - ADD_PROP_ASSIGNMENT(HSCROLL); - ADD_PROP_ASSIGNMENT(VSCROLL); - ADD_PROP_ASSIGNMENT(TABSTOP); - ADD_PROP_ASSIGNMENT(AUTOCOMPLETE); - ADD_PROP_ASSIGNMENT(HARDLINEBREAKS); - ADD_PROP_ASSIGNMENT(PRINTABLE); - ADD_PROP_ASSIGNMENT(ECHO_CHAR); - ADD_PROP_ASSIGNMENT(ROWHEIGHT); - ADD_PROP_ASSIGNMENT(HELPTEXT); - ADD_PROP_ASSIGNMENT(FONT_NAME); - ADD_PROP_ASSIGNMENT(FONT_STYLENAME); - ADD_PROP_ASSIGNMENT(FONT_FAMILY); - ADD_PROP_ASSIGNMENT(FONT_CHARSET); - ADD_PROP_ASSIGNMENT(FONT_HEIGHT); - ADD_PROP_ASSIGNMENT(FONT_WEIGHT); - ADD_PROP_ASSIGNMENT(FONT_SLANT); - ADD_PROP_ASSIGNMENT(FONT_UNDERLINE); - ADD_PROP_ASSIGNMENT(FONT_WORDLINEMODE); - ADD_PROP_ASSIGNMENT(FONT_STRIKEOUT); - ADD_PROP_ASSIGNMENT(TEXTLINECOLOR); - ADD_PROP_ASSIGNMENT(FONTEMPHASISMARK); - ADD_PROP_ASSIGNMENT(FONTRELIEF); - ADD_PROP_ASSIGNMENT(HELPURL); - ADD_PROP_ASSIGNMENT(RECORDMARKER); - ADD_PROP_ASSIGNMENT(BOUNDFIELD); - ADD_PROP_ASSIGNMENT(TREATASNUMERIC); - ADD_PROP_ASSIGNMENT(EFFECTIVE_VALUE); - ADD_PROP_ASSIGNMENT(EFFECTIVE_DEFAULT); - ADD_PROP_ASSIGNMENT(EFFECTIVE_MIN); - ADD_PROP_ASSIGNMENT(EFFECTIVE_MAX); - ADD_PROP_ASSIGNMENT(HIDDEN); - ADD_PROP_ASSIGNMENT(FILTERPROPOSAL); - ADD_PROP_ASSIGNMENT(FIELDSOURCE); - ADD_PROP_ASSIGNMENT(TABLENAME); - ADD_PROP_ASSIGNMENT(FILTERSUPPLIER); - ADD_PROP_ASSIGNMENT(CURRENTFILTER); - ADD_PROP_ASSIGNMENT(SELECTED_FIELDS); - ADD_PROP_ASSIGNMENT(SELECTED_TABLES); - ADD_PROP_ASSIGNMENT(THREADSAFE); - ADD_PROP_ASSIGNMENT(CONTROLLABEL); - ADD_PROP_ASSIGNMENT(CURRSYM_POSITION); - ADD_PROP_ASSIGNMENT(SOURCE); - ADD_PROP_ASSIGNMENT(CURSORCOLOR); - ADD_PROP_ASSIGNMENT(ALWAYSSHOWCURSOR); - ADD_PROP_ASSIGNMENT(DISPLAYSYNCHRON); - ADD_PROP_ASSIGNMENT(ISMODIFIED); - ADD_PROP_ASSIGNMENT(ISNEW); - ADD_PROP_ASSIGNMENT(PRIVILEGES); - ADD_PROP_ASSIGNMENT(DETAILFIELDS); - ADD_PROP_ASSIGNMENT(COMMAND); - ADD_PROP_ASSIGNMENT(COMMANDTYPE); - ADD_PROP_ASSIGNMENT(RESULTSET_CONCURRENCY); - ADD_PROP_ASSIGNMENT(INSERTONLY); - ADD_PROP_ASSIGNMENT(RESULTSET_TYPE); - ADD_PROP_ASSIGNMENT(ESCAPE_PROCESSING); - ADD_PROP_ASSIGNMENT(APPLYFILTER); - ADD_PROP_ASSIGNMENT(ISNULLABLE); - ADD_PROP_ASSIGNMENT(ACTIVECOMMAND); - ADD_PROP_ASSIGNMENT(ISCURRENCY); - ADD_PROP_ASSIGNMENT(URL); - ADD_PROP_ASSIGNMENT(TITLE); - ADD_PROP_ASSIGNMENT(ACTIVE_CONNECTION); - ADD_PROP_ASSIGNMENT(SCALE); - ADD_PROP_ASSIGNMENT(SORT); - ADD_PROP_ASSIGNMENT(PERSISTENCE_MAXTEXTLENGTH); - - // now sort the array by name - - std::sort( - s_AllKnownProperties.begin(), - s_AllKnownProperties.end(), - PropertyAssignmentNameCompareLess() - ); -} - -//================================================================== -//= instantiation of property strings -//================================================================== - -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABINDEX, "TabIndex"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TAG, "Tag"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_NAME, "Name"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CLASSID, "ClassId"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ROWCOUNT, "RowCount"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ROWCOUNTFINAL, "IsRowCountFinal"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FETCHSIZE, "FetchSize"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUE, "Value"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXT, "Text"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LABEL, "Label"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CANINSERT, "CanInsert"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CANUPDATE, "CanUpdate"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CANDELETE, "CanDelete"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_NAVIGATION, "NavigationBarMode"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HASNAVIGATION, "HasNavigationBar"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CYCLE, "Cycle"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCE, "DataField"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ENABLED, "Enabled"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_READONLY, "ReadOnly"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISREADONLY, "IsReadOnly"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILTER_CRITERIA, "Filter"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISREQUIRED, "IsRequired"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_AUTOINCREMENT, "IsAutoIncrement"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CACHESIZE, "CacheSize"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATAENTRY, "DataEntry"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LASTDIRTY, "LastUpdated"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STATEMENT, "Statement"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_WIDTH, "Width"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SEARCHABLE, "IsSearchable"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MULTILINE, "MultiLine"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TARGET_URL, "TargetURL"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TARGET_FRAME, "TargetFrame"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL, "DefaultControl"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXTEXTLEN, "MaxTextLen"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EDITMASK, "EditMask"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SIZE, "Size"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SPIN, "Spin"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATE, "Date"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIME, "Time"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STATE, "State"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TRISTATE, "TriState"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HIDDEN_VALUE, "HiddenValue"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BUTTONTYPE, "ButtonType"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STRINGITEMLIST, "StringItemList"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_TEXT, "DefaultText"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTCHECKED, "DefaultState"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FORMATKEY, "FormatKey"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FORMATSSUPPLIER, "FormatsSupplier"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_ACTION, "SubmitAction"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_TARGET, "SubmitTarget"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_METHOD, "SubmitMethod"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_ENCODING, "SubmitEncoding"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_IMAGE_URL, "ImageURL"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LISTSOURCETYPE, "ListSourceType"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LISTSOURCE, "ListSource"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SELECT_SEQ, "SelectedItems"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUE_SEQ, "ValueItemList"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MULTISELECTION, "MultiSelection"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALIGN, "Align"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_DATE, "DefaultDate"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_TIME, "DefaultTime"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_VALUE, "DefaultValue"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DECIMAL_ACCURACY, "DecimalAccuracy"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORSOURCE, "DataSelection"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORSOURCETYPE, "DataSelectionType"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FIELDTYPE, "Type"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DECIMALS, "Decimals"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_REFVALUE, "RefValue"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUEMIN, "ValueMin"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUEMAX, "ValueMax"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STRICTFORMAT, "StrictFormat"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALLOWADDITIONS, "AllowInserts"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALLOWEDITS, "AllowUpdates"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALLOWDELETIONS, "AllowDeletes"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MASTERFIELDS, "MasterFields"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISPASSTHROUGH, "IsPassThrough"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_QUERY, "Query"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LITERALMASK, "LiteralMask"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUESTEP, "ValueStep"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SHOWTHOUSANDSEP, "ShowThousandsSeparator"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURRENCYSYMBOL, "CurrencySymbol"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATEFORMAT, "DateFormat"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATEMIN, "DateMin"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATEMAX, "DateMax"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATE_SHOW_CENTURY, "DateShowCentury"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIMEFORMAT, "TimeFormat"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIMEMIN, "TimeMin"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIMEMAX, "TimeMax"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINECOUNT, "LineCount"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BOUNDCOLUMN, "BoundColumn"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT, "FontDescriptor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BACKGROUNDCOLOR, "BackgroundColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILLCOLOR, "FillColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXTCOLOR, "TextColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINECOLOR, "LineColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BORDER, "Border"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DROPDOWN, "Dropdown"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MULTI, "Multi"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HSCROLL, "HScroll"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VSCROLL, "VScroll"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABSTOP, "Tabstop"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_AUTOCOMPLETE, "Autocomplete"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HARDLINEBREAKS, "HardLineBreaks"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PRINTABLE, "Printable"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ECHO_CHAR, "EchoChar"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ROWHEIGHT, "RowHeight"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HELPTEXT, "HelpText"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_NAME, "FontName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_STYLENAME, "FontStyleName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_FAMILY, "FontFamily"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_CHARSET, "FontCharset"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_HEIGHT, "FontHeight"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_WEIGHT, "FontWeight"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_SLANT, "FontSlant"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_UNDERLINE, "FontUnderline"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_WORDLINEMODE, "FontWordLineMode"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_STRIKEOUT, "FontStrikeout"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXTLINECOLOR, "TextLineColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTEMPHASISMARK, "FontEmphasisMark"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONTRELIEF, "FontRelief"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HELPURL, "HelpURL"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RECORDMARKER, "HasRecordMarker"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BOUNDFIELD, "BoundField"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TREATASNUMERIC, "TreatAsNumber"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_VALUE, "EffectiveValue"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_DEFAULT, "EffectiveDefault"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MIN, "EffectiveMin"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MAX, "EffectiveMax"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HIDDEN, "Hidden"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILTERPROPOSAL, "UseFilterValueProposal"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FIELDSOURCE, "FieldSource"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABLENAME, "TableName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILTERSUPPLIER, "FilterSupplier"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURRENTFILTER, "CurrentFilter"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SELECTED_FIELDS, "SelectedFields"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SELECTED_TABLES, "SelectedTables"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_THREADSAFE, "ThreadSafe"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISFILTERAPPLIED, "IsFilterApplied"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLLABEL, "LabelControl"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURRSYM_POSITION, "PrependCurrencySymbol"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SOURCE, "Source"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORCOLOR, "CursorColor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALWAYSSHOWCURSOR, "AlwaysShowCursor"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DISPLAYSYNCHRON, "DisplayIsSynchron"); - -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISMODIFIED, "IsModified"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISNEW, "IsNew"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PRIVILEGES, "Privileges"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COMMAND, "Command"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COMMANDTYPE, "CommandType"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESULTSET_CONCURRENCY, "ResultSetConcurrency"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_INSERTONLY, "IgnoreResult"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESULTSET_TYPE, "ResultSetType"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ESCAPE_PROCESSING, "EscapeProcessing"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFILTER, "ApplyFilter"); - -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISNULLABLE, "IsNullable"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ACTIVECOMMAND, "ActiveCommand"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISCURRENCY, "IsCurrency"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_URL, "URL"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TITLE, "Title"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ACTIVE_CONNECTION, "ActiveConnection"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SCALE, "Scale"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SORT, "Order"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATASOURCE, "DataSourceName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DETAILFIELDS, "DetailFields"); - -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COLUMNSERVICENAME, "ColumnServiceName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_REALNAME, "RealName"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCEPROPERTY, "DataFieldProperty"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_USER, "User"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PASSWORD, "Password"); -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DISPATCHURLINTERNAL, "DispatchURLInternal"); - -IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PERSISTENCE_MAXTEXTLENGTH, "PersistenceMaxTextLength"); - -//......................................................................... -} -//... namespace frm ....................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/forms_services.cxx b/binfilter/bf_forms/source/misc/forms_services.cxx deleted file mode 100644 index 0620dc6005ae..000000000000 --- a/binfilter/bf_forms/source/misc/forms_services.cxx +++ /dev/null @@ -1,604 +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. - * - ************************************************************************/ - -#include "services.hxx" -#include "formsmodule.hxx" -namespace binfilter { - -//... namespace frm ....................................................... -namespace frm -{ -//......................................................................... - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -IMPLEMENT_CONSTASCII_USTRING(AWT_CONTROL_TEXTFIELD, "com.sun.star.awt.TextField"); - -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_EDIT, "stardiv.vcl.control.Edit"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_LISTBOX, "stardiv.vcl.control.ListBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_COMBOBOX, "stardiv.vcl.control.ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_RADIOBUTTON, "stardiv.vcl.control.RadioButton"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_GROUPBOX, "stardiv.vcl.control.GroupBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_FIXEDTEXT, "stardiv.vcl.control.FixedText"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_COMMANDBUTTON, "stardiv.vcl.control.Button"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_CHECKBOX, "stardiv.vcl.control.CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_IMAGEBUTTON, "stardiv.vcl.control.ImageButton"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_FILECONTROL, "stardiv.vcl.control.FileControl"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_TIMEFIELD, "stardiv.vcl.control.TimeField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_DATEFIELD, "stardiv.vcl.control.DateField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_NUMERICFIELD, "stardiv.vcl.control.NumericField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_CURRENCYFIELD, "stardiv.vcl.control.CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_PATTERNFIELD, "stardiv.vcl.control.PatternField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_FORMATTEDFIELD, "stardiv.vcl.control.FormattedField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_IMAGECONTROL, "stardiv.vcl.control.ImageControl"); - -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_EDIT, "stardiv.vcl.controlmodel.Edit"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_LISTBOX, "stardiv.vcl.controlmodel.ListBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMBOBOX, "stardiv.vcl.controlmodel.ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_RADIOBUTTON, "stardiv.vcl.controlmodel.RadioButton"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_GROUPBOX, "stardiv.vcl.controlmodel.GroupBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_FIXEDTEXT, "stardiv.vcl.controlmodel.FixedText"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMMANDBUTTON, "stardiv.vcl.controlmodel.Button"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_CHECKBOX, "stardiv.vcl.controlmodel.CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGEBUTTON, "stardiv.vcl.controlmodel.ImageButton"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_FILECONTROL, "stardiv.vcl.controlmodel.FileControl"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_TIMEFIELD, "stardiv.vcl.controlmodel.TimeField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_DATEFIELD, "stardiv.vcl.controlmodel.DateField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_NUMERICFIELD, "stardiv.vcl.controlmodel.NumericField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_CURRENCYFIELD, "stardiv.vcl.controlmodel.CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_PATTERNFIELD, "stardiv.vcl.controlmodel.PatternField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_FORMATTEDFIELD, "stardiv.vcl.controlmodel.FormattedField"); -IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGECONTROL, "stardiv.vcl.controlmodel.ImageControl"); - -// ----------------------- -// service names for compatibility -// ----------------------- -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FORM, "stardiv.one.form.component.Form"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_EDIT, "stardiv.one.form.component.Edit"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_TEXTFIELD, "stardiv.one.form.component.TextField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_LISTBOX, "stardiv.one.form.component.ListBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_COMBOBOX, "stardiv.one.form.component.ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_RADIOBUTTON, "stardiv.one.form.component.RadioButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_GROUPBOX, "stardiv.one.form.component.GroupBox"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FIXEDTEXT, "stardiv.one.form.component.FixedText"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_COMMANDBUTTON, "stardiv.one.form.component.CommandButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_CHECKBOX, "stardiv.one.form.component.CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_GRID, "stardiv.one.form.component.Grid"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_GRIDCONTROL, "stardiv.one.form.component.GridControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_IMAGEBUTTON, "stardiv.one.form.component.ImageButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FILECONTROL, "stardiv.one.form.component.FileControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_TIMEFIELD, "stardiv.one.form.component.TimeField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_DATEFIELD, "stardiv.one.form.component.DateField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_NUMERICFIELD, "stardiv.one.form.component.NumericField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_CURRENCYFIELD, "stardiv.one.form.component.CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_PATTERNFIELD, "stardiv.one.form.component.PatternField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_HIDDEN, "stardiv.one.form.component.Hidden"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_HIDDENCONTROL, "stardiv.one.form.component.HiddenControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_IMAGECONTROL, "stardiv.one.form.component.ImageControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FORMATTEDFIELD, "stardiv.one.form.component.FormattedField"); - -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_EDIT, "stardiv.one.form.control.Edit"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_TEXTFIELD, "stardiv.one.form.control.TextField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_LISTBOX, "stardiv.one.form.control.ListBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_COMBOBOX, "stardiv.one.form.control.ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_RADIOBUTTON, "stardiv.one.form.control.RadioButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_GROUPBOX, "stardiv.one.form.control.GroupBox"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_FIXEDTEXT, "stardiv.one.form.control.FixedText"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_COMMANDBUTTON, "stardiv.one.form.control.CommandButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_CHECKBOX, "stardiv.one.form.control.CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_GRID, "stardiv.one.form.control.Grid"); // compatibility -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_GRIDCONTROL, "stardiv.one.form.control.GridControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_IMAGEBUTTON, "stardiv.one.form.control.ImageButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_TIMEFIELD, "stardiv.one.form.control.TimeField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_DATEFIELD, "stardiv.one.form.control.DateField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_NUMERICFIELD, "stardiv.one.form.control.NumericField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_CURRENCYFIELD, "stardiv.one.form.control.CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_PATTERNFIELD, "stardiv.one.form.control.PatternField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_IMAGECONTROL, "stardiv.one.form.control.ImageControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_FORMATTEDFIELD, "stardiv.one.form.control.FormattedField"); - -// ----------------------- -// new (sun) service names -// ----------------------- -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORM, "com.sun.star.form.component.Form"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HTMLFORM, "com.sun.star.form.component.HTMLForm"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATAFORM, "com.sun.star.form.component.DataForm"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TEXTFIELD, "com.sun.star.form.component.TextField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_LISTBOX, "com.sun.star.form.component.ListBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMBOBOX, "com.sun.star.form.component.ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_RADIOBUTTON, "com.sun.star.form.component.RadioButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GROUPBOX, "com.sun.star.form.component.GroupBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FIXEDTEXT, "com.sun.star.form.component.FixedText"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMMANDBUTTON, "com.sun.star.form.component.CommandButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CHECKBOX, "com.sun.star.form.component.CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GRIDCONTROL, "com.sun.star.form.component.GridControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_IMAGEBUTTON, "com.sun.star.form.component.ImageButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FILECONTROL, "com.sun.star.form.component.FileControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TIMEFIELD, "com.sun.star.form.component.TimeField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATEFIELD, "com.sun.star.form.component.DateField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_NUMERICFIELD, "com.sun.star.form.component.NumericField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CURRENCYFIELD, "com.sun.star.form.component.CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_PATTERNFIELD, "com.sun.star.form.component.PatternField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HIDDENCONTROL, "com.sun.star.form.component.HiddenControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORMATTEDFIELD, "com.sun.star.form.component.FormattedField"); - -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_IMAGECONTROL, "com.sun.star.form.component.DatabaseImageControl" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_RADIOBUTTON, "com.sun.star.form.component.DatabaseRadioButton" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_CHECKBOX, "com.sun.star.form.component.DatabaseCheckBox" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_LISTBOX, "com.sun.star.form.component.DatabaseListBox" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_COMBOBOX, "com.sun.star.form.component.DatabaseComboBox" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_TEXTFIELD, "com.sun.star.form.component.DatabaseTextField" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_DATEFIELD, "com.sun.star.form.component.DatabaseDateField" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_TIMEFIELD, "com.sun.star.form.component.DatabaseTimeField" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_NUMERICFIELD, "com.sun.star.form.component.DatabaseNumericField" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD, "com.sun.star.form.component.DatabaseCurrencyField" ); -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_COMPONENT_DATABASE_PATTERNFIELD, "com.sun.star.form.component.DatabasePatternField" ); - -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_TEXTFIELD, "com.sun.star.form.control.TextField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_LISTBOX, "com.sun.star.form.control.ListBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMBOBOX, "com.sun.star.form.control.ComboBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_RADIOBUTTON, "com.sun.star.form.control.RadioButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_GROUPBOX, "com.sun.star.form.control.GroupBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_FIXEDTEXT, "com.sun.star.form.control.FixedText"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMMANDBUTTON, "com.sun.star.form.control.CommandButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_CHECKBOX, "com.sun.star.form.control.CheckBox"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_GRIDCONTROL, "com.sun.star.form.control.GridControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGEBUTTON, "com.sun.star.form.control.ImageButton"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_TIMEFIELD, "com.sun.star.form.control.TimeField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_DATEFIELD, "com.sun.star.form.control.DateField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_NUMERICFIELD, "com.sun.star.form.control.NumericField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_CURRENCYFIELD, "com.sun.star.form.control.CurrencyField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_PATTERNFIELD, "com.sun.star.form.control.PatternField"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGECONTROL, "com.sun.star.form.control.ImageControl"); -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_FORMATTEDFIELD, "com.sun.star.form.control.FormattedField"); - -IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_FORMS_COLLECTION, "com.sun.star.form.Forms"); - -IMPLEMENT_CONSTASCII_USTRING(FRM_NUMBER_FORMATTER, "com.sun.star.util.NumberFormatter"); -IMPLEMENT_CONSTASCII_USTRING(FRM_NUMBER_FORMATS_SUPPLIER, "com.sun.star.util.NumberFormatsSupplier"); - -IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_ROWSET, "com.sun.star.sdb.RowSet"); -IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_CONNECTION, "com.sun.star.sdb.Connection"); -IMPLEMENT_CONSTASCII_USTRING(SRV_SDBC_STATEMENT, "com.sun.star.sdbc.Statement"); - -IMPLEMENT_CONSTASCII_USTRING(SRV_AWT_POINTER, "com.sun.star.awt.Pointer"); -IMPLEMENT_CONSTASCII_USTRING(SRV_AWT_IMAGEPRODUCER, "com.sun.star.awt.ImageProducer"); - -// ----------------------- -// common -// ----------------------- -IMPLEMENT_CONSTASCII_USTRING( FRM_SUN_FORMCOMPONENT, "com.sun.star.form.FormComponent" ); - -//......................................................................... -} -//... namespace frm ....................................................... -}//namespace bifilter -#include <uno/lbnames.h> -#include <osl/diagnose.h> - -namespace binfilter {//STRIP009 - -namespace starregistry = ::com::sun::star::registry; -namespace staruno = ::com::sun::star::uno; -namespace starlang = ::com::sun::star::lang; - -//--------------------------------------------------------------------------------------- -//....................................................................................... -#define DECLARE_SERVICE_INFO(classImplName) \ - namespace frm { \ - extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> SAL_CALL classImplName##_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory) throw (::com::sun::star::uno::RuntimeException); \ - } - -//--------------------------------------------------------------------------------------- -DECLARE_SERVICE_INFO(OFixedTextModel) -DECLARE_SERVICE_INFO(ORadioButtonModel) -DECLARE_SERVICE_INFO(ORadioButtonControl) -DECLARE_SERVICE_INFO(OCheckBoxModel) -DECLARE_SERVICE_INFO(OCheckBoxControl) -DECLARE_SERVICE_INFO(OHiddenModel) -DECLARE_SERVICE_INFO(OGroupBoxModel) -DECLARE_SERVICE_INFO(OGroupBoxControl) -DECLARE_SERVICE_INFO(OListBoxControl) -DECLARE_SERVICE_INFO(OListBoxModel) -DECLARE_SERVICE_INFO(OComboBoxControl) -DECLARE_SERVICE_INFO(OComboBoxModel) -DECLARE_SERVICE_INFO(OEditControl) -DECLARE_SERVICE_INFO(OEditModel) -DECLARE_SERVICE_INFO(ONumericControl) -DECLARE_SERVICE_INFO(ONumericModel) -DECLARE_SERVICE_INFO(OPatternControl) -DECLARE_SERVICE_INFO(OPatternModel) -DECLARE_SERVICE_INFO(OCurrencyControl) -DECLARE_SERVICE_INFO(OCurrencyModel) -DECLARE_SERVICE_INFO(ODateControl) -DECLARE_SERVICE_INFO(ODateModel) -DECLARE_SERVICE_INFO(OTimeControl) -DECLARE_SERVICE_INFO(OTimeModel) -DECLARE_SERVICE_INFO(OFormattedControl) -DECLARE_SERVICE_INFO(OFormattedModel) -DECLARE_SERVICE_INFO(OFileControlModel) -DECLARE_SERVICE_INFO(OButtonControl) -DECLARE_SERVICE_INFO(OButtonModel) -DECLARE_SERVICE_INFO(OImageButtonControl) -DECLARE_SERVICE_INFO(OImageButtonModel) - -DECLARE_SERVICE_INFO(OImageControlControl) -DECLARE_SERVICE_INFO(OImageControlModel) -DECLARE_SERVICE_INFO(OGridControlModel) - -// some special handling for the FormattedFieldWrapper which can act as FormattedModel or as EditModel -DECLARE_SERVICE_INFO(OFormattedFieldWrapper)//STRIP008 ; - // this is for a service, which is instantiated through the EditModel service name - // and which acts mostly as Edit (mostly means : if somebody uses XPersistObject::read immediately after - // the object was instantiated and the stream contains a FormattedModel, it switches permanently to - // formatted.) -namespace frm { \ - extern Reference<XInterface> SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const Reference<XMultiServiceFactory>& _rxFactory) throw (RuntimeException); \ -} - -DECLARE_SERVICE_INFO(OFormsCollection) -DECLARE_SERVICE_INFO(ImageProducer) - -//--------------------------------------------------------------------------------------- - -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::registry; - -static Sequence< ::rtl::OUString > s_aClassImplementationNames; -static Sequence<Sequence< ::rtl::OUString > > s_aClassServiceNames; -static Sequence<sal_Int64> s_aFactories; - // need to use sal_Int64 instead of ComponentInstantiation, as ComponentInstantiation has no cppuType, so - // it can't be used with sequences - -//--------------------------------------------------------------------------------------- -void registerClassInfo( - ::rtl::OUString _rClassImplName, // the ImplName of the class - const Sequence< ::rtl::OUString >& _rServiceNames, // the services supported by this class - ::cppu::ComponentInstantiation _pCreateFunction // the method for instantiating such a class - ) -{ - sal_Int32 nCurrentLength = s_aClassImplementationNames.getLength(); - OSL_ENSURE((nCurrentLength == s_aClassServiceNames.getLength()) - && (nCurrentLength == s_aFactories.getLength()), - "forms::registerClassInfo : invalid class infos !"); - - s_aClassImplementationNames.realloc(nCurrentLength + 1); - s_aClassServiceNames.realloc(nCurrentLength + 1); - s_aFactories.realloc(nCurrentLength + 1); - - s_aClassImplementationNames.getArray()[nCurrentLength] = _rClassImplName; - s_aClassServiceNames.getArray()[nCurrentLength] = _rServiceNames; - s_aFactories.getArray()[nCurrentLength] = reinterpret_cast<sal_Int64>(_pCreateFunction); -} - -//--------------------------------------------------------------------------------------- -//....................................................................................... -#define REGISTER_CLASS_CORE(classImplName) \ - registerClassInfo( \ - ::rtl::OUString::createFromAscii("com.sun.star.form.") + ::rtl::OUString::createFromAscii(#classImplName), \ - aServices, \ - frm::classImplName##_CreateInstance) - -//....................................................................................... -#define REGISTER_CLASS1(classImplName, service1) \ - aServices.realloc(1); \ - aServices.getArray()[0] = frm::service1; \ - REGISTER_CLASS_CORE(classImplName) - -//....................................................................................... -#define REGISTER_CLASS2(classImplName, service1, service2) \ - aServices.realloc(2); \ - aServices.getArray()[0] = frm::service1; \ - aServices.getArray()[1] = frm::service2; \ - REGISTER_CLASS_CORE(classImplName) - -//....................................................................................... -#define REGISTER_CLASS3(classImplName, service1, service2, service3) \ - aServices.realloc(3); \ - aServices.getArray()[0] = frm::service1; \ - aServices.getArray()[1] = frm::service2; \ - aServices.getArray()[2] = frm::service3; \ - REGISTER_CLASS_CORE(classImplName) - -//....................................................................................... -#define REGISTER_CLASS4(classImplName, service1, service2, service3, service4) \ - aServices.realloc(4); \ - aServices.getArray()[0] = frm::service1; \ - aServices.getArray()[1] = frm::service2; \ - aServices.getArray()[2] = frm::service3; \ - aServices.getArray()[3] = frm::service4; \ - REGISTER_CLASS_CORE(classImplName) - -//--------------------------------------------------------------------------------------- -void ensureClassInfos() -{ - if (s_aClassImplementationNames.getLength()) - // nothing to do - return; - Sequence< ::rtl::OUString > aServices; - - // ======================================================================== - // = ControlModels - // ------------------------------------------------------------------------ - // - FixedText - REGISTER_CLASS2(OFixedTextModel, FRM_COMPONENT_FIXEDTEXT, FRM_SUN_COMPONENT_FIXEDTEXT); - // - Hidden - REGISTER_CLASS3(OHiddenModel, FRM_COMPONENT_HIDDENCONTROL, FRM_SUN_COMPONENT_HIDDENCONTROL, FRM_COMPONENT_HIDDEN); - // - FileControl - REGISTER_CLASS2(OFileControlModel, FRM_COMPONENT_FILECONTROL, FRM_SUN_COMPONENT_FILECONTROL); - // - ImageButton - REGISTER_CLASS2(OImageButtonModel, FRM_COMPONENT_IMAGEBUTTON, FRM_SUN_COMPONENT_IMAGEBUTTON); - // - GridControl - REGISTER_CLASS3(OGridControlModel, FRM_COMPONENT_GRID /* compatibility */, FRM_COMPONENT_GRIDCONTROL, FRM_SUN_COMPONENT_GRIDCONTROL); - // - GroupBox - REGISTER_CLASS2(OGroupBoxModel, FRM_COMPONENT_GROUPBOX, FRM_SUN_COMPONENT_GROUPBOX); - - // - RadioButton - REGISTER_CLASS3( ORadioButtonModel, FRM_COMPONENT_RADIOBUTTON, FRM_SUN_COMPONENT_RADIOBUTTON, FRM_SUN_COMPONENT_DATABASE_RADIOBUTTON ); - // - CheckBox - REGISTER_CLASS3( OCheckBoxModel, FRM_COMPONENT_CHECKBOX, FRM_SUN_COMPONENT_CHECKBOX, FRM_SUN_COMPONENT_DATABASE_CHECKBOX ); - // - ListBox - REGISTER_CLASS3( OListBoxModel, FRM_COMPONENT_LISTBOX, FRM_SUN_COMPONENT_LISTBOX, FRM_SUN_COMPONENT_DATABASE_LISTBOX ); - // - ComboBox - REGISTER_CLASS3( OComboBoxModel, FRM_COMPONENT_COMBOBOX, FRM_SUN_COMPONENT_COMBOBOX, FRM_SUN_COMPONENT_DATABASE_COMBOBOX ); - // - EditControl - REGISTER_CLASS3( OEditModel, FRM_COMPONENT_TEXTFIELD, FRM_SUN_COMPONENT_TEXTFIELD, FRM_SUN_COMPONENT_DATABASE_TEXTFIELD ); - // - DateControl - REGISTER_CLASS3( ODateModel, FRM_COMPONENT_DATEFIELD, FRM_SUN_COMPONENT_DATEFIELD, FRM_SUN_COMPONENT_DATABASE_DATEFIELD ); - // - TimeControl - REGISTER_CLASS3( OTimeModel, FRM_COMPONENT_TIMEFIELD, FRM_SUN_COMPONENT_TIMEFIELD, FRM_SUN_COMPONENT_DATABASE_TIMEFIELD ); - // - NumericField - REGISTER_CLASS3( ONumericModel, FRM_COMPONENT_NUMERICFIELD, FRM_SUN_COMPONENT_NUMERICFIELD, FRM_SUN_COMPONENT_DATABASE_NUMERICFIELD ); - // - CurrencyField - REGISTER_CLASS3( OCurrencyModel, FRM_COMPONENT_CURRENCYFIELD, FRM_SUN_COMPONENT_CURRENCYFIELD, FRM_SUN_COMPONENT_DATABASE_CURRENCYFIELD ); - // - PatternField - REGISTER_CLASS3( OPatternModel, FRM_COMPONENT_PATTERNFIELD, FRM_SUN_COMPONENT_PATTERNFIELD, FRM_SUN_COMPONENT_DATABASE_PATTERNFIELD ); - // - Button - REGISTER_CLASS2( OButtonModel, FRM_COMPONENT_COMMANDBUTTON, FRM_SUN_COMPONENT_COMMANDBUTTON ); - // - ImageControl - REGISTER_CLASS2( OImageControlModel, FRM_COMPONENT_IMAGECONTROL, FRM_SUN_COMPONENT_IMAGECONTROL ); - - // - FormattedField - REGISTER_CLASS1(OFormattedFieldWrapper, FRM_COMPONENT_EDIT); - // since SUPD568 both OFormattedModel and OEditModel use FRM_COMPONENT_EDIT for persistence, - // and while reading a wrapper determines which kind of model it is - // register the wrapper for the FormattedField, as it handles the XPersistObject::write - // so that version <= 5.1 are able to read it - aServices.realloc(3); - aServices.getArray()[0] = frm::FRM_COMPONENT_FORMATTEDFIELD; - aServices.getArray()[1] = frm::FRM_SUN_COMPONENT_FORMATTEDFIELD; - aServices.getArray()[2] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseFormattedField"); - registerClassInfo(::rtl::OUString::createFromAscii("com.sun.star.comp.forms.OFormattedFieldWrapper_ForcedFormatted"), - aServices, - frm::OFormattedFieldWrapper_CreateInstance_ForceFormatted); - - // ======================================================================== - // = Controls - // - RadioButton - REGISTER_CLASS2(ORadioButtonControl, FRM_CONTROL_RADIOBUTTON, FRM_SUN_CONTROL_RADIOBUTTON); - // - CheckBox - REGISTER_CLASS2(OCheckBoxControl, FRM_CONTROL_CHECKBOX, FRM_SUN_CONTROL_CHECKBOX); - // - GroupBox - REGISTER_CLASS2(OGroupBoxControl, FRM_CONTROL_GROUPBOX, FRM_SUN_CONTROL_GROUPBOX); - // - ListBox - REGISTER_CLASS2(OListBoxControl, FRM_CONTROL_LISTBOX, FRM_SUN_CONTROL_LISTBOX); - // - ComboBox - REGISTER_CLASS2(OComboBoxControl, FRM_CONTROL_COMBOBOX, FRM_SUN_CONTROL_COMBOBOX); - // - EditControl - REGISTER_CLASS3(OEditControl, FRM_CONTROL_TEXTFIELD, FRM_SUN_CONTROL_TEXTFIELD, FRM_CONTROL_EDIT); - // - DateControl - REGISTER_CLASS2(ODateControl, FRM_CONTROL_DATEFIELD, FRM_SUN_CONTROL_DATEFIELD); - // - TimeControl - REGISTER_CLASS2(OTimeControl, FRM_CONTROL_TIMEFIELD, FRM_SUN_CONTROL_TIMEFIELD); - // - NumericField - REGISTER_CLASS2(ONumericControl, FRM_CONTROL_NUMERICFIELD, FRM_SUN_CONTROL_NUMERICFIELD); - // - CurrencyField - REGISTER_CLASS2(OCurrencyControl, FRM_CONTROL_CURRENCYFIELD, FRM_SUN_CONTROL_CURRENCYFIELD); - // - PatternField - REGISTER_CLASS2(OPatternControl, FRM_CONTROL_PATTERNFIELD, FRM_SUN_CONTROL_PATTERNFIELD); - // - FormattedField - REGISTER_CLASS2(OFormattedControl, FRM_CONTROL_FORMATTEDFIELD, FRM_SUN_CONTROL_FORMATTEDFIELD); - // - Button - REGISTER_CLASS2(OButtonControl, FRM_CONTROL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON); - // - ImageButton - REGISTER_CLASS2(OImageButtonControl, FRM_CONTROL_IMAGEBUTTON, FRM_SUN_CONTROL_IMAGEBUTTON); - // - ImageControl - REGISTER_CLASS2(OImageControlControl, FRM_CONTROL_IMAGECONTROL, FRM_SUN_CONTROL_IMAGECONTROL); - - - // ======================================================================== - // = various - REGISTER_CLASS1(OFormsCollection, FRM_SUN_FORMS_COLLECTION); - REGISTER_CLASS1(ImageProducer, SRV_AWT_IMAGEPRODUCER); -} - -//--------------------------------------------------------------------------------------- -void registerServiceProvider(const ::rtl::OUString& _rServiceImplName, const Sequence< ::rtl::OUString >& _rServices, starregistry::XRegistryKey* _pKey) -{ - ::rtl::OUString sMainKeyName = ::rtl::OUString::createFromAscii("/"); - sMainKeyName += _rServiceImplName; - sMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES"); - Reference<starregistry::XRegistryKey> xNewKey = _pKey->createKey(sMainKeyName); - OSL_ENSURE(xNewKey.is(), "forms::registerProvider : could not create a registry key !"); - if (!xNewKey.is()) - return; - - const ::rtl::OUString* pSupportedServices = _rServices.getConstArray(); - for (sal_Int32 i=0; i<_rServices.getLength(); ++i, ++pSupportedServices) - xNewKey->createKey(*pSupportedServices); -} - -//======================================================================================= -extern "C" -{ - -//--------------------------------------------------------------------------------------- -void SAL_CALL createRegistryInfo_ODatabaseForm(); -void SAL_CALL createRegistryInfo_OFilterControl(); - -//--------------------------------------------------------------------------------------- -void SAL_CALL createRegistryInfo_FORMS() -{ - static sal_Bool bInit = sal_False; - if (!bInit) - { - createRegistryInfo_ODatabaseForm(); - createRegistryInfo_OFilterControl(); - bInit = sal_True; - } -} - -//--------------------------------------------------------------------------------------- -void SAL_CALL component_getImplementationEnvironment(const sal_Char** _ppEnvTypeName, uno_Environment** _ppEnv) -{ - *_ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -//--------------------------------------------------------------------------------------- -sal_Bool SAL_CALL component_writeInfo(void* _pServiceManager, starregistry::XRegistryKey* _pRegistryKey) -{ - if (_pRegistryKey) - { - try - { - // the real way - use the OModule - createRegistryInfo_FORMS(); - if ( !::binfilter::frm::OFormsModule::writeComponentInfos(//STRIP008 if ( !::frm::OFormsModule::writeComponentInfos( - static_cast<XMultiServiceFactory*>( _pServiceManager ), - static_cast<XRegistryKey*>( _pRegistryKey ) ) - ) - return sal_False; - - // a lot of stuff which is implemented "manually" here in this file - - // collect the class infos - ensureClassInfos(); - - // both our static sequences should have the same length ... - sal_Int32 nClasses = s_aClassImplementationNames.getLength(); - OSL_ENSURE(s_aClassServiceNames.getLength() == nClasses, - "forms::component_writeInfo : invalid class infos !"); - - // loop through the sequences and register the service providers - const ::rtl::OUString* pClasses = s_aClassImplementationNames.getConstArray(); - const Sequence< ::rtl::OUString >* pServices = s_aClassServiceNames.getConstArray(); - - for (sal_Int32 i=0; i<nClasses; ++i, ++pClasses, ++pServices) - registerServiceProvider(*pClasses, *pServices, _pRegistryKey); - - s_aClassImplementationNames.realloc(0); - s_aClassServiceNames.realloc(0); - s_aFactories.realloc(0); - - return sal_True; - } - catch (starregistry::InvalidRegistryException &) - { - OSL_ENSURE(sal_False, "forms::component_writeInfo : InvalidRegistryException !"); - } - } - s_aClassImplementationNames.realloc(0); - s_aClassServiceNames.realloc(0); - s_aFactories.realloc(0); - return sal_False; -} - -//--------------------------------------------------------------------------------------- -void* SAL_CALL component_getFactory(const sal_Char* _pImplName, XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/) -{ - if (!_pServiceManager || !_pImplName) - return NULL; - - // a lot of stuff which is implemented "manually" here in this file - void* pRet = NULL; - - // collect the class infos - ensureClassInfos(); - - // both our static sequences should have the same length ... - sal_Int32 nClasses = s_aClassImplementationNames.getLength(); - OSL_ENSURE((s_aClassServiceNames.getLength() == nClasses) && - (s_aFactories.getLength() == nClasses), - "forms::component_writeInfo : invalid class infos !"); - - // loop through the sequences and register the service providers - const ::rtl::OUString* pClasses = s_aClassImplementationNames.getConstArray(); - const Sequence< ::rtl::OUString >* pServices = s_aClassServiceNames.getConstArray(); - const sal_Int64* pFunctionsAsInts = s_aFactories.getConstArray(); - - for (sal_Int32 i=0; i<nClasses; ++i, ++pClasses, ++pServices, ++pFunctionsAsInts) - { - if (rtl_ustr_ascii_compare(*pClasses, _pImplName) == 0) - { - ::cppu::ComponentInstantiation aCurrentCreateFunction = - reinterpret_cast< ::cppu::ComponentInstantiation>(*pFunctionsAsInts); - - Reference<XSingleServiceFactory> xFactory( - ::cppu::createSingleFactory( - _pServiceManager, - *pClasses, - aCurrentCreateFunction, - *pServices - ) - ); - if (xFactory.is()) - { - xFactory->acquire(); - pRet = xFactory.get(); - break; - } - } - } - - // the real way - use the OModule - if ( !pRet ) - { - createRegistryInfo_FORMS(); - { - // let the module look for the component - Reference< XInterface > xRet; - xRet = ::binfilter::frm::OFormsModule::getComponentFactory(//STRIP008 xRet = ::frm::OFormsModule::getComponentFactory( - ::rtl::OUString::createFromAscii( _pImplName ), - static_cast< XMultiServiceFactory* >( _pServiceManager ) ); - - if ( xRet.is() ) - xRet->acquire(); - pRet = xRet.get(); - } - } - - return pRet; -} - -} -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/misc/makefile.mk b/binfilter/bf_forms/source/misc/makefile.mk deleted file mode 100644 index 6bed9b34574c..000000000000 --- a/binfilter/bf_forms/source/misc/makefile.mk +++ /dev/null @@ -1,63 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE - -PRJ=..$/..$/.. -BFPRJ=..$/.. - -PRJNAME=binfilter -TARGET=forms_common - -#GEN_HID=TRUE -#GEN_HID_OTHER=TRUE -NO_HIDS=TRUE - -ENABLE_EXCEPTIONS=TRUE -#TARGETTYPE=GUI - -# --- Settings ---------------------------------- - -.INCLUDE : settings.mk -INC+= -I$(PRJ)$/inc$/bf_forms -# --- Types ------------------------------------- - -INCPRE+=$(SOLARINCDIR)$/offuh - -# --- Files ------------------------------------- - -SLOFILES= $(SLO)$/forms_limitedformats.obj \ - $(SLO)$/forms_property.obj \ - $(SLO)$/forms_services.obj \ - $(SLO)$/forms_InterfaceContainer.obj \ - $(SLO)$/forms_ids.obj \ - $(SLO)$/forms_formsmodule.obj - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk - diff --git a/binfilter/bf_forms/source/resource/forms_frm_resource.cxx b/binfilter/bf_forms/source/resource/forms_frm_resource.cxx deleted file mode 100644 index d434c8abc7c9..000000000000 --- a/binfilter/bf_forms/source/resource/forms_frm_resource.cxx +++ /dev/null @@ -1,90 +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. - * - ************************************************************************/ - -#include "frm_resource.hxx" - -#include <tools/simplerm.hxx> - -// ---- needed as long as we have no contexts for components --- -#include <vcl/svapp.hxx> -//--------------------------------------------------- - -#include <bf_svtools/solar.hrc> -namespace binfilter { - -//......................................................................... -namespace frm -{ - - //================================================================== - //= ResourceManager - //================================================================== - SimpleResMgr* ResourceManager::m_pImpl = NULL; - - //------------------------------------------------------------------ - ResourceManager::EnsureDelete::~EnsureDelete() - { - delete ResourceManager::m_pImpl; - } - - //------------------------------------------------------------------ - void ResourceManager::ensureImplExists() - { - if (m_pImpl) - return; - - ByteString sFileName("bf_frm"); //STRIP005 - - m_pImpl = SimpleResMgr::Create(sFileName.GetBuffer(), Application::GetSettings().GetUILocale()); - - if (m_pImpl) - { - // no that we have a impl class make sure it's deleted on unloading the library - static ResourceManager::EnsureDelete s_aDeleteTheImplClas; - } - } - - //------------------------------------------------------------------ - ::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId) - { - ::rtl::OUString sReturn; - - ensureImplExists(); - if (m_pImpl) - sReturn = m_pImpl->ReadString(_nResId); - - return sReturn; - } - -//......................................................................... -} -//......................................................................... - -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/binfilter/bf_forms/source/resource/forms_strings.src b/binfilter/bf_forms/source/resource/forms_strings.src deleted file mode 100644 index b2a8eb880ce4..000000000000 --- a/binfilter/bf_forms/source/resource/forms_strings.src +++ /dev/null @@ -1,531 +0,0 @@ -/************************************************************************* - * - * 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. - * - ************************************************************************/ - -#define NO_LOCALIZE_EXPORT - -#ifndef _FRM_RESOURCE_HRC_ -#include "frm_resource.hrc" -#endif - -String RID_BASELISTBOX_ERROR_FILLLIST -{ - Text [ de ] = "Der Inhalt eines Kombinations- oder Listenfeldes konnte nicht ermittelt werden."; - Text [ en-US ] = "The contents of a combo box or list field could not be determined."; - Text[ pt ] = "Foi impossível determinar o conteúdo de uma caixa combinada ou caixa de listagem."; - Text[ ru ] = "Невозможно определить содержимое поля со списком или поля списка."; - Text[ el ] = "Δεν ήταν δυνατόν να γίνει αναγνώριση του περιεχομένου ενός πλαισίου συνδυασμού ή ενός πεδίου καταλόγου"; - Text[ nl ] = "Inhoud combinatieveld of keuzelijst niet gevonden."; - Text[ fr ] = "Impossible de déterminer le contenu de la zone combinée/zone de liste."; - Text[ es ] = "No se pudo determinar ni el contenido del cuadro combinado ni el del listado."; - Text[ fi ] = "Yhdistelmäruudun tai luettelokentän sisältöä ei voitu määrittää."; - Text[ ca ] = "No s'ha pogut determinar el contingut d'un camp de llista o quadre combinat."; - Text[ it ] = "Non è stato possibile determinare il contenuto di una casella combinata o di una casella di riepilogo."; - Text[ sk ] = "Nebolo možné určiť obsah rozbaľovacieho menu alebo textového poľa."; - Text[ da ] = "Det var ikke muligt at bestemme indholdet for en kombinationsboks eller rulleliste."; - Text[ sv ] = "Innehållet i ett kombinationsfält eller en listruta kunde inte bestämmas."; - Text[ pl ] = "Nie można ustalić zawartości pola kombi lub pola listy."; - Text[ pt-BR ] = "Não foi possível determinar o conteúdo de uma caixa de combinação ou campo de listagem."; - Text[ th ] = "ไม่สามารถกำหนดเนื้อหาของกล่องคอมโบ้หรือเขตข้อมูลรายการได้"; - Text[ ja ] = "コンボボックスまたはリストボックスの内容が確認できませんでした。"; - Text[ ko ] = "콤보 상자 또는 목록 필드의 내용을 확인하지 못했습니다."; - Text[ zh-CN ] = "无法确定组合框或者列表框内的内容。"; - Text[ zh-TW ] = "無法從資料庫內測定組合方塊或清單方塊的內容"; - Text[ tr ] = "Kombinasyon alanı yada liste alanı algılanamıyor."; - Text[ hi-IN ] = "कॉम्बो बॉक्स अथवा सूची बॉक्स की विषय को निश्चित नहीं कर सकते है ।"; - Text[ ar ] = "تعذر التعرف على محتويات مربع تحرير وسرد أو مربع قائمة."; - Text[ he ] = "Der Inhalt eines Kombinations- oder Listenfeldes konnte nicht ermittelt werden."; -}; - -String RID_STR_IMPORT_GRAPHIC -{ - Text [ de ] = "Grafik einfügen" ; - Text [ en-US ] = "Insert graphics" ; - Text[ pt ] = "Inserir imagem"; - Text[ ru ] = "Вставить графический объект"; - Text[ el ] = "Εισαγωγή γραφικού"; - Text[ nl ] = "Afbeelding invoegen"; - Text[ fr ] = "Insérer une image"; - Text[ es ] = "Insertar una imagen"; - Text[ fi ] = "Lisää grafiikka"; - Text[ ca ] = "Insereix gràfics"; - Text[ it ] = "Inserisci immagine"; - Text[ sk ] = "Vložiť obrázok"; - Text[ da ] = "Indsæt grafik"; - Text[ sv ] = "Infoga grafik"; - Text[ pl ] = "Wstaw grafikę"; - Text[ pt-BR ] = "Inserir Figuras"; - Text[ th ] = "แทรกกราฟิค"; - Text[ ja ] = "図の挿入"; - Text[ ko ] = "그림 삽입"; - Text[ zh-CN ] = "插入图形"; - Text[ zh-TW ] = "插入圖形"; - Text[ tr ] = "Resim ekle"; - Text[ hi-IN ] = "सुचित्र जोड़ो"; - Text[ ar ] = "إدراج صورة"; - Text[ he ] = "Grafik einfügen"; -}; - -String RID_STR_CONTROL_SUBSTITUTED_NAME -{ - Text [ de ] = "ersetzt"; - Text [ en-US ] = "substituted"; - Text[ pt ] = "substituído"; - Text[ ru ] = "подставлено"; - Text[ el ] = "αντικαταστάθηκε"; - Text[ nl ] = "vervangen"; - Text[ fr ] = "remplacé"; - Text[ es ] = "reemplazado"; - Text[ fi ] = "korvattu"; - Text[ ca ] = "substituït"; - Text[ it ] = "sostituito"; - Text[ sk ] = "nahradené"; - Text[ da ] = "erstattet"; - Text[ sv ] = "ersatt"; - Text[ pl ] = "zamieniono"; - Text[ pt-BR ] = "substituído"; - Text[ th ] = "แทน"; - Text[ ja ] = "置換"; - Text[ ko ] = "대체됨"; - Text[ zh-CN ] = "替换"; - Text[ zh-TW ] = "替代"; - Text[ tr ] = "değiştirildi"; - Text[ hi-IN ] = "स्थानापन्न की हुयी"; - Text[ ar ] = "مستبدل"; - Text[ he ] = "ersetzt"; -}; - -String RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN -{ - Text [ de ] = "Beim Laden dieses Controls trat ein Fehler auf. Es wurde daher durch einen Platzhalter ersetzt."; - Text [ en-US ] = "An error occurred while this control was being loaded. It was therefore replaced with a placeholder."; - Text[ pt ] = "Ao carregar este controlo ocorreu um erro. Por esta razão foi substituído por um marcador de posição."; - Text[ ru ] = "Ошибка загрузки элемента управления. Он был заменен полем подстановки."; - Text[ el ] = "Προέκυψε σφάλμα κατά τη φόρτωση αυτού του στοιχείου ελέγχου. Για αυτόν τον λόγο αντικαταστάθηκε με ένα πλαίσιο δείκτη τοποθέτησης."; - Text[ nl ] = "Fout bij het laden van control. Is vervangen door plaatsvervanger."; - Text[ fr ] = "Erreur lors du chargement de ce contrôle ; c'est pouquoi il a été remplacé par un substituant."; - Text[ es ] = "Ha ocurrido un error al cargar este Control. Por ello se ha reemplazado con un comodín."; - Text[ fi ] = "Tätä ohjausobjektia ladattaessa ilmeni virhe. Se korvattiin siksi paikkamerkillä."; - Text[ ca ] = "S'ha produït un error mentre aquest control es carregava. Per tant, s'ha reemplaçat per un marcador."; - Text[ it ] = "Durante il caricamento del control si è verificato un errore. Pertanto è stato sostituito con una variabile."; - Text[ sk ] = "Objavila sa chyba pri načítaní tohto ovládacieho prvku, ktorý bol preto nahradený len zástupcom."; - Text[ da ] = "Der opstod en fejl under indlæsningen af dette kontrolelement. Det blev derfor erstattet med en pladsholder."; - Text[ sv ] = "När denna control laddades uppstod ett fel. Därför ersattes den av en platshållare."; - Text[ pl ] = "Wystąpił błąd podczas ładowania tego formantu, więc zastąpiono go znakiem-wypełniaczem."; - Text[ pt-BR ] = "Ocorreu um erro durante o carregamento desse controle. Por isso ele foi substituído por um marcador de posição."; - Text[ th ] = "เกิดข้อผิดพลาดขณะกำลังโหลดตัวควบคุม เนื่องจากมันถูกแทนที่ด้วยตำแหน่งวางวัตถุ"; - Text[ ja ] = "このコントロールの読み込み中にエラーが発生しました。それが原因でワイルドカードに置換されました。"; - Text[ ko ] = "이 컨트롤 로드 중에 오류가 발생했습니다. 이 이유로 인해 플레이스홀더로 대체되었습니다."; - Text[ zh-CN ] = "装入这个字段时出现了一个错误,因此用通配符代替字段。"; - Text[ zh-TW ] = "載入這個控制項時發生一個錯誤。但已經用一個萬用字元替代它。"; - Text[ tr ] = "Komutlar yüklenirken hata oluştu. Bu yüzden eskideğerler ile değiştirildi."; - Text[ hi-IN ] = "इस नियंत्रण को लोड करने के समय गलती घटित हुआ । इसलिए इसको स्थानधारक द्वारा प्रतिस्थापित किया है ।"; - Text[ ar ] = "حدث خطأ أثناء تحميل عنصر التحكم هذا. لهذا تم استبداله بعنصر نائب."; - Text[ he ] = "Beim Laden dieses Controls trat ein Fehler auf. Es wurde daher durch einen Platzhalter ersetzt."; -}; - -String RID_STR_READERROR -{ - Text [ de ] = "Fehler beim Lesen von Daten aus der Datenbank" ; - Text [ en-US ] = "Error reading data from database" ; - Text[ pt ] = "Erro ao ler dados da base de dados"; - Text[ ru ] = "Ошибка чтения данных из базы данных"; - Text[ el ] = "Σφάλμα κατά την ανάγνωση δεδομένων από τη βάση δεδομένων"; - Text[ nl ] = "Fout bij lezen van gegevens in database"; - Text[ fr ] = "Erreur lors de la lecture des données de la base de données"; - Text[ es ] = "Error al leer datos de la base de datos"; - Text[ fi ] = "On ilmennyt virhe luettaessa tietokannan tietoja."; - Text[ ca ] = "S'ha produït un error en llegir les dades de la base de dades"; - Text[ it ] = "Errore durante la lettura di dati dal database"; - Text[ sk ] = "Chyba pri čítaní dát z databázy"; - Text[ da ] = "Fejl under læsning af data fra databasen"; - Text[ sv ] = "Fel vid läsning av data från databasen"; - Text[ pl ] = "Błąd odczytu danych z bazy"; - Text[ pt-BR ] = "Ocorreu um erro ao ler dados do banco de dados"; - Text[ th ] = "อ่านข้อมูลจากฐานข้อมูลผิดพลาด"; - Text[ ja ] = "データベースからデータを読み取る時のエラー"; - Text[ ko ] = "데이터베이스에 있는 데이터를 읽을 때 오류"; - Text[ zh-CN ] = "在读取数据库数据时发生错误"; - Text[ zh-TW ] = "在讀取資料庫時發生錯誤"; - Text[ tr ] = "Hata: veritabanından veriler okunamıyor"; - Text[ hi-IN ] = "लेखासंचय से डॉटा को पढ़ने के समय गलती"; - Text[ ar ] = "حدث خطأ أثناء قراءة بيانات من قاعدة البيانات"; - Text[ he ] = "Fehler beim Lesen von Daten aus der Datenbank"; -}; - -String RID_STR_CONNECTERROR -{ - Text [ de ] = "Verbindungsaufbau gescheitert" ; - Text [ en-US ] = "Connection failed" ; - Text[ pt ] = "Não foi possível estabelecer ligação."; - Text[ ru ] = "Подключение повреждено"; - Text[ el ] = "Η σύνδεση απέτυχε"; - Text[ nl ] = "Kan geen verbinding tot stand brengen"; - Text[ fr ] = "Connexion impossible"; - Text[ es ] = "No se pudo efectuar la conexión."; - Text[ fi ] = "Yhteyden muodostaminen ei onnistunut."; - Text[ ca ] = "La connexió ha fallat"; - Text[ it ] = "Impossibile creare il collegamento"; - Text[ sk ] = "Spojenie prerušené"; - Text[ da ] = "Det var ikke muligt at oprette forbindelsen"; - Text[ sv ] = "Uppkoppling avbruten"; - Text[ pl ] = "Połączenie nie powiodło się"; - Text[ pt-BR ] = "Não foi possível estabelecer a conexão"; - Text[ th ] = "การเชื่อมต่อล้มเหลว"; - Text[ ja ] = "接続できませんでした。"; - Text[ ko ] = "연결 실패"; - Text[ zh-CN ] = "连接失败"; - Text[ zh-TW ] = "連線失敗"; - Text[ tr ] = "Bağlantı hatası"; - Text[ hi-IN ] = "कनेक्शन असफल हुआ"; - Text[ ar ] = "عملية الاتصال فشلت"; - Text[ he ] = "Verbindungsaufbau gescheitert"; -}; - -String RID_ERR_LOADING_FORM -{ - Text [ de ] = "Die Dateninhalte konnten nicht geladen werden."; - Text [ en-US ] = "The data content could not be loaded."; - Text[ pt ] = "Foi impossível carregar o conteúdo dos dados."; - Text[ ru ] = "Невозможно загрузить данные."; - Text[ el ] = "Δεν ήταν δυνατόν να γίνει φόρτωση των περιεχομένων των δεδομένων."; - Text[ nl ] = "De gegevens kunnen niet worden geladen."; - Text[ fr ] = "Impossible de charger le contenu des données."; - Text[ es ] = "No se pudieron cargar los contenidos de los datos."; - Text[ fi ] = "Tietosisällön lataaminen ei onnistunut."; - Text[ ca ] = "No s'ha pogut carregar el contingut de les dades."; - Text[ it ] = "Non è stato possibile caricare i contenuti."; - Text[ sk ] = "Obsah dát nemohol byť načítaný."; - Text[ da ] = "Det var ikke muligt at indlæse dataindholdet."; - Text[ sv ] = "Datainnehållet kunde inte laddas."; - Text[ pl ] = "Nie można załadować danych."; - Text[ pt-BR ] = "Não foi possível carregar o conteúdo dos dados."; - Text[ th ] = "ไม่สามารถโหลดเนื้อหาข้อมูลได้"; - Text[ ja ] = "データ内容が読み込めませんでした。"; - Text[ ko ] = "데이터 내용을 로드하지 못했습니다."; - Text[ zh-CN ] = "无法装入数据内容。"; - Text[ zh-TW ] = "無法載入資料內容。"; - Text[ tr ] = "Veri yüklenemedi"; - Text[ hi-IN ] = "डॉटा विषय को लोड़ नहीं कर सकते है ।"; - Text[ ar ] = "تعذر تحميل المحتويات البيانية."; - Text[ he ] = "Die Dateninhalte konnten nicht geladen werden."; -}; - -String RID_ERR_REFRESHING_FORM -{ - Text [ de ] = "Die Dateninhalte konnten nicht aktualisiert werden."; - Text [ en-US ] = "The data content could not be updated"; - Text [ x-comment ] = "; The meaning here is 'refresh', not 'update'."; - Text[ pt ] = "Foi impossível actualizar o conteúdo dos dados."; - Text[ ru ] = "Невозможно обновить содержимое данных."; - Text[ el ] = "Δεν ήταν δυνατόν να γίνει ενημέρωση των περιεχομένων των δεδομένων."; - Text[ nl ] = "De gegevens kunnen niet worden bijgewerkt."; - Text[ fr ] = "Impossible d'actualiser le contenu des données."; - Text[ es ] = "No se pudieron actualizar los contenidos de los datos."; - Text[ fi ] = "Tietosisällön päivittäminen ei onnistunut."; - Text[ ca ] = "No s'ha pogut actualitzar el contingut de les dades"; - Text[ it ] = "Non è stato possibile aggiornare i contenuti."; - Text[ sk ] = "Obsah dát nemohol byť aktualizovaný"; - Text[ da ] = "Det var ikke muligt at opdatere dataindholdet."; - Text[ sv ] = "Datainnehållet kunde inte uppdateras."; - Text[ pl ] = "Nie można zaktualizować danych."; - Text[ pt-BR ] = "Não foi possível atualizar o conteúdo dos dados."; - Text[ th ] = "ไม่สามารถปรับปรุงเนื้อหาข้อมูลได้"; - Text[ ja ] = "データ内容が更新できませんでした。"; - Text[ ko ] = "데이터 내용을 업데이트하지 못했습니다."; - Text[ zh-CN ] = "无法更新数据内容。"; - Text[ zh-TW ] = "無法更新資料內容。"; - Text[ tr ] = "Veri içeriği güncellenemedi."; - Text[ hi-IN ] = "डॉटा विषय को अपडेट् नहीं कर सकते है ।"; - Text[ ar ] = "تعذر تحديث المحتويات البيانية."; - Text[ he ] = "Die Dateninhalte konnten nicht aktualisiert werden."; -}; - -String RID_STR_ERR_INSERTRECORD -{ - Text [ de ] = "Fehler beim Einfügen des neuen Datensatzs"; - Text [ en-US ] = "Error inserting the new record"; - Text[ pt ] = "Erro ao inserir o novo registo de dados"; - Text[ ru ] = "Ошибка вставки новой записи"; - Text[ el ] = "Σφάλμα κατά την εισαγωγή της νέας εγγραφής"; - Text[ nl ] = "Fout bij invoegen van nieuwe record"; - Text[ fr ] = "Erreur lors de l'insertion du nouvel enregistrement"; - Text[ es ] = "Error al insertar un nuevo registro de datos."; - Text[ fi ] = "Virhe lisättäessä uutta tietuetta."; - Text[ ca ] = "S'ha produït un error en inserir el nou registre"; - Text[ it ] = "Errore nell'inserire il nuovo record di dati."; - Text[ sk ] = "Chyba pri vkladaní nového záznamu"; - Text[ da ] = "Fejl ved indsættelse af den nye datapost"; - Text[ sv ] = "Fel vid infogning av den nya dataposten"; - Text[ pl ] = "Błąd wstawiania nowego rekordu"; - Text[ pt-BR ] = "Ocorreu um erro ao inserir o novo registro"; - Text[ th ] = "แทรกระเบียนใหม่ผิดพลาด"; - Text[ ja ] = "新しいレコードを挿入する時のエラー"; - Text[ ko ] = "새 레코드 삽입시 오류"; - Text[ zh-CN ] = "在插入新数据条目时发生错误"; - Text[ zh-TW ] = "在插入新資料條目時發生錯誤"; - Text[ tr ] = "Yeni veri kümesi girerken hata oluştu."; - Text[ hi-IN ] = "नया अभिलेख को जोड़ने के समय गलती"; - Text[ ar ] = "حدث خطأ أثناء إدراج السجل الجديد"; - Text[ he ] = "Fehler beim Einfügen des neuen Datensatzs"; -}; - -String RID_STR_ERR_UPDATERECORD -{ - Text [ de ] = "Fehler beim Schreiben des aktuellen Datensatzes"; - Text [ en-US ] = "Error updating the current record"; - Text[ pt ] = "Erro ao escrever o registo de dados activo"; - Text[ ru ] = "Ошибка обновления текущей записи"; - Text[ el ] = "Σφάλμα κατά την εγγραφή της τρέχουσας εγγραφής"; - Text[ nl ] = "Fout bij schrijven van huidige record"; - Text[ fr ] = "Erreur lors de l'écriture de l'enregistrement actif"; - Text[ es ] = "Error al escribir el registro actual de datos."; - Text[ fi ] = "Virhe päivitettäessä nykyistä tietuetta."; - Text[ ca ] = "S'ha produït un error en actualitzar el registre actual"; - Text[ it ] = "Errore nello scrivere il record di dati attivo"; - Text[ sk ] = "Chyba pri aktualizácii aktuálneho záznamu"; - Text[ da ] = "Fejl ved skrivning af den aktuelle datapost"; - Text[ sv ] = "Fel vid skrivning av den aktuella dataposten"; - Text[ pl ] = "Błąd aktualizacji bieżącego rekordu"; - Text[ pt-BR ] = "Ocorreu um erro ao atualizar o registro atual"; - Text[ th ] = "ปรับปรุงระเบียนปัจจุบันผิดพลาด"; - Text[ ja ] = "現在のレコードを書き込む時のエラー"; - Text[ ko ] = "현재의 데이터 레코드에서 오류"; - Text[ zh-CN ] = "在更新当前数据条目时发生错误"; - Text[ zh-TW ] = "在寫入資料條目時發生錯誤"; - Text[ tr ] = "Yürürlükteki veri kümesi güncellenirken hata oluştu"; - Text[ hi-IN ] = "वर्तमान अभिलेख को अपडेट् करने के समय गलती"; - Text[ ar ] = "حدث خطأ أثناء كتابة السجل الحالي"; - Text[ he ] = "Fehler beim Schreiben des aktuellen Datensatzes"; -}; - -String RID_STR_ERR_DELETERECORD -{ - Text [ de ] = "Fehler beim Löschen des aktuellen Datensatzes"; - Text [ en-US ] = "Error deleting the current record"; - Text[ pt ] = "Erro ao eliminar o registo de dados activo"; - Text[ ru ] = "Ошибка удаления текущей записи"; - Text[ el ] = "Σφάλμα κατά την διαγραφή της τρέχουσας εγγραφής"; - Text[ nl ] = "Fout bij wissen van huidige record"; - Text[ fr ] = "Erreur lors de la suppression de l'enregistrement actif"; - Text[ es ] = "Error al borrar el registro actual."; - Text[ fi ] = "Virhe poistettaessa nykyistä tietuetta."; - Text[ ca ] = "S'ha produït un error en suprimir el registre actual"; - Text[ it ] = "Errore nel cancellare il record di dati attivo"; - Text[ sk ] = "Chyba pri odstraňovaní aktuálneho záznamu"; - Text[ da ] = "Fejl ved sletning af den aktuelle datapost"; - Text[ sv ] = "Fel vid radering av den aktuella dataposten"; - Text[ pl ] = "Błąd usuwania bieżącego rekordu"; - Text[ pt-BR ] = "Ocorreu um erro ao excluir o registro atual"; - Text[ th ] = "ลบระเบียนปัจจุบันผิดพลาด"; - Text[ ja ] = "現在のレコードを削除する時のエラー"; - Text[ ko ] = "현재 레코드 삭제시에 오류"; - Text[ zh-CN ] = "在删除当前数据条目时发生错误"; - Text[ zh-TW ] = "在刪除資料條目時發生錯誤"; - Text[ tr ] = "Yürürlükteki veri kümesi silinirken hata oluştu."; - Text[ hi-IN ] = "वर्तमान अभिलेख को मिटाने के समय गलती"; - Text[ ar ] = "حدث خطأ أثناء حذف السجل الحالي"; - Text[ he ] = "Fehler beim Löschen des aktuellen Datensatzes"; -}; - -String RID_STR_ERR_DELETERECORDS -{ - Text [ de ] = "Fehler beim Löschen der angegebenen Datensätze"; - Text [ en-US ] = "Error deleting the specified records"; - Text[ pt ] = "Erro ao eliminar os registos de dados indicados."; - Text[ ru ] = "Ошибка удаления указанной записи"; - Text[ el ] = "Σφάλμα κατά την διαγραφή των επιλεγμένων εγγραφών"; - Text[ nl ] = "Fout bij wissen van opgegeven records"; - Text[ fr ] = "Erreur lors de la suppression des enregistrements spécifiés"; - Text[ es ] = "Error al borrar los registros indicados."; - Text[ fi ] = "Virhe poistettaessa määritettyjä tietueita."; - Text[ ca ] = "S'ha produït un error en suprimir els registres indicats"; - Text[ it ] = "Errore nel cancellare i record di dati specificati."; - Text[ sk ] = "Chyba pri odstraňovaní uvedených záznamov"; - Text[ da ] = "Fejl ved sletning af de angivne dataposter"; - Text[ sv ] = "Fel vid radering av de angivna dataposterna"; - Text[ pl ] = "Błąd usuwania określonych rekordów"; - Text[ pt-BR ] = "Ocorreu um erro ao excluir os registros especificados"; - Text[ th ] = "ลบระเบียนที่ระบุผิดพลาด"; - Text[ ja ] = "指定したレコードを削除する時のエラー"; - Text[ ko ] = "지정된 레코드 삭제 중 오류"; - Text[ zh-CN ] = "在删除指定的数据条目时发生错误"; - Text[ zh-TW ] = "在刪除指定資料條目時發生錯誤"; - Text[ tr ] = "Belirtilmiş veri kümesi silinirken hata oluştu."; - Text[ hi-IN ] = "निर्दिष्ट की हुयी अभिलेखों को मिटाने के समय गलती"; - Text[ ar ] = "حدث خطأ أثناء حذف السجلات المدرجة"; - Text[ he ] = "Fehler beim Löschen der angegebenen Datensätze"; -}; - -String RID_STR_NEED_NON_NULL_OBJECT -{ - Text [ de ] = "Das Objekt darf nicht NULL sein."; - Text [ en-US ] = "The object cannot be NULL."; - Text[ pt ] = "O objecto não pode ser NULL."; - Text[ ru ] = "Объект не может быть NULL."; - Text[ el ] = "Το αντικείμενο δεν μπορεί να είναι ΚΕΝΟ."; - Text[ nl ] = "Het object mag niet NUL zijn."; - Text[ fr ] = "L'objet ne pas être NULL."; - Text[ es ] = "El objeto no puede ser NULL."; - Text[ fi ] = "Objekti ei voi olla NULL."; - Text[ ca ] = "L'objecte no pot ser NULL."; - Text[ it ] = "L'oggetto non deve essere NULL."; - Text[ sk ] = "Objekt nemôže byť NULL."; - Text[ da ] = "Objektet må ikke være NUL."; - Text[ sv ] = "Objektet får inte vara NULL."; - Text[ pl ] = "Obiekt nie może mieć wartości NULL."; - Text[ pt-BR ] = "O objeto não pode ser NULL."; - Text[ th ] = "วัตถุไม่สามารถเป็น NULL ได้"; - Text[ ja ] = "オブジェクトが NULL ではいけません。"; - Text[ ko ] = "개체가 NULL이면 안됩니다."; - Text[ zh-CN ] = "这个对象不可以是 NULL 。"; - Text[ zh-TW ] = "這個物件不可以是 NULL 。"; - Text[ tr ] = "Nesne NULL olamaz."; - Text[ hi-IN ] = "वस्तु NULL नहीं हो सकता है ।"; - Text[ ar ] = "The object must not be NULL."; - Text[ he ] = "Das Objekt darf nicht NULL sein."; -}; - -String RID_STR_OPEN_GRAPHICS -{ - Text [ de ] = "Grafik einfügen aus..."; - Text [ en-US ] = "Insert graphics from..."; - Text[ pt ] = "Inserir imagem de..."; - Text[ ru ] = "Вставить графические объекты из..."; - Text[ el ] = "Εισαγωγή γραφικών από..."; - Text[ nl ] = "Afbeelding invoegen uit..."; - Text[ fr ] = "Insérer une image à partir de..."; - Text[ es ] = "Insertar una imagen de..."; - Text[ fi ] = "Lisää grafiikka kohteesta..."; - Text[ ca ] = "Inserta un gràfic des de..."; - Text[ it ] = "Inserisci l'immagine da..."; - Text[ sk ] = "Vložiť obrázok z..."; - Text[ da ] = "Indsæt grafik fra..."; - Text[ sv ] = "Infoga grafik från..."; - Text[ pl ] = "Wstaw grafikę z..."; - Text[ pt-BR ] = "Inserir figuras de..."; - Text[ th ] = "แทรกกราฟฟิคจาก..."; - Text[ ja ] = "図の挿入に開く..."; - Text[ ko ] = "삽입할 그림... "; - Text[ zh-CN ] = "插入图形从..."; - Text[ zh-TW ] = "插入圖形從..."; - Text[ tr ] = "'dan grafik ekle..."; - Text[ hi-IN ] = "से सुचित्रों को जोड़ो..."; - Text[ ar ] = "Insert graphics from..."; - Text[ he ] = "Grafik einfügen aus..."; -}; - -String RID_STR_CLEAR_GRAPHICS -{ - Text [ de ] = "Grafik entfernen"; - Text [ en-US ] = "Remove graphics"; - Text[ pt ] = "Remover imagem"; - Text[ ru ] = "Удалить графические объекты"; - Text[ el ] = "Κατάργηση γραφικών"; - Text[ nl ] = "Afbeelding verwijderen"; - Text[ fr ] = "Supprimer l'image"; - Text[ es ] = "Borrar la imagen"; - Text[ fi ] = "Poista grafiikka"; - Text[ ca ] = "Elimina els gràfics"; - Text[ it ] = "Elimina l'immagine"; - Text[ sk ] = "Odstrániť obrázok"; - Text[ da ] = "Fjern grafik"; - Text[ sv ] = "Ta bort grafik"; - Text[ pl ] = "Usuń grafikę"; - Text[ pt-BR ] = "Remover figuras"; - Text[ th ] = "เอากราฟฟิคออก"; - Text[ ja ] = "図の削除"; - Text[ ko ] = "그림 제거"; - Text[ zh-CN ] = "删除图形"; - Text[ zh-TW ] = "刪除圖形"; - Text[ tr ] = "Grafik kaldır"; - Text[ hi-IN ] = "सुचित्रों को हटाओ"; - Text[ ar ] = "Remove graphics"; - Text[ he ] = "Grafik entfernen"; -}; - - -String RID_STR_INVALIDSTREAM -{ - Text = "Die bergebene Stream-Komponente ist ungltig."; -}; - -String RID_STR_SYNTAXERROR -{ - Text [ de ] = "Fehler bei der Analyse des Anfrageausdrucks" ; - Text [ en-US ] = "Syntax error in query expression" ; - Text[ pt ] = "Erro ao analisar a expressão de consulta."; - Text[ ru ] = "Ошибка синтаксиса в выражении запроса"; - Text[ el ] = "Σφάλμα κατά την ανάλυση του ορίσματος του ερωτήματος"; - Text[ nl ] = "Fout bij de analyse van query-afdruk"; - Text[ fr ] = "Erreur dans l'analyse de l'expression de la requête"; - Text[ es ] = "Ha ocurrido un error al analizar la expresión de la consulta"; - Text[ fi ] = "Syntaksivirhe kyselylausekkeessa"; - Text[ ca ] = "S'ha produït un error en analitzar l'expressió de consulta"; - Text[ it ] = "Errore nell'analizzare dell'espressione di ricerca"; - Text[ sk ] = "Chyba syntaxu v dotaze"; - Text[ da ] = "Fejl under analysen af forespørgseludtrykket"; - Text[ sv ] = "Fel vid analys av frågeuttryck"; - Text[ pl ] = "Błąd przy ocenie wydruku kwerendy"; - Text[ pt-BR ] = "Ocorreu um erro ao analisar a expressão da consulta"; - Text[ th ] = "ไวยกรณ์ในคำอธิบายแบบสอบถามผิดพลาด"; - Text[ ja ] = "クエリー言語分析中でのエラー"; - Text[ ko ] = "쿼리식을 분석하는 중 오류"; - Text[ zh-CN ] = "查询语句出现语法错误。"; - Text[ zh-TW ] = "在分解查詢語句時發生一個錯誤。"; - Text[ tr ] = "Sorgu ifadesinde sözdizim hatası"; - Text[ hi-IN ] = "जानकारी की वर्णन में सिन्टाक्स की गलती"; - Text[ ar ] = "حدث خطأ أثناء تحليل عبارة الاستفسار"; - Text[ he ] = "שגיאת תחביר בביטוי שאילתה"; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/binfilter/bf_forms/source/resource/makefile.mk b/binfilter/bf_forms/source/resource/makefile.mk deleted file mode 100644 index 401be541be41..000000000000 --- a/binfilter/bf_forms/source/resource/makefile.mk +++ /dev/null @@ -1,54 +0,0 @@ -#************************************************************************* -# -# 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. -# -#************************************************************************* - -EXTERNAL_WARNINGS_NOT_ERRORS := TRUE - -PRJ=..$/..$/.. -BFPRJ=..$/.. - -PRJNAME=binfilter -TARGET=forms_resource - -#GEN_HID=TRUE -#GEN_HID_OTHER=TRUE -NO_HIDS=TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk -INC+= -I$(PRJ)$/inc$/bf_forms -# --- Files -------------------------------------------------------- - -SRS1NAME=forms_resource -SRC1FILES= \ - forms_strings.src \ - -SLOFILES= $(SLO)$/forms_frm_resource.obj \ - -# --- Targets ---------------------------------- - -.INCLUDE : target.mk |