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