2000-09-18 15:33:13 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: Grid.cxx,v $
|
|
|
|
*
|
2001-05-11 17:04:43 +00:00
|
|
|
* $Revision: 1.12 $
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
2001-05-11 17:04:43 +00:00
|
|
|
* last change: $Author: fs $ $Date: 2001-05-11 18:04:43 $
|
2000-09-18 15:33:13 +00:00
|
|
|
*
|
|
|
|
* 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 "Grid.hxx"
|
|
|
|
#ifndef _FRM_COLUMNS_HXX
|
|
|
|
#include "Columns.hxx"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_FORMCOMPONENTTYPE_HPP_
|
|
|
|
#include <com/sun/star/form/FormComponentType.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_XFORM_HPP_
|
|
|
|
#include <com/sun/star/form/XForm.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
|
|
|
|
#include <com/sun/star/form/XLoadable.hpp>
|
|
|
|
#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 _CPPUHELPER_QUERYINTERFACE_HXX_
|
|
|
|
#include <cppuhelper/queryinterface.hxx>
|
|
|
|
#endif
|
2001-03-15 07:47:25 +00:00
|
|
|
#ifndef _COMPHELPER_EXTRACT_HXX_
|
|
|
|
#include <comphelper/extract.hxx>
|
2000-09-18 15:33:13 +00:00
|
|
|
#endif
|
2000-10-19 10:52:20 +00:00
|
|
|
#ifndef _COMPHELPER_CONTAINER_HXX_
|
|
|
|
#include <comphelper/container.hxx>
|
2000-09-18 15:33:13 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _SV_SVAPP_HXX
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef _TOOLKIT_UNOHLP_HXX
|
|
|
|
#include <toolkit/helper/vclunohelper.hxx>
|
|
|
|
#endif
|
|
|
|
|
2000-12-19 16:12:27 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
// TODO : find a place for this !
|
|
|
|
namespace internal
|
|
|
|
{
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Vergleichen von Strings
|
|
|
|
static int
|
|
|
|
#if defined( WNT )
|
|
|
|
__cdecl
|
|
|
|
#endif
|
|
|
|
#if defined( ICC ) && defined( OS2 )
|
|
|
|
_Optlink
|
|
|
|
#endif
|
|
|
|
NameCompare(const void* pFirst, const void* pSecond)
|
|
|
|
{
|
|
|
|
return ((::rtl::OUString*)pFirst)->compareTo(*(::rtl::OUString*)pSecond);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
sal_Int32 findPos(const ::rtl::OUString& aStr, const StringSequence& rList)
|
|
|
|
{
|
|
|
|
const ::rtl::OUString* pStrList = rList.getConstArray();
|
|
|
|
::rtl::OUString* pResult = (::rtl::OUString*) bsearch(&aStr, (void*)pStrList, rList.getLength(), sizeof(::rtl::OUString),
|
|
|
|
&NameCompare);
|
|
|
|
|
|
|
|
if (pResult)
|
|
|
|
return (pResult - pStrList);
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace internal
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
namespace frm
|
|
|
|
{
|
|
|
|
//.........................................................................
|
2000-11-23 07:48:15 +00:00
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::sdb;
|
|
|
|
using namespace ::com::sun::star::sdbc;
|
|
|
|
using namespace ::com::sun::star::sdbcx;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
using namespace ::com::sun::star::form;
|
|
|
|
using namespace ::com::sun::star::awt;
|
|
|
|
using namespace ::com::sun::star::io;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::util;
|
|
|
|
using namespace ::com::sun::star::view;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
const sal_uInt16 ROWHEIGHT = 0x0001;
|
|
|
|
const sal_uInt16 FONTTYPE = 0x0002;
|
|
|
|
const sal_uInt16 FONTSIZE = 0x0004;
|
|
|
|
const sal_uInt16 FONTATTRIBS = 0x0008;
|
|
|
|
const sal_uInt16 TABSTOP = 0x0010;
|
|
|
|
const sal_uInt16 TEXTCOLOR = 0x0020;
|
|
|
|
const sal_uInt16 FONTDESCRIPTOR = 0x0040;
|
|
|
|
const sal_uInt16 RECORDMARKER = 0x0080;
|
|
|
|
const sal_uInt16 BACKGROUNDCOLOR = 0x0100;
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
InterfaceRef SAL_CALL OGridControlModel_CreateInstance(const Reference<XMultiServiceFactory>& _rxFactory)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
return *(new OGridControlModel(_rxFactory));
|
|
|
|
}
|
|
|
|
|
|
|
|
DBG_NAME(OGridControlModel);
|
|
|
|
//------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
OGridControlModel::OGridControlModel(const Reference<XMultiServiceFactory>& _rxFactory)
|
2000-09-18 15:33:13 +00:00
|
|
|
:OControlModel(_rxFactory, ::rtl::OUString())
|
2000-11-23 07:48:15 +00:00
|
|
|
,OInterfaceContainer(_rxFactory, m_aMutex, ::getCppuType(static_cast<Reference<XPropertySet>*>(NULL)))
|
2000-09-18 15:33:13 +00:00
|
|
|
,m_aSelectListeners(m_aMutex)
|
|
|
|
,m_aResetListeners(m_aMutex)
|
|
|
|
,m_aDefaultControl(FRM_CONTROL_GRID) // use the old control name for compytibility reasons
|
|
|
|
,m_nFontEvent(0)
|
|
|
|
,m_bEnable(sal_True)
|
|
|
|
,m_bNavigation(sal_True)
|
|
|
|
,m_nBorder(1)
|
|
|
|
,m_bRecordMarker(sal_True)
|
|
|
|
,m_bPrintable(sal_True)
|
|
|
|
,m_bAlwaysShowCursor(sal_False)
|
|
|
|
,m_bDisplaySynchron(sal_True)
|
|
|
|
{
|
|
|
|
DBG_CTOR(OGridControlModel,NULL);
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
m_nClassId = FormComponentType::GRIDCONTROL;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
OGridControlModel::~OGridControlModel()
|
|
|
|
{
|
|
|
|
DBG_DTOR(OGridControlModel,NULL);
|
|
|
|
if (m_nFontEvent)
|
|
|
|
Application::RemoveUserEvent(m_nFontEvent);
|
|
|
|
|
|
|
|
if (!OComponentHelper::rBHelper.bDisposed)
|
|
|
|
{
|
|
|
|
acquire();
|
|
|
|
dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XServiceInfo
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
StringSequence OGridControlModel::getSupportedServiceNames() throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
StringSequence aSupported = OControlModel::getSupportedServiceNames();
|
|
|
|
aSupported.realloc(aSupported.getLength() + 1);
|
|
|
|
|
|
|
|
::rtl::OUString*pArray = aSupported.getArray();
|
|
|
|
pArray[aSupported.getLength()-1] = FRM_SUN_COMPONENT_GRIDCONTROL;
|
|
|
|
return aSupported;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType ) throw (RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Any aReturn = OGridControlModel_BASE::queryInterface(_rType);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if (!aReturn.hasValue())
|
2000-11-23 07:48:15 +00:00
|
|
|
{
|
2000-09-18 15:33:13 +00:00
|
|
|
aReturn = OControlModel::queryAggregation(_rType);
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
if (!aReturn.hasValue())
|
|
|
|
aReturn = OInterfaceContainer::queryInterface(_rType);
|
|
|
|
}
|
2000-09-18 15:33:13 +00:00
|
|
|
return aReturn;
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XChild
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::setParent(const InterfaceRef& Parent) throw(NoSupportException, RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XForm> xForm(m_xParent, UNO_QUERY);
|
|
|
|
Reference<XLoadable> xLoadable(xForm, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xLoadable.is())
|
|
|
|
xLoadable->removeLoadListener(this);
|
|
|
|
|
|
|
|
OControlModel::setParent(Parent);
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
xForm = Reference<XForm> (m_xParent, UNO_QUERY);
|
|
|
|
xLoadable = Reference<XLoadable> (xForm, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xLoadable.is())
|
|
|
|
xLoadable->addLoadListener(this);
|
|
|
|
}
|
2001-01-08 07:15:57 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
Sequence< Type > SAL_CALL OGridControlModel::getTypes( ) throw(RuntimeException)
|
|
|
|
{
|
|
|
|
static Sequence<Type> aTypes;
|
|
|
|
if (!aTypes.getLength())
|
|
|
|
aTypes = concatSequences(OControlModel::getTypes(), OInterfaceContainer::getTypes(), OGridControlModel_BASE::getTypes());
|
|
|
|
return aTypes;
|
|
|
|
}
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
// OComponentHelper
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::disposing()
|
|
|
|
{
|
|
|
|
OControlModel::disposing();
|
|
|
|
OInterfaceContainer::disposing();
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
EventObject aEvt(static_cast<XWeak*>(this));
|
2000-09-18 15:33:13 +00:00
|
|
|
m_aSelectListeners.disposeAndClear(aEvt);
|
|
|
|
m_aResetListeners.disposeAndClear(aEvt);
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XEventListener
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::disposing(const EventObject& e) throw( RuntimeException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
OControlModel::disposing(e);
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XSelectionSupplier
|
2000-09-18 15:33:13 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
sal_Bool SAL_CALL OGridControlModel::select(const Any& rElement) throw(IllegalArgumentException, RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySet> xSel;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (rElement.hasValue() && !::cppu::extractInterface(xSel, rElement))
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
throw IllegalArgumentException();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
2000-11-23 07:48:15 +00:00
|
|
|
InterfaceRef xMe = static_cast<XWeak*>(this);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if (xSel.is())
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XChild> xAsChild(xSel, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (!xAsChild.is() || (xAsChild->getParent() != xMe))
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
throw IllegalArgumentException();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xSel != m_xSelection)
|
|
|
|
{
|
|
|
|
m_xSelection = xSel;
|
2000-11-23 07:48:15 +00:00
|
|
|
EventObject aEvt(xMe);
|
|
|
|
NOTIFY_LISTENERS(m_aSelectListeners, XSelectionChangeListener, selectionChanged, aEvt);
|
2000-09-18 15:33:13 +00:00
|
|
|
return sal_True;
|
|
|
|
}
|
2000-11-23 07:48:15 +00:00
|
|
|
return sal_False;
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Any SAL_CALL OGridControlModel::getSelection() throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
return makeAny(m_xSelection);
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::addSelectionChangeListener(const Reference< XSelectionChangeListener >& _rxListener) throw( RuntimeException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
m_aSelectListeners.addInterface(_rxListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::removeSelectionChangeListener(const Reference< XSelectionChangeListener >& _rxListener) throw( RuntimeException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
m_aSelectListeners.removeInterface(_rxListener);
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XGridColumnFactory
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySet> SAL_CALL OGridControlModel::createColumn(const ::rtl::OUString& ColumnType)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
const Sequence< ::rtl::OUString >& rColumnTypes = frm::getColumnTypes();
|
2000-09-18 15:33:13 +00:00
|
|
|
return createColumn(::internal::findPos(ColumnType, rColumnTypes));
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySet> OGridControlModel::createColumn(sal_Int32 nTypeId) const
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySet> xReturn;
|
2000-09-18 15:33:13 +00:00
|
|
|
switch (nTypeId)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
case TYPE_CHECKBOX: xReturn = new CheckBoxColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_COMBOBOX: xReturn = new ComboBoxColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_CURRENCYFIELD: xReturn = new CurrencyFieldColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_DATEFIELD: xReturn = new DateFieldColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_LISTBOX: xReturn = new ListBoxColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_NUMERICFIELD: xReturn = new NumericFieldColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_PATTERNFIELD: xReturn = new PatternFieldColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_TEXTFIELD: xReturn = new TextFieldColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_TIMEFIELD: xReturn = new TimeFieldColumn(OControlModel::m_xServiceFactory); break;
|
|
|
|
case TYPE_FORMATTEDFIELD: xReturn = new FormattedFieldColumn(OControlModel::m_xServiceFactory); break;
|
2000-09-18 15:33:13 +00:00
|
|
|
default:
|
|
|
|
DBG_ERROR("OGridControlModel::createColumn: Unknown Column");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return xReturn;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
StringSequence SAL_CALL OGridControlModel::getColumnTypes()
|
|
|
|
{
|
|
|
|
return frm::getColumnTypes();
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XReset
|
2000-09-18 15:33:13 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void SAL_CALL OGridControlModel::reset()
|
|
|
|
{
|
|
|
|
::cppu::OInterfaceIteratorHelper aIter(m_aResetListeners);
|
2000-11-23 07:48:15 +00:00
|
|
|
EventObject aEvt(static_cast<XWeak*>(this));
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Bool bContinue = sal_True;
|
|
|
|
while (aIter.hasMoreElements() && bContinue)
|
2000-11-23 07:48:15 +00:00
|
|
|
bContinue =((XResetListener*)aIter.next())->approveReset(aEvt);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if (bContinue)
|
|
|
|
{
|
|
|
|
_reset();
|
2000-11-23 07:48:15 +00:00
|
|
|
NOTIFY_LISTENERS(m_aResetListeners, XResetListener, resetted, aEvt);
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::addResetListener(const Reference<XResetListener>& _rxListener)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
m_aResetListeners.addInterface(_rxListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::removeResetListener(const Reference<XResetListener>& _rxListener)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
m_aResetListeners.removeInterface(_rxListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::_reset()
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XReset> xReset;
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Int32 nCount = getCount();
|
|
|
|
for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
getByIndex( nIndex ) >>= xReset;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xReset.is())
|
|
|
|
xReset->reset();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XPropertySet
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySetInfo> SAL_CALL OGridControlModel::getPropertySetInfo() throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySetInfo> xInfo( createPropertySetInfo( getInfoHelper() ) );
|
2000-09-18 15:33:13 +00:00
|
|
|
return xInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
::cppu::IPropertyArrayHelper& OGridControlModel::getInfoHelper()
|
|
|
|
{
|
|
|
|
return *const_cast<OGridControlModel*>(this)->getArrayHelper();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::fillProperties(
|
2000-11-23 07:48:15 +00:00
|
|
|
Sequence< Property >& _rProps,
|
|
|
|
Sequence< Property >& _rAggregateProps ) const
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
BEGIN_AGGREGATION_PROPERTY_HELPER(29, m_xAggregateSet)
|
2000-11-23 07:48:15 +00:00
|
|
|
DECL_PROP1(NAME, ::rtl::OUString, BOUND);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP2(CLASSID, sal_Int16, READONLY, TRANSIENT);
|
2000-11-23 07:48:15 +00:00
|
|
|
DECL_PROP1(TAG, ::rtl::OUString, BOUND);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP1(TABINDEX, sal_Int16, BOUND);
|
|
|
|
DECL_PROP3(TABSTOP, sal_Bool, BOUND, MAYBEDEFAULT, MAYBEVOID);
|
|
|
|
DECL_PROP2(HASNAVIGATION, sal_Bool, BOUND, MAYBEDEFAULT);
|
|
|
|
DECL_PROP1(ENABLED, sal_Bool, BOUND);
|
|
|
|
DECL_PROP1(BORDER, sal_Int16, BOUND);
|
2000-11-23 07:48:15 +00:00
|
|
|
DECL_PROP1(DEFAULTCONTROL, ::rtl::OUString, BOUND);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP3(TEXTCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
|
|
|
|
DECL_PROP3(BACKGROUNDCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
|
2000-11-23 07:48:15 +00:00
|
|
|
DECL_PROP2(FONT, FontDescriptor, BOUND, MAYBEDEFAULT);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP3(ROWHEIGHT, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID);
|
2000-11-23 07:48:15 +00:00
|
|
|
DECL_PROP1(HELPTEXT, ::rtl::OUString, BOUND);
|
|
|
|
DECL_PROP1(FONT_NAME, ::rtl::OUString, MAYBEDEFAULT);
|
|
|
|
DECL_PROP1(FONT_STYLENAME, ::rtl::OUString, MAYBEDEFAULT);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP1(FONT_FAMILY, sal_Int16, MAYBEDEFAULT);
|
|
|
|
DECL_PROP1(FONT_CHARSET, sal_Int16, MAYBEDEFAULT);
|
2001-03-22 15:47:19 +00:00
|
|
|
DECL_PROP1(FONT_HEIGHT, float, MAYBEDEFAULT);
|
|
|
|
DECL_PROP1(FONT_WEIGHT, float, MAYBEDEFAULT);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP1(FONT_SLANT, sal_Int16, MAYBEDEFAULT);
|
|
|
|
DECL_PROP1(FONT_UNDERLINE, sal_Int16, MAYBEDEFAULT);
|
2001-05-11 17:04:43 +00:00
|
|
|
DECL_BOOL_PROP1(FONT_WORDLINEMODE, MAYBEDEFAULT);
|
2000-09-18 15:33:13 +00:00
|
|
|
DECL_PROP1(FONT_STRIKEOUT, sal_Int16, MAYBEDEFAULT);
|
|
|
|
DECL_PROP2(RECORDMARKER, sal_Bool, BOUND, MAYBEDEFAULT );
|
|
|
|
DECL_PROP2(PRINTABLE, sal_Bool, BOUND, MAYBEDEFAULT );
|
|
|
|
DECL_PROP4(CURSORCOLOR, sal_Int32, BOUND, MAYBEDEFAULT, MAYBEVOID , TRANSIENT);
|
|
|
|
DECL_PROP3(ALWAYSSHOWCURSOR, sal_Bool, BOUND, MAYBEDEFAULT, TRANSIENT);
|
|
|
|
DECL_PROP3(DISPLAYSYNCHRON, sal_Bool, BOUND, MAYBEDEFAULT, TRANSIENT);
|
2001-05-11 17:04:43 +00:00
|
|
|
DECL_PROP2(HELPURL, ::rtl::OUString, BOUND, MAYBEDEFAULT);
|
2000-09-18 15:33:13 +00:00
|
|
|
END_AGGREGATION_PROPERTY_HELPER();
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
2001-04-09 10:09:57 +00:00
|
|
|
case PROPERTY_ID_HELPTEXT:
|
|
|
|
rValue <<= m_sHelpText;
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_HELPURL:
|
|
|
|
rValue <<= m_sHelpURL;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DISPLAYSYNCHRON:
|
|
|
|
setBOOL(rValue, m_bDisplaySynchron);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ALWAYSSHOWCURSOR:
|
|
|
|
setBOOL(rValue, m_bAlwaysShowCursor);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_CURSORCOLOR:
|
|
|
|
rValue = m_aCursorColor;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_PRINTABLE:
|
|
|
|
setBOOL(rValue, m_bPrintable);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TABSTOP:
|
|
|
|
rValue = m_aTabStop;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_HASNAVIGATION:
|
|
|
|
setBOOL(rValue, m_bNavigation);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_RECORDMARKER:
|
|
|
|
setBOOL(rValue, m_bRecordMarker);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ENABLED:
|
|
|
|
setBOOL(rValue, m_bEnable);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BORDER:
|
|
|
|
rValue <<= (sal_Int16)m_nBorder;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DEFAULTCONTROL:
|
|
|
|
rValue <<= m_aDefaultControl;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TEXTCOLOR:
|
|
|
|
rValue = m_aTextColor;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BACKGROUNDCOLOR:
|
|
|
|
rValue = m_aBackgroundColor;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT:
|
2000-11-23 07:48:15 +00:00
|
|
|
rValue = makeAny(m_aFont);
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ROWHEIGHT:
|
|
|
|
rValue = m_aRowHeight;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_NAME:
|
|
|
|
rValue <<= m_aFont.Name;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
|
|
|
rValue <<= m_aFont.StyleName;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
rValue <<= (sal_Int16)m_aFont.Family;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
rValue <<= (sal_Int16)m_aFont.CharSet;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
|
|
|
rValue <<= (float)(m_aFont.Height);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
|
|
|
rValue <<= (float)m_aFont.Weight;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
2000-11-23 07:48:15 +00:00
|
|
|
rValue = makeAny(m_aFont.Slant);
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
rValue <<= (sal_Int16)m_aFont.Underline;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
|
|
|
rValue <<= (sal_Int16)m_aFont.Strikeout;
|
|
|
|
break;
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
|
|
|
rValue = ::cppu::bool2any(m_aFont.WordLineMode);
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
default:
|
|
|
|
OControlModel::getFastPropertyValue(rValue, nHandle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
sal_Bool OGridControlModel::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue,
|
|
|
|
sal_Int32 nHandle, const Any& rValue )throw( IllegalArgumentException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
sal_Bool bModified(sal_False);
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
2001-04-09 10:09:57 +00:00
|
|
|
case PROPERTY_ID_HELPTEXT:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sHelpText);
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_HELPURL:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sHelpURL);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DISPLAYSYNCHRON:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bDisplaySynchron);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ALWAYSSHOWCURSOR:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAlwaysShowCursor);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_CURSORCOLOR:
|
|
|
|
if (!rValue.hasValue() || !m_aCursorColor.hasValue())
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
if (rValue.hasValue() && (TypeClass_LONG != rValue.getValueType().getTypeClass()))
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
throw IllegalArgumentException();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
rOldValue = m_aCursorColor;
|
|
|
|
rConvertedValue = rValue;
|
|
|
|
bModified = (rOldValue.getValue() != rConvertedValue.getValue());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getINT32(m_aCursorColor));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_PRINTABLE:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bPrintable);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TABSTOP:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTabStop, ::getBooleanCppuType());
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_HASNAVIGATION:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bNavigation);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_RECORDMARKER:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bRecordMarker);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ENABLED:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEnable);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BORDER:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nBorder);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DEFAULTCONTROL:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultControl);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TEXTCOLOR:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTextColor, ::getCppuType((const sal_Int32*)NULL));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BACKGROUNDCOLOR:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aBackgroundColor, ::getCppuType((const sal_Int32*)NULL));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT:
|
2000-11-23 07:48:15 +00:00
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, makeAny(m_aFont), ::getCppuType((const FontDescriptor*)NULL));
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ROWHEIGHT:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aRowHeight, ::getCppuType((const sal_Int32*)NULL));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_NAME:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.Name);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.StyleName);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.Family);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.CharSet);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, float(m_aFont.Height));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.Weight);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aFont.Slant);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.Underline);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Int16)m_aFont.Strikeout);
|
|
|
|
break;
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
|
|
|
bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, (sal_Bool)m_aFont.WordLineMode);
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
default:
|
|
|
|
bModified = OControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue);
|
|
|
|
}
|
|
|
|
return bModified;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
2001-04-09 10:09:57 +00:00
|
|
|
case PROPERTY_ID_HELPTEXT:
|
|
|
|
rValue >>= m_sHelpText;
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_HELPURL:
|
|
|
|
rValue >>= m_sHelpURL;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DISPLAYSYNCHRON:
|
|
|
|
m_bDisplaySynchron = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ALWAYSSHOWCURSOR:
|
|
|
|
m_bAlwaysShowCursor = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_CURSORCOLOR:
|
|
|
|
m_aCursorColor = rValue;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_PRINTABLE:
|
|
|
|
m_bPrintable = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TABSTOP:
|
|
|
|
m_aTabStop = rValue;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_HASNAVIGATION:
|
|
|
|
m_bNavigation = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ENABLED:
|
|
|
|
m_bEnable = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_RECORDMARKER:
|
|
|
|
m_bRecordMarker = getBOOL(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BORDER:
|
|
|
|
rValue >>= m_nBorder;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DEFAULTCONTROL:
|
|
|
|
rValue >>= m_aDefaultControl;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TEXTCOLOR:
|
|
|
|
m_aTextColor = rValue;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BACKGROUNDCOLOR:
|
|
|
|
m_aBackgroundColor = rValue;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT:
|
|
|
|
rValue >>= m_aFont;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_NAME:
|
|
|
|
rValue >>= m_aFont.Name;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
|
|
|
rValue >>= m_aFont.StyleName;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
m_aFont.Family = getINT16(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
m_aFont.CharSet = getINT16(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
|
|
|
m_aFont.Height = sal_Int16(getFloat(rValue));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
|
|
|
rValue >>= m_aFont.Weight;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
|
|
|
rValue >>= m_aFont.Slant;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
m_aFont.Underline = getINT16(rValue);
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
|
|
|
m_aFont.Strikeout = getINT16(rValue);
|
|
|
|
break;
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
|
|
|
m_aFont.WordLineMode = getBOOL(rValue);
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_ROWHEIGHT:
|
|
|
|
m_aRowHeight = rValue;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
OControlModel::setFastPropertyValue_NoBroadcast(nHandle, rValue );
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_FONT:
|
|
|
|
if (m_nFontEvent)
|
|
|
|
{
|
|
|
|
Application::RemoveUserEvent(m_nFontEvent);
|
|
|
|
m_nFontEvent = 0;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_NAME:
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
2000-09-18 15:33:13 +00:00
|
|
|
if (m_nFontEvent)
|
|
|
|
Application::RemoveUserEvent(m_nFontEvent);
|
|
|
|
m_nFontEvent = Application::PostUserEvent( LINK(this, OGridControlModel, OnFontChanged) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
IMPL_LINK( OGridControlModel, OnFontChanged, void*, EMPTYARG )
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Any aOldVal;
|
2000-09-18 15:33:13 +00:00
|
|
|
aOldVal >>= m_aOldFont;
|
2000-11-23 07:48:15 +00:00
|
|
|
Any aNewVal;
|
2000-09-18 15:33:13 +00:00
|
|
|
aNewVal >>= m_aFont;
|
|
|
|
{
|
|
|
|
::osl::MutexGuard aGuard(m_aMutex);
|
|
|
|
m_nFontEvent = 0;
|
|
|
|
m_aOldFont = m_aFont;
|
|
|
|
}
|
|
|
|
firePropertyChange(PROPERTY_ID_FONT, aNewVal, aOldVal);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
//XPropertyState
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
PropertyState OGridControlModel::getPropertyStateByHandle(sal_Int32 nHandle)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
PropertyState eState(PropertyState_DIRECT_VALUE);
|
2000-09-18 15:33:13 +00:00
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_HELPURL:
|
|
|
|
if (m_sHelpURL.getLength() == 0)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_DISPLAYSYNCHRON:
|
|
|
|
if (m_bDisplaySynchron)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_ALWAYSSHOWCURSOR:
|
|
|
|
if (!m_bAlwaysShowCursor)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_CURSORCOLOR:
|
|
|
|
if (!m_aCursorColor.hasValue())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_PRINTABLE:
|
|
|
|
if (m_bPrintable)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_HASNAVIGATION:
|
|
|
|
if (m_bNavigation)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_RECORDMARKER:
|
|
|
|
if (m_bRecordMarker)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TABSTOP:
|
|
|
|
if (!m_aTabStop.hasValue())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TEXTCOLOR:
|
|
|
|
if (!m_aTextColor.hasValue())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_BACKGROUNDCOLOR:
|
|
|
|
if (!m_aBackgroundColor.hasValue())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_NAME:
|
2001-05-11 08:33:55 +00:00
|
|
|
if (!m_aFont.Name.getLength())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
2001-05-11 08:33:55 +00:00
|
|
|
if (!m_aFont.StyleName.getLength())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
if (!m_aFont.Family)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
if (!m_aFont.CharSet)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
|
|
|
if (!m_aFont.Height)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
|
|
|
if (!m_aFont.Weight)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
2000-11-23 07:48:15 +00:00
|
|
|
if (m_aFont.Slant == FontSlant_NONE)
|
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
if (!m_aFont.Underline)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
|
|
|
if (!m_aFont.Strikeout)
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
|
|
|
if (!m_aFont.WordLineMode)
|
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_ROWHEIGHT:
|
|
|
|
if (!m_aRowHeight.hasValue())
|
2000-11-23 07:48:15 +00:00
|
|
|
eState = PropertyState_DEFAULT_VALUE;
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
eState = OControlModel::getPropertyStateByHandle(nHandle);
|
|
|
|
}
|
|
|
|
return eState;
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::setPropertyToDefaultByHandle(sal_Int32 nHandle)
|
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_ALWAYSSHOWCURSOR:
|
|
|
|
setFastPropertyValue(nHandle, makeBoolAny(sal_False));
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_PRINTABLE:
|
|
|
|
case PROPERTY_ID_HASNAVIGATION:
|
|
|
|
case PROPERTY_ID_RECORDMARKER:
|
|
|
|
case PROPERTY_ID_DISPLAYSYNCHRON:
|
|
|
|
setFastPropertyValue(nHandle, makeBoolAny(sal_True));
|
|
|
|
break;
|
|
|
|
case PROPERTY_ID_TABSTOP:
|
|
|
|
case PROPERTY_ID_TEXTCOLOR:
|
|
|
|
case PROPERTY_ID_BACKGROUNDCOLOR:
|
|
|
|
case PROPERTY_ID_ROWHEIGHT:
|
|
|
|
case PROPERTY_ID_CURSORCOLOR:
|
2000-11-23 07:48:15 +00:00
|
|
|
setFastPropertyValue(nHandle, Any());
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_HELPURL:
|
|
|
|
case PROPERTY_ID_FONT_NAME:
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
2000-11-23 07:48:15 +00:00
|
|
|
setFastPropertyValue(nHandle, makeAny(::rtl::OUString()));
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Any aVal;
|
2000-09-18 15:33:13 +00:00
|
|
|
aVal <<= (sal_Int16)0;
|
|
|
|
setFastPropertyValue(nHandle, aVal);
|
|
|
|
} break;
|
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
2000-11-23 07:48:15 +00:00
|
|
|
setFastPropertyValue(nHandle, makeAny((float)0));
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
2000-11-23 07:48:15 +00:00
|
|
|
setFastPropertyValue(nHandle, makeAny((float)0));
|
2000-09-18 15:33:13 +00:00
|
|
|
break;
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
|
|
|
setFastPropertyValue(nHandle, ::cppu::bool2any(sal_False));
|
|
|
|
break;
|
2000-09-18 15:33:13 +00:00
|
|
|
default:
|
|
|
|
OControlModel::setPropertyToDefaultByHandle(nHandle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
switch (nHandle)
|
|
|
|
{
|
|
|
|
case PROPERTY_ID_PRINTABLE:
|
|
|
|
case PROPERTY_ID_HASNAVIGATION:
|
|
|
|
case PROPERTY_ID_RECORDMARKER:
|
|
|
|
return makeBoolAny(sal_True);
|
|
|
|
case PROPERTY_ID_TABSTOP:
|
|
|
|
case PROPERTY_ID_TEXTCOLOR:
|
|
|
|
case PROPERTY_ID_BACKGROUNDCOLOR:
|
|
|
|
case PROPERTY_ID_ROWHEIGHT:
|
2000-11-23 07:48:15 +00:00
|
|
|
return Any();
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_FONT_NAME:
|
|
|
|
case PROPERTY_ID_FONT_STYLENAME:
|
2000-11-23 07:48:15 +00:00
|
|
|
return makeAny(::rtl::OUString());
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_FONT_FAMILY:
|
|
|
|
case PROPERTY_ID_FONT_CHARSET:
|
|
|
|
case PROPERTY_ID_FONT_SLANT:
|
|
|
|
case PROPERTY_ID_FONT_UNDERLINE:
|
|
|
|
case PROPERTY_ID_FONT_STRIKEOUT:
|
2000-11-23 07:48:15 +00:00
|
|
|
return makeAny((sal_Int16)0);
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_FONT_HEIGHT:
|
2000-11-23 07:48:15 +00:00
|
|
|
return makeAny((float)0);
|
2000-09-18 15:33:13 +00:00
|
|
|
case PROPERTY_ID_FONT_WEIGHT:
|
2000-11-23 07:48:15 +00:00
|
|
|
return makeAny((float)0);
|
2001-05-11 17:04:43 +00:00
|
|
|
case PROPERTY_ID_FONT_WORDLINEMODE:
|
|
|
|
return ::cppu::bool2any(sal_False);
|
2000-09-18 15:33:13 +00:00
|
|
|
default:
|
|
|
|
return OControlModel::getPropertyDefaultByHandle(nHandle);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XLoadListener
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::loaded(const EventObject& rEvent) throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XLoadListener> xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Int32 nCount = getCount();
|
|
|
|
for (sal_Int32 nIndex=0; nIndex < nCount; ++nIndex)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
getByIndex(nIndex) >>= xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xListener.is())
|
|
|
|
xListener->loaded(rEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::unloaded(const EventObject& rEvent) throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XLoadListener> xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Int32 nCount = getCount();
|
|
|
|
for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
getByIndex(nIndex) >>= xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xListener.is())
|
|
|
|
xListener->unloaded(rEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::reloading(const EventObject& rEvent) throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XLoadListener> xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Int32 nCount = getCount();
|
|
|
|
for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
getByIndex(nIndex) >>= xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xListener.is())
|
|
|
|
xListener->reloading(rEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::unloading(const EventObject& rEvent) throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XLoadListener> xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Int32 nCount = getCount();
|
|
|
|
for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
getByIndex(nIndex) >>= xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xListener.is())
|
|
|
|
xListener->unloading(rEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void SAL_CALL OGridControlModel::reloaded(const EventObject& rEvent) throw(RuntimeException)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XLoadListener> xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
sal_Int32 nCount = getCount();
|
|
|
|
for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
getByIndex(nIndex) >>= xListener;
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xListener.is())
|
|
|
|
xListener->reloaded(rEvent);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
OGridColumn* OGridControlModel::getColumnImplementation(const InterfaceRef& _rxIFace) const
|
|
|
|
{
|
|
|
|
OGridColumn* pImplementation = NULL;
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XUnoTunnel> xUnoTunnel(_rxIFace, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xUnoTunnel.is())
|
|
|
|
pImplementation = reinterpret_cast<OGridColumn*>(xUnoTunnel->getSomething(OGridColumn::getUnoTunnelImplementationId()));
|
|
|
|
|
|
|
|
return pImplementation;
|
|
|
|
}
|
|
|
|
|
2000-12-19 16:12:27 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::implRemoved(const InterfaceRef& _rxObject)
|
|
|
|
{
|
|
|
|
OInterfaceContainer::implRemoved(_rxObject);
|
|
|
|
|
|
|
|
if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxObject, UNO_QUERY).get())
|
|
|
|
{ // the currently selected element was replaced
|
|
|
|
m_xSelection.clear();
|
2000-12-19 16:14:16 +00:00
|
|
|
EventObject aEvt(static_cast<XWeak*>(this));
|
|
|
|
NOTIFY_LISTENERS(m_aSelectListeners, XSelectionChangeListener, selectionChanged, aEvt);
|
2000-12-19 16:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::implInserted(const InterfaceRef& _rxObject)
|
|
|
|
{
|
|
|
|
OInterfaceContainer::implInserted(_rxObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
void OGridControlModel::implReplaced(const InterfaceRef& _rxReplacedObject, const InterfaceRef& _rxNewObject)
|
|
|
|
{
|
|
|
|
OInterfaceContainer::implReplaced(_rxReplacedObject, _rxNewObject);
|
|
|
|
|
|
|
|
if (Reference<XInterface>(m_xSelection, UNO_QUERY).get() == Reference<XInterface>(_rxReplacedObject, UNO_QUERY).get())
|
|
|
|
{ // the currently selected element was replaced
|
|
|
|
m_xSelection.clear();
|
2000-12-19 16:14:16 +00:00
|
|
|
EventObject aEvt(static_cast<XWeak*>(this));
|
|
|
|
NOTIFY_LISTENERS(m_aSelectListeners, XSelectionChangeListener, selectionChanged, aEvt);
|
2000-12-19 16:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::insert(sal_Int32 _nIndex, const InterfaceRef& xElement, sal_Bool bEvents) throw( IllegalArgumentException )
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
OGridColumn* pCol = getColumnImplementation(xElement);
|
|
|
|
if (!pCol)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
throw IllegalArgumentException();
|
2000-09-18 15:33:13 +00:00
|
|
|
}
|
|
|
|
OInterfaceContainer::insert(_nIndex, xElement, bEvents);
|
|
|
|
}
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// XPersistObject
|
2000-09-18 15:33:13 +00:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
::rtl::OUString SAL_CALL OGridControlModel::getServiceName()
|
|
|
|
{
|
|
|
|
return FRM_COMPONENT_GRID; // old (non-sun) name for compatibility !
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
OControlModel::write(_rxOutStream);
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XMarkableStream> xMark(_rxOutStream, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
// 1. Version
|
|
|
|
_rxOutStream->writeShort(0x0008);
|
|
|
|
|
|
|
|
// 2. Columns
|
|
|
|
sal_Int32 nLen = getCount();
|
|
|
|
_rxOutStream->writeLong(nLen);
|
|
|
|
OGridColumn* pCol;
|
|
|
|
for (sal_Int32 i = 0; i < nLen; i++)
|
|
|
|
{
|
|
|
|
// zuerst den Servicenamen fuer das darunterliegende Model
|
|
|
|
pCol = getColumnImplementation(m_aItems[i]);
|
|
|
|
DBG_ASSERT(pCol != NULL, "OGridControlModel::write : such items should never reach it into my container !");
|
|
|
|
|
|
|
|
_rxOutStream << pCol->getModelName();
|
|
|
|
|
|
|
|
// dann das Object selbst
|
|
|
|
sal_Int32 nMark = xMark->createMark();
|
|
|
|
sal_Int32 nObjLen = 0;
|
|
|
|
_rxOutStream->writeLong(nObjLen);
|
|
|
|
|
|
|
|
// schreiben der Col
|
|
|
|
pCol->write(_rxOutStream);
|
|
|
|
|
|
|
|
// feststellen der Laenge
|
|
|
|
nObjLen = xMark->offsetToMark(nMark) - 4;
|
|
|
|
xMark->jumpToMark(nMark);
|
|
|
|
_rxOutStream->writeLong(nObjLen);
|
|
|
|
xMark->jumpToFurthest();
|
|
|
|
xMark->deleteMark(nMark);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 3. Events
|
|
|
|
writeEvents(_rxOutStream);
|
|
|
|
|
|
|
|
// 4. Attribute
|
|
|
|
// Maskierung fuer alle any Typen
|
|
|
|
sal_uInt16 nAnyMask = 0;
|
2000-11-23 07:48:15 +00:00
|
|
|
if (m_aRowHeight.getValueType().getTypeClass() == TypeClass_LONG)
|
2000-09-18 15:33:13 +00:00
|
|
|
nAnyMask |= ROWHEIGHT;
|
|
|
|
if (!(m_aFont == getDefaultFont())) // have no !=, only a ==
|
|
|
|
nAnyMask |= FONTATTRIBS | FONTSIZE | FONTTYPE | FONTDESCRIPTOR;
|
2000-11-23 07:48:15 +00:00
|
|
|
if (m_aTabStop.getValueType().getTypeClass() == TypeClass_BOOLEAN)
|
2000-09-18 15:33:13 +00:00
|
|
|
nAnyMask |= TABSTOP;
|
2000-11-23 07:48:15 +00:00
|
|
|
if (m_aTextColor.getValueType().getTypeClass() == TypeClass_LONG)
|
2000-09-18 15:33:13 +00:00
|
|
|
nAnyMask |= TEXTCOLOR;
|
2000-11-23 07:48:15 +00:00
|
|
|
if (m_aBackgroundColor.getValueType().getTypeClass() == TypeClass_LONG)
|
2000-09-18 15:33:13 +00:00
|
|
|
nAnyMask |= BACKGROUNDCOLOR;
|
|
|
|
if (!m_bRecordMarker)
|
|
|
|
nAnyMask |= RECORDMARKER;
|
|
|
|
|
|
|
|
_rxOutStream->writeShort(nAnyMask);
|
|
|
|
|
|
|
|
if (nAnyMask & ROWHEIGHT)
|
|
|
|
_rxOutStream->writeLong(getINT32(m_aRowHeight));
|
|
|
|
|
|
|
|
// alte Structuren
|
|
|
|
if (nAnyMask & FONTDESCRIPTOR)
|
|
|
|
{
|
|
|
|
// Attrib
|
|
|
|
_rxOutStream->writeShort( VCLUnoHelper::ConvertFontWeight( m_aFont.Weight ) );
|
|
|
|
_rxOutStream->writeShort( m_aFont.Slant );
|
|
|
|
_rxOutStream->writeShort( m_aFont.Underline );
|
|
|
|
_rxOutStream->writeShort( m_aFont.Strikeout );
|
|
|
|
_rxOutStream->writeShort( m_aFont.Orientation * 10 );
|
|
|
|
_rxOutStream->writeBoolean( m_aFont.Kerning );
|
|
|
|
_rxOutStream->writeBoolean( m_aFont.WordLineMode );
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
// Size
|
2000-09-18 15:33:13 +00:00
|
|
|
_rxOutStream->writeLong( m_aFont.Width );
|
|
|
|
_rxOutStream->writeLong( m_aFont.Height );
|
|
|
|
_rxOutStream->writeShort( VCLUnoHelper::ConvertFontWidth( m_aFont.CharacterWidth ) );
|
|
|
|
|
|
|
|
// Type
|
|
|
|
_rxOutStream->writeUTF( m_aFont.Name );
|
|
|
|
_rxOutStream->writeUTF( m_aFont.StyleName );
|
|
|
|
_rxOutStream->writeShort( m_aFont.Family );
|
|
|
|
_rxOutStream->writeShort( m_aFont.CharSet );
|
|
|
|
_rxOutStream->writeShort( m_aFont.Pitch );
|
|
|
|
}
|
|
|
|
|
|
|
|
_rxOutStream << m_aDefaultControl;
|
|
|
|
_rxOutStream->writeShort(m_nBorder);
|
|
|
|
_rxOutStream->writeBoolean(m_bEnable);
|
|
|
|
|
|
|
|
if (nAnyMask & TABSTOP)
|
|
|
|
_rxOutStream->writeBoolean(getBOOL(m_aTabStop));
|
|
|
|
|
|
|
|
_rxOutStream->writeBoolean(m_bNavigation);
|
|
|
|
|
|
|
|
if (nAnyMask & TEXTCOLOR)
|
|
|
|
_rxOutStream->writeLong(getINT32(m_aTextColor));
|
|
|
|
|
|
|
|
// neu ab Version 6
|
2001-04-02 09:28:06 +00:00
|
|
|
_rxOutStream << m_sHelpText;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if (nAnyMask & FONTDESCRIPTOR)
|
|
|
|
_rxOutStream << m_aFont;
|
|
|
|
|
|
|
|
if (nAnyMask & RECORDMARKER)
|
|
|
|
_rxOutStream->writeBoolean(m_bRecordMarker);
|
|
|
|
|
|
|
|
// neu ab Version 7
|
|
|
|
_rxOutStream->writeBoolean(m_bPrintable);
|
|
|
|
|
|
|
|
// new since 8
|
|
|
|
if (nAnyMask & BACKGROUNDCOLOR)
|
|
|
|
_rxOutStream->writeLong(getINT32(m_aBackgroundColor));
|
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------
|
2000-11-23 07:48:15 +00:00
|
|
|
void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream)
|
2000-09-18 15:33:13 +00:00
|
|
|
{
|
|
|
|
OControlModel::read(_rxInStream);
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XMarkableStream> xMark(_rxInStream, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
// 1. Version
|
|
|
|
sal_Int16 nVersion = _rxInStream->readShort();
|
|
|
|
|
|
|
|
// 2. Einlesen der Spalten
|
|
|
|
sal_Int32 nLen = _rxInStream->readLong();
|
|
|
|
if (nLen)
|
|
|
|
{
|
|
|
|
for (sal_Int32 i = 0; i < nLen; i++)
|
|
|
|
{
|
|
|
|
// Lesen des Modelnamen
|
|
|
|
|
|
|
|
::rtl::OUString sModelName;
|
|
|
|
_rxInStream >> sModelName;
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPropertySet> xCol(createColumn(getColumnTypeByModelName(sModelName)));
|
2000-09-18 15:33:13 +00:00
|
|
|
DBG_ASSERT(xCol.is(), "OGridControlModel::read : unknown column type !");
|
|
|
|
sal_Int32 nObjLen = _rxInStream->readLong();
|
|
|
|
if (nObjLen)
|
|
|
|
{
|
|
|
|
sal_Int32 nMark = xMark->createMark();
|
|
|
|
if (xCol.is())
|
|
|
|
{
|
|
|
|
OGridColumn* pCol = getColumnImplementation(xCol);
|
|
|
|
pCol->read(_rxInStream);
|
|
|
|
}
|
|
|
|
xMark->jumpToMark(nMark);
|
|
|
|
_rxInStream->skipBytes(nObjLen);
|
|
|
|
xMark->deleteMark(nMark);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xCol.is())
|
|
|
|
insert(i, xCol, sal_False);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// In der Basisimplementierung werden die Events nur gelesen, Elemente im Container existieren
|
|
|
|
// da aber vor TF_ONE fuer das GridControl immer Events geschrieben wurden, muessen sie auch immer
|
|
|
|
// mit gelesen werden
|
|
|
|
sal_Int32 nObjLen = _rxInStream->readLong();
|
|
|
|
if (nObjLen)
|
|
|
|
{
|
|
|
|
sal_Int32 nMark = xMark->createMark();
|
2000-11-23 07:48:15 +00:00
|
|
|
Reference<XPersistObject> xObj(m_xEventAttacher, UNO_QUERY);
|
2000-09-18 15:33:13 +00:00
|
|
|
if (xObj.is())
|
|
|
|
xObj->read(_rxInStream);
|
|
|
|
xMark->jumpToMark(nMark);
|
|
|
|
_rxInStream->skipBytes(nObjLen);
|
|
|
|
xMark->deleteMark(nMark);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Attachement lesen
|
|
|
|
for (sal_Int32 i = 0; i < nLen; i++)
|
|
|
|
{
|
2000-11-23 07:48:15 +00:00
|
|
|
InterfaceRef xIfc(m_aItems[i], UNO_QUERY);
|
|
|
|
Reference<XPropertySet> xSet(xIfc, UNO_QUERY);
|
|
|
|
Any aHelper;
|
2000-09-18 15:33:13 +00:00
|
|
|
aHelper <<= xSet;
|
|
|
|
m_xEventAttacher->attach( i, xIfc, aHelper );
|
|
|
|
}
|
|
|
|
|
|
|
|
// 4. Einlesen der Attribute
|
|
|
|
if (nVersion == 1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Maskierung fuer any
|
|
|
|
sal_uInt16 nAnyMask = _rxInStream->readShort();
|
|
|
|
|
|
|
|
if (nAnyMask & ROWHEIGHT)
|
|
|
|
{
|
|
|
|
sal_Int32 nValue = _rxInStream->readLong();
|
|
|
|
m_aRowHeight <<= (sal_Int32)nValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nAnyMask & FONTATTRIBS)
|
|
|
|
{
|
|
|
|
m_aFont.Weight = VCLUnoHelper::ConvertFontWeight( _rxInStream->readShort() );
|
|
|
|
|
2000-11-23 07:48:15 +00:00
|
|
|
m_aFont.Slant = (FontSlant)_rxInStream->readShort();
|
2000-09-18 15:33:13 +00:00
|
|
|
m_aFont.Underline = _rxInStream->readShort();
|
|
|
|
m_aFont.Strikeout = _rxInStream->readShort();
|
|
|
|
m_aFont.Orientation = ( (double)_rxInStream->readShort() ) / 10;
|
|
|
|
m_aFont.Kerning = _rxInStream->readBoolean();
|
|
|
|
m_aFont.WordLineMode = _rxInStream->readBoolean();
|
|
|
|
}
|
|
|
|
if (nAnyMask & FONTSIZE)
|
|
|
|
{
|
|
|
|
m_aFont.Width = _rxInStream->readLong();
|
|
|
|
m_aFont.Height = _rxInStream->readLong();
|
|
|
|
m_aFont.CharacterWidth = VCLUnoHelper::ConvertFontWidth( _rxInStream->readShort() );
|
|
|
|
}
|
|
|
|
if (nAnyMask & FONTTYPE)
|
|
|
|
{
|
|
|
|
m_aFont.Name = _rxInStream->readUTF();
|
|
|
|
m_aFont.StyleName = _rxInStream->readUTF();
|
|
|
|
m_aFont.Family = _rxInStream->readShort();
|
|
|
|
m_aFont.CharSet = _rxInStream->readShort();
|
|
|
|
m_aFont.Pitch = _rxInStream->readShort();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Name
|
|
|
|
_rxInStream >> m_aDefaultControl;
|
|
|
|
m_nBorder = _rxInStream->readShort();
|
|
|
|
m_bEnable = _rxInStream->readBoolean();
|
|
|
|
|
|
|
|
if (nAnyMask & TABSTOP)
|
|
|
|
{
|
|
|
|
m_aTabStop = makeBoolAny(_rxInStream->readBoolean());
|
|
|
|
}
|
|
|
|
|
|
|
|
if (nVersion > 3)
|
|
|
|
m_bNavigation = _rxInStream->readBoolean();
|
|
|
|
|
|
|
|
if (nAnyMask & TEXTCOLOR)
|
|
|
|
{
|
|
|
|
sal_Int32 nValue = _rxInStream->readLong();
|
|
|
|
m_aTextColor <<= (sal_Int32)nValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// neu ab Version 6
|
|
|
|
if (nVersion > 5)
|
2001-04-02 09:28:06 +00:00
|
|
|
_rxInStream >> m_sHelpText;
|
2000-09-18 15:33:13 +00:00
|
|
|
|
|
|
|
if (nAnyMask & FONTDESCRIPTOR)
|
|
|
|
{
|
|
|
|
_rxInStream >> m_aFont;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_aOldFont = m_aFont;
|
|
|
|
|
|
|
|
if (nAnyMask & RECORDMARKER)
|
|
|
|
m_bRecordMarker = _rxInStream->readBoolean();
|
|
|
|
|
|
|
|
// neu ab Version 7
|
|
|
|
if (nVersion > 6)
|
|
|
|
m_bPrintable = _rxInStream->readBoolean();
|
|
|
|
|
|
|
|
if (nAnyMask & BACKGROUNDCOLOR)
|
|
|
|
{
|
|
|
|
sal_Int32 nValue = _rxInStream->readLong();
|
|
|
|
m_aBackgroundColor <<= (sal_Int32)nValue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//.........................................................................
|
|
|
|
} // namespace frm
|
|
|
|
//.........................................................................
|
|
|
|
|