initial import

This commit is contained in:
Jens-Heiner Rechtien
2000-09-18 15:33:13 +00:00
parent 95117e7fef
commit bf4154eb53
74 changed files with 27360 additions and 0 deletions

6
forms/prj/d.lst Normal file
View File

@@ -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

View File

@@ -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_

View File

@@ -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 <tools/debug.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= OButtonModel
//==================================================================
DBG_NAME(OButtonModel)
//------------------------------------------------------------------
InterfaceRef SAL_CALL OButtonModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OButtonModel(_rxFactory));
}
//------------------------------------------------------------------
OButtonModel::OButtonModel(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starbeans::XPropertySetInfo> SAL_CALL OButtonModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> 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<OButtonModel*>(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<stario::XObjectOutputStream>& _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<stario::XObjectInputStream>& _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<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OButtonControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OButtonControl::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my base class
staruno::Sequence<staruno::Type> aBaseClassTypes = OImageControl::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(2);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starawt::XButton>*)NULL);
pOwnTypes[1] = getCppuType((staruno::Reference<starawt::XActionListener>*)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<starlang::XMultiServiceFactory>& _rxFactory)
:OImageControl(_rxFactory, VCL_CONTROL_COMMANDBUTTON)
,nClickEvent(0)
{
increment(m_refCount);
{
// als ActionListener anmelden
staruno::Reference<starawt::XButton> xButton;
query_aggregation( m_xAggregate, xButton);
if (xButton.is())
xButton->addActionListener(this);
}
// Refcount bei 1 fuer Listener
sal_Int32 n = decrement(m_refCount);
}
//------------------------------------------------------------------------------
OButtonControl::~OButtonControl()
{
if (nClickEvent)
Application::RemoveUserEvent(nClickEvent);
}
// UNO Anbindung
//------------------------------------------------------------------------------
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<starawt::XActionListener*>(this)
,static_cast<starawt::XButton*>(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<starbeans::XPropertySet> 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<staruno::XWeak*>(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<starawt::XButton> 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<starawt::XButton> xButton;
query_aggregation( m_xAggregate, xButton);
if (xButton.is())
xButton->setActionCommand(_rCommand);
}
//------------------------------------------------------------------------------
void SAL_CALL OButtonControl::addActionListener(const staruno::Reference<starawt::XActionListener>& _rxListener) throw( staruno::RuntimeException )
{
m_aActionListeners.addInterface(_rxListener);
}
//------------------------------------------------------------------------------
void SAL_CALL OButtonControl::removeActionListener(const staruno::Reference<starawt::XActionListener>& _rxListener) throw( staruno::RuntimeException )
{
m_aActionListeners.removeInterface(_rxListener);
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -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 <com/sun/star/awt/MouseEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_EVENTOBJECT_HPP_
#include <com/sun/star/lang/EventObject.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_ACTIONEVENT_HPP_
#include <com/sun/star/awt/ActionEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XACTIONLISTENER_HPP_
#include <com/sun/star/awt/XActionListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XBUTTON_HPP_
#include <com/sun/star/awt/XButton.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OButtonModel
//==================================================================
class OButtonModel
:public OImageModel
,public ::utl::OAggregationArrayUsageHelper<OButtonModel>
{
public:
OButtonModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
~OButtonModel();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OButtonModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// staruno::Reference<starbeans::XPropertySet>
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _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<staruno::Type> _getTypes();
public:
OButtonControl(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starawt::XActionListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeActionListener(const staruno::Reference<starawt::XActionListener>& _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_

View File

@@ -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 <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//==================================================================
//= OCheckBoxControl
//==================================================================
//------------------------------------------------------------------
OCheckBoxControl::OCheckBoxControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_CHECKBOX)
{
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL OCheckBoxControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new OCheckBoxModel(_rxFactory));
}
//------------------------------------------------------------------
OCheckBoxModel::OCheckBoxModel(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starbeans::XPropertySetInfo> SAL_CALL OCheckBoxModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OCheckBoxModel::getInfoHelper()
{
return *const_cast<OCheckBoxModel*>(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<stario::XObjectOutputStream>& _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<stario::XObjectInputStream>& _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;
}
//.........................................................................
}
//.........................................................................

View File

@@ -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 <unotools/propmultiplex.hxx>
#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<starlang::XMultiServiceFactory>& _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<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _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<starlang::XMultiServiceFactory>& _rxFactory);
// XServiceInfo
IMPLEMENTATION_NAME(OCheckBoxControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_CHECKBOX_HXX_

View File

@@ -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 <com/sun/star/io/XPersistObject.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectOutputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectInputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
#include <com/sun/star/io/XMarkableStream.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORMCOMPONENT_HPP_
#include <com/sun/star/form/XFormComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _UTL_SEQUENCE_HXX_
#include <unotools/sequence.hxx>
#endif
#ifndef _UTL_PROPERTY_HXX_
#include <unotools/property.hxx>
#endif
#ifndef _UTL_BASIC_IO_HXX_
#include <unotools/basicio.hxx>
#endif
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _FRM_RESOURCE_HRC_
#include "frm_resource.hrc"
#endif
#ifndef _TOOLS_DEBUG_HXX //autogen
#include <tools/debug.hxx>
#endif
#ifndef _RTL_UUID_H_
#include <rtl/uuid.h>
#endif
#ifndef _RTL_MEMORY_H_
#include <rtl/memory.h>
#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<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OGridColumn(_rxFactory));
}
//------------------------------------------------------------------
const staruno::Sequence<sal_Int8>& 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<sal_Int8>& _rIdentifier) throw(staruno::RuntimeException)
{
sal_Int64 nReturn(0);
if ( (_rIdentifier.getLength() == 16)
&& (0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
)
{
nReturn = reinterpret_cast<sal_Int64>(this);
}
else
{
staruno::Reference<starlang::XUnoTunnel> xAggregateTunnel(m_xAggregate, staruno::UNO_QUERY);
if (xAggregateTunnel.is())
nReturn = xAggregateTunnel->getSomething(_rIdentifier);
}
return nReturn;
}
//------------------------------------------------------------------
staruno::Sequence<sal_Int8> SAL_CALL OGridColumn::getImplementationId() throw(staruno::RuntimeException)
{
return OImplementationIds::getImplementationId(getTypes());
}
//------------------------------------------------------------------
staruno::Sequence<staruno::Type> SAL_CALL OGridColumn::getTypes() throw(staruno::RuntimeException)
{
staruno::Sequence<staruno::Type> aOwnTypes(5);
aOwnTypes.getArray()[0] = ::getCppuType((staruno::Reference<starbeans::XPropertySet>*)NULL);
aOwnTypes.getArray()[1] = ::getCppuType((staruno::Reference<starbeans::XFastPropertySet>*)NULL);
aOwnTypes.getArray()[2] = ::getCppuType((staruno::Reference<starbeans::XMultiPropertySet>*)NULL);
aOwnTypes.getArray()[3] = ::getCppuType((staruno::Reference<starbeans::XPropertyState>*)NULL);
aOwnTypes.getArray()[4] = ::getCppuType((staruno::Reference<starcontainer::XChild>*)NULL);
staruno::Reference<starlang::XTypeProvider> 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<starcontainer::XChild*>(this),
static_cast<starlang::XUnoTunnel*>(this),
static_cast<starform::XFormComponent*>(NULL),
// though our aggregate may be an XFormComponent, we aren't anymore
static_cast<starlang::XServiceInfo*>(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<starlang::XMultiServiceFactory>& _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<6D> !
{
m_xAggregate = staruno::Reference<staruno::XAggregation> (_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<starlang::XEventListener> xEvtLstner;
if (query_aggregation(m_xAggregate, xEvtLstner))
xEvtLstner->disposing(_rSource);
}
// OComponentHelper
//-----------------------------------------------------------------------------
void OGridColumn::disposing()
{
OComponentHelper::disposing();
OPropertySetAggregationHelper::disposing();
staruno::Reference<starlang::XComponent> xComp;
if (query_aggregation(m_xAggregate, xComp))
xComp->dispose();
setParent(InterfaceRef ());
}
//------------------------------------------------------------------------------
void OGridColumn::clearAggregateProperties(staruno::Sequence<starbeans::Property>& seqProps, sal_Bool bAllowDropDown)
{
RemoveProperty(seqProps, PROPERTY_ALIGN);
RemoveProperty(seqProps, PROPERTY_AUTOCOMPLETE);
RemoveProperty(seqProps, PROPERTY_BACKGROUNDCOLOR);
RemoveProperty(seqProps, PROPERTY_BORDER);
if (!bAllowDropDown)
RemoveProperty(seqProps, PROPERTY_DROPDOWN);
RemoveProperty(seqProps, PROPERTY_ECHO_CHAR);
RemoveProperty(seqProps, PROPERTY_FILLCOLOR);
RemoveProperty(seqProps, PROPERTY_FONT);
RemoveProperty(seqProps, PROPERTY_FONT_NAME);
RemoveProperty(seqProps, PROPERTY_FONT_STYLENAME);
RemoveProperty(seqProps, PROPERTY_FONT_FAMILY);
RemoveProperty(seqProps, PROPERTY_FONT_CHARSET);
RemoveProperty(seqProps, PROPERTY_FONT_HEIGHT);
RemoveProperty(seqProps, PROPERTY_FONT_WEIGHT);
RemoveProperty(seqProps, PROPERTY_FONT_SLANT);
RemoveProperty(seqProps, PROPERTY_FONT_UNDERLINE);
RemoveProperty(seqProps, PROPERTY_FONT_STRIKEOUT);
RemoveProperty(seqProps, PROPERTY_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<starbeans::Property>& 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<starbeans::XPropertySet>
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OGridColumn::getPropertySetInfo() throw(staruno::RuntimeException)
{
DBG_ERROR("OGridColumn::getPropertySetInfo() : Dummy Called");
return staruno::Reference<starbeans::XPropertySetInfo> ();
}
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& OGridColumn::getInfoHelper()
{
DBG_ERROR("OGridColumn::getInfoHelper() : Dummy Called");
staruno::Sequence<starbeans::Property> 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<stario::XObjectOutputStream>& _rxOutStream)
{
// 1. Schreiben des UnoControls
staruno::Reference<stario::XMarkableStream> xMark(_rxOutStream, staruno::UNO_QUERY);
sal_Int32 nMark = xMark->createMark();
sal_Int32 nLen = 0;
_rxOutStream->writeLong(nLen);
staruno::Reference<stario::XPersistObject> xPersist;
if (query_aggregation(m_xAggregate, xPersist))
xPersist->write(_rxOutStream);
// feststellen der Laenge
nLen = xMark->offsetToMark(nMark) - 4;
xMark->jumpToMark(nMark);
_rxOutStream->writeLong(nLen);
xMark->jumpToFurthest();
xMark->deleteMark(nMark);
// 2. Schreiben einer VersionsNummer
_rxOutStream->writeShort(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<stario::XObjectInputStream>& _rxInStream)
{
// 1. Lesen des UnoControls
sal_Int32 nLen = _rxInStream->readLong();
if (nLen)
{
staruno::Reference<stario::XMarkableStream> xMark(_rxInStream, staruno::UNO_QUERY);
sal_Int32 nMark = xMark->createMark();
staruno::Reference<stario::XPersistObject> xPersist;
if (query_aggregation(m_xAggregate, xPersist))
xPersist->read(_rxInStream);
xMark->jumpToMark(nMark);
_rxInStream->skipBytes(nLen);
xMark->deleteMark(nMark);
}
// 2. Lesen des Versionsnummer
sal_uInt16 nVersion = _rxInStream->readShort();
sal_uInt16 nAnyMask = _rxInStream->readShort();
if (nAnyMask & WIDTH)
{
sal_Int32 nValue = _rxInStream->readLong();
m_aWidth <<= (sal_Int32)nValue;
}
if (nAnyMask & ALIGN)
{
sal_Int16 nValue = _rxInStream->readShort();
m_aAlign <<= nValue;
}
if (nAnyMask & OLD_HIDDEN)
{
sal_Bool bValue = _rxInStream->readBoolean();
m_aHidden <<= (sal_Bool)bValue;
}
// Name
_rxInStream >> m_aLabel;
if (nAnyMask & COMPATIBLE_HIDDEN)
{
sal_Bool bValue = _rxInStream->readBoolean();
m_aHidden <<= (sal_Bool)bValue;
}
}
//------------------------------------------------------------------------------
IMPL_COLUMN(TextFieldColumn, FRM_SUN_COMPONENT_TEXTFIELD, sal_False);
IMPL_COLUMN(PatternFieldColumn, FRM_SUN_COMPONENT_PATTERNFIELD, sal_False);
IMPL_COLUMN(DateFieldColumn, FRM_SUN_COMPONENT_DATEFIELD, sal_True);
IMPL_COLUMN(TimeFieldColumn, FRM_SUN_COMPONENT_TIMEFIELD, sal_False);
IMPL_COLUMN(NumericFieldColumn, FRM_SUN_COMPONENT_NUMERICFIELD, sal_False);
IMPL_COLUMN(CurrencyFieldColumn, FRM_SUN_COMPONENT_CURRENCYFIELD, sal_False);
IMPL_COLUMN(CheckBoxColumn, FRM_SUN_COMPONENT_CHECKBOX, sal_False);
IMPL_COLUMN(ComboBoxColumn, FRM_SUN_COMPONENT_COMBOBOX, sal_False);
IMPL_COLUMN(ListBoxColumn, FRM_SUN_COMPONENT_LISTBOX, sal_False);
IMPL_COLUMN(FormattedFieldColumn, FRM_SUN_COMPONENT_FORMATTEDFIELD, sal_False);
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -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 <cppuhelper/component.hxx>
#endif
#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_
#include <unotools/proparrhlp.hxx>
#endif
#ifndef _UNOTOOLS_PROPERTY_AGGREGATION_HXX_
#include <unotools/propagg.hxx>
#endif
#ifndef _UTL_UNO3_HXX_
#include <unotools/uno3.hxx>
#endif
#include "strings.hxx"
#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
#include <com/sun/star/container/XChild.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectOutputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectInputStream.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_
#include <com/sun/star/lang/XUnoTunnel.hpp>
#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<staruno::XAggregation> m_xAggregate;
::rtl::OUString m_aModelName;
// [properties]
::rtl::OUString m_aLabel; // Name der Spalte
// [properties]
public:
OGridColumn(const staruno::Reference<starlang::XMultiServiceFactory>& _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<sal_Int8>& getUnoTunnelImplementationId();
// XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const staruno::Sequence<sal_Int8>& _rIdentifier) throw(staruno::RuntimeException);
// XTypeProvider
virtual staruno::Sequence<sal_Int8> SAL_CALL getImplementationId() throw(staruno::RuntimeException);
virtual staruno::Sequence<staruno::Type> 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<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<starbeans::Property>& seqProps, sal_Bool bAllowDropDown);
static void setOwnProperties(staruno::Sequence<starbeans::Property>& seqProps);
};
#define DECL_COLUMN(ClassName) \
class ClassName \
:public OGridColumn \
,public OAggregationArrayUsageHelper< ClassName > \
{ \
public: \
ClassName(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);\
\
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<starlang::XMultiServiceFactory>& _rxFactory) \
:OGridColumn(_rxFactory, Model){} \
staruno::Reference<starbeans::XPropertySetInfo> ClassName::getPropertySetInfo() throw(staruno::RuntimeException)\
{ \
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) ); \
return xInfo; \
} \
::cppu::IPropertyArrayHelper& ClassName::getInfoHelper() \
{ \
return *const_cast<ClassName*>(this)->getArrayHelper(); \
} \
void ClassName::fillProperties( \
::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rProps, \
::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& /* [out] */ _rAggregateProps \
) const \
{ \
if (m_xAggregateSet.is()) \
{ \
_rAggregateProps = m_xAggregateSet->getPropertySetInfo()->getProperties(); \
clearAggregateProperties(_rAggregateProps, bAllowDropDown); \
setOwnProperties(_rProps); \
} \
} \
// liste der moeglichen Controls
DECLARE_CONSTASCII_USTRING(FRM_COL_TEXTFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COL_CHECKBOX);
DECLARE_CONSTASCII_USTRING(FRM_COL_COMBOBOX);
DECLARE_CONSTASCII_USTRING(FRM_COL_LISTBOX);
DECLARE_CONSTASCII_USTRING(FRM_COL_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COL_DATEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COL_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COL_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COL_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COL_FORMATTEDFIELD);
// column type ids
#define TYPE_CHECKBOX 0
#define TYPE_COMBOBOX 1
#define TYPE_CURRENCYFIELD 2
#define TYPE_DATEFIELD 3
#define TYPE_FORMATTEDFIELD 4
#define TYPE_LISTBOX 5
#define TYPE_NUMERICFIELD 6
#define TYPE_PATTERNFIELD 7
#define TYPE_TEXTFIELD 8
#define TYPE_TIMEFIELD 9
// liste aller bekannten columns
const StringSequence& getColumnTypes();
sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName);
// Columns
DECL_COLUMN(TextFieldColumn)
DECL_COLUMN(PatternFieldColumn)
DECL_COLUMN(DateFieldColumn)
DECL_COLUMN(TimeFieldColumn)
DECL_COLUMN(NumericFieldColumn)
DECL_COLUMN(CurrencyFieldColumn)
DECL_COLUMN(CheckBoxColumn)
DECL_COLUMN(ComboBoxColumn)
DECL_COLUMN(ListBoxColumn)
DECL_COLUMN(FormattedFieldColumn)
#endif // _FRM_COLUMNS_HXX
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -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 <tools/debug.hxx>
#endif
#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
#include <cppuhelper/queryinterface.hxx>
#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 <unotools/numbers.hxx>
#endif
#ifndef _UNOTOOLS_DATETIME_HXX_
#include <unotools/datetime.hxx>
#endif
#ifndef _UTL_UNO3_DB_TOOLS_HXX_
#include <unotools/dbtools.hxx>
#endif
#ifndef _UTL_DB_CONVERSION_HXX_
#include <unotools/dbconversion.hxx>
#endif
#ifndef _COM_SUN_STAR_SDB_SQLERROREVENT_HPP_
#include <com/sun/star/sdb/SQLErrorEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
#include <com/sun/star/sdbc/XRowSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XSQLQUERYCOMPOSERFACTORY_HPP_
#include <com/sun/star/sdb/XSQLQueryComposerFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
#include <com/sun/star/sdb/XQueriesSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
#include <com/sun/star/util/NumberFormat.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XLISTBOX_HPP_
#include <com/sun/star/awt/XListBox.hpp>
#endif
//.........................................................................
namespace frm
{
//========================================================================
// class OComboBoxModel
//========================================================================
sal_Int32 OComboBoxModel::nTextHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL OComboBoxModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return (*new OComboBoxModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OComboBoxModel::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my two base classes
staruno::Sequence<staruno::Type> aBaseClassTypes = OBoundControlModel::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starsdb::XSQLErrorBroadcaster>*)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<starsdb::XSQLErrorBroadcaster*>(this)
);
return aReturn;
}
//------------------------------------------------------------------
OComboBoxModel::OComboBoxModel(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starform::ListSourceType*>(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<starbeans::XPropertySetInfo> SAL_CALL OComboBoxModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OComboBoxModel::getInfoHelper()
{
return *const_cast<OComboBoxModel*>(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<stario::XObjectOutputStream>& _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<stario::XObjectInputStream>& _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<6D> 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<starsdbc::XRowSet> xForm(m_xCursor, staruno::UNO_QUERY);
if (!xForm.is())
return;
staruno::Reference<starsdbc::XConnection> xConnection = getConnection(xForm);
if (!xConnection.is())
return;
// we need a com::sun::star::sdb::Connection for some of the code below ...
staruno::Reference<starlang::XServiceInfo> xServiceInfo(xConnection, staruno::UNO_QUERY);
if (!xServiceInfo.is() || !xServiceInfo->supportsService(SRV_SDB_CONNECTION))
{
DBG_ERROR("OComboBoxModel::loadData : invalid connection !");
return;
}
staruno::Reference<starsdbc::XResultSet> 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<starcontainer::XNameAccess> xFieldsByName = getTableFields(xConnection, m_aListSource);
staruno::Reference<starcontainer::XIndexAccess> 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<starsdb::XSQLQueryComposerFactory> xFactory(xConnection, staruno::UNO_QUERY);
if (!xFactory.is())
break;
staruno::Reference<starsdb::XSQLQueryComposer> xComposer = xFactory->createQueryComposer();
try
{
staruno::Reference<starbeans::XPropertySet> 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<starsdbcx::XColumnsSupplier> xSupplyFields(xComposer, staruno::UNO_QUERY);
DBG_ASSERT(xSupplyFields.is(), "OComboBoxModel::loadData : invalid query composer !");
staruno::Reference<starcontainer::XNameAccess> xFieldNames = xSupplyFields->getColumns();
if (xFieldNames->hasByName(m_aControlSource))
{
staruno::Reference<starbeans::XPropertySet> xComposerFieldAsSet(*(staruno::Reference<starbeans::XPropertySet>*)xFieldNames->getByName(m_aControlSource).getValue());
if (hasProperty(PROPERTY_FIELDSOURCE, xComposerFieldAsSet))
xComposerFieldAsSet->getPropertyValue(PROPERTY_FIELDSOURCE) >>= aFieldName;
}
disposeComponent(xComposer);
}
if (!aFieldName.len())
break;
staruno::Reference<starsdbc::XDatabaseMetaData> xMeta = xConnection->getMetaData();
::rtl::OUString aQuote = xMeta->getIdentifierQuoteString();
::rtl::OUString aStatement = ::rtl::OUString::createFromAscii("SELECT DISTINCT ");
aStatement += quoteName(aQuote, aFieldName);
aStatement += ::rtl::OUString::createFromAscii(" FROM ");
aStatement += quoteTableName(xMeta, m_aListSource);
staruno::Reference<starsdbc::XStatement> xStmt = xConnection->createStatement();
xListCursor = xStmt->executeQuery(aStatement);
} break;
case starform::ListSourceType_QUERY:
{
staruno::Reference<starsdb::XQueriesSupplier> xSupplyQueries(xConnection, staruno::UNO_QUERY);
staruno::Reference<starbeans::XPropertySet> xQuery(*(InterfaceRef*)xSupplyQueries->getQueries()->getByName(m_aListSource).getValue(), staruno::UNO_QUERY);
staruno::Reference<starsdbc::XStatement> xStmt = xConnection->createStatement();
staruno::Reference<starbeans::XPropertySet>(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<starsdbc::XStatement> xStmt = xConnection->createStatement();
if (starform::ListSourceType_SQLPASSTHROUGH == m_eListSourceType)
{
staruno::Reference<starbeans::XPropertySet> 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<starsdbcx::XColumnsSupplier> xSupplyCols(xListCursor, staruno::UNO_QUERY);
DBG_ASSERT(xSupplyCols.is(), "OComboBoxModel::loadData : cursor supports the row set service but is no column supplier ??!");
staruno::Reference<starcontainer::XIndexAccess> xColumns;
if (xSupplyCols.is())
{
xColumns = staruno::Reference<starcontainer::XIndexAccess>(xSupplyCols->getColumns(), staruno::UNO_QUERY);
DBG_ASSERT(xColumns.is(), "OComboBoxModel::loadData : no columns supplied by the row set !");
}
staruno::Reference<starsdb::XColumn> xDataField;
if (xColumns.is())
xDataField = staruno::Reference<starsdb::XColumn>(*(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++<SHRT_MAX)) // max anzahl eintraege
{
aStringList.push_back(DBTypeConversion::getValue(xDataField,
m_xFormatter,
m_aNullDate,
m_nFormatKey,
m_nKeyType));
}
}
break;
case starform::ListSourceType_TABLEFIELDS:
{
staruno::Reference<starcontainer::XNameAccess> xFieldNames = getTableFields(xConnection, m_aListSource);
if (xFieldNames.is())
{
StringSequence seqNames = xFieldNames->getElementNames();
sal_Int32 nFieldsCount = seqNames.getLength();
const ::rtl::OUString* pustrNames = seqNames.getConstArray();
for (sal_Int32 k=0; k<nFieldsCount; ++k)
aStringList.push_back(pustrNames[k]);
}
}
break;
}
}
catch(starsdbc::SQLException& eSQL)
{
onError(eSQL, FRM_RES_STRING(RID_BASELISTBOX_ERROR_FILLLIST));
disposeComponent(xListCursor);
return;
}
catch(staruno::Exception& eUnknown)
{
eUnknown;
disposeComponent(xListCursor);
return;
}
// String-staruno::Sequence fuer ListBox erzeugen
StringSequence aStringSeq(aStringList.size());
::rtl::OUString* pStringAry = aStringSeq.getArray();
for (sal_Int32 i = 0; i<aStringSeq.getLength(); ++i)
pStringAry[i] = aStringList[i];
// String-staruno::Sequence an ListBox setzen
m_xAggregateSet->setPropertyValue(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<starsdbc::XRowSet> xRowSet(rEvent.Source, staruno::UNO_QUERY);
DBG_ASSERT(xRowSet.is(), "OComboBoxModel::_loaded : invalid event source !");
staruno::Reference<starutil::XNumberFormatsSupplier> xSupplier = getNumberFormats(getConnection(xRowSet), sal_False, m_xServiceFactory);
if (xSupplier.is())
{
m_xFormatter = staruno::Reference<starutil::XNumberFormatter>(
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<StringSequence*>(NULL))))
{
StringSequence aStringItemList = *(StringSequence*)aAnyList.getValue();
const ::rtl::OUString* pStringItems = aStringItemList.getConstArray();
sal_Int32 i;
for (i=0; i<aStringItemList.getLength(); ++i, ++pStringItems)
{
if (pStringItems->equals(aNewValue))
break;
}
// not found -> add
if (i >= aStringItemList.getLength())
{
sal_Int32 nOldLen = aStringItemList.getLength();
aStringItemList.realloc(nOldLen + 1);
::rtl::OUString* pStringItems = aStringItemList.getArray() + nOldLen;
*pStringItems = aNewValue;
aAnyList <<= aStringItemList;
m_xAggregateSet->setPropertyValue(PROPERTY_STRINGITEMLIST, aAnyList);
}
}
return sal_True;
}
// XPropertiesChangeListener
//------------------------------------------------------------------------------
void OComboBoxModel::_onValueChanged()
{
// release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// and in this special case do it before calling DBTypeConversion::getValue, as this uses the number formatter
// which's implementation locks the SM, too :(
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
DBG_ASSERT(m_xColumn.is(), "OComboBoxModel::_onValueChanged : have no column !");
m_aSaveValue = DBTypeConversion::getValue(m_xColumn,
m_xFormatter,
m_aNullDate,
m_nFormatKey,
m_nKeyType);
m_xAggregateFastSet->setFastPropertyValue(OComboBoxModel::nTextHandle, 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<starsdb::XSQLErrorListener>& _rxListener) throw(staruno::RuntimeException)
{
m_aErrorListeners.addInterface(_rxListener);
}
//------------------------------------------------------------------------------
void SAL_CALL OComboBoxModel::removeSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _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<staruno::XWeak*>(this), _rContextDescription);
if (m_aErrorListeners.getLength())
{
starsdb::SQLErrorEvent aEvent(static_cast<staruno::XWeak*>(this), staruno::makeAny(aError));
::cppu::OInterfaceIteratorHelper aIter(m_aErrorListeners);
while (aIter.hasMoreElements())
static_cast<starsdb::XSQLErrorListener*>(aIter.next())->errorOccured(aEvent);
}
}
//========================================================================
//= OComboBoxControl
//========================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OComboBoxControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new OComboBoxControl(_rxFactory));
}
//------------------------------------------------------------------------------
OComboBoxControl::OComboBoxControl(const staruno::Reference<starlang::XMultiServiceFactory>& _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;
}
//.........................................................................
}
//.........................................................................

View File

@@ -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 <cppuhelper/interfacecontainer.hxx>
#endif
#ifndef _DATE_HXX
#include <tools/date.hxx>
#endif
#ifndef _SV_TIMER_HXX
#include <vcl/timer.hxx>
#endif
#include <com/sun/star/util/XRefreshable.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
#include <com/sun/star/form/ListSourceType.hpp>
#include <com/sun/star/awt/XItemListener.hpp>
#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/form/XChangeBroadcaster.hpp>
//.........................................................................
namespace frm
{
//==================================================================
// OComboBoxModel
//==================================================================
class OComboBoxModel
:public OBoundControlModel
,public starsdb::XSQLErrorBroadcaster
,public ::utl::OAggregationArrayUsageHelper< OComboBoxModel >
{
staruno::Reference<starutil::XNumberFormatter> 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<staruno::Type> _getTypes();
public:
OComboBoxModel(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
// XReset
virtual void _reset();
// XSQLErrorBroadcaster
virtual void SAL_CALL addSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _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<starlang::XMultiServiceFactory>& _rxFactory);
// XServiceInfo
IMPLEMENTATION_NAME(OComboBoxControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_COMBOBOX_HXX_

View File

@@ -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 <tools/debug.hxx>
#endif
#ifndef _TOOLS_INTN_HXX
#include <tools/intn.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OCurrencyControl
//==================================================================
//------------------------------------------------------------------
OCurrencyControl::OCurrencyControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_CURRENCYFIELD)
{
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL OCurrencyControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OCurrencyControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OCurrencyControl::_getTypes()
{
return OBoundControl::_getTypes();
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OCurrencyControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_CURRENCYFIELD;
return aSupported;
}
//==================================================================
// OCurrencyModel
//==================================================================
sal_Int32 OCurrencyModel::nValueHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL OCurrencyModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OCurrencyModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OCurrencyModel::_getTypes()
{
return OEditBaseModel::_getTypes();
}
//------------------------------------------------------------------
OCurrencyModel::OCurrencyModel(const staruno::Reference<starlang::XMultiServiceFactory>& _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<starbeans::XPropertySetInfo> SAL_CALL OCurrencyModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> 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<OCurrencyModel*>(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
//.........................................................................

View File

@@ -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<staruno::Type> _getTypes();
public:
OCurrencyModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OCurrencyModel();
// starform::XBoundComponent
virtual sal_Bool _commit();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OCurrencyModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// staruno::Reference<starbeans::XPropertySet>
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<staruno::Type> _getTypes();
public:
OCurrencyControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OCurrencyControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FORMS_CURRENCY_HXX_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,554 @@
/*************************************************************************
*
* $RCSfile: DatabaseForm.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_DATABASEFORM_HXX_
#define _FRM_DATABASEFORM_HXX_
#ifndef _COM_SUN_STAR_SDB_XSQLERRORLISTENER_HPP_
#include <com/sun/star/sdb/XSQLErrorListener.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
#include <com/sun/star/io/XPersistObject.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XSQLERRORBROADCASTER_HPP_
#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_FORMSUBMITMETHOD_HPP_
#include <com/sun/star/form/FormSubmitMethod.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_FORMSUBMITENCODING_HPP_
#include <com/sun/star/form/FormSubmitEncoding.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XSUBMIT_HPP_
#include <com/sun/star/form/XSubmit.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XRESET_HPP_
#include <com/sun/star/form/XReset.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XDATABASEPARAMETERBROADCASTER_HPP_
#include <com/sun/star/form/XDatabaseParameterBroadcaster.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROWSET_HPP_
#include <com/sun/star/sdbc/XRowSet.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBCX_XDELETEROWS_HPP_
#include <com/sun/star/sdbcx/XDeleteRows.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XRESULTSETUPDATE_HPP_
#include <com/sun/star/sdbc/XResultSetUpdate.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XROWSETAPPROVELISTENER_HPP_
#include <com/sun/star/sdb/XRowSetApproveListener.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XROWSETAPPROVEBROADCASTER_HPP_
#include <com/sun/star/sdb/XRowSetApproveBroadcaster.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_NAVIGATIONBARMODE_HPP_
#include <com/sun/star/form/NavigationBarMode.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
#include <com/sun/star/form/XLoadable.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XLOADLISTENER_HPP_
#include <com/sun/star/form/XLoadListener.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XTABCONTROLLERMODEL_HPP_
#include <com/sun/star/awt/XTabControllerModel.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
#include <com/sun/star/script/XEventAttacherManager.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XROWSETLISTENER_HPP_
#include <com/sun/star/sdbc/XRowSetListener.hpp>
#endif
#ifndef _COM_SUN_STAR_SDB_XRESULTSETACCESS_HPP_
#include <com/sun/star/sdb/XResultSetAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XCLOSEABLE_HPP_
#include <com/sun/star/sdbc/XCloseable.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMED_HPP_
#include <com/sun/star/container/XNamed.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XPARAMETERS_HPP_
#include <com/sun/star/sdbc/XParameters.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
#endif
#ifndef _LINK_HXX
#include <tools/link.hxx>
#endif
#ifndef _FRM_INTERFACE_CONTAINER_HXX_
#include "InterfaceContainer.hxx"
#endif
#ifndef _FRM_IDS_HXX_
#include "ids.hxx"
#endif
#ifndef _UNOTOOLS_PROPERTY_AGGREGATION_HXX_
#include <unotools/propagg.hxx>
#endif
#ifndef _UNOTOOLS_PROPERTY_MULTIPLEX_HXX_
#include <unotools/propmultiplex.hxx>
#endif
#ifndef _UTL_UNO3_HXX_
#include <unotools/uno3.hxx>
#endif
#ifndef _UNOTOOLS_GUARDING_HXX_
#include <unotools/guarding.hxx>
#endif
#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_
#include <unotools/proparrhlp.hxx>
#endif
namespace com { namespace sun { namespace star { namespace sdbc {
class SQLException;
} } } }
class Timer;
class INetMIMEMessage;
typedef ::utl::OReusableGuard< ::osl::Mutex > ReusableMutexGuard;
//.........................................................................
namespace frm
{
//.........................................................................
namespace starsdb = ::com::sun::star::sdb;
namespace starsdbc = ::com::sun::star::sdbc;
namespace starsdbcx = ::com::sun::star::sdbcx;
namespace starform = ::com::sun::star::form;
namespace starutil = ::com::sun::star::util;
//========================================================================
//= html tools
//========================================================================
const sal_uInt16 SUCCESSFUL_REPRESENT_TEXT = 0x0001;
const sal_uInt16 SUCCESSFUL_REPRESENT_FILE = 0x0002;
const ::rtl::OUString ALL_COMPONENTS_GROUP_NAME = ::rtl::OUString::createFromAscii("AllComponentGroup");
//------------------------------------------------------------------------------
class HtmlSuccessfulObj
{
public:
::rtl::OUString aName;
::rtl::OUString aValue;
sal_uInt16 nRepresentation;
HtmlSuccessfulObj( const ::rtl::OUString& _rName, const ::rtl::OUString& _rValue,
sal_uInt16 _nRepresent = SUCCESSFUL_REPRESENT_TEXT )
:aName( _rName )
,aValue( _rValue )
,nRepresentation( _nRepresent )
{
}
HtmlSuccessfulObj()
{
}
};
DECLARE_STL_VECTOR(HtmlSuccessfulObj, HtmlSuccessfulObjList);
//========================================================================
class OGroupManager;
class OFormSubmitResetThread;
struct OParameterInfoImpl;
class ODatabaseForm :public OFormComponents
,public OPropertySetAggregationHelper
,public OPropertyChangeListener
,public ::utl::OAggregationArrayUsageHelper<ODatabaseForm>
,public starsdb::XSQLErrorBroadcaster
// service com::sun::star::form::component::Form (supported by com::sun::star::form::component::DataForm)
,public starform::XForm
,public starawt::XTabControllerModel
// already present (via OFormComponents) : com::sun::star::script::XEventAttacherManager
// service com::sun::star::form::component::HTMLForm
,public starform::XReset
,public starform::XSubmit
// other stuff (new or re-routed interfaces)
,public starform::XLoadListener
,public starform::XLoadable
,public starsdbc::XCloseable
,public starsdbc::XRowSet
,public starsdbc::XRowSetListener
,public starsdb::XRowSetApproveListener
,public starsdb::XRowSetApproveBroadcaster
,public starsdbc::XResultSetUpdate
,public starsdbcx::XDeleteRows
,public starsdbc::XParameters
,public starform::XDatabaseParameterBroadcaster
// already preset (via OFormComponents) : stario::XPersistObject
,public starsdb::XSQLErrorListener
,public starcontainer::XNamed
,public starlang::XServiceInfo
{
friend class OFormSubmitResetThread;
OImplementationIdsRef m_aHoldIdHelper;
// listener administration
::cppu::OInterfaceContainerHelper m_aLoadListeners;
::cppu::OInterfaceContainerHelper m_aRowSetApproveListeners;
::cppu::OInterfaceContainerHelper m_aRowSetListeners;
::cppu::OInterfaceContainerHelper m_aParameterListeners;
::cppu::OInterfaceContainerHelper m_aResetListeners;
::cppu::OInterfaceContainerHelper m_aSubmitListeners;
::cppu::OInterfaceContainerHelper m_aErrorListeners;
staruno::Any m_aCycle;
StringSequence m_aMasterFields;
StringSequence m_aDetailFields;
::std::vector<bool> m_aParameterVisited;
// the object doin' most of the work - an SDB-rowset
staruno::Reference<staruno::XAggregation> m_xAggregate;
// same object, interface as member because of performance reasons
staruno::Reference<starsdbc::XRowSet> m_xAggregateAsRowSet;
// Verwaltung der ControlGruppen
OGroupManager* m_pGroupManager;
OParameterInfoImpl* m_pParameterInfo;
Timer* m_pLoadTimer;
OFormSubmitResetThread* m_pThread;
::rtl::OUString m_sCurrentErrorContext;
// will be used as additional context information
// when an exception is catched and forwarded to the listeners
::osl::Mutex m_aResetSafety;
INT32 m_nResetsPending;
// <overwritten_properties>
sal_Int32 m_nPrivileges;
// </overwritten_properties>
// <properties>
::rtl::OUString m_sName;
::rtl::OUString m_aTargetURL;
::rtl::OUString m_aTargetFrame;
starform::FormSubmitMethod m_eSubmitMethod;
starform::FormSubmitEncoding m_eSubmitEncoding;
starform::NavigationBarMode m_eNavigation;
sal_Bool m_bAllowInsert : 1;
sal_Bool m_bAllowUpdate : 1;
sal_Bool m_bAllowDelete : 1;
// </properties>
sal_Bool m_bLoaded : 1;
sal_Bool m_bSubForm : 1;
public:
ODatabaseForm(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
~ODatabaseForm();
// UNO binding
DECLARE_UNO3_AGG_DEFAULTS(ODatabaseForm, OFormComponents);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// XTypeProvider
virtual staruno::Sequence<staruno::Type> SAL_CALL getTypes( ) throw(staruno::RuntimeException);
virtual staruno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(staruno::RuntimeException);
// starlang::XComponent
virtual void SAL_CALL disposing();
// property handling
virtual staruno::Reference< starbeans::XPropertySetInfo > 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);
staruno::Any SAL_CALL getFastPropertyValue( sal_Int32 nHandle )
throw(starbeans::UnknownPropertyException, starlang::WrappedTargetException, staruno::RuntimeException);
void fire( sal_Int32 * pnHandles, const staruno::Any * pNewValues, const staruno::Any * pOldValues, sal_Int32 nCount, sal_Bool bVetoable );
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
// com::sun::star::beans::XPropertyState
virtual starbeans::PropertyState getPropertyStateByHandle(sal_Int32 nHandle);
virtual void setPropertyToDefaultByHandle(sal_Int32 nHandle);
virtual staruno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
// com::sun::star::sdbc::XSQLErrorBroadcaster
virtual void SAL_CALL addSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun::star::form::XForm
// nothing to implement
// com::sun::star::form::XReset
virtual void SAL_CALL reset() throw(staruno::RuntimeException);
virtual void SAL_CALL addResetListener(const staruno::Reference<starform::XResetListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeResetListener(const staruno::Reference<starform::XResetListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun::star::form::XSubmit
virtual void SAL_CALL submit(const staruno::Reference<starawt::XControl>& aControl, const starawt::MouseEvent& aMouseEvt) throw(staruno::RuntimeException);
virtual void SAL_CALL addSubmitListener(const staruno::Reference<starform::XSubmitListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeSubmitListener(const staruno::Reference<starform::XSubmitListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun::star::container::XChild
virtual InterfaceRef SAL_CALL getParent() { return OFormComponents::getParent(); }
virtual void SAL_CALL setParent(const InterfaceRef& Parent);
// com::sun::star::container::XNamed
virtual ::rtl::OUString SAL_CALL getName() throw(staruno::RuntimeException);
virtual void SAL_CALL setName(const ::rtl::OUString& aName) throw(staruno::RuntimeException);
// com::sun::star::awt::XTabControllerModel
virtual sal_Bool SAL_CALL getGroupControl() throw(staruno::RuntimeException);
virtual void SAL_CALL setGroupControl(sal_Bool _bGroupControl) throw(staruno::RuntimeException) { }
virtual void SAL_CALL setControlModels(const staruno::Sequence< staruno::Reference< starawt::XControlModel > >& _rControls) throw(staruno::RuntimeException);
virtual staruno::Sequence< staruno::Reference< starawt::XControlModel > > SAL_CALL getControlModels() throw(staruno::RuntimeException);
virtual void SAL_CALL setGroup(const staruno::Sequence< staruno::Reference< starawt::XControlModel > >& _rGroup, const ::rtl::OUString& _rGroupName) throw(staruno::RuntimeException);
virtual sal_Int32 SAL_CALL getGroupCount() throw(staruno::RuntimeException);
virtual void SAL_CALL getGroup(sal_Int32 _nGroup, staruno::Sequence< staruno::Reference< starawt::XControlModel > >& _rxGroup, ::rtl::OUString& _rName) throw(staruno::RuntimeException);
virtual void SAL_CALL getGroupByName(const ::rtl::OUString& _rName, staruno::Sequence< staruno::Reference< starawt::XControlModel > >& _rxGroup) throw(staruno::RuntimeException);
// com::sun::star::lang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
// com::sun::star::form::XLoadListener
virtual void SAL_CALL loaded(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL unloading(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL unloaded(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL reloading(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL reloaded(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
// com::sun::star::form::XLoadable
virtual void SAL_CALL load() throw(staruno::RuntimeException);
virtual void SAL_CALL unload() throw(staruno::RuntimeException);
virtual void SAL_CALL reload() throw(staruno::RuntimeException);
virtual sal_Bool SAL_CALL isLoaded() throw(staruno::RuntimeException);
virtual void SAL_CALL addLoadListener(const staruno::Reference<starform::XLoadListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeLoadListener(const staruno::Reference<starform::XLoadListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun::star::sdbc::XCloseable
virtual void SAL_CALL close() throw(starsdbc::SQLException, staruno::RuntimeException);
// com::sun::star::sdbc::XRowSetListener
virtual void SAL_CALL cursorMoved(const starlang::EventObject& event) throw(staruno::RuntimeException);
virtual void SAL_CALL rowChanged(const starlang::EventObject& event) throw(staruno::RuntimeException);
virtual void SAL_CALL rowSetChanged(const starlang::EventObject& event) throw(staruno::RuntimeException);
// com::sun::star::sdb::XRowSetApproveListener
virtual sal_Bool SAL_CALL approveCursorMove(const starlang::EventObject& event) throw(staruno::RuntimeException);
virtual sal_Bool SAL_CALL approveRowChange(const starsdb::RowChangeEvent& event) throw(staruno::RuntimeException);
virtual sal_Bool SAL_CALL approveRowSetChange(const starlang::EventObject& event) throw(staruno::RuntimeException);
// com::sun::star::sdb::XRowSetApproveBroadcaster
virtual void SAL_CALL addRowSetApproveListener(const staruno::Reference<starsdb::XRowSetApproveListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeRowSetApproveListener(const staruno::Reference<starsdb::XRowSetApproveListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun:star::form::XDatabaseParameterBroadcaster
virtual void SAL_CALL addParameterListener(const staruno::Reference<starform::XDatabaseParameterListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeParameterListener(const staruno::Reference<starform::XDatabaseParameterListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun::star::sdbc::XRowSet
virtual void SAL_CALL execute() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL addRowSetListener(const staruno::Reference<starsdbc::XRowSetListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeRowSetListener(const staruno::Reference<starsdbc::XRowSetListener>& _rxListener) throw(staruno::RuntimeException);
// com::sun::star::sdbc::XResultSet
virtual sal_Bool SAL_CALL next() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL isBeforeFirst() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL isAfterLast() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL isFirst() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL isLast() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL beforeFirst() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL afterLast() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL first() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL last() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Int32 SAL_CALL getRow() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL absolute(sal_Int32 row) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL relative(sal_Int32 rows) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL previous() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL refreshRow() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL rowUpdated() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL rowInserted() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual sal_Bool SAL_CALL rowDeleted() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual InterfaceRef SAL_CALL getStatement() throw(starsdbc::SQLException, staruno::RuntimeException);
// com::sun::star::sdbc::XResultSetUpdate
virtual void SAL_CALL insertRow() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL updateRow() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL deleteRow() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL cancelRowUpdates() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL moveToInsertRow() throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL moveToCurrentRow() throw(starsdbc::SQLException, staruno::RuntimeException);
// com::sun::star::sdbcx::XDeleteRows
virtual staruno::Sequence< sal_Int32 > SAL_CALL deleteRows(const staruno::Sequence<staruno::Any>& rows) throw(starsdbc::SQLException, staruno::RuntimeException);
// com::sun::star::lang::XServiceInfo
virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw(staruno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getImplementationName() throw(staruno::RuntimeException);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
// com::sun::star::io::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
virtual void SAL_CALL write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
// com::sun::star::sdbc::XSQLErrorListener
virtual void SAL_CALL errorOccured(const starsdb::SQLErrorEvent& aEvent) throw(staruno::RuntimeException);
// com::sun::star::sdbc::XParameters
virtual void SAL_CALL setNull(sal_Int32 parameterIndex, sal_Int32 sqlType) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setObjectNull(sal_Int32 parameterIndex, sal_Int32 sqlType, const ::rtl::OUString& typeName) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setBoolean(sal_Int32 parameterIndex, sal_Bool x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setByte(sal_Int32 parameterIndex, sal_Int8 x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setShort(sal_Int32 parameterIndex, sal_Int16 x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setInt(sal_Int32 parameterIndex, sal_Int32 x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setLong(sal_Int32 parameterIndex, Hyper x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setFloat(sal_Int32 parameterIndex, float x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setDouble(sal_Int32 parameterIndex, double x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setString(sal_Int32 parameterIndex, const ::rtl::OUString& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setBytes(sal_Int32 parameterIndex, const staruno::Sequence< sal_Int8 >& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setDate(sal_Int32 parameterIndex, const starutil::Date& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setTime(sal_Int32 parameterIndex, const starutil::Time& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setTimestamp(sal_Int32 parameterIndex, const starutil::DateTime& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setBinaryStream(sal_Int32 parameterIndex, const staruno::Reference<stario::XInputStream>& x, sal_Int32 length) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setCharacterStream(sal_Int32 parameterIndex, const staruno::Reference<stario::XInputStream>& x, sal_Int32 length) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setObject(sal_Int32 parameterIndex, const staruno::Any& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setObjectWithInfo(sal_Int32 parameterIndex, const staruno::Any& x, sal_Int32 targetSqlType, sal_Int32 scale) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setRef(sal_Int32 parameterIndex, const staruno::Reference<starsdbc::XRef>& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setBlob(sal_Int32 parameterIndex, const staruno::Reference<starsdbc::XBlob>& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setClob(sal_Int32 parameterIndex, const staruno::Reference<starsdbc::XClob>& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL setArray(sal_Int32 parameterIndex, const staruno::Reference<starsdbc::XArray>& x) throw(starsdbc::SQLException, staruno::RuntimeException);
virtual void SAL_CALL clearParameters() throw(starsdbc::SQLException, staruno::RuntimeException);
inline void submitNBC( const staruno::Reference<starawt::XControl>& Control, const starawt::MouseEvent& MouseEvt );
protected:
virtual void implInserted(const InterfaceRef& _rxObject);
virtual void implRemoved(const InterfaceRef& _rxObject);
// OPropertyChangeListener
virtual void _propertyChanged( const starbeans::PropertyChangeEvent& ) throw(staruno::RuntimeException);
private:
void executeRowSet(ReusableMutexGuard& _rClearForNotifies, sal_Bool bMoveToFirst = sal_True);
bool fillParameters(ReusableMutexGuard& _rClearForNotifies);
OParameterInfoImpl* createParameterInfo() const;
bool hasValidParent() const;
// if there are no parameter infos we now that we have a complete new statement to execute
bool needStatementRebuild() const {return m_pParameterInfo == NULL;}
// impl methods
void load_impl(sal_Bool bCausedByParentForm, sal_Bool bMoveToFirst = sal_True) throw(staruno::RuntimeException);
void reload_impl(sal_Bool bMoveToFirst) throw(staruno::RuntimeException);
void submit_impl(const staruno::Reference<starawt::XControl>& Control, const starawt::MouseEvent& MouseEvt, bool _bAproveByListeners);
void reset_impl(bool _bAproveByListeners);
// error handling
void onError(const starsdb::SQLErrorEvent& _rEvent);
void onError(starsdbc::SQLException&, const ::rtl::OUString& _rContextDescription);
// html tools
::rtl::OUString GetDataURLEncoded(const staruno::Reference<starawt::XControl>& SubmitButton, const starawt::MouseEvent& MouseEvt);
::rtl::OUString GetDataTextEncoded(const staruno::Reference<starawt::XControl>& SubmitButton, const starawt::MouseEvent& MouseEvt);
staruno::Sequence<sal_Int8> GetDataMultiPartEncoded(const staruno::Reference<starawt::XControl>& SubmitButton, const starawt::MouseEvent& MouseEvt,
::rtl::OUString& rContentType);
void AppendComponent(HtmlSuccessfulObjList& rList, const staruno::Reference<starbeans::XPropertySet>& xComponentSet, const ::rtl::OUString& rNamePrefix,
const staruno::Reference<starawt::XControl>& rxSubmitButton, const starawt::MouseEvent& MouseEvt);
void FillSuccessfulList(HtmlSuccessfulObjList& rList, const staruno::Reference<starawt::XControl>& rxSubmitButton, const starawt::MouseEvent& MouseEvt);
void InsertTextPart(INetMIMEMessage& rParent, const ::rtl::OUString& rName, const ::rtl::OUString& rData);
sal_Bool InsertFilePart(INetMIMEMessage& rParent, const ::rtl::OUString& rName, const ::rtl::OUString& rFileName);
void Encode(::rtl::OUString& rString) const;
staruno::Reference< starsdbc::XConnection > getConnection();
DECL_LINK( OnTimeout, void* );
};
inline void ODatabaseForm::submitNBC(const staruno::Reference<starawt::XControl>& Control, const starawt::MouseEvent& MouseEvt)
{
submit_impl(Control, MouseEvt, sal_False);
}
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FRM_DATABASEFORM_HXX_

View File

@@ -0,0 +1,303 @@
/*************************************************************************
*
* $RCSfile: Date.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_DATE_HXX_
#include "Date.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _DATE_HXX
#include <tools/date.hxx>
#endif
#ifndef _UNOTOOLS_DATETIME_HXX_
#include <unotools/datetime.hxx>
#endif
#ifndef _UTL_DB_CONVERSION_HXX_
#include <unotools/dbconversion.hxx>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//------------------------------------------------------------------
ODateControl::ODateControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_DATEFIELD)
{
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL ODateControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new ODateControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> ODateControl::_getTypes()
{
return OBoundControl::_getTypes();
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL ODateControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_DATEFIELD;
return aSupported;
}
/*************************************************************************/
sal_Int32 ODateModel::nDateHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL ODateModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new ODateModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> ODateModel::_getTypes()
{
return OEditBaseModel::_getTypes();
}
//------------------------------------------------------------------
ODateModel::ODateModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_DATEFIELD, FRM_CONTROL_DATEFIELD )
// use the old control name for compytibility reasons
{
m_nClassId = starform::FormComponentType::DATEFIELD;
m_sDataFieldConnectivityProperty = PROPERTY_DATE;
if (ODateModel::nDateHandle == -1)
ODateModel::nDateHandle = getOriginalHandle(PROPERTY_ID_DATE);
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL ODateModel::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 2);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-2] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.starform");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_DATEFIELD;
return aSupported;
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL ODateModel::getServiceName()
{
return FRM_COMPONENT_DATEFIELD; // old (non-sun) name for compatibility !
}
// starbeans::XPropertySet
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL ODateModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void ODateModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(10)
// Date auf transient setzen
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_DATE, starbeans::PropertyAttribute::TRANSIENT, 0);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP3(DEFAULT_DATE, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND);
DECL_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& ODateModel::getInfoHelper()
{
return *const_cast<ODateModel*>(this)->getArrayHelper();
}
// starform::XLoadListener
//------------------------------------------------------------------------------
void ODateModel::_loaded(const starlang::EventObject& rEvent)
{
OBoundControlModel::_loaded(rEvent);
if (m_xField.is())
{
m_bDateTimeField = sal_False;
try
{
sal_Int32 nFieldType;
m_xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType;
m_bDateTimeField = (nFieldType == starsdbc::DataType::TIMESTAMP);
}
catch(...)
{
}
}
}
// starform::XBoundComponent
//------------------------------------------------------------------------------
sal_Bool ODateModel::_commit()
{
staruno::Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( ODateModel::nDateHandle );
if (!compare(aNewValue, m_aSaveValue))
{
if (!aNewValue.hasValue())
m_xColumnUpdate->updateNull();
else
{
try
{
starutil::Date aDate;
if (!(aNewValue >>= aDate))
{
sal_Int32 nAsInt(0);
aNewValue >>= nAsInt;
Date aToolsValue(nAsInt);
typeConvert(aToolsValue, aDate);
}
if (!m_bDateTimeField)
m_xColumnUpdate->updateDate(aDate);
else
{
starutil::DateTime aDateTime = m_xColumn->getTimestamp();
aDateTime.Day = aDate.Day;
aDateTime.Month = aDate.Month;
aDateTime.Year = aDate.Year;
m_xColumnUpdate->updateTimestamp(aDateTime);
}
}
catch(...)
{
return sal_False;
}
}
m_aSaveValue = aNewValue;
}
return sal_True;
}
//------------------------------------------------------------------------------
void ODateModel::_onValueChanged()
{
starutil::Date aDate = m_xColumn->getDate();
if (m_xColumn->wasNull())
m_aSaveValue.clear();
else
// the aggregated set expects an Int32 as value ...
m_aSaveValue <<= DBTypeConversion::toINT32(aDate);
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(ODateModel::nDateHandle, m_aSaveValue);
}
}
//------------------------------------------------------------------------------
void ODateModel::_reset()
{
staruno::Any aValue;
if (m_aDefault.getValueType().getTypeClass() == staruno::TypeClass_LONG)
aValue = m_aDefault;
else
{ // aktuelles Datum einstellen
Date aCurrentDate;
aValue <<= DBTypeConversion::toINT32(aCurrentDate);
}
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(ODateModel::nDateHandle, aValue);
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,142 @@
/*************************************************************************
*
* $RCSfile: Date.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_DATE_HXX_
#define _FORMS_DATE_HXX_
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= ODateModel
//==================================================================
class ODateModel
:public OEditBaseModel
,public ::utl::OAggregationArrayUsageHelper< ODateModel >
{
staruno::Any m_aSaveValue;
sal_Bool m_bDateTimeField;
static sal_Int32 nDateHandle;
protected:
virtual void _onValueChanged();
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
ODateModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// starform::XBoundComponent
virtual sal_Bool _commit();
// stario::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(ODateModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// starform::XReset
virtual void _reset( void );
// starform::XLoadListener
virtual void _loaded(const starlang::EventObject& rEvent);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
//==================================================================
//= ODateControl
//==================================================================
class ODateControl: public OBoundControl
{
protected:
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
ODateControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
DECLARE_UNO3_AGG_DEFAULTS(ODateControl, OBoundControl);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(ODateControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FORMS_DATE_HXX_

View File

@@ -0,0 +1,643 @@
/*************************************************************************
*
* $RCSfile: Edit.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_EDIT_HXX_
#include "Edit.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _COM_SUN_STAR_UNO_TYPE_HXX_
#include <com/sun/star/uno/Type.hxx>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XSUBMIT_HPP_
#include <com/sun/star/form/XSubmit.hpp>
#endif
#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
#include <com/sun/star/util/NumberFormat.hpp>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _TOOLS_VCLRSC_HXX
#include <tools/vclrsc.hxx>
#endif
#ifndef _UTL_CONTAINER_HXX_
#include <unotools/container.hxx>
#endif
#include <unotools/datetime.hxx>
#include <unotools/numbers.hxx>
#ifndef _UTL_UNO3_DB_TOOLS_HXX_
#include <unotools/dbtools.hxx>
#endif
#ifndef _UTL_DB_CONVERSION_HXX_
#include <unotools/dbconversion.hxx>
#endif
//.........................................................................
namespace frm
{
//------------------------------------------------------------------
InterfaceRef SAL_CALL OEditControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OEditControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OEditControl::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my two base classes
staruno::Sequence<staruno::Type> aBaseClassTypes = OBoundControl::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(3);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starawt::XFocusListener>*)NULL);
pOwnTypes[1] = getCppuType((staruno::Reference<starawt::XKeyListener>*)NULL);
pOwnTypes[2] = getCppuType((staruno::Reference<starform::XChangeBroadcaster>*)NULL);
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
}
return aTypes;
}
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OEditControl::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn;
aReturn = OBoundControl::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<starawt::XFocusListener*>(this)
,static_cast<starawt::XKeyListener*>(this)
,static_cast<starform::XChangeBroadcaster*>(this)
);
return aReturn;
}
DBG_NAME(OEditControl);
//------------------------------------------------------------------------------
OEditControl::OEditControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_EDIT)
,m_aChangeListeners(m_aMutex)
,m_nKeyEvent( 0 )
{
DBG_CTOR(OEditControl,NULL);
increment(m_refCount);
{ // als FocusListener anmelden
staruno::Reference<starawt::XWindow> xComp;
if (query_aggregation(m_xAggregate, xComp))
{
xComp->addFocusListener(this);
xComp->addKeyListener(this);
}
}
// Refcount wieder bei 2 fuer beide Listener
sal_Int32 n = decrement(m_refCount);
}
//------------------------------------------------------------------------------
OEditControl::~OEditControl()
{
if( m_nKeyEvent )
Application::RemoveUserEvent( m_nKeyEvent );
if (!OComponentHelper::rBHelper.bDisposed)
{
acquire();
dispose();
}
DBG_DTOR(OEditControl,NULL);
}
// starform::XChangeBroadcaster
//------------------------------------------------------------------------------
void OEditControl::addChangeListener(const staruno::Reference<starform::XChangeListener>& l)
{
m_aChangeListeners.addInterface( l );
}
//------------------------------------------------------------------------------
void OEditControl::removeChangeListener(const staruno::Reference<starform::XChangeListener>& l)
{
m_aChangeListeners.removeInterface( l );
}
// OComponentHelper
//------------------------------------------------------------------------------
void OEditControl::disposing()
{
OBoundControl::disposing();
starlang::EventObject aEvt(static_cast<staruno::XWeak*>(this));
m_aChangeListeners.disposeAndClear(aEvt);
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence OEditControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_TEXTFIELD;
return aSupported;
}
// starlang::XEventListener
//------------------------------------------------------------------------------
void OEditControl::disposing(const starlang::EventObject& Source) throw( staruno::RuntimeException )
{
OBoundControl::disposing(Source);
}
// starawt::XFocusListener
//------------------------------------------------------------------------------
void OEditControl::focusGained( const starawt::FocusEvent& e )
{
staruno::Reference<starbeans::XPropertySet> xSet(getModel(), staruno::UNO_QUERY);
if (xSet.is())
xSet->getPropertyValue( PROPERTY_TEXT ) >>= m_aHtmlChangeValue;
}
//------------------------------------------------------------------------------
void OEditControl::focusLost( const starawt::FocusEvent& e )
{
staruno::Reference<starbeans::XPropertySet> xSet(getModel(), staruno::UNO_QUERY);
if (xSet.is())
{
::rtl::OUString sNewHtmlChangeValue;
xSet->getPropertyValue( PROPERTY_TEXT ) >>= sNewHtmlChangeValue;
if( sNewHtmlChangeValue != m_aHtmlChangeValue )
{
starlang::EventObject aEvt;
aEvt.Source = *this;
NOTIFY_LISTENERS(m_aChangeListeners, starform::XChangeListener, changed, aEvt);
}
}
}
// starawt::XKeyListener
//------------------------------------------------------------------------------
void OEditControl::keyPressed(const starawt::KeyEvent& e)
{
if( e.KeyCode != KEY_RETURN || e.Modifiers != 0 )
return;
// Steht das Control in einem Formular mit einer Submit-starutil::URL?
staruno::Reference<starbeans::XPropertySet> xSet(getModel(), staruno::UNO_QUERY);
if( !xSet.is() )
return;
// nicht fuer multiline edits
staruno::Any aTmp( xSet->getPropertyValue(PROPERTY_MULTILINE));
if ((aTmp.getValueType().equals(::getBooleanCppuType())) && getBOOL(aTmp))
return;
staruno::Reference<starform::XFormComponent> xFComp(xSet, staruno::UNO_QUERY);
InterfaceRef xParent = xFComp->getParent();
if( !xParent.is() )
return;
staruno::Reference<starbeans::XPropertySet> xFormSet(xParent, staruno::UNO_QUERY);
if( !xFormSet.is() )
return;
aTmp = xFormSet->getPropertyValue( PROPERTY_TARGET_URL );
if (!aTmp.getValueType().equals(::getCppuType((const ::rtl::OUString*)NULL)) ||
!getString(aTmp).getLength() )
return;
staruno::Reference<starcontainer::XIndexAccess> xElements(xParent, staruno::UNO_QUERY);
sal_Int32 nCount = xElements->getCount();
if( nCount > 1 )
{
for( sal_Int32 nIndex=0; nIndex < nCount; nIndex++ )
{
// staruno::Any aElement(xElements->getByIndex(nIndex));
staruno::Reference<starbeans::XPropertySet> xFCSet(*(InterfaceRef *)xElements->getByIndex(nIndex).getValue(), staruno::UNO_QUERY);
if (hasProperty(PROPERTY_CLASSID, xFCSet) &&
getINT16(xFCSet->getPropertyValue(PROPERTY_CLASSID)) == starform::FormComponentType::TEXTFIELD)
{
// Noch ein weiteres Edit gefunden ==> dann nicht submitten
if (xFCSet != xSet)
return;
}
}
}
// Da wir noch im Haender stehen, submit asynchron ausloesen
if( m_nKeyEvent )
Application::RemoveUserEvent( m_nKeyEvent );
m_nKeyEvent = Application::PostUserEvent( LINK(this, OEditControl,
OnKeyPressed) );
}
//------------------------------------------------------------------------------
void OEditControl::keyReleased(const starawt::KeyEvent& e)
{
}
//------------------------------------------------------------------------------
IMPL_LINK(OEditControl, OnKeyPressed, void*, EMPTYARG)
{
m_nKeyEvent = 0;
staruno::Reference<starform::XFormComponent> xFComp(getModel(), staruno::UNO_QUERY);
InterfaceRef xParent = xFComp->getParent();
staruno::Reference<starform::XSubmit> xSubmit(xParent, staruno::UNO_QUERY);
if (xSubmit.is())
xSubmit->submit( staruno::Reference<starawt::XControl>(), starawt::MouseEvent() );
return 0L;
}
/*************************************************************************/
sal_Int32 OEditModel::nTextHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL OEditModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OEditModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OEditModel::_getTypes()
{
return OEditBaseModel::_getTypes();
}
DBG_NAME(OEditModel);
//------------------------------------------------------------------
OEditModel::OEditModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OEditBaseModel( _rxFactory, VCL_CONTROLMODEL_EDIT, FRM_CONTROL_EDIT )
// use the old control name for compytibility reasons
,m_nMaxLen(0)
,m_aNullDate(STANDARD_DB_DATE)
,m_nKeyType(starutil::NumberFormat::UNDEFINED)
,m_nFormatKey(0)
,m_nFieldType(starsdbc::DataType::OTHER)
,m_bWritingFormattedFake(sal_False)
{
DBG_CTOR(OEditModel,NULL);
m_nClassId = starform::FormComponentType::TEXTFIELD;
m_sDataFieldConnectivityProperty = PROPERTY_TEXT;
if (OEditModel::nTextHandle == -1)
OEditModel::nTextHandle = getOriginalHandle(PROPERTY_ID_TEXT);
}
//------------------------------------------------------------------
OEditModel::~OEditModel()
{
if (!OComponentHelper::rBHelper.bDisposed)
{
acquire();
dispose();
}
DBG_DTOR(OEditModel,NULL);
}
//------------------------------------------------------------------------------
void OEditModel::disposing()
{
OEditBaseModel::disposing();
m_xFormatter = NULL;
}
// stario::XPersistObject
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OEditModel::getServiceName()
{
return FRM_COMPONENT_EDIT; // old (non-sun) name for compatibility !
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OEditModel::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 2);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabaseTextField");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_TEXTFIELD;
return aSupported;
}
// starbeans::XPropertySet
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OEditModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void OEditModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(12)
// Text auf transient setzen
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, starbeans::PropertyAttribute::TRANSIENT, 0);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP2(DEFAULT_TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT);
DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND);
DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
DECL_IFACE_PROP2(BOUNDFIELD, starbeans::XPropertySet,READONLY, TRANSIENT);
DECL_BOOL_PROP2(FILTERPROPOSAL, BOUND, MAYBEDEFAULT);
DECL_IFACE_PROP2(CONTROLLABEL, starbeans::XPropertySet,BOUND, MAYBEVOID);
DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
FRM_END_PROP_HELPER();
}
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& OEditModel::getInfoHelper()
{
return *const_cast<OEditModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
void OEditModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
staruno::Any aCurrentText;
// bin ich gerade loaded und habe dazu zeitweilig die MaxTextLen umgesetzt ?
if (m_nMaxLen)
{ // -> fuer die Dauer des Speicherns meinem aggregierten Model die alte TextLen einreden
// before doing this we have to save the current text value of the aggregate, as this may be affected by resetting the text len
// FS - 08.12.99 - 70606
aCurrentText = m_xAggregateSet->getPropertyValue(PROPERTY_TEXT);
m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, staruno::makeAny((sal_Int16)0));
}
OEditBaseModel::write(_rxOutStream);
if (m_nMaxLen)
{ // wieder zuruecksetzen
m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, staruno::makeAny((sal_Int16)m_nMaxLen));
// and reset the text
// First we set it to an empty string : Without this the second setPropertyValue would not do anything as it thinks
// we aren't changing the prop (it didn't notify the - implicite - change of the text prop while setting the max text len)
// This seems to be a bug with in toolkit's EditControl-implementation.
m_xAggregateSet->setPropertyValue(PROPERTY_TEXT, staruno::makeAny(::rtl::OUString()));
m_xAggregateSet->setPropertyValue(PROPERTY_TEXT, aCurrentText);
}
}
//------------------------------------------------------------------------------
void OEditModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream)
{
OEditBaseModel::read(_rxInStream);
// Some versions (5.1 'til about 552) wrote a wrong DefaultControl-property value which is unknown
// to older versions (5.0).
// correct this ...
if (m_xAggregateSet.is())
{
staruno::Any aDefaultControl = m_xAggregateSet->getPropertyValue(PROPERTY_DEFAULTCONTROL);
if ( (aDefaultControl.getValueType().getTypeClass() == staruno::TypeClass_STRING)
&& (getString(aDefaultControl).compareTo(FRM_CONTROL_TEXTFIELD) == COMPARE_EQUAL)
)
{
m_xAggregateSet->setPropertyValue(PROPERTY_DEFAULTCONTROL, staruno::makeAny(::rtl::OUString(FRM_CONTROL_EDIT)));
// Older as well as current versions should understand this : the former knew only the FRM_CONTROL_EDIT,
// the latter are registered for both FRM_CONTROL_EDIT and FRM_CONTROL_TEXTFIELD.
}
}
}
//------------------------------------------------------------------------------
sal_Int16 OEditModel::getPersistenceFlags() const
{
sal_Int16 nFlags = OEditBaseModel::getPersistenceFlags();
if (m_bWritingFormattedFake)
nFlags |= PF_FAKE_FORMATTED_FIELD;
return nFlags;
}
// starform::XLoadListener
//------------------------------------------------------------------------------
void OEditModel::_loaded(const starlang::EventObject& rEvent)
{
if (m_xField.is())
{
// jetzt den Key und typ ermitteln
m_nFieldType = getINT32(m_xField->getPropertyValue(PROPERTY_FIELDTYPE));
m_nFormatKey = getINT32(m_xField->getPropertyValue(PROPERTY_FORMATKEY));
// starutil::XNumberFormatter besorgen
staruno::Reference<starsdbc::XRowSet> xRowSet(rEvent.Source, staruno::UNO_QUERY);
DBG_ASSERT(xRowSet.is(), "OEditModel::_loaded : source is not a row set ?");
staruno::Reference<starutil::XNumberFormatsSupplier> xSupplier = getNumberFormats(getConnection(xRowSet), sal_False, m_xServiceFactory);
if (xSupplier.is())
{
m_xFormatter = staruno::Reference<starutil::XNumberFormatter>(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);
}
if (m_nKeyType != starutil::NumberFormat::SCIENTIFIC)
{
m_nMaxLen = getINT16(m_xAggregateSet->getPropertyValue(PROPERTY_MAXTEXTLEN));
if (!m_nMaxLen)
{
sal_Int32 nFieldLen;
m_xField->getPropertyValue(::rtl::OUString::createFromAscii("Precision")) >>= nFieldLen;
if (nFieldLen && nFieldLen <= USHRT_MAX)
{
staruno::Any aVal;
aVal <<= (sal_Int16)nFieldLen;
m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, aVal);
m_nMaxLen = nFieldLen; // damit das Ganze beim _unloaded wieder zurueckgesetzt wird
}
}
else
m_nMaxLen = 0;
}
}
}
//------------------------------------------------------------------------------
void OEditModel::_unloaded()
{
OEditBaseModel::_unloaded();
if (m_xField.is())
{
if (m_nMaxLen)
{
staruno::Any aVal;
aVal <<= (sal_Int16)0; // nur wenn es 0 war, habe ich es in _loaded umgesetzt
m_xAggregateSet->setPropertyValue(PROPERTY_MAXTEXTLEN, aVal);
m_nMaxLen = 0;
}
m_xFormatter = 0;
m_nFieldType = starsdbc::DataType::OTHER;
m_nFormatKey = 0;
m_nKeyType = starutil::NumberFormat::UNDEFINED;
m_aNullDate = STANDARD_DB_DATE;
}
}
//------------------------------------------------------------------------------
sal_Bool OEditModel::_commit()
{
::rtl::OUString aNewValue;
m_xAggregateFastSet->getFastPropertyValue(OEditModel::nTextHandle) >>= aNewValue;
if (aNewValue != m_aSaveValue)
{
if (!aNewValue.len() && !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;
}
return sal_True;
}
// starbeans::XPropertyChangeListener
//------------------------------------------------------------------------------
void OEditModel::_onValueChanged()
{
// release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// and in this special case do it before calling DBTypeConversion::getValue, as this uses the number formatter
// which's implementation locks the SM, too :(
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_aSaveValue = DBTypeConversion::getValue(m_xColumn,
m_xFormatter,
m_aNullDate,
m_nFormatKey,
m_nKeyType);
m_xAggregateFastSet->setFastPropertyValue(OEditModel::nTextHandle, staruno::makeAny(m_aSaveValue));
}
// starform::XReset
//------------------------------------------------------------------------------
void OEditModel::_reset()
{
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(OEditModel::nTextHandle, staruno::makeAny(m_aDefaultText));
}
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,199 @@
/*************************************************************************
*
* $RCSfile: Edit.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_EDIT_HXX_
#define _FORMS_EDIT_HXX_
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
//.........................................................................
namespace frm
{
//==================================================================
//= OEditModel
//==================================================================
class OEditModel
:public OEditBaseModel
,public ::utl::OAggregationArrayUsageHelper< OEditModel >
{
staruno::Reference<starutil::XNumberFormatter> m_xFormatter;
::rtl::OUString m_aSaveValue;
sal_Int32 m_nFormatKey;
Date m_aNullDate;
sal_Int32 m_nFieldType;
sal_Int16 m_nKeyType;
sal_Int16 m_nMaxLen;
sal_Bool m_bWritingFormattedFake;
// are we writing something which should be interpreted as formatted upon reading
static sal_Int32 nTextHandle;
protected:
virtual void _onValueChanged();
virtual staruno::Sequence<staruno::Type> _getTypes();
OEditModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OEditModel();
void enableFormattedWriteFake() { m_bWritingFormattedFake = sal_True; }
void disableFormattedWriteFake() { m_bWritingFormattedFake = sal_False; }
sal_Bool lastReadWasFormattedFake() const { return (getLastReadVersion() & PF_FAKE_FORMATTED_FIELD) != 0; }
friend InterfaceRef SAL_CALL OEditModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
friend class OFormattedFieldWrapper;
friend class OFormattedModel; // temporary
public:
virtual void SAL_CALL disposing();
// starform::XBoundComponent
virtual sal_Bool _commit();
// stario::XPersistObject
virtual void SAL_CALL write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
virtual ::rtl::OUString SAL_CALL getServiceName();
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OEditModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starform::XLoadListener
virtual void _loaded(const starlang::EventObject& rEvent);
virtual void _unloaded();
// 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()
protected:
virtual sal_Int16 getPersistenceFlags() const;
};
//==================================================================
//= OEditControl
//==================================================================
class OEditControl : public OBoundControl
,public starawt::XFocusListener
,public starawt::XKeyListener
,public starform::XChangeBroadcaster
{
::cppu::OInterfaceContainerHelper
m_aChangeListeners;
::rtl::OUString m_aHtmlChangeValue;
sal_uInt32 m_nKeyEvent;
public:
OEditControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OEditControl();
DECLARE_UNO3_AGG_DEFAULTS(OEditControl, OBoundControl);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
virtual staruno::Sequence<staruno::Type> _getTypes();
// OComponentHelper
virtual void SAL_CALL disposing();
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OEditControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starform::XChangeBroadcaster
virtual void SAL_CALL addChangeListener(const staruno::Reference<starform::XChangeListener>& _rxListener);
virtual void SAL_CALL removeChangeListener(const staruno::Reference<starform::XChangeListener>& _rxListener);
// starawt::XFocusListener
virtual void SAL_CALL focusGained( const starawt::FocusEvent& e );
virtual void SAL_CALL focusLost( const starawt::FocusEvent& e );
// starawt::XKeyListener
virtual void SAL_CALL keyPressed(const starawt::KeyEvent& e);
virtual void SAL_CALL keyReleased(const starawt::KeyEvent& e);
private:
DECL_LINK( OnKeyPressed, void* );
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_EDIT_HXX_

View File

@@ -0,0 +1,429 @@
/*************************************************************************
*
* $RCSfile: EditBase.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.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 <tools/debug.hxx>
#endif
#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
#include <cppuhelper/queryinterface.hxx>
#endif
#ifndef _FRM_RESOURCE_HXX_
#include "frm_resource.hxx"
#endif
#ifndef _FRM_RESOURCE_HRC_
#include "frm_resource.hrc"
#endif
//.........................................................................
namespace frm
{
const sal_uInt16 DEFAULT_LONG = 0x0001;
const sal_uInt16 DEFAULT_DOUBLE = 0x0002;
const sal_uInt16 FILTERPROPOSAL = 0x0004;
//------------------------------------------------------------------
OEditBaseModel::OEditBaseModel(
const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory,
const ::rtl::OUString& rUnoControlModelName,
const ::rtl::OUString& rDefault )
:OBoundControlModel( _rxFactory, rUnoControlModelName, rDefault )
,m_bFilterProposal(sal_False)
,m_bEmptyIsNull(sal_True)
,m_nLastReadVersion(0)
{
}
// stario::XPersist
//------------------------------------------------------------------------------
void OEditBaseModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
OBoundControlModel::write(_rxOutStream);
// Version
sal_uInt16 nVersionId = 0x0005;
DBG_ASSERT((getPersistenceFlags() & ~(sal_Int16)PF_SPECIAL_FLAGS) == 0,
"OEditBaseModel::write : invalid special version flags !");
// please don't use other flags, older versions can't interpret them !
nVersionId |= getPersistenceFlags();
_rxOutStream->writeShort(nVersionId);
// Name
_rxOutStream->writeShort(0); // obsolete
_rxOutStream << m_aDefaultText;
// Maskierung fuer any
sal_uInt16 nAnyMask = 0;
if (m_aDefault.getValueType().getTypeClass() == staruno::TypeClass_LONG)
nAnyMask |= DEFAULT_LONG;
else if (m_aDefault.getValueType().getTypeClass() == staruno::TypeClass_DOUBLE)
nAnyMask |= DEFAULT_DOUBLE;
if (m_bFilterProposal) // da boolean, kein Wert speichern
nAnyMask |= FILTERPROPOSAL;
_rxOutStream->writeBoolean(m_bEmptyIsNull);
_rxOutStream->writeShort(nAnyMask);
if ((nAnyMask & DEFAULT_LONG) == DEFAULT_LONG)
_rxOutStream->writeLong(getINT32(m_aDefault));
else if ((nAnyMask & DEFAULT_DOUBLE) == DEFAULT_DOUBLE)
_rxOutStream->writeDouble(getDouble(m_aDefault));
// since version 5 we write the help text
_rxOutStream << m_aHelpText;
// (that's potentially bad : at the time I added the above line we had two derived classes : OEditModel and
// OFormattedModel. The first one does not have an own version handling, so it can't write the help text itself,
// the second one does it's own writing (reading) after calling our method, so normally we shouldn't write any
// additional members as this is not compatible to older office versions.
// We decided to place the writing of the help text here as it seems the less worse alternative. There is no delivered
// office version including formatted controls (and thus the OFormattedModel), and the OFormattedModel::read seems
// robust against this change (as it will read a wrong and unknown file version and thus set it's members to defaults).
if ((nVersionId & PF_HANDLE_COMMON_PROPS) != 0)
writeCommonEditProperties(_rxOutStream);
// !!! properties common to all OEditBaseModel derived classes should be written in writeCommonEditProperties !!!
}
//------------------------------------------------------------------------------
sal_Int16 OEditBaseModel::getPersistenceFlags() const
{
return PF_HANDLE_COMMON_PROPS;
}
//------------------------------------------------------------------------------
void OEditBaseModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream)
{
OBoundControlModel::read(_rxInStream);
::osl::MutexGuard aGuard(m_aMutex);
// Version eigene Versionsnummer
sal_uInt16 nVersion = _rxInStream->readShort();
m_nLastReadVersion = nVersion;
sal_Bool bHandleCommonProps = (nVersion & PF_HANDLE_COMMON_PROPS) != 0;
nVersion = nVersion & ~PF_SPECIAL_FLAGS;
sal_uInt16 nOld = _rxInStream->readShort();
_rxInStream >> m_aDefaultText;
if (nVersion >= 0x0003)
{
m_bEmptyIsNull = _rxInStream->readBoolean();
sal_uInt16 nAnyMask = _rxInStream->readShort();
if ((nAnyMask & DEFAULT_LONG) == DEFAULT_LONG)
{
sal_Int32 nValue = _rxInStream->readLong();
m_aDefault <<= (sal_Int32)nValue;
}
else if ((nAnyMask & DEFAULT_DOUBLE) == DEFAULT_DOUBLE)
{
double fValue = _rxInStream->readDouble();
m_aDefault <<= (double)fValue;
}
if ((nAnyMask & FILTERPROPOSAL) == FILTERPROPOSAL)
m_bFilterProposal = sal_True;
}
if (nVersion > 4)
_rxInStream >> m_aHelpText;
if (bHandleCommonProps)
readCommonEditProperties(_rxInStream);
// Nach dem Lesen die Defaultwerte anzeigen
if (m_aControlSource.getLength())
// (not if we don't have a control source - the "State" property acts like it is persistent, then)
_reset();
};
//------------------------------------------------------------------------------
void OEditBaseModel::defaultCommonEditProperties()
{
OBoundControlModel::defaultCommonProperties();
// no own common properties at the moment
}
//------------------------------------------------------------------------------
void OEditBaseModel::readCommonEditProperties(const staruno::Reference<stario::XObjectInputStream>& _rxInStream)
{
sal_Int32 nLen = _rxInStream->readLong();
staruno::Reference<stario::XMarkableStream> xMark(_rxInStream, staruno::UNO_QUERY);
DBG_ASSERT(xMark.is(), "OBoundControlModel::readCommonProperties : can only work with markable streams !");
sal_Int32 nMark = xMark->createMark();
// read properties common to all OBoundControlModels
OBoundControlModel::readCommonProperties(_rxInStream);
// read properties common to all OEditBaseModels
// skip the remaining bytes
xMark->jumpToMark(nMark);
_rxInStream->skipBytes(nLen);
xMark->deleteMark(nMark);
}
//------------------------------------------------------------------------------
void OEditBaseModel::writeCommonEditProperties(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
staruno::Reference<stario::XMarkableStream> xMark(_rxOutStream, staruno::UNO_QUERY);
DBG_ASSERT(xMark.is(), "OEditBaseModel::writeCommonProperties : can only work with markable streams !");
sal_Int32 nMark = xMark->createMark();
// a placeholder where we will write the overall length (later in this method)
sal_Int32 nLen = 0;
_rxOutStream->writeLong(nLen);
// write properties common to all OBoundControlModels
OBoundControlModel::writeCommonProperties(_rxOutStream);
// write properties common to all OEditBaseModels
// close the block - write the correct length at the beginning
nLen = xMark->offsetToMark(nMark) - sizeof(nLen);
xMark->jumpToMark(nMark);
_rxOutStream->writeLong(nLen);
xMark->jumpToFurthest();
xMark->deleteMark(nMark);
}
//------------------------------------------------------------------------------
void OEditBaseModel::getFastPropertyValue( staruno::Any& rValue, sal_Int32 nHandle ) const
{
switch (nHandle)
{
case PROPERTY_ID_EMPTY_IS_NULL:
rValue <<= (sal_Bool)m_bEmptyIsNull;
break;
case PROPERTY_ID_FILTERPROPOSAL:
rValue <<= (sal_Bool)m_bFilterProposal;
break;
case PROPERTY_ID_DEFAULT_TEXT:
rValue <<= m_aDefaultText;
break;
case PROPERTY_ID_DEFAULT_VALUE:
case PROPERTY_ID_DEFAULT_DATE:
case PROPERTY_ID_DEFAULT_TIME:
rValue = m_aDefault;
break;
default:
OBoundControlModel::getFastPropertyValue(rValue, nHandle);
}
}
//------------------------------------------------------------------------------
sal_Bool OEditBaseModel::convertFastPropertyValue( 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_EMPTY_IS_NULL:
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEmptyIsNull);
break;
case PROPERTY_ID_FILTERPROPOSAL:
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bFilterProposal);
break;
case PROPERTY_ID_DEFAULT_TEXT:
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultText);
break;
case PROPERTY_ID_DEFAULT_VALUE:
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefault, ::getCppuType((const double*)0));
break;
case PROPERTY_ID_DEFAULT_DATE:
case PROPERTY_ID_DEFAULT_TIME:
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefault, ::getCppuType((const sal_Int32*)0));
break;
default:
bModified = OBoundControlModel::convertFastPropertyValue(
rConvertedValue,
rOldValue,
nHandle,
rValue);
}
return bModified;
}
//------------------------------------------------------------------------------
void OEditBaseModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const staruno::Any& rValue )
{
switch (nHandle)
{
case PROPERTY_ID_EMPTY_IS_NULL:
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_BOOLEAN, "invalid type" );
m_bEmptyIsNull = getBOOL(rValue);
break;
case PROPERTY_ID_FILTERPROPOSAL:
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_BOOLEAN, "invalid type" );
m_bFilterProposal = getBOOL(rValue);
break;
// Aenderung der defaultwerte fuehrt zu reset
case PROPERTY_ID_DEFAULT_TEXT:
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING, "invalid type" );
rValue >>= m_aDefaultText;
_reset();
break;
case PROPERTY_ID_DEFAULT_VALUE:
case PROPERTY_ID_DEFAULT_DATE:
case PROPERTY_ID_DEFAULT_TIME:
m_aDefault = rValue;
_reset();
break;
default:
OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue );
}
}
//XPropertyState
//------------------------------------------------------------------------------
starbeans::PropertyState OEditBaseModel::getPropertyStateByHandle(sal_Int32 nHandle)
{
starbeans::PropertyState eState;
switch (nHandle)
{
case PROPERTY_ID_DEFAULT_TEXT:
if (!m_aDefaultText.len())
eState = starbeans::PropertyState_DEFAULT_VALUE;
else
eState = starbeans::PropertyState_DIRECT_VALUE;
break;
case PROPERTY_ID_FILTERPROPOSAL:
if (!m_bFilterProposal)
eState = starbeans::PropertyState_DEFAULT_VALUE;
else
eState = starbeans::PropertyState_DIRECT_VALUE;
break;
case PROPERTY_ID_DEFAULT_VALUE:
case PROPERTY_ID_DEFAULT_DATE:
case PROPERTY_ID_DEFAULT_TIME:
if (!m_aDefault.hasValue())
eState = starbeans::PropertyState_DEFAULT_VALUE;
else
eState = starbeans::PropertyState_DIRECT_VALUE;
break;
default:
eState = OBoundControlModel::getPropertyStateByHandle(nHandle);
}
return eState;
}
//------------------------------------------------------------------------------
void OEditBaseModel::setPropertyToDefaultByHandle(sal_Int32 nHandle)
{
switch (nHandle)
{
case PROPERTY_ID_DEFAULT_TEXT:
setFastPropertyValue(nHandle, staruno::makeAny(::rtl::OUString()));
break;
case PROPERTY_ID_FILTERPROPOSAL:
setFastPropertyValue(nHandle, staruno::makeAny((sal_Bool)sal_False));
break;
case PROPERTY_ID_DEFAULT_VALUE:
case PROPERTY_ID_DEFAULT_DATE:
case PROPERTY_ID_DEFAULT_TIME:
setFastPropertyValue(nHandle, staruno::Any());
break;
default:
OBoundControlModel::setPropertyToDefaultByHandle(nHandle);
}
}
//------------------------------------------------------------------------------
staruno::Any OEditBaseModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
{
switch (nHandle)
{
case PROPERTY_ID_DEFAULT_TEXT:
return staruno::makeAny(::rtl::OUString());
break;
case PROPERTY_ID_FILTERPROPOSAL:
return staruno::Any(staruno::makeAny((sal_Bool)sal_False));
break;
case PROPERTY_ID_DEFAULT_VALUE:
case PROPERTY_ID_DEFAULT_DATE:
case PROPERTY_ID_DEFAULT_TIME:
return staruno::Any();
default:
return OBoundControlModel::getPropertyDefaultByHandle(nHandle);
}
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,158 @@
/*************************************************************************
*
* $RCSfile: EditBase.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_EDITBASE_HXX_
#define _FORMS_EDITBASE_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
#ifndef _DATE_HXX
#include <tools/date.hxx>
#endif
#ifndef _LINK_HXX
#include <tools/link.hxx>
#endif
#include <com/sun/star/util/XNumberFormatter.hpp>
#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/awt/XKeyListener.hpp>
#include <com/sun/star/form/XChangeBroadcaster.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XComponent.hpp>
// persistence flags for use with the version id
#define PF_HANDLE_COMMON_PROPS 0x8000
// Derived classes which use their own persistence methods (read/write) and have an own
// version handling therein may want to clear this flag in getPersistenceFlags.
// If done so, this class will write an version without a call to writeCommonEditProperties.
#define PF_FAKE_FORMATTED_FIELD 0x4000
// .... hmmm .... a fake, as the name suggests. see OFormattedFieldWrapper
#define PF_RESERVED_2 0x2000
#define PF_RESERVED_3 0x1000
#define PF_RESERVED_4 0x0800
#define PF_RESERVED_5 0x0400
#define PF_RESERVED_6 0x0200
#define PF_RESERVED_7 0x0100
#define PF_SPECIAL_FLAGS 0xFF00
//.........................................................................
namespace frm
{
//==================================================================
//= OEditBaseModel
//==================================================================
class OEditBaseModel : public OBoundControlModel
{
sal_Int16 m_nLastReadVersion;
protected:
// [properties] fuer all Editierfelder
staruno::Any m_aDefault;
::rtl::OUString m_aDefaultText; // Defaultwert
sal_Bool m_bEmptyIsNull : 1; // LeerString ist NULL
sal_Bool m_bFilterProposal : 1; // use a list of possible value in filtermode
// [properties]
sal_Int16 getLastReadVersion() const { return m_nLastReadVersion; }
public:
OEditBaseModel(
const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory,
const ::rtl::OUString& rUnoControlModelName,
const ::rtl::OUString& rDefault );
// stario::XPersistObject
virtual void SAL_CALL write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
// starbeans::XPropertySet
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;
protected:
// new properties common to all edit models should be handled with the following two methods
void SAL_CALL readCommonEditProperties(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
void SAL_CALL writeCommonEditProperties(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream);
void defaultCommonEditProperties();
virtual sal_Int16 getPersistenceFlags() const;
// derived classes may use this if they want this base class to write additinal version flags
// (one of the PF_.... constants). After ::read they may ask for that flags with getLastReadVersion
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_EDITBASE_HXX_

View File

@@ -0,0 +1,225 @@
/*************************************************************************
*
* $RCSfile: EventThread.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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_EVENT_THREAD_HXX_
#include "EventThread.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX //autogen
#include <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
OComponentEventThread::OComponentEventThread( ::cppu::OComponentHelper* pCompImpl ) :
m_pCompImpl( pCompImpl )
{
increment(m_refCount);
// Eine Referenz des Controls halten
{
InterfaceRef xIFace(static_cast<staruno::XWeak*>(pCompImpl));
query_interface(xIFace, m_xComp);
}
// und uns an dem Control anmelden
{
staruno::Reference<starlang::XEventListener> xEvtLstnr = static_cast<starlang::XEventListener*>(this);
m_xComp->addEventListener( xEvtLstnr );
}
decrement(m_refCount);
}
OComponentEventThread::~OComponentEventThread()
{
DBG_ASSERT( m_aEvents.size() == 0,
"OComponentEventThread::~OComponentEventThread: Kein dispose gerufen?" );
while (m_aEvents.size())
delete *m_aEvents.erase(m_aEvents.begin());
}
staruno::Any SAL_CALL OComponentEventThread::queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException)
{
staruno::Any aReturn;
aReturn = OWeakObject::queryInterface(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType,
static_cast<starlang::XEventListener*>(this)
);
return aReturn;
}
void OComponentEventThread::disposing( const starlang::EventObject& evt )
{
if( evt.Source == m_xComp )
{
::osl::MutexGuard aGuard( m_aMutex );
// Event-Listener abmelden
staruno::Reference<starlang::XEventListener> xEvtLstnr = static_cast<starlang::XEventListener*>(this);
m_xComp->removeEventListener( xEvtLstnr );
// Event-Queue loeschen
while (m_aEvents.size())
delete *m_aEvents.erase(m_aEvents.begin());
m_aControls.erase(m_aControls.begin(), m_aControls.end());
m_aFlags.erase(m_aFlags.begin(), m_aFlags.end());
// Das Control loslassen und pCompImpl auf 0 setzen, damit der
// Thread weiss, dass er sich beenden soll.
m_xComp = 0;
m_pCompImpl = 0;
// Den Thread aufwecken und beenden.
m_aCond.set();
terminate();
}
}
void OComponentEventThread::addEvent( const starlang::EventObject* _pEvt, sal_Bool bFlag )
{
staruno::Reference<starawt::XControl> xTmp;
addEvent( _pEvt, xTmp, bFlag );
}
void OComponentEventThread::addEvent( const starlang::EventObject* _pEvt,
const staruno::Reference<starawt::XControl>& rControl,
sal_Bool bFlag )
{
::osl::MutexGuard aGuard( m_aMutex );
// Daten in die Queue stellen
m_aEvents.push_back( cloneEvent( _pEvt ) );
staruno::Reference<staruno::XWeak> xWeakControl(rControl, staruno::UNO_QUERY);
staruno::Reference<staruno::XAdapter> xControlAdapter = xWeakControl.is() ? xWeakControl->queryAdapter() : staruno::Reference<staruno::XAdapter>();
m_aControls.push_back( xControlAdapter );
m_aFlags.push_back( bFlag );
// Thread aufwecken
m_aCond.set();
}
void OComponentEventThread::run()
{
// uns selbst festhalten, damit wir nicht geloescht werden,
// wenn zwischendrinne mal ein dispose gerufen wird.
InterfaceRef xThis(static_cast<staruno::XWeak*>(this));
do
{
::osl::MutexGuard aGuard(m_aMutex);
while( m_aEvents.size() > 0 )
{
// Das Control holen und festhalten, damit es waehrend des
// actionPerformed nicht geloescht werden kann.
staruno::Reference<starlang::XComponent> xComp = m_xComp;
::cppu::OComponentHelper *pCompImpl = m_pCompImpl;
starlang::EventObject* pEvt = *m_aEvents.erase( m_aEvents.begin() );
staruno::Reference<staruno::XAdapter> xControlAdapter = *m_aControls.erase( m_aControls.begin() );
sal_Bool bFlag = *m_aFlags.erase( m_aFlags.begin() );
{
MutexRelease aReleaseOnce(m_aMutex);
// Weil ein queryHardRef eine staruno::Exception schmeissen kann sollte
// es nicht bei gelocktem Mutex aufgerufen werden.
staruno::Reference<starawt::XControl> xControl;
if ( xControlAdapter.is() )
query_interface(xControlAdapter->queryAdapted(), xControl);
if( xComp.is() )
processEvent( pCompImpl, pEvt, xControl, bFlag );
}
delete pEvt;
};
// Nach einem dispose kennen wir das Control nicht mehr. Dann darf
// auch nicht gewartet werden.
if( !m_xComp.is() )
return;
// Warte-Bedingung zuruecksetzen
m_aCond.reset();
{
MutexRelease aReleaseOnce(m_aMutex);
// und warten ... falls nicht zwischenzeitlich doch noch ein
// Event eingetroffen ist.
m_aCond.wait();
}
}
while( sal_True );
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,165 @@
/*************************************************************************
*
* $RCSfile: EventThread.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_EVENT_THREAD_HXX_
#define _FRM_EVENT_THREAD_HXX_
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <vos/thread.hxx>
#ifndef _OSL_CONDITN_HXX_
#include <osl/conditn.hxx>
#endif
#ifndef _CPPUHELPER_COMPONENT_HXX_
#include <cppuhelper/component.hxx>
#endif
#ifndef _UTL_STLTYPES_HXX_
#include <unotools/stl_types.hxx>
#endif
#ifndef _UNOTOOLS_GUARDING_HXX_
#include <unotools/guarding.hxx>
#endif
#ifndef _UTL_UNO3_HXX_
#include <unotools/uno3.hxx>
#endif
using namespace utl;
//.........................................................................
namespace frm
{
//.........................................................................
namespace starlang = ::com::sun::star::lang;
namespace staruno = ::com::sun::star::uno;
// ***************************************************************************************************
// ***************************************************************************************************
class OComponentEventThread
:public ::vos::OThread
,public starlang::XEventListener
,public ::cppu::OWeakObject
{
DECLARE_STL_VECTOR(starlang::EventObject*, ThreadEvents);
DECLARE_STL_VECTOR(staruno::Reference<staruno::XAdapter> , ThreadObjects);
DECLARE_STL_VECTOR(sal_Bool, ThreadBools);
OCountedMutex m_aMutex;
::osl::Condition m_aCond; // Queue gefuellt?
ThreadEvents m_aEvents; // Event-Queue
ThreadObjects m_aControls; // Control fuer Submit
ThreadBools m_aFlags; // Flags fuer Submit/Reset
::cppu::OComponentHelper* m_pCompImpl; // Implementierung des Controls
staruno::Reference<starlang::XComponent> m_xComp; // starlang::XComponent des Controls
protected:
// XThread
virtual void SAL_CALL run();
// Die folgende Methode wird gerufen um das Event unter Beruecksichtigung
// seines Typs zu duplizieren.
virtual starlang::EventObject* cloneEvent(const starlang::EventObject* _pEvt) const = 0;
// Ein Event bearbeiten. Der Mutex ist dabei nicht gelockt, pCompImpl
// bleibt aber in jedem Fall gueltig. Bei pEvt kann es sich auch um
// einen abgeleiteten Typ handeln, naemlich den, den cloneEvent
// zurueckgibt. rControl ist nur gesetzt, wenn beim addEvent ein
// Control uebergeben wurde. Da das Control nur als WeakRef gehalten
// wird kann es auch zwischenzeitlich verschwinden.
virtual void processEvent( ::cppu::OComponentHelper* _pCompImpl,
const starlang::EventObject* _pEvt,
const staruno::Reference<starawt::XControl>& _rControl,
sal_Bool _bFlag) = 0;
public:
// UNO Anbindung
DECLARE_UNO3_DEFAULTS(OComponentEventThread, OWeakObject);
virtual staruno::Any SAL_CALL queryInterface(const ::com::sun::star::uno::Type& _rType) throw (::com::sun::star::uno::RuntimeException);
OComponentEventThread(::cppu::OComponentHelper* pCompImpl);
virtual ~OComponentEventThread();
void addEvent( const starlang::EventObject* _pEvt, sal_Bool bFlag = sal_False );
void addEvent( const starlang::EventObject* _pEvt, const staruno::Reference<starawt::XControl>& rControl,
sal_Bool bFlag = sal_False );
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource );
/* resolve ambiguity : both OWeakObject and OObject have these memory operators */
void * SAL_CALL operator new( size_t size ) throw() { return OThread::operator new(size); }
void SAL_CALL operator delete( void * p ) throw() { OThread::operator delete(p); }
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FRM_EVENT_THREAD_HXX_

View File

@@ -0,0 +1,329 @@
/*************************************************************************
*
* $RCSfile: File.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_FILE_HXX_
#include "File.hxx"
#endif
#include <com/sun/star/form/FormComponentType.hpp>
#ifndef _FRM_PROPERTY_HRC_
#include "property.hrc"
#endif
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _UTL_CONTAINER_HXX_
#include <unotools/container.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//------------------------------------------------------------------
InterfaceRef SAL_CALL OFileControlModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OFileControlModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OFileControlModel::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my base class
staruno::Sequence<staruno::Type> aBaseClassTypes = OControlModel::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starform::XReset>*)NULL);
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
}
return aTypes;
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence OFileControlModel::getSupportedServiceNames() throw(staruno::RuntimeException)
{
StringSequence aSupported = OControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FILECONTROL;
return aSupported;
}
//------------------------------------------------------------------
OFileControlModel::OFileControlModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OControlModel(_rxFactory, VCL_CONTROLMODEL_FILECONTROL)
,m_aResetListeners(m_aMutex)
{
m_nClassId = starform::FormComponentType::FILECONTROL;
}
//------------------------------------------------------------------
OFileControlModel::~OFileControlModel()
{
if (!OComponentHelper::rBHelper.bDisposed)
{
acquire();
dispose();
}
}
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OFileControlModel::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn;
aReturn = OControlModel::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<starform::XReset*>(this)
);
return aReturn;
}
// OComponentHelper
//-----------------------------------------------------------------------------
void OFileControlModel::disposing()
{
OControlModel::disposing();
starlang::EventObject aEvt(static_cast<staruno::XWeak*>(this));
m_aResetListeners.disposeAndClear(aEvt);
}
//------------------------------------------------------------------------------
void OFileControlModel::getFastPropertyValue(staruno::Any& rValue, sal_Int32 nHandle) const
{
switch (nHandle)
{
case PROPERTY_ID_DEFAULT_TEXT : rValue <<= m_sDefaultValue; break;
default:
OControlModel::getFastPropertyValue(rValue, nHandle);
}
}
//------------------------------------------------------------------------------
void OFileControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const staruno::Any& rValue)
{
switch (nHandle)
{
case PROPERTY_ID_DEFAULT_TEXT :
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING, "OFileControlModel::setFastPropertyValue_NoBroadcast : invalid type !" );
rValue >>= m_sDefaultValue;
break;
default:
OControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue);
}
}
//------------------------------------------------------------------------------
sal_Bool OFileControlModel::convertFastPropertyValue(staruno::Any& rConvertedValue, staruno::Any& rOldValue, sal_Int32 nHandle, const staruno::Any& rValue)
throw( starlang::IllegalArgumentException )
{
switch (nHandle)
{
case PROPERTY_ID_DEFAULT_TEXT :
return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sDefaultValue);
default:
return OControlModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
}
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OFileControlModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void OFileControlModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(6)
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP1(DEFAULT_TEXT, ::rtl::OUString, BOUND);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
// in den agregierten Properties muss ich noch PROPERTY_ID_TEXT auf transient setzen ...
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, starbeans::PropertyAttribute::TRANSIENT, 0);
FRM_END_PROP_HELPER();
}
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& OFileControlModel::getInfoHelper()
{
return *const_cast<OFileControlModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OFileControlModel::getServiceName()
{
return FRM_COMPONENT_FILECONTROL; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void OFileControlModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
OControlModel::write(_rxOutStream);
::osl::MutexGuard aGuard(m_aMutex);
// Version
_rxOutStream->writeShort(0x0002);
// Default-Wert
_rxOutStream << m_sDefaultValue;
_rxOutStream << m_aHelpText;
}
//------------------------------------------------------------------------------
void OFileControlModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream)
{
OControlModel::read(_rxInStream);
::osl::MutexGuard aGuard(m_aMutex);
// Version
sal_uInt16 nVersion = _rxInStream->readShort();
// Default-Wert
switch (nVersion)
{
case 1:
_rxInStream >> m_sDefaultValue; break;
case 2:
_rxInStream >> m_sDefaultValue;
_rxInStream >> m_aHelpText;
break;
default:
DBG_ERROR("OFileControlModel::read : unknown version !");
m_sDefaultValue = ::rtl::OUString();
}
// Nach dem Lesen die Defaultwerte anzeigen
// _reset();
}
//-----------------------------------------------------------------------------
void SAL_CALL OFileControlModel::reset()
{
::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners);
starlang::EventObject aEvt(static_cast<staruno::XWeak*>(this));
sal_Bool bContinue = sal_True;
while (aIter.hasMoreElements() && bContinue)
bContinue =((starform::XResetListener*)aIter.next())->approveReset(aEvt);
if (bContinue)
{
{
// Wenn Models threadSave
::osl::MutexGuard aGuard(m_aMutex);
_reset();
}
NOTIFY_LISTENERS(m_aResetListeners, starform::XResetListener, resetted, aEvt);
}
}
//-----------------------------------------------------------------------------
void OFileControlModel::addResetListener(const staruno::Reference<starform::XResetListener>& _rxListener)
{
m_aResetListeners.addInterface(_rxListener);
}
//-----------------------------------------------------------------------------
void OFileControlModel::removeResetListener(const staruno::Reference<starform::XResetListener>& _rxListener)
{
m_aResetListeners.removeInterface(_rxListener);
}
//------------------------------------------------------------------------------
void OFileControlModel::_reset()
{
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateSet->setPropertyValue(PROPERTY_TEXT, staruno::makeAny(m_sDefaultValue));
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,138 @@
/*************************************************************************
*
* $RCSfile: File.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_FILE_HXX_
#define _FORMS_FILE_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OFileControlModel
//==================================================================
class OFileControlModel
:public OControlModel
,public starform::XReset
,public ::utl::OAggregationArrayUsageHelper< OFileControlModel >
{
::cppu::OInterfaceContainerHelper m_aResetListeners;
::rtl::OUString m_sDefaultValue;
protected:
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OFileControlModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
~OFileControlModel();
DECLARE_UNO3_AGG_DEFAULTS(OFileControlModel, OControlModel);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OFileControlModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
// OComponentHelper
virtual void SAL_CALL disposing();
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);
virtual sal_Bool SAL_CALL convertFastPropertyValue(staruno::Any& rConvertedValue, staruno::Any& rOldValue, sal_Int32 nHandle, const staruno::Any& rValue )
throw(starlang::IllegalArgumentException);
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
// starform::XReset
virtual void SAL_CALL reset();
virtual void SAL_CALL addResetListener(const staruno::Reference<starform::XResetListener>& _rxListener);
virtual void SAL_CALL removeResetListener(const staruno::Reference<starform::XResetListener>& _rxListener);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
protected:
void _reset();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FORMS_FILE_HXX_

View File

@@ -0,0 +1,174 @@
/*************************************************************************
*
* $RCSfile: FixedText.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_FIXEDTEXT_HXX_
#include "FixedText.hxx"
#endif
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _FRM_PROPERTY_HRC_
#include "property.hrc"
#endif
#ifndef _FRM_PROPERTY_HXX_
#include "property.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//------------------------------------------------------------------------------
InterfaceRef SAL_CALL OFixedTextModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new OFixedTextModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OFixedTextModel::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes = OControlModel::_getTypes();
return aTypes;
}
//------------------------------------------------------------------
OFixedTextModel::OFixedTextModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rFactory)
:OControlModel(_rFactory, VCL_CONTROLMODEL_FIXEDTEXT)
{
m_nClassId = starform::FormComponentType::FIXEDTEXT;
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OFixedTextModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
{
StringSequence aSupported = OControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString* pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_FIXEDTEXT;
return aSupported;
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OFixedTextModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo(createPropertySetInfo(getInfoHelper()));
return xInfo;
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OFixedTextModel::getInfoHelper()
{
return *const_cast<OFixedTextModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
void OFixedTextModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(4)
RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
DECL_PROP1(NAME, rtl::OUString, BOUND);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP1(TAG, rtl::OUString, BOUND);
DECL_PROP1(HELPTEXT,rtl::OUString, BOUND);
FRM_END_PROP_HELPER();
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OFixedTextModel::getServiceName() throw(staruno::RuntimeException)
{
return FRM_COMPONENT_FIXEDTEXT; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void SAL_CALL OFixedTextModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
throw(stario::IOException, staruno::RuntimeException)
{
OControlModel::write(_rxOutStream);
// Version
_rxOutStream->writeShort(0x0002);
_rxOutStream << m_aHelpText;
}
//------------------------------------------------------------------------------
void SAL_CALL OFixedTextModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException)
{
OControlModel::read(_rxInStream);
// Version
sal_Int16 nVersion = _rxInStream->readShort();
if (nVersion > 1)
_rxInStream >> m_aHelpText;
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,117 @@
/*************************************************************************
*
* $RCSfile: FixedText.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_FIXEDTEXT_HXX_
#define _FORMS_FIXEDTEXT_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
//.........................................................................
namespace frm
{
//==================================================================
// OFixedTextModel
//==================================================================
class OFixedTextModel
:public OControlModel
,public ::utl::OAggregationArrayUsageHelper< OFixedTextModel >
{
protected:
// UNO Anbindung
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OFixedTextModel(
const staruno::Reference<starlang::XMultiServiceFactory>& _rFactory // factory to create the aggregate with
);
// XPropertySetRef
virtual staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// XServiceInfo
IMPLEMENTATION_NAME(OFixedTextModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
// XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
virtual void SAL_CALL
write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_FIXEDTEXT_HXX_

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,212 @@
/*************************************************************************
*
* $RCSfile: FormattedField.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_FORMATTEDFIELD_HXX_
#define _FORMS_FORMATTEDFIELD_HXX_
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
#ifndef _LANG_HXX
#include <tools/lang.hxx>
#endif
#ifndef _UNOTOOLS_PROPERTY_MULTIPLEX_HXX_
#include <unotools/propmultiplex.hxx>
#endif
//.........................................................................
namespace frm
{
//==================================================================
//= OFormattedModel
//==================================================================
class OFormattedModel
:public OEditBaseModel
,public OPropertyChangeListener
,public ::utl::OAggregationArrayUsageHelper< OFormattedModel >
{
// das Original, falls ich die Format-Properties meines aggregierten Models gefaket, d.h. von dem Feld, an das
// ich gebunden bin, weitergereicht habe (nur gueltig wenn loaded)
staruno::Reference<starutil::XNumberFormatsSupplier> m_xOriginalFormatter;
Date m_aNullDate;
staruno::Any m_aSaveValue;
sal_Int16 m_nKeyType;
sal_Bool m_bOriginalNumeric : 1,
m_bNumeric : 1;
// analog fuer TreatAsNumeric-Property
static staruno::Reference<starutil::XNumberFormatsSupplier> s_xDefaultFormatter;
static sal_Int32 nValueHandle;
// falls ich wirklich mal einen selber benutzen muss, wird der zwischen allen Instanzen geteilt
protected:
virtual void _onValueChanged();
staruno::Reference<starutil::XNumberFormatsSupplier> calcDefaultFormatsSupplier() const;
staruno::Reference<starutil::XNumberFormatsSupplier> calcFormFormatsSupplier() const;
staruno::Reference<starutil::XNumberFormatsSupplier> calcFormatsSupplier() const;
sal_Int32 calcFormatKey() const;
void getFormatDescription(::rtl::OUString& sFormat, LanguageType& eLanguage);
OFormattedModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
friend InterfaceRef SAL_CALL OFormattedModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
friend class OFormattedFieldWrapper;
public:
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OFormattedModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starform::XBoundComponent
virtual sal_Bool _commit();
// stario::XPersistObject
virtual void SAL_CALL write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
virtual ::rtl::OUString SAL_CALL getServiceName();
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> 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);
// starform::XLoadListener
virtual void SAL_CALL loaded(const starlang::EventObject& rEvent);
virtual void _loaded(const starlang::EventObject& rEvent);
virtual void _unloaded();
// starform::XReset
virtual void _reset( void );
// starbeans::XPropertyState
void setPropertyToDefaultByHandle(sal_Int32 nHandle);
staruno::Any getPropertyDefaultByHandle(sal_Int32 nHandle) const;
void SAL_CALL setPropertyToDefault(const ::rtl::OUString& aPropertyName) throw(starbeans::UnknownPropertyException, staruno::RuntimeException);
staruno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw(starbeans::UnknownPropertyException, staruno::RuntimeException);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
// OPropertyChangeListener
virtual void _propertyChanged(const starbeans::PropertyChangeEvent& evt) throw(staruno::RuntimeException);
protected:
virtual sal_Int16 getPersistenceFlags() const;
// as we have an own version handling for persistence
};
//==================================================================
//= OFormattedControl
//==================================================================
class OFormattedControl : public OBoundControl
,public starawt::XKeyListener
{
sal_uInt32 m_nKeyEvent;
public:
OFormattedControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OFormattedControl();
DECLARE_UNO3_AGG_DEFAULTS(OFormattedControl, OBoundControl);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
virtual staruno::Sequence<staruno::Type> _getTypes();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OFormattedControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
// starawt::XKeyListener
virtual void SAL_CALL keyPressed(const starawt::KeyEvent& e);
virtual void SAL_CALL keyReleased(const starawt::KeyEvent& e);
// starawt::XControl
virtual void SAL_CALL setDesignMode(sal_Bool bOn);
private:
DECL_LINK( OnKeyPressed, void* );
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_FORMATTEDFIELD_HXX_

View File

@@ -0,0 +1,350 @@
/*************************************************************************
*
* $RCSfile: FormattedFieldWrapper.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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_FORMATTED_FIELD_WRAPPER_HXX_
#include "FormattedFieldWrapper.hxx"
#endif
#ifndef _FORMS_EDIT_HXX_
#include "Edit.hxx"
#endif
#ifndef _FORMS_FORMATTEDFIELD_HXX_
#include "FormattedField.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _UTL_UNO3_DB_TOOLS_HXX_
#include <unotools/dbtools.hxx>
#endif
#ifndef _ISOLANG_HXX
#include <tools/isolang.hxx>
#endif
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _TOOLS_INTN_HXX
#include <tools/intn.hxx>
#endif
//.........................................................................
namespace frm
{
//==================================================================
// OFormattedFieldWrapper
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OFormattedFieldWrapper(_rxFactory, sal_True));
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OFormattedFieldWrapper(_rxFactory, sal_False));
}
//------------------------------------------------------------------
OFormattedFieldWrapper::OFormattedFieldWrapper(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory, sal_Bool _bActAsFormatted)
:m_pEditPart(NULL)
,m_xServiceFactory(_rxFactory)
{
if (_bActAsFormatted)
{
increment(m_refCount);
{
// instantiate an FormattedModel
InterfaceRef xFormattedModel;
// (instantiate it directly ..., as the OFormattedModel isn't registered for any service names anymore)
OFormattedModel* pModel = new OFormattedModel(m_xServiceFactory);
query_interface(static_cast<staruno::XWeak*>(pModel), xFormattedModel);
m_xAggregate = staruno::Reference<staruno::XAggregation> (xFormattedModel, staruno::UNO_QUERY);
DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::OFormattedFieldWrapper : the OFormattedModel didn't have an staruno::XAggregation interface !");
// _before_ setting the delegator, give it to the member references
query_interface(xFormattedModel, m_xFormattedPart);
m_pEditPart = new OEditModel(m_xServiceFactory);
m_pEditPart->acquire();
}
if (m_xAggregate.is())
{ // has to be in it's own block because of the temporary variable created by *this
m_xAggregate->setDelegator(static_cast<staruno::XWeak*>(this));
}
decrement(m_refCount);
}
}
//------------------------------------------------------------------
OFormattedFieldWrapper::~OFormattedFieldWrapper()
{
// release the aggregated object (if any)
if (m_xAggregate.is())
m_xAggregate->setDelegator(InterfaceRef ());
if (m_pEditPart)
m_pEditPart->release();
}
//------------------------------------------------------------------
staruno::Any SAL_CALL OFormattedFieldWrapper::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn;
if (_rType.equals( ::getCppuType( static_cast< staruno::Reference< starlang::XTypeProvider >* >(NULL) ) ) )
{ // a XTypeProvider interface needs a working aggregate - we don't want to give the type provider
// of our base class (OWeakAggObject) to the caller as it supplies nearly nothing
ensureAggregate();
if (m_xAggregate.is())
aReturn = m_xAggregate->queryAggregation(_rType);
}
if (!aReturn.hasValue())
aReturn = OWeakAggObject::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<stario::XPersistObject*>(this)
);
if (!aReturn.hasValue())
{
// somebody requests an interface other than the basics (staruno::XInterface) and other than
// the only one we can supply without an aggregate. So ensure the aggregate exists.
ensureAggregate();
if (m_xAggregate.is())
aReturn = m_xAggregate->queryAggregation(_rType);
}
return aReturn;
}
//------------------------------------------------------------------
::rtl::OUString SAL_CALL OFormattedFieldWrapper::getServiceName() throw(staruno::RuntimeException)
{
// return the old compatibility name for an EditModel
return FRM_COMPONENT_EDIT;
}
//------------------------------------------------------------------
void SAL_CALL OFormattedFieldWrapper::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw( stario::IOException, staruno::RuntimeException )
{
// can't write myself
ensureAggregate();
// if we act as real edit field, we can simple forward this write request
if (!m_xFormattedPart.is())
{
staruno::Reference<stario::XPersistObject> xAggregatePersistence;
query_aggregation(m_xAggregate, xAggregatePersistence);
DBG_ASSERT(xAggregatePersistence.is(), "OFormattedFieldWrapper::write : don't know how to handle this : can't write !");
// oops ... We gave an stario::XPersistObject interface to the caller but now we aren't an stario::XPersistObject ...
if (xAggregatePersistence.is())
xAggregatePersistence->write(_rxOutStream);
return;
}
// else we have to write an edit part first
DBG_ASSERT(m_pEditPart, "OFormattedFieldWrapper::write : formatted part without edit part ?");
// for this we transfer the current props of the formatted part to the edit part
staruno::Reference<starbeans::XPropertySet> xFormatProps(m_xFormattedPart, staruno::UNO_QUERY);
staruno::Reference<starbeans::XPropertySet> xEditProps;
query_interface(static_cast<staruno::XWeak*>(m_pEditPart), xEditProps);
UniString sLanguage, sCountry;
ConvertLanguageToIsoNames(Application::GetAppInternational().GetLanguage(), sLanguage, sCountry);
starlang::Locale aAppLanguage(
sLanguage,
sCountry,
::rtl::OUString());
TransferFormComponentProperties(xFormatProps, xEditProps, aAppLanguage);
// then write the edit part, after switching to "fake mode"
m_pEditPart->enableFormattedWriteFake();
m_pEditPart->write(_rxOutStream);
m_pEditPart->disableFormattedWriteFake();
// and finally write the formatted part we're really interested in
m_xFormattedPart->write(_rxOutStream);
}
//------------------------------------------------------------------
void SAL_CALL OFormattedFieldWrapper::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw( stario::IOException, staruno::RuntimeException )
{
if (m_xAggregate.is())
{ // we alread did a decision if we're an EditModel or a FormattedModel
// if we act as formatted, we have to read the edit part first
if (m_xFormattedPart.is())
{
// two possible cases:
// a) the stuff was written by a version which didn't work with an Edit header (all intermediate
// versions >5.1 && <=568)
// b) it was written by a version using edit headers
// as we can distinguish a) from b) only after we have read the edit part, we need to remember the
// position
staruno::Reference<stario::XMarkableStream> xInMarkable(_rxInStream, staruno::UNO_QUERY);
DBG_ASSERT(xInMarkable.is(), "OFormattedFieldWrapper::read : can only work with markable streams !");
sal_Int32 nBeforeEditPart = xInMarkable->createMark();
m_pEditPart->read(_rxInStream);
// this only works because an edit model can read the stuff written by a formatted model (maybe with
// some assertions) , but not vice versa
if (!m_pEditPart->lastReadWasFormattedFake())
{ // case a), written with a version without the edit part fake, so seek to the start position, again
xInMarkable->jumpToMark(nBeforeEditPart);
}
xInMarkable->deleteMark(nBeforeEditPart);
}
staruno::Reference<stario::XPersistObject> xAggregatePersistence;
query_aggregation(m_xAggregate, xAggregatePersistence);
DBG_ASSERT(xAggregatePersistence.is(), "OFormattedFieldWrapper::read : don't know how to handle this : can't read !");
// oops ... We gave an stario::XPersistObject interface to the caller but now we aren't an stario::XPersistObject ...
if (xAggregatePersistence.is())
xAggregatePersistence->read(_rxInStream);
return;
}
// we have to decide from the data within the stream whether we should be an EditModel or a FormattedModel
OEditBaseModel* pNewAggregate = NULL;
// let an OEditModel do the reading
OEditModel* pBasicReader = new OEditModel(m_xServiceFactory);
pBasicReader->read(_rxInStream);
// was it really an edit model ?
if (!pBasicReader->lastReadWasFormattedFake())
// yes -> all fine
pNewAggregate = pBasicReader;
else
{ // no -> substitute it with a formatted model
// let the formmatted model do the reading
OFormattedModel* pFormattedReader = new OFormattedModel(m_xServiceFactory);
pFormattedReader->read(_rxInStream);
// for the next write (if any) : the FormattedModel and the EditModel parts
query_interface(static_cast<staruno::XWeak*>(pFormattedReader), m_xFormattedPart);
m_pEditPart = pBasicReader;
m_pEditPart->acquire();
// aggregate the formatted part below
pNewAggregate = pFormattedReader;
}
// do the aggregation
increment(m_refCount);
{
query_interface(static_cast<staruno::XWeak*>(pNewAggregate), m_xAggregate);
DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::read : the OEditModel didn't have an staruno::XAggregation interface !");
}
if (m_xAggregate.is())
{ // has to be in it's own block because of the temporary variable created by *this
m_xAggregate->setDelegator(static_cast<staruno::XWeak*>(this));
}
decrement(m_refCount);
}
//------------------------------------------------------------------
void OFormattedFieldWrapper::ensureAggregate()
{
if (m_xAggregate.is())
return;
increment(m_refCount);
{
// instantiate an EditModel (the only place where we are allowed to decide that we're an FormattedModel
// is in ::read)
InterfaceRef xEditModel = m_xServiceFactory->createInstance(FRM_SUN_COMPONENT_TEXTFIELD);
if (!xEditModel.is())
{
// arghhh ... instantiate it directly ... it's dirty, but we really need this aggregate
OEditModel* pModel = new OEditModel(m_xServiceFactory);
query_interface(static_cast<staruno::XWeak*>(pModel), xEditModel);
}
m_xAggregate = staruno::Reference<staruno::XAggregation> (xEditModel, staruno::UNO_QUERY);
DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::ensureAggregate : the OEditModel didn't have an staruno::XAggregation interface !");
}
if (m_xAggregate.is())
{ // has to be in it's own block because of the temporary variable created by *this
m_xAggregate->setDelegator(static_cast<staruno::XWeak*>(this));
}
decrement(m_refCount);
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,120 @@
/*************************************************************************
*
* $RCSfile: FormattedFieldWrapper.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_FORMATTED_FIELD_WRAPPER_HXX_
#define _FRM_FORMATTED_FIELD_WRAPPER_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
//.........................................................................
namespace frm
{
class OEditModel;
//==================================================================
//= OFormattedFieldWrapper
//==================================================================
class OFormattedFieldWrapper
:public stario::XPersistObject
,public ::cppu::OWeakAggObject
{
staruno::Reference<starlang::XMultiServiceFactory> m_xServiceFactory;
protected:
staruno::Reference<staruno::XAggregation> m_xAggregate;
OEditModel* m_pEditPart;
// if we act as formatted this is used to write the EditModel part
staruno::Reference<stario::XPersistObject> m_xFormattedPart;
// if we act as formatted, this is the PersistObject interface of our aggregate, used
// to read and write the FormattedModel part
OFormattedFieldWrapper(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory, sal_Bool _bActAsFormatted);
// if _bActAsFormatted is sal_False, the state is undetermined until somebody calls ::read or does
// anything which requires a living aggregate
virtual ~OFormattedFieldWrapper();
friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
friend InterfaceRef SAL_CALL OFormattedFieldWrapper_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
public:
// UNO
DECLARE_UNO3_AGG_DEFAULTS(OFormattedFieldWrapper, OWeakAggObject);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// stario::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
virtual void SAL_CALL write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
protected:
/// ensure we're in a defined state, which means a FormattedModel _OR_ an EditModel
void ensureAggregate();
};
//.........................................................................
}
//.........................................................................
#endif // _FRM_FORMATTED_FIELD_WRAPPER_HXX_

View File

@@ -0,0 +1,207 @@
/*************************************************************************
*
* $RCSfile: FormsCollection.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): _______________________________________
*
*
************************************************************************/
#include "FormsCollection.hxx"
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _UTL_SEQUENCE_HXX_
#include <unotools/sequence.hxx>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
#include <com/sun/star/form/XForm.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//------------------------------------------------------------------
DBG_NAME(OFormsCollection)
//------------------------------------------------------------------
InterfaceRef SAL_CALL OFormsCollection_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OFormsCollection(_rxFactory));
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OFormsCollection::getServiceName() throw(staruno::RuntimeException)
{
return FRM_SUN_FORMS_COLLECTION;
}
//------------------------------------------------------------------------------
staruno::Sequence< sal_Int8 > SAL_CALL OFormsCollection::getImplementationId( ) throw(staruno::RuntimeException)
{
return OImplementationIds::getImplementationId(getTypes());
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> SAL_CALL OFormsCollection::getTypes() throw(staruno::RuntimeException)
{
staruno::Sequence<staruno::Type> aBaseTypes = OInterfaceContainer::getTypes();
staruno::Sequence<staruno::Type> aComponentTypes = FormsCollectionComponentBase::getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
aOwnTypes.getArray()[0] = ::getCppuType(static_cast<staruno::Reference<starcontainer::XChild>*>(NULL));
return concatSequences(aBaseTypes, aComponentTypes, aOwnTypes);
}
//------------------------------------------------------------------
OFormsCollection::OFormsCollection(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:FormsCollectionComponentBase(m_aMutex)
,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<staruno::Reference<starform::XForm>*>(NULL)))
{
DBG_CTOR(OFormsCollection, NULL);
}
//------------------------------------------------------------------------------
OFormsCollection::~OFormsCollection()
{
DBG_DTOR(OFormsCollection, NULL);
if (!FormsCollectionComponentBase::rBHelper.bDisposed)
{
acquire();
dispose();
}
}
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OFormsCollection::queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException)
{
staruno::Any aReturn = ::cppu::queryInterface(
_rType,
static_cast<starcontainer::XChild*>(this),
static_cast<starlang::XServiceInfo*>(this)
);
if (!aReturn.hasValue())
aReturn = OInterfaceContainer::queryInterface(_rType);
if (!aReturn.hasValue())
aReturn = FormsCollectionComponentBase::queryAggregation(_rType);
return aReturn;
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OFormsCollection::getImplementationName() throw(staruno::RuntimeException)
{
return ::rtl::OUString::createFromAscii("com.sun.star.form.OFormsCollection");
}
//------------------------------------------------------------------------------
sal_Bool SAL_CALL OFormsCollection::supportsService( const ::rtl::OUString& _rServiceName ) throw(staruno::RuntimeException)
{
staruno::Sequence<rtl::OUString> aSupported = getSupportedServiceNames();
const rtl::OUString* pSupported = aSupported.getConstArray();
for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported)
if (pSupported->equals(_rServiceName))
return sal_True;
return sal_False;
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(staruno::RuntimeException)
{
StringSequence aReturn(2);
aReturn.getArray()[0] = FRM_SUN_FORMS_COLLECTION;
aReturn.getArray()[1] = ::rtl::OUString::createFromAscii("com.sun.star.form.FormComponents");
return aReturn;
}
// OComponentHelper
//------------------------------------------------------------------------------
void OFormsCollection::disposing()
{
OInterfaceContainer::disposing();
FormsCollectionComponentBase::disposing();
m_xParent = NULL;
}
//XChild
//------------------------------------------------------------------------------
void OFormsCollection::setParent(const InterfaceRef& Parent) throw( starlang::NoSupportException, staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
m_xParent = Parent;
}
//------------------------------------------------------------------------------
InterfaceRef OFormsCollection::getParent() throw( staruno::RuntimeException )
{
return m_xParent;
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,138 @@
/*************************************************************************
*
* $RCSfile: FormsCollection.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_INTERFACE_CONTAINER_HXX_
#include "InterfaceContainer.hxx"
#endif
#ifndef _CPPUHELPER_COMPONENT_HXX_
#include <cppuhelper/component.hxx>
#endif
#ifndef _UTL_UNO3_HXX_
#include <unotools/uno3.hxx>
#endif
#ifndef _FRM_IDS_HXX_
#include "ids.hxx"
#endif
#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
#include <com/sun/star/lang/XServiceInfo.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OFormsCollection
// Implementiert den UNO-Container fuer Formulare
// enthaelt alle zugeordneten Forms
// dieses Container kann selbst den Context fuer Formulare darstellen
// oder au<61>en einen Context uebergeben bekommen
//==================================================================
typedef ::cppu::OComponentHelper FormsCollectionComponentBase;
// else MSVC kills itself on some statements
class OFormsCollection
:public FormsCollectionComponentBase
,public OInterfaceContainer
,public starcontainer::XChild
,public starlang::XServiceInfo
{
::osl::Mutex m_aMutex;
OImplementationIdsRef m_aHoldIdHelper;
::utl::InterfaceRef m_xParent; // Parent
public:
OFormsCollection(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OFormsCollection();
public:
DECLARE_UNO3_AGG_DEFAULTS(OFormsCollection, FormsCollectionComponentBase);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// XTypeProvider
virtual staruno::Sequence< staruno::Type > SAL_CALL getTypes( ) throw(staruno::RuntimeException);
virtual staruno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(staruno::RuntimeException);
// XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(staruno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(staruno::RuntimeException);
virtual StringSequence SAL_CALL getSupportedServiceNames( ) throw(staruno::RuntimeException);
// OComponentHelper
virtual void SAL_CALL disposing();
// starcontainer::XChild
virtual ::utl::InterfaceRef SAL_CALL getParent() throw(staruno::RuntimeException);
virtual void SAL_CALL setParent(const ::utl::InterfaceRef& Parent) throw(starlang::NoSupportException, staruno::RuntimeException);
};
//.........................................................................
} // namespace frm
//.........................................................................

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,228 @@
/*************************************************************************
*
* $RCSfile: Grid.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
#ifndef _COM_SUN_STAR_FORM_XLOADLISTENER_HPP_
#include <com/sun/star/form/XLoadListener.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XGRIDCOLUMNFACTORY_HPP_
#include <com/sun/star/form/XGridColumnFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_VIEW_XSELECTIONSUPPLIER_HPP_
#include <com/sun/star/view/XSelectionSupplier.hpp>
#endif
#ifndef _LINK_HXX
#include <tools/link.hxx>
#endif
#ifndef _FRM_INTERFACE_CONTAINER_HXX_
#include "InterfaceContainer.hxx"
#endif
#ifndef _UNOTOOLS_PROPERTY_ARRAY_HELPER_HXX_
#include <unotools/proparrhlp.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
namespace starview = ::com::sun::star::view;
//==================================================================
// OGridControlModel
//==================================================================
class OGridColumn;
class OGridControlModel :public OControlModel
,public OInterfaceContainer
,public OAggregationArrayUsageHelper<OGridControlModel>
// though we don't use aggregation, we're derived from an OPropertySetAggregationHelper,
// which expects that we use an OPropertyArrayAggregationHelper, which we ensure
// with deriving from OAggregationArrayUsageHelper
,public starawt::XControlModel
,public starform::XGridColumnFactory
,public starform::XLoadListener
,public starform::XReset
,public starview::XSelectionSupplier
{
::cppu::OInterfaceContainerHelper
m_aSelectListeners,
m_aResetListeners;
staruno::Reference<starbeans::XPropertySet> m_xSelection;
sal_uInt32 m_nFontEvent;
// [properties]
::rtl::OUString m_aDefaultControl;
staruno::Any m_aRowHeight; // Zeilenhoehe
staruno::Any m_aTabStop;
staruno::Any m_aTextColor;
staruno::Any m_aBackgroundColor;
starawt::FontDescriptor m_aFont;
starawt::FontDescriptor m_aOldFont;
sal_Int16 m_nBorder;
sal_Bool m_bEnable : 1;
sal_Bool m_bNavigation : 1;
sal_Bool m_bRecordMarker : 1;
sal_Bool m_bPrintable : 1;
sal_Bool m_bAlwaysShowCursor : 1; // transient
sal_Bool m_bDisplaySynchron : 1; // transient
staruno::Any m_aCursorColor; // transient
::rtl::OUString m_sHelpURL; // URL
// [properties]
protected:
virtual staruno::Sequence<staruno::Type> _getTypes();
void _reset();
public:
OGridControlModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OGridControlModel();
// UNO Anbindung
DECLARE_UNO3_AGG_DEFAULTS(OGridControlModel, OControlModel);
virtual staruno::Any SAL_CALL queryAggregation( const staruno::Type& _rType ) throw (staruno::RuntimeException);
// starcontainer::XChild
virtual void SAL_CALL setParent(const InterfaceRef& Parent) throw(starlang::NoSupportException, staruno::RuntimeException);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OGridControlModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
// OComponentHelper
virtual void SAL_CALL disposing();
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
// starform::XLoadListener
virtual void SAL_CALL loaded(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL unloaded(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL unloading(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL reloading(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL reloaded(const starlang::EventObject& aEvent) throw(staruno::RuntimeException);
// starform::XReset
virtual void SAL_CALL reset();
virtual void SAL_CALL addResetListener(const staruno::Reference<starform::XResetListener>& _rxListener);
virtual void SAL_CALL removeResetListener(const staruno::Reference<starform::XResetListener>& _rxListener);
// ::com::sun::star::view::XSelectionSupplier
virtual sal_Bool SAL_CALL select(const staruno::Any& aElement) throw(starlang::IllegalArgumentException, staruno::RuntimeException);
virtual staruno::Any SAL_CALL getSelection() throw(staruno::RuntimeException);
virtual void SAL_CALL addSelectionChangeListener(const staruno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeSelectionChangeListener(const staruno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener) throw(staruno::RuntimeException);
// starform::XGridColumnFactory
virtual staruno::Reference<starbeans::XPropertySet> SAL_CALL createColumn(const ::rtl::OUString& ColumnType);
virtual StringSequence SAL_CALL getColumnTypes();
// stario::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName();
virtual void SAL_CALL write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> 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 );
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
protected:
virtual void insert(sal_Int32 _nIndex, const InterfaceRef& _Object, sal_Bool bEvents)
throw(starlang::IllegalArgumentException);
staruno::Reference<starbeans::XPropertySet> createColumn(sal_Int32 nTypeId) const;
OGridColumn* getColumnImplementation(const InterfaceRef& _rxIFace) const;
private:
DECL_LINK( OnFontChanged, void* );
};
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,211 @@
/*************************************************************************
*
* $RCSfile: GroupBox.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_GROUPBOX_HXX_
#include "GroupBox.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 <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//==================================================================
// OGroupBoxModel
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OGroupBoxModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new OGroupBoxModel(_rxFactory));
}
//------------------------------------------------------------------
OGroupBoxModel::OGroupBoxModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OControlModel(_rxFactory, VCL_CONTROLMODEL_GROUPBOX, VCL_CONTROL_GROUPBOX)
{
m_nClassId = starform::FormComponentType::GROUPBOX;
}
// XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OGroupBoxModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
{
StringSequence aSupported = OControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString* pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GROUPBOX;
return aSupported;
}
//------------------------------------------------------------------
OGroupBoxModel::~OGroupBoxModel()
{
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OGroupBoxModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OGroupBoxModel::getInfoHelper()
{
return *const_cast<OGroupBoxModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
void OGroupBoxModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(4)
// don't want to have the TabStop property
RemoveProperty(_rAggregateProps, PROPERTY_TABSTOP);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
FRM_END_PROP_HELPER();
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OGroupBoxModel::getServiceName() throw(staruno::RuntimeException)
{
return FRM_COMPONENT_GROUPBOX; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void SAL_CALL OGroupBoxModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
throw(stario::IOException, staruno::RuntimeException)
{
OControlModel::write(_rxOutStream);
// Version
_rxOutStream->writeShort(0x0002);
_rxOutStream << m_aHelpText;
}
//------------------------------------------------------------------------------
void SAL_CALL OGroupBoxModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException)
{
OControlModel::read( _rxInStream );
// Version
sal_uInt16 nVersion = _rxInStream->readShort();
DBG_ASSERT(nVersion > 0, "OGroupBoxModel::read : version 0 ? this should never have been written !");
// ups, ist das Englisch richtig ? ;)
if (nVersion == 2)
_rxInStream >> m_aHelpText;
if (nVersion > 0x0002)
{
DBG_ERROR("OGroupBoxModel::read : unknown version !");
}
};
//==================================================================
// OGroupBoxControl
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OGroupBoxControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new OGroupBoxControl(_rxFactory));
}
//------------------------------------------------------------------------------
OGroupBoxControl::OGroupBoxControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OControl(_rxFactory, VCL_CONTROL_GROUPBOX)
{
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OGroupBoxControl::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
{
StringSequence aSupported = OControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString* pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_GROUPBOX;
return aSupported;
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,125 @@
/*************************************************************************
*
* $RCSfile: GroupBox.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_GROUPBOX_HXX_
#define _FORMS_GROUPBOX_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
//.........................................................................
namespace frm
{
//==================================================================
// OGroupBoxModel
//==================================================================
class OGroupBoxModel
:public OControlModel
,public ::utl::OAggregationArrayUsageHelper< OGroupBoxModel >
{
public:
OGroupBoxModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OGroupBoxModel();
// XServiceInfo
IMPLEMENTATION_NAME(OGroupBoxModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
// XPropertySetRef
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
//==================================================================
// OGroupBoxControl (nur aus Kompatibilit<69>t zur 5.0)
//==================================================================
class OGroupBoxControl : public OControl
{
public:
OGroupBoxControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// XServiceInfo
IMPLEMENTATION_NAME(OGroupBoxControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_GROUPBOX_HXX_

View File

@@ -0,0 +1,532 @@
/*************************************************************************
*
* $RCSfile: GroupManager.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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_GROUPMANAGER_HXX_
#include "GroupManager.hxx"
#endif
#ifndef _FRM_DATABASEFORM_HXX_
#include "DatabaseForm.hxx"
#endif
#include <com/sun/star/beans/XFastPropertySet.hpp>
#ifndef _UTL_PROPERTY_HXX_
#include <unotools/property.hxx>
#endif
#ifndef _UTL_TYPES_HXX_
#include <unotools/types.hxx>
#endif
#ifndef _SOLAR_H
#include <tools/solar.h>
#endif
#include <tools/debug.hxx>
#include "property.hrc"
//.........................................................................
namespace frm
{
//.........................................................................
//========================================================================
// class OGroupCompAcc
//========================================================================
//------------------------------------------------------------------
OGroupCompAcc::OGroupCompAcc(const staruno::Reference<starbeans::XPropertySet>& rxElement, const OGroupComp& _rGroupComp )
:m_xComponent( rxElement )
,m_aGroupComp( _rGroupComp )
{
}
//------------------------------------------------------------------
sal_Bool OGroupCompAcc::operator==( const OGroupCompAcc& rCompAcc ) const
{
return (m_xComponent == rCompAcc.GetComponent());
}
//------------------------------------------------------------------
class OGroupCompAccLess : public ::std::binary_function<OGroupCompAcc, OGroupCompAcc, sal_Bool>
{
public:
sal_Bool operator() (const OGroupCompAcc& lhs, const OGroupCompAcc& rhs) const
{
return
reinterpret_cast<sal_Int64>(lhs.m_xComponent.get())
< reinterpret_cast<sal_Int64>(rhs.m_xComponent.get());
}
};
//========================================================================
// class OGroupComp
//========================================================================
//------------------------------------------------------------------
OGroupComp::OGroupComp()
:m_nTabIndex( 0 )
,m_nPos( -1 )
{
}
//------------------------------------------------------------------
OGroupComp::OGroupComp(const OGroupComp& _rSource)
:m_aName( _rSource.m_aName )
,m_xComponent( _rSource.m_xComponent )
,m_nTabIndex( _rSource.m_nTabIndex )
,m_nPos( _rSource.m_nPos )
{
}
//------------------------------------------------------------------
OGroupComp::OGroupComp(const staruno::Reference<starbeans::XPropertySet>& rxSet, sal_Int32 nInsertPos )
:m_xComponent( rxSet )
,m_nTabIndex(0)
,m_nPos( nInsertPos )
{
if (m_xComponent.is())
{
if (hasProperty( PROPERTY_TABINDEX, m_xComponent ) )
// Indices kleiner 0 werden wie 0 behandelt
m_nTabIndex = Max(getINT16(m_xComponent->getPropertyValue( PROPERTY_TABINDEX )) , sal_Int16(0));
m_xComponent->getPropertyValue( PROPERTY_NAME ) >>= m_aName;
}
}
//------------------------------------------------------------------
sal_Bool OGroupComp::operator==( const OGroupComp& rComp ) const
{
return m_nTabIndex == rComp.GetTabIndex() && m_nPos == rComp.GetPos();
}
//------------------------------------------------------------------
class OGroupCompLess : public ::std::binary_function<OGroupComp, OGroupComp, sal_Bool>
{
public:
sal_Bool operator() (const OGroupComp& lhs, const OGroupComp& rhs) const
{
sal_Bool bResult;
// TabIndex von 0 wird hinten einsortiert
if (lhs.m_nTabIndex == rhs.GetTabIndex())
bResult = lhs.m_nPos < rhs.GetPos();
else if (lhs.m_nTabIndex && rhs.GetTabIndex())
bResult = lhs.m_nTabIndex < rhs.GetTabIndex();
else
bResult = lhs.m_nTabIndex != 0;
return bResult;
}
};
//========================================================================
// class OGroup
//========================================================================
DBG_NAME(OGroup)
//------------------------------------------------------------------
OGroup::OGroup( const ::rtl::OUString& rGroupName )
:m_aGroupName( rGroupName )
,m_nInsertPos(0)
{
DBG_CTOR(OGroup,NULL);
}
//------------------------------------------------------------------
OGroup::~OGroup()
{
DBG_DTOR(OGroup,NULL);
}
//------------------------------------------------------------------
void OGroup::InsertComponent( const staruno::Reference<starbeans::XPropertySet>& xSet )
{
OGroupComp aNewGroupComp( xSet, m_nInsertPos );
sal_Int32 nPosInserted = insert_sorted(m_aCompArray, aNewGroupComp, OGroupCompLess());
OGroupCompAcc aNewGroupCompAcc( xSet, m_aCompArray[nPosInserted] );
insert_sorted(m_aCompAccArray, aNewGroupCompAcc, OGroupCompAccLess());
m_nInsertPos++;
}
//------------------------------------------------------------------
void OGroup::RemoveComponent( const staruno::Reference<starbeans::XPropertySet>& rxElement )
{
sal_Int32 nGroupCompAccPos;
OGroupCompAcc aSearchCompAcc( rxElement, OGroupComp() );
if ( seek_entry(m_aCompAccArray, aSearchCompAcc, nGroupCompAccPos, OGroupCompAccLess()) )
{
OGroupCompAcc& aGroupCompAcc = m_aCompAccArray[nGroupCompAccPos];
const OGroupComp& aGroupComp = aGroupCompAcc.GetGroupComponent();
sal_Int32 nGroupCompPos;
if ( seek_entry(m_aCompArray, aGroupComp, nGroupCompPos, OGroupCompLess()) )
{
m_aCompAccArray.erase( m_aCompAccArray.begin() + nGroupCompAccPos );
m_aCompArray.erase( m_aCompArray.begin() + nGroupCompPos );
/*============================================================
Durch das Entfernen der GroupComp ist die Einfuegeposition
ungueltig geworden. Sie braucht hier aber nicht angepasst werden,
da sie fortlaufend vergeben wird und damit immer
aufsteigend eindeutig ist.
============================================================*/
}
else
{
DBG_ERROR( "OGroup::RemoveComponent: Component nicht in Gruppe" );
}
}
else
{
DBG_ERROR( "OGroup::RemoveComponent: Component nicht in Gruppe" );
}
}
//------------------------------------------------------------------
sal_Bool OGroup::operator==( const OGroup& rGroup ) const
{
return m_aGroupName.equals(rGroup.GetGroupName());
}
//------------------------------------------------------------------
class OGroupLess : public ::std::binary_function<OGroup, OGroup, sal_Bool>
{
public:
sal_Bool operator() (const OGroup& lhs, const OGroup& rhs) const
{
return lhs.m_aGroupName < rhs.m_aGroupName;
}
};
//------------------------------------------------------------------
staruno::Sequence< staruno::Reference<starawt::XControlModel> > OGroup::GetControlModels() const
{
sal_Int32 nLen = m_aCompArray.size();
staruno::Sequence<staruno::Reference<starawt::XControlModel> > aControlModelSeq( nLen );
staruno::Reference<starawt::XControlModel>* pModels = aControlModelSeq.getArray();
ConstOGroupCompArrIterator aGroupComps = m_aCompArray.begin();
for (sal_Int32 i = 0; i < nLen; ++i, ++pModels, ++aGroupComps)
{
*pModels = staruno::Reference<starawt::XControlModel> ((*aGroupComps).GetComponent(), staruno::UNO_QUERY);
}
return aControlModelSeq;
}
DBG_NAME(OGroupManager);
//------------------------------------------------------------------
OGroupManager::OGroupManager()
:m_pCompGroup(new OGroup(ALL_COMPONENTS_GROUP_NAME))
{
DBG_CTOR(OGroupManager,NULL);
}
//------------------------------------------------------------------
OGroupManager::~OGroupManager()
{
DBG_DTOR(OGroupManager,NULL);
// Alle Components und CompGroup loeschen
delete m_pCompGroup;
}
// starbeans::XPropertyChangeListener
//------------------------------------------------------------------
void OGroupManager::disposing(const starlang::EventObject& evt) throw( staruno::RuntimeException )
{
staruno::Reference<starcontainer::XContainer> xContainer(evt.Source, staruno::UNO_QUERY);
if (xContainer.is())
{
DELETEZ(m_pCompGroup);
////////////////////////////////////////////////////////////////
// Gruppen loeschen
m_aGroupArr.erase(m_aGroupArr.begin(), m_aGroupArr.end());
}
}
//------------------------------------------------------------------
void SAL_CALL OGroupManager::propertyChange(const starbeans::PropertyChangeEvent& evt)
{
staruno::Reference<starbeans::XPropertySet> xSet(evt.Source, staruno::UNO_QUERY);
// Component aus CompGroup entfernen
m_pCompGroup->RemoveComponent( xSet );
// Component aus Gruppe entfernen
sal_Int32 nGroupPos;
::rtl::OUString sGroupName;
if (evt.PropertyName == PROPERTY_NAME)
evt.OldValue >>= sGroupName;
else
xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
OGroup aSearchGroup( sGroupName );
if (seek_entry(m_aGroupArr, aSearchGroup, nGroupPos, OGroupLess()))
{
// Gruppe vorhanden
OGroup& rFoundGroup = m_aGroupArr[nGroupPos];
rFoundGroup.RemoveComponent( xSet );
// Wenn Anzahl der Gruppenelemente == 1 ist, Gruppe deaktivieren
if( rFoundGroup.Count() == 1 )
{
for ( OUInt32ArrIterator aMapSearch = m_aActiveGroupMap.begin();
aMapSearch < m_aActiveGroupMap.end();
++aMapSearch
)
{
if( *aMapSearch == nGroupPos )
{
m_aActiveGroupMap.erase(aMapSearch);
break;
}
}
}
}
// Bei Component als PropertyChangeListener abmelden
xSet->removePropertyChangeListener( PROPERTY_NAME, this );
if (hasProperty(PROPERTY_TABINDEX, xSet))
xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this );
// Component neu einordnen
InsertElement( xSet );
}
// starcontainer::XContainerListener
//------------------------------------------------------------------
void SAL_CALL OGroupManager::elementInserted(const starcontainer::ContainerEvent& Event)
{
staruno::Reference<starbeans::XPropertySet> xSet(*(InterfaceRef *)Event.Element.getValue(), staruno::UNO_QUERY);
if (xSet.is())
InsertElement( xSet );
}
//------------------------------------------------------------------
void SAL_CALL OGroupManager::elementRemoved(const starcontainer::ContainerEvent& Event)
{
staruno::Reference<starbeans::XPropertySet> xSet(*(InterfaceRef *)Event.Element.getValue(), staruno::UNO_QUERY);
if (xSet.is())
RemoveElement( xSet );
}
//------------------------------------------------------------------
void SAL_CALL OGroupManager::elementReplaced(const starcontainer::ContainerEvent& Event)
{
staruno::Reference<starbeans::XPropertySet> xSet(*(InterfaceRef *)Event.ReplacedElement.getValue(), staruno::UNO_QUERY);
if (xSet.is())
RemoveElement( xSet );
xSet = staruno::Reference<starbeans::XPropertySet> (*(InterfaceRef *)Event.Element.getValue(), staruno::UNO_QUERY);
if (xSet.is())
InsertElement( xSet );
}
// Other functions
//------------------------------------------------------------------
staruno::Sequence<staruno::Reference<starawt::XControlModel> > OGroupManager::getControlModels()
{
return m_pCompGroup->GetControlModels();
}
//------------------------------------------------------------------
sal_Int32 OGroupManager::getGroupCount()
{
return m_aActiveGroupMap.size();
}
//------------------------------------------------------------------
void OGroupManager::getGroup(sal_Int32 nGroup, staruno::Sequence< staruno::Reference<starawt::XControlModel> >& _rGroup, ::rtl::OUString& _rName)
{
sal_uInt16 nGroupPos= m_aActiveGroupMap[nGroup];
OGroup& rGroup = m_aGroupArr[nGroupPos];
_rName = rGroup.GetGroupName();
_rGroup = rGroup.GetControlModels();
}
//------------------------------------------------------------------
void OGroupManager::getGroupByName(const ::rtl::OUString& _rName, staruno::Sequence< staruno::Reference<starawt::XControlModel> >& _rGroup)
{
sal_Int32 nGroupPos;
OGroup aSearchGroup( _rName );
if (seek_entry(m_aGroupArr, aSearchGroup, nGroupPos, OGroupLess()))
{
OGroup& rGroup = m_aGroupArr[nGroupPos];
_rGroup = rGroup.GetControlModels();
}
}
//------------------------------------------------------------------
void OGroupManager::InsertElement( const staruno::Reference<starbeans::XPropertySet>& xSet )
{
// Nur ControlModels
staruno::Reference<starawt::XControlModel> xControl(xSet, staruno::UNO_QUERY);
if (!xControl.is() )
return;
// Component in CompGroup aufnehmen
m_pCompGroup->InsertComponent( xSet );
// Component in Gruppe aufnehmen
sal_Int32 nPos;
::rtl::OUString sGroupName;
xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
OGroup aNewGroup( sGroupName );
if (seek_entry(m_aGroupArr, aNewGroup, nPos, OGroupLess()))
{
// Gruppe existiert schon ...
}
else
{
// Gruppe muss neu angelegt werden
nPos = insert_sorted(m_aGroupArr, aNewGroup, OGroupLess());
// Indizes der ActiveGroupMap anpassen
if (seek_entry(m_aGroupArr, aNewGroup, nPos, OGroupLess()))
{
for ( OUInt32ArrIterator aMapSearch = m_aActiveGroupMap.begin();
aMapSearch < m_aActiveGroupMap.end();
++aMapSearch
)
{
if( (*aMapSearch) >= nPos )
++(*aMapSearch);
}
}
else
DBG_ERROR("OGroupManager::InsertElement : inserted the element but did not find it afterwards !");
}
OGroup& rNewGroup = m_aGroupArr[nPos];
rNewGroup.InsertComponent( xSet );
// Wenn Anzahl der Gruppenelemente == 2 ist, Gruppe aktivieren
if( rNewGroup.Count() == 2 )
{
m_aActiveGroupMap.insert( m_aActiveGroupMap.end(), nPos );
}
// Bei Component als PropertyChangeListener anmelden
xSet->addPropertyChangeListener( PROPERTY_NAME, this );
// Tabindex mu<6D> nicht jeder unterstuetzen
if (hasProperty(PROPERTY_TABINDEX, xSet))
xSet->addPropertyChangeListener( PROPERTY_TABINDEX, this );
}
//------------------------------------------------------------------
void OGroupManager::RemoveElement( const staruno::Reference<starbeans::XPropertySet>& xSet )
{
// Nur ControlModels
staruno::Reference<starawt::XControlModel> xControl(xSet, staruno::UNO_QUERY);
if (!xControl.is() )
return;
// Component aus CompGroup entfernen
m_pCompGroup->RemoveComponent( xSet );
// Component aus Gruppe entfernen
sal_Int32 nGroupPos;
::rtl::OUString sGroupName;
xSet->getPropertyValue( PROPERTY_NAME ) >>= sGroupName;
OGroup aSearchGroup( sGroupName );
if (seek_entry(m_aGroupArr, aSearchGroup, nGroupPos, OGroupLess()))
{
// Gruppe vorhanden
OGroup& rGroup = m_aGroupArr[nGroupPos];
rGroup.RemoveComponent( xSet );
// Wenn Anzahl der Gruppenelemente == 1 ist, Gruppe deaktivieren
if( rGroup.Count() == 1 )
{
for ( OUInt32ArrIterator aMapSearch = m_aActiveGroupMap.begin();
aMapSearch < m_aActiveGroupMap.end();
++aMapSearch
)
{
if( *aMapSearch == nGroupPos )
{
m_aActiveGroupMap.erase(aMapSearch);
break;
}
}
}
}
// Bei Component als PropertyChangeListener abmelden
xSet->removePropertyChangeListener( PROPERTY_NAME, this );
if (hasProperty(PROPERTY_TABINDEX, xSet))
xSet->removePropertyChangeListener( PROPERTY_TABINDEX, this );
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,264 @@
/*************************************************************************
*
* $RCSfile: GroupManager.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_GROUPMANAGER_HXX_
#define _FRM_GROUPMANAGER_HXX_
#include <com/sun/star/sdbc/XRowSet.hpp>
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/container/XContainerListener.hpp>
#ifndef _UTL_STLTYPES_HXX_
#include <unotools/stl_types.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE2_HXX_
#include <cppuhelper/implbase2.hxx>
#endif
#ifndef _UTL_STLTYPES_HXX_
#include <unotools/stl_types.hxx>
#endif
#ifndef _UTL_TYPES_HXX_
#include <unotools/types.hxx>
#endif
using namespace utl;
/*========================================================================
Funktionsweise GroupManager:
Der GroupManager horcht an der starform, ob FormComponents eingefuegt oder entfernt
werden. Zusaetzlich horcht er bei den FormComponents an den Properties
"Name" und "TabIndex". Mit diesen Infos aktualisiert er seine Gruppen.
Der GroupManager verwaltet eine Gruppe, in der alle Controls nach TabIndex
geordnet sind, und ein Array von Gruppen, in dem jede FormComponent noch
einmal einer Gruppe dem Namen nach zugeordnet wird.
Die einzelnen Gruppen werden ueber eine Map aktiviert, wenn sie mehr als
ein Element besitzen.
Die Gruppen verwalten intern die FormComponents in zwei Arrays. In dem
GroupCompArray werden die Components nach TabIndex und Einfuegepostion
sortiert. Da auf dieses Array ueber die FormComponent zugegriffen
wird, gibt es noch das GroupCompAccessArray, in dem die FormComponents
nach ihrer Speicheradresse sortiert sind. Jedes Element des
GroupCompAccessArrays ist mit einem Element des GroupCompArrays verpointert.
========================================================================*/
//.........................................................................
namespace frm
{
//.........................................................................
namespace starbeans = ::com::sun::star::beans;
namespace starcontainer = ::com::sun::star::container;
//========================================================================
template <class ELEMENT, class LESS_COMPARE>
sal_Int32 insert_sorted(::std::vector<ELEMENT>& _rArray, const ELEMENT& _rNewElement, const LESS_COMPARE& _rCompareOp)
{
::std::vector<ELEMENT>::iterator aInsertPos = lower_bound(
_rArray.begin(),
_rArray.end(),
_rNewElement,
_rCompareOp
);
aInsertPos = _rArray.insert(aInsertPos, _rNewElement);
return aInsertPos - _rArray.begin();
}
template <class ELEMENT, class LESS_COMPARE>
sal_Bool seek_entry(const ::std::vector<ELEMENT>& _rArray, const ELEMENT& _rNewElement, sal_Int32& nPos, const LESS_COMPARE& _rCompareOp)
{
::std::vector<ELEMENT>::const_iterator aExistentPos = ::std::lower_bound(
_rArray.begin(),
_rArray.end(),
_rNewElement,
_rCompareOp
);
if ((aExistentPos != _rArray.end()) && (*aExistentPos == _rNewElement))
{ // we have a valid "lower or equal" element and it's really "equal"
nPos = aExistentPos - _rArray.begin();
return sal_True;
}
nPos = -1;
return sal_False;
}
//========================================================================
class OGroupComp
{
::rtl::OUString m_aName;
staruno::Reference<starbeans::XPropertySet> m_xComponent;
sal_Int32 m_nPos;
sal_Int16 m_nTabIndex;
friend class OGroupCompLess;
public:
OGroupComp(const staruno::Reference<starbeans::XPropertySet>& rxElement, sal_Int32 nInsertPos );
OGroupComp(const OGroupComp& _rSource);
OGroupComp();
sal_Bool operator==( const OGroupComp& rComp ) const;
const staruno::Reference<starbeans::XPropertySet>& GetComponent() const { return m_xComponent; }
sal_Int32 GetPos() const { return m_nPos; }
sal_Int16 GetTabIndex() const { return m_nTabIndex; }
::rtl::OUString GetName() const { return m_aName; }
};
DECLARE_STL_VECTOR(OGroupComp, OGroupCompArr);
//========================================================================
class OGroupComp;
class OGroupCompAcc
{
staruno::Reference<starbeans::XPropertySet> m_xComponent;
OGroupComp m_aGroupComp;
friend class OGroupCompAccLess;
public:
OGroupCompAcc(const staruno::Reference<starbeans::XPropertySet>& rxElement, const OGroupComp& _rGroupComp );
sal_Bool operator==( const OGroupCompAcc& rCompAcc ) const;
const staruno::Reference<starbeans::XPropertySet>& GetComponent() const { return m_xComponent; }
const OGroupComp& GetGroupComponent() const { return m_aGroupComp; }
};
DECLARE_STL_VECTOR(OGroupCompAcc, OGroupCompAccArr);
//========================================================================
class OGroup
{
OGroupCompArr m_aCompArray;
OGroupCompAccArr m_aCompAccArray;
::rtl::OUString m_aGroupName;
sal_uInt16 m_nInsertPos; // Die Einfugeposition der GroupComps wird von der Gruppe bestimmt.
friend class OGroupLess;
public:
OGroup( const ::rtl::OUString& rGroupName );
virtual ~OGroup();
sal_Bool operator==( const OGroup& rGroup ) const;
::rtl::OUString GetGroupName() const { return m_aGroupName; }
staruno::Sequence< staruno::Reference<starawt::XControlModel> > GetControlModels() const;
void InsertComponent( const staruno::Reference<starbeans::XPropertySet>& rxElement );
void RemoveComponent( const staruno::Reference<starbeans::XPropertySet>& rxElement );
sal_uInt16 Count() const { return m_aCompArray.size(); }
const staruno::Reference<starbeans::XPropertySet>& GetObject( sal_uInt16 nP ) const
{ return m_aCompArray[nP].GetComponent(); }
};
DECLARE_STL_VECTOR(OGroup, OGroupArr);
DECLARE_STL_VECTOR(sal_uInt32, OUInt32Arr);
//========================================================================
class OGroupManager : public ::cppu::WeakImplHelper2<starbeans::XPropertyChangeListener, starcontainer::XContainerListener>
{
OGroup* m_pCompGroup; // Alle Components nach TabIndizes sortiert
OGroupArr m_aGroupArr; // Alle Components nach Gruppen sortiert
OUInt32Arr m_aActiveGroupMap; // In dieser Map werden die Indizes aller Gruppen gehalten,
// die mehr als 1 Element haben
// Helper functions
void InsertElement( const staruno::Reference<starbeans::XPropertySet>& rxElement );
void RemoveElement( const staruno::Reference<starbeans::XPropertySet>& rxElement );
public:
OGroupManager();
virtual ~OGroupManager();
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
// starbeans::XPropertyChangeListener
virtual void SAL_CALL propertyChange(const starbeans::PropertyChangeEvent& evt);
// starcontainer::XContainerListener
virtual void SAL_CALL elementInserted(const starcontainer::ContainerEvent& _rEvent);
virtual void SAL_CALL elementRemoved(const starcontainer::ContainerEvent& _rEvent);
virtual void SAL_CALL elementReplaced(const starcontainer::ContainerEvent& _rEvent);
// Other functions
sal_Int32 getGroupCount();
void getGroup(sal_Int32 nGroup, staruno::Sequence< staruno::Reference<starawt::XControlModel> >& _rGroup, ::rtl::OUString& Name);
void getGroupByName(const ::rtl::OUString& Name, staruno::Sequence< staruno::Reference<starawt::XControlModel> >& _rGroup);
staruno::Sequence< staruno::Reference<starawt::XControlModel> > getControlModels();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FRM_GROUPMANAGER_HXX_

View File

@@ -0,0 +1,216 @@
/*************************************************************************
*
* $RCSfile: Hidden.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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_HIDDEN_HXX_
#include "Hidden.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 <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//------------------------------------------------------------------
InterfaceRef SAL_CALL OHiddenModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new OHiddenModel(_rxFactory));
}
//------------------------------------------------------------------
OHiddenModel::OHiddenModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OControlModel(_rxFactory, ::rtl::OUString())
{
m_nClassId = starform::FormComponentType::HIDDENCONTROL;
}
//------------------------------------------------------------------------------
void OHiddenModel::getFastPropertyValue(staruno::Any& _rValue, sal_Int32 _nHandle) const
{
switch (_nHandle)
{
case PROPERTY_ID_HIDDEN_VALUE : _rValue <<= m_sHiddenValue; break;
default:
OControlModel::getFastPropertyValue(_rValue, _nHandle);
}
}
//------------------------------------------------------------------------------
void OHiddenModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const staruno::Any& _rValue) throw (com::sun::star::uno::Exception)
{
switch (_nHandle)
{
case PROPERTY_ID_HIDDEN_VALUE :
DBG_ASSERT(_rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING, "OHiddenModel::setFastPropertyValue_NoBroadcast : invalid type !" );
_rValue >>= m_sHiddenValue;
break;
default:
OControlModel::setFastPropertyValue_NoBroadcast(_nHandle, _rValue);
}
}
//------------------------------------------------------------------------------
sal_Bool OHiddenModel::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_HIDDEN_VALUE :
bModified = tryPropertyValue(_rConvertedValue, _rOldValue, _rValue, m_sHiddenValue);
break;
default:
bModified = OControlModel::convertFastPropertyValue(_rConvertedValue, _rOldValue, _nHandle, _rValue);
break;
}
return bModified;
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OHiddenModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& OHiddenModel::getInfoHelper()
{
return *const_cast<OHiddenModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
void OHiddenModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
BEGIN_AGGREGATION_PROPERTY_HELPER(4, m_xAggregateSet)
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP1(HIDDEN_VALUE, ::rtl::OUString, BOUND);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
END_AGGREGATION_PROPERTY_HELPER();
}
// XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OHiddenModel::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException)
{
StringSequence aSupported = OControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 2);
::rtl::OUString* pArray = aSupported.getArray();
pArray[aSupported.getLength()-2] = ::rtl::OUString::createFromAscii("com.sun.star.form.FormComponent");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_HIDDENCONTROL;
return aSupported;
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OHiddenModel::getServiceName() throw(staruno::RuntimeException)
{
return FRM_COMPONENT_HIDDEN; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void SAL_CALL OHiddenModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
throw(stario::IOException, staruno::RuntimeException)
{
// Version
_rxOutStream->writeShort(0x0002);
// Wert
_rxOutStream << m_sHiddenValue;
OControlModel::write(_rxOutStream);
}
//------------------------------------------------------------------------------
void SAL_CALL OHiddenModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException)
{
// Version
UINT16 nVersion = _rxInStream->readShort();
// Name
DBG_ASSERT(nVersion != 1, "OHiddenModel::read : this version is obsolete !");
switch (nVersion)
{
case 1 : { ::rtl::OUString sDummy; _rxInStream >> sDummy; _rxInStream >> m_sHiddenValue; } break;
case 2 : _rxInStream >> m_sHiddenValue; break;
default : DBG_ERROR("OHiddenModel::read : unknown version !"); m_sHiddenValue = ::rtl::OUString();
}
OControlModel::read(_rxInStream);
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,121 @@
/*************************************************************************
*
* $RCSfile: Hidden.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FORMS_HIDDEN_HXX_
#define _FORMS_HIDDEN_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
//.........................................................................
namespace frm
{
//==================================================================
// OHiddenModel
//==================================================================
class OHiddenModel
:public OControlModel
,public ::utl::OAggregationArrayUsageHelper< OHiddenModel >
{
::rtl::OUString m_sHiddenValue;
public:
OHiddenModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// 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<starbeans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
virtual cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// XServiceInfo
IMPLEMENTATION_NAME(OHiddenModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
// XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName() throw(staruno::RuntimeException);
virtual void SAL_CALL
write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
#endif // _FORMS_HIDDEN_HXX_
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,316 @@
/*************************************************************************
*
* $RCSfile: ImageButton.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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_IMAGE_BUTTON_HXX_
#include "ImageButton.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
#include <com/sun/star/awt/MouseButton.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= OImageButtonModel
//==================================================================
DBG_NAME(OImageButtonModel)
//------------------------------------------------------------------
InterfaceRef SAL_CALL OImageButtonModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OImageButtonModel(_rxFactory));
}
//------------------------------------------------------------------
OImageButtonModel::OImageButtonModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OImageModel(_rxFactory, VCL_CONTROLMODEL_IMAGEBUTTON, FRM_CONTROL_IMAGEBUTTON)
// use the old control name for compytibility reasons
{
DBG_CTOR(OImageButtonModel, NULL);
m_nClassId = starform::FormComponentType::IMAGEBUTTON;
}
//------------------------------------------------------------------------------
OImageButtonModel::~OImageButtonModel()
{
DBG_DTOR(OImageButtonModel, NULL);
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OImageButtonModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence OImageButtonModel::getSupportedServiceNames() throw()
{
StringSequence aSupported = OControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_IMAGEBUTTON;
return aSupported;
}
//------------------------------------------------------------------------------
void OImageButtonModel::fillProperties(
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& OImageButtonModel::getInfoHelper()
{
return *const_cast<OImageButtonModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
::rtl::OUString OImageButtonModel::getServiceName()
{
return FRM_COMPONENT_IMAGEBUTTON; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void OImageButtonModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
OControlModel::write(_rxOutStream);
// Version
_rxOutStream->writeShort(0x0003);
_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 OImageButtonModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream)
{
OControlModel::read(_rxInStream);
// Version
sal_uInt16 nVersion = _rxInStream->readShort();
switch (nVersion)
{
case 0x0001:
{
m_eButtonType = (starform::FormButtonType)_rxInStream->readShort();
}
break;
case 0x0002:
{
m_eButtonType = (starform::FormButtonType)_rxInStream->readShort();
::rtl::OUString sTmp;
_rxInStream >> sTmp;
m_sTargetURL = INetURLObject::RelToAbs( sTmp );
_rxInStream >> m_sTargetFrame;
}
break;
case 0x0003:
{
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("OImageButtonModel::read : unknown version !");
m_eButtonType = starform::FormButtonType_PUSH;
m_sTargetURL = ::rtl::OUString();
m_sTargetFrame = ::rtl::OUString();
break;
}
}
//==================================================================
// OImageButtonControl
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OImageButtonControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OImageButtonControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OImageButtonControl::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my base class
staruno::Sequence<staruno::Type> aBaseClassTypes = OImageControl::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starawt::XMouseListener>*)NULL);
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
}
return aTypes;
}
//------------------------------------------------------------------------------
StringSequence OImageButtonControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_IMAGEBUTTON;
return aSupported;
}
//------------------------------------------------------------------------------
OImageButtonControl::OImageButtonControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OImageControl(_rxFactory, VCL_CONTROL_IMAGEBUTTON)
{
increment(m_refCount);
{
// als MouseListener anmelden
staruno::Reference<starawt::XWindow> xComp;
query_aggregation( m_xAggregate, xComp);
if (xComp.is())
xComp->addMouseListener((starawt::XMouseListener*)this);
}
// Refcount bei 1 fuer angemeldeten Listener
sal_Int32 n = decrement(m_refCount);
}
// UNO Anbindung
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OImageButtonControl::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn;
aReturn = OImageControl::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<starawt::XMouseListener*>(this)
);
return aReturn;
}
//------------------------------------------------------------------------------
void OImageButtonControl::mousePressed(const starawt::MouseEvent& e)
{
//////////////////////////////////////////////////////////////////////
// Nur linke Maustaste
if (e.Buttons != starawt::MouseButton::LEFT)
return;
::osl::ClearableMutexGuard aGuard( m_aMutex );
if( m_aApproveActionListeners.getLength() )
{
// Wenn es ApproveAction-Lisener gibt, muss ein eigener Thread
// aufgemacht werden.
if( !m_pThread )
{
m_pThread = new OImageControlThread_Impl( this );
m_pThread->acquire();
m_pThread->create();
}
m_pThread->OComponentEventThread::addEvent( &e );
}
else
{
// Sonst nicht. Dann darf man aber auf keinen Fal die Listener
// benachrichtigen, auch dann nicht, wenn er spaeter hinzukommt.
aGuard.clear();
actionPerformed_Impl( sal_False, e );
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,147 @@
/*************************************************************************
*
* $RCSfile: ImageButton.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_IMAGE_BUTTON_HXX_
#define _FRM_IMAGE_BUTTON_HXX_
#ifndef _FRM_IMAGE_HXX_
#include "Image.hxx"
#endif
#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
#include <com/sun/star/awt/XMouseListener.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OImageButtonModel
//==================================================================
class OImageButtonModel
:public OImageModel
,public ::utl::OAggregationArrayUsageHelper< OImageButtonModel >
{
public:
OImageButtonModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
~OImageButtonModel();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OImageButtonModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// staruno::Reference<starbeans::XPropertySet>
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
//==================================================================
// OImageButtonControl
//==================================================================
class OImageButtonControl : public OImageControl,
public starawt::XMouseListener
{
protected:
// UNO Anbindung
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OImageButtonControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OImageButtonControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// UNO Anbindung
DECLARE_UNO3_AGG_DEFAULTS(OImageButtonControl, OImageControl);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException)
{ OControl::disposing(_rSource); }
// starawt::XMouseListener
virtual void SAL_CALL mousePressed(const starawt::MouseEvent& e);
virtual void SAL_CALL mouseReleased(const starawt::MouseEvent& e) { }
virtual void SAL_CALL mouseEntered(const starawt::MouseEvent& e) { }
virtual void SAL_CALL mouseExited(const starawt::MouseEvent& e) { }
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FRM_IMAGE_BUTTON_HXX_

View File

@@ -0,0 +1,673 @@
/*************************************************************************
*
* $RCSfile: ImageControl.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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_IMAGE_CONTROL_HXX_
#include "ImageControl.hxx"
#endif
#ifndef _FRM_PROPERTY_HRC_
#include "property.hrc"
#endif
#ifndef _FRM_RESOURCE_HRC_
#include "frm_resource.hrc"
#endif
#ifndef _FRM_RESOURCE_HXX_
#include "frm_resource.hxx"
#endif
#include "conversion.hxx"
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_MOUSEBUTTON_HPP_
#include <com/sun/star/awt/MouseButton.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
#include <com/sun/star/awt/XWindow.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XDIALOG_HPP_
#include <com/sun/star/awt/XDialog.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XACTIVEDATASINK_HPP_
#include <com/sun/star/io/XActiveDataSink.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_NOTCONNECTEDEXCEPTION_HPP_
#include <com/sun/star/io/NotConnectedException.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
#include <com/sun/star/beans/PropertyValue.hpp>
#endif
#ifndef _SVX_IMPGRF_HXX
#include <svx/impgrf.hxx>
#endif
#ifndef _URLOBJ_HXX
#include <tools/urlobj.hxx>
#endif
#ifndef _STREAM_HXX
#include <tools/stream.hxx>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _UNOTOOLS_STREAMHELPER_HXX_
#include <unotools/streamhelper.hxx>
#endif
#ifndef _CPPUHELPER_EXTRACT_HXX_
#include <cppuhelper/extract.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OImageControlModel
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OImageControlModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OImageControlModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OImageControlModel::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my base class
staruno::Sequence<staruno::Type> aBaseClassTypes = OBoundControlModel::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starform::XImageProducerSupplier>*)NULL);
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
}
return aTypes;
}
DBG_NAME(OImageControlModel)
//------------------------------------------------------------------
OImageControlModel::OImageControlModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_IMAGECONTROL, FRM_CONTROL_IMAGECONTROL, sal_False)
// use the old control name for compytibility reasons
,OPropertyChangeListener(m_aMutex)
,m_pImageProducer(new ImageProducer)
,m_bReadOnly(sal_False)
{
DBG_CTOR(OImageControlModel,NULL);
m_xImageProducer = m_pImageProducer;
m_sDataFieldConnectivityProperty = PROPERTY_IMAGE_URL;
increment(m_refCount);
if (m_xAggregateSet.is())
{
OPropertyChangeMultiplexer* pMultiplexer = new OPropertyChangeMultiplexer(this, m_xAggregateSet);
pMultiplexer->addProperty(PROPERTY_IMAGE_URL);
}
decrement(m_refCount);
}
//------------------------------------------------------------------
OImageControlModel::~OImageControlModel()
{
if (!OComponentHelper::rBHelper.bDisposed)
{
acquire();
dispose();
}
DBG_DTOR(OImageControlModel,NULL);
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence OImageControlModel::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.starform");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_IMAGECONTROL;
return aSupported;
}
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OImageControlModel::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn;
aReturn = OBoundControlModel::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<starform::XImageProducerSupplier*>(this)
);
return aReturn;
}
//------------------------------------------------------------------------------
sal_Bool OImageControlModel::_approve(sal_Int32 _nColumnType)
{
// zulaessing sind die binary Typen, OTHER- und LONGVARCHAR-Felder
if ((_nColumnType == starsdbc::DataType::BINARY) || (_nColumnType == starsdbc::DataType::VARBINARY)
|| (_nColumnType == starsdbc::DataType::LONGVARBINARY) || (_nColumnType == starsdbc::DataType::OTHER)
|| (_nColumnType == starsdbc::DataType::LONGVARCHAR))
return sal_True;
return sal_False;
}
//------------------------------------------------------------------------------
void OImageControlModel::_propertyChanged( const starbeans::PropertyChangeEvent& rEvt )
throw( staruno::RuntimeException )
{
::osl::MutexGuard aGuard(m_aMutex);
// Wenn eine starutil::URL gesetzt worden ist, muss die noch an den ImageProducer
// weitergereicht werden.
// xInStream erzeugen
staruno::Reference<stario::XActiveDataSink> xSink(
m_xServiceFactory->createInstance(
::rtl::OUString::createFromAscii("com.sun.star.io.ObjectInputStream")), staruno::UNO_QUERY);
if (!xSink.is())
return;
// SvStream am xInStream setzen
INetURLObject aURLObj(getString(rEvt.NewValue));
String aPath = INetURLObject::decode(aURLObj.PathToFileName(), '%', INetURLObject::DECODE_UNAMBIGUOUS);
SvFileStream* pFileStream = new SvFileStream();
pFileStream->Open(aPath, STREAM_READ);
sal_Bool bSetNull = !pFileStream->IsOpen();
if (!bSetNull)
{
// get the size of the stream
pFileStream->Seek(STREAM_SEEK_TO_END);
sal_Int32 nSize = (sal_Int32)pFileStream->Tell();
if (pFileStream->GetBufferSize() < 8192)
pFileStream->SetBufferSize(8192);
staruno::Reference<stario::XInputStream> xInput
(new ::utl::OInputStreamHelper(new SvLockBytes(pFileStream, sal_True),
pFileStream->GetBufferSize()));
xSink->setInputStream(xInput);
staruno::Reference<stario::XInputStream> xInStream(xSink, staruno::UNO_QUERY);
if (m_xColumnUpdate.is())
m_xColumnUpdate->updateBinaryStream(xInStream, xInput->available());
else
{
GetImageProducer()->setImage( xInStream );
m_xImageProducer->startProduction();
}
// usually the setBinaryStream should close the input, but just in case ....
try { xInStream->closeInput(); } catch (stario::NotConnectedException& e) { e; }
}
else
{
if (m_xColumnUpdate.is())
m_xColumnUpdate->updateNull();
else
{
staruno::Reference<stario::XInputStream> xInStream;
GetImageProducer()->setImage( xInStream );
m_xImageProducer->startProduction();
}
delete pFileStream;
}
}
//------------------------------------------------------------------------------
void OImageControlModel::getFastPropertyValue(staruno::Any& rValue, sal_Int32 nHandle) const
{
switch (nHandle)
{
case PROPERTY_ID_READONLY : rValue <<= (sal_Bool)m_bReadOnly; break;
default:
OBoundControlModel::getFastPropertyValue(rValue, nHandle);
}
}
//------------------------------------------------------------------------------
void OImageControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const staruno::Any& rValue)
{
switch (nHandle)
{
case PROPERTY_ID_READONLY :
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_BOOLEAN, "OImageControlModel::setFastPropertyValue_NoBroadcast : invalid type !" );
m_bReadOnly = getBOOL(rValue);
break;
default:
OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue);
}
}
//------------------------------------------------------------------------------
sal_Bool OImageControlModel::convertFastPropertyValue(staruno::Any& rConvertedValue, staruno::Any& rOldValue, sal_Int32 nHandle, const staruno::Any& rValue)
throw( starlang::IllegalArgumentException )
{
switch (nHandle)
{
case PROPERTY_ID_READONLY :
return tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bReadOnly);
default:
return OBoundControlModel::convertFastPropertyValue(rConvertedValue, rOldValue, nHandle, rValue);
}
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OImageControlModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo(createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void OImageControlModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(9)
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_IMAGE_URL, starbeans::PropertyAttribute::TRANSIENT, 0);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_BOOL_PROP1(READONLY, BOUND);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND);
DECL_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& OImageControlModel::getInfoHelper()
{
return *const_cast<OImageControlModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
::rtl::OUString OImageControlModel::getServiceName()
{
return FRM_COMPONENT_IMAGECONTROL; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void OImageControlModel::write(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
// Basisklasse
OBoundControlModel::write(_rxOutStream);
// Version
_rxOutStream->writeShort(0x0003);
// Name
_rxOutStream->writeBoolean(m_bReadOnly);
_rxOutStream << m_aHelpText;
// from version 0x0003 : common properties
writeCommonProperties(_rxOutStream);
}
//------------------------------------------------------------------------------
void OImageControlModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream)
{
OBoundControlModel::read(_rxInStream);
// Version
sal_uInt16 nVersion = _rxInStream->readShort();
switch (nVersion)
{
case 0x0001:
m_bReadOnly = _rxInStream->readBoolean();
break;
case 0x0002:
m_bReadOnly = _rxInStream->readBoolean();
_rxInStream >> m_aHelpText;
break;
case 0x0003:
m_bReadOnly = _rxInStream->readBoolean();
_rxInStream >> m_aHelpText;
readCommonProperties(_rxInStream);
break;
default :
DBG_ERROR("OImageControlModel::read : unknown version !");
m_bReadOnly = sal_False;
defaultCommonProperties();
break;
}
// Nach dem Lesen die Defaultwerte anzeigen
if (m_aControlSource.getLength())
{ // (not if we don't have a control source - the "State" property acts like it is persistent, then
::osl::MutexGuard aGuard(m_aMutex); // _reset expects this mutex guarding
_reset();
}
}
// starbeans::XPropertyChangeListener
//------------------------------------------------------------------------------
void OImageControlModel::_onValueChanged()
{
UpdateFromField();
}
//------------------------------------------------------------------------------
staruno::Any OImageControlModel::_getControlValue() const
{
// hier macht ein Vergleich keinen Sinn, daher void siehe OBoundControlModel
return staruno::Any();
}
// OComponentHelper
//------------------------------------------------------------------
void OImageControlModel::disposing()
{
OBoundControlModel::disposing();
#if SUPD<583
XInputStreamRef xInStream;
#else
staruno::Reference<stario::XInputStream> xInStream;
#endif
GetImageProducer()->setImage( xInStream );
m_xImageProducer->startProduction();
}
//------------------------------------------------------------------------------
void OImageControlModel::_reset()
{
#if SUPD<583
XInputStreamRef xDummy;
#else
staruno::Reference<stario::XInputStream> xDummy;
#endif
GetImageProducer()->setImage(xDummy);
staruno::Reference<starawt::XImageProducer> xProducer = m_xImageProducer;
{ // release our mutex once (it's acquired in the calling method !), as starting the image production may
// result in the locking of the solar mutex (unfortunally the default implementation of our aggregate,
// VCLXImageControl, does this locking)
// FS - 74438 - 30.03.00
MutexRelease aRelease(m_aMutex);
xProducer->startProduction();
}
}
// Helper functions
//------------------------------------------------------------------------------
void OImageControlModel::UpdateFromField()
{
staruno::Reference<stario::XInputStream> xInStream;
xInStream = m_xColumn->getBinaryStream();
#if SUPD<583
//------------------------------------------------------------
// temporary as long as the ImageProducer is a Smart-UNO-Class
XInputStreamRef xUsrIFace;
convertIFace(xInStream, xUsrIFace);
GetImageProducer()->setImage(xUsrIFace);
//------------------------------------------------------------
#else
GetImageProducer()->setImage(xInStream);
#endif
m_xImageProducer->startProduction();
}
//==================================================================
// OImageControlControl
//==================================================================
//------------------------------------------------------------------
InterfaceRef SAL_CALL OImageControlControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OImageControlControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OImageControlControl::_getTypes()
{
static staruno::Sequence<staruno::Type> aTypes;
if (!aTypes.getLength())
{
// my base class
staruno::Sequence<staruno::Type> aBaseClassTypes = OBoundControl::_getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
staruno::Type* pOwnTypes = aOwnTypes.getArray();
pOwnTypes[0] = getCppuType((staruno::Reference<starawt::XMouseListener>*)NULL);
aTypes = concatSequences(aBaseClassTypes, aOwnTypes);
}
return aTypes;
}
//------------------------------------------------------------------------------
OImageControlControl::OImageControlControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_IMAGECONTROL)
{
increment(m_refCount);
{
// als Focus- und MouseListener anmelden
staruno::Reference<starawt::XWindow> xComp;
query_aggregation( m_xAggregate, xComp);
if (xComp.is())
xComp->addMouseListener(this);
}
// Refcount bei 1 fuer den Listener
sal_Int32 n = decrement(m_refCount);
}
// UNO Anbindung
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OImageControlControl::queryAggregation(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn;
aReturn = OBoundControl::queryAggregation(_rType);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<starawt::XMouseListener*>(this)
);
return aReturn;
}
//------------------------------------------------------------------------------
StringSequence OImageControlControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_IMAGECONTROL;
return aSupported;
}
// starawt::XControl
//------------------------------------------------------------------------------
void SAL_CALL OImageControlControl::createPeer(const staruno::Reference<starawt::XToolkit>& _rxToolkit, const staruno::Reference<starawt::XWindowPeer>& Parent) throw( staruno::RuntimeException )
{
OBoundControl::createPeer(_rxToolkit, Parent);
if (!m_xControl.is())
return;
// ImageConsumer vom Control holen
staruno::Reference<starawt::XWindowPeer> xPeer = m_xControl->getPeer();
staruno::Reference<starawt::XImageConsumer> xImageConsumer(xPeer, staruno::UNO_QUERY);
if (!xImageConsumer.is())
return;
// ImageConsumer am Imageproducer setzen
staruno::Reference<starform::XImageProducerSupplier> xImageSource(m_xControl->getModel(), staruno::UNO_QUERY);
if (!xImageSource.is())
return;
staruno::Reference<starawt::XImageProducer> xImageProducer = xImageSource->getImageProducer();
xImageProducer->addConsumer(xImageConsumer);
xImageProducer->startProduction();
}
// MouseListener
//------------------------------------------------------------------------------
void OImageControlControl::mousePressed(const starawt::MouseEvent& e)
{
//////////////////////////////////////////////////////////////////////
// Nur linke Maustaste
if (e.Buttons != starawt::MouseButton::LEFT)
return;
//////////////////////////////////////////////////////////////////////
// Doppelclick
if (e.ClickCount == 2)
{
staruno::Reference<starbeans::XPropertySet> xSet(getModel(), staruno::UNO_QUERY);
if (!xSet.is())
return;
// wenn Control nicht gebunden ist, kein Dialog (da die zu schickende URL hinterher sowieso
// versanden wuerde)
// FS - #64946# - 19.04.99
staruno::Reference<starbeans::XPropertySet> xBoundField;
if (hasProperty(PROPERTY_BOUNDFIELD, xSet))
::cppu::extractInterface(xBoundField, xSet->getPropertyValue(PROPERTY_BOUNDFIELD));
if (!xBoundField.is())
{
// but only if our IMAGE_URL property is handled as if it is transient, which is equivalent to
// an empty control source
if (!hasProperty(PROPERTY_CONTROLSOURCE, xSet) || (::utl::getString(xSet->getPropertyValue(PROPERTY_CONTROLSOURCE)).getLength() != 0))
return;
}
sal_Bool bReadOnly;
xSet->getPropertyValue(PROPERTY_READONLY) >>= bReadOnly;
if (bReadOnly)
return;
::rtl::OUString sTitle = FRM_RES_STRING(RID_STR_IMPORT_GRAPHIC);
// build some arguments for the upcoming dialog
staruno::Sequence<staruno::Any> aParams(4);
aParams.getArray()[0] = staruno::makeAny(starbeans::PropertyValue(
::rtl::OUString::createFromAscii("Title"), -1,
staruno::makeAny(sTitle), starbeans::PropertyState_DIRECT_VALUE
));
aParams.getArray()[1] = staruno::makeAny(starbeans::PropertyValue(
::rtl::OUString::createFromAscii("PreviewActive"), -1,
staruno::makeAny((sal_Bool)sal_True), starbeans::PropertyState_DIRECT_VALUE
));
aParams.getArray()[2] = staruno::makeAny(starbeans::PropertyValue(
::rtl::OUString::createFromAscii("AllowEmptyFileNames"), -1,
staruno::makeAny((sal_Bool)sal_True), starbeans::PropertyState_DIRECT_VALUE
));
staruno::Reference<starawt::XWindow> xWindow(getPeer(), staruno::UNO_QUERY);
aParams.getArray()[3] = staruno::makeAny(starbeans::PropertyValue(
::rtl::OUString::createFromAscii("ParentWindow"), -1,
staruno::makeAny(xWindow), starbeans::PropertyState_DIRECT_VALUE
));
try
{
staruno::Reference<starawt::XDialog> xDialog(
m_xServiceFactory->createInstanceWithArguments(
::rtl::OUString::createFromAscii("com.sun.star.dialogs.ImportGraphicsDialog"),
aParams),
staruno::UNO_QUERY
);
staruno::Reference<starbeans::XPropertySet> xDialogProps(xDialog, staruno::UNO_QUERY);
if (xDialog.is() && xDialogProps.is() && xDialog->execute())
{
staruno::Any aSelectedPath = xDialogProps->getPropertyValue(::rtl::OUString::createFromAscii("SelectedPath"));
if (aSelectedPath.getValueType().getTypeClass() == staruno::TypeClass_STRING)
{
xSet->setPropertyValue(PROPERTY_IMAGE_URL, ::com::sun::star::uno::makeAny(::rtl::OUString()));
// reset the url property in case it already has the value we're about to set - in this case
// our propertyChanged would not get called without this.
xSet->setPropertyValue(PROPERTY_IMAGE_URL, aSelectedPath);
}
}
}
catch(...)
{
}
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,201 @@
/*************************************************************************
*
* $RCSfile: ImageControl.hxx,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): _______________________________________
*
*
************************************************************************/
#ifndef _FRM_IMAGE_CONTROL_HXX_
#define _FRM_IMAGE_CONTROL_HXX_
#include "FormComponent.hxx"
#ifndef _PRODUCE_HXX //autogen
#include <svtools/imgprod.hxx>
#endif
#ifndef _COM_SUN_STAR_FORM_XIMAGEPRODUCERSUPPLIER_HPP_
#include <com/sun/star/form/XImageProducerSupplier.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XMOUSELISTENER_HPP_
#include <com/sun/star/awt/XMouseListener.hpp>
#endif
#ifndef _UNOTOOLS_PROPERTY_MULTIPLEX_HXX_
#include <unotools/propmultiplex.hxx>
#endif
using namespace utl;
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OImageControlModel
//==================================================================
class OImageControlModel
:public starform::XImageProducerSupplier
,public ::utl::OAggregationArrayUsageHelper<OImageControlModel>
,public OBoundControlModel
,public OPropertyChangeListener
{
staruno::Reference<starawt::XImageProducer> m_xImageProducer;
ImageProducer* m_pImageProducer;
sal_Bool m_bReadOnly;
// Helper functions
void UpdateFromField();
protected:
// UNO Anbindung
virtual staruno::Sequence<staruno::Type> _getTypes();
virtual void _onValueChanged();
virtual sal_Bool _approve(sal_Int32 _nColumnType);
inline ImageProducer* GetImageProducer() { return m_pImageProducer; }
public:
OImageControlModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OImageControlModel();
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);
virtual sal_Bool SAL_CALL convertFastPropertyValue(staruno::Any& rConvertedValue, staruno::Any& rOldValue, sal_Int32 nHandle, const staruno::Any& rValue )
throw(starlang::IllegalArgumentException);
// UNO Anbindung
DECLARE_UNO3_AGG_DEFAULTS(OImageControlModel, OBoundControlModel);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// starform::XBoundComponent
virtual staruno::Any _getControlValue() const;
virtual void _reset();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OImageControlModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// OComponentHelper
virtual void SAL_CALL disposing();
// OPropertyChangeListener
virtual void _propertyChanged( const starbeans::PropertyChangeEvent& ) throw(staruno::RuntimeException);
// staruno::Reference<starbeans::XPropertySet>
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream);
virtual void SAL_CALL read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream);
// starform::XImageProducerSupplier
virtual staruno::Reference<starawt::XImageProducer> SAL_CALL getImageProducer() { return m_xImageProducer; }
// ::utl::OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
//==================================================================
// OImageControlControl
//==================================================================
class OImageControlControl : public starawt::XMouseListener,
public OBoundControl
{
protected:
// UNO Anbindung
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OImageControlControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// UNO Anbindung
DECLARE_UNO3_AGG_DEFAULTS(OImageControlControl, OBoundControl);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException)
{ OBoundControl::disposing(_rSource); }
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OImageControlControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starawt::XMouseListener
virtual void SAL_CALL mousePressed(const starawt::MouseEvent& e);
virtual void SAL_CALL mouseReleased(const starawt::MouseEvent& e) { }
virtual void SAL_CALL mouseEntered(const starawt::MouseEvent& e) { }
virtual void SAL_CALL mouseExited(const starawt::MouseEvent& e) { }
// starawt::XControl
virtual void SAL_CALL createPeer(const staruno::Reference<starawt::XToolkit>& _rToolkit, const staruno::Reference<starawt::XWindowPeer>& _rParent) throw(staruno::RuntimeException);
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FRM_IMAGE_CONTROL_HXX_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,254 @@
/*************************************************************************
*
* $RCSfile: ListBox.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_LISTBOX_HXX_
#define _FORMS_LISTBOX_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
#endif
#ifndef _DATE_HXX
#include <tools/date.hxx>
#endif
#ifndef _SV_TIMER_HXX
#include <vcl/timer.hxx>
#endif
#include <com/sun/star/util/XRefreshable.hpp>
#include <com/sun/star/util/XNumberFormatter.hpp>
#include <com/sun/star/sdb/XSQLErrorBroadcaster.hpp>
#include <com/sun/star/form/ListSourceType.hpp>
#include <com/sun/star/awt/XItemListener.hpp>
#include <com/sun/star/awt/XFocusListener.hpp>
#include <com/sun/star/form/XChangeBroadcaster.hpp>
//.........................................................................
namespace frm
{
const ::rtl::OUString LISTBOX_EMPTY_VALUE = ::rtl::OUString::createFromAscii("$$$empty$$$");
//==================================================================
//= OListBoxModel
//==================================================================
class OListBoxModel
:public OBoundControlModel
,public starsdb::XSQLErrorBroadcaster
,public starutil::XRefreshable
,public ::utl::OAggregationArrayUsageHelper< OListBoxModel >
{
staruno::Any m_aSaveValue;
// <properties>
starform::ListSourceType m_eListSourceType; // type der list source
staruno::Any m_aBoundColumn;
StringSequence m_aListSourceSeq; //
StringSequence m_aValueSeq; // alle Werte, readonly
staruno::Sequence<sal_Int16> m_aDefaultSelectSeq; // DefaultSelected
// </properties>
::cppu::OInterfaceContainerHelper m_aRefreshListeners;
::cppu::OInterfaceContainerHelper m_aErrorListeners;
static sal_Int32 nSelectHandle;
// [properties]
sal_Int16 m_nNULLPos; // Position an der der NULLwert abgelegt wird
sal_Bool m_bBoundComponent : 1;
// Helper functions
StringSequence GetCurValueSeq() const;
virtual staruno::Sequence<staruno::Type> _getTypes();
protected:
// UNO Anbindung
virtual void _onValueChanged();
public:
OListBoxModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OListBoxModel();
// XServiceInfo
IMPLEMENTATION_NAME(OListBoxModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
// UNO Anbindung
DECLARE_UNO3_AGG_DEFAULTS(OListBoxModel, OBoundControlModel);
virtual staruno::Any SAL_CALL queryAggregation( const staruno::Type& _rType ) throw (staruno::RuntimeException);
// OComponentHelper
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();
// XBoundComponent
virtual sal_Bool _commit();
// XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException);
// XReset
virtual void _reset();
// XRefreshable
virtual void SAL_CALL refresh() throw(staruno::RuntimeException);
virtual void SAL_CALL addRefreshListener(const staruno::Reference<starutil::XRefreshListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeRefreshListener(const staruno::Reference<starutil::XRefreshListener>& _rxListener) throw(staruno::RuntimeException);
// XSQLErrorBroadcaster
virtual void SAL_CALL addSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeSQLErrorListener(const staruno::Reference<starsdb::XSQLErrorListener>& _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);
};
//==================================================================
//= OListBoxControl
//==================================================================
class OListBoxControl :public OBoundControl
,public starawt::XFocusListener
,public starawt::XItemListener
,public starform::XChangeBroadcaster
{
::cppu::OInterfaceContainerHelper m_aChangeListeners;
staruno::Any m_aCurrentSelection;
Timer m_aChangeTimer;
protected:
// UNO Anbindung
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OListBoxControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OListBoxControl();
// UNO Anbindung
DECLARE_UNO3_AGG_DEFAULTS(OListBoxControl, OBoundControl);
virtual staruno::Any SAL_CALL queryAggregation( const staruno::Type& _rType ) throw (staruno::RuntimeException);
// XServiceInfo
IMPLEMENTATION_NAME(OListBoxControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(staruno::RuntimeException);
// XChangeBroadcaster
virtual void SAL_CALL addChangeListener(const staruno::Reference<starform::XChangeListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeChangeListener(const staruno::Reference<starform::XChangeListener>& _rxListener) throw(staruno::RuntimeException);
// XFocusListener
virtual void SAL_CALL focusGained(const starawt::FocusEvent& _rEvent) throw(staruno::RuntimeException);
virtual void SAL_CALL focusLost(const starawt::FocusEvent& _rEvent) throw(staruno::RuntimeException);
// XItemListener
virtual void SAL_CALL itemStateChanged(const starawt::ItemEvent& _rEvent) throw(staruno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& Source) throw (staruno::RuntimeException);
// OComponentHelper
virtual void SAL_CALL disposing();
private:
DECL_LINK( OnTimeout, void* );
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_LISTBOX_HXX_

View File

@@ -0,0 +1,256 @@
/*************************************************************************
*
* $RCSfile: Numeric.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_NUMERIC_HXX_
#include "Numeric.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// ONumericControl
//==================================================================
//------------------------------------------------------------------
ONumericControl::ONumericControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_NUMERICFIELD)
{
}
//------------------------------------------------------------------------------
StringSequence ONumericControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_NUMERICFIELD;
return aSupported;
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL ONumericControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new ONumericControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> ONumericControl::_getTypes()
{
return OBoundControl::_getTypes();
}
//==================================================================
// ONumericModel
//==================================================================
sal_Int32 ONumericModel::nValueHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL ONumericModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new ONumericModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> ONumericModel::_getTypes()
{
return OEditBaseModel::_getTypes();
}
//------------------------------------------------------------------
ONumericModel::ONumericModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_NUMERICFIELD, FRM_CONTROL_NUMERICFIELD)
// use the old control name for compytibility reasons
{
m_nClassId = starform::FormComponentType::NUMERICFIELD;
m_sDataFieldConnectivityProperty = PROPERTY_VALUE;
if (ONumericModel::nValueHandle == -1)
ONumericModel::nValueHandle = getOriginalHandle(PROPERTY_ID_VALUE);
}
//------------------------------------------------------------------
ONumericModel::~ONumericModel()
{
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence ONumericModel::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.starform");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_NUMERICFIELD;
return aSupported;
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL ONumericModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void ONumericModel::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& ONumericModel::getInfoHelper()
{
return *const_cast<ONumericModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL ONumericModel::getServiceName()
{
return FRM_COMPONENT_NUMERICFIELD; // old (non-sun) name for compatibility !
}
// starform::XBoundComponent
//------------------------------------------------------------------------------
sal_Bool ONumericModel::_commit()
{
staruno::Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( ONumericModel::nValueHandle );
if (!compare(aNewValue, m_aSaveValue))
{
if (!aNewValue.hasValue())
m_xColumnUpdate->updateNull();
else
{
try
{
m_xColumnUpdate->updateDouble(getDouble(aNewValue));
}
catch(...)
{
return sal_False;
}
}
m_aSaveValue = aNewValue;
}
return sal_True;
}
//------------------------------------------------------------------------------
void ONumericModel::_onValueChanged()
{
m_aSaveValue <<= (double)m_xColumn->getDouble();
if (m_xColumn->wasNull())
m_aSaveValue.clear();
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(ONumericModel::nValueHandle, m_aSaveValue);
}
}
// starform::XReset
//------------------------------------------------------------------------------
void ONumericModel::_reset()
{
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(ONumericModel::nValueHandle, aValue);
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,138 @@
/*************************************************************************
*
* $RCSfile: Numeric.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_NUMERIC_HXX_
#define _FORMS_NUMERIC_HXX_
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= ONumericModel
//==================================================================
class ONumericModel
:public OEditBaseModel
,public ::utl::OAggregationArrayUsageHelper< ONumericModel >
{
staruno::Any m_aSaveValue;
static sal_Int32 nValueHandle;
protected:
virtual void _onValueChanged();
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
ONumericModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~ONumericModel();
// starform::XBoundComponent
virtual sal_Bool _commit();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(ONumericModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// staruno::Reference<starbeans::XPropertySet>
virtual staruno::Reference<starbeans::XPropertySetInfo> 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()
};
//==================================================================
//= ONumericControl
//==================================================================
class ONumericControl: public OBoundControl
{
protected:
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
ONumericControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(ONumericControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FORMS_NUMERIC_HXX_

View File

@@ -0,0 +1,251 @@
/*************************************************************************
*
* $RCSfile: Pattern.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_PATTERN_HXX_
#include "Pattern.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
// OPatternControl
//==================================================================
//------------------------------------------------------------------
OPatternControl::OPatternControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_PATTERNFIELD)
{
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL OPatternControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OPatternControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OPatternControl::_getTypes()
{
return OBoundControl::_getTypes();
}
//------------------------------------------------------------------------------
StringSequence OPatternControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_PATTERNFIELD;
return aSupported;
}
//==================================================================
// OPatternModel
//==================================================================
sal_Int32 OPatternModel::nTextHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL OPatternModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OPatternModel(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OPatternModel::_getTypes()
{
return OEditBaseModel::_getTypes();
}
//------------------------------------------------------------------
OPatternModel::OPatternModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_PATTERNFIELD, FRM_CONTROL_PATTERNFIELD)
// use the old control name for compytibility reasons
{
m_nClassId = starform::FormComponentType::PATTERNFIELD;
m_sDataFieldConnectivityProperty = PROPERTY_TEXT;
if (OPatternModel::nTextHandle == -1)
OPatternModel::nTextHandle = getOriginalHandle(PROPERTY_ID_TEXT);
}
//------------------------------------------------------------------
OPatternModel::~OPatternModel()
{
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OPatternModel::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 2);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-2] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.DatabasePatternField");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_PATTERNFIELD;
return aSupported;
}
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OPatternModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void OPatternModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(12)
// Text auf transient setzen
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TEXT, starbeans::PropertyAttribute::TRANSIENT, 0);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP2(DEFAULT_TEXT, ::rtl::OUString, BOUND, MAYBEDEFAULT);
DECL_BOOL_PROP1(EMPTY_IS_NULL, BOUND);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND);
DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
DECL_IFACE_PROP2(BOUNDFIELD, starbeans::XPropertySet, READONLY, TRANSIENT);
DECL_PROP2(FILTERPROPOSAL, sal_Bool, BOUND, MAYBEDEFAULT);
DECL_IFACE_PROP2(CONTROLLABEL, starbeans::XPropertySet, BOUND, MAYBEVOID);
DECL_PROP2(CONTROLSOURCEPROPERTY, rtl::OUString, READONLY, TRANSIENT);
FRM_END_PROP_HELPER();
}
//------------------------------------------------------------------------------
::cppu::IPropertyArrayHelper& OPatternModel::getInfoHelper()
{
return *const_cast<OPatternModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OPatternModel::getServiceName()
{
return FRM_COMPONENT_PATTERNFIELD; // old (non-sun) name for compatibility !
}
// starform::XBoundComponent
//------------------------------------------------------------------------------
sal_Bool OPatternModel::_commit()
{
::rtl::OUString aNewValue = getString(m_xAggregateFastSet->getFastPropertyValue( OPatternModel::nTextHandle ));
if (aNewValue != m_aSaveValue)
{
if (!aNewValue.len() && !m_bRequired && m_bEmptyIsNull)
m_xColumnUpdate->updateNull();
else
{
try
{
m_xColumnUpdate->updateString(aNewValue);
}
catch(...)
{
return sal_False;
}
}
m_aSaveValue = aNewValue;
}
return sal_True;
}
// starbeans::XPropertyChangeListener
//------------------------------------------------------------------------------
void OPatternModel::_onValueChanged()
{
m_aSaveValue = m_xColumn->getString();
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(OPatternModel::nTextHandle, staruno::makeAny(m_aSaveValue));
}
}
// starform::XReset
//------------------------------------------------------------------------------
void OPatternModel::_reset( void )
{
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(OPatternModel::nTextHandle, staruno::makeAny(m_aDefaultText));
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,139 @@
/*************************************************************************
*
* $RCSfile: Pattern.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_PATTERN_HXX_
#define _FORMS_PATTERN_HXX_
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= OPatternModel
//==================================================================
class OPatternModel
:public OEditBaseModel
,public ::utl::OAggregationArrayUsageHelper< OPatternModel >
{
::rtl::OUString m_aSaveValue;
static sal_Int32 nTextHandle;
protected:
virtual void _onValueChanged();
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OPatternModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OPatternModel();
// starform::XBoundComponent
virtual sal_Bool _commit();
// staruno::Reference<starbeans::XPropertySet>
virtual staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OPatternModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// 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()
};
//==================================================================
//= OPatternControl
//==================================================================
class OPatternControl: public OBoundControl
{
protected:
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OPatternControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OPatternControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FORMS_PATTERN_HXX_

View File

@@ -0,0 +1,510 @@
/*************************************************************************
*
* $RCSfile: RadioButton.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_RADIOBUTTON_HXX_
#include "RadioButton.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 <tools/debug.hxx>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_
#include <com/sun/star/container/XIndexAccess.hpp>
#endif
//.........................................................................
namespace frm
{
//==================================================================
//------------------------------------------------------------------------------
InterfaceRef SAL_CALL ORadioButtonControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new ORadioButtonControl(_rxFactory));
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL ORadioButtonControl::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_RADIOBUTTON;
return aSupported;
}
//------------------------------------------------------------------
ORadioButtonControl::ORadioButtonControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_RADIOBUTTON)
{
}
//==================================================================
InterfaceRef SAL_CALL ORadioButtonModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException)
{
return *(new ORadioButtonModel(_rxFactory));
}
//------------------------------------------------------------------
ORadioButtonModel::ORadioButtonModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControlModel(_rxFactory, VCL_CONTROLMODEL_RADIOBUTTON, FRM_CONTROL_RADIOBUTTON, sal_False)
// use the old control name for compytibility reasons
,OPropertyChangeListener(m_aMutex)
,m_bInReset(sal_False)
{
m_nClassId = starform::FormComponentType::RADIOBUTTON;
m_nDefaultChecked = RB_NOCHECK;
m_aLabelServiceName = FRM_SUN_COMPONENT_GROUPBOX;
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);
}
// XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL ORadioButtonModel::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.DatabaseRadioButton");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_RADIOBUTTON;
return aSupported;
}
//------------------------------------------------------------------------------
void ORadioButtonModel::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 ORadioButtonModel::SetSiblingPropsTo(const ::rtl::OUString& rPropName, const staruno::Any& rValue)
{
// mein Name
::rtl::OUString sMyName(m_aName);
// meine Siblings durchiterieren
staruno::Reference<starcontainer::XIndexAccess> xIndexAccess(getParent(), staruno::UNO_QUERY);
if (xIndexAccess.is())
{
staruno::Reference<starbeans::XPropertySet> xMyProps;
query_interface(static_cast<staruno::XWeak*>(this), xMyProps);
::rtl::OUString sCurrentName;
for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
{
staruno::Reference<starbeans::XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), staruno::UNO_QUERY);
if (!xSiblingProperties.is())
continue;
if (xMyProps == xSiblingProperties)
continue; // mich selber nicht umsetzen
// nur wenn es ein Radio-Button ist
if (!hasProperty(PROPERTY_CLASSID, xSiblingProperties))
continue;
sal_Int16 nType;
xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType;
if (nType != starform::FormComponentType::RADIOBUTTON)
continue;
// das 'zur selben Gruppe gehoeren' wird am Namen festgemacht
xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sCurrentName;
if (sCurrentName == sMyName)
xSiblingProperties->setPropertyValue(rPropName, rValue);
}
}
}
//------------------------------------------------------------------------------
void ORadioButtonModel::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle, const staruno::Any& rValue) throw (::com::sun::star::uno::Exception)
{
switch (nHandle)
{
case PROPERTY_ID_REFVALUE :
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_STRING, "ORadioButtonModel::setFastPropertyValue_NoBroadcast : invalid type !" );
rValue >>= m_sReferenceValue;
break;
case PROPERTY_ID_DEFAULTCHECKED :
DBG_ASSERT(rValue.getValueType().getTypeClass() == staruno::TypeClass_SHORT, "ORadioButtonModel::setFastPropertyValue_NoBroadcast : invalid type !" );
rValue >>= (sal_Int16)m_nDefaultChecked;
_reset();
break;
default:
OBoundControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue);
}
// if the label control changed ...
if (nHandle == PROPERTY_ID_CONTROLLABEL)
{ // ... forward this to our siblings
SetSiblingPropsTo(PROPERTY_CONTROLLABEL, rValue);
}
// wenn sich die ControlSource-Eigenschaft geaendert hat ...
if (nHandle == PROPERTY_ID_CONTROLSOURCE)
{ // ... muss ich allen meinen Siblings, die in der selben RadioButton-Gruppe sind wie ich, auch die
// neue ControlSource mitgeben
SetSiblingPropsTo(PROPERTY_CONTROLSOURCE, rValue);
}
// die andere Richtung : wenn sich mein Name aendert ...
if (nHandle == PROPERTY_ID_NAME)
{
// ... muss ich testen, ob ich Siblings mit dem selben Namen habe, damit ich deren ControlSource uebernehmen kann
staruno::Reference<starcontainer::XIndexAccess> xIndexAccess(getParent(), staruno::UNO_QUERY);
if (xIndexAccess.is())
{
::rtl::OUString sName;
::rtl::OUString sControlSource;
staruno::Reference<starbeans::XPropertySet> xMyProps;
query_interface(static_cast<staruno::XWeak*>(this), xMyProps);
for (sal_Int32 i=0; i<xIndexAccess->getCount(); ++i)
{
staruno::Reference<starbeans::XPropertySet> xSiblingProperties(*(InterfaceRef*)xIndexAccess->getByIndex(i).getValue(), staruno::UNO_QUERY);
if (!xSiblingProperties.is())
continue;
if (xMyProps == xSiblingProperties)
// nur wenn ich nicht mich selber gefunden habe
continue;
sal_Int16 nType;
xSiblingProperties->getPropertyValue(PROPERTY_CLASSID) >>= nType;
if (nType != starform::FormComponentType::RADIOBUTTON)
// nur Radio-Buttons
continue;
xSiblingProperties->getPropertyValue(PROPERTY_NAME) >>= sName;
// Control, das zur gleichen Gruppe gehoert ?
if (rValue == sName)
{
setPropertyValue(PROPERTY_CONTROLSOURCE, xSiblingProperties->getPropertyValue(PROPERTY_CONTROLSOURCE));
break;
}
}
}
}
if (nHandle == PROPERTY_ID_DEFAULTCHECKED)
{
sal_Int16 nValue;
rValue >>= nValue;
if (1 == nValue)
{ // bei allen Radios der selben Gruppe das 'default checked' ruecksetzen, denn wie schon der highlander wusste :
// es kann nur einen geben.
staruno::Any aZero;
nValue = 0;
aZero <<= nValue;
SetSiblingPropsTo(PROPERTY_DEFAULTCHECKED, aZero);
}
}
}
//------------------------------------------------------------------------------
sal_Bool ORadioButtonModel::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<starbeans::XPropertySetInfo> SAL_CALL ORadioButtonModel::getPropertySetInfo() throw(staruno::RuntimeException)
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
cppu::IPropertyArrayHelper& ORadioButtonModel::getInfoHelper()
{
return *const_cast<ORadioButtonModel*>(this)->getArrayHelper();
}
//------------------------------------------------------------------------------
void ORadioButtonModel::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 ORadioButtonModel::getServiceName() throw(staruno::RuntimeException)
{
return FRM_COMPONENT_RADIOBUTTON; // old (non-sun) name for compatibility !
}
//------------------------------------------------------------------------------
void SAL_CALL ORadioButtonModel::write(const staruno::Reference<stario::XObjectOutputStream>& _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 ORadioButtonModel::read(const staruno::Reference<stario::XObjectInputStream>& _rxInStream) throw(stario::IOException, staruno::RuntimeException)
{
OBoundControlModel::read(_rxInStream);
::osl::MutexGuard aGuard(m_aMutex);
// Version
UINT16 nVersion = _rxInStream->readShort();
switch (nVersion)
{
case 0x0001 : _rxInStream >> m_sReferenceValue; _rxInStream >> (sal_Int16)m_nDefaultChecked; 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("ORadioButtonModel::read : unknown version !");
m_sReferenceValue = ::rtl::OUString();
m_nDefaultChecked = 0;
defaultCommonProperties();
break;
}
// Nach dem Lesen die Defaultwerte anzeigen
if (m_aControlSource.getLength())
// (not if we don't have a control source - the "State" property acts like it is persistent, then
_reset();
}
//------------------------------------------------------------------------------
void ORadioButtonModel::_propertyChanged(const starbeans::PropertyChangeEvent& _rEvent) throw(staruno::RuntimeException)
{
if (_rEvent.PropertyName.equals(PROPERTY_STATE))
{
if (_rEvent.NewValue == (sal_Int16)1)
{
// wenn sich mein Status auf 'checked' geaendert hat, muss ich alle meine Siblings, die in der selben Gruppe
// sind wie ich, entsprechend zuruecksetzen
staruno::Any aZero;
aZero <<= (sal_Int16)0;
SetSiblingPropsTo(PROPERTY_STATE, aZero);
::osl::MutexGuard aGuard(m_aMutex);
// as we aren't commitable we have to take care of the field we are bound to ourself
if (m_xField.is() && !m_bInReset)
{
m_xField->setPropertyValue(PROPERTY_VALUE, staruno::makeAny(m_sReferenceValue));
}
}
}
}
//------------------------------------------------------------------------------
void ORadioButtonModel::_onValueChanged()
{
staruno::Any aValue;
aValue <<= (sal_Int16)((m_xColumn->getString() == m_sReferenceValue) ? RB_CHECK : RB_NOCHECK);
m_bInReset = sal_True;
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateSet->setPropertyValue(PROPERTY_STATE, aValue);
}
m_bInReset = sal_False;
}
//------------------------------------------------------------------------------
staruno::Any ORadioButtonModel::_getControlValue() const
{
return m_xAggregateSet->getPropertyValue(PROPERTY_STATE);
}
//------------------------------------------------------------------------------
sal_Int16 ORadioButtonModel::getState( const staruno::Any& rValue )
{
//::rtl::OUString aStrValue = DBTypeConversion::toString( rValue );
return RB_NOCHECK;
}
//------------------------------------------------------------------------------
void ORadioButtonModel::_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 ORadioButtonModel::_commit()
{
if (!m_bInReset)
// normally we don't have a commit as we forward all state changes immediately to our field we're bound to
return sal_True;
// we're in reset, so this commit means "put the value into the field you're bound to"
// 72769 - 08.02.00 - FS
DBG_ASSERT(m_xField.is(), "ORadioButtonModel::_commit : committing while resetting, but not bound ?");
if (m_xField.is())
{
try
{
sal_Int16 nValue;
m_xAggregateSet->getPropertyValue(PROPERTY_STATE) >>= nValue;
if (nValue == 1)
m_xField->setPropertyValue(PROPERTY_VALUE, staruno::makeAny(m_sReferenceValue));
}
catch(...)
{
DBG_ERROR("ORadioButtonModel::_commit : could not commit !");
}
}
return sal_True;
}
//-----------------------------------------------------------------------------
void ORadioButtonModel::reset(void) throw (::com::sun::star::uno::RuntimeException)
{
m_bInReset = sal_True;
OBoundControlModel::reset();
m_bInReset = sal_False;
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,162 @@
/*************************************************************************
*
* $RCSfile: RadioButton.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_RADIOBUTTON_HXX_
#define _FORMS_RADIOBUTTON_HXX_
#ifndef _FORMS_FORMCOMPONENT_HXX_
#include "FormComponent.hxx"
#endif
#ifndef _UNOTOOLS_PROPERTY_MULTIPLEX_HXX_
#include <unotools/propmultiplex.hxx>
#endif
//.........................................................................
namespace frm
{
enum { RB_NOCHECK, RB_CHECK, RB_DONTKNOW };
//==================================================================
// ORadioButtonModel
//==================================================================
class ORadioButtonModel :public OBoundControlModel
,public OPropertyChangeListener
,public ::utl::OAggregationArrayUsageHelper< ORadioButtonModel >
{
::rtl::OUString m_sReferenceValue; // Referenzwert zum Checken des Buttons
sal_Int16 m_nDefaultChecked; // Soll beim Reset gecheckt werden ?
sal_Bool m_bInReset : 1;
protected:
sal_Int16 getState(const staruno::Any& rValue);
virtual void _onValueChanged();
virtual staruno::Any _getControlValue() const;
public:
ORadioButtonModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// XServiceInfo
IMPLEMENTATION_NAME(ORadioButtonModel);
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);
// XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> 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<stario::XObjectOutputStream>& _rxOutStream) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL
read(const staruno::Reference<stario::XObjectInputStream>& _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();
protected:
void SetSiblingPropsTo(const ::rtl::OUString& rPropName, const staruno::Any& rValue);
};
//==================================================================
// ORadioButtonControl
//==================================================================
class ORadioButtonControl: public OBoundControl
{
public:
ORadioButtonControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// XServiceInfo
IMPLEMENTATION_NAME(ORadioButtonControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
};
//.........................................................................
}
//.........................................................................
#endif // _FORMS_RADIOBUTTON_HXX_

View File

@@ -0,0 +1,310 @@
/*************************************************************************
*
* $RCSfile: Time.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_TIME_HXX_
#include "Time.hxx"
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#ifndef _TOOLS_TIME_HXX
#include <tools/time.hxx>
#endif
#ifndef _UNOTOOLS_DATETIME_HXX_
#include <unotools/datetime.hxx>
#endif
#ifndef _UTL_DB_CONVERSION_HXX_
#include <unotools/dbconversion.hxx>
#endif
#ifndef _COM_SUN_STAR_SDBC_DATATYPE_HPP_
#include <com/sun/star/sdbc/DataType.hpp>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= OTimeControl
//==================================================================
//------------------------------------------------------------------
OTimeControl::OTimeControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OBoundControl(_rxFactory, VCL_CONTROL_TIMEFIELD)
{
}
//------------------------------------------------------------------
InterfaceRef SAL_CALL OTimeControl_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OTimeControl(_rxFactory));
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OTimeControl::_getTypes()
{
return OBoundControl::_getTypes();
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OTimeControl::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControl::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 1);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-1] = FRM_SUN_CONTROL_TIMEFIELD;
return aSupported;
}
//==================================================================
//= OTimeModel
//==================================================================
sal_Int32 OTimeModel::nTimeHandle = -1;
//------------------------------------------------------------------
InterfaceRef SAL_CALL OTimeModel_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
{
return *(new OTimeModel(_rxFactory));
}
// starlang::XServiceInfo
//------------------------------------------------------------------------------
StringSequence SAL_CALL OTimeModel::getSupportedServiceNames() throw()
{
StringSequence aSupported = OBoundControlModel::getSupportedServiceNames();
aSupported.realloc(aSupported.getLength() + 2);
::rtl::OUString*pArray = aSupported.getArray();
pArray[aSupported.getLength()-2] = ::rtl::OUString::createFromAscii("com.sun.star.form.component.starform");
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_TIMEFIELD;
return aSupported;
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> OTimeModel::_getTypes()
{
return OBoundControlModel::_getTypes();
}
//------------------------------------------------------------------
OTimeModel::OTimeModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:OEditBaseModel(_rxFactory, VCL_CONTROLMODEL_TIMEFIELD, FRM_CONTROL_TIMEFIELD )
// use the old control name for compytibility reasons
{
m_nClassId = starform::FormComponentType::TIMEFIELD;
m_sDataFieldConnectivityProperty = PROPERTY_TIME;
if (OTimeModel::nTimeHandle == -1)
OTimeModel::nTimeHandle = getOriginalHandle(PROPERTY_ID_TIME);
}
//------------------------------------------------------------------------------
::rtl::OUString SAL_CALL OTimeModel::getServiceName()
{
return FRM_COMPONENT_TIMEFIELD; // old (non-sun) name for compatibility !
}
// starbeans::XPropertySet
//------------------------------------------------------------------------------
staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL OTimeModel::getPropertySetInfo() throw( staruno::RuntimeException )
{
staruno::Reference<starbeans::XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
return xInfo;
}
//------------------------------------------------------------------------------
void OTimeModel::fillProperties(
staruno::Sequence< starbeans::Property >& _rProps,
staruno::Sequence< starbeans::Property >& _rAggregateProps ) const
{
FRM_BEGIN_PROP_HELPER(10)
// starutil::Time auf transient setzen
// ModifyPropertyAttributes(_rAggregateProps, PROPERTY_TIME, starbeans::PropertyAttribute::TRANSIENT, 0);
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
DECL_PROP3(DEFAULT_TIME, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
DECL_PROP1(CONTROLSOURCE, ::rtl::OUString, BOUND);
DECL_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& OTimeModel::getInfoHelper()
{
return *const_cast<OTimeModel*>(this)->getArrayHelper();
}
// starform::XLoadListener
//------------------------------------------------------------------------------
void OTimeModel::_loaded(const starlang::EventObject& rEvent)
{
OBoundControlModel::_loaded(rEvent);
if (m_xField.is())
{
m_bDateTimeField = sal_False;
try
{
sal_Int32 nFieldType;
m_xField->getPropertyValue(PROPERTY_FIELDTYPE) >>= nFieldType;
m_bDateTimeField = (nFieldType == starsdbc::DataType::TIMESTAMP);
}
catch(...)
{
}
}
}
// starform::XBoundComponent
//------------------------------------------------------------------------------
sal_Bool OTimeModel::_commit()
{
staruno::Any aNewValue = m_xAggregateFastSet->getFastPropertyValue( OTimeModel::nTimeHandle );
if (!compare(aNewValue, m_aSaveValue))
{
if (!aNewValue.hasValue())
m_xColumnUpdate->updateNull();
else
{
try
{
starutil::Time aTime;
if (!(aNewValue >>= aTime))
{
sal_Int32 nAsInt(0);
aNewValue >>= nAsInt;
Time aToolsValue(nAsInt);
typeConvert(aToolsValue, aTime);
}
if (!m_bDateTimeField)
m_xColumnUpdate->updateTime(aTime);
else
{
starutil::DateTime aDateTime = m_xColumn->getTimestamp();
aDateTime.HundredthSeconds = aTime.HundredthSeconds;
aDateTime.Seconds = aTime.Seconds;
aDateTime.Minutes = aTime.Minutes;
aDateTime.Hours = aTime.Hours;
m_xColumnUpdate->updateTimestamp(aDateTime);
}
}
catch(...)
{
return sal_False;
}
}
m_aSaveValue = aNewValue;
}
return sal_True;
}
//------------------------------------------------------------------------------
void OTimeModel::_onValueChanged()
{
starutil::Time aTime = m_xColumn->getTime();
if (m_xColumn->wasNull())
m_aSaveValue.clear();
else
// the aggregated set expects an Int32 as value ...
m_aSaveValue <<= DBTypeConversion::toINT32(aTime);
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(OTimeModel::nTimeHandle, m_aSaveValue);
}
}
//------------------------------------------------------------------------------
void OTimeModel::_reset()
{
staruno::Any aValue;
if (m_aDefault.getValueType().getTypeClass() == staruno::TypeClass_LONG)
aValue = m_aDefault;
else
{ // aktuelles Datum einstellen
Time aCurrentTime;
aValue <<= DBTypeConversion::toINT32(aCurrentTime);
}
{ // release our mutex once (it's acquired in the calling method !), as setting aggregate properties
// may cause any uno controls belonging to us to lock the solar mutex, which is potentially dangerous with
// our own mutex locked
// FS - 72451 - 31.01.00
MutexRelease aRelease(m_aMutex);
m_xAggregateFastSet->setFastPropertyValue(OTimeModel::nTimeHandle, aValue);
}
}
//.........................................................................
} // namespace frm
//.........................................................................

View File

@@ -0,0 +1,142 @@
/*************************************************************************
*
* $RCSfile: Time.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_TIME_HXX_
#define _FORMS_TIME_HXX_
#ifndef _FORMS_EDITBASE_HXX_
#include "EditBase.hxx"
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//==================================================================
//= OTimeModel
//==================================================================
class OTimeModel
:public OEditBaseModel
,public ::utl::OAggregationArrayUsageHelper< OTimeModel >
{
staruno::Any m_aSaveValue;
sal_Bool m_bDateTimeField;
static sal_Int32 nTimeHandle;
protected:
virtual void _onValueChanged();
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OTimeModel(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
// starform::XBoundComponent
virtual sal_Bool _commit();
// stario::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName();
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OTimeModel);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
// starbeans::XPropertySet
virtual staruno::Reference<starbeans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(staruno::RuntimeException);
virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
// starform::XReset
virtual void _reset( void );
// starform::XLoadListener
virtual void _loaded(const starlang::EventObject& rEvent);
// OAggregationArrayUsageHelper
virtual void fillProperties(
staruno::Sequence< starbeans::Property >& /* [out] */ _rProps,
staruno::Sequence< starbeans::Property >& /* [out] */ _rAggregateProps
) const;
IMPLEMENT_INFO_SERVICE()
};
//==================================================================
//= OTimeControl
//==================================================================
class OTimeControl: public OBoundControl
{
protected:
virtual staruno::Sequence<staruno::Type> _getTypes();
public:
OTimeControl(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
DECLARE_UNO3_AGG_DEFAULTS(OTimeControl, OBoundControl);
// starlang::XServiceInfo
IMPLEMENTATION_NAME(OTimeControl);
virtual StringSequence SAL_CALL getSupportedServiceNames() throw();
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FORMS_TIME_HXX_

View File

@@ -0,0 +1,145 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJINC=..
PRJNAME=forms
TARGET=component
ENABLE_EXCEPTIONS=TRUE
# --- Settings ----------------------------------
.INCLUDE : settings.mk
# --- Types -------------------------------------
INCPRE+=$(SOLARINCDIR)$/offuh
# --- Files -------------------------------------
CXXFILES= Grid.cxx \
Columns.cxx\
DatabaseForm.cxx \
GroupManager.cxx \
FormsCollection.cxx \
EventThread.cxx \
File.cxx \
Edit.cxx \
EditBase.cxx \
Numeric.cxx \
Pattern.cxx \
Currency.cxx \
Date.cxx \
Time.cxx \
FormattedField.cxx \
FormattedFieldWrapper.cxx \
ListBox.cxx \
ComboBox.cxx \
GroupBox.cxx \
Hidden.cxx \
CheckBox.cxx \
RadioButton.cxx \
FixedText.cxx \
FormComponent.cxx \
Image.cxx \
Button.cxx \
ImageButton.cxx \
ImageControl.cxx \
.IF "$(COM)"=="GCC"
NOOPTFILES= $(SLO)$/EventThread.obj
.ENDIF
SLOFILES= $(SLO)$/Grid.obj \
$(SLO)$/Columns.obj \
$(SLO)$/DatabaseForm.obj \
$(SLO)$/GroupManager.obj \
$(SLO)$/FormsCollection.obj \
$(SLO)$/EventThread.obj \
$(SLO)$/File.obj \
$(SLO)$/Edit.obj \
$(SLO)$/EditBase.obj \
$(SLO)$/Numeric.obj \
$(SLO)$/Pattern.obj \
$(SLO)$/Currency.obj \
$(SLO)$/Date.obj \
$(SLO)$/Time.obj \
$(SLO)$/FormattedField.obj \
$(SLO)$/FormattedFieldWrapper.obj \
$(SLO)$/ListBox.obj \
$(SLO)$/ComboBox.obj \
$(SLO)$/GroupBox.obj \
$(SLO)$/Hidden.obj \
$(SLO)$/CheckBox.obj \
$(SLO)$/RadioButton.obj \
$(SLO)$/FixedText.obj \
$(SLO)$/FormComponent.obj \
$(SLO)$/Image.obj \
$(SLO)$/Button.obj \
$(SLO)$/ImageButton.obj \
$(SLO)$/ImageControl.obj \
# --- Targets ----------------------------------
.INCLUDE : target.mk

View File

@@ -0,0 +1,305 @@
/*************************************************************************
*
* $RCSfile: InterfaceContainer.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_INTERFACE_CONTAINER_HXX_
#define _FRM_INTERFACE_CONTAINER_HXX_
#ifndef _UTL_STLTYPES_HXX_
#include <unotools/stl_types.hxx>
#endif
#ifndef _UTL_TYPES_HXX_
#include <unotools/types.hxx>
#endif
#ifndef _UTL_UNO3_HXX_
#include <unotools/uno3.hxx>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEREPLACE_HPP_
#include <com/sun/star/container/XNameReplace.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
#include <com/sun/star/container/XIndexReplace.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XEVENTLISTENER_HPP_
#include <com/sun/star/lang/XEventListener.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_EVENTOBJECT_HPP_
#include <com/sun/star/lang/EventObject.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XENUMERATIONACCESS_HPP_
#include <com/sun/star/container/XEnumerationAccess.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XPERSISTOBJECT_HPP_
#include <com/sun/star/io/XPersistObject.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORMCOMPONENT_HPP_
#include <com/sun/star/form/XFormComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_XEVENTATTACHERMANAGER_HPP_
#include <com/sun/star/script/XEventAttacherManager.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENT_HPP_
#include <com/sun/star/script/ScriptEvent.hpp>
#endif
#ifndef _COM_SUN_STAR_SCRIPT_SCRIPTEVENTDESCRIPTOR_HPP_
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XCONTAINER_HPP_
#include <com/sun/star/container/XContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_CONTAINER_XINDEXCONTAINER_HPP_
#include <com/sun/star/container/XIndexContainer.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#endif
#ifndef _COM_SUN_STAR_FORM_XFORMCOMPONENT_HPP_
#include <com/sun/star/form/XFormComponent.hpp>
#endif
#ifndef _OSL_MUTEX_HXX_
#include <osl/mutex.hxx>
#endif
#ifndef _CPPUHELPER_INTERFACECONTAINER_HXX_
#include <cppuhelper/interfacecontainer.hxx>
#endif
#ifndef _CPPUHELPER_COMPONENT_HXX_
#include <cppuhelper/component.hxx>
#endif
using namespace utl;
//.........................................................................
namespace frm
{
//.........................................................................
namespace starcontainer = ::com::sun::star::container;
namespace starscript = ::com::sun::star::script;
namespace starbeans = ::com::sun::star::beans;
namespace stario = ::com::sun::star::io;
namespace starlang = ::com::sun::star::lang;
namespace starform = ::com::sun::star::form;
typedef ::std::vector<InterfaceRef> OInterfaceArray;
typedef ::std::hash_multimap< ::rtl::OUString, InterfaceRef, ::utl::UStringHash, ::utl::UStringEqual> OInterfaceMap;
//==================================================================
// FmForms
// Implementiert den UNO-Container fuer Formulare
// enthaelt alle zugeordneten Forms
// dieses Container kann selbst den Context fuer Formulare darstellen
// oder au<61>en einen Context uebergeben bekommen
//==================================================================
class OInterfaceContainer
:public starcontainer::XNameContainer
,public starcontainer::XIndexContainer
,public starcontainer::XContainer
,public starcontainer::XEnumerationAccess
,public starscript::XEventAttacherManager
,public starbeans::XPropertyChangeListener
,public stario::XPersistObject
{
protected:
OInterfaceArray m_aItems;
OInterfaceMap m_aMap;
::cppu::OInterfaceContainerHelper m_aContainerListeners;
::osl::Mutex& m_rMutex;
staruno::Type m_aElementType;
staruno::Reference<starlang::XMultiServiceFactory> m_xServiceFactory;
// EventManager
staruno::Reference<starscript::XEventAttacherManager> m_xEventAttacher;
public:
OInterfaceContainer(
const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory,
::osl::Mutex& _rMutex,
const staruno::Type& _rElementType);
public:
virtual staruno::Any SAL_CALL queryInterface(const staruno::Type& _rType) throw (staruno::RuntimeException);
// stario::XPersistObject
virtual ::rtl::OUString SAL_CALL getServiceName( ) throw(staruno::RuntimeException) = 0;
virtual void SAL_CALL write( const staruno::Reference< stario::XObjectOutputStream >& OutStream ) throw(stario::IOException, staruno::RuntimeException);
virtual void SAL_CALL read( const staruno::Reference< stario::XObjectInputStream >& InStream ) throw(stario::IOException, staruno::RuntimeException);
// starlang::XEventListener
virtual void SAL_CALL disposing(const starlang::EventObject& _rSource) throw(staruno::RuntimeException);
// starbeans::XPropertyChangeListener
virtual void SAL_CALL propertyChange(const starbeans::PropertyChangeEvent& evt);
// starcontainer::XElementAccess
virtual staruno::Type SAL_CALL getElementType() throw(staruno::RuntimeException) ;
virtual sal_Bool SAL_CALL hasElements() throw(staruno::RuntimeException);
// starcontainer::XEnumerationAccess
virtual staruno::Reference<starcontainer::XEnumeration> SAL_CALL createEnumeration() throw(staruno::RuntimeException);
// starcontainer::XNameAccess
virtual staruno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
virtual StringSequence SAL_CALL getElementNames( ) throw(staruno::RuntimeException);
virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw(staruno::RuntimeException);
// starcontainer::XNameReplace
virtual void SAL_CALL replaceByName(const ::rtl::OUString& Name, const staruno::Any& _rElement) throw(starlang::IllegalArgumentException, starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
// starcontainer::XNameContainer
virtual void SAL_CALL insertByName(const ::rtl::OUString& Name, const staruno::Any& _rElement) throw(starlang::IllegalArgumentException, starcontainer::ElementExistException, starlang::WrappedTargetException, staruno::RuntimeException);
virtual void SAL_CALL removeByName(const ::rtl::OUString& Name) throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException);
// starcontainer::XIndexAccess
virtual sal_Int32 SAL_CALL getCount() throw(staruno::RuntimeException);
virtual staruno::Any SAL_CALL getByIndex(sal_Int32 _nIndex) throw(starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException);
// starcontainer::XIndexReplace
virtual void SAL_CALL replaceByIndex(sal_Int32 _nIndex, const staruno::Any& _rElement) throw(starlang::IllegalArgumentException, starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException);
// starcontainer::XIndexContainer
virtual void SAL_CALL insertByIndex(sal_Int32 _nIndex, const staruno::Any& Element) throw(starlang::IllegalArgumentException, starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException);
virtual void SAL_CALL removeByIndex(sal_Int32 _nIndex) throw(starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException);
// starcontainer::XContainer
virtual void SAL_CALL addContainerListener(const staruno::Reference<starcontainer::XContainerListener>& _rxListener) throw(staruno::RuntimeException);
virtual void SAL_CALL removeContainerListener(const staruno::Reference<starcontainer::XContainerListener>& _rxListener) throw(staruno::RuntimeException);
// starscript::XEventAttacherManager
virtual void SAL_CALL registerScriptEvent( sal_Int32 nIndex, const starscript::ScriptEventDescriptor& aScriptEvent ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL registerScriptEvents( sal_Int32 nIndex, const staruno::Sequence< starscript::ScriptEventDescriptor >& aScriptEvents ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL revokeScriptEvents( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL insertEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL removeEntry( sal_Int32 nIndex ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual staruno::Sequence< starscript::ScriptEventDescriptor > SAL_CALL getScriptEvents( sal_Int32 Index ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL attach( sal_Int32 nIndex, const staruno::Reference< staruno::XInterface >& xObject, const staruno::Any& aHelper ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::ServiceNotRegisteredException, staruno::RuntimeException);
virtual void SAL_CALL detach( sal_Int32 nIndex, const staruno::Reference< staruno::XInterface >& xObject ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL addScriptListener( const staruno::Reference< starscript::XScriptListener >& xListener ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual void SAL_CALL removeScriptListener( const staruno::Reference< starscript::XScriptListener >& Listener ) throw(::com::sun::star::lang::IllegalArgumentException, staruno::RuntimeException);
virtual staruno::Sequence< staruno::Type > SAL_CALL getTypes( ) throw(staruno::RuntimeException);
protected:
// helper
virtual void SAL_CALL disposing();
virtual void insert(sal_Int32 _nIndex, const InterfaceRef& _Object, sal_Bool bEvents = sal_True)
throw(starlang::IllegalArgumentException);
virtual void removeElementsNoEvents(sal_Int32 nIndex);
// called after the object is inserted, but before the "real listeners" are notified
virtual void implInserted(const InterfaceRef& _rxObject) { }
// called after the object is removed, but before the "real listeners" are notified
virtual void implRemoved(const InterfaceRef& _rxObject) { }
void SAL_CALL writeEvents(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream);
void SAL_CALL readEvents(const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32 nCount);
};
//==================================================================
//= OFormComponents
//==================================================================
typedef ::cppu::OComponentHelper FormComponentsBase;
// else MSVC kills itself on some statements
class OFormComponents : public FormComponentsBase,
public OInterfaceContainer,
public starform::XFormComponent
{
protected:
::osl::Mutex m_aMutex;
::utl::InterfaceRef m_xParent;
public:
OFormComponents(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory);
virtual ~OFormComponents();
DECLARE_UNO3_AGG_DEFAULTS(OFormComponents, FormComponentsBase);
virtual staruno::Any SAL_CALL queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException);
virtual staruno::Sequence< staruno::Type > SAL_CALL getTypes( ) throw(staruno::RuntimeException);
// OComponentHelper
virtual void SAL_CALL disposing();
// starform::XFormComponent
virtual ::utl::InterfaceRef SAL_CALL getParent() throw(staruno::RuntimeException);
virtual void SAL_CALL setParent(const ::utl::InterfaceRef& Parent) throw(starlang::NoSupportException, staruno::RuntimeException);
};
//.........................................................................
} // namespace frm
//.........................................................................
#endif // _FRM_INTERFACE_CONTAINER_HXX_

View File

@@ -0,0 +1,92 @@
/*************************************************************************
*
* $RCSfile: frm_resource.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_RESOURCE_HRC_
#define _FRM_RESOURCE_HRC_
#ifndef _SOLAR_HRC
#include <svtools/solar.hrc>
#endif
//------------------------------------------------------------------------------
#define RID_FRM_STRINGS_START RID_FORMLAYER_START
//------------------------------------------------------------------------------
//- String-IDs
#define RID_BASELISTBOX_ERROR_FILLLIST ( RID_FRM_STRINGS_START + 0 )
#define RID_STR_IMPORT_GRAPHIC ( RID_FRM_STRINGS_START + 1 )
#define RID_STR_CONTROL_SUBSTITUTED_NAME ( RID_FRM_STRINGS_START + 2 )
#define RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN ( RID_FRM_STRINGS_START + 3 )
#define RID_STR_READERROR ( RID_FRM_STRINGS_START + 4 )
#define RID_STR_CONNECTERROR ( RID_FRM_STRINGS_START + 5 )
#define RID_ERR_LOADING_FORM ( RID_FRM_STRINGS_START + 6 )
#define RID_ERR_REFRESHING_FORM ( RID_FRM_STRINGS_START + 7 )
#define RID_STR_ERR_INSERTRECORD ( RID_FRM_STRINGS_START + 8 )
#define RID_STR_ERR_UPDATERECORD ( RID_FRM_STRINGS_START + 9 )
#define RID_STR_ERR_DELETERECORD ( RID_FRM_STRINGS_START + 10 )
#define RID_STR_ERR_DELETERECORDS ( RID_FRM_STRINGS_START + 11 )
#endif // _FRM_RESOURCE_HRC_

View File

@@ -0,0 +1,113 @@
/*************************************************************************
*
* $RCSfile: frm_resource.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_RESOURCE_HXX_
#define _FRM_RESOURCE_HXX_
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
class SimpleResMgr;
//.........................................................................
namespace frm
{
#define FRM_RES_STRING(id) ResourceManager::loadString(id)
//==================================================================
//= ResourceManager
//= handling ressources within the FormLayer library
//==================================================================
class ResourceManager
{
static SimpleResMgr* m_pImpl;
private:
// no instantiation allowed
ResourceManager() { }
~ResourceManager() { }
// we'll instantiate one static member of the following class, which, in it's dtor,
// ensures that m_pImpl will be deleted
class EnsureDelete
{
public:
EnsureDelete() { }
~EnsureDelete();
};
friend class EnsureDelete;
protected:
static void ensureImplExists();
public:
/** loads the string with the specified resource id from the FormLayer resource file
*/
static ::rtl::OUString loadString(sal_uInt16 _nResId);
};
//.........................................................................
}
//.........................................................................
#endif // _FRM_RESOURCE_HXX_

72
forms/source/inc/ids.hxx Normal file
View File

@@ -0,0 +1,72 @@
/*************************************************************************
*
* $RCSfile: ids.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_IDS_HXX_
#define _FRM_IDS_HXX_
#ifndef _UNOTOOLS_ID_HELPER_HXX_
#include <unotools/idhelper.hxx>
#endif
DECLARE_IMPLEMENTATIONID_HELPER(frm, OImplementationIds)
#endif // _FRM_IDS_HXX_

View File

@@ -0,0 +1,422 @@
/*************************************************************************
*
* $RCSfile: property.hrc,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_PROPERTY_HRC_
#define _FRM_PROPERTY_HRC_
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _FRM_STRINGS_HXX_
#include "strings.hxx"
#endif
//.........................................................................
namespace frm
{
//.........................................................................
// PropertyId's, welche eine Zuordnung zu einen PropertyName haben
#define PROPERTY_ID_START 0
#define PROPERTY_ID_NAME (PROPERTY_ID_START + 1)
#define PROPERTY_ID_TABINDEX (PROPERTY_ID_START + 2)
#define PROPERTY_ID_CONTROLSOURCE (PROPERTY_ID_START + 3)
#define PROPERTY_ID_MASTERFIELDS (PROPERTY_ID_START + 4)
#define PROPERTY_ID_DATASOURCE (PROPERTY_ID_START + 6)
#define PROPERTY_ID_CLASSID (PROPERTY_ID_START + 9)
#define PROPERTY_ID_CURSORTYPE (PROPERTY_ID_START + 10)
#define PROPERTY_ID_READONLY (PROPERTY_ID_START + 11)
#define PROPERTY_ID_NAVIGATION (PROPERTY_ID_START + 13)
#define PROPERTY_ID_CYCLE (PROPERTY_ID_START + 14)
#define PROPERTY_ID_ALLOWADDITIONS (PROPERTY_ID_START + 15)
#define PROPERTY_ID_ALLOWEDITS (PROPERTY_ID_START + 16)
#define PROPERTY_ID_ALLOWDELETIONS (PROPERTY_ID_START + 17)
#define PROPERTY_ID_CACHESIZE (PROPERTY_ID_START + 19)
#define PROPERTY_ID_LASTDIRTY (PROPERTY_ID_START + 24)
#define PROPERTY_ID_VALUE (PROPERTY_ID_START + 31) // INT32
#define PROPERTY_ID_FORMATKEY (PROPERTY_ID_START + 33) // UINT32
#define PROPERTY_ID_SIZE (PROPERTY_ID_START + 37) // UINT32
#define PROPERTY_ID_HEIGHT (PROPERTY_ID_START + 41) // UINT16
#define PROPERTY_ID_WIDTH (PROPERTY_ID_START + 42) // UINT16
#define PROPERTY_ID_DEFAULTCONTROL (PROPERTY_ID_START + 43) // string
#define PROPERTY_ID_BOUNDCOLUMN (PROPERTY_ID_START + 44) // UINT16 may be null
#define PROPERTY_ID_LISTSOURCETYPE (PROPERTY_ID_START + 45) // UINT16
#define PROPERTY_ID_LISTSOURCE (PROPERTY_ID_START + 46) // string
#define PROPERTY_ID_LISTINDEX (PROPERTY_ID_START + 47) // UINT32
#define PROPERTY_ID_TEXT (PROPERTY_ID_START + 48) // string
#define PROPERTY_ID_STRINGITEMLIST (PROPERTY_ID_START + 49) // wsstringsequence
#define PROPERTY_ID_LABEL (PROPERTY_ID_START + 50) // string
#define PROPERTY_ID_STATE (PROPERTY_ID_START + 52) // UINT16
#define PROPERTY_ID_GROUPBOX (PROPERTY_ID_START + 53) // string
#define PROPERTY_ID_FONT (PROPERTY_ID_START + 54) // font
#define PROPERTY_ID_HASNAVIGATION (PROPERTY_ID_START + 55)
#define PROPERTY_ID_ROWHEIGHT (PROPERTY_ID_START + 57) // UINT16
#define PROPERTY_ID_BACKGROUNDCOLOR (PROPERTY_ID_START + 58) // UINT32
#define PROPERTY_ID_FILLCOLOR (PROPERTY_ID_START + 59) // UINT32
#define PROPERTY_ID_TEXTCOLOR (PROPERTY_ID_START + 60) // UINT32
#define PROPERTY_ID_LINECOLOR (PROPERTY_ID_START + 61) // UINT32
#define PROPERTY_ID_BORDER (PROPERTY_ID_START + 62) // UINT16
#define PROPERTY_ID_ALIGN (PROPERTY_ID_START + 63) // UINT16
#define PROPERTY_ID_DROPDOWN (PROPERTY_ID_START + 64) // BOOL
#define PROPERTY_ID_MULTI (PROPERTY_ID_START + 65) // BOOL
#define PROPERTY_ID_HSCROLL (PROPERTY_ID_START + 66) // BOOL
#define PROPERTY_ID_VSCROLL (PROPERTY_ID_START + 67) // BOOL
#define PROPERTY_ID_TABSTOP (PROPERTY_ID_START + 68) // BOOL
#define PROPERTY_ID_REFVALUE (PROPERTY_ID_START + 69) // ::rtl::OUString
#define PROPERTY_ID_BUTTONTYPE (PROPERTY_ID_START + 70) // UINT16
#define PROPERTY_ID_DEFAULT_TEXT (PROPERTY_ID_START + 71) // ::rtl::OUString
#define PROPERTY_ID_SUBMIT_ACTION (PROPERTY_ID_START + 72) // string
#define PROPERTY_ID_SUBMIT_METHOD (PROPERTY_ID_START + 73) // FmSubmitMethod
#define PROPERTY_ID_SUBMIT_ENCODING (PROPERTY_ID_START + 74) // FmSubmitEncoding
#define PROPERTY_ID_DEFAULT_VALUE (PROPERTY_ID_START + 75) // ::rtl::OUString
#define PROPERTY_ID_SUBMIT_TARGET (PROPERTY_ID_START + 76) // ::rtl::OUString
#define PROPERTY_ID_DEFAULTCHECKED (PROPERTY_ID_START + 77) // UINT16
#define PROPERTY_ID_VALUE_SEQ (PROPERTY_ID_START + 78) // StringSeq
#define PROPERTY_ID_IMAGE_URL (PROPERTY_ID_START + 79) // ::rtl::OUString
#define PROPERTY_ID_SELECT_SEQ (PROPERTY_ID_START + 91) // INT16Seq
#define PROPERTY_ID_DEFAULT_SELECT_SEQ (PROPERTY_ID_START + 92) // INT16Seq
#define PROPERTY_ID_MULTISELECTION (PROPERTY_ID_START + 93) // BOOL
#define PROPERTY_ID_MULTILINE (PROPERTY_ID_START + 94) // BOOL
#define PROPERTY_ID_DATE (PROPERTY_ID_START + 95) // UINT32
#define PROPERTY_ID_DATEMIN (PROPERTY_ID_START + 96) // UINT32
#define PROPERTY_ID_DATEMAX (PROPERTY_ID_START + 97) // UINT32
#define PROPERTY_ID_DATEFORMAT (PROPERTY_ID_START + 98) // UINT16
#define PROPERTY_ID_TIME (PROPERTY_ID_START + 99) // UINT32
#define PROPERTY_ID_TIMEMIN (PROPERTY_ID_START +100) // UINT32
#define PROPERTY_ID_TIMEMAX (PROPERTY_ID_START +101) // UINT32
#define PROPERTY_ID_TIMEFORMAT (PROPERTY_ID_START +102) // UINT16
#define PROPERTY_ID_VALUEMIN (PROPERTY_ID_START +103) // INT32
#define PROPERTY_ID_VALUEMAX (PROPERTY_ID_START +104) // INT32
#define PROPERTY_ID_VALUESTEP (PROPERTY_ID_START +105) // INT32
#define PROPERTY_ID_CURRENCYSYMBOL (PROPERTY_ID_START +106) // ::rtl::OUString
#define PROPERTY_ID_EDITMASK (PROPERTY_ID_START +107) // ::rtl::OUString
#define PROPERTY_ID_LITERALMASK (PROPERTY_ID_START +108) // ::rtl::OUString
#define PROPERTY_ID_ENABLED (PROPERTY_ID_START +109) // BOOL
#define PROPERTY_ID_AUTOCOMPLETE (PROPERTY_ID_START +110) // BOOL
#define PROPERTY_ID_LINECOUNT (PROPERTY_ID_START +111) // UINT16
#define PROPERTY_ID_MAXTEXTLEN (PROPERTY_ID_START +112) // UINT16
#define PROPERTY_ID_SPIN (PROPERTY_ID_START +113) // BOOL
#define PROPERTY_ID_STRICTFORMAT (PROPERTY_ID_START +114) // BOOL
#define PROPERTY_ID_SHOWTHOUSANDSEP (PROPERTY_ID_START +115) // BOOL
#define PROPERTY_ID_HARDLINEBREAKS (PROPERTY_ID_START +116) // BOOL
#define PROPERTY_ID_PRINTABLE (PROPERTY_ID_START +117) // BOOL
#define PROPERTY_ID_TARGET_URL (PROPERTY_ID_START +118) // ::rtl::OUString
#define PROPERTY_ID_TARGET_FRAME (PROPERTY_ID_START +119) // ::rtl::OUString
#define PROPERTY_ID_TAG (PROPERTY_ID_START +120) // ::rtl::OUString
#define PROPERTY_ID_ECHO_CHAR (PROPERTY_ID_START +121) // UINT16
#define PROPERTY_ID_EMPTY_IS_NULL (PROPERTY_ID_START +126) // Bool
#define PROPERTY_ID_DECIMAL_ACCURACY (PROPERTY_ID_START +127) // UINT16
#define PROPERTY_ID_DATE_SHOW_CENTURY (PROPERTY_ID_START +128) // Bool
#define PROPERTY_ID_TRISTATE (PROPERTY_ID_START +129) // Bool
#define PROPERTY_ID_DEFAULT_BUTTON (PROPERTY_ID_START +130) // Bool
#define PROPERTY_ID_HIDDEN_VALUE (PROPERTY_ID_START +131) // ::rtl::OUString
#define PROPERTY_ID_DECIMALS (PROPERTY_ID_START +132) // UINT16
#define PROPERTY_ID_AUTOINCREMENT (PROPERTY_ID_START +133) // UINT16
#define PROPERTY_ID_FILTER_CRITERIA (PROPERTY_ID_START +135) // ::rtl::OUString
#define PROPERTY_ID_QUERY (PROPERTY_ID_START +137) // ::rtl::OUString
#define PROPERTY_ID_DEFAULT_LONG_VALUE (PROPERTY_ID_START +138) // Double
#define PROPERTY_ID_DEFAULT_DATE (PROPERTY_ID_START +139) // UINT32
#define PROPERTY_ID_DEFAULT_TIME (PROPERTY_ID_START +140)
#define PROPERTY_ID_HELPTEXT (PROPERTY_ID_START +141)
#define PROPERTY_ID_FONT_NAME (PROPERTY_ID_START +142)
#define PROPERTY_ID_FONT_STYLENAME (PROPERTY_ID_START +143)
#define PROPERTY_ID_FONT_FAMILY (PROPERTY_ID_START +144)
#define PROPERTY_ID_FONT_CHARSET (PROPERTY_ID_START +145)
#define PROPERTY_ID_FONT_HEIGHT (PROPERTY_ID_START +146)
#define PROPERTY_ID_FONT_WEIGHT (PROPERTY_ID_START +147)
#define PROPERTY_ID_FONT_SLANT (PROPERTY_ID_START +148)
#define PROPERTY_ID_FONT_UNDERLINE (PROPERTY_ID_START +149)
#define PROPERTY_ID_FONT_STRIKEOUT (PROPERTY_ID_START +150)
#define PROPERTY_ID_ISPASSTHROUGH (PROPERTY_ID_START +151)
#define PROPERTY_ID_HELPURL (PROPERTY_ID_START +152) // ::rtl::OUString
#define PROPERTY_ID_RECORDMARKER (PROPERTY_ID_START +153)
#define PROPERTY_ID_BOUNDFIELD (PROPERTY_ID_START +154)
#define PROPERTY_ID_FORMATSSUPPLIER (PROPERTY_ID_START +155) // XNumberFormatsSupplier
#define PROPERTY_ID_TREATASNUMERIC (PROPERTY_ID_START +156) // BOOL
#define PROPERTY_ID_EFFECTIVE_VALUE (PROPERTY_ID_START +157) // ANY (string or double)
#define PROPERTY_ID_EFFECTIVE_DEFAULT (PROPERTY_ID_START +158) // dito
#define PROPERTY_ID_EFFECTIVE_MIN (PROPERTY_ID_START +159) // dito
#define PROPERTY_ID_EFFECTIVE_MAX (PROPERTY_ID_START +160) // dito
#define PROPERTY_ID_HIDDEN (PROPERTY_ID_START +161) // BOOL
#define PROPERTY_ID_FILTERPROPOSAL (PROPERTY_ID_START +162) // BOOL
#define PROPERTY_ID_FIELDSOURCE (PROPERTY_ID_START +163) // String
#define PROPERTY_ID_TABLENAME (PROPERTY_ID_START +164) // String
#define PROPERTY_ID_FILTERSUPPLIER (PROPERTY_ID_START +165) // XIndexAccess
#define PROPERTY_ID_CURRENTFILTER (PROPERTY_ID_START +166) // INT32
#define PROPERTY_ID_SELECTED_FIELDS (PROPERTY_ID_START +167)
#define PROPERTY_ID_SELECTED_TABLES (PROPERTY_ID_START +168)
#define PROPERTY_ID_THREADSAFE (PROPERTY_ID_START +169) // BOOL
#define PROPERTY_ID_CONTROLLABEL (PROPERTY_ID_START +171) // XPropertySet
#define PROPERTY_ID_CURRSYM_POSITION (PROPERTY_ID_START +172) // String
#define PROPERTY_ID_SOURCE (PROPERTY_ID_START +173) // XInterface
#define PROPERTY_ID_CURSORCOLOR (PROPERTY_ID_START +174) // INT32
#define PROPERTY_ID_ALWAYSSHOWCURSOR (PROPERTY_ID_START +175) // BOOL
#define PROPERTY_ID_DISPLAYSYNCHRON (PROPERTY_ID_START +176) // BOOL
#define PROPERTY_ID_ISMODIFIED (PROPERTY_ID_START +177) // BOOL
#define PROPERTY_ID_ISNEW (PROPERTY_ID_START +178) // BOOL
#define PROPERTY_ID_PRIVILEGES (PROPERTY_ID_START +179) // INT32
#define PROPERTY_ID_DETAILFIELDS (PROPERTY_ID_START +180) // Sequence< ::rtl::OUString >
#define PROPERTY_ID_COMMAND (PROPERTY_ID_START +181) // String
#define PROPERTY_ID_COMMANDTYPE (PROPERTY_ID_START +182) // INT32 (com::sun::star::sdb::CommandType)
#define PROPERTY_ID_RESULTSET_CONCURRENCY (PROPERTY_ID_START +183)// INT32 (com::sun::star::sdbc::ResultSetConcurrency)
#define PROPERTY_ID_INSERTONLY (PROPERTY_ID_START +184) // BOOL
#define PROPERTY_ID_RESULTSET_TYPE (PROPERTY_ID_START +185) // INT32 (com::sun::star::sdbc::ResultSetType)
#define PROPERTY_ID_ESCAPE_PROCESSING (PROPERTY_ID_START +186) // BOOL
#define PROPERTY_ID_APPLYFILTER (PROPERTY_ID_START +187) // BOOL
#define PROPERTY_ID_ISNULLABLE (PROPERTY_ID_START +188) // BOOL
#define PROPERTY_ID_ACTIVECOMMAND (PROPERTY_ID_START +189) // String
#define PROPERTY_ID_ISCURRENCY (PROPERTY_ID_START +190) // BOOL
#define PROPERTY_ID_NUMBER_FORMATS_SUPPLIER (PROPERTY_ID_START +191)// BOOL
#define PROPERTY_ID_URL (PROPERTY_ID_START +192) // String
#define PROPERTY_ID_TITLE (PROPERTY_ID_START +193) // String
#define PROPERTY_ID_ACTIVE_CONNECTION (PROPERTY_ID_START +194) // com::sun::star::sdbc::XConnection
#define PROPERTY_ID_SCALE (PROPERTY_ID_START +195) // INT32
#define PROPERTY_ID_SORT (PROPERTY_ID_START +196) // String
#define PROPERTY_ID_ROWCOUNT (PROPERTY_ID_START +197)
#define PROPERTY_ID_ROWCOUNTFINAL (PROPERTY_ID_START +198)
#define PROPERTY_ID_FETCHSIZE (PROPERTY_ID_START +199)
#define PROPERTY_ID_STATEMENT (PROPERTY_ID_START +200)
#define PROPERTY_ID_SEARCHABLE (PROPERTY_ID_START +201)
#define PROPERTY_ID_ISREADONLY (PROPERTY_ID_START +202)
#define PROPERTY_ID_ISREQUIRED (PROPERTY_ID_START +203)
#define PROPERTY_ID_FIELDTYPE (PROPERTY_ID_START +204)
#define PROPERTY_ID_COLUMNSERVICENAME (PROPERTY_ID_START +205)
#define PROPERTY_ID_CONTROLSOURCEPROPERTY (PROPERTY_ID_START +206)
#define PROPERTY_ID_REALNAME (PROPERTY_ID_START +207)
// start ID fuer aggregierte Properties
#define PROPERTY_ID_AGGREGATE_ID (PROPERTY_ID_START + 10000)
// extern declaration fuer vordefinierte Strings, laengst nicht vollstaendig
DECLARE_CONSTASCII_USTRING(PROPERTY_NAME);
DECLARE_CONSTASCII_USTRING(PROPERTY_TAG);
DECLARE_CONSTASCII_USTRING(PROPERTY_TABINDEX);
DECLARE_CONSTASCII_USTRING(PROPERTY_CLASSID);
DECLARE_CONSTASCII_USTRING(PROPERTY_ALIGN);
DECLARE_CONSTASCII_USTRING(PROPERTY_ROWCOUNT);
DECLARE_CONSTASCII_USTRING(PROPERTY_ROWCOUNTFINAL);
DECLARE_CONSTASCII_USTRING(PROPERTY_FETCHSIZE);
DECLARE_CONSTASCII_USTRING(PROPERTY_VALUE);
DECLARE_CONSTASCII_USTRING(PROPERTY_VALUEMIN);
DECLARE_CONSTASCII_USTRING(PROPERTY_VALUEMAX);
DECLARE_CONSTASCII_USTRING(PROPERTY_VALUESTEP);
DECLARE_CONSTASCII_USTRING(PROPERTY_TEXT);
DECLARE_CONSTASCII_USTRING(PROPERTY_LABEL);
DECLARE_CONSTASCII_USTRING(PROPERTY_NAVIGATION);
DECLARE_CONSTASCII_USTRING(PROPERTY_CYCLE);
DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCE);
DECLARE_CONSTASCII_USTRING(PROPERTY_ENABLED);
DECLARE_CONSTASCII_USTRING(PROPERTY_SPIN);
DECLARE_CONSTASCII_USTRING(PROPERTY_READONLY);
DECLARE_CONSTASCII_USTRING(PROPERTY_FILTER_CRITERIA);
DECLARE_CONSTASCII_USTRING(PROPERTY_AUTOINCREMENT);
DECLARE_CONSTASCII_USTRING(PROPERTY_CACHESIZE);
DECLARE_CONSTASCII_USTRING(PROPERTY_LASTDIRTY);
DECLARE_CONSTASCII_USTRING(PROPERTY_STATEMENT);
DECLARE_CONSTASCII_USTRING(PROPERTY_WIDTH);
DECLARE_CONSTASCII_USTRING(PROPERTY_SEARCHABLE);
DECLARE_CONSTASCII_USTRING(PROPERTY_MULTILINE);
DECLARE_CONSTASCII_USTRING(PROPERTY_TARGET_URL);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL);
DECLARE_CONSTASCII_USTRING(PROPERTY_MAXTEXTLEN);
DECLARE_CONSTASCII_USTRING(PROPERTY_SIZE);
DECLARE_CONSTASCII_USTRING(PROPERTY_DATE);
DECLARE_CONSTASCII_USTRING(PROPERTY_TIME);
DECLARE_CONSTASCII_USTRING(PROPERTY_STATE);
DECLARE_CONSTASCII_USTRING(PROPERTY_TRISTATE);
DECLARE_CONSTASCII_USTRING(PROPERTY_HIDDEN_VALUE);
DECLARE_CONSTASCII_USTRING(PROPERTY_TARGET_FRAME);
DECLARE_CONSTASCII_USTRING(PROPERTY_BUTTONTYPE);
DECLARE_CONSTASCII_USTRING(PROPERTY_STRINGITEMLIST);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_TEXT);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULTCHECKED);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_DATE);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_TIME);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_VALUE);
DECLARE_CONSTASCII_USTRING(PROPERTY_FORMATKEY);
DECLARE_CONSTASCII_USTRING(PROPERTY_FORMATSSUPPLIER);
DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_ACTION);
DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_TARGET);
DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_METHOD);
DECLARE_CONSTASCII_USTRING(PROPERTY_SUBMIT_ENCODING);
DECLARE_CONSTASCII_USTRING(PROPERTY_IMAGE_URL);
DECLARE_CONSTASCII_USTRING(PROPERTY_EMPTY_IS_NULL);
DECLARE_CONSTASCII_USTRING(PROPERTY_LISTSOURCETYPE);
DECLARE_CONSTASCII_USTRING(PROPERTY_LISTSOURCE);
DECLARE_CONSTASCII_USTRING(PROPERTY_SELECT_SEQ);
DECLARE_CONSTASCII_USTRING(PROPERTY_VALUE_SEQ);
DECLARE_CONSTASCII_USTRING(PROPERTY_DEFAULT_SELECT_SEQ);
DECLARE_CONSTASCII_USTRING(PROPERTY_MULTISELECTION);
DECLARE_CONSTASCII_USTRING(PROPERTY_DECIMAL_ACCURACY);
DECLARE_CONSTASCII_USTRING(PROPERTY_EDITMASK);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISREADONLY);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISREQUIRED);
DECLARE_CONSTASCII_USTRING(PROPERTY_FIELDTYPE);
DECLARE_CONSTASCII_USTRING(PROPERTY_DECIMALS);
DECLARE_CONSTASCII_USTRING(PROPERTY_REFVALUE);
DECLARE_CONSTASCII_USTRING(PROPERTY_STRICTFORMAT);
DECLARE_CONSTASCII_USTRING(PROPERTY_DATASOURCE);
DECLARE_CONSTASCII_USTRING(PROPERTY_ALLOWADDITIONS);
DECLARE_CONSTASCII_USTRING(PROPERTY_ALLOWEDITS);
DECLARE_CONSTASCII_USTRING(PROPERTY_ALLOWDELETIONS);
DECLARE_CONSTASCII_USTRING(PROPERTY_MASTERFIELDS);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISPASSTHROUGH);
DECLARE_CONSTASCII_USTRING(PROPERTY_QUERY);
DECLARE_CONSTASCII_USTRING(PROPERTY_LITERALMASK);
DECLARE_CONSTASCII_USTRING(PROPERTY_SHOWTHOUSANDSEP);
DECLARE_CONSTASCII_USTRING(PROPERTY_CURRENCYSYMBOL);
DECLARE_CONSTASCII_USTRING(PROPERTY_DATEFORMAT);
DECLARE_CONSTASCII_USTRING(PROPERTY_DATEMIN);
DECLARE_CONSTASCII_USTRING(PROPERTY_DATEMAX);
DECLARE_CONSTASCII_USTRING(PROPERTY_DATE_SHOW_CENTURY);
DECLARE_CONSTASCII_USTRING(PROPERTY_TIMEFORMAT);
DECLARE_CONSTASCII_USTRING(PROPERTY_TIMEMIN);
DECLARE_CONSTASCII_USTRING(PROPERTY_TIMEMAX);
DECLARE_CONSTASCII_USTRING(PROPERTY_LINECOUNT);
DECLARE_CONSTASCII_USTRING(PROPERTY_BOUNDCOLUMN);
DECLARE_CONSTASCII_USTRING(PROPERTY_HASNAVIGATION);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT);
DECLARE_CONSTASCII_USTRING(PROPERTY_BACKGROUNDCOLOR);
DECLARE_CONSTASCII_USTRING(PROPERTY_FILLCOLOR);
DECLARE_CONSTASCII_USTRING(PROPERTY_TEXTCOLOR);
DECLARE_CONSTASCII_USTRING(PROPERTY_LINECOLOR);
DECLARE_CONSTASCII_USTRING(PROPERTY_BORDER);
DECLARE_CONSTASCII_USTRING(PROPERTY_DROPDOWN);
DECLARE_CONSTASCII_USTRING(PROPERTY_MULTI);
DECLARE_CONSTASCII_USTRING(PROPERTY_HSCROLL);
DECLARE_CONSTASCII_USTRING(PROPERTY_VSCROLL);
DECLARE_CONSTASCII_USTRING(PROPERTY_TABSTOP);
DECLARE_CONSTASCII_USTRING(PROPERTY_AUTOCOMPLETE);
DECLARE_CONSTASCII_USTRING(PROPERTY_HARDLINEBREAKS);
DECLARE_CONSTASCII_USTRING(PROPERTY_PRINTABLE);
DECLARE_CONSTASCII_USTRING(PROPERTY_ECHO_CHAR);
DECLARE_CONSTASCII_USTRING(PROPERTY_ROWHEIGHT);
DECLARE_CONSTASCII_USTRING(PROPERTY_HELPTEXT);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_NAME);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_STYLENAME);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_FAMILY);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_CHARSET);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_HEIGHT);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_WEIGHT);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_SLANT);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_UNDERLINE);
DECLARE_CONSTASCII_USTRING(PROPERTY_FONT_STRIKEOUT);
DECLARE_CONSTASCII_USTRING(PROPERTY_HELPURL);
DECLARE_CONSTASCII_USTRING(PROPERTY_RECORDMARKER);
DECLARE_CONSTASCII_USTRING(PROPERTY_BOUNDFIELD);
DECLARE_CONSTASCII_USTRING(PROPERTY_TREATASNUMERIC);
DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_VALUE);
DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_DEFAULT);
DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MIN);
DECLARE_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MAX);
DECLARE_CONSTASCII_USTRING(PROPERTY_HIDDEN);
DECLARE_CONSTASCII_USTRING(PROPERTY_FILTERPROPOSAL);
DECLARE_CONSTASCII_USTRING(PROPERTY_FIELDSOURCE);
DECLARE_CONSTASCII_USTRING(PROPERTY_TABLENAME);
DECLARE_CONSTASCII_USTRING(PROPERTY_FILTERSUPPLIER);
DECLARE_CONSTASCII_USTRING(PROPERTY_CURRENTFILTER);
DECLARE_CONSTASCII_USTRING(PROPERTY_SELECTED_FIELDS);
DECLARE_CONSTASCII_USTRING(PROPERTY_SELECTED_TABLES);
DECLARE_CONSTASCII_USTRING(PROPERTY_THREADSAFE);
DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLLABEL);
DECLARE_CONSTASCII_USTRING(PROPERTY_CURRSYM_POSITION);
DECLARE_CONSTASCII_USTRING(PROPERTY_SOURCE);
DECLARE_CONSTASCII_USTRING(PROPERTY_CURSORCOLOR);
DECLARE_CONSTASCII_USTRING(PROPERTY_ALWAYSSHOWCURSOR);
DECLARE_CONSTASCII_USTRING(PROPERTY_DISPLAYSYNCHRON);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISMODIFIED);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISNEW);
DECLARE_CONSTASCII_USTRING(PROPERTY_PRIVILEGES);
DECLARE_CONSTASCII_USTRING(PROPERTY_DETAILFIELDS);
DECLARE_CONSTASCII_USTRING(PROPERTY_COMMAND);
DECLARE_CONSTASCII_USTRING(PROPERTY_COMMANDTYPE);
DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSET_CONCURRENCY);
DECLARE_CONSTASCII_USTRING(PROPERTY_INSERTONLY);
DECLARE_CONSTASCII_USTRING(PROPERTY_RESULTSET_TYPE);
DECLARE_CONSTASCII_USTRING(PROPERTY_ESCAPE_PROCESSING);
DECLARE_CONSTASCII_USTRING(PROPERTY_APPLYFILTER);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISNULLABLE);
DECLARE_CONSTASCII_USTRING(PROPERTY_ACTIVECOMMAND);
DECLARE_CONSTASCII_USTRING(PROPERTY_ISCURRENCY);
DECLARE_CONSTASCII_USTRING(PROPERTY_NUMBER_FORMATS_SUPPLIER);
DECLARE_CONSTASCII_USTRING(PROPERTY_URL);
DECLARE_CONSTASCII_USTRING(PROPERTY_TITLE);
DECLARE_CONSTASCII_USTRING(PROPERTY_ACTIVE_CONNECTION);
DECLARE_CONSTASCII_USTRING(PROPERTY_SCALE);
DECLARE_CONSTASCII_USTRING(PROPERTY_SORT);
DECLARE_CONSTASCII_USTRING(PROPERTY_COLUMNSERVICENAME);
DECLARE_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCEPROPERTY);
DECLARE_CONSTASCII_USTRING(PROPERTY_REALNAME);
//.........................................................................
}
//.........................................................................
#endif // _FRM_PROPERTY_HRC_

View File

@@ -0,0 +1,261 @@
/*************************************************************************
*
* $RCSfile: property.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_PROPERTY_HXX_
#define _FRM_PROPERTY_HXX_
#ifndef _COM_SUN_STAR_UNO_XAGGREGATION_HPP_
#include <com/sun/star/uno/XAggregation.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
#include <com/sun/star/beans/XPropertyState.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
#include <com/sun/star/beans/PropertyAttribute.hpp>
#endif
#ifndef _CPPUHELPER_PROPSHLP_HXX
#include <cppuhelper/propshlp.hxx>
#endif
#ifndef _CPPUHELPER_PROPTYPEHLP_HXX
#include <cppuhelper/proptypehlp.hxx>
#endif
#ifndef _UTL_PROPERTY_HXX_
#include <unotools/property.hxx>
#endif
#ifndef _UNOTOOLS_PROPERTY_AGGREGATION_HXX_
#include <unotools/propagg.hxx>
#endif
#ifndef _UTL_STLTYPES_HXX_
#include <unotools/stl_types.hxx>
#endif
using namespace utl;
//=========================================================================
//= property helper classes
//=========================================================================
//... namespace frm .......................................................
namespace frm
{
//.........................................................................
//==================================================================
//= assigment property handle <-> property name
//= used by the PropertySetAggregationHelper
//==================================================================
class PropertyInfoService
{
//..................................................................
struct PropertyAssignment
{
::rtl::OUString sName;
sal_Int32 nHandle;
PropertyAssignment() { nHandle = -1; }
PropertyAssignment(const PropertyAssignment& _rSource)
:sName(_rSource.sName), nHandle(_rSource.nHandle) { }
PropertyAssignment(const ::rtl::OUString& _rName, sal_Int32 _nHandle)
:sName(_rName), nHandle(_nHandle) { }
};
DECLARE_STL_VECTOR(PropertyAssignment, PropertyMap);
static PropertyMap s_AllKnownProperties;
//..................................................................
// comparing two PropertyAssignment's
public:
typedef PropertyAssignment PUBLIC_SOLARIS_COMPILER_HACK;
// did not get the following compiled under with SUNPRO 5 without this
// public typedef
private:
friend struct PropertyAssignmentNameCompareLess;
typedef binary_function< PUBLIC_SOLARIS_COMPILER_HACK, PUBLIC_SOLARIS_COMPILER_HACK, sal_Bool > PropertyAssignmentNameCompareLess_Base;
struct PropertyAssignmentNameCompareLess : public PropertyAssignmentNameCompareLess_Base
{
inline sal_Bool operator() (const PUBLIC_SOLARIS_COMPILER_HACK& _rL, const PUBLIC_SOLARIS_COMPILER_HACK& _rR) const
{
return (_rL.sName.compareTo(_rR.sName) < 0);
}
};
public:
PropertyInfoService() { }
public:
static sal_Int32 getPropertyId(const ::rtl::OUString& _rName);
static ::rtl::OUString getPropertyName(sal_Int32 _nHandle);
private:
static void initialize();
};
//..................................................................
// a class implementing the utl::IPropertyInfoService
class ConcretInfoService : public ::utl::IPropertyInfoService
{
public:
virtual sal_Int32 getPreferedPropertyId(const ::rtl::OUString& _rName);
};
//------------------------------------------------------------------------------
#define DECL_PROP_IMPL(varname, type) \
pProps[nPos++] = starbeans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< type* >(NULL)),
//------------------------------------------------------------------------------
#define DECL_BOOL_PROP_IMPL(varname) \
pProps[nPos++] = starbeans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getBooleanCppuType(),
//------------------------------------------------------------------------------
#define DECL_IFACE_PROP_IMPL(varname, type) \
pProps[nPos++] = starbeans::Property(PROPERTY_##varname, PROPERTY_ID_##varname, ::getCppuType(reinterpret_cast< staruno::Reference< type >* >(NULL)),
//------------------------------------------------------------------------------
#define BEGIN_AGGREGATION_PROPERTY_HELPER(count, aggregate) \
_rProps.realloc(count); \
starbeans::Property* pProps = _rProps.getArray(); \
sal_Int32 nPos = 0; \
\
if (aggregate.is()) \
_rAggregateProps = aggregate->getPropertySetInfo()->getProperties(); \
//------------------------------------------------------------------------------
#define BEGIN_PROPERTY_ARRAY_HELPER(count) \
staruno::Sequence<starbeans::Property> aProps(count); \
starbeans::Property* pProps = aProps.getArray(); \
sal_Int32 nPos = 0; \
// ===
//------------------------------------------------------------------------------
#define DECL_PROP0(varname, type) \
DECL_PROP_IMPL(varname, type) 0)
//------------------------------------------------------------------------------
#define DECL_PROP1(varname, type, attrib1) \
DECL_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1)
//------------------------------------------------------------------------------
#define DECL_PROP2(varname, type, attrib1, attrib2) \
DECL_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2)
//------------------------------------------------------------------------------
#define DECL_PROP3(varname, type, attrib1, attrib2, attrib3) \
DECL_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3)
//------------------------------------------------------------------------------
#define DECL_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \
DECL_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3 | starbeans::PropertyAttribute::attrib4)
// === some property types require special handling
// === such as interfaces
//------------------------------------------------------------------------------
#define DECL_IFACE_PROP0(varname, type) \
DECL_IFACE_PROP_IMPL(varname, type) 0)
//------------------------------------------------------------------------------
#define DECL_IFACE_PROP1(varname, type, attrib1) \
DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1)
//------------------------------------------------------------------------------
#define DECL_IFACE_PROP2(varname, type, attrib1, attrib2) \
DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2)
//------------------------------------------------------------------------------
#define DECL_IFACE_PROP3(varname, type, attrib1, attrib2, attrib3) \
DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3)
//------------------------------------------------------------------------------
#define DECL_IFACE_PROP4(varname, type, attrib1, attrib2, attrib3, attrib4) \
DECL_IFACE_PROP_IMPL(varname, type) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2 | starbeans::PropertyAttribute::attrib3 | PropertyAttribute::attrib4)
// === or Boolean properties
//------------------------------------------------------------------------------
#define DECL_BOOL_PROP0(varname) \
DECL_BOOL_PROP_IMPL(varname) 0)
//------------------------------------------------------------------------------
#define DECL_BOOL_PROP1(varname, attrib1) \
DECL_BOOL_PROP_IMPL(varname) starbeans::PropertyAttribute::attrib1)
//------------------------------------------------------------------------------
#define DECL_BOOL_PROP2(varname, attrib1, attrib2) \
DECL_BOOL_PROP_IMPL(varname) starbeans::PropertyAttribute::attrib1 | starbeans::PropertyAttribute::attrib2)
// ===
//------------------------------------------------------------------------------
#define END_AGGREGATION_PROPERTY_HELPER() \
DBG_ASSERT(nPos == _rProps.getLength(), "<...>::getInfohelper : forgot to adjust the count ?"); \
//------------------------------------------------------------------------------
#define END_PROPERTY_ARRAY_HELPER() \
DBG_ASSERT(nPos == aProps.getLength(), "<...>::getInfohelper : forgot to adjust the count ?"); \
return new ::cppu::OPropertyArrayHelper(aProps);
//.........................................................................
}
//... namespace frm .......................................................
#endif // _FRM_PROPERTY_HXX_

View File

@@ -0,0 +1,234 @@
/*************************************************************************
*
* $RCSfile: services.hxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_SERVICES_HXX_
#define _FRM_SERVICES_HXX_
#ifndef _RTL_USTRING_HXX_
#include <rtl/ustring.hxx>
#endif
#ifndef _FRM_STRINGS_HXX_
#include "strings.hxx"
#endif
//... namespace frm .......................................................
namespace frm
{
//.........................................................................
// alle serviceNamen
DECLARE_CONSTASCII_USTRING(FRM_NUMBER_FORMATTER);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_EDIT);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_LISTBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_COMBOBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_RADIOBUTTON);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_GROUPBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_FIXEDTEXT);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_COMMANDBUTTON);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_CHECKBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_IMAGEBUTTON);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_FILECONTROL);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_DATEFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_FORMATTEDFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROL_IMAGECONTROL);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_EDIT);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_LISTBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMBOBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_RADIOBUTTON);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_GROUPBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_FIXEDTEXT);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMMANDBUTTON);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_CHECKBOX);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGEBUTTON);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_FILECONTROL);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_DATEFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_FORMATTEDFIELD);
DECLARE_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGECONTROL);
DECLARE_CONSTASCII_USTRING(AWT_CONTROL_TEXTFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FORM);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_EDIT); // alter service name (5.0)
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_TEXTFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_LISTBOX);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_COMBOBOX);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_RADIOBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_GROUPBOX);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FIXEDTEXT);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_COMMANDBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_CHECKBOX);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_GRID); // alter service name (5.0)
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_GRIDCONTROL);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_IMAGEBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FILECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_DATEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_FORMATTEDFIELD);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_HIDDEN); // alter service name (5.0)
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_HIDDENCONTROL);
DECLARE_CONSTASCII_USTRING(FRM_COMPONENT_IMAGECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_LISTBOX);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_RADIOBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_COMBOBOX);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_GROUPBOX);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_CHECKBOX);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_FIXEDTEXT);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_COMMANDBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_GRID);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_GRIDCONTROL);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_IMAGEBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_EDIT); // alt
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_TEXTFIELD);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_DATEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_FILECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_IMAGECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_CONTROL_FORMATTEDFIELD);
DECLARE_CONSTASCII_USTRING(SRV_SDB_ROWSET);
DECLARE_CONSTASCII_USTRING(SRV_SDB_CONNECTION);
DECLARE_CONSTASCII_USTRING(SRV_SDBC_STATEMENT);
DECLARE_CONSTASCII_USTRING(SRV_SDB_DATABASE_ENVIRONMENT);
DECLARE_CONSTASCII_USTRING(SRV_SDB_DATABASE_ACCESS_CONNECTION);
DECLARE_CONSTASCII_USTRING(SRV_SDB_DATABASE_ACCESS_CONTEXT);
DECLARE_CONSTASCII_USTRING(SRV_AWT_POINTER);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORM);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HTMLFORM);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATAFORM);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TEXTFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_LISTBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMBOBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_RADIOBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GROUPBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FIXEDTEXT);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMMANDBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CHECKBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GRIDCONTROL);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_IMAGEBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FILECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HIDDENCONTROL);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_IMAGECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORMATTEDFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_TEXTFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_LISTBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMBOBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_RADIOBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_GROUPBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_FIXEDTEXT);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMMANDBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_CHECKBOX);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_GRIDCONTROL);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGEBUTTON);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_TIMEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_DATEFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_NUMERICFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_CURRENCYFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_PATTERNFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGECONTROL);
DECLARE_CONSTASCII_USTRING(FRM_SUN_CONTROL_FORMATTEDFIELD);
DECLARE_CONSTASCII_USTRING(FRM_SUN_FORMS_COLLECTION);
DECLARE_CONSTASCII_USTRING(FRM_SUN_INTERNATIONAL_INFO);
//.........................................................................
}
//... namespace frm .......................................................
#endif // _FRM_SERVICES_HXX_

View File

@@ -0,0 +1,896 @@
/*************************************************************************
*
* $RCSfile: InterfaceContainer.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_INTERFACE_CONTAINER_HXX_
#include "InterfaceContainer.hxx"
#endif
#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
#include <cppuhelper/queryinterface.hxx>
#endif
#ifndef _UNOTOOLS_EVENTATTACHERMGR_HXX_
#include <unotools/eventattachermgr.hxx>
#endif
#ifndef _UTL_TYPES_HXX_
#include <unotools/types.hxx>
#endif
#ifndef _UNOTOOLS_ENUMHELPER_HXX_
#include <unotools/enumhelper.hxx>
#endif
#ifndef _UTL_PROPERTY_HXX_
#include <unotools/property.hxx>
#endif
#ifndef _UTL_CONTAINER_HXX_
#include <unotools/container.hxx>
#endif
#ifndef _UTL_SEQUENCE_HXX_
#include <unotools/sequence.hxx>
#endif
#ifndef _FRM_PROPERTY_HRC_
#include "property.hrc"
#endif
#ifndef _FRM_SERVICES_HXX_
#include "services.hxx"
#endif
#ifndef _FRM_RESOURCE_HRC_
#include "frm_resource.hrc"
#endif
#ifndef _FRM_RESOURCE_HXX_
#include "frm_resource.hxx"
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
#ifndef _COM_SUN_STAR_LANG_XCOMPONENT_HPP_
#include <com/sun/star/lang/XComponent.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_XMARKABLESTREAM_HPP_
#include <com/sun/star/io/XMarkableStream.hpp>
#endif
#ifndef _COM_SUN_STAR_IO_WRONGFORMATEXCEPTION_HPP_
#include <com/sun/star/io/WrongFormatException.hpp>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
//.........................................................................
namespace frm
{
//.........................................................................
//------------------------------------------------------------------
OInterfaceContainer::OInterfaceContainer(
const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory,
::osl::Mutex& _rMutex,
const staruno::Type& _rElementType)
:m_rMutex(_rMutex)
,m_aContainerListeners(_rMutex)
,m_aElementType(_rElementType)
,m_xServiceFactory(_rxFactory)
{
m_xEventAttacher = ::utl::createEventAttacherManager(m_xServiceFactory);
}
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OInterfaceContainer::queryInterface(const staruno::Type& _rType) throw (staruno::RuntimeException)
{
staruno::Any aReturn =
::cppu::queryInterface(_rType
,static_cast<starcontainer::XElementAccess*>(static_cast<starcontainer::XNameAccess*>(this))
,static_cast<starcontainer::XIndexAccess*>(this)
,static_cast<starcontainer::XNameAccess*>(this)
,static_cast<starcontainer::XIndexReplace*>(this)
,static_cast<starcontainer::XNameReplace*>(this)
,static_cast<starcontainer::XIndexContainer*>(this)
,static_cast<starcontainer::XNameContainer*>(this)
,static_cast<starcontainer::XEnumerationAccess*>(this)
,static_cast<starcontainer::XContainer*>(this)
,static_cast<starlang::XEventListener*>(this)
,static_cast<starbeans::XPropertyChangeListener*>(this)
,static_cast<starscript::XEventAttacherManager*>(this)
);
if (!aReturn.hasValue())
aReturn = ::cppu::queryInterface(_rType
,static_cast<stario::XPersistObject*>(this)
);
return aReturn;
}
//------------------------------------------------------------------------------
staruno::Sequence<staruno::Type> SAL_CALL OInterfaceContainer::getTypes() throw(staruno::RuntimeException)
{
staruno::Sequence<staruno::Type> aTypes(7);
aTypes.getArray()[0] = ::getCppuType(static_cast<staruno::Reference<starcontainer::XNameContainer>*>(NULL));
aTypes.getArray()[1] = ::getCppuType(static_cast<staruno::Reference<starcontainer::XIndexContainer>*>(NULL));
aTypes.getArray()[2] = ::getCppuType(static_cast<staruno::Reference<starcontainer::XContainer>*>(NULL));
aTypes.getArray()[3] = ::getCppuType(static_cast<staruno::Reference<starcontainer::XEnumerationAccess>*>(NULL));
aTypes.getArray()[4] = ::getCppuType(static_cast<staruno::Reference<starscript::XEventAttacherManager>*>(NULL));
aTypes.getArray()[5] = ::getCppuType(static_cast<staruno::Reference<starbeans::XPropertyChangeListener>*>(NULL));
aTypes.getArray()[6] = ::getCppuType(static_cast<staruno::Reference<stario::XPersistObject>*>(NULL));
return aTypes;
}
//------------------------------------------------------------------------------
void OInterfaceContainer::disposing()
{
// dispose aller elemente
for (sal_Int32 i = m_aItems.size(); i > 0; --i)
{
staruno::Reference<starbeans::XPropertySet> xSet(m_aItems[i - 1], staruno::UNO_QUERY);
if (xSet.is())
xSet->removePropertyChangeListener(PROPERTY_NAME, this);
// Eventverkn<6B>pfungen aufheben
InterfaceRef xIfc(xSet, staruno::UNO_QUERY);
m_xEventAttacher->detach(i - 1, xIfc);
m_xEventAttacher->removeEntry(i - 1);
staruno::Reference<starlang::XComponent> xComponent(xSet, staruno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
}
m_aMap.clear();
m_aItems.clear();
starlang::EventObject aEvt(static_cast<starcontainer::XContainer*>(this));
m_aContainerListeners.disposeAndClear(aEvt);
}
// stario::XPersistObject
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::writeEvents(const staruno::Reference<stario::XObjectOutputStream>& _rxOutStream)
{
staruno::Reference<stario::XMarkableStream> xMark(_rxOutStream, staruno::UNO_QUERY);
sal_Int32 nMark = xMark->createMark();
sal_Int32 nObjLen = 0;
_rxOutStream->writeLong(nObjLen);
staruno::Reference<stario::XPersistObject> xScripts(m_xEventAttacher, staruno::UNO_QUERY);
if (xScripts.is())
xScripts->write(_rxOutStream);
// feststellen der Laenge
nObjLen = xMark->offsetToMark(nMark) - 4;
xMark->jumpToMark(nMark);
_rxOutStream->writeLong(nObjLen);
xMark->jumpToFurthest();
xMark->deleteMark(nMark);
}
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::readEvents(const staruno::Reference<stario::XObjectInputStream>& _rxInStream, sal_Int32 nCount)
{
::osl::MutexGuard aGuard( m_rMutex );
if (nCount)
{
// Scripting Info lesen
staruno::Reference<stario::XMarkableStream> xMark(_rxInStream, staruno::UNO_QUERY);
sal_Int32 nObjLen = _rxInStream->readLong();
if (nObjLen)
{
sal_Int32 nMark = xMark->createMark();
staruno::Reference<stario::XPersistObject> xObj(m_xEventAttacher, staruno::UNO_QUERY);
if (xObj.is())
xObj->read(_rxInStream);
xMark->jumpToMark(nMark);
_rxInStream->skipBytes(nObjLen);
xMark->deleteMark(nMark);
}
// Attachement lesen
for (sal_Int32 i = 0; i < nCount; i++)
{
InterfaceRef xIfc(m_aItems[i], staruno::UNO_QUERY);
staruno::Reference<starbeans::XPropertySet> xSet(xIfc, staruno::UNO_QUERY);
staruno::Any aHelper;
aHelper <<= xSet;
m_xEventAttacher->attach( i, xIfc, aHelper );
}
}
else
{
// neuen EventManager
m_xEventAttacher = ::utl::createEventAttacherManager(m_xServiceFactory);
}
}
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::write( const staruno::Reference< stario::XObjectOutputStream >& _rxOutStream ) throw(stario::IOException, staruno::RuntimeException)
{
::osl::MutexGuard aGuard( m_rMutex );
sal_Int32 nLen = m_aItems.size();
// schreiben der laenge
_rxOutStream->writeLong(nLen);
if (nLen)
{
// 1. Version
_rxOutStream->writeShort(0x0001);
// 2. Objekte
for (sal_Int32 i = 0; i < nLen; i++)
{
staruno::Reference<stario::XPersistObject> xObj(m_aItems[i], staruno::UNO_QUERY);
if (xObj.is())
_rxOutStream->writeObject(xObj);
else
{
// ::com::sun::star::chaos::Error
}
}
// 3. Scripts
writeEvents(_rxOutStream);
}
}
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::read( const staruno::Reference< stario::XObjectInputStream >& _rxInStream ) throw(stario::IOException, staruno::RuntimeException)
{
::osl::MutexGuard aGuard( m_rMutex );
// after ::read the object is expected to be in the state it was when ::write was called, so we have
// to empty ourself here
// FS - 71598 - 12.01.00
while (getCount())
removeByIndex(0);
// Schreibt nur in Abhaengigkeit der L<>nge
sal_Int32 nLen = _rxInStream->readLong();
if (nLen)
{
// 1. Version
sal_uInt16 nVersion = _rxInStream->readShort();
// 2. Objekte
for (sal_Int32 i = 0; i < nLen; i++)
{
staruno::Reference<stario::XPersistObject> xObj;
try
{
xObj = _rxInStream->readObject();
}
catch(stario::WrongFormatException& e)
{
e; // make compiler happy
// the object could not be read
xObj = NULL;
// create a dummy starform (so the readEvents below will assign the events to the right controls)
xObj = staruno::Reference<stario::XPersistObject> (m_xServiceFactory->createInstance(FRM_COMPONENT_HIDDENCONTROL), staruno::UNO_QUERY);
DBG_ASSERT(xObj.is(), "OInterfaceContainer::read : could not create a substitute for the unknown object !");
if (!xObj.is())
// couldn't handle it ...
throw;
// set some properties describing what we did
staruno::Reference<starbeans::XPropertySet> xObjProps(xObj, staruno::UNO_QUERY);
if (xObjProps.is())
{
try
{
xObjProps->setPropertyValue(PROPERTY_NAME, staruno::makeAny(FRM_RES_STRING(RID_STR_CONTROL_SUBSTITUTED_NAME)));
xObjProps->setPropertyValue(PROPERTY_TAG, staruno::makeAny(FRM_RES_STRING(RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN)));
}
catch(...)
{
}
}
// 72133 - 09.02.00 - FS
}
catch(...)
{
// unsere Map leeren
while (!m_aItems.empty())
removeElementsNoEvents(0);
// und die staruno::Exception nach aussen
throw;
}
if (xObj.is())
{
staruno::Any aElement = xObj->queryInterface(m_aElementType);
if (aElement.hasValue())
insert(m_aItems.size(), *static_cast<const InterfaceRef*>(aElement.getValue()), sal_False);
else
; // form konnte nicht gelesen werden; nyi
}
}
}
readEvents(_rxInStream, nLen);
}
// starcontainer::XContainer
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::addContainerListener(const staruno::Reference<starcontainer::XContainerListener>& _rxListener) throw( staruno::RuntimeException )
{
m_aContainerListeners.addInterface(_rxListener);
}
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::removeContainerListener(const staruno::Reference<starcontainer::XContainerListener>& _rxListener) throw( staruno::RuntimeException )
{
m_aContainerListeners.removeInterface(_rxListener);
}
// starlang::XEventListener
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::disposing(const starlang::EventObject& _rSource) throw( staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_rMutex );
OInterfaceArray::iterator j = find(m_aItems.begin(), m_aItems.end(), _rSource.Source);
if (j != m_aItems.end())
{
OInterfaceMap::iterator i = m_aMap.begin();
while (i != m_aMap.end() && (*i).second != _rSource.Source)
++i;
m_aMap.erase(i);
m_aItems.erase(j);
}
}
// starbeans::XPropertyChangeListener
//------------------------------------------------------------------------------
void OInterfaceContainer::propertyChange(const starbeans::PropertyChangeEvent& evt)
{
if (evt.PropertyName == PROPERTY_NAME)
{
::osl::MutexGuard aGuard( m_rMutex );
OInterfaceMap::iterator i = find(m_aMap.begin(), m_aMap.end(),
pair<const ::rtl::OUString, InterfaceRef >(::utl::getString(evt.OldValue),evt.Source));
if (i != m_aMap.end())
{
InterfaceRef xCorrectType((*i).second);
m_aMap.erase(i);
m_aMap.insert(pair<const ::rtl::OUString, InterfaceRef >(::utl::getString(evt.NewValue),xCorrectType));
}
}
}
// starcontainer::XElementAccess
//------------------------------------------------------------------------------
sal_Bool SAL_CALL OInterfaceContainer::hasElements() throw( staruno::RuntimeException )
{
return !m_aMap.empty();
}
//------------------------------------------------------------------------------
staruno::Type SAL_CALL OInterfaceContainer::getElementType() throw(staruno::RuntimeException)
{
return m_aElementType;
}
// starcontainer::XEnumerationAccess
//------------------------------------------------------------------------------
staruno::Reference<starcontainer::XEnumeration> SAL_CALL OInterfaceContainer::createEnumeration() throw( staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_rMutex );
return new ::utl::OEnumerationByIndex(static_cast<starcontainer::XIndexAccess*>(this));
}
// starcontainer::XNameAccess
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OInterfaceContainer::getByName( const ::rtl::OUString& _rName ) throw(starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException)
{
pair <OInterfaceMap::iterator,
OInterfaceMap::iterator> aPair = m_aMap.equal_range(_rName);
if (aPair.first == aPair.second)
throw starcontainer::NoSuchElementException();
return staruno::Any(&(*aPair.first).second, m_aElementType);
}
//------------------------------------------------------------------------------
StringSequence SAL_CALL OInterfaceContainer::getElementNames() throw(staruno::RuntimeException)
{
StringSequence aNameList(m_aItems.size());
::rtl::OUString* pStringArray = aNameList.getArray();
for (OInterfaceMap::const_iterator i = m_aMap.begin(); i != m_aMap.end(); ++i, ++pStringArray)
{
*pStringArray = (*i).first;
}
return aNameList;
}
//------------------------------------------------------------------------------
sal_Bool SAL_CALL OInterfaceContainer::hasByName( const ::rtl::OUString& _rName ) throw(staruno::RuntimeException)
{
pair <OInterfaceMap::iterator,
OInterfaceMap::iterator> aPair = m_aMap.equal_range(_rName);
return aPair.first != aPair.second;
}
// starcontainer::XIndexAccess
//------------------------------------------------------------------------------
sal_Int32 OInterfaceContainer::getCount() throw( staruno::RuntimeException )
{
return m_aItems.size();
}
//------------------------------------------------------------------------------
staruno::Any OInterfaceContainer::getByIndex(sal_Int32 _nIndex) throw( starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException )
{
if (_nIndex < 0 || _nIndex >= m_aItems.size())
throw starlang::IndexOutOfBoundsException();
return staruno::Any(&m_aItems[_nIndex], m_aElementType);
}
//------------------------------------------------------------------------------
void OInterfaceContainer::insert(sal_Int32 _nIndex, const InterfaceRef& xElement, sal_Bool bEvents) throw( starlang::IllegalArgumentException )
{
// das richtige Interface besorgen
staruno::Any aCorrectType = xElement->queryInterface(m_aElementType);
if (!aCorrectType.hasValue())
throw starlang::IllegalArgumentException();
InterfaceRef xCorrectType = *static_cast<const InterfaceRef*>(aCorrectType.getValue());
::rtl::OUString sName;
staruno::Reference<starbeans::XPropertySet> xSet(xElement, staruno::UNO_QUERY);
if (xSet.is())
{
if (!hasProperty(PROPERTY_NAME, xSet))
throw starlang::IllegalArgumentException();
staruno::Any aValue = xSet->getPropertyValue(PROPERTY_NAME);
aValue >>= sName;
xSet->addPropertyChangeListener(PROPERTY_NAME, this);
}
else
throw starlang::IllegalArgumentException();
if (_nIndex > m_aItems.size()) // ermitteln des tatsaechlichen Indexs
{
_nIndex = m_aItems.size();
m_aItems.push_back(xCorrectType);
}
else
m_aItems.insert(m_aItems.begin() + _nIndex, xCorrectType);
m_aMap.insert(pair<const ::rtl::OUString, InterfaceRef >(sName,xCorrectType));
staruno::Reference<starcontainer::XChild> xChild(xElement, staruno::UNO_QUERY);
if (xChild.is())
xChild->setParent(static_cast<starcontainer::XContainer*>(this));
if (bEvents)
{
m_xEventAttacher->insertEntry(_nIndex);
InterfaceRef xIfc(xElement, staruno::UNO_QUERY);// wichtig
staruno::Any aHelper;
aHelper <<= xSet;
m_xEventAttacher->attach(_nIndex, xIfc, aHelper);
}
// notify derived classes
implInserted(xCorrectType);
// notify listeners
starcontainer::ContainerEvent aEvt;
aEvt.Source = static_cast<starcontainer::XContainer*>(this);
aEvt.Accessor <<= _nIndex;
aEvt.Element = staruno::Any(&xCorrectType, m_aElementType);
NOTIFY_LISTENERS(m_aContainerListeners, starcontainer::XContainerListener, elementInserted, aEvt);
}
//------------------------------------------------------------------------------
void OInterfaceContainer::removeElementsNoEvents(sal_Int32 nIndex)
{
OInterfaceArray::iterator i = m_aItems.begin() + nIndex;
InterfaceRef xElement(*i);
OInterfaceMap::iterator j = m_aMap.begin();
while (j != m_aMap.end() && (*j).second != xElement) ++j;
m_aItems.erase(i);
m_aMap.erase(j);
staruno::Reference<starbeans::XPropertySet> xSet(xElement, staruno::UNO_QUERY);
if (xSet.is())
xSet->removePropertyChangeListener(PROPERTY_NAME, this);
staruno::Reference<starcontainer::XChild> xChild(xElement, staruno::UNO_QUERY);
if (xChild.is())
xChild->setParent(InterfaceRef ());
}
// starcontainer::XIndexContainer
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::insertByIndex(sal_Int32 _nIndex, const staruno::Any& Element) throw(starlang::IllegalArgumentException, starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException)
{
if (Element.getValueType().getTypeClass() != staruno::TypeClass_INTERFACE)
throw starlang::IllegalArgumentException();
::osl::MutexGuard aGuard( m_rMutex );
insert(_nIndex, InterfaceRef (*(InterfaceRef *)Element.getValue()), sal_True);
}
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::replaceByIndex(sal_Int32 _nIndex, const staruno::Any& Element) throw( starlang::IllegalArgumentException, starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException )
{
if (Element.getValueType().getTypeClass() != staruno::TypeClass_INTERFACE)
throw starlang::IllegalArgumentException();
::osl::MutexGuard aGuard( m_rMutex );
if (_nIndex < 0 || _nIndex >= m_aItems.size())
throw starlang::IndexOutOfBoundsException();
InterfaceRef xOldElement(m_aItems[_nIndex]);
InterfaceRef xNewElement(*(InterfaceRef *)Element.getValue());
OInterfaceMap::iterator j = m_aMap.begin();
while (j != m_aMap.end() && (*j).second != xOldElement) ++j;
// Eventverkn<6B>pfungen aufheben
InterfaceRef xIfc(xOldElement, staruno::UNO_QUERY);// wichtig
m_xEventAttacher->detach(_nIndex, xIfc);
m_xEventAttacher->removeEntry(_nIndex);
staruno::Reference<starbeans::XPropertySet> xSet(xOldElement, staruno::UNO_QUERY);
if (xSet.is())
xSet->removePropertyChangeListener(PROPERTY_NAME, this);
staruno::Reference<starcontainer::XChild> xChild(xOldElement, staruno::UNO_QUERY);
if (xChild.is())
xChild->setParent(InterfaceRef ());
// neue einfuegen
::rtl::OUString sName;
xSet = staruno::Reference<starbeans::XPropertySet> (xNewElement, staruno::UNO_QUERY);
if (xSet.is())
{
if (!hasProperty(PROPERTY_NAME, xSet))
throw starlang::IllegalArgumentException();
staruno::Any aValue = xSet->getPropertyValue(PROPERTY_NAME);
aValue >>= sName;
xSet->addPropertyChangeListener(PROPERTY_NAME, this);
}
else
throw starlang::IllegalArgumentException();
// remove the old one
m_aMap.erase(j);
// insert the new one
m_aMap.insert(pair<const ::rtl::OUString, InterfaceRef >(sName,xNewElement));
m_aItems[_nIndex] = xNewElement;
xChild = staruno::Reference<starcontainer::XChild> (xNewElement, staruno::UNO_QUERY);
if (xChild.is())
xChild->setParent(static_cast<starcontainer::XContainer*>(this));
m_xEventAttacher->insertEntry(_nIndex);
xIfc = InterfaceRef (xNewElement, staruno::UNO_QUERY);// wichtig
staruno::Any aHelper;
aHelper <<= xSet;
m_xEventAttacher->attach(_nIndex, xIfc, aHelper);
// benachrichtigen
starcontainer::ContainerEvent aEvt;
aEvt.Source = static_cast<starcontainer::XContainer*>(this);
aEvt.Accessor <<= _nIndex;
aEvt.Element = staruno::Any(&xNewElement, m_aElementType);
aEvt.ReplacedElement = staruno::Any(&xOldElement, m_aElementType);
NOTIFY_LISTENERS(m_aContainerListeners, starcontainer::XContainerListener, elementReplaced, aEvt);
}
//------------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::removeByIndex(sal_Int32 _nIndex) throw( starlang::IndexOutOfBoundsException, starlang::WrappedTargetException, staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_rMutex );
if (_nIndex < 0 || _nIndex >= m_aItems.size())
throw starlang::IndexOutOfBoundsException();
OInterfaceArray::iterator i = m_aItems.begin() + _nIndex;
InterfaceRef xElement(*i);
OInterfaceMap::iterator j = m_aMap.begin();
while (j != m_aMap.end() && (*j).second != xElement) ++j;
m_aItems.erase(i);
m_aMap.erase(j);
// Eventverkn<6B>pfungen aufheben
InterfaceRef xIfc(xElement, staruno::UNO_QUERY);// wichtig
m_xEventAttacher->detach(_nIndex, xIfc);
m_xEventAttacher->removeEntry(_nIndex);
staruno::Reference<starbeans::XPropertySet> xSet(xElement, staruno::UNO_QUERY);
if (xSet.is())
xSet->removePropertyChangeListener(PROPERTY_NAME, this);
staruno::Reference<starcontainer::XChild> xChild(xElement, staruno::UNO_QUERY);
if (xChild.is())
xChild->setParent(InterfaceRef ());
// notify derived classes
implRemoved(xElement);
// notify listeners
starcontainer::ContainerEvent aEvt;
aEvt.Source = static_cast<starcontainer::XContainer*>(this);
aEvt.Element = staruno::Any(&xElement, m_aElementType);
aEvt.Accessor <<= _nIndex;
NOTIFY_LISTENERS(m_aContainerListeners, starcontainer::XContainerListener, elementRemoved, aEvt);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::insertByName(const ::rtl::OUString& Name, const staruno::Any& Element) throw( starlang::IllegalArgumentException, starcontainer::ElementExistException, starlang::WrappedTargetException, staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_rMutex );
if (Element.getValueType().getTypeClass() != staruno::TypeClass_INTERFACE)
throw starlang::IllegalArgumentException();
InterfaceRef xElement(*(InterfaceRef *)Element.getValue());
staruno::Reference<starbeans::XPropertySet> xSet(xElement, staruno::UNO_QUERY);
if (xSet.is())
{
if (!hasProperty(PROPERTY_NAME, xSet))
throw starlang::IllegalArgumentException();
xSet->setPropertyValue(PROPERTY_NAME, staruno::makeAny(Name));
}
insertByIndex(m_aItems.size(), Element);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::replaceByName(const ::rtl::OUString& Name, const staruno::Any& Element) throw( starlang::IllegalArgumentException, starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_rMutex );
pair <OInterfaceMap::iterator,
OInterfaceMap::iterator> aPair = m_aMap.equal_range(Name);
if (aPair.first == aPair.second)
throw starcontainer::NoSuchElementException();
if (Element.getValueType().getTypeClass() != staruno::TypeClass_INTERFACE)
throw starlang::IllegalArgumentException();
staruno::Reference<starbeans::XPropertySet> xSet(*(InterfaceRef *)Element.getValue(), staruno::UNO_QUERY);
if (xSet.is())
{
if (!hasProperty(PROPERTY_NAME, xSet))
throw starlang::IllegalArgumentException();
xSet->setPropertyValue(PROPERTY_NAME, staruno::makeAny(Name));
}
// determine the element pos
sal_Int32 nPos = find(m_aItems.begin(), m_aItems.end(), (*aPair.first).second) - m_aItems.begin();
replaceByIndex(nPos, Element);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::removeByName(const ::rtl::OUString& Name) throw( starcontainer::NoSuchElementException, starlang::WrappedTargetException, staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_rMutex );
pair <OInterfaceMap::iterator,
OInterfaceMap::iterator> aPair = m_aMap.equal_range(Name);
if (aPair.first == aPair.second)
throw starcontainer::NoSuchElementException();
sal_Int32 nPos = find(m_aItems.begin(), m_aItems.end(), (*aPair.first).second) - m_aItems.begin();
removeByIndex(nPos);
}
// starscript::XEventAttacherManager
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::registerScriptEvent( sal_Int32 nIndex, const starscript::ScriptEventDescriptor& aScriptEvent ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->registerScriptEvent(nIndex, aScriptEvent);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::registerScriptEvents( sal_Int32 nIndex, const staruno::Sequence< starscript::ScriptEventDescriptor >& aScriptEvents ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->registerScriptEvents(nIndex, aScriptEvents);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::revokeScriptEvent( sal_Int32 nIndex, const ::rtl::OUString& aListenerType, const ::rtl::OUString& aEventMethod, const ::rtl::OUString& aRemoveListenerParam ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->revokeScriptEvent(nIndex,
aListenerType, aEventMethod, aRemoveListenerParam );
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::revokeScriptEvents( sal_Int32 nIndex ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->revokeScriptEvents(nIndex);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::insertEntry( sal_Int32 nIndex ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->insertEntry(nIndex);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::removeEntry( sal_Int32 nIndex ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->removeEntry(nIndex);
}
//------------------------------------------------------------------------
staruno::Sequence< starscript::ScriptEventDescriptor > SAL_CALL OInterfaceContainer::getScriptEvents( sal_Int32 nIndex ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
return m_xEventAttacher->getScriptEvents(nIndex);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::attach( sal_Int32 nIndex, const staruno::Reference< staruno::XInterface >& xObject, const staruno::Any& aHelper ) throw(starlang::IllegalArgumentException, starlang::ServiceNotRegisteredException, staruno::RuntimeException)
{
m_xEventAttacher->attach(nIndex, xObject, aHelper);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::detach( sal_Int32 nIndex, const staruno::Reference< staruno::XInterface >& xObject ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->detach(nIndex, xObject);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::addScriptListener( const staruno::Reference< starscript::XScriptListener >& xListener ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->addScriptListener(xListener);
}
//------------------------------------------------------------------------
void SAL_CALL OInterfaceContainer::removeScriptListener( const staruno::Reference< starscript::XScriptListener >& xListener ) throw(starlang::IllegalArgumentException, staruno::RuntimeException)
{
m_xEventAttacher->removeScriptListener(xListener);
}
//==================================================================
//= OFormComponents
//==================================================================
//------------------------------------------------------------------------------
staruno::Any SAL_CALL OFormComponents::queryAggregation(const staruno::Type& _rType) throw(staruno::RuntimeException)
{
staruno::Any aReturn = ::cppu::queryInterface(
_rType,
static_cast<starform::XFormComponent*>(this),
static_cast<starcontainer::XChild*>(static_cast<starform::XFormComponent*>(this))
);
if (!aReturn.hasValue())
aReturn = OInterfaceContainer::queryInterface(_rType);
if (!aReturn.hasValue())
aReturn = FormComponentsBase::queryAggregation(_rType);
return aReturn;
}
//------------------------------------------------------------------
staruno::Sequence<staruno::Type> SAL_CALL OFormComponents::getTypes() throw(staruno::RuntimeException)
{
staruno::Sequence<staruno::Type> aBaseTypes = OInterfaceContainer::getTypes();
staruno::Sequence<staruno::Type> aComponentTypes = FormComponentsBase::getTypes();
staruno::Sequence<staruno::Type> aOwnTypes(1);
aOwnTypes.getArray()[0] = ::getCppuType(static_cast<staruno::Reference<starform::XFormComponent>*>(NULL));
return ::utl::concatSequences(aBaseTypes, aComponentTypes, aOwnTypes);
}
//------------------------------------------------------------------------------
OFormComponents::OFormComponents(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory)
:FormComponentsBase(m_aMutex)
,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<staruno::Reference<starform::XFormComponent>*>(NULL)))
{
}
//------------------------------------------------------------------------------
OFormComponents::~OFormComponents()
{
if (!FormComponentsBase::rBHelper.bDisposed)
{
acquire();
dispose();
}
}
// OComponentHelper
//------------------------------------------------------------------------------
void OFormComponents::disposing()
{
OInterfaceContainer::disposing();
FormComponentsBase::disposing();
m_xParent = NULL;
}
//XChild
//------------------------------------------------------------------------------
void OFormComponents::setParent(const InterfaceRef& Parent) throw( starlang::NoSupportException, staruno::RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
m_xParent = Parent;
}
//------------------------------------------------------------------------------
InterfaceRef OFormComponents::getParent() throw( staruno::RuntimeException )
{
return m_xParent;
}
//.........................................................................
} // namespace frm
//.........................................................................

67
forms/source/misc/ids.cxx Normal file
View File

@@ -0,0 +1,67 @@
/*************************************************************************
*
* $RCSfile: ids.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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 "ids.hxx"
IMPLEMENT_IMPLEMENTATIONID_HELPER(frm, OImplementationIds)

View File

@@ -0,0 +1,90 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJINC=..
PRJNAME=forms
TARGET=common
ENABLE_EXCEPTIONS=TRUE
#TARGETTYPE=GUI
# --- Settings ----------------------------------
.INCLUDE : settings.mk
# --- Types -------------------------------------
INCPRE+=$(SOLARINCDIR)$/offuh
# --- Files -------------------------------------
SLOFILES= $(SLO)$/property.obj \
$(SLO)$/services.obj \
$(SLO)$/InterfaceContainer.obj \
$(SLO)$/ids.obj \
$(SLO)$/InternationalHack.obj \
# --- Targets ----------------------------------
.INCLUDE : target.mk

View File

@@ -0,0 +1,468 @@
/*************************************************************************
*
* $RCSfile: property.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_PROPERTY_HXX_
#include "property.hxx"
#endif
#ifndef _FRM_PROPERTY_HRC_
#include "property.hrc"
#endif
#ifndef _CPPUHELPER_QUERYINTERFACE_HXX_
#include <cppuhelper/queryinterface.hxx>
#endif
#ifndef _TOOLS_DEBUG_HXX
#include <tools/debug.hxx>
#endif
#include <com/sun/star/beans/PropertyAttribute.hpp>
//... namespace frm .......................................................
namespace frm
{
//.........................................................................
//==================================================================
//= PropertyInfoService
//==================================================================
PropertyInfoService::PropertyMap PropertyInfoService::s_AllKnownProperties;
//------------------------------------------------------------------
sal_Int32 PropertyInfoService::getPropertyId(const ::rtl::OUString& _rName)
{
initialize();
PropertyAssignment aCompareName(_rName, -1);
PropertyAssignmentNameCompareLess aCompareOp;
ConstPropertyMapIterator aLowerBound = lower_bound(
s_AllKnownProperties.begin(),
s_AllKnownProperties.end(),
aCompareName,
aCompareOp);
if ((aLowerBound != s_AllKnownProperties.end()) && aLowerBound->sName.equals(_rName))
{ // we found something _and_ we have an identity
return aLowerBound->nHandle;
}
return -1;
}
//------------------------------------------------------------------
sal_Int32 ConcretInfoService::getPreferedPropertyId(const ::rtl::OUString& _rName)
{
return PropertyInfoService::getPropertyId(_rName);
}
//------------------------------------------------------------------
#define ADD_PROP_ASSIGNMENT(varname) \
s_AllKnownProperties.push_back(PropertyAssignment(PROPERTY_##varname, PROPERTY_ID_##varname))
//..................................................................
void PropertyInfoService::initialize()
{
if (s_AllKnownProperties.size())
return;
ADD_PROP_ASSIGNMENT(NAME);
ADD_PROP_ASSIGNMENT(TAG);
ADD_PROP_ASSIGNMENT(TABINDEX);
ADD_PROP_ASSIGNMENT(CLASSID);
ADD_PROP_ASSIGNMENT(ALIGN);
ADD_PROP_ASSIGNMENT(ROWCOUNT);
ADD_PROP_ASSIGNMENT(ROWCOUNTFINAL);
ADD_PROP_ASSIGNMENT(FETCHSIZE);
ADD_PROP_ASSIGNMENT(VALUE);
ADD_PROP_ASSIGNMENT(VALUEMIN);
ADD_PROP_ASSIGNMENT(VALUEMAX);
ADD_PROP_ASSIGNMENT(VALUESTEP);
ADD_PROP_ASSIGNMENT(TEXT);
ADD_PROP_ASSIGNMENT(LABEL);
ADD_PROP_ASSIGNMENT(NAVIGATION);
ADD_PROP_ASSIGNMENT(CYCLE);
ADD_PROP_ASSIGNMENT(CONTROLSOURCE);
ADD_PROP_ASSIGNMENT(ENABLED);
ADD_PROP_ASSIGNMENT(SPIN);
ADD_PROP_ASSIGNMENT(READONLY);
ADD_PROP_ASSIGNMENT(FILTER_CRITERIA);
ADD_PROP_ASSIGNMENT(AUTOINCREMENT);
ADD_PROP_ASSIGNMENT(CACHESIZE);
ADD_PROP_ASSIGNMENT(LASTDIRTY);
ADD_PROP_ASSIGNMENT(STATEMENT);
ADD_PROP_ASSIGNMENT(WIDTH);
ADD_PROP_ASSIGNMENT(SEARCHABLE);
ADD_PROP_ASSIGNMENT(MULTILINE);
ADD_PROP_ASSIGNMENT(TARGET_URL);
ADD_PROP_ASSIGNMENT(DEFAULTCONTROL);
ADD_PROP_ASSIGNMENT(MAXTEXTLEN);
ADD_PROP_ASSIGNMENT(SIZE);
ADD_PROP_ASSIGNMENT(DATE);
ADD_PROP_ASSIGNMENT(TIME);
ADD_PROP_ASSIGNMENT(STATE);
ADD_PROP_ASSIGNMENT(TRISTATE);
ADD_PROP_ASSIGNMENT(HIDDEN_VALUE);
ADD_PROP_ASSIGNMENT(TARGET_FRAME);
ADD_PROP_ASSIGNMENT(BUTTONTYPE);
ADD_PROP_ASSIGNMENT(STRINGITEMLIST);
ADD_PROP_ASSIGNMENT(DEFAULT_TEXT);
ADD_PROP_ASSIGNMENT(DEFAULTCHECKED);
ADD_PROP_ASSIGNMENT(DEFAULT_DATE);
ADD_PROP_ASSIGNMENT(DEFAULT_TIME);
ADD_PROP_ASSIGNMENT(DEFAULT_VALUE);
ADD_PROP_ASSIGNMENT(FORMATKEY);
ADD_PROP_ASSIGNMENT(FORMATSSUPPLIER);
ADD_PROP_ASSIGNMENT(SUBMIT_ACTION);
ADD_PROP_ASSIGNMENT(SUBMIT_TARGET);
ADD_PROP_ASSIGNMENT(SUBMIT_METHOD);
ADD_PROP_ASSIGNMENT(SUBMIT_ENCODING);
ADD_PROP_ASSIGNMENT(IMAGE_URL);
ADD_PROP_ASSIGNMENT(EMPTY_IS_NULL);
ADD_PROP_ASSIGNMENT(LISTSOURCETYPE);
ADD_PROP_ASSIGNMENT(LISTSOURCE);
ADD_PROP_ASSIGNMENT(SELECT_SEQ);
ADD_PROP_ASSIGNMENT(VALUE_SEQ);
ADD_PROP_ASSIGNMENT(DEFAULT_SELECT_SEQ);
ADD_PROP_ASSIGNMENT(MULTISELECTION);
ADD_PROP_ASSIGNMENT(DECIMAL_ACCURACY);
ADD_PROP_ASSIGNMENT(EDITMASK);
ADD_PROP_ASSIGNMENT(ISREADONLY);
ADD_PROP_ASSIGNMENT(ISREQUIRED);
ADD_PROP_ASSIGNMENT(FIELDTYPE);
ADD_PROP_ASSIGNMENT(DECIMALS);
ADD_PROP_ASSIGNMENT(REFVALUE);
ADD_PROP_ASSIGNMENT(STRICTFORMAT);
ADD_PROP_ASSIGNMENT(DATASOURCE);
ADD_PROP_ASSIGNMENT(ALLOWADDITIONS);
ADD_PROP_ASSIGNMENT(ALLOWEDITS);
ADD_PROP_ASSIGNMENT(ALLOWDELETIONS);
ADD_PROP_ASSIGNMENT(MASTERFIELDS);
ADD_PROP_ASSIGNMENT(ISPASSTHROUGH);
ADD_PROP_ASSIGNMENT(QUERY);
ADD_PROP_ASSIGNMENT(LITERALMASK);
ADD_PROP_ASSIGNMENT(SHOWTHOUSANDSEP);
ADD_PROP_ASSIGNMENT(CURRENCYSYMBOL);
ADD_PROP_ASSIGNMENT(DATEFORMAT);
ADD_PROP_ASSIGNMENT(DATEMIN);
ADD_PROP_ASSIGNMENT(DATEMAX);
ADD_PROP_ASSIGNMENT(DATE_SHOW_CENTURY);
ADD_PROP_ASSIGNMENT(TIMEFORMAT);
ADD_PROP_ASSIGNMENT(TIMEMIN);
ADD_PROP_ASSIGNMENT(TIMEMAX);
ADD_PROP_ASSIGNMENT(LINECOUNT);
ADD_PROP_ASSIGNMENT(BOUNDCOLUMN);
ADD_PROP_ASSIGNMENT(HASNAVIGATION);
ADD_PROP_ASSIGNMENT(FONT);
ADD_PROP_ASSIGNMENT(BACKGROUNDCOLOR);
ADD_PROP_ASSIGNMENT(FILLCOLOR);
ADD_PROP_ASSIGNMENT(TEXTCOLOR);
ADD_PROP_ASSIGNMENT(LINECOLOR);
ADD_PROP_ASSIGNMENT(BORDER);
ADD_PROP_ASSIGNMENT(DROPDOWN);
ADD_PROP_ASSIGNMENT(MULTI);
ADD_PROP_ASSIGNMENT(HSCROLL);
ADD_PROP_ASSIGNMENT(VSCROLL);
ADD_PROP_ASSIGNMENT(TABSTOP);
ADD_PROP_ASSIGNMENT(AUTOCOMPLETE);
ADD_PROP_ASSIGNMENT(HARDLINEBREAKS);
ADD_PROP_ASSIGNMENT(PRINTABLE);
ADD_PROP_ASSIGNMENT(ECHO_CHAR);
ADD_PROP_ASSIGNMENT(ROWHEIGHT);
ADD_PROP_ASSIGNMENT(HELPTEXT);
ADD_PROP_ASSIGNMENT(FONT_NAME);
ADD_PROP_ASSIGNMENT(FONT_STYLENAME);
ADD_PROP_ASSIGNMENT(FONT_FAMILY);
ADD_PROP_ASSIGNMENT(FONT_CHARSET);
ADD_PROP_ASSIGNMENT(FONT_HEIGHT);
ADD_PROP_ASSIGNMENT(FONT_WEIGHT);
ADD_PROP_ASSIGNMENT(FONT_SLANT);
ADD_PROP_ASSIGNMENT(FONT_UNDERLINE);
ADD_PROP_ASSIGNMENT(FONT_STRIKEOUT);
ADD_PROP_ASSIGNMENT(HELPURL);
ADD_PROP_ASSIGNMENT(RECORDMARKER);
ADD_PROP_ASSIGNMENT(BOUNDFIELD);
ADD_PROP_ASSIGNMENT(TREATASNUMERIC);
ADD_PROP_ASSIGNMENT(EFFECTIVE_VALUE);
ADD_PROP_ASSIGNMENT(EFFECTIVE_DEFAULT);
ADD_PROP_ASSIGNMENT(EFFECTIVE_MIN);
ADD_PROP_ASSIGNMENT(EFFECTIVE_MAX);
ADD_PROP_ASSIGNMENT(HIDDEN);
ADD_PROP_ASSIGNMENT(FILTERPROPOSAL);
ADD_PROP_ASSIGNMENT(FIELDSOURCE);
ADD_PROP_ASSIGNMENT(TABLENAME);
ADD_PROP_ASSIGNMENT(FILTERSUPPLIER);
ADD_PROP_ASSIGNMENT(CURRENTFILTER);
ADD_PROP_ASSIGNMENT(SELECTED_FIELDS);
ADD_PROP_ASSIGNMENT(SELECTED_TABLES);
ADD_PROP_ASSIGNMENT(THREADSAFE);
ADD_PROP_ASSIGNMENT(CONTROLLABEL);
ADD_PROP_ASSIGNMENT(CURRSYM_POSITION);
ADD_PROP_ASSIGNMENT(SOURCE);
ADD_PROP_ASSIGNMENT(CURSORCOLOR);
ADD_PROP_ASSIGNMENT(ALWAYSSHOWCURSOR);
ADD_PROP_ASSIGNMENT(DISPLAYSYNCHRON);
ADD_PROP_ASSIGNMENT(ISMODIFIED);
ADD_PROP_ASSIGNMENT(ISNEW);
ADD_PROP_ASSIGNMENT(PRIVILEGES);
ADD_PROP_ASSIGNMENT(DETAILFIELDS);
ADD_PROP_ASSIGNMENT(COMMAND);
ADD_PROP_ASSIGNMENT(COMMANDTYPE);
ADD_PROP_ASSIGNMENT(RESULTSET_CONCURRENCY);
ADD_PROP_ASSIGNMENT(INSERTONLY);
ADD_PROP_ASSIGNMENT(RESULTSET_TYPE);
ADD_PROP_ASSIGNMENT(ESCAPE_PROCESSING);
ADD_PROP_ASSIGNMENT(APPLYFILTER);
ADD_PROP_ASSIGNMENT(ISNULLABLE);
ADD_PROP_ASSIGNMENT(ACTIVECOMMAND);
ADD_PROP_ASSIGNMENT(ISCURRENCY);
ADD_PROP_ASSIGNMENT(NUMBER_FORMATS_SUPPLIER);
ADD_PROP_ASSIGNMENT(URL);
ADD_PROP_ASSIGNMENT(TITLE);
ADD_PROP_ASSIGNMENT(ACTIVE_CONNECTION);
ADD_PROP_ASSIGNMENT(SCALE);
ADD_PROP_ASSIGNMENT(SORT);
// now sort the array by name
PropertyAssignmentNameCompareLess aCompareOp;
std::sort(
s_AllKnownProperties.begin(),
s_AllKnownProperties.end(),
aCompareOp
);
}
//==================================================================
//= instantiation of property strings
//==================================================================
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABINDEX, "TabIndex");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TAG, "Tag");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_NAME, "Name");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CLASSID, "ClassId");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ROWCOUNT, "RowCount");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ROWCOUNTFINAL, "IsRowCountFinal");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FETCHSIZE, "FetchSize");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUE, "Value");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXT, "Text");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LABEL, "Label");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CANINSERT, "CanInsert");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CANUPDATE, "CanUpdate");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CANDELETE, "CanDelete");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_NAVIGATION, "NavigationBarMode");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HASNAVIGATION, "HasNavigationBar");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CYCLE, "Cycle");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCE, "DataField");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ENABLED, "Enabled");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_READONLY, "ReadOnly");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISREADONLY, "IsReadOnly");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILTER_CRITERIA, "Filter");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISREQUIRED, "IsRequired");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_AUTOINCREMENT, "IsAutoIncrement");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CACHESIZE, "CacheSize");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATAENTRY, "DataEntry");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LASTDIRTY, "LastUpdated");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STATEMENT, "Statement");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_WIDTH, "Width");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SEARCHABLE, "IsSearchable");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MULTILINE, "MultiLine");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TARGET_URL, "TargetURL");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TARGET_FRAME, "TargetFrame");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTCONTROL, "DefaultControl");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MAXTEXTLEN, "MaxTextLen");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EDITMASK, "EditMask");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SIZE, "Size");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SPIN, "Spin");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATE, "Date");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIME, "Time");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STATE, "State");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TRISTATE, "TriState");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HIDDEN_VALUE, "HiddenValue");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BUTTONTYPE, "ButtonType");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STRINGITEMLIST, "StringItemList");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_TEXT, "DefaultText");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULTCHECKED, "DefaultState");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FORMATKEY, "FormatKey");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FORMATSSUPPLIER, "FormatsSupplier");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_ACTION, "SubmitAction");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_TARGET, "SubmitTarget");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_METHOD, "SubmitMethod");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SUBMIT_ENCODING, "SubmitEncoding");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_IMAGE_URL, "ImageURL");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EMPTY_IS_NULL, "ConvertEmptyToNull");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LISTSOURCETYPE, "ListSourceType");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LISTSOURCE, "ListSource");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SELECT_SEQ, "SelectedItems");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUE_SEQ, "ValueItemList");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_SELECT_SEQ, "DefaultSelection");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MULTISELECTION, "MultiSelection");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALIGN, "Align");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_DATE, "DefaultDate");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_TIME, "DefaultTime");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DEFAULT_VALUE, "DefaultValue");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DECIMAL_ACCURACY, "DecimalAccuracy");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORSOURCE, "DataSelection");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORSOURCETYPE, "DataSelectionType");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FIELDTYPE, "Type");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DECIMALS, "Decimals");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_REFVALUE, "RefValue");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUEMIN, "ValueMin");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUEMAX, "ValueMax");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_STRICTFORMAT, "StrictFormat");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALLOWADDITIONS, "AllowInserts");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALLOWEDITS, "AllowUpdates");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALLOWDELETIONS, "AllowDeletes");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MASTERFIELDS, "MasterFields");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISPASSTHROUGH, "IsPassThrough");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_QUERY, "Query");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LITERALMASK, "LiteralMask");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VALUESTEP, "ValueStep");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SHOWTHOUSANDSEP, "ShowThousandsSeparator");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURRENCYSYMBOL, "CurrencySymbol");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATEFORMAT, "DateFormat");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATEMIN, "DateMin");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATEMAX, "DateMax");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATE_SHOW_CENTURY, "DateShowCentury");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIMEFORMAT, "TimeFormat");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIMEMIN, "TimeMin");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TIMEMAX, "TimeMax");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINECOUNT, "LineCount");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BOUNDCOLUMN, "BoundColumn");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT, "FontDescriptor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BACKGROUNDCOLOR, "BackgroundColor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILLCOLOR, "FillColor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TEXTCOLOR, "TextColor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_LINECOLOR, "LineColor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BORDER, "Border");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DROPDOWN, "Dropdown");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_MULTI, "Multi");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HSCROLL, "HScroll");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_VSCROLL, "VScroll");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABSTOP, "Tabstop");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_AUTOCOMPLETE, "Autocomplete");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HARDLINEBREAKS, "HardLineBreaks");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PRINTABLE, "Printable");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ECHO_CHAR, "EchoChar");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ROWHEIGHT, "RowHeight");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HELPTEXT, "HelpText");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_NAME, "FontName");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_STYLENAME, "FontStyleName");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_FAMILY, "FontFamily");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_CHARSET, "FontCharset");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_HEIGHT, "FontHeight");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_WEIGHT, "FontWeight");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_SLANT, "FontSlant");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_UNDERLINE, "FontUnderline");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FONT_STRIKEOUT, "FontStrikeout");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HELPURL, "HelpURL");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RECORDMARKER, "HasRecordMarker");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_BOUNDFIELD, "BoundField");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TREATASNUMERIC, "TreatAsNumber");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_VALUE, "EffectiveValue");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_DEFAULT, "EffectiveDefault");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MIN, "EffectiveMin");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_EFFECTIVE_MAX, "EffectiveMax");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_HIDDEN, "Hidden");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILTERPROPOSAL, "UseFilterValueProposal");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FIELDSOURCE, "FieldSource");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TABLENAME, "TableName");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_FILTERSUPPLIER, "FilterSupplier");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURRENTFILTER, "CurrentFilter");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SELECTED_FIELDS, "SelectedFields");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SELECTED_TABLES, "SelectedTables");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_THREADSAFE, "ThreadSafe");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISFILTERAPPLIED, "IsFilterApplied");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLLABEL, "LabelControl");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURRSYM_POSITION, "PrependCurrencySymbol");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SOURCE, "Source");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CURSORCOLOR, "CursorColor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ALWAYSSHOWCURSOR, "AlwaysShowCursor");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DISPLAYSYNCHRON, "DisplayIsSynchron");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISMODIFIED, "IsModified");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISNEW, "IsNew");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_PRIVILEGES, "Privileges");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COMMAND, "Command");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COMMANDTYPE, "CommandType");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESULTSET_CONCURRENCY, "ResultSetConcurrency");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_INSERTONLY, "IgnoreResult");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_RESULTSET_TYPE, "ResultSetType");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ESCAPE_PROCESSING, "EscapeProcessing");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_APPLYFILTER, "ApplyFilter");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISNULLABLE, "IsNullable");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ACTIVECOMMAND, "ActiveCommand");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ISCURRENCY, "IsCurrency");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_NUMBER_FORMATS_SUPPLIER, "NumberFormatsSupplier");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_URL, "URL");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_TITLE, "Title");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_ACTIVE_CONNECTION, "ActiveConnection");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SCALE, "Scale");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_SORT, "Order");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DATASOURCE, "DataSourceName");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_DETAILFIELDS, "DetailFields");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_COLUMNSERVICENAME, "ColumnServiceName");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_REALNAME, "RealName");
IMPLEMENT_CONSTASCII_USTRING(PROPERTY_CONTROLSOURCEPROPERTY, "DataFieldProperty");
//.........................................................................
}
//... namespace frm .......................................................

View File

@@ -0,0 +1,580 @@
/*************************************************************************
*
* $RCSfile: services.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_SERVICES_HXX_
#include "services.hxx"
#endif
//... namespace frm .......................................................
namespace frm
{
//.........................................................................
IMPLEMENT_CONSTASCII_USTRING(AWT_CONTROL_TEXTFIELD, "com.sun.star.awt.TextField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_EDIT, "stardiv.vcl.control.Edit");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_LISTBOX, "stardiv.vcl.control.ListBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_COMBOBOX, "stardiv.vcl.control.ComboBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_RADIOBUTTON, "stardiv.vcl.control.RadioButton");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_GROUPBOX, "stardiv.vcl.control.GroupBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_FIXEDTEXT, "stardiv.vcl.control.FixedText");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_COMMANDBUTTON, "stardiv.vcl.control.Button");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_CHECKBOX, "stardiv.vcl.control.CheckBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_IMAGEBUTTON, "stardiv.vcl.control.ImageButton");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_FILECONTROL, "stardiv.vcl.control.FileControl");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_TIMEFIELD, "stardiv.vcl.control.TimeField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_DATEFIELD, "stardiv.vcl.control.DateField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_NUMERICFIELD, "stardiv.vcl.control.NumericField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_CURRENCYFIELD, "stardiv.vcl.control.CurrencyField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_PATTERNFIELD, "stardiv.vcl.control.PatternField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_FORMATTEDFIELD, "stardiv.vcl.control.FormattedField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROL_IMAGECONTROL, "stardiv.vcl.control.ImageControl");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_EDIT, "stardiv.vcl.controlmodel.Edit");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_LISTBOX, "stardiv.vcl.controlmodel.ListBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMBOBOX, "stardiv.vcl.controlmodel.ComboBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_RADIOBUTTON, "stardiv.vcl.controlmodel.RadioButton");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_GROUPBOX, "stardiv.vcl.controlmodel.GroupBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_FIXEDTEXT, "stardiv.vcl.controlmodel.FixedText");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_COMMANDBUTTON, "stardiv.vcl.controlmodel.Button");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_CHECKBOX, "stardiv.vcl.controlmodel.CheckBox");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGEBUTTON, "stardiv.vcl.controlmodel.ImageButton");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_FILECONTROL, "stardiv.vcl.controlmodel.FileControl");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_TIMEFIELD, "stardiv.vcl.controlmodel.TimeField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_DATEFIELD, "stardiv.vcl.controlmodel.DateField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_NUMERICFIELD, "stardiv.vcl.controlmodel.NumericField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_CURRENCYFIELD, "stardiv.vcl.controlmodel.CurrencyField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_PATTERNFIELD, "stardiv.vcl.controlmodel.PatternField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_FORMATTEDFIELD, "stardiv.vcl.controlmodel.FormattedField");
IMPLEMENT_CONSTASCII_USTRING(VCL_CONTROLMODEL_IMAGECONTROL, "stardiv.vcl.controlmodel.ImageControl");
// -----------------------
// service names for compatibility
// -----------------------
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FORM, "stardiv.one.form.component.Form");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_EDIT, "stardiv.one.form.component.Edit"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_TEXTFIELD, "stardiv.one.form.component.TextField");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_LISTBOX, "stardiv.one.form.component.ListBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_COMBOBOX, "stardiv.one.form.component.ComboBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_RADIOBUTTON, "stardiv.one.form.component.RadioButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_GROUPBOX, "stardiv.one.form.component.GroupBox"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FIXEDTEXT, "stardiv.one.form.component.FixedText"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_COMMANDBUTTON, "stardiv.one.form.component.CommandButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_CHECKBOX, "stardiv.one.form.component.CheckBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_GRID, "stardiv.one.form.component.Grid"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_GRIDCONTROL, "stardiv.one.form.component.GridControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_IMAGEBUTTON, "stardiv.one.form.component.ImageButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FILECONTROL, "stardiv.one.form.component.FileControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_TIMEFIELD, "stardiv.one.form.component.TimeField");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_DATEFIELD, "stardiv.one.form.component.DateField");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_NUMERICFIELD, "stardiv.one.form.component.NumericField");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_CURRENCYFIELD, "stardiv.one.form.component.CurrencyField");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_PATTERNFIELD, "stardiv.one.form.component.PatternField");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_HIDDEN, "stardiv.one.form.component.Hidden");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_HIDDENCONTROL, "stardiv.one.form.component.HiddenControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_IMAGECONTROL, "stardiv.one.form.component.ImageControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_COMPONENT_FORMATTEDFIELD, "stardiv.one.form.component.FormattedField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_EDIT, "stardiv.one.form.control.Edit"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_TEXTFIELD, "stardiv.one.form.control.TextField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_LISTBOX, "stardiv.one.form.control.ListBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_COMBOBOX, "stardiv.one.form.control.ComboBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_RADIOBUTTON, "stardiv.one.form.control.RadioButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_GROUPBOX, "stardiv.one.form.control.GroupBox"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_FIXEDTEXT, "stardiv.one.form.control.FixedText"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_COMMANDBUTTON, "stardiv.one.form.control.CommandButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_CHECKBOX, "stardiv.one.form.control.CheckBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_GRID, "stardiv.one.form.control.Grid"); // compatibility
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_GRIDCONTROL, "stardiv.one.form.control.GridControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_IMAGEBUTTON, "stardiv.one.form.control.ImageButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_TIMEFIELD, "stardiv.one.form.control.TimeField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_DATEFIELD, "stardiv.one.form.control.DateField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_NUMERICFIELD, "stardiv.one.form.control.NumericField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_CURRENCYFIELD, "stardiv.one.form.control.CurrencyField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_PATTERNFIELD, "stardiv.one.form.control.PatternField");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_IMAGECONTROL, "stardiv.one.form.control.ImageControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_CONTROL_FORMATTEDFIELD, "stardiv.one.form.control.FormattedField");
// -----------------------
// new (sun) service names
// -----------------------
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORM, "com.sun.star.form.component.Form");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HTMLFORM, "com.sun.star.form.component.HTMLForm");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATAFORM, "com.sun.star.form.component.DataForm");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TEXTFIELD, "com.sun.star.form.component.TextField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_LISTBOX, "com.sun.star.form.component.ListBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMBOBOX, "com.sun.star.form.component.ComboBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_RADIOBUTTON, "com.sun.star.form.component.RadioButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GROUPBOX, "com.sun.star.form.component.GroupBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FIXEDTEXT, "com.sun.star.form.component.FixedText");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_COMMANDBUTTON, "com.sun.star.form.component.CommandButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CHECKBOX, "com.sun.star.form.component.CheckBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_GRIDCONTROL, "com.sun.star.form.component.GridControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_IMAGEBUTTON, "com.sun.star.form.component.ImageButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FILECONTROL, "com.sun.star.form.component.FileControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_TIMEFIELD, "com.sun.star.form.component.TimeField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_DATEFIELD, "com.sun.star.form.component.DateField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_NUMERICFIELD, "com.sun.star.form.component.NumericField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_CURRENCYFIELD, "com.sun.star.form.component.CurrencyField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_PATTERNFIELD, "com.sun.star.form.component.PatternField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_HIDDENCONTROL, "com.sun.star.form.component.HiddenControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_IMAGECONTROL, "com.sun.star.form.component.ImageControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_COMPONENT_FORMATTEDFIELD, "com.sun.star.form.component.FormattedField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_TEXTFIELD, "com.sun.star.form.control.TextField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_LISTBOX, "com.sun.star.form.control.ListBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMBOBOX, "com.sun.star.form.control.ComboBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_RADIOBUTTON, "com.sun.star.form.control.RadioButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_GROUPBOX, "com.sun.star.form.control.GroupBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_FIXEDTEXT, "com.sun.star.form.control.FixedText");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_COMMANDBUTTON, "com.sun.star.form.control.CommandButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_CHECKBOX, "com.sun.star.form.control.CheckBox");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_GRIDCONTROL, "com.sun.star.form.control.GridControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGEBUTTON, "com.sun.star.form.control.ImageButton");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_TIMEFIELD, "com.sun.star.form.control.TimeField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_DATEFIELD, "com.sun.star.form.control.DateField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_NUMERICFIELD, "com.sun.star.form.control.NumericField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_CURRENCYFIELD, "com.sun.star.form.control.CurrencyField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_PATTERNFIELD, "com.sun.star.form.control.PatternField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_IMAGECONTROL, "com.sun.star.form.control.ImageControl");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_CONTROL_FORMATTEDFIELD, "com.sun.star.form.control.FormattedField");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_FORMS_COLLECTION, "com.sun.star.form.FormsCollection");
IMPLEMENT_CONSTASCII_USTRING(FRM_SUN_INTERNATIONAL_INFO, "com.sun.star.deprecated.International");
IMPLEMENT_CONSTASCII_USTRING(FRM_DATA_ENGINE, "com.sun.star.data.DatabaseEngine");
IMPLEMENT_CONSTASCII_USTRING(FRM_NUMBER_FORMATTER, "com.sun.star.util.NumberFormatter");
IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_ROWSET, "com.sun.star.sdb.RowSet");
IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_CONNECTION, "com.sun.star.sdb.Connection");
IMPLEMENT_CONSTASCII_USTRING(SRV_SDBC_STATEMENT, "com.sun.star.sdbc.Statement");
IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_DATABASE_ENVIRONMENT, "com.sun.star.sdb.DatabaseEnvironment");
IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_DATABASE_ACCESS_CONNECTION, "com.sun.star.sdb.DatabaseAccessConnection");
IMPLEMENT_CONSTASCII_USTRING(SRV_SDB_DATABASE_ACCESS_CONTEXT, "com.sun.star.sdb.DatabaseAccessContext");
IMPLEMENT_CONSTASCII_USTRING(SRV_AWT_POINTER, "com.sun.star.awt.Pointer");
//.........................................................................
}
//... namespace frm .......................................................
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
#ifndef _UNO_LBNAMES_H_
#include <uno/lbnames.h>
#endif
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
#ifndef _UNO_MAPPING_HXX_
#include <uno/mapping.hxx>
#endif
namespace starregistry = ::com::sun::star::registry;
namespace staruno = ::com::sun::star::uno;
namespace starlang = ::com::sun::star::lang;
//---------------------------------------------------------------------------------------
//.......................................................................................
#define DECLARE_SERVICE_INFO(classImplName) \
namespace frm { \
extern staruno::Reference<staruno::XInterface> SAL_CALL classImplName##_CreateInstance(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException); \
}
//---------------------------------------------------------------------------------------
DECLARE_SERVICE_INFO(OFixedTextModel)
DECLARE_SERVICE_INFO(ORadioButtonModel)
DECLARE_SERVICE_INFO(ORadioButtonControl)
DECLARE_SERVICE_INFO(OCheckBoxModel)
DECLARE_SERVICE_INFO(OCheckBoxControl)
DECLARE_SERVICE_INFO(OHiddenModel)
DECLARE_SERVICE_INFO(OGroupBoxModel)
DECLARE_SERVICE_INFO(OGroupBoxControl)
DECLARE_SERVICE_INFO(OListBoxControl)
DECLARE_SERVICE_INFO(OListBoxModel)
DECLARE_SERVICE_INFO(OComboBoxControl)
DECLARE_SERVICE_INFO(OComboBoxModel)
DECLARE_SERVICE_INFO(OEditControl)
DECLARE_SERVICE_INFO(OEditModel)
DECLARE_SERVICE_INFO(ONumericControl)
DECLARE_SERVICE_INFO(ONumericModel)
DECLARE_SERVICE_INFO(OPatternControl)
DECLARE_SERVICE_INFO(OPatternModel)
DECLARE_SERVICE_INFO(OCurrencyControl)
DECLARE_SERVICE_INFO(OCurrencyModel)
DECLARE_SERVICE_INFO(ODateControl)
DECLARE_SERVICE_INFO(ODateModel)
DECLARE_SERVICE_INFO(OTimeControl)
DECLARE_SERVICE_INFO(OTimeModel)
DECLARE_SERVICE_INFO(OFormattedControl)
DECLARE_SERVICE_INFO(OFormattedModel)
DECLARE_SERVICE_INFO(OFileControlModel)
DECLARE_SERVICE_INFO(OButtonControl)
DECLARE_SERVICE_INFO(OButtonModel)
DECLARE_SERVICE_INFO(OImageButtonControl)
DECLARE_SERVICE_INFO(OImageButtonModel)
DECLARE_SERVICE_INFO(OImageControlControl)
DECLARE_SERVICE_INFO(OImageControlModel)
DECLARE_SERVICE_INFO(OGridControlModel)
// some special handling for the FormattedFieldWrapper which can act as FormattedModel or as EditModel
DECLARE_SERVICE_INFO(OFormattedFieldWrapper);
// this is for a service, which is instantiated through the EditModel service name
// and which acts mostly as Edit (mostly means : if somebody uses XPersistObject::read immediately after
// the object was instantiated and the stream contains a FormattedModel, it switches permanently to
// formatted.)
namespace frm { \
extern staruno::Reference<staruno::XInterface> SAL_CALL OFormattedFieldWrapper_CreateInstance_ForceFormatted(const staruno::Reference<starlang::XMultiServiceFactory>& _rxFactory) throw (staruno::RuntimeException); \
}
DECLARE_SERVICE_INFO(OFormsCollection)
DECLARE_SERVICE_INFO(ODatabaseForm)
DECLARE_SERVICE_INFO(OInternationalInfo)
//---------------------------------------------------------------------------------------
static staruno::Sequence< ::rtl::OUString > s_aClassImplementationNames;
static staruno::Sequence<staruno::Sequence< ::rtl::OUString > > s_aClassServiceNames;
static staruno::Sequence<sal_Int64> s_aFactories;
// need to use sal_Int64 instead of ComponentInstantiation, as ComponentInstantiation has no cppuType, so
// it can't be used with sequences
//---------------------------------------------------------------------------------------
void registerClassInfo(
::rtl::OUString _rClassImplName, // the ImplName of the class
const staruno::Sequence< ::rtl::OUString >& _rServiceNames, // the services supported by this class
::cppu::ComponentInstantiation _pCreateFunction // the method for instantiating such a class
)
{
sal_Int32 nCurrentLength = s_aClassImplementationNames.getLength();
OSL_ENSHURE((nCurrentLength == s_aClassServiceNames.getLength())
&& (nCurrentLength == s_aFactories.getLength()),
"forms::registerClassInfo : invalid class infos !");
s_aClassImplementationNames.realloc(nCurrentLength + 1);
s_aClassServiceNames.realloc(nCurrentLength + 1);
s_aFactories.realloc(nCurrentLength + 1);
s_aClassImplementationNames.getArray()[nCurrentLength] = _rClassImplName;
s_aClassServiceNames.getArray()[nCurrentLength] = _rServiceNames;
s_aFactories.getArray()[nCurrentLength] = reinterpret_cast<sal_Int64>(_pCreateFunction);
}
//---------------------------------------------------------------------------------------
//.......................................................................................
#define REGISTER_CLASS_CORE(classImplName) \
registerClassInfo( \
::rtl::OUString::createFromAscii("com.sun.star.form.") + ::rtl::OUString::createFromAscii(#classImplName), \
aServices, \
frm::classImplName##_CreateInstance)
//.......................................................................................
#define REGISTER_CLASS1(classImplName, service1) \
aServices.realloc(1); \
aServices.getArray()[0] = frm::service1; \
REGISTER_CLASS_CORE(classImplName)
//.......................................................................................
#define REGISTER_CLASS2(classImplName, service1, service2) \
aServices.realloc(2); \
aServices.getArray()[0] = frm::service1; \
aServices.getArray()[1] = frm::service2; \
REGISTER_CLASS_CORE(classImplName)
//.......................................................................................
#define REGISTER_CLASS3(classImplName, service1, service2, service3) \
aServices.realloc(3); \
aServices.getArray()[0] = frm::service1; \
aServices.getArray()[1] = frm::service2; \
aServices.getArray()[2] = frm::service3; \
REGISTER_CLASS_CORE(classImplName)
//.......................................................................................
#define REGISTER_CLASS4(classImplName, service1, service2, service3, service4) \
aServices.realloc(4); \
aServices.getArray()[0] = frm::service1; \
aServices.getArray()[1] = frm::service2; \
aServices.getArray()[2] = frm::service3; \
aServices.getArray()[3] = frm::service4; \
REGISTER_CLASS_CORE(classImplName)
//---------------------------------------------------------------------------------------
void ensureClassInfos()
{
if (s_aClassImplementationNames.getLength())
// nothing to do
return;
staruno::Sequence< ::rtl::OUString > aServices;
// ========================================================================
// = ControlModels
// ------------------------------------------------------------------------
// - FixedText
REGISTER_CLASS2(OFixedTextModel, FRM_COMPONENT_FIXEDTEXT, FRM_SUN_COMPONENT_FIXEDTEXT);
// - RadioButton
REGISTER_CLASS2(ORadioButtonModel, FRM_COMPONENT_RADIOBUTTON, FRM_SUN_COMPONENT_RADIOBUTTON);
// - CheckBox
REGISTER_CLASS2(OCheckBoxModel, FRM_COMPONENT_CHECKBOX, FRM_SUN_COMPONENT_CHECKBOX);
// - Hidden
REGISTER_CLASS3(OHiddenModel, FRM_COMPONENT_HIDDENCONTROL, FRM_SUN_COMPONENT_HIDDENCONTROL, FRM_COMPONENT_HIDDEN);
// - GroupBox
REGISTER_CLASS2(OGroupBoxModel, FRM_COMPONENT_GROUPBOX, FRM_SUN_COMPONENT_GROUPBOX);
// - ListBox
REGISTER_CLASS2(OListBoxModel, FRM_COMPONENT_LISTBOX, FRM_SUN_COMPONENT_LISTBOX);
// - ComboBox
REGISTER_CLASS2(OComboBoxModel, FRM_COMPONENT_COMBOBOX, FRM_SUN_COMPONENT_COMBOBOX);
// - EditControl
REGISTER_CLASS2(OEditModel, FRM_COMPONENT_TEXTFIELD, FRM_SUN_COMPONENT_TEXTFIELD);
// - DateControl
REGISTER_CLASS2(ODateModel, FRM_COMPONENT_DATEFIELD, FRM_SUN_COMPONENT_DATEFIELD);
// - TimeControl
REGISTER_CLASS2(OTimeModel, FRM_COMPONENT_TIMEFIELD, FRM_SUN_COMPONENT_TIMEFIELD);
// - NumericField
REGISTER_CLASS2(ONumericModel, FRM_COMPONENT_NUMERICFIELD, FRM_SUN_COMPONENT_NUMERICFIELD);
// - CurrencyField
REGISTER_CLASS2(OCurrencyModel, FRM_COMPONENT_CURRENCYFIELD, FRM_SUN_COMPONENT_CURRENCYFIELD);
// - PatternField
REGISTER_CLASS2(OPatternModel, FRM_COMPONENT_PATTERNFIELD, FRM_SUN_COMPONENT_PATTERNFIELD);
// - Button
REGISTER_CLASS2(OButtonModel, FRM_COMPONENT_COMMANDBUTTON, FRM_SUN_COMPONENT_COMMANDBUTTON);
// - ImageButton
REGISTER_CLASS2(OImageButtonModel, FRM_COMPONENT_IMAGEBUTTON, FRM_SUN_COMPONENT_IMAGEBUTTON);
// - ImageControl
REGISTER_CLASS2(OImageControlModel, FRM_COMPONENT_IMAGECONTROL, FRM_SUN_COMPONENT_IMAGECONTROL);
// - FormattedField
REGISTER_CLASS1(OFormattedFieldWrapper, FRM_COMPONENT_EDIT);
// since SUPD568 both OFormattedModel and OEditModel use FRM_COMPONENT_EDIT for persistence,
// and while reading a wrapper determines which kind of model it is
// register the wrapper for the FormattedField, as it handles the XPersistObject::write
// so that version <= 5.1 are able to read it
aServices.realloc(2);
aServices.getArray()[0] = frm::FRM_COMPONENT_FORMATTEDFIELD;
aServices.getArray()[1] = frm::FRM_SUN_COMPONENT_FORMATTEDFIELD;
registerClassInfo(::rtl::OUString::createFromAscii("com.sun.star.form.") + ::rtl::OUString::createFromAscii("OFormattedFieldWrapper_ForcedFormatted"),
aServices,
frm::OFormattedFieldWrapper_CreateInstance_ForceFormatted);
// - FileControl
REGISTER_CLASS2(OFileControlModel, FRM_COMPONENT_FILECONTROL, FRM_SUN_COMPONENT_FILECONTROL);
// - GridControl
REGISTER_CLASS3(OGridControlModel, FRM_COMPONENT_GRID /* compatibility */, FRM_COMPONENT_GRIDCONTROL, FRM_SUN_COMPONENT_GRIDCONTROL);
// ========================================================================
// = Controls
// - RadioButton
REGISTER_CLASS2(ORadioButtonControl, FRM_CONTROL_RADIOBUTTON, FRM_SUN_CONTROL_RADIOBUTTON);
// - CheckBox
REGISTER_CLASS2(OCheckBoxControl, FRM_CONTROL_CHECKBOX, FRM_SUN_CONTROL_CHECKBOX);
// - GroupBox
REGISTER_CLASS2(OGroupBoxControl, FRM_CONTROL_GROUPBOX, FRM_SUN_CONTROL_GROUPBOX);
// - ListBox
REGISTER_CLASS2(OListBoxControl, FRM_CONTROL_LISTBOX, FRM_SUN_CONTROL_LISTBOX);
// - ComboBox
REGISTER_CLASS2(OComboBoxControl, FRM_CONTROL_COMBOBOX, FRM_SUN_CONTROL_COMBOBOX);
// - EditControl
REGISTER_CLASS3(OEditControl, FRM_CONTROL_TEXTFIELD, FRM_SUN_CONTROL_TEXTFIELD, FRM_CONTROL_EDIT);
// - DateControl
REGISTER_CLASS2(ODateControl, FRM_CONTROL_DATEFIELD, FRM_SUN_CONTROL_DATEFIELD);
// - TimeControl
REGISTER_CLASS2(OTimeControl, FRM_CONTROL_TIMEFIELD, FRM_SUN_CONTROL_TIMEFIELD);
// - NumericField
REGISTER_CLASS2(ONumericControl, FRM_CONTROL_NUMERICFIELD, FRM_SUN_CONTROL_NUMERICFIELD);
// - CurrencyField
REGISTER_CLASS2(OCurrencyControl, FRM_CONTROL_CURRENCYFIELD, FRM_SUN_CONTROL_CURRENCYFIELD);
// - PatternField
REGISTER_CLASS2(OPatternControl, FRM_CONTROL_PATTERNFIELD, FRM_SUN_CONTROL_PATTERNFIELD);
// - FormattedField
REGISTER_CLASS2(OFormattedControl, FRM_CONTROL_FORMATTEDFIELD, FRM_SUN_CONTROL_FORMATTEDFIELD);
// - Button
REGISTER_CLASS2(OButtonControl, FRM_CONTROL_COMMANDBUTTON, FRM_SUN_CONTROL_COMMANDBUTTON);
// - ImageButton
REGISTER_CLASS2(OImageButtonControl, FRM_CONTROL_IMAGEBUTTON, FRM_SUN_CONTROL_IMAGEBUTTON);
// - ImageControl
REGISTER_CLASS2(OImageControlControl, FRM_CONTROL_IMAGECONTROL, FRM_SUN_CONTROL_IMAGECONTROL);
// ========================================================================
// = various
REGISTER_CLASS1(OFormsCollection, FRM_SUN_FORMS_COLLECTION);
REGISTER_CLASS4(ODatabaseForm, FRM_COMPONENT_FORM, FRM_SUN_COMPONENT_FORM, FRM_SUN_COMPONENT_HTMLFORM, FRM_SUN_COMPONENT_DATAFORM);
REGISTER_CLASS1(OInternationalInfo, FRM_SUN_INTERNATIONAL_INFO);
}
//---------------------------------------------------------------------------------------
void registerServiceProvider(const ::rtl::OUString& _rServiceImplName, const staruno::Sequence< ::rtl::OUString >& _rServices, starregistry::XRegistryKey* _pKey)
{
::rtl::OUString sMainKeyName = ::rtl::OUString::createFromAscii("/");
sMainKeyName += _rServiceImplName;
sMainKeyName += ::rtl::OUString::createFromAscii("/UNO/SERVICES");
staruno::Reference<starregistry::XRegistryKey> xNewKey = _pKey->createKey(sMainKeyName);
OSL_ENSHURE(xNewKey.is(), "forms::registerProvider : could not create a registry key !");
if (!xNewKey.is())
return;
const ::rtl::OUString* pSupportedServices = _rServices.getConstArray();
for (sal_Int32 i=0; i<_rServices.getLength(); ++i, ++pSupportedServices)
xNewKey->createKey(*pSupportedServices);
}
//=======================================================================================
extern "C"
{
//---------------------------------------------------------------------------------------
void SAL_CALL component_getImplementationEnvironment(const sal_Char** _ppEnvTypeName, uno_Environment** _ppEnv)
{
*_ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
//---------------------------------------------------------------------------------------
sal_Bool SAL_CALL component_writeInfo(void* _pServiceManager, starregistry::XRegistryKey* _pRegistryKey)
{
if (_pRegistryKey)
{
try
{
// collect the class infos
ensureClassInfos();
// both our static sequences should have the same length ...
sal_Int32 nClasses = s_aClassImplementationNames.getLength();
OSL_ENSHURE(s_aClassServiceNames.getLength() == nClasses,
"forms::component_writeInfo : invalid class infos !");
// loop through the sequences and register the service providers
const ::rtl::OUString* pClasses = s_aClassImplementationNames.getConstArray();
const staruno::Sequence< ::rtl::OUString >* pServices = s_aClassServiceNames.getConstArray();
for (sal_Int32 i=0; i<nClasses; ++i, ++pClasses, ++pServices)
registerServiceProvider(*pClasses, *pServices, _pRegistryKey);
s_aClassImplementationNames.realloc(0);
s_aClassServiceNames.realloc(0);
s_aFactories.realloc(0);
return sal_True;
}
catch (starregistry::InvalidRegistryException &)
{
OSL_ENSHURE(sal_False, "forms::component_writeInfo : InvalidRegistryException !");
}
}
s_aClassImplementationNames.realloc(0);
s_aClassServiceNames.realloc(0);
s_aFactories.realloc(0);
return sal_False;
}
//---------------------------------------------------------------------------------------
void* SAL_CALL component_getFactory(const sal_Char* _pImplName, starlang::XMultiServiceFactory* _pServiceManager, void* /*_pRegistryKey*/)
{
if (!_pServiceManager)
return NULL;
void* pRet = NULL;
// collect the class infos
ensureClassInfos();
// both our static sequences should have the same length ...
sal_Int32 nClasses = s_aClassImplementationNames.getLength();
OSL_ENSHURE((s_aClassServiceNames.getLength() == nClasses) &&
(s_aFactories.getLength() == nClasses),
"forms::component_writeInfo : invalid class infos !");
// loop through the sequences and register the service providers
const ::rtl::OUString* pClasses = s_aClassImplementationNames.getConstArray();
const staruno::Sequence< ::rtl::OUString >* pServices = s_aClassServiceNames.getConstArray();
const sal_Int64* pFunctionsAsInts = s_aFactories.getConstArray();
for (sal_Int32 i=0; i<nClasses; ++i, ++pClasses, ++pServices, ++pFunctionsAsInts)
{
if (rtl_ustr_ascii_compare(*pClasses, _pImplName) == 0)
{
::cppu::ComponentInstantiation aCurrentCreateFunction =
reinterpret_cast< ::cppu::ComponentInstantiation>(*pFunctionsAsInts);
staruno::Reference<starlang::XSingleServiceFactory> xFactory(
::cppu::createSingleFactory(
_pServiceManager,
*pClasses,
aCurrentCreateFunction,
*pServices
)
);
if (xFactory.is())
{
xFactory->acquire();
pRet = xFactory.get();
break;
}
}
}
return pRet;
}
}

View File

@@ -0,0 +1,131 @@
/*************************************************************************
*
* $RCSfile: frm_resource.cxx,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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 "frm_resource.hxx"
#ifndef _TOOLS_SIMPLERESMGR_HXX_
#include <tools/simplerm.hxx>
#endif
// ---- needed as long as we have no contexts for components ---
#ifndef _SV_SVAPP_HXX
#include <vcl/svapp.hxx>
#endif
#ifndef _TOOLS_INTN_HXX
#include <tools/intn.hxx>
#endif
//---------------------------------------------------
#ifndef _SOLAR_HRC
#include <svtools/solar.hrc>
#endif
//.........................................................................
namespace frm
{
//==================================================================
//= ResourceManager
//==================================================================
SimpleResMgr* ResourceManager::m_pImpl = NULL;
//------------------------------------------------------------------
ResourceManager::EnsureDelete::~EnsureDelete()
{
delete ResourceManager::m_pImpl;
}
//------------------------------------------------------------------
void ResourceManager::ensureImplExists()
{
if (m_pImpl)
return;
LanguageType nType = Application::GetAppInternational().GetLanguage();
ByteString sFileName("frm");
sFileName += ByteString::CreateFromInt32( (sal_Int32)SOLARUPD );
m_pImpl = SimpleResMgr::Create(sFileName.GetBuffer(), nType);
if (m_pImpl)
{
// no that we have a impl class make sure it's deleted on unloading the library
static ResourceManager::EnsureDelete s_aDeleteTheImplClas;
}
}
//------------------------------------------------------------------
::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId)
{
::rtl::OUString sReturn;
ensureImplExists();
if (m_pImpl)
sReturn = m_pImpl->ReadString(_nResId);
return sReturn;
}
//.........................................................................
}
//.........................................................................

View File

@@ -0,0 +1,84 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..$/..
PRJINC=..
PRJNAME=forms
TARGET=resource
# --- Settings -----------------------------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
# --- Files --------------------------------------------------------
SRS1NAME=resource
SRC1FILES= \
strings.src \
SLOFILES= $(SLO)$/frm_resource.obj \
# --- Targets ----------------------------------
.INCLUDE : target.mk

View File

@@ -0,0 +1,356 @@
/*************************************************************************
*
* $RCSfile: strings.src,v $
*
* $Revision: 1.1.1.1 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
*
* 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_RESOURCE_HRC_
#include "frm_resource.hrc"
#endif
String RID_BASELISTBOX_ERROR_FILLLIST
{
Text = "Der Inhalt eines Kombinations- oder Listenfeldes konnte nicht ermittelt werden.";
Text [ ENGLISH ] = "The content of a combo or list box could not be determined.";
Text [ english_us ] = "The contents of a combo box or list field could not be determined.";
Text[ portuguese ] = "Foi imposs<73>vel determinar o conte<74>do de uma caixa combinada ou caixa de listagem.";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ greek ] = "<22><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ dutch ] = "Inhoud combinatieveld of keuzelijst niet gevonden";
Text[ french ] = "Impossible de d<>terminer le contenu de la zone combin<69>e/zone de liste.";
Text[ spanish ] = "No se pudo determinar el contenido de un campo combinado o un listado.";
Text[ italian ] = "Non <20> stato possibile determinare il contenuto di una casella combinata o di una casella di riepilogo.";
Text[ danish ] = "Det var ikke muligt at bestemme indholdet for en kombinationsboks eller rulleliste.";
Text[ swedish ] = "Inneh<65>llet i ett kombinationsf<73>lt eller en listruta kunde inte best<73>mmas.";
Text[ polish ] = "Nie mo<6D>na by<62>o ustali<6C> zawarto<74>ci pola kombi lub pola listy.";
Text[ portuguese_brazilian ] = "ComboBox/ListBox : determine the list contents";
Text[ japanese ] = "<22><><EFBFBD><EFBFBD><EFBFBD>ޯ<EFBFBD><DEAF><EFBFBD>܂<EFBFBD><DC82><EFBFBD>ؽ<EFBFBD><D8BD>ޯ<EFBFBD><DEAF><EFBFBD>̓<EFBFBD><CC93>e<EFBFBD><65><EFBFBD>m<EFBFBD>F<EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>B";
Text[ korean ] = "ComboBox/ListBox : determine the list contents";
Text[ chinese_simplified ] = "<22>޷<EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD>Ͽ<EFBFBD><CFBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ݡ<EFBFBD>";
Text[ chinese_traditional ] = "<22>L<EFBFBD>k<EFBFBD>q<EFBFBD><71><EFBFBD>Ʈw<C6AE><77><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD>զX<D5A6><58><EFBFBD><EFBFBD><EFBFBD>βM<CEB2><4D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>e";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.";
Text[ turkish ] = "The contents of a combo box or list field could not be determined.";
};
String RID_STR_IMPORT_GRAPHIC
{
Text = "Grafik einf<6E>gen" ;
Text [ English ] = "Insert graphic" ;
Text [ portuguese ] = "Inserir imagem" ;
Text [ english_us ] = "Insert graphics" ;
Text [ portuguese_brazilian ] = "Grafik einf<6E>gen" ;
Text [ swedish ] = "Infoga grafik" ;
Text [ danish ] = "Inds<64>t billede" ;
Text [ italian ] = "Inserisci immagine" ;
Text [ spanish ] = "Insertar imagen" ;
Text [ french ] = "Ins<6E>rer une image" ;
Text [ dutch ] = "Afbeelding invoegen" ;
Text[ chinese_simplified ] = "<22><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ polish ] = "Wstaw grafik<69>";
Text[ japanese ] = "<22><><EFBFBD>̨<EFBFBD><CCA8><EFBFBD>̑}<7D><>";
Text[ chinese_traditional ] = "<22><><EFBFBD>J<EFBFBD>Ϥ<EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ korean ] = "<22>׷<EFBFBD><D7B7><EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ turkish ] = "Insert graphics";
};
String RID_STR_CONTROL_SUBSTITUTED_NAME
{
Text = "ersetzt";
Text [ english ] = "substituted";
Text [ english_us ] = "substituted";
Text[ portuguese ] = "substitu<74>do";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ dutch ] = "vervangen";
Text[ french ] = "remplac<61>";
Text[ spanish ] = "reemplazado";
Text[ italian ] = "sostituito";
Text[ danish ] = "erstattet";
Text[ swedish ] = "ersatt";
Text[ polish ] = "zamieniono";
Text[ portuguese_brazilian ] = "substituted";
Text[ japanese ] = "<22>u<EFBFBD><75>";
Text[ korean ] = "<22><>ü";
Text[ chinese_simplified ] = "<22>滻";
Text[ chinese_traditional ] = "<22><><EFBFBD>N";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ turkish ] = "substituted";
};
String RID_STR_CONTROL_SUBSTITUTED_EPXPLAIN
{
Text = "Beim Laden dieses Controls trat ein Fehler auf. Es wurde daher durch einen Platzhalter ersetzt.";
Text [ english ] = "While loading this control an error occured. Thus it was replaced with a placeholder.";
Text [ english_us ] = "While loading this control an error occured. Therefore, it was replaced with a placeholder.";
Text[ portuguese ] = "Ao carregar este controlo ocorreu um erro. Por esta raz<61>o foi substitu<74>do por um marcador de posi<73><69>o.";
Text[ russian ] = "<22><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (control) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.";
Text[ dutch ] = "Fout bjj het laden van control. Werd vervangen door plaatsvervanger.";
Text[ french ] = "Erreur lors du chargement de ce contr<74>le ; c'est pouquoi il a <20>t<EFBFBD> remplac<61> par un substituant.";
Text[ spanish ] = "Ha ocurrido un error al cargar este Control. Por ello se ha reemplazado con un comod<6F>n.";
Text[ italian ] = "Durante il caricamento del control si <20> verificato un errore. Pertanto <20> stato sostituito con una variabile.";
Text[ danish ] = "Der opstod en fejl under indl<64>sningen af dette kontrolelement. Det blev derfor erstattet med en pladsholder.";
Text[ swedish ] = "N<>r denna control laddades uppstod ett fel. D<>rf<72>r ersattes den av en platsh<73>llare.";
Text[ polish ] = "Wyst<73>pi<70> b<><62>d podczas <20>adowania pola kontrolnego (control). Zamieniono je dlatego na znak-wype<70>niacz.";
Text[ portuguese_brazilian ] = "While loading this control an error occured. Thus it was replaced with a placeholder.";
Text[ japanese ] = "<22><><EFBFBD>̺<EFBFBD><CCBA>۰ق̓ǂݍ<C782><DD8D>ݒ<EFBFBD><DD92>ɴװ<C9B4><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B<EFBFBD><42><EFBFBD><EFBFBD><EA82AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD><DCB2>޶<EFBFBD><DEB6>ނɒu<C992><75><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>܂<EFBFBD><DC82><EFBFBD><EFBFBD>B";
Text[ korean ] = "<22><> <20><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>߻<EFBFBD><DFBB>ؼ<EFBFBD> <20><>ü Ʋ<><C6B2> <20><>ü<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD><EFBFBD>ϴ<EFBFBD>.";
Text[ chinese_simplified ] = "<22><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֶΡ<D6B6>";
Text[ chinese_traditional ] = "<22>b<EFBFBD>˸<EFBFBD><CBB8>o<EFBFBD>ӱ<EFBFBD><D3B1><EFBFBD>ɵo<C9B5>ͤ@<40>ӿ<EFBFBD><D3BF>~<7E>C<EFBFBD><43><EFBFBD>w<EFBFBD>g<EFBFBD>Τ@<40>ӳq<D3B3>t<EFBFBD>Ŵ<EFBFBD><C5B4>N<EFBFBD><4E><EFBFBD>C";
Text[ arabic ] = "<22><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>.";
Text[ turkish ] = "While loading this control an error occured. Therefore, it was replaced with a placeholder.";
};
String RID_STR_READERROR
{
Text = "Fehler beim Lesen von Daten aus der Datenbank" ;
Text [ ENGLISH ] = "Error while reading data from database" ;
Text [ norwegian ] = "Feil ved lesing av data fra database" ;
Text [ italian ] = "Errore durante la lettura di dati dal database" ;
Text [ portuguese_brazilian ] = "Erro ao ler dados da base de dados" ;
Text [ portuguese ] = "Erro ao ler dados da base de dados" ;
Text [ finnish ] = "Virhe luettaessa tietoja tietokannasta" ;
Text [ danish ] = "Fejl under l<>sning af data fra databasen" ;
Text [ french ] = "Erreur lors de la lecture des donn<6E>es de la base de donn<6E>es" ;
Text [ swedish ] = "Fel vid l<>sning av data fr<66>n databasen" ;
Text [ dutch ] = "Fout bij lezen van gegevens in database" ;
Text [ spanish ] = "Error al leer datos de la base de datos" ;
Text [ english_us ] = "Error reading data from database" ;
Text[ chinese_simplified ] = "<22>ڶ<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ polish ] = "B<><42>d podczas odczytu danych z bazy danych";
Text[ japanese ] = "<22>ް<EFBFBD><DEB0>ް<EFBFBD><DEB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ް<EFBFBD><DEB0>ǂݎ<C782><DD8E><EFBFBD><EFBFBD>̍ۂ̴װ";
Text[ chinese_traditional ] = "<22><62><C5AA><EFBFBD><EFBFBD><EFBFBD>Ʈw<C6AE>ɵo<C9B5>Ϳ<EFBFBD><CDBF>~";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ korean ] = "<22><><EFBFBD><EFBFBD><EFBFBD>ͺ<EFBFBD><CDBA>̽<EFBFBD><CCBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>͸<EFBFBD> <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20>߻<EFBFBD>";
Text[ arabic ] = "<22><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ turkish ] = "Error reading data from database";
};
String RID_STR_CONNECTERROR
{
Text = "Verbindungsaufbau gescheitert" ;
Text [ ENGLISH ] = "Can't create connection" ;
Text [ norwegian ] = "Kan ikke opprette forbindelse" ;
Text [ italian ] = "Impossibile creare la connessione" ;
Text [ portuguese_brazilian ] = "N<>o consigo criar a conex<65>o" ;
Text [ portuguese ] = "N<>o foi poss<73>vel estabelecer liga<67><61>o." ;
Text [ finnish ] = "Yhteytt<74> ei voi muodostaa" ;
Text [ danish ] = "Det var ikke muligt at oprette forbindelsen" ;
Text [ french ] = "Connexion impossible" ;
Text [ swedish ] = "Uppkoppling avbruten" ;
Text [ dutch ] = "Kan geen verbinding tot stand brengen" ;
Text [ spanish ] = "No se pudo efectuar la conexi<78>n." ;
Text [ english_us ] = "Connection failed" ;
Text[ chinese_simplified ] = "<22><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ polish ] = "Po<50><6F>czenie nie dosz<73>o do skutku";
Text[ japanese ] = "<22>ڑ<EFBFBD><DA91>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD>";
Text[ chinese_traditional ] = "<22>s<EFBFBD>u<EFBFBD><75><EFBFBD><EFBFBD>";
Text[ greek ] = "<22> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ korean ] = "<22><><EFBFBD><20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ turkish ] = "Connection failed";
};
String RID_ERR_LOADING_FORM
{
Text = "Die Dateninhalte konnten nicht geladen werden.";
Text [ english ] = "The data content could not be loaded.";
Text [ english_us ] = "The data content could not be loaded.";
Text[ portuguese ] = "Foi imposs<73>vel carregar o conte<74>do dos dados.";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ greek ] = "<22><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ dutch ] = "De gegevens konden niet worden geladen.";
Text[ french ] = "Impossible de charger le contenu des donn<6E>es.";
Text[ spanish ] = "No se pudieron cargar los contenidos de los datos.";
Text[ italian ] = "Non <20> stato possibile caricare i contenuti.";
Text[ danish ] = "Det var ikke muligt at indl<64>se dataindholdet.";
Text[ swedish ] = "Datainneh<65>llet kunde inte laddas.";
Text[ polish ] = "Nie mo<6D>na by<62>o za<7A>adowa<77> zawarto<74>ci danych.";
Text[ portuguese_brazilian ] = "The data content could not be loaded.";
Text[ japanese ] = "<22>ް<EFBFBD><DEB0><EFBFBD><EFBFBD>e<EFBFBD><65><EFBFBD>ǂݍ<C782><DD8D>߂܂<DF82><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>B";
Text[ korean ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ε<EFBFBD><CEB5><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.";
Text[ chinese_simplified ] = "<22>޷<EFBFBD>װ<EFBFBD><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>";
Text[ chinese_traditional ] = "<22>L<EFBFBD>k<EFBFBD>˸<EFBFBD><CBB8><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>e<EFBFBD>C";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ turkish ] = "The data content could not be loaded.";
};
String RID_ERR_REFRESHING_FORM
{
Text = "Die Dateninhalte konnten nicht aktualisiert werden.";
Text [ english ] = "The data content could not be refreshed.";
Text [ english_us ] = "The data content could not be updated";
Text[ portuguese ] = "Foi imposs<73>vel actualizar o conte<74>do dos dados.";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ greek ] = "<22><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ dutch ] = "De gegevens konden niet worden geactualiseerd:";
Text[ french ] = "Impossible d'actualiser le contenu des donn<6E>es.";
Text[ spanish ] = "No se pudieron actualizar los contenidos de los datos.";
Text[ italian ] = "Non <20> stato possibile aggiornare i contenuti.";
Text[ danish ] = "Det var ikke muligt at opdatere dataindholdet.";
Text[ swedish ] = "Datainneh<65>llet kunde inte uppdateras.";
Text[ polish ] = "Nie mo<6D>na by<62>o zaktualizowa<77> zawarto<74>ci danych.";
Text[ portuguese_brazilian ] = "The data content could not be refreshed.";
Text[ japanese ] = "<22>ް<EFBFBD><DEB0><EFBFBD><EFBFBD>e<EFBFBD><65><EFBFBD>X<EFBFBD>V<EFBFBD>ł<EFBFBD><C582>܂<EFBFBD><DC82><EFBFBD><EFBFBD>ł<EFBFBD><C582><EFBFBD><EFBFBD>B";
Text[ korean ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD>߽<EFBFBD><DFBD>ϴ<EFBFBD>.";
Text[ chinese_simplified ] = "<22>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݡ<EFBFBD>";
Text[ chinese_traditional ] = "<22>L<EFBFBD>k<EFBFBD><6B><EFBFBD>s<EFBFBD><73><EFBFBD>Ƥ<EFBFBD><C6A4>e<EFBFBD>C";
Text[ arabic ] = "<22><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.";
Text[ turkish ] = "The data content could not be refreshed.";
};
String RID_STR_ERR_INSERTRECORD
{
Text = "Fehler beim Einf<6E>gen des neuen Datensatzs";
Text [ english ] = "error inserting the new record";
Text [ english_us ] = "Error inserting the new record";
Text[ portuguese ] = "Erro ao inserir o novo registo de dados";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ dutch ] = "Fout bij invoegen van nieuwe record";
Text[ french ] = "Erreur lors de l'insertion du nouvel enregistrement";
Text[ spanish ] = "Error al insertar un nuevo registro de datos.";
Text[ italian ] = "Errore nell'inserire il nuovo record di dati.";
Text[ danish ] = "Fejl ved inds<64>ttelse af den nye datapost";
Text[ swedish ] = "Fel vid infogning av den nya dataposten";
Text[ polish ] = "B<><42>d przy wstawianiu nowego rekordu";
Text[ portuguese_brazilian ] = "error inserting the new record";
Text[ japanese ] = "<22>V<EFBFBD><56><EFBFBD><EFBFBD>ں<EFBFBD><DABA>ނ<EFBFBD><DE82>}<7D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۂ̴װ";
Text[ korean ] = "<22><> <20><><EFBFBD>ڵ<EFBFBD> <20><><EFBFBD>Խ<EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ chinese_simplified ] = "<22>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀʱ<C4BF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ chinese_traditional ] = "<22>b<EFBFBD><62><EFBFBD>J<EFBFBD>s<EFBFBD><73><EFBFBD>Ʊ<EFBFBD><C6B1>خɵo<C9B5>Ϳ<EFBFBD><CDBF>~";
Text[ arabic ] = "<22><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ turkish ] = "Error inserting the new record";
};
String RID_STR_ERR_UPDATERECORD
{
Text = "Fehler beim Schreiben des aktuellen Datensatzes";
Text [ english ] = "error updating the current record";
Text [ english_us ] = "Error updating the current record";
Text[ portuguese ] = "Erro ao escrever o registo de dados activo";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ dutch ] = "Fout bij schrijven van actuele record";
Text[ french ] = "Erreur lors de l'<27>criture de l'enregistrement actif";
Text[ spanish ] = "Error al escribir el registro actual de datos.";
Text[ italian ] = "Errore nello scrivere il record di dati corrente.";
Text[ danish ] = "Fejl ved skrivning af den aktuelle datapost";
Text[ swedish ] = "Fel vid skrivning av den aktuella dataposten";
Text[ polish ] = "B<><42>d przy pisaniu aktualnego rekordu";
Text[ portuguese_brazilian ] = "error updating the current record";
Text[ japanese ] = "<22><><EFBFBD>݂<EFBFBD>ں<EFBFBD><DABA>ނ<EFBFBD><DE82><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ލۂ̴װ";
Text[ korean ] = "<22><><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈ<EFBFBD><C6AE> <20><><EFBFBD><EFBFBD>";
Text[ chinese_simplified ] = "<22>ڸ<EFBFBD><DAB8>µ<EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀʱ<C4BF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ chinese_traditional ] = "<22>b<EFBFBD>g<EFBFBD>J<EFBFBD><4A><EFBFBD>Ʊ<EFBFBD><C6B1>خɵo<C9B5>Ϳ<EFBFBD><CDBF>~";
Text[ arabic ] = "<22><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ turkish ] = "Error updating the current record";
};
String RID_STR_ERR_DELETERECORD
{
Text = "Fehler beim L<>schen des aktuellen Datensatzes";
Text [ english ] = "error deleting the current record";
Text [ english_us ] = "Error deleting the current record";
Text[ portuguese ] = "Erro ao eliminar o registo de dados activo";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ dutch ] = "Fout bij wissen van actuele record";
Text[ french ] = "Erreur lors de la suppression de l'enregistrement actif";
Text[ spanish ] = "Error al eliminar el registro actual de datos.";
Text[ italian ] = "Errore nel cancellare il record di dati corrente.";
Text[ danish ] = "Fejl ved sletning af den aktuelle datapost";
Text[ swedish ] = "Fel vid radering av den aktuella dataposten";
Text[ polish ] = "B<><42>d przy usuwaniu aktualnego rekordu";
Text[ portuguese_brazilian ] = "error deleting the current record";
Text[ japanese ] = "<22><><EFBFBD>݂<EFBFBD>ں<EFBFBD><DABA>ނ<EFBFBD><DE82><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>ۂ̴װ";
Text[ korean ] = "<22><><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ chinese_simplified ] = "<22><>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀʱ<C4BF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ chinese_traditional ] = "<22>b<EFBFBD>R<EFBFBD><52><EFBFBD><EFBFBD><EFBFBD>Ʊ<EFBFBD><C6B1>خɵo<C9B5>Ϳ<EFBFBD><CDBF>~";
Text[ arabic ] = "<22><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ turkish ] = "Error deleting the current record";
};
String RID_STR_ERR_DELETERECORDS
{
Text = "Fehler beim L<>schen der angegebenen Datens<6E>tze";
Text [ english ] = "error deleting the specified records";
Text [ english_us ] = "Error deleting the specified records";
Text[ portuguese ] = "Erro ao eliminar os registos de dados indicados.";
Text[ russian ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ greek ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ dutch ] = "Fout bij wissen van records";
Text[ french ] = "Erreur lors de la suppression des enregistrements sp<73>cifi<66>s";
Text[ spanish ] = "Error al eliminar los registros de datos indicados.";
Text[ italian ] = "Errore nel cancellare i record di dati specificati.";
Text[ danish ] = "Fejl ved sletning af de angivne dataposter";
Text[ swedish ] = "Fel vid radering av de angivna dataposterna";
Text[ polish ] = "B<><42>d przy usuwaniu podanych rekord<72>w";
Text[ portuguese_brazilian ] = "error deleting the specified records";
Text[ japanese ] = "<22>w<EFBFBD><EFBFBD><E882B5>ں<EFBFBD><DABA>ނ<EFBFBD><DE82><EFBFBD><ED8F9C><EFBFBD><EFBFBD><EFBFBD>ۂ̴װ";
Text[ korean ] = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>ڵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>";
Text[ chinese_simplified ] = "<22><>ɾ<EFBFBD><C9BE>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀʱ<C4BF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ chinese_traditional ] = "<22>b<EFBFBD>R<EFBFBD><52><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><77><EFBFBD>Ʊ<EFBFBD><C6B1>خɵo<C9B5>Ϳ<EFBFBD><CDBF>~";
Text[ arabic ] = "<22><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
Text[ turkish ] = "Error deleting the specified records";
};

3
forms/util/frm.dxp Normal file
View File

@@ -0,0 +1,3 @@
component_writeInfo
component_getImplementationEnvironment
component_getFactory

165
forms/util/frm.xml Normal file
View File

@@ -0,0 +1,165 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//StarOffice//DTD ComponentDescription 1.0//EN" "componentdescription.dtd">
<COMPONENTDESCRIPTION xmlns:xlink="http://www.w3.org/1999/xlink/Namespace" >
<Author>Frank Schoenheit</Author>
<Name>com.sun.star.form.OButtonModel</Name>
<Description>
This component provides the button.
</Description>
<SupportedService>com.sun.star.form.component.CommandButton</SupportedService>
<Name>com.sun.star.form.OCheckBoxModel</Name>
<Description>
This component provides the OCheckBoxModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseCheckBox</SupportedService>
<Name>com.sun.star.form.OComboBoxModel</Name>
<Description>
This component provides the OComboBoxModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseComboBox</SupportedService>
<Name>com.sun.star.form.OCurrencyModel</Name>
<Description>
This component provides the OCurrencyModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseCurrencyField</SupportedService>
<Name>com.sun.star.form.ODateModel</Name>
<Description>
This component provides the ODateModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseDateField</SupportedService>
<Name>com.sun.star.form.OEditModel</Name>
<Description>
This component provides the OEditModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseTextField</SupportedService>
<Name>com.sun.star.form.OFileControlModel</Name>
<Description>
This component provides the OFileControlModel.
</Description>
<SupportedService>com.sun.star.form.component.FileControl</SupportedService>
<Name>com.sun.star.form.ODatabaseForm</Name>
<Description>
This component provides the button.
</Description>
<SupportedService>com.sun.star.form.component.HTMLForm</SupportedService>
<Name>com.sun.star.form.OFormsCollection</Name>
<Description>
This component provides the button.
</Description>
<SupportedService>com.sun.star.form.Forms</SupportedService>
<Name>com.sun.star.form.OGridControlModel</Name>
<Description>
This component provides the OGridControlModel.
</Description>
<SupportedService>com.sun.star.form.component.GridControl</SupportedService>
<Name>com.sun.star.form.OGroupBoxModel</Name>
<Description>
This component provides the OGroupBoxModel.
</Description>
<SupportedService>com.sun.star.form.component.GroupBox</SupportedService>
<Name>com.sun.star.form.OHiddenModel</Name>
<Description>
This component provides the OHiddenModel.
</Description>
<SupportedService>com.sun.star.form.component.HiddenControl</SupportedService>
<Name>com.sun.star.form.OImageButtonModel</Name>
<Description>
This component provides the OImageButtonModel.
</Description>
<SupportedService>com.sun.star.form.component.ImageButton</SupportedService>
<Name>com.sun.star.form.OImageControlModel</Name>
<Description>
This component provides the OImageControlModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseImageControl</SupportedService>
<Name>com.sun.star.form.OListBoxModel</Name>
<Description>
This component provides the OListBoxModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseListBox</SupportedService>
<Name>com.sun.star.form.ONumericModel</Name>
<Description>
This component provides the ONumericModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseNumericField</SupportedService>
<Name>com.sun.star.form.OPatternModel</Name>
<Description>
This component provides the OPatternModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabasePatternField</SupportedService>
<Name>com.sun.star.form.ORadioButtonModel</Name>
<Description>
This component provides the RadioButtonModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseRadioButton</SupportedService>
<Name>com.sun.star.form.OFixedTextModel</Name>
<Description>
This component provides the button.
</Description>
<SupportedService>com.sun.star.form.component.FixedText</SupportedService>
<Name>com.sun.star.form.OTimeModel</Name>
<Description>
This component provides the OTimeModel.
</Description>
<SupportedService>com.sun.star.form.component.DatabaseTimeField</SupportedService>
<Language>c++</Language>
<Status StatusValue="final"/>
<ModuleName>frm</ModuleName>
<LoaderName>com.sun.star.loader.SharedLibrary</LoaderName>
<ServiceDependency>...</ServiceDependency>
<ProjectBuildDependency>sal</ProjectBuildDependency>
<ProjectBuildDependency>osl</ProjectBuildDependency>
<ProjectBuildDependency>one</ProjectBuildDependency>
<ProjectBuildDependency>cppu</ProjectBuildDependency>
<ProjectBuildDependency>cppuhelper</ProjectBuildDependency>
<ProjectBuildDependency>tools</ProjectBuildDependency>
<ProjectBuildDependency>vcl</ProjectBuildDependency>
<ProjectBuildDependency>svtool</ProjectBuildDependency>
<ProjectBuildDependency>sfx2</ProjectBuildDependency>
<ProjectBuildDependency>vos</ProjectBuildDependency>
<ProjectBuildDependency>unotools</ProjectBuildDependency>
<ProjectBuildDependency>tk</ProjectBuildDependency>
<RuntimeModuleDependency>sal</RuntimeModuleDependency>
<RuntimeModuleDependency>osl</RuntimeModuleDependency>
<RuntimeModuleDependency>one</RuntimeModuleDependency>
<RuntimeModuleDependency>cppu</RuntimeModuleDependency>
<RuntimeModuleDependency>cppuhelper</RuntimeModuleDependency>
<RuntimeModuleDependency>tools</RuntimeModuleDependency>
<RuntimeModuleDependency>vcl</RuntimeModuleDependency>
<RuntimeModuleDependency>svtool</RuntimeModuleDependency>
<RuntimeModuleDependency>sfx2</RuntimeModuleDependency>
<RuntimeModuleDependency>vos</RuntimeModuleDependency>
<RuntimeModuleDependency>unotools</RuntimeModuleDependency>
<RuntimeModuleDependency>tk</RuntimeModuleDependency>
</COMPONENTDESCRIPTION>

183
forms/util/makefile.mk Normal file
View File

@@ -0,0 +1,183 @@
#*************************************************************************
#
# $RCSfile: makefile.mk,v $
#
# $Revision: 1.1.1.1 $
#
# last change: $Author: hr $ $Date: 2000-09-18 16:29:06 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
#
# - GNU Lesser General Public License Version 2.1
# - Sun Industry Standards Source License Version 1.1
#
# Sun Microsystems Inc., October, 2000
#
# GNU Lesser General Public License Version 2.1
# =============================================
# Copyright 2000 by Sun Microsystems, Inc.
# 901 San Antonio Road, Palo Alto, CA 94303, USA
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License version 2.1, as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
#
# Sun Industry Standards Source License Version 1.1
# =================================================
# The contents of this file are subject to the Sun Industry Standards
# Source License Version 1.1 (the "License"); You may not use this file
# except in compliance with the License. You may obtain a copy of the
# License at http://www.openoffice.org/license.html.
#
# Software provided under this License is provided on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
# See the License for the specific provisions governing your rights and
# obligations concerning the Software.
#
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
#
# Copyright: 2000 by Sun Microsystems, Inc.
#
# All Rights Reserved.
#
# Contributor(s): _______________________________________
#
#
#
#*************************************************************************
PRJ=..
PRJNAME=forms
TARGET=frm
USE_LDUMP2=TRUE
USE_DEFFILE=TRUE
# --- Settings ----------------------------------
.INCLUDE : svpre.mk
.INCLUDE : settings.mk
.INCLUDE : sv.mk
LDUMP=ldump2.exe
# --- Library -----------------------------------
LIB1TARGET=$(SLB)$/forms.lib
LIB1FILES=\
$(SLB)$/common.lib \
$(SLB)$/resource.lib \
$(SLB)$/component.lib
SHL1TARGET=$(TARGET)$(UPD)$(DLLPOSTFIX)
SHL1STDLIBS= \
$(SALLIB) \
$(OSLLIB) \
$(ONELIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(TOOLSLIB) \
$(VCLLIB) \
$(SVTOOLLIB) \
$(SVLLIB) \
$(SFX2LIB) \
$(VOSLIB) \
$(UNOTOOLSLIB) \
$(TKLIB)
SHL1LIBS=$(LIB1TARGET)
SHL1DEF=$(MISC)$/$(SHL1TARGET).def
SHL1DEPN= $(LIB1TARGET) \
makefile.mk
DEF1NAME=$(SHL1TARGET)
DEF1EXPORTFILE=$(TARGET).dxp
# === .res file ==========================================================
RES1FILELIST=\
$(SRS)$/resource.srs \
RESLIB1NAME=$(TARGET)
RESLIB1SRSFILES=$(RES1FILELIST)
.IF "$(GUI)"=="UNX"
SHL1STDLIBS +=\
-lX11 -lXt -lXmu
.ENDIF
# --- Targets ----------------------------------
.INCLUDE : target.mk
# --- Filter-Datei ---
$(MISC)$/$(SHL1TARGET).flt: makefile.mk
@echo ------------------------------
@echo Making: $@
@echo CLEAR_THE_FILE > $@
@echo OControl >> $@
@echo OBoundControl >> $@
@echo OCombo >> $@
@echo OList >> $@
@echo OFixedText >> $@
@echo OCheckBox >> $@
@echo OGroupBox >> $@
@echo RadioButton >> $@
@echo OHidden >> $@
@echo OEdit >> $@
@echo OEditBase >> $@
@echo ONumeric >> $@
@echo OPattern >> $@
@echo OCurrency >> $@
@echo ODate >> $@
@echo OTime >> $@
@echo OFile >> $@
@echo OFormatted >> $@
@echo OComponent >> $@
@echo OButton >> $@
@echo OImage >> $@
@echo OInterfaceContainer >> $@
@echo OFormsCollection >> $@
@echo OGroup >> $@
@echo HtmlSuccess >> $@
@echo OSuccess >> $@
@echo OParameter >> $@
@echo ODatabaseForm >> $@
@echo OFormComponents >> $@
@echo OFormSubmitResetThread >> $@
@echo OInternational >> $@
@echo OGrid >> $@
@echo FieldColumn >> $@
@echo BoxColumn >> $@
@echo StandardFormatsSupplier >> $@
@echo OGuard >> $@
@echo OPropertyChange >> $@
@echo OEnumeration >> $@
@echo Weak >> $@
@echo OUString >> $@
@echo Any@uno@star@sun@com >> $@
@echo _C >> $@
@echo _TI2 >> $@
@echo _real >> $@