update dev300-m58
[ooovba.git] / svx / source / inc / gridcell.hxx
blobff03e1a52869f5bfa7b96d5f632d14b1b432a3d3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gridcell.hxx,v $
10 * $Revision: 1.24 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_GRIDCELL_HXX
32 #define _SVX_GRIDCELL_HXX
34 #include <svx/gridctrl.hxx>
36 #include "sqlparserclient.hxx"
37 #include "typeconversionclient.hxx"
38 #include "fmtools.hxx"
40 /** === begin UNO includes === **/
41 #include <com/sun/star/sdb/XColumn.hpp>
42 #include <com/sun/star/form/XBoundControl.hpp>
43 #include <com/sun/star/awt/XTextComponent.hpp>
44 #include <com/sun/star/awt/XListBox.hpp>
45 #include <com/sun/star/awt/TextAlign.hpp>
46 #include <com/sun/star/awt/XControlModel.hpp>
47 #include <com/sun/star/awt/XControl.hpp>
48 #include <com/sun/star/awt/XCheckBox.hpp>
49 #include <com/sun/star/beans/XFastPropertySet.hpp>
50 #include <com/sun/star/lang/XUnoTunnel.hpp>
51 /** === end UNO includes === **/
53 #include <tools/rtti.hxx>
55 #include <comphelper/propmultiplex.hxx>
56 #include <comphelper/componentcontext.hxx>
58 #include <cppuhelper/component.hxx>
60 class DbCellControl;
61 class Edit;
62 class FmXGridCell;
64 //==================================================================
65 // FmMutexHelper
66 //==================================================================
67 class FmMutexHelper
69 protected:
70 ::osl::Mutex m_aMutex;
73 //==================================================================
74 // DbGridColumn, Spaltenbeschreibung
75 //==================================================================
76 class DbGridColumn
78 friend class DbGridControl;
80 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xModel;
81 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xField; // Verbindung zum Datenbankfeld
82 ::svt::CellControllerRef m_xController; // Struktur zum Verwalten der Controls fuer eine Spalte
83 // diese wird von der DbBrowseBox auf die jeweiligen Zellen
84 // einer Spalte positioniert
85 FmXGridCell* m_pCell;
87 protected:
88 DbGridControl& m_rParent;
90 private:
91 sal_Int32 m_nLastVisibleWidth; // nur gueltig, wenn m_bHidden == sal_True
92 sal_Int32 m_nFormatKey;
93 sal_Int16 m_nFieldType;
94 sal_Int16 m_nTypeId;
95 sal_uInt16 m_nId;
96 sal_Int16 m_nFieldPos;
97 sal_Int16 m_nAlign; // wird mit TXT_ALIGN_LEFT .... angegeben
98 sal_Bool m_bReadOnly : 1;
99 sal_Bool m_bAutoValue : 1;
100 sal_Bool m_bInSave : 1;
101 sal_Bool m_bNumeric : 1;
102 sal_Bool m_bObject : 1; // Verweist die Column auf ein Object Datentyp?
103 sal_Bool m_bHidden : 1;
104 sal_Bool m_bLocked : 1;
105 sal_Bool m_bDateTime : 1;
107 static ::svt::CellControllerRef s_xEmptyController;
108 // used by locked columns
109 public:
110 DbGridColumn(sal_uInt16 _nId, DbGridControl& rParent)
111 :m_pCell(NULL)
112 ,m_rParent(rParent)
113 ,m_nLastVisibleWidth(-1)
114 ,m_nFormatKey(0)
115 ,m_nFieldType(0)
116 ,m_nTypeId(0)
117 ,m_nId(_nId)
118 ,m_nFieldPos(-1)
119 ,m_nAlign(::com::sun::star::awt::TextAlign::LEFT)
120 ,m_bReadOnly(sal_False)
121 ,m_bAutoValue(sal_False)
122 ,m_bInSave(sal_False)
123 ,m_bNumeric(sal_False)
124 ,m_bObject(sal_False)
125 ,m_bHidden(sal_False)
126 ,m_bLocked(sal_False)
127 ,m_bDateTime(sal_False)
131 ~DbGridColumn();
133 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& getModel() const { return m_xModel; }
134 void setModel(::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xModel);
137 sal_uInt16 GetId() const {return m_nId;}
138 sal_Bool IsReadOnly() const {return m_bReadOnly;}
139 sal_Bool IsAutoValue() const {return m_bAutoValue;}
140 sal_Bool IsUpdating() const {return m_bInSave;}
141 sal_Int16 GetAlignment() const {return m_nAlign;}
142 sal_Int16 GetType() const {return m_nFieldType;}
143 sal_Int16 GetFieldPos() const {return m_nFieldPos; }
144 sal_Bool IsNumeric() const {return m_bNumeric;}
145 sal_Bool IsDateTime() const {return m_bDateTime;}
146 sal_Bool IsObject() const {return m_bObject;}
147 sal_Bool IsHidden() const {return m_bHidden;}
148 sal_Int32 GetKey() const {return m_nFormatKey;}
149 const ::svt::CellControllerRef& GetController() const {return m_bLocked ? s_xEmptyController : m_xController;}
150 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& GetField() const {return m_xField;}
151 DbGridControl& GetParent() const {return m_rParent;}
152 FmXGridCell* GetCell() const {return m_pCell;}
154 ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn > GetCurrentFieldValue() const;
156 // Zeichnen eines Feldes an einer Position, ist ein ::com::sun::star::sdbcx::View gesetzt
157 // uebernimmt dieser das Zeichnen, z.B. fuer CheckBoxen
158 void Paint(OutputDevice& rDev,
159 const Rectangle& rRect,
160 const DbGridRow* pRow,
161 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
164 // Inititialierung im alive mode
165 // Ist kein ColumnController gesetzt, wird eine DefaultInitialisierung
166 // vorgenommen
167 void CreateControl(sal_Int32 _nFieldPos, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xField, sal_Int32 nTypeId);
168 void UpdateControl()
170 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xField(m_xField);
171 CreateControl(m_nFieldPos, xField, m_nTypeId);
174 // Editieren einer Zelle
175 void UpdateFromField(const DbGridRow* pRow, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
176 sal_Bool Commit();
178 // freigeben aller Daten, die fuer den AliveMode noetig sind
179 void Clear();
181 XubString GetCellText(const DbGridRow* pRow, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
182 XubString GetCellText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
184 void SetReadOnly(sal_Bool bRead){m_bReadOnly = bRead;}
185 void SetObject(sal_Int16 nPos) {m_bObject = m_bReadOnly = sal_True; m_nFieldPos = nPos;}
187 void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat );
189 // Properties, die auf den ::com::sun::star::frame::Controller durchschlagen koennen
190 sal_Int16 SetAlignment(sal_Int16 _nAlign);
191 // if _nAlign is -1, the alignment is calculated from the type of the field we are bound to
192 // the value really set is returned
193 sal_Int16 SetAlignmentFromModel(sal_Int16 nStandardAlign);
194 // set the alignment according to the "Align"-property of m_xModel, use the given standard
195 // alignment if the property if void, return the really set alignment
197 // column locking
198 sal_Bool isLocked() const { return m_bLocked; }
199 void setLock(sal_Bool _bLock);
201 private:
202 /** attaches or detaches our cell object to the SctriptEventAttacherManager implemented
203 by our model's parent
205 void impl_toggleScriptManager_nothrow( bool _bAttach );
208 //==================================================================
209 // DbCellControl, liefert die Daten fuer einen CellController
210 // wird in der Regel nur für komplexe Controls wie z.B ComboBoxen
211 // benoetigt
212 //==================================================================
213 class DbCellControl
214 :public ::svxform::OTypeConversionClient
215 ,public ::svxform::OStaticDataAccessTools
216 ,public FmMutexHelper // _before_ the listener, so the listener is to be destroyed first!
217 ,public ::comphelper::OPropertyChangeListener
219 private:
220 ::comphelper::OPropertyChangeMultiplexer* m_pModelChangeBroadcaster;
222 private:
223 sal_Bool m_bTransparent : 1;
224 sal_Bool m_bAlignedController : 1;
225 sal_Bool m_bAccessingValueProperty : 1;
227 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >
228 m_xCursor;
230 protected:
231 DbGridColumn& m_rColumn;
232 Window* m_pPainter;
233 Window* m_pWindow;
235 protected:
236 // attribute access
237 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& getCursor() const { return m_xCursor; }
239 // control transparency
240 inline sal_Bool isTransparent( ) const { return m_bTransparent; }
241 inline void setTransparent( sal_Bool _bSet ) { m_bTransparent = _bSet; }
243 // control alignment
244 inline void setAlignedController( sal_Bool _bAlign = sal_True ) { m_bAlignedController = _bAlign; }
247 /** determined whether or not the value property is locked
248 @see lockValueProperty
250 inline sal_Bool isValuePropertyLocked() const;
252 /** locks the listening at the value property.
253 <p>This means that every subsequent change now done on the value property of the model ("Text", or "Value",
254 or whatever) is then ignored.<br/>
255 This base class uses this setting in <method>Commit</method>.</p>
256 @precond
257 Value locking can't be nested
258 @see unlockValueProperty
260 inline void lockValueProperty();
261 /** unlocks the listening at the value property
262 @see lockValueProperty
264 inline void unlockValueProperty();
266 protected:
267 // adds the given property to the list of properties which we listen for
268 void doPropertyListening( const ::rtl::OUString& _rPropertyName );
270 // called whenever a property which affects field settings in general is called
271 // you should overwrite this method for every property you add yourself as listener to
272 // with doPropertyListening
273 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
275 // called by _propertyChanged if a property which denotes the column value has changed
276 void implValuePropertyChanged( );
279 public:
280 TYPEINFO();
281 DbCellControl(DbGridColumn& _rColumn, sal_Bool _bText = sal_True);
282 virtual ~DbCellControl();
285 Window* GetControl() const { return m_pWindow; }
287 // control alignment
288 inline sal_Bool isAlignedController() const { return m_bAlignedController; }
289 void AlignControl(sal_Int16 nAlignment);
291 void SetTextLineColor();
292 void SetTextLineColor(const Color& _rColor);
294 // Initialisieren bevor ein Control angezeigt wird
295 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
296 virtual ::svt::CellControllerRef CreateController() const = 0;
298 // Schreiben des Wertes in das Model
299 sal_Bool Commit();
301 // Formatting the field data to output text
302 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL) = 0;
304 virtual void Update(){}
305 // Refresh the control by the field data
306 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) = 0;
308 // Painten eines Zellinhalts im vorgegeben Rechteck
309 virtual void PaintFieldToCell( OutputDevice& rDev, const Rectangle& rRect, const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
310 virtual void PaintCell( OutputDevice& _rDev, const Rectangle& _rRect );
312 void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat );
314 double GetValue(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
316 protected:
317 void invalidatedController();
319 /** commits the content of the control (e.g. the text of an edit field) into the column model
320 (e.g. the "Text" property of the model).
321 <p>To be overwritten in derived classes.</p>
322 @see updateFromModel
324 virtual sal_Bool commitControl( ) = 0;
326 /** updates the current content of the control (e.g. the text of an edit field) from the column model
327 (e.g. the "Text" property of the model).
328 <p>To be overwritten in derived classes.</p>
329 @precond
330 NULL != _rxModel
331 @precond
332 NULL != m_pWindow
334 @see commitControl
336 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel ) = 0;
338 protected:
339 // OPropertyChangeListener
340 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
342 private:
343 void implDoPropertyListening( const ::rtl::OUString& _rPropertyName, sal_Bool _bWarnIfNotExistent = sal_True );
345 /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model
346 void implAdjustReadOnly( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
348 /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model
349 void implAdjustEnabled( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
352 //==================================================================
353 //------------------------------------------------------------------
354 inline sal_Bool DbCellControl::isValuePropertyLocked() const
356 return m_bAccessingValueProperty;
359 //------------------------------------------------------------------
360 inline void DbCellControl::lockValueProperty()
362 OSL_ENSURE( !isValuePropertyLocked(), "DbCellControl::lockValueProperty: not to be nested!" );
363 m_bAccessingValueProperty = sal_True;
366 //------------------------------------------------------------------
367 inline void DbCellControl::unlockValueProperty()
369 OSL_ENSURE( isValuePropertyLocked(), "DbCellControl::lockValueProperty: not locked so far!" );
370 m_bAccessingValueProperty = sal_False;
373 //==================================================================
374 /** a field which is bound to a column which supports the MaxTextLen property
376 class DbLimitedLengthField : public DbCellControl
378 public:
379 TYPEINFO();
381 protected:
382 DbLimitedLengthField( DbGridColumn& _rColumn );
384 protected:
385 // DbCellControl
386 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
388 protected:
389 inline void implSetMaxTextLen( sal_Int16 _nMaxLen )
391 implSetEffectiveMaxTextLen( _nMaxLen ? _nMaxLen : EDIT_NOLIMIT );
393 virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen );
396 //==================================================================
397 class DbTextField : public DbLimitedLengthField
399 ::svt::IEditImplementation* m_pEdit;
400 ::svt::IEditImplementation* m_pPainterImplementation;
401 sal_Int16 m_nKeyType;
402 sal_Bool m_bIsSimpleEdit;
404 protected:
405 ~DbTextField( );
407 public:
408 TYPEINFO();
409 DbTextField(DbGridColumn& _rColumn);
411 ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit; }
412 sal_Bool IsSimpleEdit() const { return m_bIsSimpleEdit; }
414 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
415 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
416 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
417 virtual ::svt::CellControllerRef CreateController() const;
418 virtual void PaintFieldToCell( OutputDevice& _rDev, const Rectangle& _rRect,
419 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField,
420 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter );
422 protected:
423 // DbCellControl
424 virtual sal_Bool commitControl( );
425 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
426 // DbLimitedLengthField
427 virtual void implSetEffectiveMaxTextLen( sal_Int16 _nMaxLen );
430 //==================================================================
431 class DbFormattedField : public DbLimitedLengthField
433 protected:
434 ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > m_xSupplier;
435 sal_Int16 m_nKeyType;
438 public:
439 TYPEINFO();
440 DbFormattedField(DbGridColumn& _rColumn);
441 virtual ~DbFormattedField();
444 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
445 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
446 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
447 virtual ::svt::CellControllerRef CreateController() const;
449 protected:
450 // DbCellControl
451 virtual sal_Bool commitControl( );
452 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
454 // OPropertyChangeListener
455 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
458 //==================================================================
459 class DbCheckBox : public DbCellControl
461 public:
462 TYPEINFO();
463 DbCheckBox(DbGridColumn& _rColumn);
465 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
466 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
467 virtual ::svt::CellControllerRef CreateController() const;
468 virtual void PaintFieldToCell(OutputDevice& rDev, const Rectangle& rRect,
469 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField,
470 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
471 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
473 protected:
474 // DbCellControl
475 virtual sal_Bool commitControl( );
476 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
479 //==================================================================
480 class DbComboBox : public DbCellControl
482 sal_Int16 m_nKeyType;
484 public:
485 TYPEINFO();
486 DbComboBox(DbGridColumn& _rColumn);
488 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
489 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
490 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
491 virtual ::svt::CellControllerRef CreateController() const;
493 void SetList(const ::com::sun::star::uno::Any& rItems);
495 protected:
496 // DbCellControl
497 virtual sal_Bool commitControl( );
498 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
500 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
502 // OPropertyChangeListener
503 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
506 //==================================================================
507 class DbListBox :public DbCellControl
509 sal_Bool m_bBound : 1;
510 ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aValueList;
512 public:
513 TYPEINFO();
514 DbListBox(DbGridColumn& _rColumn);
516 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
517 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
518 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
519 virtual ::svt::CellControllerRef CreateController() const;
521 void SetList(const ::com::sun::star::uno::Any& rItems);
523 protected:
524 // DbCellControl
525 virtual sal_Bool commitControl( );
526 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
528 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
530 // OPropertyChangeListener
531 virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException);
534 //==================================================================
535 class DbPatternField : public DbCellControl
537 public:
538 TYPEINFO();
539 DbPatternField( DbGridColumn& _rColumn, const ::comphelper::ComponentContext& _rContext );
540 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
541 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
542 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
543 virtual ::svt::CellControllerRef CreateController() const;
545 protected:
546 /// DbCellControl
547 virtual sal_Bool commitControl( );
548 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
550 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
552 private:
553 String impl_formatText( const String& _rText );
555 private:
556 ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter;
557 ::std::auto_ptr< ::dbtools::FormattedColumnValue > m_pPaintFormatter;
558 ::comphelper::ComponentContext m_aContext;
561 //==================================================================
562 class DbSpinField : public DbCellControl
564 private:
565 sal_Int16 m_nStandardAlign;
567 public:
568 TYPEINFO();
570 protected:
571 DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign = com::sun::star::awt::TextAlign::RIGHT );
573 public:
574 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxCursor );
575 virtual ::svt::CellControllerRef CreateController() const;
577 protected:
578 virtual SpinField* createField(
579 Window* _pParent,
580 WinBits _nFieldStyle,
581 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
582 ) = 0;
585 //==================================================================
586 class DbDateField : public DbSpinField
588 public:
589 TYPEINFO();
590 DbDateField(DbGridColumn& _rColumn);
591 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
592 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
594 protected:
595 // DbCellControl
596 virtual sal_Bool commitControl( );
597 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
599 // DbSpinField
600 virtual SpinField* createField(
601 Window* _pParent,
602 WinBits _nFieldStyle,
603 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
606 /// initializes everything which relates to the properties describing the numeric behaviour
607 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
610 //==================================================================
611 class DbTimeField : public DbSpinField
613 public:
614 TYPEINFO();
615 DbTimeField(DbGridColumn& _rColumn);
616 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
617 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
619 protected:
620 // DbCellControl
621 virtual sal_Bool commitControl( );
622 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
624 // DbSpinField
625 virtual SpinField* createField(
626 Window* _pParent,
627 WinBits _nFieldStyle,
628 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
631 /// initializes everything which relates to the properties describing the numeric behaviour
632 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
635 //==================================================================
636 class DbCurrencyField : public DbSpinField
638 sal_Int16 m_nScale;
640 public:
641 TYPEINFO();
642 DbCurrencyField(DbGridColumn& _rColumn);
643 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
644 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
646 double GetCurrency(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter) const;
648 protected:
649 // DbCellControl
650 virtual sal_Bool commitControl( );
651 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
653 // DbSpinField
654 virtual SpinField* createField(
655 Window* _pParent,
656 WinBits _nFieldStyle,
657 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
660 /// initializes everything which relates to the properties describing the numeric behaviour
661 virtual void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
664 //==================================================================
665 class DbNumericField : public DbSpinField
667 public:
668 TYPEINFO();
669 DbNumericField(DbGridColumn& _rColumn);
670 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
671 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
673 protected:
674 // DbCellControl
675 virtual sal_Bool commitControl( );
676 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
678 // DbSpinField
679 virtual SpinField* createField(
680 Window* _pParent,
681 WinBits _nFieldStyle,
682 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel
685 /// initializes everything which relates to the properties describing the numeric behaviour
686 void implAdjustGenericFieldSetting( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxModel );
689 //==================================================================
690 class DbFilterField
691 :public DbCellControl
692 ,public ::svxform::OSQLParserClient
694 ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aValueList;
695 XubString m_aText;
696 Link m_aCommitLink;
697 sal_Int16 m_nControlClass;
698 sal_Bool m_bFilterList : 1;
699 sal_Bool m_bFilterListFilled : 1;
700 sal_Bool m_bBound : 1;
702 public:
703 TYPEINFO();
704 DbFilterField(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,DbGridColumn& _rColumn);
705 virtual ~DbFilterField();
707 virtual void Init( Window& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& xCursor );
708 virtual ::svt::CellControllerRef CreateController() const;
709 virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect);
710 virtual void Update();
711 virtual XubString GetFormatText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter, Color** ppColor = NULL);
712 virtual void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField, const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
714 const XubString& GetText() const {return m_aText;}
715 void SetText(const XubString& rText);
717 void SetCommitHdl( const Link& rLink ) { m_aCommitLink = rLink; }
718 const Link& GetCommitHdl() const { return m_aCommitLink; }
720 protected:
722 // DbCellControl
723 virtual sal_Bool commitControl( );
724 virtual void updateFromModel( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _rxModel );
726 protected:
727 void SetList(const ::com::sun::star::uno::Any& rItems, sal_Bool bComboBox);
728 void CreateControl(Window* pParent, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xModel);
729 DECL_LINK( OnClick, void* );
732 //==================================================================
733 // Base class providing the access to a grid cell
734 //==================================================================
735 class FmXGridCell : public ::cppu::OComponentHelper,
736 public ::com::sun::star::awt::XControl,
737 public ::com::sun::star::form::XBoundControl
739 protected:
740 ::osl::Mutex m_aMutex;
741 DbGridColumn* m_pColumn;
742 DbCellControl* m_pCellControl;
744 virtual ~FmXGridCell();
745 public:
746 TYPEINFO();
747 FmXGridCell(DbGridColumn* pColumn, DbCellControl* pControl);
750 DECLARE_UNO3_AGG_DEFAULTS(FmXGridCell, OComponentHelper);
751 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
753 void SetTextLineColor();
754 void SetTextLineColor(const Color& _rColor);
756 // XTypeProvider
757 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(::com::sun::star::uno::RuntimeException);
759 // OComponentHelper
760 virtual void SAL_CALL disposing();
762 // ::com::sun::star::lang::XComponent
763 virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException){OComponentHelper::dispose();}
764 virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener)throw(::com::sun::star::uno::RuntimeException) { OComponentHelper::addEventListener(aListener);}
765 virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener)throw(::com::sun::star::uno::RuntimeException) { OComponentHelper::removeEventListener(aListener);}
767 // ::com::sun::star::awt::XControl
768 virtual void SAL_CALL setContext(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& /*Context*/) throw(::com::sun::star::uno::RuntimeException){}
769 virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getContext() throw(::com::sun::star::uno::RuntimeException);
770 virtual void SAL_CALL createPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit >& /*Toolkit*/, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& /*Parent*/) throw(::com::sun::star::uno::RuntimeException){}
772 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > SAL_CALL getPeer() throw (::com::sun::star::uno::RuntimeException) {return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > ();}
773 virtual sal_Bool SAL_CALL setModel(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& /*Model*/) throw (::com::sun::star::uno::RuntimeException) {return sal_False;}
774 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > SAL_CALL getModel() throw (::com::sun::star::uno::RuntimeException);
775 virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > SAL_CALL getView() throw (::com::sun::star::uno::RuntimeException) {return ::com::sun::star::uno::Reference< ::com::sun::star::awt::XView > ();}
776 virtual void SAL_CALL setDesignMode(sal_Bool /*bOn*/) throw (::com::sun::star::uno::RuntimeException) {}
777 virtual sal_Bool SAL_CALL isDesignMode() throw (::com::sun::star::uno::RuntimeException) {return sal_False;}
778 virtual sal_Bool SAL_CALL isTransparent() throw (::com::sun::star::uno::RuntimeException) {return sal_False;}
780 // ::com::sun::star::form::XBoundControl
781 virtual sal_Bool SAL_CALL getLock() throw(::com::sun::star::uno::RuntimeException);
782 virtual void SAL_CALL setLock(sal_Bool _bLock) throw(::com::sun::star::uno::RuntimeException);
784 sal_Bool Commit() {return m_pCellControl->Commit();}
785 void ImplInitWindow( Window& rParent, const InitWindowFacet _eInitWhat )
786 { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); }
788 sal_Bool isAlignedController() const { return m_pCellControl->isAlignedController(); }
789 void AlignControl(sal_Int16 nAlignment)
790 { m_pCellControl->AlignControl(nAlignment);}
793 //==================================================================
794 class FmXDataCell : public FmXGridCell
796 public:
797 TYPEINFO();
798 FmXDataCell(DbGridColumn* pColumn, DbCellControl* pControl):FmXGridCell(pColumn, pControl){}
800 virtual void PaintFieldToCell(OutputDevice& rDev,
801 const Rectangle& rRect,
802 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField,
803 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
805 void UpdateFromField(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField,
806 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter)
807 { m_pCellControl->UpdateFromField(xField, xFormatter); }
809 protected:
810 void UpdateFromColumn();
813 //==================================================================
814 class FmXTextCell : public FmXDataCell
816 protected:
817 /** determines whether the text of this cell can be painted directly, without
818 using the painter control
820 If this is <TRUE/>, the <member>PaintCell</member> method will simply use the text as returned
821 by <member>GetText</member>, and draw it onto the device passed to <member>PaintFieldToCell</member>,
822 while respecting the current alignment settings.
824 If this is <FALSE/>, the <member>PaintFieldToCell</member> request will be forwarded to the painter
825 control (<member>m_pPainter</member>). This is more expensive, but the only option
826 if your painting involves more that a simple DrawText.
828 This member is <TRUE/> by default, and can be modified by derived classes.
830 sal_Bool m_bFastPaint;
832 public:
833 TYPEINFO();
834 FmXTextCell( DbGridColumn* pColumn, DbCellControl* pControl )
835 :FmXDataCell( pColumn, pControl )
836 ,m_bFastPaint( sal_True )
840 virtual void PaintFieldToCell(OutputDevice& rDev,
841 const Rectangle& rRect,
842 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& xField,
843 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter);
845 XubString GetText(const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxField,
846 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xFormatter,
847 Color** ppColor = NULL)
848 {return m_pCellControl->GetFormatText(_rxField, xFormatter, ppColor);}
851 //==================================================================
852 class FmXEditCell : public FmXTextCell,
853 public ::com::sun::star::awt::XTextComponent
855 protected:
856 ::cppu::OInterfaceContainerHelper m_aTextListeners;
857 ::svt::IEditImplementation* m_pEditImplementation;
858 bool m_bOwnEditImplementation;
860 virtual ~FmXEditCell();
861 public:
862 FmXEditCell(DbGridColumn* pColumn, DbCellControl* pControl);
864 DECLARE_UNO3_AGG_DEFAULTS(FmXEditCell, FmXTextCell);
865 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
867 // XTypeProvider
868 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
870 // OComponentHelper
871 virtual void SAL_CALL disposing();
873 // ::com::sun::star::awt::XTextComponent
874 virtual void SAL_CALL addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
875 virtual void SAL_CALL removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
876 virtual void SAL_CALL setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException);
877 virtual void SAL_CALL insertText(const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text) throw(::com::sun::star::uno::RuntimeException);
878 virtual ::rtl::OUString SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
879 virtual ::rtl::OUString SAL_CALL getSelectedText() throw(::com::sun::star::uno::RuntimeException);
880 virtual void SAL_CALL setSelection(const ::com::sun::star::awt::Selection& aSelection) throw(::com::sun::star::uno::RuntimeException);
881 virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException);
882 virtual sal_Bool SAL_CALL isEditable() throw(::com::sun::star::uno::RuntimeException);
883 virtual void SAL_CALL setEditable(sal_Bool bEditable) throw(::com::sun::star::uno::RuntimeException);
884 virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException);
885 virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException);
887 protected:
888 DECL_LINK( OnTextChanged, void* );
891 //==================================================================
892 class FmXCheckBoxCell : public FmXDataCell,
893 public ::com::sun::star::awt::XCheckBox
895 ::cppu::OInterfaceContainerHelper m_aItemListeners;
896 CheckBox* m_pBox;
897 protected:
898 virtual ~FmXCheckBoxCell();
899 public:
900 FmXCheckBoxCell(DbGridColumn* pColumn, DbCellControl* pControl);
903 // UNO
904 DECLARE_UNO3_AGG_DEFAULTS(FmXCheckBoxCell, FmXDataCell);
905 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
906 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
908 // OComponentHelper
909 virtual void SAL_CALL disposing();
911 // ::com::sun::star::awt::XCheckBox
912 virtual void SAL_CALL addItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
913 virtual void SAL_CALL removeItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
914 virtual sal_Int16 SAL_CALL getState() throw(::com::sun::star::uno::RuntimeException);
915 virtual void SAL_CALL setState(sal_Int16 n) throw(::com::sun::star::uno::RuntimeException);
916 virtual void SAL_CALL setLabel(const ::rtl::OUString& Label) throw(::com::sun::star::uno::RuntimeException);
917 virtual void SAL_CALL enableTriState(sal_Bool b) throw(::com::sun::star::uno::RuntimeException);
919 protected:
920 DECL_LINK( OnClick, void* );
923 //==================================================================
924 class FmXListBoxCell : public FmXTextCell,
925 public ::com::sun::star::awt::XListBox
927 ::cppu::OInterfaceContainerHelper m_aItemListeners,
928 m_aActionListeners;
929 ListBox* m_pBox;
930 protected:
931 virtual ~FmXListBoxCell();
932 public:
933 FmXListBoxCell(DbGridColumn* pColumn, DbCellControl* pControl);
936 DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell);
937 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
938 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
940 // OComponentHelper
941 virtual void SAL_CALL disposing();
943 // ::com::sun::star::awt::XListBox
944 virtual void SAL_CALL addItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
945 virtual void SAL_CALL removeItemListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XItemListener >& l) throw(::com::sun::star::uno::RuntimeException);
946 virtual void SAL_CALL addActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l) throw(::com::sun::star::uno::RuntimeException);
947 virtual void SAL_CALL removeActionListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XActionListener >& l) throw(::com::sun::star::uno::RuntimeException);
948 virtual void SAL_CALL addItem(const ::rtl::OUString& aItem, sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
949 virtual void SAL_CALL addItems(const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
950 virtual void SAL_CALL removeItems(sal_Int16 nPos, sal_Int16 nCount) throw(::com::sun::star::uno::RuntimeException);
951 virtual sal_Int16 SAL_CALL getItemCount() throw(::com::sun::star::uno::RuntimeException);
952 virtual ::rtl::OUString SAL_CALL getItem(sal_Int16 nPos) throw(::com::sun::star::uno::RuntimeException);
953 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getItems() throw(::com::sun::star::uno::RuntimeException);
954 virtual sal_Int16 SAL_CALL getSelectedItemPos() throw(::com::sun::star::uno::RuntimeException);
955 virtual ::com::sun::star::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos() throw(::com::sun::star::uno::RuntimeException);
956 virtual ::rtl::OUString SAL_CALL getSelectedItem() throw(::com::sun::star::uno::RuntimeException);
957 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSelectedItems() throw(::com::sun::star::uno::RuntimeException);
958 virtual void SAL_CALL SAL_CALL selectItemPos(sal_Int16 nPos, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException);
959 virtual void SAL_CALL SAL_CALL selectItemsPos(const ::com::sun::star::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException);
960 virtual void SAL_CALL SAL_CALL selectItem(const ::rtl::OUString& aItem, sal_Bool bSelect) throw(::com::sun::star::uno::RuntimeException);
961 virtual sal_Bool SAL_CALL isMutipleMode() throw(::com::sun::star::uno::RuntimeException);
962 virtual void SAL_CALL SAL_CALL setMultipleMode(sal_Bool bMulti) throw(::com::sun::star::uno::RuntimeException);
963 virtual sal_Int16 SAL_CALL getDropDownLineCount() throw(::com::sun::star::uno::RuntimeException);
964 virtual void SAL_CALL SAL_CALL setDropDownLineCount(sal_Int16 nLines) throw(::com::sun::star::uno::RuntimeException);
965 virtual void SAL_CALL SAL_CALL makeVisible(sal_Int16 nEntry) throw(::com::sun::star::uno::RuntimeException);
967 protected:
968 DECL_LINK( OnSelect, VclWindowEvent* );
969 DECL_LINK( OnDoubleClick, void* );
972 //==================================================================
973 class FmXFilterCell :public FmXGridCell
974 ,public ::com::sun::star::awt::XTextComponent
975 ,public ::com::sun::star::lang::XUnoTunnel
977 ::cppu::OInterfaceContainerHelper m_aTextListeners;
978 protected:
979 virtual ~FmXFilterCell();
980 public:
981 TYPEINFO();
982 FmXFilterCell(DbGridColumn* pColumn = NULL, DbCellControl* pControl = NULL);
985 DECLARE_UNO3_AGG_DEFAULTS(FmXFilterCell, FmXGridCell);
986 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type& _rType ) throw(::com::sun::star::uno::RuntimeException);
987 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
989 // XUnoTunnel
990 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException);
992 // helpers for XUnoTunnel
993 static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId();
994 static FmXFilterCell* getImplementation(
995 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _rxObject);
997 // painting the filter text
998 virtual void PaintCell(OutputDevice& rDev, const Rectangle& rRect);
999 void Update(){m_pCellControl->Update();}
1001 // OComponentHelper
1002 virtual void SAL_CALL disposing();
1004 // ::com::sun::star::awt::XTextComponent
1005 virtual void SAL_CALL addTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
1006 virtual void SAL_CALL removeTextListener(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTextListener >& l) throw(::com::sun::star::uno::RuntimeException);
1007 virtual void SAL_CALL setText(const ::rtl::OUString& aText) throw(::com::sun::star::uno::RuntimeException);
1008 virtual void SAL_CALL insertText(const ::com::sun::star::awt::Selection& Sel, const ::rtl::OUString& Text) throw(::com::sun::star::uno::RuntimeException);
1009 virtual ::rtl::OUString SAL_CALL getText() throw(::com::sun::star::uno::RuntimeException);
1010 virtual ::rtl::OUString SAL_CALL getSelectedText() throw(::com::sun::star::uno::RuntimeException);
1011 virtual void SAL_CALL setSelection(const ::com::sun::star::awt::Selection& aSelection) throw(::com::sun::star::uno::RuntimeException);
1012 virtual ::com::sun::star::awt::Selection SAL_CALL getSelection() throw(::com::sun::star::uno::RuntimeException);
1013 virtual sal_Bool SAL_CALL isEditable() throw(::com::sun::star::uno::RuntimeException);
1014 virtual void SAL_CALL setEditable(sal_Bool bEditable) throw(::com::sun::star::uno::RuntimeException);
1015 virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) throw(::com::sun::star::uno::RuntimeException);
1016 virtual sal_Int16 SAL_CALL getMaxTextLen() throw(::com::sun::star::uno::RuntimeException);
1018 protected:
1019 DECL_LINK( OnCommit, void* );
1022 #endif // _SVX_GRIDCELL_HXX