xref: /aoo42x/main/forms/source/component/Columns.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_forms.hxx"
30 #include "Columns.hxx"
31 #ifndef _FRM_PROPERTY_HRC_
32 #include "property.hrc"
33 #endif
34 #include "property.hxx"
35 #include "componenttools.hxx"
36 #include "ids.hxx"
37 #include "findpos.hxx"
38 #include <com/sun/star/io/XPersistObject.hpp>
39 #include <com/sun/star/io/XObjectOutputStream.hpp>
40 #include <com/sun/star/io/XObjectInputStream.hpp>
41 #include <com/sun/star/io/XMarkableStream.hpp>
42 #include <com/sun/star/form/XFormComponent.hpp>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include <com/sun/star/form/binding/XBindableValue.hpp>
45 #include <com/sun/star/beans/XPropertyContainer.hpp>
46 #include <com/sun/star/text/XText.hpp>
47 #include <comphelper/sequence.hxx>
48 #include <comphelper/property.hxx>
49 #include <comphelper/basicio.hxx>
50 #include <comphelper/types.hxx>
51 #include "services.hxx"
52 #ifndef _FRM_RESOURCE_HRC_
53 #include "frm_resource.hrc"
54 #endif
55 #include <tools/debug.hxx>
56 #include <rtl/uuid.h>
57 #include <rtl/memory.h>
58 
59 //.........................................................................
60 namespace frm
61 {
62 //.........................................................................
63 using namespace ::com::sun::star::uno;
64 using namespace ::com::sun::star::beans;
65 using namespace ::com::sun::star::container;
66 using namespace ::com::sun::star::form;
67 using namespace ::com::sun::star::awt;
68 using namespace ::com::sun::star::io;
69 using namespace ::com::sun::star::lang;
70 using namespace ::com::sun::star::util;
71 using namespace ::com::sun::star::text;
72 using namespace ::com::sun::star::form::binding;
73 
74 const sal_uInt16 WIDTH              = 0x0001;
75 const sal_uInt16 ALIGN              = 0x0002;
76 const sal_uInt16 OLD_HIDDEN         = 0x0004;
77 const sal_uInt16 COMPATIBLE_HIDDEN  = 0x0008;
78 
79 //------------------------------------------------------------------------------
80 const StringSequence& getColumnTypes()
81 {
82     static StringSequence aColumnTypes(10);
83     if (!aColumnTypes.getConstArray()[0].getLength())
84     {
85         ::rtl::OUString* pNames = aColumnTypes.getArray();
86         pNames[TYPE_CHECKBOX]       = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CheckBox" ) );
87         pNames[TYPE_COMBOBOX]       = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ComboBox" ) );
88         pNames[TYPE_CURRENCYFIELD]  = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CurrencyField" ) );
89         pNames[TYPE_DATEFIELD]      = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DateField" ) );
90         pNames[TYPE_FORMATTEDFIELD] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FormattedField" ) );
91         pNames[TYPE_LISTBOX]        = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ListBox" ) );
92         pNames[TYPE_NUMERICFIELD]   = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "NumericField" ) );
93         pNames[TYPE_PATTERNFIELD]   = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PatternField" ) );
94         pNames[TYPE_TEXTFIELD]      = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextField" ) );
95         pNames[TYPE_TIMEFIELD]      = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TimeField" ) );
96     }
97     return aColumnTypes;
98 }
99 
100 //------------------------------------------------------------------------------
101 sal_Int32 getColumnTypeByModelName(const ::rtl::OUString& aModelName)
102 {
103     const ::rtl::OUString aModelPrefix = ::rtl::OUString::createFromAscii("com.sun.star.form.component.");
104     const ::rtl::OUString aCompatibleModelPrefix = ::rtl::OUString::createFromAscii("stardiv.one.form.component.");
105 
106     sal_Int32 nTypeId = -1;
107     if (aModelName == FRM_COMPONENT_EDIT)
108         nTypeId = TYPE_TEXTFIELD;
109     else
110     {
111         sal_Int32 nPrefixPos = aModelName.indexOf(aModelPrefix);
112 #ifdef DBG_UTIL
113         sal_Int32 nCompatiblePrefixPos = aModelName.indexOf(aCompatibleModelPrefix);
114 #endif
115         DBG_ASSERT( (nPrefixPos != -1) ||   (nCompatiblePrefixPos != -1),
116                 "::getColumnTypeByModelName() : wrong servivce !");
117 
118         ::rtl::OUString aColumnType = (nPrefixPos != -1)
119             ? aModelName.copy(aModelPrefix.getLength())
120             : aModelName.copy(aCompatibleModelPrefix.getLength());
121 
122         const StringSequence& rColumnTypes = getColumnTypes();
123         nTypeId = ::detail::findPos(aColumnType, rColumnTypes);
124     }
125     return nTypeId;
126 }
127 
128 /*************************************************************************/
129 
130 //------------------------------------------------------------------
131 const Sequence<sal_Int8>& OGridColumn::getUnoTunnelImplementationId()
132 {
133     static Sequence< sal_Int8 > * pSeq = 0;
134     if( !pSeq )
135     {
136         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
137         if( !pSeq )
138         {
139             static Sequence< sal_Int8 > aSeq( 16 );
140             rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True );
141             pSeq = &aSeq;
142         }
143     }
144     return *pSeq;
145 }
146 
147 //------------------------------------------------------------------
148 sal_Int64 SAL_CALL OGridColumn::getSomething( const Sequence<sal_Int8>& _rIdentifier) throw(RuntimeException)
149 {
150     sal_Int64 nReturn(0);
151 
152     if  (   (_rIdentifier.getLength() == 16)
153         &&  (0 == rtl_compareMemory( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ))
154         )
155     {
156         nReturn = reinterpret_cast<sal_Int64>(this);
157     }
158     else
159     {
160         Reference< XUnoTunnel > xAggTunnel;
161         if ( query_aggregation( m_xAggregate, xAggTunnel ) )
162             return xAggTunnel->getSomething( _rIdentifier );
163     }
164     return nReturn;
165 }
166 
167 //------------------------------------------------------------------
168 Sequence<sal_Int8> SAL_CALL OGridColumn::getImplementationId() throw(RuntimeException)
169 {
170     return OImplementationIds::getImplementationId(getTypes());
171 }
172 
173 //------------------------------------------------------------------
174 Sequence<Type> SAL_CALL OGridColumn::getTypes() throw(RuntimeException)
175 {
176     TypeBag aTypes( OGridColumn_BASE::getTypes() );
177     // erase the types which we do not support
178     aTypes.removeType( XFormComponent::static_type() );
179     aTypes.removeType( XServiceInfo::static_type() );
180     aTypes.removeType( XBindableValue::static_type() );
181     aTypes.removeType( XPropertyContainer::static_type() );
182 
183     // but re-add their base class(es)
184     aTypes.addType( XChild::static_type() );
185 
186     Reference< XTypeProvider > xProv;
187     if ( query_aggregation( m_xAggregate, xProv ))
188         aTypes.addTypes( xProv->getTypes() );
189 
190     aTypes.removeType( XTextRange::static_type() );
191     aTypes.removeType( XSimpleText::static_type() );
192     aTypes.removeType( XText::static_type() );
193 
194     return aTypes.getTypes();
195 }
196 
197 //------------------------------------------------------------------
198 Any SAL_CALL OGridColumn::queryAggregation( const Type& _rType ) throw (RuntimeException)
199 {
200     Any aReturn;
201     // some functionality at our aggregate cannot be reasonably fullfilled here.
202     if  (   _rType.equals(::getCppuType(static_cast< Reference< XFormComponent >* >(NULL)))
203         ||  _rType.equals(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL)))
204         ||  _rType.equals(::getCppuType(static_cast< Reference< XBindableValue >* >(NULL)))
205         ||  _rType.equals(::getCppuType(static_cast< Reference< XPropertyContainer >* >(NULL)))
206         ||  comphelper::isAssignableFrom(::getCppuType(static_cast< Reference< XTextRange >* >(NULL)),_rType)
207         )
208         return aReturn;
209 
210     aReturn = OGridColumn_BASE::queryAggregation(_rType);
211     if (!aReturn.hasValue())
212     {
213         aReturn = OPropertySetAggregationHelper::queryInterface(_rType);
214         if (!aReturn.hasValue() && m_xAggregate.is())
215             aReturn = m_xAggregate->queryAggregation(_rType);
216     }
217 
218     return aReturn;
219 }
220 
221 DBG_NAME(OGridColumn);
222 //------------------------------------------------------------------------------
223 OGridColumn::OGridColumn( const comphelper::ComponentContext& _rContext, const ::rtl::OUString& _sModelName )
224 	:OGridColumn_BASE(m_aMutex)
225 	,OPropertySetAggregationHelper(OGridColumn_BASE::rBHelper)
226 	,m_aHidden( makeAny( sal_False ) )
227     ,m_aContext( _rContext )
228 	,m_aModelName(_sModelName)
229 {
230     DBG_CTOR(OGridColumn,NULL);
231 
232     // Anlegen des UnoControlModels
233     if ( m_aModelName.getLength() )    // is there a to-be-aggregated model?
234     {
235         increment( m_refCount );
236 
237         {
238             m_xAggregate.set( m_aContext.createComponent( m_aModelName ), UNO_QUERY );
239             setAggregation( m_xAggregate );
240         }
241 
242         if ( m_xAggregate.is() )
243         {   // don't omit those brackets - they ensure that the following temporary is properly deleted
244             m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) );
245         }
246 
247         // Refcount wieder bei NULL
248         decrement( m_refCount );
249     }
250 }
251 
252 //------------------------------------------------------------------------------
253 OGridColumn::OGridColumn( const OGridColumn* _pOriginal )
254 	:OGridColumn_BASE( m_aMutex )
255 	,OPropertySetAggregationHelper( OGridColumn_BASE::rBHelper )
256     ,m_aContext( _pOriginal->m_aContext )
257 {
258     DBG_CTOR(OGridColumn,NULL);
259 
260 	m_aWidth = _pOriginal->m_aWidth;
261 	m_aAlign = _pOriginal->m_aAlign;
262 	m_aHidden = _pOriginal->m_aHidden;
263 	m_aModelName = _pOriginal->m_aModelName;
264 	m_aLabel = _pOriginal->m_aLabel;
265 
266 	increment( m_refCount );
267 	{
268 		{
269 			m_xAggregate = createAggregateClone( _pOriginal );
270 			setAggregation( m_xAggregate );
271 		}
272 
273 		if ( m_xAggregate.is() )
274 		{	// don't omit this brackets - they ensure that the following temporary is properly deleted
275 			m_xAggregate->setDelegator( static_cast< ::cppu::OWeakObject* >( this ) );
276 		}
277 	}
278 	decrement( m_refCount );
279 }
280 
281 //------------------------------------------------------------------------------
282 OGridColumn::~OGridColumn()
283 {
284     if (!OGridColumn_BASE::rBHelper.bDisposed)
285     {
286         acquire();
287         dispose();
288     }
289 
290     // freigeben der Agg
291     if (m_xAggregate.is())
292     {
293         InterfaceRef  xIface;
294         m_xAggregate->setDelegator(xIface);
295     }
296 
297     DBG_DTOR(OGridColumn,NULL);
298 }
299 
300 // XEventListener
301 //------------------------------------------------------------------------------
302 void SAL_CALL OGridColumn::disposing(const EventObject& _rSource) throw(RuntimeException)
303 {
304     OPropertySetAggregationHelper::disposing(_rSource);
305 
306     Reference<XEventListener>  xEvtLstner;
307     if (query_aggregation(m_xAggregate, xEvtLstner))
308         xEvtLstner->disposing(_rSource);
309 }
310 
311 // OGridColumn_BASE
312 //-----------------------------------------------------------------------------
313 void OGridColumn::disposing()
314 {
315     OGridColumn_BASE::disposing();
316     OPropertySetAggregationHelper::disposing();
317 
318     Reference<XComponent>  xComp;
319     if (query_aggregation(m_xAggregate, xComp))
320         xComp->dispose();
321 }
322 
323 //------------------------------------------------------------------------------
324 void OGridColumn::clearAggregateProperties( Sequence< Property >& _rProps, sal_Bool bAllowDropDown )
325 {
326     // some properties are not to be exposed to the outer world
327     ::std::set< ::rtl::OUString > aForbiddenProperties;
328     aForbiddenProperties.insert( PROPERTY_ALIGN );
329     aForbiddenProperties.insert( PROPERTY_AUTOCOMPLETE );
330     aForbiddenProperties.insert( PROPERTY_BACKGROUNDCOLOR );
331     aForbiddenProperties.insert( PROPERTY_BORDER );
332     aForbiddenProperties.insert( PROPERTY_BORDERCOLOR );
333     aForbiddenProperties.insert( PROPERTY_ECHO_CHAR );
334     aForbiddenProperties.insert( PROPERTY_FILLCOLOR );
335     aForbiddenProperties.insert( PROPERTY_FONT );
336     aForbiddenProperties.insert( PROPERTY_FONT_NAME );
337     aForbiddenProperties.insert( PROPERTY_FONT_STYLENAME );
338     aForbiddenProperties.insert( PROPERTY_FONT_FAMILY );
339     aForbiddenProperties.insert( PROPERTY_FONT_CHARSET );
340     aForbiddenProperties.insert( PROPERTY_FONT_HEIGHT );
341     aForbiddenProperties.insert( PROPERTY_FONT_WEIGHT );
342     aForbiddenProperties.insert( PROPERTY_FONT_SLANT );
343     aForbiddenProperties.insert( PROPERTY_FONT_UNDERLINE );
344     aForbiddenProperties.insert( PROPERTY_FONT_STRIKEOUT );
345     aForbiddenProperties.insert( PROPERTY_FONT_WORDLINEMODE );
346     aForbiddenProperties.insert( PROPERTY_TEXTLINECOLOR );
347     aForbiddenProperties.insert( PROPERTY_FONTEMPHASISMARK );
348     aForbiddenProperties.insert( PROPERTY_FONTRELIEF );
349     aForbiddenProperties.insert( PROPERTY_HARDLINEBREAKS );
350     aForbiddenProperties.insert( PROPERTY_HSCROLL );
351     aForbiddenProperties.insert( PROPERTY_LABEL );
352     aForbiddenProperties.insert( PROPERTY_LINECOLOR );
353     aForbiddenProperties.insert( PROPERTY_MULTISELECTION );
354     aForbiddenProperties.insert( PROPERTY_PRINTABLE );
355     aForbiddenProperties.insert( PROPERTY_TABINDEX );
356     aForbiddenProperties.insert( PROPERTY_TABSTOP );
357     aForbiddenProperties.insert( PROPERTY_TEXTCOLOR );
358     aForbiddenProperties.insert( PROPERTY_VSCROLL );
359     aForbiddenProperties.insert( PROPERTY_CONTROLLABEL );
360     aForbiddenProperties.insert( PROPERTY_RICH_TEXT );
361     aForbiddenProperties.insert( PROPERTY_VERTICAL_ALIGN );
362     aForbiddenProperties.insert( PROPERTY_IMAGE_URL );
363     aForbiddenProperties.insert( PROPERTY_IMAGE_POSITION );
364     aForbiddenProperties.insert( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EnableVisible" ) ) );
365     if ( !bAllowDropDown )
366         aForbiddenProperties.insert( PROPERTY_DROPDOWN );
367 
368     Sequence< Property > aNewProps( _rProps.getLength() );
369     Property* pNewProps = aNewProps.getArray();
370 
371     const Property* pProps = _rProps.getConstArray();
372     const Property* pPropsEnd = pProps + _rProps.getLength();
373     for ( ; pProps != pPropsEnd; ++pProps )
374     {
375         if ( aForbiddenProperties.find( pProps->Name ) == aForbiddenProperties.end() )
376             *pNewProps++ = *pProps;
377     }
378 
379     aNewProps.realloc( pNewProps - aNewProps.getArray() );
380     _rProps = aNewProps;
381 }
382 
383 //------------------------------------------------------------------------------
384 void OGridColumn::setOwnProperties(Sequence<Property>& aDescriptor)
385 {
386     aDescriptor.realloc(5);
387     Property* pProperties = aDescriptor.getArray();
388     DECL_PROP1(LABEL,               ::rtl::OUString,    BOUND);
389     DECL_PROP3(WIDTH,               sal_Int32,          BOUND, MAYBEVOID, MAYBEDEFAULT);
390     DECL_PROP3(ALIGN,               sal_Int16,          BOUND, MAYBEVOID, MAYBEDEFAULT);
391     DECL_BOOL_PROP2(HIDDEN,                             BOUND, MAYBEDEFAULT);
392     DECL_PROP1(COLUMNSERVICENAME,   ::rtl::OUString,    READONLY);
393 }
394 
395 // Reference<XPropertySet>
396 //------------------------------------------------------------------------------
397 void OGridColumn::getFastPropertyValue(Any& rValue, sal_Int32 nHandle ) const
398 {
399     switch (nHandle)
400     {
401         case PROPERTY_ID_COLUMNSERVICENAME:
402             rValue <<= m_aModelName;
403             break;
404         case PROPERTY_ID_LABEL:
405             rValue <<= m_aLabel;
406             break;
407         case PROPERTY_ID_WIDTH:
408             rValue = m_aWidth;
409             break;
410         case PROPERTY_ID_ALIGN:
411             rValue = m_aAlign;
412             break;
413         case PROPERTY_ID_HIDDEN:
414             rValue = m_aHidden;
415             break;
416         default:
417             OPropertySetAggregationHelper::getFastPropertyValue(rValue, nHandle);
418     }
419 }
420 
421 //------------------------------------------------------------------------------
422 sal_Bool OGridColumn::convertFastPropertyValue( Any& rConvertedValue, Any& rOldValue,
423                                             sal_Int32 nHandle, const Any& rValue )throw( IllegalArgumentException )
424 {
425     sal_Bool bModified(sal_False);
426     switch (nHandle)
427     {
428         case PROPERTY_ID_LABEL:
429             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aLabel);
430             break;
431         case PROPERTY_ID_WIDTH:
432             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aWidth, ::getCppuType((const sal_Int32*)NULL));
433             break;
434         case PROPERTY_ID_ALIGN:
435             bModified = tryPropertyValue( rConvertedValue, rOldValue, rValue, m_aAlign, ::getCppuType( (const sal_Int32*)NULL ) );
436             // strange enough, css.awt.TextAlign is a 32-bit integer, while the Align property (both here for grid controls
437             // and for ordinary toolkit controls) is a 16-bit integer. So, allow for 32 bit, but normalize it to 16 bit
438             if ( bModified )
439             {
440                 sal_Int32 nAlign( 0 );
441                 if ( rConvertedValue >>= nAlign )
442                     rConvertedValue <<= (sal_Int16)nAlign;
443             }
444             break;
445         case PROPERTY_ID_HIDDEN:
446             bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, getBOOL(m_aHidden));
447             break;
448     }
449     return bModified;
450 }
451 
452 //------------------------------------------------------------------------------
453 void OGridColumn::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const Any& rValue ) throw (::com::sun::star::uno::Exception)
454 {
455     switch (nHandle)
456     {
457         case PROPERTY_ID_LABEL:
458             DBG_ASSERT(rValue.getValueType().getTypeClass() == TypeClass_STRING, "invalid type" );
459             rValue >>= m_aLabel;
460             break;
461         case PROPERTY_ID_WIDTH:
462             m_aWidth = rValue;
463             break;
464         case PROPERTY_ID_ALIGN:
465             m_aAlign = rValue;
466             break;
467         case PROPERTY_ID_HIDDEN:
468             m_aHidden = rValue;
469             break;
470     }
471 }
472 
473 
474 // XPropertyState
475 //------------------------------------------------------------------------------
476 Any OGridColumn::getPropertyDefaultByHandle( sal_Int32 nHandle ) const
477 {
478     switch (nHandle)
479     {
480         case PROPERTY_ID_WIDTH:
481         case PROPERTY_ID_ALIGN:
482             return Any();
483         case PROPERTY_ID_HIDDEN:
484             return makeAny((sal_Bool)sal_False);
485         default:
486             return OPropertySetAggregationHelper::getPropertyDefaultByHandle(nHandle);
487     }
488 }
489 
490 // XCloneable
491 //------------------------------------------------------------------------------
492 Reference< XCloneable > SAL_CALL OGridColumn::createClone(  ) throw (RuntimeException)
493 {
494     OGridColumn* pNewColumn = createCloneColumn();
495     return pNewColumn;
496 }
497 
498 //XPersistObject
499 //------------------------------------------------------------------------------
500 void SAL_CALL OGridColumn::write(const Reference<XObjectOutputStream>& _rxOutStream)
501 {
502     // 1. Schreiben des UnoControls
503     Reference<XMarkableStream>  xMark(_rxOutStream, UNO_QUERY);
504     sal_Int32 nMark = xMark->createMark();
505 
506     sal_Int32 nLen = 0;
507     _rxOutStream->writeLong(nLen);
508 
509     Reference<XPersistObject>  xPersist;
510     if (query_aggregation(m_xAggregate, xPersist))
511         xPersist->write(_rxOutStream);
512 
513     // feststellen der Laenge
514     nLen = xMark->offsetToMark(nMark) - 4;
515     xMark->jumpToMark(nMark);
516     _rxOutStream->writeLong(nLen);
517     xMark->jumpToFurthest();
518     xMark->deleteMark(nMark);
519 
520     // 2. Schreiben einer VersionsNummer
521     _rxOutStream->writeShort(0x0002);
522 
523     sal_uInt16 nAnyMask = 0;
524     if (m_aWidth.getValueType().getTypeClass() == TypeClass_LONG)
525         nAnyMask |= WIDTH;
526 
527     if (m_aAlign.getValueTypeClass() == TypeClass_SHORT)
528         nAnyMask |= ALIGN;
529 
530     nAnyMask |= COMPATIBLE_HIDDEN;
531 
532     _rxOutStream->writeShort(nAnyMask);
533 
534     if (nAnyMask & WIDTH)
535         _rxOutStream->writeLong(getINT32(m_aWidth));
536     if (nAnyMask & ALIGN)
537         _rxOutStream->writeShort(getINT16(m_aAlign));
538 
539     // Name
540     _rxOutStream << m_aLabel;
541 
542     // the new place for the hidden flag : after m_aLabel, so older office version read the correct label, too
543     if (nAnyMask & COMPATIBLE_HIDDEN)
544         _rxOutStream->writeBoolean(getBOOL(m_aHidden));
545 }
546 
547 //------------------------------------------------------------------------------
548 void SAL_CALL OGridColumn::read(const Reference<XObjectInputStream>& _rxInStream)
549 {
550     // 1. Lesen des UnoControls
551     sal_Int32 nLen = _rxInStream->readLong();
552     if (nLen)
553     {
554         Reference<XMarkableStream>  xMark(_rxInStream, UNO_QUERY);
555         sal_Int32 nMark = xMark->createMark();
556         Reference<XPersistObject>  xPersist;
557         if (query_aggregation(m_xAggregate, xPersist))
558             xPersist->read(_rxInStream);
559 
560         xMark->jumpToMark(nMark);
561         _rxInStream->skipBytes(nLen);
562         xMark->deleteMark(nMark);
563     }
564 
565     // 2. Lesen des Versionsnummer
566     sal_uInt16 nVersion = _rxInStream->readShort(); (void)nVersion;
567     sal_uInt16 nAnyMask = _rxInStream->readShort();
568 
569     if (nAnyMask & WIDTH)
570     {
571         sal_Int32 nValue = _rxInStream->readLong();
572         m_aWidth <<= (sal_Int32)nValue;
573     }
574 
575     if (nAnyMask & ALIGN)
576     {
577         sal_Int16 nValue = _rxInStream->readShort();
578         m_aAlign <<= nValue;
579     }
580     if (nAnyMask & OLD_HIDDEN)
581     {
582         sal_Bool bValue = _rxInStream->readBoolean();
583         m_aHidden <<= (sal_Bool)bValue;
584     }
585 
586     // Name
587     _rxInStream >> m_aLabel;
588 
589     if (nAnyMask & COMPATIBLE_HIDDEN)
590     {
591         sal_Bool bValue = _rxInStream->readBoolean();
592         m_aHidden <<= (sal_Bool)bValue;
593     }
594 }
595 
596 //------------------------------------------------------------------------------
597 IMPL_COLUMN(TextFieldColumn,        FRM_SUN_COMPONENT_TEXTFIELD,        sal_False);
598 IMPL_COLUMN(PatternFieldColumn,     FRM_SUN_COMPONENT_PATTERNFIELD,     sal_False);
599 IMPL_COLUMN(DateFieldColumn,        FRM_SUN_COMPONENT_DATEFIELD,        sal_True);
600 IMPL_COLUMN(TimeFieldColumn,        FRM_SUN_COMPONENT_TIMEFIELD,        sal_False);
601 IMPL_COLUMN(NumericFieldColumn,     FRM_SUN_COMPONENT_NUMERICFIELD,     sal_False);
602 IMPL_COLUMN(CurrencyFieldColumn,    FRM_SUN_COMPONENT_CURRENCYFIELD,    sal_False);
603 IMPL_COLUMN(CheckBoxColumn,         FRM_SUN_COMPONENT_CHECKBOX,         sal_False);
604 IMPL_COLUMN(ComboBoxColumn,         FRM_SUN_COMPONENT_COMBOBOX,         sal_False);
605 IMPL_COLUMN(ListBoxColumn,          FRM_SUN_COMPONENT_LISTBOX,          sal_False);
606 IMPL_COLUMN(FormattedFieldColumn,   FRM_SUN_COMPONENT_FORMATTEDFIELD,   sal_False);
607 
608 //.........................................................................
609 }   // namespace frm
610 //.........................................................................
611 
612