From bf4154eb5307ec8c35f000fd1df39ef3abb2eb6d Mon Sep 17 00:00:00 2001
From: Jens-Heiner Rechtien
Date: Mon, 18 Sep 2000 15:33:13 +0000
Subject: [PATCH] initial import
---
forms/prj/d.lst | 6 +
forms/source/component/BaseListBox.hxx | 77 +
forms/source/component/Button.cxx | 382 ++
forms/source/component/Button.hxx | 171 +
forms/source/component/CheckBox.cxx | 435 ++
forms/source/component/CheckBox.hxx | 159 +
forms/source/component/Columns.cxx | 676 +++
forms/source/component/Columns.hxx | 268 ++
forms/source/component/ComboBox.cxx | 908 ++++
forms/source/component/ComboBox.hxx | 199 +
forms/source/component/Currency.cxx | 295 ++
forms/source/component/Currency.hxx | 138 +
forms/source/component/DatabaseForm.cxx | 3904 +++++++++++++++++
forms/source/component/DatabaseForm.hxx | 554 +++
forms/source/component/Date.cxx | 303 ++
forms/source/component/Date.hxx | 142 +
forms/source/component/Edit.cxx | 643 +++
forms/source/component/Edit.hxx | 199 +
forms/source/component/EditBase.cxx | 429 ++
forms/source/component/EditBase.hxx | 158 +
forms/source/component/EventThread.cxx | 225 +
forms/source/component/EventThread.hxx | 165 +
forms/source/component/File.cxx | 329 ++
forms/source/component/File.hxx | 138 +
forms/source/component/FixedText.cxx | 174 +
forms/source/component/FixedText.hxx | 117 +
forms/source/component/FormComponent.cxx | 1458 ++++++
forms/source/component/FormattedField.cxx | 1186 +++++
forms/source/component/FormattedField.hxx | 212 +
.../component/FormattedFieldWrapper.cxx | 350 ++
.../component/FormattedFieldWrapper.hxx | 120 +
forms/source/component/FormsCollection.cxx | 207 +
forms/source/component/FormsCollection.hxx | 138 +
forms/source/component/Grid.cxx | 1302 ++++++
forms/source/component/Grid.hxx | 228 +
forms/source/component/GroupBox.cxx | 211 +
forms/source/component/GroupBox.hxx | 125 +
forms/source/component/GroupManager.cxx | 532 +++
forms/source/component/GroupManager.hxx | 264 ++
forms/source/component/Hidden.cxx | 216 +
forms/source/component/Hidden.hxx | 121 +
forms/source/component/ImageButton.cxx | 316 ++
forms/source/component/ImageButton.hxx | 147 +
forms/source/component/ImageControl.cxx | 673 +++
forms/source/component/ImageControl.hxx | 201 +
forms/source/component/ListBox.cxx | 1330 ++++++
forms/source/component/ListBox.hxx | 254 ++
forms/source/component/Numeric.cxx | 256 ++
forms/source/component/Numeric.hxx | 138 +
forms/source/component/Pattern.cxx | 251 ++
forms/source/component/Pattern.hxx | 139 +
forms/source/component/RadioButton.cxx | 510 +++
forms/source/component/RadioButton.hxx | 162 +
forms/source/component/Time.cxx | 310 ++
forms/source/component/Time.hxx | 142 +
forms/source/component/makefile.mk | 145 +
forms/source/inc/InterfaceContainer.hxx | 305 ++
forms/source/inc/frm_resource.hrc | 92 +
forms/source/inc/frm_resource.hxx | 113 +
forms/source/inc/ids.hxx | 72 +
forms/source/inc/property.hrc | 422 ++
forms/source/inc/property.hxx | 261 ++
forms/source/inc/services.hxx | 234 +
forms/source/misc/InterfaceContainer.cxx | 896 ++++
forms/source/misc/ids.cxx | 67 +
forms/source/misc/makefile.mk | 90 +
forms/source/misc/property.cxx | 468 ++
forms/source/misc/services.cxx | 580 +++
forms/source/resource/frm_resource.cxx | 131 +
forms/source/resource/makefile.mk | 84 +
forms/source/resource/strings.src | 356 ++
forms/util/frm.dxp | 3 +
forms/util/frm.xml | 165 +
forms/util/makefile.mk | 183 +
74 files changed, 27360 insertions(+)
create mode 100644 forms/prj/d.lst
create mode 100644 forms/source/component/BaseListBox.hxx
create mode 100644 forms/source/component/Button.cxx
create mode 100644 forms/source/component/Button.hxx
create mode 100644 forms/source/component/CheckBox.cxx
create mode 100644 forms/source/component/CheckBox.hxx
create mode 100644 forms/source/component/Columns.cxx
create mode 100644 forms/source/component/Columns.hxx
create mode 100644 forms/source/component/ComboBox.cxx
create mode 100644 forms/source/component/ComboBox.hxx
create mode 100644 forms/source/component/Currency.cxx
create mode 100644 forms/source/component/Currency.hxx
create mode 100644 forms/source/component/DatabaseForm.cxx
create mode 100644 forms/source/component/DatabaseForm.hxx
create mode 100644 forms/source/component/Date.cxx
create mode 100644 forms/source/component/Date.hxx
create mode 100644 forms/source/component/Edit.cxx
create mode 100644 forms/source/component/Edit.hxx
create mode 100644 forms/source/component/EditBase.cxx
create mode 100644 forms/source/component/EditBase.hxx
create mode 100644 forms/source/component/EventThread.cxx
create mode 100644 forms/source/component/EventThread.hxx
create mode 100644 forms/source/component/File.cxx
create mode 100644 forms/source/component/File.hxx
create mode 100644 forms/source/component/FixedText.cxx
create mode 100644 forms/source/component/FixedText.hxx
create mode 100644 forms/source/component/FormComponent.cxx
create mode 100644 forms/source/component/FormattedField.cxx
create mode 100644 forms/source/component/FormattedField.hxx
create mode 100644 forms/source/component/FormattedFieldWrapper.cxx
create mode 100644 forms/source/component/FormattedFieldWrapper.hxx
create mode 100644 forms/source/component/FormsCollection.cxx
create mode 100644 forms/source/component/FormsCollection.hxx
create mode 100644 forms/source/component/Grid.cxx
create mode 100644 forms/source/component/Grid.hxx
create mode 100644 forms/source/component/GroupBox.cxx
create mode 100644 forms/source/component/GroupBox.hxx
create mode 100644 forms/source/component/GroupManager.cxx
create mode 100644 forms/source/component/GroupManager.hxx
create mode 100644 forms/source/component/Hidden.cxx
create mode 100644 forms/source/component/Hidden.hxx
create mode 100644 forms/source/component/ImageButton.cxx
create mode 100644 forms/source/component/ImageButton.hxx
create mode 100644 forms/source/component/ImageControl.cxx
create mode 100644 forms/source/component/ImageControl.hxx
create mode 100644 forms/source/component/ListBox.cxx
create mode 100644 forms/source/component/ListBox.hxx
create mode 100644 forms/source/component/Numeric.cxx
create mode 100644 forms/source/component/Numeric.hxx
create mode 100644 forms/source/component/Pattern.cxx
create mode 100644 forms/source/component/Pattern.hxx
create mode 100644 forms/source/component/RadioButton.cxx
create mode 100644 forms/source/component/RadioButton.hxx
create mode 100644 forms/source/component/Time.cxx
create mode 100644 forms/source/component/Time.hxx
create mode 100644 forms/source/component/makefile.mk
create mode 100644 forms/source/inc/InterfaceContainer.hxx
create mode 100644 forms/source/inc/frm_resource.hrc
create mode 100644 forms/source/inc/frm_resource.hxx
create mode 100644 forms/source/inc/ids.hxx
create mode 100644 forms/source/inc/property.hrc
create mode 100644 forms/source/inc/property.hxx
create mode 100644 forms/source/inc/services.hxx
create mode 100644 forms/source/misc/InterfaceContainer.cxx
create mode 100644 forms/source/misc/ids.cxx
create mode 100644 forms/source/misc/makefile.mk
create mode 100644 forms/source/misc/property.cxx
create mode 100644 forms/source/misc/services.cxx
create mode 100644 forms/source/resource/frm_resource.cxx
create mode 100644 forms/source/resource/makefile.mk
create mode 100644 forms/source/resource/strings.src
create mode 100644 forms/util/frm.dxp
create mode 100644 forms/util/frm.xml
create mode 100644 forms/util/makefile.mk
diff --git a/forms/prj/d.lst b/forms/prj/d.lst
new file mode 100644
index 000000000000..b14fbbecc8bd
--- /dev/null
+++ b/forms/prj/d.lst
@@ -0,0 +1,6 @@
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\lib\*.so %_DEST%\lib%_EXT%\*.so
+..\%__SRC%\lib\*.sl %_DEST%\lib%_EXT%\*.sl
+..\%__SRC%\bin\*.bin %_DEST%\bin%_EXT%\*.bin
+..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
+..\util\*.xml %_DEST%\xml%_EXT%\*.xml
diff --git a/forms/source/component/BaseListBox.hxx b/forms/source/component/BaseListBox.hxx
new file mode 100644
index 000000000000..f3b43029b055
--- /dev/null
+++ b/forms/source/component/BaseListBox.hxx
@@ -0,0 +1,77 @@
+/*************************************************************************
+ *
+ * $RCSfile: BaseListBox.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_BASELISTBOX_HXX_
+#define _FORMS_BASELISTBOX_HXX_
+
+//.........................................................................
+namespace frm
+{
+
+const sal_uInt16 ENTRY_NOT_FOUND = 0xFFFF;
+const sal_uInt16 BOUNDCOLUMN = 0x0001;
+
+//.........................................................................
+}
+//.........................................................................
+
+#endif // _FORMS_BASELISTBOX_HXX_
+
diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx
new file mode 100644
index 000000000000..d8facdb67c32
--- /dev/null
+++ b/forms/source/component/Button.cxx
@@ -0,0 +1,382 @@
+/*************************************************************************
+ *
+ * $RCSfile: Button.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FRM_BUTTON_HXX_
+#include "Button.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+#ifndef _URLOBJ_HXX
+#include
+#endif
+#ifndef _SV_SVAPP_HXX
+#include
+#endif
+
+//.........................................................................
+namespace frm
+{
+//.........................................................................
+
+//==================================================================
+//= OButtonModel
+//==================================================================
+DBG_NAME(OButtonModel)
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OButtonModel_CreateInstance(const staruno::Reference& _rxFactory)
+{
+ return *(new OButtonModel(_rxFactory));
+}
+
+//------------------------------------------------------------------
+OButtonModel::OButtonModel(const staruno::Reference& _rxFactory)
+ :OImageModel(_rxFactory, VCL_CONTROLMODEL_COMMANDBUTTON, FRM_CONTROL_COMMANDBUTTON)
+ // use the old control name for compytibility reasons
+{
+ DBG_CTOR(OButtonModel, NULL);
+ m_nClassId = starform::FormComponentType::COMMANDBUTTON;
+}
+
+//------------------------------------------------------------------------------
+OButtonModel::~OButtonModel()
+{
+ DBG_DTOR(OButtonModel, NULL);
+}
+
+//------------------------------------------------------------------------------
+staruno::Reference SAL_CALL OButtonModel::getPropertySetInfo() throw( staruno::RuntimeException )
+{
+ staruno::Reference xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//------------------------------------------------------------------------------
+void OButtonModel::fillProperties(
+ staruno::Sequence< starbeans::Property >& _rProps,
+ staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
+{
+ FRM_BEGIN_PROP_HELPER(8)
+ DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
+ DECL_PROP1(BUTTONTYPE, starform::FormButtonType, 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);
+ DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
+ FRM_END_PROP_HELPER();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& OButtonModel::getInfoHelper()
+{
+ return *const_cast(this)->getArrayHelper();
+}
+
+// starlang::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()
+{
+ return FRM_COMPONENT_COMMANDBUTTON; // old (non-sun) name for compatibility !
+}
+
+//------------------------------------------------------------------------------
+void OButtonModel::write(const staruno::Reference& _rxOutStream)
+{
+ OImageModel::write(_rxOutStream);
+
+ _rxOutStream->writeShort(0x0002); // Version
+ _rxOutStream->writeShort( (sal_uInt16)m_eButtonType );
+
+ ::rtl::OUString sTmp = INetURLObject::decode(INetURLObject::AbsToRel( m_sTargetURL ), '%', INetURLObject::DECODE_UNAMBIGUOUS);
+ _rxOutStream << sTmp;
+ _rxOutStream << m_sTargetFrame;
+ _rxOutStream << m_aHelpText;
+}
+
+//------------------------------------------------------------------------------
+void OButtonModel::read(const staruno::Reference& _rxInStream)
+{
+ OImageModel::read(_rxInStream);
+
+ sal_uInt16 nVersion = _rxInStream->readShort(); // Version
+ switch (nVersion)
+ {
+ case 0x0001:
+ {
+ m_eButtonType = (starform::FormButtonType)_rxInStream->readShort();
+
+ ::rtl::OUString sTmp;
+ _rxInStream >> sTmp;
+ m_sTargetURL = INetURLObject::RelToAbs( sTmp );
+ _rxInStream >> m_sTargetFrame;
+ }
+ break;
+ case 0x0002:
+ {
+ m_eButtonType = (starform::FormButtonType)_rxInStream->readShort();
+
+ ::rtl::OUString sTmp;
+ _rxInStream >> sTmp;
+ m_sTargetURL = INetURLObject::RelToAbs( sTmp );
+ _rxInStream >> m_sTargetFrame;
+ _rxInStream >> m_aHelpText;
+ }
+ break;
+ default :
+ DBG_ERROR("OButtonModel::read : unknown version !");
+ m_eButtonType = starform::FormButtonType_PUSH;
+ m_sTargetURL = ::rtl::OUString();
+ m_sTargetFrame = ::rtl::OUString();
+ break;
+ }
+}
+
+//==================================================================
+// OButtonControl
+//==================================================================
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OButtonControl_CreateInstance(const staruno::Reference& _rxFactory)
+{
+ return *(new OButtonControl(_rxFactory));
+}
+
+//------------------------------------------------------------------------------
+staruno::Sequence OButtonControl::_getTypes()
+{
+ static staruno::Sequence aTypes;
+ if (!aTypes.getLength())
+ {
+ // my base class
+ staruno::Sequence aBaseClassTypes = OImageControl::_getTypes();
+
+ staruno::Sequence aOwnTypes(2);
+ staruno::Type* pOwnTypes = aOwnTypes.getArray();
+ pOwnTypes[0] = getCppuType((staruno::Reference*)NULL);
+ pOwnTypes[1] = getCppuType((staruno::Reference*)NULL);
+
+ aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
+ }
+ return aTypes;
+}
+
+//------------------------------------------------------------------------------
+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 staruno::Reference& _rxFactory)
+ :OImageControl(_rxFactory, VCL_CONTROL_COMMANDBUTTON)
+ ,nClickEvent(0)
+{
+ increment(m_refCount);
+ {
+ // als ActionListener anmelden
+ staruno::Reference 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
+//------------------------------------------------------------------------------
+staruno::Any SAL_CALL OButtonControl::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
+{
+ staruno::Any aReturn;
+
+ aReturn = OImageControl::queryAggregation(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType
+ ,static_cast(this)
+ ,static_cast(this)
+ );
+
+ return aReturn;
+}
+
+// ActionListener
+//------------------------------------------------------------------------------
+void OButtonControl::actionPerformed(const starawt::ActionEvent& rEvent)
+{
+ // 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
+ staruno::Reference xSet(getModel(), staruno::UNO_QUERY);
+ if (!xSet.is())
+ return 0L;
+
+ if (starform::FormButtonType_PUSH == *(starform::FormButtonType*)xSet->getPropertyValue(PROPERTY_BUTTONTYPE).getValue())
+ {
+ // notify the action listeners for a push button
+ ::cppu::OInterfaceIteratorHelper aIter(m_aActionListeners);
+ starawt::ActionEvent aEvt(static_cast(this), m_aActionCommand);
+ while(aIter.hasMoreElements() )
+ {
+ ((starawt::XActionListener*)aIter.next())->actionPerformed(aEvt);
+ }
+ }
+ else
+ actionPerformed_Impl( sal_False );
+ }
+ return 0L;
+}
+
+// starawt::XButton
+//------------------------------------------------------------------------------
+void OButtonControl::setLabel(const ::rtl::OUString& Label) throw( staruno::RuntimeException )
+{
+ staruno::Reference xButton;
+ query_aggregation( m_xAggregate, xButton);
+ if (xButton.is())
+ xButton->setLabel(Label);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OButtonControl::setActionCommand(const ::rtl::OUString& _rCommand) throw( staruno::RuntimeException )
+{
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
+ m_aActionCommand = _rCommand;
+ }
+
+ staruno::Reference xButton;
+ query_aggregation( m_xAggregate, xButton);
+ if (xButton.is())
+ xButton->setActionCommand(_rCommand);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OButtonControl::addActionListener(const staruno::Reference& _rxListener) throw( staruno::RuntimeException )
+{
+ m_aActionListeners.addInterface(_rxListener);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OButtonControl::removeActionListener(const staruno::Reference& _rxListener) throw( staruno::RuntimeException )
+{
+ m_aActionListeners.removeInterface(_rxListener);
+}
+
+//.........................................................................
+} // namespace frm
+//.........................................................................
+
diff --git a/forms/source/component/Button.hxx b/forms/source/component/Button.hxx
new file mode 100644
index 000000000000..056d06bbd932
--- /dev/null
+++ b/forms/source/component/Button.hxx
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * $RCSfile: Button.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FRM_BUTTON_HXX_
+#define _FRM_BUTTON_HXX_
+
+#ifndef _FRM_IMAGE_HXX_
+#include "Image.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_MOUSEEVENT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_LANG_EVENTOBJECT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_AWT_ACTIONEVENT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
+#include
+#endif
+
+//.........................................................................
+namespace frm
+{
+//.........................................................................
+
+//==================================================================
+// OButtonModel
+//==================================================================
+class OButtonModel
+ :public OImageModel
+ ,public ::utl::OAggregationArrayUsageHelper
+{
+public:
+ OButtonModel(const staruno::Reference& _rxFactory);
+ ~OButtonModel();
+
+// starlang::XServiceInfo
+ IMPLEMENTATION_NAME(OButtonModel);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
+
+// staruno::Reference
+ virtual staruno::Reference SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+// stario::XPersistObject
+ virtual ::rtl::OUString SAL_CALL getServiceName();
+ virtual void SAL_CALL write(const staruno::Reference& _rxOutStream);
+ virtual void SAL_CALL read(const staruno::Reference& _rxInStream);
+
+ virtual void fillProperties(
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
+ ) const;
+ IMPLEMENT_INFO_SERVICE()
+};
+
+//==================================================================
+// OButtonControl
+//==================================================================
+class OButtonControl: public starawt::XButton,
+ public starawt::XActionListener,
+ public OImageControl
+{
+ sal_uInt32 nClickEvent;
+
+protected:
+
+ // UNO Anbindung
+ virtual staruno::Sequence _getTypes();
+
+public:
+ OButtonControl(const staruno::Reference& _rxFactory);
+ virtual ~OButtonControl();
+
+// starlang::XServiceInfo
+ IMPLEMENTATION_NAME(OButtonControl);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
+
+// UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OButtonControl, OImageControl);
+ virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
+
+// starawt::XActionListener
+ virtual void SAL_CALL actionPerformed(const starawt::ActionEvent& rEvent);
+
+// starawt::XButton
+ virtual void SAL_CALL addActionListener(const staruno::Reference& _rxListener) throw(staruno::RuntimeException);
+ virtual void SAL_CALL removeActionListener(const staruno::Reference& _rxListener) throw(staruno::RuntimeException);
+ virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(staruno::RuntimeException);
+ virtual void SAL_CALL setActionCommand(const ::rtl::OUString& _rCommand) throw(staruno::RuntimeException);
+
+// starlang::XEventListener
+ virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException)
+ { OControl::disposing(_rSource); }
+private:
+ DECL_LINK( OnClick, void* );
+};
+
+//.........................................................................
+} // namespace frm
+//.........................................................................
+
+#endif // _FRM_BUTTON_HXX_
+
diff --git a/forms/source/component/CheckBox.cxx b/forms/source/component/CheckBox.cxx
new file mode 100644
index 000000000000..b4ec521670de
--- /dev/null
+++ b/forms/source/component/CheckBox.cxx
@@ -0,0 +1,435 @@
+/*************************************************************************
+ *
+ * $RCSfile: CheckBox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_CHECKBOX_HXX_
+#include "CheckBox.hxx"
+#endif
+#ifndef _FRM_PROPERTY_HXX_
+#include "property.hxx"
+#endif
+#ifndef _FRM_PROPERTY_HRC_
+#include "property.hrc"
+#endif
+#ifndef _FRM_SERVICES_HXX_
+#include "services.hxx"
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+
+//.........................................................................
+namespace frm
+{
+
+//==================================================================
+//= OCheckBoxControl
+//==================================================================
+
+//------------------------------------------------------------------
+OCheckBoxControl::OCheckBoxControl(const staruno::Reference& _rxFactory)
+ :OBoundControl(_rxFactory, VCL_CONTROL_CHECKBOX)
+{
+}
+
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OCheckBoxControl_CreateInstance(const staruno::Reference& _rxFactory) throw (staruno::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 staruno::Reference& _rxFactory) throw (staruno::RuntimeException)
+{
+ return *(new OCheckBoxModel(_rxFactory));
+}
+
+//------------------------------------------------------------------
+OCheckBoxModel::OCheckBoxModel(const staruno::Reference& _rxFactory)
+ :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_CHECKBOX, FRM_CONTROL_CHECKBOX, sal_False)
+ // use the old control name for compytibility reasons
+ ,OPropertyChangeListener(m_aMutex)
+ ,m_bInReset(sal_False)
+{
+ m_nClassId = starform::FormComponentType::CHECKBOX;
+ m_nDefaultChecked = CB_NOCHECK;
+ m_sDataFieldConnectivityProperty = PROPERTY_STATE;
+
+ increment(m_refCount);
+ if (m_xAggregateSet.is())
+ {
+ OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet);
+ pMultiplexer->addProperty(PROPERTY_STATE);
+ }
+ decrement(m_refCount);
+}
+
+//------------------------------------------------------------------------------
+void OCheckBoxModel::_propertyChanged(const starbeans::PropertyChangeEvent& _rEvent) throw(staruno::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 (m_xField.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] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseCheckBox");
+ pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_CHECKBOX;
+ return aSupported;
+}
+
+//------------------------------------------------------------------------------
+void OCheckBoxModel::getFastPropertyValue(staruno::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 staruno::Any& _rValue) throw (com::sun::star::uno::Exception)
+{
+ switch (_nHandle)
+ {
+ case PROPERTY_ID_REFVALUE :
+ DBG_ASSERT(_rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING, "OCheckBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
+ _rValue >>= m_sReferenceValue;
+ break;
+
+ case PROPERTY_ID_DEFAULTCHECKED :
+ DBG_ASSERT(_rValue.getValueType().getTypeClass() == staruno::TypeClass_SHORT, "OCheckBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
+ _rValue >>= m_nDefaultChecked;
+ _reset();
+ break;
+
+ default:
+ OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OCheckBoxModel::convertFastPropertyValue(
+ staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, sal_Int32 _nHandle, const staruno::Any& _rValue)
+ throw (starlang::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;
+}
+
+//------------------------------------------------------------------------------
+staruno::Reference SAL_CALL OCheckBoxModel::getPropertySetInfo() throw(staruno::RuntimeException)
+{
+ staruno::Reference xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//------------------------------------------------------------------------------
+cppu::IPropertyArrayHelper& OCheckBoxModel::getInfoHelper()
+{
+ return *const_cast(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+void OCheckBoxModel::fillProperties(
+ staruno::Sequence< starbeans::Property >& _rProps,
+ staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
+{
+ FRM_BEGIN_PROP_HELPER(11)
+ // the "State" property is transient, so change this
+// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_STATE, starbeans::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_PROP1(HELPTEXT, rtl::OUString, BOUND);
+ DECL_IFACE_PROP2(BOUNDFIELD, starbeans::XPropertySet, READONLY, TRANSIENT);
+ DECL_IFACE_PROP2(CONTROLLABEL, starbeans::XPropertySet, BOUND, MAYBEVOID);
+ DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
+ FRM_END_PROP_HELPER();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OCheckBoxModel::getServiceName() throw(staruno::RuntimeException)
+{
+ return FRM_COMPONENT_CHECKBOX; // old (non-sun) name for compatibility !
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OCheckBoxModel::write(const staruno::Reference& _rxOutStream)
+ throw(stario::IOException, staruno::RuntimeException)
+{
+ OBoundControlModel::write(_rxOutStream);
+
+ // Version
+ _rxOutStream->writeShort(0x0003);
+ // Properties
+ _rxOutStream << m_sReferenceValue;
+ _rxOutStream << (sal_Int16)m_nDefaultChecked;
+ _rxOutStream << m_aHelpText;
+ // from version 0x0003 : common properties
+ writeCommonProperties(_rxOutStream);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OCheckBoxModel::read(const staruno::Reference& _rxInStream) throw(stario::IOException, staruno::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 >> (sal_Int16)m_nDefaultChecked;
+ _rxInStream >> m_aHelpText;
+ break;
+ case 0x0003 :
+ _rxInStream >> m_sReferenceValue;
+ _rxInStream >> (sal_Int16)m_nDefaultChecked;
+ _rxInStream >> m_aHelpText;
+ 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 starlang::EventObject& rEvent)
+{
+ OBoundControlModel::_loaded(rEvent);
+}
+
+//------------------------------------------------------------------------------
+void OCheckBoxModel::_onValueChanged()
+{
+ //////////////////////////////////////////////////////////////////
+ // Wert an ControlModel setzen
+ if (m_xAggregateSet.is())
+ {
+ staruno::Any aValue;
+ if (m_xColumn->getBoolean())
+ aValue <<= (sal_Int16)CB_CHECK;
+ else if (m_xColumn->wasNull())
+ {
+ sal_Bool bTriState;
+ m_xAggregateSet->getPropertyValue(PROPERTY_TRISTATE) >>= bTriState;
+ aValue <<= (sal_Int16)(bTriState ? CB_DONTKNOW : m_nDefaultChecked);
+ }
+ else
+ aValue <<= (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;
+ }
+}
+
+//------------------------------------------------------------------------------
+staruno::Any OCheckBoxModel::_getControlValue() const
+{
+ return m_xAggregateSet->getPropertyValue(PROPERTY_STATE);
+}
+
+//------------------------------------------------------------------------------
+void OCheckBoxModel::_reset( void )
+{
+ staruno::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(m_xField.is(), "OCheckBoxModel::_commit : committing while resetting, but not bound ?");
+ if (m_xField.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(...)
+ {
+ 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;
+}
+
+//.........................................................................
+}
+//.........................................................................
+
diff --git a/forms/source/component/CheckBox.hxx b/forms/source/component/CheckBox.hxx
new file mode 100644
index 000000000000..17c21aa4c83e
--- /dev/null
+++ b/forms/source/component/CheckBox.hxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * $RCSfile: CheckBox.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_CHECKBOX_HXX_
+#define _FORMS_CHECKBOX_HXX_
+
+#ifndef _FORMS_FORMCOMPONENT_HXX_
+#include "FormComponent.hxx"
+#endif
+
+#ifndef _UNOTOOLS_PROPERTY_MULTIPLEX_HXX_
+#include
+#endif
+
+//.........................................................................
+namespace frm
+{
+
+enum { CB_NOCHECK, CB_CHECK, CB_DONTKNOW };
+
+//==================================================================
+//= OCheckBoxModel
+//==================================================================
+class OCheckBoxModel :public OBoundControlModel
+ ,public OPropertyChangeListener
+ ,public ::utl::OAggregationArrayUsageHelper< OCheckBoxModel >
+{
+ ::rtl::OUString m_sReferenceValue; // Referenzwert zum Checken des Buttons
+ sal_Int16 m_nDefaultChecked; // Soll beim Reset gecheckt werden ?
+ sal_Bool m_bInReset;
+
+protected:
+ sal_Int16 getState(const staruno::Any& rValue);
+
+ virtual void _onValueChanged();
+ virtual void _loaded(const starlang::EventObject& rEvent);
+ virtual staruno::Any _getControlValue() const;
+
+public:
+ OCheckBoxModel(const staruno::Reference& _rxFactory);
+
+ // XServiceInfo
+ IMPLEMENTATION_NAME(OCheckBoxModel);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+
+ // OPropertySetHelper
+ virtual void SAL_CALL getFastPropertyValue(staruno::Any& rValue, sal_Int32 nHandle) const;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const staruno::Any& rValue )
+ throw (staruno::Exception);
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, sal_Int32 _nHandle, const staruno::Any& _rValue )
+ throw (starlang::IllegalArgumentException);
+
+ // XPropertySetRef
+ virtual staruno::Reference SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
+ virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // XPersistObject
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
+ virtual void SAL_CALL
+ write(const staruno::Reference& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL
+ read(const staruno::Reference& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
+
+ // OPropertyChangeListener
+ virtual void _propertyChanged(const starbeans::PropertyChangeEvent& evt) throw(staruno::RuntimeException);
+
+ // XReset
+ virtual void SAL_CALL reset() throw(staruno::RuntimeException);
+
+// OAggregationArrayUsageHelper
+ virtual void fillProperties(
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
+ ) const;
+ IMPLEMENT_INFO_SERVICE()
+
+protected:
+ virtual void _reset();
+ virtual sal_Bool _commit();
+};
+
+//==================================================================
+//= OCheckBoxControl
+//==================================================================
+class OCheckBoxControl : public OBoundControl
+{
+public:
+ OCheckBoxControl(const staruno::Reference& _rxFactory);
+
+ // XServiceInfo
+ IMPLEMENTATION_NAME(OCheckBoxControl);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
+};
+
+//.........................................................................
+}
+//.........................................................................
+
+#endif // _FORMS_CHECKBOX_HXX_
+
diff --git a/forms/source/component/Columns.cxx b/forms/source/component/Columns.cxx
new file mode 100644
index 000000000000..a39f8366eda7
--- /dev/null
+++ b/forms/source/component/Columns.cxx
@@ -0,0 +1,676 @@
+/*************************************************************************
+ *
+ * $RCSfile: Columns.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FRM_COLUMNS_HXX
+#include "Columns.hxx"
+#endif
+#ifndef _FRM_PROPERTY_HRC_
+#include "property.hrc"
+#endif
+#ifndef _FRM_PROPERTY_HXX_
+#include "property.hxx"
+#endif
+#ifndef _FRM_IDS_HXX_
+#include "ids.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FORM_XFORMCOMPONENT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include
+#endif
+#ifndef _UTL_SEQUENCE_HXX_
+#include
+#endif
+#ifndef _UTL_PROPERTY_HXX_
+#include
+#endif
+#ifndef _UTL_BASIC_IO_HXX_
+#include
+#endif
+
+#ifndef _FRM_SERVICES_HXX_
+#include "services.hxx"
+#endif
+#ifndef _FRM_RESOURCE_HRC_
+#include "frm_resource.hrc"
+#endif
+#ifndef _TOOLS_DEBUG_HXX //autogen
+#include
+#endif
+#ifndef _RTL_UUID_H_
+#include
+#endif
+#ifndef _RTL_MEMORY_H_
+#include
+#endif
+
+namespace internal {
+sal_Int32 findPos(const ::rtl::OUString& aStr, const StringSequence& rList);
+}
+
+//.........................................................................
+namespace frm
+{
+//.........................................................................
+
+ namespace starform = ::com::sun::star::form;
+
+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.search(aModelPrefix);
+ sal_Int32 nCampatiblePrefixPos = aModelName.search(aCompatibleModelPrefix);
+ DBG_ASSERT( (nPrefixPos != -1) || (nCampatiblePrefixPos != -1),
+ "::getColumnTypeByModelName() : wrong servivce !");
+
+ ::rtl::OUString aColumnType = (nPrefixPos != -1)
+ ? aModelName.copy(aModelPrefix.len())
+ : aModelName.copy(aCompatibleModelPrefix.len());
+
+ const StringSequence& rColumnTypes = getColumnTypes();
+ nTypeId = ::internal::findPos(aColumnType, rColumnTypes);
+ }
+ return nTypeId;
+}
+
+/*************************************************************************/
+
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OGridColumn_CreateInstance(const staruno::Reference& _rxFactory)
+{
+ return *(new OGridColumn(_rxFactory));
+}
+
+//------------------------------------------------------------------
+const staruno::Sequence& OGridColumn::getUnoTunnelImplementationId()
+{
+ static staruno::Sequence< sal_Int8 > * pSeq = 0;
+ if( !pSeq )
+ {
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( !pSeq )
+ {
+ static staruno::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 staruno::Sequence& _rIdentifier) throw(staruno::RuntimeException)
+{
+ sal_Int64 nReturn(0);
+
+ if ( (_rIdentifier.getLength() == 16)
+ && (0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
+ )
+ {
+ nReturn = reinterpret_cast(this);
+ }
+ else
+ {
+ staruno::Reference xAggregateTunnel(m_xAggregate, staruno::UNO_QUERY);
+ if (xAggregateTunnel.is())
+ nReturn = xAggregateTunnel->getSomething(_rIdentifier);
+ }
+ return nReturn;
+}
+
+//------------------------------------------------------------------
+staruno::Sequence SAL_CALL OGridColumn::getImplementationId() throw(staruno::RuntimeException)
+{
+ return OImplementationIds::getImplementationId(getTypes());
+}
+
+//------------------------------------------------------------------
+staruno::Sequence SAL_CALL OGridColumn::getTypes() throw(staruno::RuntimeException)
+{
+ staruno::Sequence aOwnTypes(5);
+ aOwnTypes.getArray()[0] = ::getCppuType((staruno::Reference*)NULL);
+ aOwnTypes.getArray()[1] = ::getCppuType((staruno::Reference*)NULL);
+ aOwnTypes.getArray()[2] = ::getCppuType((staruno::Reference*)NULL);
+ aOwnTypes.getArray()[3] = ::getCppuType((staruno::Reference*)NULL);
+ aOwnTypes.getArray()[4] = ::getCppuType((staruno::Reference*)NULL);
+
+ staruno::Reference xProv;
+
+ if (query_aggregation(m_xAggregate, xProv))
+ return concatSequences(aOwnTypes, OComponentHelper::getTypes(), xProv->getTypes());
+ else
+ return concatSequences(aOwnTypes, OComponentHelper::getTypes(), xProv->getTypes());
+}
+
+//------------------------------------------------------------------
+staruno::Any SAL_CALL OGridColumn::queryAggregation( const staruno::Type& _rType ) throw (staruno::RuntimeException)
+{
+ staruno::Any aReturn = OComponentHelper::queryAggregation(_rType);
+
+ if (!aReturn.hasValue())
+ aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
+
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType,
+ static_cast(this),
+ static_cast(this),
+ static_cast(NULL),
+ // though our aggregate may be an XFormComponent, we aren't anymore
+ static_cast(NULL)
+ // though our aggregate may be an XServiceInfo, we aren't anymore
+ );
+
+ if (!aReturn.hasValue() && m_xAggregate.is())
+ aReturn = m_xAggregate->queryAggregation(_rType);
+
+ return aReturn;
+}
+
+DBG_NAME(OGridColumn);
+//------------------------------------------------------------------------------
+OGridColumn::OGridColumn(const staruno::Reference& _rxFactory, const ::rtl::OUString& _sModelName)
+ :OComponentHelper(m_aMutex)
+ ,OPropertySetAggregationHelper(OComponentHelper::rBHelper)
+ ,m_aModelName(_sModelName)
+{
+ DBG_CTOR(OGridColumn,NULL);
+ // Anlegen des UnoControlModels
+ if (m_aModelName.getLength()) // gibt es ein zu aggregierendes Model
+ {
+ increment(m_refCount);
+
+ // Muss im eigenen Block,
+ // da xAgg vor dem delegator setzen wieder freigesetzt sein mu !
+ {
+ m_xAggregate = staruno::Reference (_rxFactory->createInstance(m_aModelName), staruno::UNO_QUERY);
+ setAggregation(m_xAggregate);
+ }
+
+ if (m_xAggregate.is())
+ {
+ m_xAggregate->setDelegator(static_cast< ::cppu::OWeakObject* >(this));
+ }
+
+ // Refcount wieder bei NULL
+ decrement(m_refCount);
+ }
+
+ m_aHidden <<= (sal_Bool)sal_False;
+}
+
+//------------------------------------------------------------------------------
+OGridColumn::~OGridColumn()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+
+ // freigeben der Agg
+ if (m_xAggregate.is())
+ {
+ InterfaceRef xIface;
+ m_xAggregate->setDelegator(xIface);
+ }
+ DBG_DTOR(OGridColumn,NULL);
+}
+
+// starcontainer::XChild
+//------------------------------------------------------------------------------
+void SAL_CALL OGridColumn::setParent(const InterfaceRef& Parent) throw(starlang::NoSupportException, staruno::RuntimeException)
+{
+ m_xParent = Parent;
+}
+
+// starlang::XEventListener
+//------------------------------------------------------------------------------
+void SAL_CALL OGridColumn::disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException)
+{
+ OPropertySetAggregationHelper::disposing(_rSource);
+
+ staruno::Reference xEvtLstner;
+ if (query_aggregation(m_xAggregate, xEvtLstner))
+ xEvtLstner->disposing(_rSource);
+}
+
+// OComponentHelper
+//-----------------------------------------------------------------------------
+void OGridColumn::disposing()
+{
+ OComponentHelper::disposing();
+ OPropertySetAggregationHelper::disposing();
+
+ staruno::Reference xComp;
+ if (query_aggregation(m_xAggregate, xComp))
+ xComp->dispose();
+
+ setParent(InterfaceRef ());
+}
+
+//------------------------------------------------------------------------------
+void OGridColumn::clearAggregateProperties(staruno::Sequence& 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_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(staruno::Sequence& aDescriptor)
+{
+ aDescriptor.realloc(5);
+ starbeans::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);
+}
+
+// staruno::Reference
+//------------------------------------------------------------------------------
+staruno::Reference SAL_CALL OGridColumn::getPropertySetInfo() throw(staruno::RuntimeException)
+{
+ DBG_ERROR("OGridColumn::getPropertySetInfo() : Dummy Called");
+ return staruno::Reference ();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& OGridColumn::getInfoHelper()
+{
+ DBG_ERROR("OGridColumn::getInfoHelper() : Dummy Called");
+
+ staruno::Sequence aDescriptor, aAggProperties;
+ static OPropertyArrayAggregationHelper aDescAry(aDescriptor, aAggProperties);
+ return aDescAry;
+}
+
+//------------------------------------------------------------------------------
+void OGridColumn::getFastPropertyValue(staruno::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( staruno::Any& rConvertedValue, staruno::Any& rOldValue,
+ sal_Int32 nHandle, const staruno::Any& rValue )throw( starlang::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:
+ bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType((const sal_Int16*)NULL));
+ break;
+ case PROPERTY_ID_HIDDEN:
+ bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getBOOL(m_aHidden));
+ break;
+ }
+ return bModified;
+}
+
+//------------------------------------------------------------------------------
+void OGridColumn::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const staruno::Any& rValue )
+{
+ switch (nHandle)
+ {
+ case PROPERTY_ID_LABEL:
+ DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::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;
+ }
+}
+
+
+// starbeans::XPropertyState
+//------------------------------------------------------------------------------
+starbeans::PropertyState OGridColumn::getPropertyStateByHandle(sal_Int32 nHandle)
+{
+ starbeans::PropertyState eState;
+ switch (nHandle)
+ {
+ case PROPERTY_ID_WIDTH:
+ if (!m_aWidth.hasValue())
+ eState = starbeans::PropertyState_DEFAULT_VALUE;
+ else
+ eState = starbeans::PropertyState_DIRECT_VALUE;
+ break;
+ case PROPERTY_ID_ALIGN:
+ if (!m_aAlign.hasValue())
+ eState = starbeans::PropertyState_DEFAULT_VALUE;
+ else
+ eState = starbeans::PropertyState_DIRECT_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, staruno::Any());
+ break;
+ case PROPERTY_ID_HIDDEN:
+ setFastPropertyValue(nHandle, staruno::makeAny((sal_Bool)sal_True));
+ break;
+ default:
+ OPropertySetAggregationHelper::setPropertyToDefaultByHandle(nHandle);
+ }
+}
+
+//------------------------------------------------------------------------------
+staruno::Any OGridColumn::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
+{
+ switch (nHandle)
+ {
+ case PROPERTY_ID_WIDTH:
+ case PROPERTY_ID_ALIGN:
+ return staruno::Any();
+ case PROPERTY_ID_HIDDEN:
+ return staruno::makeAny((sal_Bool)sal_False);
+ default:
+ return OPropertySetAggregationHelper::getPropertyDefaultByHandle(nHandle);
+ }
+}
+
+//XPersistObject
+//------------------------------------------------------------------------------
+void SAL_CALL OGridColumn::write(const staruno::Reference& _rxOutStream)
+{
+ // 1. Schreiben des UnoControls
+ staruno::Reference xMark(_rxOutStream, staruno::UNO_QUERY);
+ sal_Int32 nMark = xMark->createMark();
+
+ sal_Int32 nLen = 0;
+ _rxOutStream->writeLong(nLen);
+
+ staruno::Reference 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() == staruno::TypeClass_LONG)
+ nAnyMask |= WIDTH;
+
+ if (m_aAlign.getValueType().getTypeClass() == staruno::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 staruno::Reference& _rxInStream)
+{
+ // 1. Lesen des UnoControls
+ sal_Int32 nLen = _rxInStream->readLong();
+ if (nLen)
+ {
+ staruno::Reference xMark(_rxInStream, staruno::UNO_QUERY);
+ sal_Int32 nMark = xMark->createMark();
+ staruno::Reference 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
+//.........................................................................
+
diff --git a/forms/source/component/Columns.hxx b/forms/source/component/Columns.hxx
new file mode 100644
index 000000000000..954d77b9aad1
--- /dev/null
+++ b/forms/source/component/Columns.hxx
@@ -0,0 +1,268 @@
+/*************************************************************************
+ *
+ * $RCSfile: Columns.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FRM_COLUMNS_HXX
+#define _FRM_COLUMNS_HXX
+
+#ifndef _CPPUHELPER_COMPONENT_HXX_
+#include
+#endif
+#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_
+#include
+#endif
+#ifndef _UNOTOOLS_PROPERTY_AGGREGATION_HXX_
+#include
+#endif
+#ifndef _UTL_UNO3_HXX_
+#include
+#endif
+#include "strings.hxx"
+
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
+#include
+#endif
+
+using namespace utl;
+
+//.........................................................................
+namespace frm
+{
+//.........................................................................
+
+ namespace starcontainer = ::com::sun::star::container;
+ namespace stario = ::com::sun::star::io;
+
+//==================================================================
+// OGridColumn
+//==================================================================
+class OGridColumn
+ :public ::cppu::OComponentHelper
+ ,public OPropertySetAggregationHelper
+ ,public starcontainer::XChild
+ ,public starlang::XUnoTunnel
+{
+protected:
+// [properties]
+ staruno::Any m_aWidth; // Spaltenbreite
+ staruno::Any m_aAlign;
+ staruno::Any m_aHidden; // Spalte ist versteckt ?
+// [properties]
+
+ ::osl::Mutex m_aMutex;
+ InterfaceRef m_xParent;
+ staruno::Reference m_xAggregate;
+ ::rtl::OUString m_aModelName;
+
+// [properties]
+ ::rtl::OUString m_aLabel; // Name der Spalte
+
+// [properties]
+
+public:
+ OGridColumn(const staruno::Reference& _rxFactory, const ::rtl::OUString& _sModelName = ::rtl::OUString());
+ virtual ~OGridColumn();
+
+ // UNO Anbindung
+ DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OComponentHelper);
+ virtual staruno::Any SAL_CALL queryAggregation( const staruno::Type& _rType ) throw (staruno::RuntimeException);
+
+ static const staruno::Sequence& getUnoTunnelImplementationId();
+ // XUnoTunnel
+ virtual sal_Int64 SAL_CALL getSomething( const staruno::Sequence& _rIdentifier) throw(staruno::RuntimeException);
+
+// XTypeProvider
+ virtual staruno::Sequence SAL_CALL getImplementationId() throw(staruno::RuntimeException);
+ virtual staruno::Sequence SAL_CALL getTypes() throw(staruno::RuntimeException);
+
+// OComponentHelper
+ virtual void SAL_CALL disposing();
+
+// starlang::XEventListener
+ virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
+
+// starcontainer::XChild
+ virtual InterfaceRef SAL_CALL getParent() throw(staruno::RuntimeException){return m_xParent;}
+ virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(starlang::NoSupportException, staruno::RuntimeException);
+
+// stario::XPersistObject
+ virtual void SAL_CALL write(const staruno::Reference& _rxOutStream);
+ virtual void SAL_CALL read(const staruno::Reference& _rxInStream);
+
+// starbeans::XPropertySet
+ virtual staruno::Reference SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+ virtual void SAL_CALL getFastPropertyValue(staruno::Any& rValue, sal_Int32 nHandle ) const;
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(staruno::Any& rConvertedValue, staruno::Any& rOldValue,
+ sal_Int32 nHandle, const staruno::Any& rValue )
+ throw(starlang::IllegalArgumentException);
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const staruno::Any& rValue);
+
+// starbeans::XPropertyState
+ virtual starbeans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
+ virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
+ virtual staruno::Any getPropertyDefaultByHandle( sal_Int32 nHandle ) const;
+
+ const ::rtl::OUString& getModelName() const { return m_aModelName; }
+
+protected:
+ static void clearAggregateProperties(staruno::Sequence& seqProps, sal_Bool bAllowDropDown);
+ static void setOwnProperties(staruno::Sequence& seqProps);
+};
+
+#define DECL_COLUMN(ClassName) \
+class ClassName \
+ :public OGridColumn \
+ ,public OAggregationArrayUsageHelper< ClassName > \
+{ \
+public: \
+ ClassName(const staruno::Reference& _rxFactory);\
+ \
+ virtual staruno::Reference SAL_CALL getPropertySetInfo() throw(staruno::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 staruno::Reference& _rxFactory) \
+ :OGridColumn(_rxFactory, Model){} \
+staruno::Reference ClassName::getPropertySetInfo() throw(staruno::RuntimeException)\
+{ \
+ staruno::Reference xInfo( createPropertySetInfo( getInfoHelper() ) ); \
+ return xInfo; \
+} \
+::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \
+{ \
+ return *const_cast(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)
+
+#endif // _FRM_COLUMNS_HXX
+
+//.........................................................................
+} // namespace frm
+//.........................................................................
+
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
new file mode 100644
index 000000000000..3e18ce861db3
--- /dev/null
+++ b/forms/source/component/ComboBox.cxx
@@ -0,0 +1,908 @@
+/*************************************************************************
+ *
+ * $RCSfile: ComboBox.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_COMBOBOX_HXX_
+#include "ComboBox.hxx"
+#endif
+#ifndef _FRM_PROPERTY_HXX_
+#include "property.hxx"
+#endif
+#ifndef _FRM_PROPERTY_HRC_
+#include "property.hrc"
+#endif
+#ifndef _FRM_SERVICES_HXX_
+#include "services.hxx"
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
+#include
+#endif
+#ifndef _FRM_RESOURCE_HXX_
+#include "frm_resource.hxx"
+#endif
+#ifndef _FRM_RESOURCE_HRC_
+#include "frm_resource.hrc"
+#endif
+#ifndef _FORMS_BASELISTBOX_HXX_
+#include "BaseListBox.hxx"
+#endif
+#ifndef _UTL_NUMBERS_HXX_
+#include
+#endif
+#ifndef _UNOTOOLS_DATETIME_HXX_
+#include
+#endif
+#ifndef _UTL_UNO3_DB_TOOLS_HXX_
+#include
+#endif
+#ifndef _UTL_DB_CONVERSION_HXX_
+#include
+#endif
+
+#ifndef _COM_SUN_STAR_SDB_SQLERROREVENT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSERFACTORY_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
+#include
+#endif
+
+//.........................................................................
+namespace frm
+{
+
+//========================================================================
+// class OComboBoxModel
+//========================================================================
+sal_Int32 OComboBoxModel::nTextHandle = -1;
+
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OComboBoxModel_CreateInstance(const staruno::Reference& _rxFactory) throw (staruno::RuntimeException)
+{
+ return (*new OComboBoxModel(_rxFactory));
+}
+
+//------------------------------------------------------------------------------
+staruno::Sequence OComboBoxModel::_getTypes()
+{
+ static staruno::Sequence aTypes;
+ if (!aTypes.getLength())
+ {
+ // my two base classes
+ staruno::Sequence aBaseClassTypes = OBoundControlModel::_getTypes();
+
+ staruno::Sequence aOwnTypes(1);
+ staruno::Type* pOwnTypes = aOwnTypes.getArray();
+ pOwnTypes[0] = getCppuType((staruno::Reference*)NULL);
+
+ aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
+ }
+ return aTypes;
+}
+
+// XServiceInfo
+//------------------------------------------------------------------------------
+StringSequence SAL_CALL OComboBoxModel::getSupportedServiceNames() throw(staruno::RuntimeException)
+{
+ StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
+ aSupported.realloc(aSupported.getLength() + 2);
+
+ ::rtl::OUString* pArray = aSupported.getArray();
+ pArray[aSupported.getLength()-2] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseComboBox");
+ pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_COMBOBOX;
+ return aSupported;
+}
+
+//------------------------------------------------------------------------------
+staruno::Any SAL_CALL OComboBoxModel::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
+{
+ staruno::Any aReturn;
+
+ aReturn = OBoundControlModel::queryAggregation(_rType);
+ if (!aReturn.hasValue())
+ aReturn = ::cppu::queryInterface(_rType
+ ,static_cast(this)
+ );
+
+ return aReturn;
+}
+
+//------------------------------------------------------------------
+OComboBoxModel::OComboBoxModel(const staruno::Reference& _rxFactory)
+ :OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_COMBOBOX, FRM_CONTROL_COMBOBOX)
+ // use the old control name for compytibility reasons
+ ,m_eListSourceType(starform::ListSourceType_TABLE)
+ ,m_bEmptyIsNull(sal_True)
+ ,m_aNullDate(STANDARD_DB_DATE)
+ ,m_nKeyType(starutil::NumberFormat::UNDEFINED)
+ ,m_nFormatKey(0)
+ ,m_nFieldType(starsdbc::DataType::OTHER)
+ ,m_aErrorListeners(m_aMutex)
+{
+ m_nClassId = starform::FormComponentType::COMBOBOX;
+ m_sDataFieldConnectivityProperty = PROPERTY_TEXT;
+ if (OComboBoxModel::nTextHandle == -1)
+ OComboBoxModel::nTextHandle = getOriginalHandle(PROPERTY_ID_TEXT);
+}
+
+//------------------------------------------------------------------
+OComboBoxModel::~OComboBoxModel()
+{
+ if (!OComponentHelper::rBHelper.bDisposed)
+ {
+ acquire();
+ dispose();
+ }
+}
+
+//------------------------------------------------------------------------------
+void OComboBoxModel::disposing()
+{
+ OBoundControlModel::disposing();
+ m_xFormatter = NULL;
+}
+
+//------------------------------------------------------------------------------
+void OComboBoxModel::getFastPropertyValue(staruno::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 staruno::Any& _rValue)
+ throw (staruno::Exception)
+{
+ switch (_nHandle)
+ {
+ case PROPERTY_ID_LISTSOURCETYPE :
+ DBG_ASSERT(_rValue.getValueType().equals(::getCppuType(reinterpret_cast(NULL))),
+ "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
+ _rValue >>= m_eListSourceType;
+ break;
+
+ case PROPERTY_ID_LISTSOURCE :
+ DBG_ASSERT(_rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING,
+ "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
+ _rValue >>= m_aListSource;
+ // die ListSource hat sich geaendert -> neu laden
+ if (starform::ListSourceType_VALUELIST != m_eListSourceType)
+ {
+ if (m_xCursor.is() && !m_xField.is()) // combobox bereits mit Datenbank verbunden ?
+ // neu laden
+ loadData();
+ }
+ break;
+
+ case PROPERTY_ID_EMPTY_IS_NULL :
+ DBG_ASSERT(_rValue.getValueType().getTypeClass() == staruno::TypeClass_BOOLEAN,
+ "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
+ _rValue >>= m_bEmptyIsNull;
+ break;
+
+ case PROPERTY_ID_DEFAULT_TEXT :
+ DBG_ASSERT(_rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING,
+ "OComboBoxModel::setFastPropertyValue_NoBroadcast : invalid type !" );
+ _rValue >>= m_aDefaultText;
+ _reset();
+ break;
+
+ default:
+ OBoundControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
+ }
+}
+
+//------------------------------------------------------------------------------
+sal_Bool OComboBoxModel::convertFastPropertyValue(
+ staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, sal_Int32 _nHandle, const staruno::Any& _rValue)
+ throw (starlang::IllegalArgumentException)
+{
+ sal_Bool bModified(sal_False);
+ switch (_nHandle)
+ {
+ case PROPERTY_ID_LISTSOURCETYPE :
+ bModified = tryPropertyValue(_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;
+}
+
+//------------------------------------------------------------------------------
+staruno::Reference SAL_CALL OComboBoxModel::getPropertySetInfo() throw(staruno::RuntimeException)
+{
+ staruno::Reference xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//------------------------------------------------------------------------------
+cppu::IPropertyArrayHelper& OComboBoxModel::getInfoHelper()
+{
+ return *const_cast(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+void OComboBoxModel::fillProperties(
+ staruno::Sequence< starbeans::Property >& _rProps,
+ staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
+{
+ FRM_BEGIN_PROP_HELPER(13)
+ // Text auf transient setzen
+ ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, starbeans::PropertyAttribute::TRANSIENT, 0);
+
+ 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, starform::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_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
+ DECL_IFACE_PROP2(BOUNDFIELD, starbeans::XPropertySet, READONLY, TRANSIENT);
+ DECL_IFACE_PROP2(CONTROLLABEL, starbeans::XPropertySet, BOUND, MAYBEVOID);
+ DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
+ FRM_END_PROP_HELPER();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OComboBoxModel::getServiceName() throw(staruno::RuntimeException)
+{
+ return FRM_COMPONENT_COMBOBOX; // old (non-sun) name for compatibility !
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OComboBoxModel::write(const staruno::Reference& _rxOutStream)
+ throw(stario::IOException, staruno::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() == staruno::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;
+ _rxOutStream << m_aHelpText;
+
+ // from version 0x0006 : common properties
+ writeCommonProperties(_rxOutStream);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OComboBoxModel::read(const staruno::Reference& _rxInStream) throw(stario::IOException, staruno::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 = starform::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 = (starform::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 mu geleert werden, wenn eine Listenquelle gesetzt ist
+ // dieses kann der Fall sein wenn im alive modus gespeichert wird
+ if (m_aListSource.len() && m_xAggregateSet.is())
+ {
+ StringSequence aSequence;
+ m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, staruno::makeAny(aSequence));
+ }
+
+ if (nVersion > 0x0004)
+ _rxInStream >> m_aHelpText;
+
+ 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 != starform::ListSourceType_VALUELIST, "OComboBoxModel::loadData : do not call for a value list !");
+ ////
+ // Connection holen
+ staruno::Reference xForm(m_xCursor, staruno::UNO_QUERY);
+ if (!xForm.is())
+ return;
+ staruno::Reference xConnection = getConnection(xForm);
+ if (!xConnection.is())
+ return;
+
+ // we need a com::sun::star::sdb::Connection for some of the code below ...
+ staruno::Reference xServiceInfo(xConnection, staruno::UNO_QUERY);
+ if (!xServiceInfo.is() || !xServiceInfo->supportsService(SRV_SDB_CONNECTION))
+ {
+ DBG_ERROR("OComboBoxModel::loadData : invalid connection !");
+ return;
+ }
+
+ staruno::Reference xListCursor;
+
+ if (!m_aListSource.len() || m_eListSourceType == starform::ListSourceType_VALUELIST)
+ return;
+
+ try
+ {
+ switch (m_eListSourceType)
+ {
+ case starform::ListSourceType_TABLEFIELDS:
+ // don't work with a statement here, the fields will be collected below
+ break;
+ case starform::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
+
+ staruno::Reference xFieldsByName = getTableFields(xConnection, m_aListSource);
+ staruno::Reference xFieldsByIndex(xFieldsByName, staruno::UNO_QUERY);
+
+ ::rtl::OUString aFieldName;
+ if (xFieldsByName.is() && xFieldsByName->hasByName(m_aControlSource))
+ {
+ aFieldName = m_aControlSource;
+ }
+ else
+ {
+ // otherwise look for the alias
+ staruno::Reference xFactory(xConnection, staruno::UNO_QUERY);
+ if (!xFactory.is())
+ break;
+
+ staruno::Reference xComposer = xFactory->createQueryComposer();
+ try
+ {
+ staruno::Reference xFormAsSet(xForm, staruno::UNO_QUERY);
+ ::rtl::OUString aStatement;
+ xFormAsSet->getPropertyValue(PROPERTY_ACTIVECOMMAND) >>= aStatement;
+ xComposer->setQuery(aStatement);
+ }
+ catch(...)
+ {
+ disposeComponent(xComposer);
+ break;
+ }
+
+ // search the field
+ staruno::Reference xSupplyFields(xComposer, staruno::UNO_QUERY);
+ DBG_ASSERT(xSupplyFields.is(), "OComboBoxModel::loadData : invalid query composer !");
+
+ staruno::Reference xFieldNames = xSupplyFields->getColumns();
+ if (xFieldNames->hasByName(m_aControlSource))
+ {
+ staruno::Reference xComposerFieldAsSet(*(staruno::Reference*)xFieldNames->getByName(m_aControlSource).getValue());
+ if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet))
+ xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName;
+ }
+
+ disposeComponent(xComposer);
+ }
+
+ if (!aFieldName.len())
+ break;
+
+ staruno::Reference 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);
+
+ staruno::Reference xStmt = xConnection->createStatement();
+ xListCursor = xStmt->executeQuery(aStatement);
+ } break;
+ case starform::ListSourceType_QUERY:
+ {
+ staruno::Reference xSupplyQueries(xConnection, staruno::UNO_QUERY);
+ staruno::Reference xQuery(*(InterfaceRef*)xSupplyQueries->getQueries()->getByName(m_aListSource).getValue(), staruno::UNO_QUERY);
+ staruno::Reference xStmt = xConnection->createStatement();
+ staruno::Reference(xStmt, staruno::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:
+ {
+ staruno::Reference xStmt = xConnection->createStatement();
+ if (starform::ListSourceType_SQLPASSTHROUGH == m_eListSourceType)
+ {
+ staruno::Reference xStatementProps(xStmt, staruno::UNO_QUERY);
+ xStatementProps->setPropertyValue(PROPERTY_ESCAPE_PROCESSING, staruno::makeAny(sal_Bool(sal_False)));
+ }
+ xListCursor = xStmt->executeQuery(m_aListSource);
+ }
+ }
+ }
+ catch(starsdbc::SQLException& eSQL)
+ {
+ onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST));
+ disposeComponent(xListCursor);
+ return;
+ }
+ catch(staruno::Exception& eUnknown)
+ {
+ eUnknown;
+ disposeComponent(xListCursor);
+ return;
+ }
+
+ if (starform::ListSourceType_TABLEFIELDS != m_eListSourceType && !xListCursor.is())
+ // something went wrong ...
+ return;
+
+ vector< ::rtl::OUString > aStringList;
+ aStringList.reserve(16);
+ try
+ {
+ switch (m_eListSourceType)
+ {
+ case starform::ListSourceType_SQL:
+ case starform::ListSourceType_SQLPASSTHROUGH:
+ case starform::ListSourceType_TABLE:
+ case starform::ListSourceType_QUERY:
+ {
+ // die XDatabaseVAriant der ersten Spalte
+ staruno::Reference xSupplyCols(xListCursor, staruno::UNO_QUERY);
+ DBG_ASSERT(xSupplyCols.is(), "OComboBoxModel::loadData : cursor supports the row set service but is no column supplier ??!");
+ staruno::Reference xColumns;
+ if (xSupplyCols.is())
+ {
+ xColumns = staruno::Reference(xSupplyCols->getColumns(), staruno::UNO_QUERY);
+ DBG_ASSERT(xColumns.is(), "OComboBoxModel::loadData : no columns supplied by the row set !");
+ }
+ staruno::Reference xDataField;
+ if (xColumns.is())
+ xDataField = staruno::Reference(*(InterfaceRef*)xColumns->getByIndex(0).getValue(), staruno::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++ 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; ksetPropertyValue(PROPERTY_STRINGITEMLIST, staruno::makeAny(aStringSeq));
+
+ // Statement + Cursor zerstoeren
+ disposeComponent(xListCursor);
+}
+
+//------------------------------------------------------------------------------
+void OComboBoxModel::_loaded(const starlang::EventObject& rEvent)
+{
+ if (m_xField.is())
+ {
+ // jetzt den Key und typ ermitteln
+ m_xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= m_nFieldType;
+ m_xField->getPropertyValue(PROPERTY_FORMATKEY) >>= m_nFormatKey;
+
+ // XNumberFormatter besorgen
+ staruno::Reference xRowSet(rEvent.Source, staruno::UNO_QUERY);
+ DBG_ASSERT(xRowSet.is(), "OComboBoxModel::_loaded : invalid event source !");
+ staruno::Reference xSupplier = getNumberFormats(getConnection(xRowSet), sal_False, m_xServiceFactory);
+ if (xSupplier.is())
+ {
+ m_xFormatter = staruno::Reference(
+ m_xServiceFactory->createInstance(FRM_NUMBER_FORMATTER), staruno::UNO_QUERY
+ );
+ if (m_xFormatter.is())
+ m_xFormatter->attachNumberFormatsSupplier(xSupplier);
+
+ m_nKeyType = getNumberFormatType(xSupplier->getNumberFormats(), m_nFormatKey);
+ typeConvert(*(starutil::Date*)xSupplier->getNumberFormatSettings()->getPropertyValue(::rtl::OUString::createFromAscii("NullDate")).getValue(),
+ m_aNullDate);
+ }
+ }
+
+ // Daten nur laden, wenn eine Listenquelle angegeben wurde
+ if (m_aListSource.len() && m_xCursor.is())
+ loadData();
+}
+
+//------------------------------------------------------------------------------
+void OComboBoxModel::_unloaded()
+{
+ if (m_xField.is())
+ {
+ m_xFormatter = 0;
+ m_nFieldType = starsdbc::DataType::OTHER;
+ m_nFormatKey = 0;
+ m_nKeyType = starutil::NumberFormat::UNDEFINED;
+ m_aNullDate = STANDARD_DB_DATE;
+ }
+
+ // Zuruecksetzen der Inhalte (s.o)
+ if (m_aListSource.len() && m_xCursor.is())
+ {
+ StringSequence aSequence;
+ m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, staruno::makeAny(aSequence));
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OComboBoxModel::reloaded( const starlang::EventObject& aEvent ) throw(staruno::RuntimeException)
+{
+ OBoundControlModel::reloaded(aEvent);
+
+ // reload data if we have a list source
+ if (m_aListSource.len() && m_xCursor.is())
+ loadData();
+}
+
+// XBoundComponent
+//------------------------------------------------------------------------------
+sal_Bool OComboBoxModel::_commit()
+{
+ ::rtl::OUString aNewValue;
+ m_xAggregateFastSet->getFastPropertyValue(OComboBoxModel::nTextHandle) >>= aNewValue;
+ if (aNewValue != m_aSaveValue)
+ {
+ 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(...)
+ {
+ return sal_False;
+ }
+ }
+ m_aSaveValue = aNewValue;
+ }
+
+ // add the new value to the list
+ sal_Bool bAddToList = sal_True;
+ // (only if this is not the "commit" triggered by a "reset")
+ if (m_bResetting)
+ bAddToList = sal_False;
+
+ staruno::Any aAnyList = m_xAggregateSet->getPropertyValue(PROPERTY_STRINGITEMLIST);
+ if (bAddToList && aAnyList.getValueType().equals(::getCppuType(reinterpret_cast(NULL))))
+ {
+ StringSequence aStringItemList = *(StringSequence*)aAnyList.getValue();
+ const ::rtl::OUString* pStringItems = aStringItemList.getConstArray();
+ sal_Int32 i;
+ for (i=0; iequals(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, staruno::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, staruno::makeAny(m_aDefaultText));
+ }
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OComboBoxModel::addSQLErrorListener(const staruno::Reference& _rxListener) throw(staruno::RuntimeException)
+{
+ m_aErrorListeners.addInterface(_rxListener);
+}
+
+//------------------------------------------------------------------------------
+void SAL_CALL OComboBoxModel::removeSQLErrorListener(const staruno::Reference& _rxListener) throw(staruno::RuntimeException)
+{
+ m_aErrorListeners.removeInterface(_rxListener);
+}
+
+//------------------------------------------------------------------------------
+void OComboBoxModel::onError(starsdbc::SQLException& _rException, const ::rtl::OUString& _rContextDescription)
+{
+ starsdb::SQLContext aError = prependContextInfo(_rException, static_cast(this), _rContextDescription);
+
+ if (m_aErrorListeners.getLength())
+ {
+ starsdb::SQLErrorEvent aEvent(static_cast(this), staruno::makeAny(aError));
+
+ ::cppu::OInterfaceIteratorHelper aIter(m_aErrorListeners);
+ while (aIter.hasMoreElements())
+ static_cast(aIter.next())->errorOccured(aEvent);
+ }
+}
+
+//========================================================================
+//= OComboBoxControl
+//========================================================================
+
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OComboBoxControl_CreateInstance(const staruno::Reference& _rxFactory) throw (staruno::RuntimeException)
+{
+ return *(new OComboBoxControl(_rxFactory));
+}
+
+//------------------------------------------------------------------------------
+OComboBoxControl::OComboBoxControl(const staruno::Reference& _rxFactory)
+ :OBoundControl(_rxFactory, VCL_CONTROL_COMBOBOX)
+{
+}
+
+//------------------------------------------------------------------------------
+StringSequence SAL_CALL OComboBoxControl::getSupportedServiceNames() throw(staruno::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;
+}
+
+//.........................................................................
+}
+//.........................................................................
+
diff --git a/forms/source/component/ComboBox.hxx b/forms/source/component/ComboBox.hxx
new file mode 100644
index 000000000000..c313b2eeec14
--- /dev/null
+++ b/forms/source/component/ComboBox.hxx
@@ -0,0 +1,199 @@
+/*************************************************************************
+ *
+ * $RCSfile: ComboBox.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_COMBOBOX_HXX_
+#define _FORMS_COMBOBOX_HXX_
+
+#ifndef _FORMS_FORMCOMPONENT_HXX_
+#include "FormComponent.hxx"
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
+#include
+#endif
+#ifndef _DATE_HXX
+#include
+#endif
+#ifndef _SV_TIMER_HXX
+#include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+//.........................................................................
+namespace frm
+{
+
+//==================================================================
+// OComboBoxModel
+//==================================================================
+class OComboBoxModel
+ :public OBoundControlModel
+ ,public starsdb::XSQLErrorBroadcaster
+ ,public ::utl::OAggregationArrayUsageHelper< OComboBoxModel >
+{
+ staruno::Reference m_xFormatter;
+ starform::ListSourceType m_eListSourceType; // type der list source
+ staruno::Any m_aBoundColumn; // obsolet
+ ::rtl::OUString m_aListSource; //
+ ::rtl::OUString m_aDefaultText; // DefaultText
+ ::rtl::OUString m_aSaveValue;
+ sal_Int32 m_nFormatKey;
+ Date m_aNullDate;
+ sal_Int32 m_nFieldType;
+ sal_Int16 m_nKeyType;
+ sal_Bool m_bEmptyIsNull; // LeerString wird als NULL interpretiert
+
+ ::cppu::OInterfaceContainerHelper m_aErrorListeners;
+
+ static sal_Int32 nTextHandle;
+
+protected:
+ virtual void _onValueChanged();
+ virtual staruno::Sequence _getTypes();
+
+public:
+ OComboBoxModel(const staruno::Reference& _rxFactory);
+ ~OComboBoxModel();
+
+ virtual void SAL_CALL disposing();
+
+ // OPropertySetHelper
+ virtual void SAL_CALL getFastPropertyValue(staruno::Any& rValue, sal_Int32 nHandle) const;
+ virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const staruno::Any& rValue )
+ throw (staruno::Exception);
+ virtual sal_Bool SAL_CALL convertFastPropertyValue(
+ staruno::Any& _rConvertedValue, staruno::Any& _rOldValue, sal_Int32 _nHandle, const staruno::Any& _rValue )
+ throw (starlang::IllegalArgumentException);
+
+ // XLoadListener
+ virtual void _loaded(const starlang::EventObject& rEvent);
+ virtual void _unloaded();
+
+ virtual void SAL_CALL reloaded( const starlang::EventObject& aEvent ) throw(staruno::RuntimeException);
+
+ // XServiceInfo
+ IMPLEMENTATION_NAME(OComboBoxModel);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
+
+ // UNO
+ DECLARE_UNO3_AGG_DEFAULTS(OComboBoxModel, OBoundControlModel);
+ virtual staruno::Any SAL_CALL queryAggregation( const staruno::Type& _rType ) throw (staruno::RuntimeException);
+
+ // XBoundComponent
+ virtual sal_Bool _commit();
+
+ // XPropertySet
+ virtual staruno::Reference SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
+ virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // XPersistObject
+ virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
+ virtual void SAL_CALL
+ write(const staruno::Reference& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
+ virtual void SAL_CALL
+ read(const staruno::Reference& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
+
+ // XReset
+ virtual void _reset();
+
+ // XSQLErrorBroadcaster
+ virtual void SAL_CALL addSQLErrorListener(const staruno::Reference& _rxListener) throw(staruno::RuntimeException);
+ virtual void SAL_CALL removeSQLErrorListener(const staruno::Reference& _rxListener) throw(staruno::RuntimeException);
+
+ // OAggregationArrayUsageHelper
+ virtual void fillProperties(
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
+ ) const;
+ IMPLEMENT_INFO_SERVICE()
+
+protected:
+ void loadData();
+
+ void onError(starsdbc::SQLException& _rException, const ::rtl::OUString& _rContextDescription);
+};
+
+//==================================================================
+// OComboBoxControl
+//==================================================================
+
+class OComboBoxControl : public OBoundControl
+{
+public:
+ OComboBoxControl(const staruno::Reference& _rxFactory);
+
+ // XServiceInfo
+ IMPLEMENTATION_NAME(OComboBoxControl);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
+};
+
+//.........................................................................
+}
+//.........................................................................
+
+#endif // _FORMS_COMBOBOX_HXX_
+
diff --git a/forms/source/component/Currency.cxx b/forms/source/component/Currency.cxx
new file mode 100644
index 000000000000..f06d300a92fc
--- /dev/null
+++ b/forms/source/component/Currency.cxx
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * $RCSfile: Currency.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_CURRENCY_HXX_
+#include "Currency.hxx"
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include
+#endif
+#ifndef _TOOLS_INTN_HXX
+#include
+#endif
+
+//.........................................................................
+namespace frm
+{
+//.........................................................................
+
+//==================================================================
+// OCurrencyControl
+//==================================================================
+//------------------------------------------------------------------
+OCurrencyControl::OCurrencyControl(const staruno::Reference& _rxFactory)
+ :OBoundControl(_rxFactory, VCL_CONTROL_CURRENCYFIELD)
+{
+}
+
+//------------------------------------------------------------------
+InterfaceRef SAL_CALL OCurrencyControl_CreateInstance(const staruno::Reference& _rxFactory)
+{
+ return *(new OCurrencyControl(_rxFactory));
+}
+
+//------------------------------------------------------------------------------
+staruno::Sequence 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 staruno::Reference& _rxFactory)
+{
+ return *(new OCurrencyModel(_rxFactory));
+}
+
+//------------------------------------------------------------------------------
+staruno::Sequence OCurrencyModel::_getTypes()
+{
+ return OEditBaseModel::_getTypes();
+}
+
+//------------------------------------------------------------------
+OCurrencyModel::OCurrencyModel(const staruno::Reference& _rxFactory)
+ :OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_CURRENCYFIELD, FRM_CONTROL_CURRENCYFIELD)
+ // use the old control name for compytibility reasons
+{
+ m_nClassId = starform::FormComponentType::CURRENCYFIELD;
+ m_sDataFieldConnectivityProperty = PROPERTY_VALUE;
+ if (OCurrencyModel::nValueHandle == -1)
+ OCurrencyModel::nValueHandle = getOriginalHandle(PROPERTY_ID_VALUE);
+
+ if (m_xAggregateSet.is())
+ {
+ try
+ {
+ // get the system international informations
+ International aSystemIntl(LANGUAGE_SYSTEM);
+ ::rtl::OUString sCurrencySymbol;
+ sal_Bool bPrependCurrencySymbol;
+ switch (aSystemIntl.GetCurrPositiveFormat())
+ {
+ case 0: // $1
+ sCurrencySymbol = UniString(aSystemIntl.GetCurrSymbol());
+ bPrependCurrencySymbol = sal_True;
+ break;
+ case 1: // 1$
+ sCurrencySymbol = UniString(aSystemIntl.GetCurrSymbol());
+ bPrependCurrencySymbol = sal_False;
+ break;
+ case 2: // $ 1
+ sCurrencySymbol = ::rtl::OUString(UniString(aSystemIntl.GetCurrSymbol())) + ::rtl::OUString::createFromAscii(" ");
+ bPrependCurrencySymbol = sal_True;
+ break;
+ case 3: // 1 $
+ sCurrencySymbol = ::rtl::OUString::createFromAscii(" ") + ::rtl::OUString(UniString(aSystemIntl.GetCurrSymbol()));
+ bPrependCurrencySymbol = sal_False;
+ break;
+ }
+ if (sCurrencySymbol.getLength())
+ {
+ m_xAggregateSet->setPropertyValue(PROPERTY_CURRENCYSYMBOL, staruno::makeAny(sCurrencySymbol));
+ m_xAggregateSet->setPropertyValue(PROPERTY_CURRSYM_POSITION, staruno::makeAny(bPrependCurrencySymbol));
+ }
+ }
+ catch(...)
+ {
+ }
+ }
+}
+
+//------------------------------------------------------------------
+OCurrencyModel::~OCurrencyModel()
+{
+}
+
+// starlang::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] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseCurrencyField");
+ pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_CURRENCYFIELD;
+ return aSupported;
+}
+
+//------------------------------------------------------------------------------
+staruno::Reference SAL_CALL OCurrencyModel::getPropertySetInfo() throw( staruno::RuntimeException )
+{
+ staruno::Reference xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+}
+
+//------------------------------------------------------------------------------
+void OCurrencyModel::fillProperties(
+ staruno::Sequence< starbeans::Property >& _rProps,
+ staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
+{
+ FRM_BEGIN_PROP_HELPER(10)
+ // Value auf transient setzen
+// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_VALUE, starbeans::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_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
+ DECL_IFACE_PROP2(BOUNDFIELD, starbeans::XPropertySet, READONLY, TRANSIENT);
+ DECL_IFACE_PROP2(CONTROLLABEL, starbeans::XPropertySet, BOUND, MAYBEVOID);
+ DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
+ FRM_END_PROP_HELPER();
+}
+
+//------------------------------------------------------------------------------
+::cppu::IPropertyArrayHelper& OCurrencyModel::getInfoHelper()
+{
+ return *const_cast(this)->getArrayHelper();
+}
+
+//------------------------------------------------------------------------------
+::rtl::OUString SAL_CALL OCurrencyModel::getServiceName()
+{
+ return FRM_COMPONENT_CURRENCYFIELD; // old (non-sun) name for compatibility !
+}
+
+// starform::XBoundComponent
+//------------------------------------------------------------------------------
+sal_Bool OCurrencyModel::_commit()
+{
+ staruno::Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OCurrencyModel::nValueHandle );
+ if (!compare(aNewValue, m_aSaveValue))
+ {
+ if (aNewValue.getValueType().getTypeClass() == staruno::TypeClass_VOID)
+ m_xColumnUpdate->updateNull();
+ else
+ {
+ try
+ {
+ m_xColumnUpdate->updateDouble(getDouble(aNewValue));
+ }
+ catch(...)
+ {
+ 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);
+ }
+}
+
+// starform::XReset
+//------------------------------------------------------------------------------
+void OCurrencyModel::_reset( void )
+{
+ staruno::Any aValue;
+ if (m_aDefault.getValueType().getTypeClass() == staruno::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
+//.........................................................................
+
diff --git a/forms/source/component/Currency.hxx b/forms/source/component/Currency.hxx
new file mode 100644
index 000000000000..6ebab3bddb20
--- /dev/null
+++ b/forms/source/component/Currency.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: Currency.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:04 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _FORMS_CURRENCY_HXX_
+#define _FORMS_CURRENCY_HXX_
+
+#ifndef _FORMS_EDITBASE_HXX_
+#include "EditBase.hxx"
+#endif
+
+//.........................................................................
+namespace frm
+{
+//.........................................................................
+
+//==================================================================
+//= OCurrencyModel
+//==================================================================
+class OCurrencyModel
+ :public OEditBaseModel
+ ,public ::utl::OAggregationArrayUsageHelper< OCurrencyModel >
+{
+ staruno::Any m_aSaveValue;
+
+ static sal_Int32 nValueHandle;
+
+protected:
+ virtual void _onValueChanged();
+ virtual staruno::Sequence _getTypes();
+
+public:
+ OCurrencyModel(const staruno::Reference& _rxFactory);
+ virtual ~OCurrencyModel();
+
+ // starform::XBoundComponent
+ virtual sal_Bool _commit();
+
+ // starlang::XServiceInfo
+ IMPLEMENTATION_NAME(OCurrencyModel);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
+
+ // staruno::Reference
+ virtual staruno::Reference SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
+
+ // stario::XPersistObject
+ virtual ::rtl::OUString SAL_CALL getServiceName();
+
+ // starform::XReset
+ virtual void _reset();
+
+ // OAggregationArrayUsageHelper
+ virtual void fillProperties(
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
+ staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
+ ) const;
+ IMPLEMENT_INFO_SERVICE()
+};
+
+//==================================================================
+//= OCurrencyControl
+//==================================================================
+class OCurrencyControl: public OBoundControl
+{
+protected:
+ virtual staruno::Sequence _getTypes();
+
+public:
+ OCurrencyControl(const staruno::Reference& _rxFactory);
+ // starlang::XServiceInfo
+ IMPLEMENTATION_NAME(OCurrencyControl);
+ virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
+};
+
+//.........................................................................
+} // namespace frm
+//.........................................................................
+
+#endif // _FORMS_CURRENCY_HXX_
+
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
new file mode 100644
index 000000000000..5decff5ff1f8
--- /dev/null
+++ b/forms/source/component/DatabaseForm.cxx
@@ -0,0 +1,3904 @@
+/*************************************************************************
+ *
+ * $RCSfile: DatabaseForm.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:29:05 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include
+
+#ifndef _FRM_DATABASEFORM_HXX_
+#include "DatabaseForm.hxx"
+#endif
+#ifndef _FRM_EVENT_THREAD_HXX_
+#include "EventThread.hxx"
+#endif
+#ifndef _FORMS_LISTBOX_HXX_
+#include "ListBox.hxx"
+#endif
+#ifndef _FRM_RESOURCE_HXX_
+#include "frm_resource.hxx"
+#endif
+#ifndef _FRM_RESOURCE_HRC_
+#include "frm_resource.hrc"
+#endif
+
+#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSERFACTORY_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_UTIL_XCANCELLABLE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_DATA_DATABASECURSORTYPE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETTYPE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDBC_RESULTSETCONCURRENCY_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FORM_DATASELECTIONTYPE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDB_SQLCONTEXT_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCHPROVIDER_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FRAME_FRAMESEARCHFLAG_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XDISPATCH_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDB_COMMANDTYPE_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDB_ROWSETVETOEXCEPTION_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDB_XPARAMETERSSUPPLIER_HPP_
+#include
+#endif
+#ifndef _COM_SUN_STAR_SDBCX_PRIVILEGE_HPP_
+#include