Update git submodules
[LibreOffice.git] / forms / source / component / Grid.cxx
blob7b41dec828d8037d33e0d0961124db1eb74fade5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "Columns.hxx"
21 #include "findpos.hxx"
22 #include "Grid.hxx"
23 #include <property.hxx>
24 #include <services.hxx>
25 #include <com/sun/star/beans/PropertyAttribute.hpp>
26 #include <com/sun/star/form/FormComponentType.hpp>
27 #include <com/sun/star/io/XMarkableStream.hpp>
28 #include <com/sun/star/text/WritingMode2.hpp>
29 #include <comphelper/basicio.hxx>
30 #include <comphelper/property.hxx>
31 #include <comphelper/servicehelper.hxx>
32 #include <comphelper/types.hxx>
33 #include <vcl/unohelp.hxx>
34 #include <vcl/svapp.hxx>
35 #include <tools/debug.hxx>
36 #include <comphelper/diagnose_ex.hxx>
38 using namespace ::com::sun::star::uno;
40 namespace frm
42 using namespace ::com::sun::star;
43 using namespace ::com::sun::star::sdb;
44 using namespace ::com::sun::star::sdbc;
45 using namespace ::com::sun::star::beans;
46 using namespace ::com::sun::star::container;
47 using namespace ::com::sun::star::form;
48 using namespace ::com::sun::star::awt;
49 using namespace ::com::sun::star::io;
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::util;
52 using namespace ::com::sun::star::view;
53 namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
54 const sal_uInt16 ROWHEIGHT = 0x0001;
55 const sal_uInt16 FONTTYPE = 0x0002;
56 const sal_uInt16 FONTSIZE = 0x0004;
57 const sal_uInt16 FONTATTRIBS = 0x0008;
58 const sal_uInt16 TABSTOP = 0x0010;
59 const sal_uInt16 TEXTCOLOR = 0x0020;
60 const sal_uInt16 FONTDESCRIPTOR = 0x0040;
61 const sal_uInt16 RECORDMARKER = 0x0080;
62 const sal_uInt16 BACKGROUNDCOLOR = 0x0100;
64 OGridControlModel::OGridControlModel(const Reference<XComponentContext>& _rxFactory)
65 :OControlModel(_rxFactory, OUString())
66 ,OInterfaceContainer(_rxFactory, m_aMutex, cppu::UnoType<XPropertySet>::get())
67 ,OErrorBroadcaster( OComponentHelper::rBHelper )
68 ,FontControlModel( false )
69 ,m_aSelectListeners(m_aMutex)
70 ,m_aResetListeners(m_aMutex)
71 ,m_aRowSetChangeListeners(m_aMutex)
72 ,m_aDefaultControl( FRM_SUN_CONTROL_GRIDCONTROL )
73 ,m_nBorder(1)
74 ,m_nWritingMode( WritingMode2::CONTEXT )
75 ,m_nContextWritingMode( WritingMode2::CONTEXT )
76 ,m_bEnableVisible(true)
77 ,m_bEnable(true)
78 ,m_bNavigation(true)
79 ,m_bRecordMarker(true)
80 ,m_bPrintable(true)
81 ,m_bAlwaysShowCursor(false)
82 ,m_bDisplaySynchron(true)
84 m_nClassId = FormComponentType::GRIDCONTROL;
87 OGridControlModel::OGridControlModel( const OGridControlModel* _pOriginal, const Reference< XComponentContext >& _rxFactory )
88 :OControlModel( _pOriginal, _rxFactory )
89 ,OInterfaceContainer( _rxFactory, m_aMutex, cppu::UnoType<XPropertySet>::get() )
90 ,OErrorBroadcaster( OComponentHelper::rBHelper )
91 ,FontControlModel( _pOriginal )
92 ,m_aSelectListeners( m_aMutex )
93 ,m_aResetListeners( m_aMutex )
94 ,m_aRowSetChangeListeners( m_aMutex )
96 m_aDefaultControl = _pOriginal->m_aDefaultControl;
97 m_bEnable = _pOriginal->m_bEnable;
98 m_bEnableVisible = _pOriginal->m_bEnableVisible;
99 m_bNavigation = _pOriginal->m_bNavigation;
100 m_nBorder = _pOriginal->m_nBorder;
101 m_nWritingMode = _pOriginal->m_nWritingMode;
102 m_nContextWritingMode = _pOriginal->m_nContextWritingMode;
103 m_bRecordMarker = _pOriginal->m_bRecordMarker;
104 m_bPrintable = _pOriginal->m_bPrintable;
105 m_bAlwaysShowCursor = _pOriginal->m_bAlwaysShowCursor;
106 m_bDisplaySynchron = _pOriginal->m_bDisplaySynchron;
107 // clone the columns
108 cloneColumns( _pOriginal );
109 // TODO: clone the events?
112 OGridControlModel::~OGridControlModel()
114 if (!OComponentHelper::rBHelper.bDisposed)
116 acquire();
117 dispose();
121 // XCloneable
122 Reference< XCloneable > SAL_CALL OGridControlModel::createClone( )
124 rtl::Reference<OGridControlModel> pClone = new OGridControlModel( this, getContext() );
125 pClone->OControlModel::clonedFrom( this );
126 // do not call OInterfaceContainer::clonedFrom, it would clone the elements aka columns, which is
127 // already done in the ctor
128 //pClone->OInterfaceContainer::clonedFrom( *this );
129 return static_cast< XCloneable* >( static_cast< OControlModel* >( pClone.get() ) );
132 void OGridControlModel::cloneColumns( const OGridControlModel* _pOriginalContainer )
136 Reference< XCloneable > xColCloneable;
137 sal_Int32 nIndex = 0;
138 for (auto const& column : _pOriginalContainer->m_aItems)
140 // ask the col for a factory for the clone
141 xColCloneable.set(column, css::uno::UNO_QUERY);
142 DBG_ASSERT( xColCloneable.is(), "OGridControlModel::cloneColumns: column is not cloneable!" );
143 if ( xColCloneable.is() )
145 // create a clone of the column
146 Reference< XCloneable > xColClone( xColCloneable->createClone() );
147 DBG_ASSERT( xColClone.is(), "OGridControlModel::cloneColumns: invalid column clone!" );
148 if ( xColClone.is() )
150 // insert this clone into our own container
151 insertByIndex( nIndex, xColClone->queryInterface( m_aElementType ) );
154 ++nIndex;
157 catch( const Exception& )
159 TOOLS_WARN_EXCEPTION( "forms.component", "OGridControlModel::cloneColumns: caught an exception while cloning the columns!" );
163 // XServiceInfo
164 css::uno::Sequence<OUString> OGridControlModel::getSupportedServiceNames()
166 css::uno::Sequence<OUString> aSupported = OControlModel::getSupportedServiceNames();
167 aSupported.realloc(aSupported.getLength() + 4);
168 auto pSupported = aSupported.getArray();
169 pSupported[aSupported.getLength()-4] = "com.sun.star.awt.UnoControlModel";
170 pSupported[aSupported.getLength()-3] = FRM_SUN_COMPONENT_GRIDCONTROL;
171 pSupported[aSupported.getLength()-2] = FRM_COMPONENT_GRID;
172 pSupported[aSupported.getLength()-1] = FRM_COMPONENT_GRIDCONTROL;
173 return aSupported;
175 Any SAL_CALL OGridControlModel::queryAggregation( const Type& _rType )
177 Any aReturn = OGridControlModel_BASE::queryInterface(_rType);
178 if ( !aReturn.hasValue() )
180 aReturn = OControlModel::queryAggregation( _rType );
181 if ( !aReturn.hasValue() )
183 aReturn = OInterfaceContainer::queryInterface( _rType );
184 if ( !aReturn.hasValue() )
185 aReturn = OErrorBroadcaster::queryInterface( _rType );
188 return aReturn;
191 // XSQLErrorListener
192 void SAL_CALL OGridControlModel::errorOccured( const SQLErrorEvent& _rEvent )
194 // forward the errors which happened to my columns to my own listeners
195 onError( _rEvent );
198 // XRowSetSupplier
199 Reference< XRowSet > SAL_CALL OGridControlModel::getRowSet( )
201 return Reference< XRowSet >( getParent(), UNO_QUERY );
204 void SAL_CALL OGridControlModel::setRowSet( const Reference< XRowSet >& /*_rxDataSource*/ )
206 OSL_FAIL( "OGridControlModel::setRowSet: not supported!" );
209 void SAL_CALL OGridControlModel::addRowSetChangeListener( const Reference< XRowSetChangeListener >& i_Listener )
211 if ( i_Listener.is() )
212 m_aRowSetChangeListeners.addInterface( i_Listener );
215 void SAL_CALL OGridControlModel::removeRowSetChangeListener( const Reference< XRowSetChangeListener >& i_Listener )
217 m_aRowSetChangeListeners.removeInterface( i_Listener );
220 // XChild
221 void SAL_CALL OGridControlModel::setParent( const css::uno::Reference<css::uno::XInterface>& i_Parent )
223 ::osl::ClearableMutexGuard aGuard( m_aMutex );
224 if ( i_Parent == getParent() )
225 return;
226 OControlModel::setParent( i_Parent );
227 EventObject aEvent( *this );
228 aGuard.clear();
229 m_aRowSetChangeListeners.notifyEach( &XRowSetChangeListener::onRowSetChanged, aEvent );
231 Sequence< Type > SAL_CALL OGridControlModel::getTypes( )
233 return concatSequences(
234 OControlModel::getTypes(),
235 OInterfaceContainer::getTypes(),
236 OErrorBroadcaster::getTypes(),
237 OGridControlModel_BASE::getTypes()
241 // OComponentHelper
242 void OGridControlModel::disposing()
244 OControlModel::disposing();
245 OErrorBroadcaster::disposing();
246 OInterfaceContainer::disposing();
247 setParent(nullptr);
248 EventObject aEvt(static_cast<XWeak*>(this));
249 m_aSelectListeners.disposeAndClear(aEvt);
250 m_aResetListeners.disposeAndClear(aEvt);
251 m_aRowSetChangeListeners.disposeAndClear(aEvt);
254 // XEventListener
255 void OGridControlModel::disposing(const EventObject& _rEvent)
257 OControlModel::disposing( _rEvent );
258 OInterfaceContainer::disposing( _rEvent );
261 // XSelectionSupplier
262 sal_Bool SAL_CALL OGridControlModel::select(const Any& rElement)
264 ::osl::ClearableMutexGuard aGuard( m_aMutex );
265 Reference<XPropertySet> xSel;
266 if (rElement.hasValue())
268 xSel.set(rElement, css::uno::UNO_QUERY);
269 if (!xSel.is())
271 throw IllegalArgumentException();
274 css::uno::Reference<css::uno::XInterface> xMe = static_cast<XWeak*>(this);
275 if (xSel.is())
277 Reference<XChild> xAsChild(xSel, UNO_QUERY);
278 if (!xAsChild.is() || (xAsChild->getParent() != xMe))
280 throw IllegalArgumentException();
283 if ( xSel != m_xSelection )
285 m_xSelection = std::move(xSel);
286 aGuard.clear();
287 m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, EventObject( *this ) );
288 return true;
290 return false;
292 Any SAL_CALL OGridControlModel::getSelection()
294 return Any(m_xSelection);
297 void OGridControlModel::addSelectionChangeListener(const Reference< XSelectionChangeListener >& _rxListener)
299 m_aSelectListeners.addInterface(_rxListener);
302 void OGridControlModel::removeSelectionChangeListener(const Reference< XSelectionChangeListener >& _rxListener)
304 m_aSelectListeners.removeInterface(_rxListener);
307 // XGridColumnFactory
308 Reference<XPropertySet> SAL_CALL OGridControlModel::createColumn(const OUString& ColumnType)
310 SolarMutexGuard g;
311 const Sequence< OUString >& rColumnTypes = frm::getColumnTypes();
312 return createColumnById( ::detail::findPos( ColumnType, rColumnTypes ) );
314 Reference<XPropertySet> OGridControlModel::createColumnById(sal_Int32 nTypeId) const
316 Reference<XPropertySet> xReturn;
317 switch (nTypeId)
319 case TYPE_CHECKBOX: xReturn = new CheckBoxColumn( getContext() ); break;
320 case TYPE_COMBOBOX: xReturn = new ComboBoxColumn( getContext() ); break;
321 case TYPE_CURRENCYFIELD: xReturn = new CurrencyFieldColumn( getContext() ); break;
322 case TYPE_DATEFIELD: xReturn = new DateFieldColumn( getContext() ); break;
323 case TYPE_LISTBOX: xReturn = new ListBoxColumn( getContext() ); break;
324 case TYPE_NUMERICFIELD: xReturn = new NumericFieldColumn( getContext() ); break;
325 case TYPE_PATTERNFIELD: xReturn = new PatternFieldColumn( getContext() ); break;
326 case TYPE_TEXTFIELD: xReturn = new TextFieldColumn( getContext() ); break;
327 case TYPE_TIMEFIELD: xReturn = new TimeFieldColumn( getContext() ); break;
328 case TYPE_FORMATTEDFIELD: xReturn = new FormattedFieldColumn( getContext() ); break;
329 default:
330 OSL_FAIL("OGridControlModel::createColumn: Unknown Column");
331 break;
333 return xReturn;
335 css::uno::Sequence<OUString> SAL_CALL OGridControlModel::getColumnTypes()
337 return frm::getColumnTypes();
340 // XReset
341 void SAL_CALL OGridControlModel::reset()
343 ::comphelper::OInterfaceIteratorHelper3 aIter(m_aResetListeners);
344 EventObject aEvt(static_cast<XWeak*>(this));
345 bool bContinue = true;
346 while (aIter.hasMoreElements() && bContinue)
347 bContinue = aIter.next()->approveReset(aEvt);
348 if (bContinue)
350 _reset();
351 m_aResetListeners.notifyEach( &XResetListener::resetted, aEvt );
354 void SAL_CALL OGridControlModel::addResetListener(const Reference<XResetListener>& _rxListener)
356 m_aResetListeners.addInterface(_rxListener);
358 void SAL_CALL OGridControlModel::removeResetListener(const Reference<XResetListener>& _rxListener)
360 m_aResetListeners.removeInterface(_rxListener);
362 void OGridControlModel::_reset()
364 Reference<XReset> xReset;
365 sal_Int32 nCount = getCount();
366 for (sal_Int32 nIndex=0; nIndex < nCount; nIndex++)
368 getByIndex( nIndex ) >>= xReset;
369 if (xReset.is())
370 xReset->reset();
374 // XPropertySet
375 void OGridControlModel::describeFixedProperties( Sequence< Property >& _rProps ) const
377 _rProps.realloc(37);
378 css::beans::Property* pProperties = _rProps.getArray();
379 *pProperties++ = css::beans::Property(PROPERTY_NAME, PROPERTY_ID_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
380 *pProperties++ = css::beans::Property(PROPERTY_CLASSID, PROPERTY_ID_CLASSID, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::READONLY | css::beans::PropertyAttribute::TRANSIENT);
381 *pProperties++ = css::beans::Property(PROPERTY_TAG, PROPERTY_ID_TAG, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
382 *pProperties++ = css::beans::Property(PROPERTY_TABINDEX, PROPERTY_ID_TABINDEX, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND);
383 *pProperties++ = css::beans::Property(PROPERTY_TABSTOP, PROPERTY_ID_TABSTOP, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::MAYBEVOID);
384 *pProperties++ = css::beans::Property(PROPERTY_HASNAVIGATION, PROPERTY_ID_HASNAVIGATION, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
385 *pProperties++ = css::beans::Property(PROPERTY_ENABLED, PROPERTY_ID_ENABLED, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND);
386 *pProperties++ = css::beans::Property(PROPERTY_ENABLEVISIBLE, PROPERTY_ID_ENABLEVISIBLE, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
387 *pProperties++ = css::beans::Property(PROPERTY_BORDER, PROPERTY_ID_BORDER, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND);
388 *pProperties++ = css::beans::Property(PROPERTY_BORDERCOLOR, PROPERTY_ID_BORDERCOLOR, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEVOID);
389 *pProperties++ = css::beans::Property(PROPERTY_DEFAULTCONTROL, PROPERTY_ID_DEFAULTCONTROL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
390 *pProperties++ = css::beans::Property(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::MAYBEVOID);
391 *pProperties++ = css::beans::Property(PROPERTY_BACKGROUNDCOLOR, PROPERTY_ID_BACKGROUNDCOLOR, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::MAYBEVOID);
392 *pProperties++ = css::beans::Property(PROPERTY_FONT, PROPERTY_ID_FONT, cppu::UnoType<FontDescriptor>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
393 *pProperties++ = css::beans::Property(PROPERTY_ROWHEIGHT, PROPERTY_ID_ROWHEIGHT, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::MAYBEVOID);
394 *pProperties++ = css::beans::Property(PROPERTY_HELPTEXT, PROPERTY_ID_HELPTEXT, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND);
395 *pProperties++ = css::beans::Property(PROPERTY_FONT_NAME, PROPERTY_ID_FONT_NAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
396 *pProperties++ = css::beans::Property(PROPERTY_FONT_STYLENAME, PROPERTY_ID_FONT_STYLENAME, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
397 *pProperties++ = css::beans::Property(PROPERTY_FONT_FAMILY, PROPERTY_ID_FONT_FAMILY, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
398 *pProperties++ = css::beans::Property(PROPERTY_FONT_CHARSET, PROPERTY_ID_FONT_CHARSET, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
399 *pProperties++ = css::beans::Property(PROPERTY_FONT_HEIGHT, PROPERTY_ID_FONT_HEIGHT, cppu::UnoType<float>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
400 *pProperties++ = css::beans::Property(PROPERTY_FONT_WEIGHT, PROPERTY_ID_FONT_WEIGHT, cppu::UnoType<float>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
401 *pProperties++ = css::beans::Property(PROPERTY_FONT_SLANT, PROPERTY_ID_FONT_SLANT, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
402 *pProperties++ = css::beans::Property(PROPERTY_FONT_UNDERLINE, PROPERTY_ID_FONT_UNDERLINE, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
403 *pProperties++ = css::beans::Property(PROPERTY_FONT_WORDLINEMODE, PROPERTY_ID_FONT_WORDLINEMODE, cppu::UnoType<bool>::get(),
404 css::beans::PropertyAttribute::MAYBEDEFAULT);
405 *pProperties++ = css::beans::Property(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::MAYBEVOID);
406 *pProperties++ = css::beans::Property(PROPERTY_FONTEMPHASISMARK, PROPERTY_ID_FONTEMPHASISMARK, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
407 *pProperties++ = css::beans::Property(PROPERTY_FONTRELIEF, PROPERTY_ID_FONTRELIEF, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
408 *pProperties++ = css::beans::Property(PROPERTY_FONT_STRIKEOUT, PROPERTY_ID_FONT_STRIKEOUT, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::MAYBEDEFAULT);
409 *pProperties++ = css::beans::Property(PROPERTY_RECORDMARKER, PROPERTY_ID_RECORDMARKER, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
410 *pProperties++ = css::beans::Property(PROPERTY_PRINTABLE, PROPERTY_ID_PRINTABLE, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
411 *pProperties++ = css::beans::Property(PROPERTY_CURSORCOLOR, PROPERTY_ID_CURSORCOLOR, cppu::UnoType<sal_Int32>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT |
412 css::beans::PropertyAttribute::MAYBEVOID | css::beans::PropertyAttribute::TRANSIENT);
413 *pProperties++ = css::beans::Property(PROPERTY_ALWAYSSHOWCURSOR, PROPERTY_ID_ALWAYSSHOWCURSOR, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::TRANSIENT);
414 *pProperties++ = css::beans::Property(PROPERTY_DISPLAYSYNCHRON, PROPERTY_ID_DISPLAYSYNCHRON, cppu::UnoType<sal_Bool>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::TRANSIENT);
415 *pProperties++ = css::beans::Property(PROPERTY_HELPURL, PROPERTY_ID_HELPURL, cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
416 *pProperties++ = css::beans::Property(PROPERTY_WRITING_MODE, PROPERTY_ID_WRITING_MODE, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT);
417 *pProperties++ = css::beans::Property(PROPERTY_CONTEXT_WRITING_MODE, PROPERTY_ID_CONTEXT_WRITING_MODE, cppu::UnoType<sal_Int16>::get(), css::beans::PropertyAttribute::BOUND | css::beans::PropertyAttribute::MAYBEDEFAULT | css::beans::PropertyAttribute::TRANSIENT);
418 DBG_ASSERT( pProperties == _rProps.getArray() + _rProps.getLength(), "<...>::describeFixedProperties/getInfoHelper: forgot to adjust the count ?");
420 void OGridControlModel::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const
422 switch (nHandle)
424 case PROPERTY_ID_CONTEXT_WRITING_MODE:
425 rValue <<= m_nContextWritingMode;
426 break;
427 case PROPERTY_ID_WRITING_MODE:
428 rValue <<= m_nWritingMode;
429 break;
430 case PROPERTY_ID_HELPTEXT:
431 rValue <<= m_sHelpText;
432 break;
433 case PROPERTY_ID_HELPURL:
434 rValue <<= m_sHelpURL;
435 break;
436 case PROPERTY_ID_DISPLAYSYNCHRON:
437 rValue <<= m_bDisplaySynchron;
438 break;
439 case PROPERTY_ID_ALWAYSSHOWCURSOR:
440 rValue <<= m_bAlwaysShowCursor;
441 break;
442 case PROPERTY_ID_CURSORCOLOR:
443 rValue = m_aCursorColor;
444 break;
445 case PROPERTY_ID_PRINTABLE:
446 rValue <<= m_bPrintable;
447 break;
448 case PROPERTY_ID_TABSTOP:
449 rValue = m_aTabStop;
450 break;
451 case PROPERTY_ID_HASNAVIGATION:
452 rValue <<= m_bNavigation;
453 break;
454 case PROPERTY_ID_RECORDMARKER:
455 rValue <<= m_bRecordMarker;
456 break;
457 case PROPERTY_ID_ENABLED:
458 rValue <<= m_bEnable;
459 break;
460 case PROPERTY_ID_ENABLEVISIBLE:
461 rValue <<= m_bEnableVisible;
462 break;
463 case PROPERTY_ID_BORDER:
464 rValue <<= m_nBorder;
465 break;
466 case PROPERTY_ID_BORDERCOLOR:
467 rValue = m_aBorderColor;
468 break;
469 case PROPERTY_ID_DEFAULTCONTROL:
470 rValue <<= m_aDefaultControl;
471 break;
472 case PROPERTY_ID_BACKGROUNDCOLOR:
473 rValue = m_aBackgroundColor;
474 break;
475 case PROPERTY_ID_ROWHEIGHT:
476 rValue = m_aRowHeight;
477 break;
478 default:
479 if ( isFontRelatedProperty( nHandle ) )
480 FontControlModel::getFastPropertyValue( rValue, nHandle );
481 else
482 OControlModel::getFastPropertyValue( rValue, nHandle );
486 sal_Bool OGridControlModel::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue,
487 sal_Int32 nHandle, const Any& rValue )
489 bool bModified(false);
490 switch (nHandle)
492 case PROPERTY_ID_CONTEXT_WRITING_MODE:
493 bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_nContextWritingMode );
494 break;
495 case PROPERTY_ID_WRITING_MODE:
496 bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_nWritingMode );
497 break;
498 case PROPERTY_ID_HELPTEXT:
499 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sHelpText);
500 break;
501 case PROPERTY_ID_HELPURL:
502 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_sHelpURL);
503 break;
504 case PROPERTY_ID_DISPLAYSYNCHRON:
505 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bDisplaySynchron);
506 break;
507 case PROPERTY_ID_ALWAYSSHOWCURSOR:
508 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bAlwaysShowCursor);
509 break;
510 case PROPERTY_ID_CURSORCOLOR:
511 if (!rValue.hasValue() || !m_aCursorColor.hasValue())
513 if (rValue.hasValue() && (TypeClass_LONG != rValue.getValueTypeClass()))
515 throw IllegalArgumentException();
517 rOldValue = m_aCursorColor;
518 rConvertedValue = rValue;
519 bModified = rOldValue != rConvertedValue;
521 else
522 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getINT32(m_aCursorColor));
523 break;
524 case PROPERTY_ID_PRINTABLE:
525 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bPrintable);
526 break;
527 case PROPERTY_ID_TABSTOP:
528 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTabStop, cppu::UnoType<bool>::get());
529 break;
530 case PROPERTY_ID_HASNAVIGATION:
531 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bNavigation);
532 break;
533 case PROPERTY_ID_RECORDMARKER:
534 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bRecordMarker);
535 break;
536 case PROPERTY_ID_ENABLED:
537 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEnable);
538 break;
539 case PROPERTY_ID_ENABLEVISIBLE:
540 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_bEnableVisible);
541 break;
542 case PROPERTY_ID_BORDER:
543 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_nBorder);
544 break;
545 case PROPERTY_ID_BORDERCOLOR:
546 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aBorderColor, cppu::UnoType<sal_Int32>::get());
547 break;
548 case PROPERTY_ID_DEFAULTCONTROL:
549 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aDefaultControl);
550 break;
551 case PROPERTY_ID_BACKGROUNDCOLOR:
552 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aBackgroundColor, cppu::UnoType<sal_Int32>::get());
553 break;
554 case PROPERTY_ID_ROWHEIGHT:
556 bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aRowHeight, cppu::UnoType<sal_Int32>::get());
557 sal_Int32 nNewVal( 0 );
558 if ( ( rConvertedValue >>= nNewVal ) && ( nNewVal <= 0 ) )
560 rConvertedValue.clear();
561 bModified = m_aRowHeight.hasValue();
564 break;
565 default:
566 if ( isFontRelatedProperty( nHandle ) )
567 bModified = FontControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue );
568 else
569 bModified = OControlModel::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue);
571 return bModified;
573 void OGridControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue )
575 switch (nHandle)
577 case PROPERTY_ID_CONTEXT_WRITING_MODE:
578 rValue >>= m_nContextWritingMode;
579 break;
580 case PROPERTY_ID_WRITING_MODE:
581 rValue >>= m_nWritingMode;
582 break;
583 case PROPERTY_ID_HELPTEXT:
584 rValue >>= m_sHelpText;
585 break;
586 case PROPERTY_ID_HELPURL:
587 rValue >>= m_sHelpURL;
588 break;
589 case PROPERTY_ID_DISPLAYSYNCHRON:
590 m_bDisplaySynchron = getBOOL(rValue);
591 break;
592 case PROPERTY_ID_ALWAYSSHOWCURSOR:
593 m_bAlwaysShowCursor = getBOOL(rValue);
594 break;
595 case PROPERTY_ID_CURSORCOLOR:
596 m_aCursorColor = rValue;
597 break;
598 case PROPERTY_ID_PRINTABLE:
599 m_bPrintable = getBOOL(rValue);
600 break;
601 case PROPERTY_ID_TABSTOP:
602 m_aTabStop = rValue;
603 break;
604 case PROPERTY_ID_HASNAVIGATION:
605 m_bNavigation = getBOOL(rValue);
606 break;
607 case PROPERTY_ID_ENABLED:
608 m_bEnable = getBOOL(rValue);
609 break;
610 case PROPERTY_ID_ENABLEVISIBLE:
611 m_bEnableVisible = getBOOL(rValue);
612 break;
613 case PROPERTY_ID_RECORDMARKER:
614 m_bRecordMarker = getBOOL(rValue);
615 break;
616 case PROPERTY_ID_BORDER:
617 rValue >>= m_nBorder;
618 break;
619 case PROPERTY_ID_BORDERCOLOR:
620 m_aBorderColor = rValue;
621 break;
622 case PROPERTY_ID_DEFAULTCONTROL:
623 rValue >>= m_aDefaultControl;
624 break;
625 case PROPERTY_ID_BACKGROUNDCOLOR:
626 m_aBackgroundColor = rValue;
627 break;
628 case PROPERTY_ID_ROWHEIGHT:
629 m_aRowHeight = rValue;
630 break;
631 default:
632 if ( isFontRelatedProperty( nHandle ) )
634 FontControlModel::setFastPropertyValue_NoBroadcast_impl(
635 *this, &OGridControlModel::setDependentFastPropertyValue,
636 nHandle, rValue);
638 else
639 OControlModel::setFastPropertyValue_NoBroadcast( nHandle, rValue );
643 //XPropertyState
644 Any OGridControlModel::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
646 Any aReturn;
647 switch (nHandle)
649 case PROPERTY_ID_CONTEXT_WRITING_MODE:
650 case PROPERTY_ID_WRITING_MODE:
651 aReturn <<= WritingMode2::CONTEXT;
652 break;
653 case PROPERTY_ID_DEFAULTCONTROL:
654 aReturn <<= STARDIV_ONE_FORM_CONTROL_GRID;
655 break;
656 case PROPERTY_ID_PRINTABLE:
657 case PROPERTY_ID_HASNAVIGATION:
658 case PROPERTY_ID_RECORDMARKER:
659 case PROPERTY_ID_DISPLAYSYNCHRON:
660 case PROPERTY_ID_ENABLED:
661 case PROPERTY_ID_ENABLEVISIBLE:
662 aReturn <<= true;
663 break;
664 case PROPERTY_ID_ALWAYSSHOWCURSOR:
665 aReturn <<= false;
666 break;
667 case PROPERTY_ID_HELPURL:
668 case PROPERTY_ID_HELPTEXT:
669 aReturn <<= OUString();
670 break;
671 case PROPERTY_ID_BORDER:
672 aReturn <<= sal_Int16(1);
673 break;
674 case PROPERTY_ID_BORDERCOLOR:
675 case PROPERTY_ID_TABSTOP:
676 case PROPERTY_ID_BACKGROUNDCOLOR:
677 case PROPERTY_ID_ROWHEIGHT:
678 case PROPERTY_ID_CURSORCOLOR:
679 // void
680 break;
681 default:
682 if ( isFontRelatedProperty( nHandle ) )
683 aReturn = FontControlModel::getPropertyDefaultByHandle( nHandle );
684 else
685 aReturn = OControlModel::getPropertyDefaultByHandle(nHandle);
687 return aReturn;
690 void OGridControlModel::gotColumn( const Reference< XInterface >& _rxColumn )
692 Reference< XSQLErrorBroadcaster > xBroadcaster( _rxColumn, UNO_QUERY );
693 if ( xBroadcaster.is() )
694 xBroadcaster->addSQLErrorListener( this );
697 void OGridControlModel::lostColumn(const Reference< XInterface >& _rxColumn)
699 if ( m_xSelection == _rxColumn )
700 { // the currently selected element was replaced
701 m_xSelection.clear();
702 EventObject aEvt( static_cast< XWeak* >( this ) );
703 m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, aEvt );
705 Reference< XSQLErrorBroadcaster > xBroadcaster( _rxColumn, UNO_QUERY );
706 if ( xBroadcaster.is() )
707 xBroadcaster->removeSQLErrorListener( this );
710 void OGridControlModel::implRemoved(const css::uno::Reference<css::uno::XInterface>& _rxObject)
712 OInterfaceContainer::implRemoved(_rxObject);
713 lostColumn(_rxObject);
716 void OGridControlModel::implInserted( const ElementDescription* _pElement )
718 OInterfaceContainer::implInserted( _pElement );
719 gotColumn( _pElement->xInterface );
722 void OGridControlModel::impl_replacedElement( const ContainerEvent& _rEvent, ::osl::ClearableMutexGuard& _rInstanceLock )
724 Reference< XInterface > xOldColumn( _rEvent.ReplacedElement, UNO_QUERY );
725 Reference< XInterface > xNewColumn( _rEvent.Element, UNO_QUERY );
726 bool bNewSelection = ( xOldColumn == m_xSelection );
727 lostColumn( xOldColumn );
728 gotColumn( xNewColumn );
729 if ( bNewSelection )
730 m_xSelection.set( xNewColumn, UNO_QUERY );
731 OInterfaceContainer::impl_replacedElement( _rEvent, _rInstanceLock );
732 // < SYNCHRONIZED
733 if ( bNewSelection )
735 m_aSelectListeners.notifyEach( &XSelectionChangeListener::selectionChanged, EventObject( *this ) );
739 ElementDescription* OGridControlModel::createElementMetaData( )
741 return new ElementDescription;
744 void OGridControlModel::approveNewElement( const Reference< XPropertySet >& _rxObject, ElementDescription* _pElement )
746 OGridColumn* pCol = comphelper::getFromUnoTunnel<OGridColumn>( _rxObject );
747 if ( !pCol )
748 throw IllegalArgumentException();
749 OInterfaceContainer::approveNewElement( _rxObject, _pElement );
752 // XPersistObject
753 OUString SAL_CALL OGridControlModel::getServiceName()
755 return FRM_COMPONENT_GRID; // old (non-sun) name for compatibility!
758 void OGridControlModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
760 OControlModel::write(_rxOutStream);
761 Reference<XMarkableStream> xMark(_rxOutStream, UNO_QUERY);
762 // 1. Version
763 _rxOutStream->writeShort(0x0008);
764 // 2. Columns
765 sal_Int32 nLen = getCount();
766 _rxOutStream->writeLong(nLen);
767 for (sal_Int32 i = 0; i < nLen; i++)
769 // first the service name for the underlying model
770 OGridColumn* pCol = comphelper::getFromUnoTunnel<OGridColumn>(m_aItems[i]);
771 assert(pCol != nullptr && "OGridControlModel::write : such items should never reach it into my container !");
772 _rxOutStream << pCol->getModelName();
773 // then the object itself
774 sal_Int32 nMark = xMark->createMark();
775 sal_Int32 nObjLen = 0;
776 _rxOutStream->writeLong(nObjLen);
777 // writing the column
778 pCol->write(_rxOutStream);
779 // determining the length
780 nObjLen = xMark->offsetToMark(nMark) - 4;
781 xMark->jumpToMark(nMark);
782 _rxOutStream->writeLong(nObjLen);
783 xMark->jumpToFurthest();
784 xMark->deleteMark(nMark);
786 // 3. Events
787 writeEvents(_rxOutStream);
788 // 4. Attributes
789 // Masking for all 'any' types
790 sal_uInt16 nAnyMask = 0;
791 if (m_aRowHeight.getValueTypeClass() == TypeClass_LONG)
792 nAnyMask |= ROWHEIGHT;
793 if ( getFont() != getDefaultFont() )
794 nAnyMask |= FONTATTRIBS | FONTSIZE | FONTTYPE | FONTDESCRIPTOR;
795 if (m_aTabStop.getValueTypeClass() == TypeClass_BOOLEAN)
796 nAnyMask |= TABSTOP;
797 if ( hasTextColor() )
798 nAnyMask |= TEXTCOLOR;
799 if (m_aBackgroundColor.getValueTypeClass() == TypeClass_LONG)
800 nAnyMask |= BACKGROUNDCOLOR;
801 if (!m_bRecordMarker)
802 nAnyMask |= RECORDMARKER;
803 _rxOutStream->writeShort(nAnyMask);
804 if (nAnyMask & ROWHEIGHT)
805 _rxOutStream->writeLong(getINT32(m_aRowHeight));
806 // old structures
807 const FontDescriptor& aFont = getFont();
808 if ( nAnyMask & FONTDESCRIPTOR )
810 // Attrib
811 _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( vcl::unohelper::ConvertFontWeight( aFont.Weight ) ) );
812 _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( aFont.Slant ) );
813 _rxOutStream->writeShort( aFont.Underline );
814 _rxOutStream->writeShort( aFont.Strikeout );
815 _rxOutStream->writeShort( sal_Int16(aFont.Orientation * 10) );
816 _rxOutStream->writeBoolean( aFont.Kerning );
817 _rxOutStream->writeBoolean( aFont.WordLineMode );
818 // Size
819 _rxOutStream->writeLong( aFont.Width );
820 _rxOutStream->writeLong( aFont.Height );
821 _rxOutStream->writeShort( sal::static_int_cast< sal_Int16 >( vcl::unohelper::ConvertFontWidth( aFont.CharacterWidth ) ) );
822 // Type
823 _rxOutStream->writeUTF( aFont.Name );
824 _rxOutStream->writeUTF( aFont.StyleName );
825 _rxOutStream->writeShort( aFont.Family );
826 _rxOutStream->writeShort( aFont.CharSet );
827 _rxOutStream->writeShort( aFont.Pitch );
829 _rxOutStream << m_aDefaultControl;
830 _rxOutStream->writeShort(m_nBorder);
831 _rxOutStream->writeBoolean(m_bEnable);
832 if (nAnyMask & TABSTOP)
833 _rxOutStream->writeBoolean(getBOOL(m_aTabStop));
834 _rxOutStream->writeBoolean(m_bNavigation);
835 if (nAnyMask & TEXTCOLOR)
836 _rxOutStream->writeLong( sal_Int32(getTextColor()) );
837 // new since version 6
838 _rxOutStream << m_sHelpText;
839 if (nAnyMask & FONTDESCRIPTOR)
840 _rxOutStream << getFont();
841 if (nAnyMask & RECORDMARKER)
842 _rxOutStream->writeBoolean(m_bRecordMarker);
843 // new since version 7
844 _rxOutStream->writeBoolean(m_bPrintable);
845 // new since version 8
846 if (nAnyMask & BACKGROUNDCOLOR)
847 _rxOutStream->writeLong(getINT32(m_aBackgroundColor));
850 void OGridControlModel::read(const Reference<XObjectInputStream>& _rxInStream)
852 SolarMutexGuard g;
853 OControlModel::read(_rxInStream);
854 Reference<XMarkableStream> xMark(_rxInStream, UNO_QUERY);
855 // 1. version
856 sal_Int16 nVersion = _rxInStream->readShort();
857 // 2. reading the columns
858 sal_Int32 nLen = _rxInStream->readLong();
859 if (nLen)
861 for (sal_Int32 i = 0; i < nLen; i++)
863 // reading the model names
864 OUString sModelName;
865 _rxInStream >> sModelName;
866 Reference<XPropertySet> xCol(createColumnById(getColumnTypeByModelName(sModelName)));
867 DBG_ASSERT(xCol.is(), "OGridControlModel::read : unknown column type !");
868 sal_Int32 nObjLen = _rxInStream->readLong();
869 if (nObjLen)
871 sal_Int32 nMark = xMark->createMark();
872 if (xCol.is())
874 OGridColumn* pCol = comphelper::getFromUnoTunnel<OGridColumn>(xCol);
875 pCol->read(_rxInStream);
877 xMark->jumpToMark(nMark);
878 _rxInStream->skipBytes(nObjLen);
879 xMark->deleteMark(nMark);
881 if ( xCol.is() )
882 implInsert( i, xCol, false, nullptr, false );
885 // In the base implementation events are only read, elements in the container exist
886 // but since before TF_ONE for the GridControl events were always written, so they
887 // need to be read, too
888 sal_Int32 nObjLen = _rxInStream->readLong();
889 if (nObjLen)
891 sal_Int32 nMark = xMark->createMark();
892 Reference<XPersistObject> xObj(m_xEventAttacher, UNO_QUERY);
893 if (xObj.is())
894 xObj->read(_rxInStream);
895 xMark->jumpToMark(nMark);
896 _rxInStream->skipBytes(nObjLen);
897 xMark->deleteMark(nMark);
899 // reading the attachment
900 for (sal_Int32 i = 0; i < nLen; i++)
902 css::uno::Reference<css::uno::XInterface> xIfc(m_aItems[i], UNO_QUERY);
903 Reference<XPropertySet> xSet(xIfc, UNO_QUERY);
904 Any aHelper;
905 aHelper <<= xSet;
906 m_xEventAttacher->attach( i, xIfc, aHelper );
908 // 4. reading the attributes
909 if (nVersion == 1)
910 return;
911 // Masking for any
912 sal_uInt16 nAnyMask = _rxInStream->readShort();
913 if (nAnyMask & ROWHEIGHT)
915 sal_Int32 nValue = _rxInStream->readLong();
916 m_aRowHeight <<= nValue;
918 FontDescriptor aFont( getFont() );
919 if ( nAnyMask & FONTATTRIBS )
921 aFont.Weight = static_cast<float>(vcl::unohelper::ConvertFontWeight( _rxInStream->readShort() ));
922 aFont.Slant = static_cast<FontSlant>(_rxInStream->readShort());
923 aFont.Underline = _rxInStream->readShort();
924 aFont.Strikeout = _rxInStream->readShort();
925 aFont.Orientation = static_cast<float>(_rxInStream->readShort()) / 10;
926 aFont.Kerning = _rxInStream->readBoolean() != 0;
927 aFont.WordLineMode = _rxInStream->readBoolean() != 0;
929 if ( nAnyMask & FONTSIZE )
931 aFont.Width = static_cast<sal_Int16>(_rxInStream->readLong());
932 aFont.Height = static_cast<sal_Int16>(_rxInStream->readLong());
933 aFont.CharacterWidth = static_cast<float>(vcl::unohelper::ConvertFontWidth( _rxInStream->readShort() ));
935 if ( nAnyMask & FONTTYPE )
937 aFont.Name = _rxInStream->readUTF();
938 aFont.StyleName = _rxInStream->readUTF();
939 aFont.Family = _rxInStream->readShort();
940 aFont.CharSet = _rxInStream->readShort();
941 aFont.Pitch = _rxInStream->readShort();
943 if ( nAnyMask & ( FONTATTRIBS | FONTSIZE | FONTTYPE ) )
944 setFont( aFont );
945 // Name
946 _rxInStream >> m_aDefaultControl;
947 m_nBorder = _rxInStream->readShort();
948 m_bEnable = _rxInStream->readBoolean();
949 if (nAnyMask & TABSTOP)
951 m_aTabStop <<= (_rxInStream->readBoolean() != 0);
953 if (nVersion > 3)
954 m_bNavigation = _rxInStream->readBoolean();
955 if (nAnyMask & TEXTCOLOR)
957 sal_Int32 nValue = _rxInStream->readLong();
958 setTextColor( ::Color(ColorTransparency, nValue) );
960 // new since version 6
961 if (nVersion > 5)
962 _rxInStream >> m_sHelpText;
963 if (nAnyMask & FONTDESCRIPTOR)
965 FontDescriptor aUNOFont;
966 _rxInStream >> aUNOFont;
967 setFont( aFont );
969 if (nAnyMask & RECORDMARKER)
970 m_bRecordMarker = _rxInStream->readBoolean();
971 // new since version 7
972 if (nVersion > 6)
973 m_bPrintable = _rxInStream->readBoolean();
974 if (nAnyMask & BACKGROUNDCOLOR)
976 sal_Int32 nValue = _rxInStream->readLong();
977 m_aBackgroundColor <<= nValue;
983 extern "C" SAL_DLLPUBLIC_EXPORT XInterface*
984 com_sun_star_form_OGridControlModel_get_implementation(XComponentContext* component,
985 Sequence<Any> const &)
987 return cppu::acquire(new frm::OGridControlModel(component));
990 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */