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