calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / svx / source / inc / gridcell.hxx
blob8b62384343f5f7c3f3930e53d8c5f58ca11cbd69
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVX_SOURCE_INC_GRIDCELL_HXX
21 #define INCLUDED_SVX_SOURCE_INC_GRIDCELL_HXX
23 #include <memory>
24 #include <svx/gridctrl.hxx>
26 #include "sqlparserclient.hxx"
28 #include <com/sun/star/sdb/XColumn.hpp>
29 #include <com/sun/star/form/XBoundControl.hpp>
30 #include <com/sun/star/awt/XTextComponent.hpp>
31 #include <com/sun/star/awt/XListBox.hpp>
32 #include <com/sun/star/awt/XComboBox.hpp>
33 #include <com/sun/star/awt/TextAlign.hpp>
34 #include <com/sun/star/awt/XControlModel.hpp>
35 #include <com/sun/star/awt/XControl.hpp>
36 #include <com/sun/star/awt/XCheckBox.hpp>
37 #include <com/sun/star/awt/XButton.hpp>
38 #include <com/sun/star/lang/XUnoTunnel.hpp>
39 #include <com/sun/star/form/XChangeBroadcaster.hpp>
40 #include <com/sun/star/awt/XWindow.hpp>
41 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
43 #include <comphelper/propmultiplex.hxx>
44 #include <comphelper/interfacecontainer3.hxx>
45 #include <comphelper/uno3.hxx>
46 #include <connectivity/formattedcolumnvalue.hxx>
47 #include <cppuhelper/basemutex.hxx>
48 #include <cppuhelper/component.hxx>
49 #include <cppuhelper/implbase1.hxx>
50 #include <cppuhelper/implbase2.hxx>
51 #include <comphelper/diagnose_ex.hxx>
53 class DbCellControl;
54 class Edit;
55 class FmXGridCell;
56 namespace dbtools {
57 class FormattedColumnValue;
60 // DbGridColumn, column description
62 class DbGridColumn
64 friend class DbGridControl;
66 css::uno::Reference< css::beans::XPropertySet > m_xModel;
67 css::uno::Reference< css::beans::XPropertySet > m_xField; // connection to the database field
68 ::svt::CellControllerRef m_xController; // structure for managing the controls for a column
69 // this is positioned by the DbBrowseBox on the respective
70 // cells of a column
71 rtl::Reference<FmXGridCell> m_pCell;
72 DbGridControl& m_rParent;
73 sal_Int32 m_nLastVisibleWidth; // only valid if m_bHidden == sal_True
74 sal_Int32 m_nFormatKey;
75 sal_Int16 m_nFieldType;
76 sal_Int16 m_nTypeId;
77 sal_uInt16 m_nId;
78 sal_Int16 m_nFieldPos;
79 sal_Int16 m_nAlign; // specified with TXT_ALIGN_LEFT...
80 bool m_bReadOnly : 1;
81 bool m_bAutoValue : 1;
82 bool m_bInSave : 1;
83 bool m_bNumeric : 1;
84 bool m_bObject : 1; // does the column reference an object datatype?
85 bool m_bHidden : 1;
86 bool m_bLocked : 1;
88 static ::svt::CellControllerRef s_xEmptyController;
89 // used by locked columns
90 public:
91 DbGridColumn(sal_uInt16 _nId, DbGridControl& rParent)
92 :m_rParent(rParent)
93 ,m_nLastVisibleWidth(-1)
94 ,m_nFormatKey(0)
95 ,m_nFieldType(0)
96 ,m_nTypeId(0)
97 ,m_nId(_nId)
98 ,m_nFieldPos(-1)
99 ,m_nAlign(css::awt::TextAlign::LEFT)
100 ,m_bReadOnly(false)
101 ,m_bAutoValue(false)
102 ,m_bInSave(false)
103 ,m_bNumeric(false)
104 ,m_bObject(false)
105 ,m_bHidden(false)
106 ,m_bLocked(false)
110 ~DbGridColumn();
112 const css::uno::Reference< css::beans::XPropertySet >& getModel() const { return m_xModel; }
113 void setModel(const css::uno::Reference< css::beans::XPropertySet >& _xModel);
116 sal_uInt16 GetId() const {return m_nId;}
117 bool IsReadOnly() const {return m_bReadOnly;}
118 bool IsAutoValue() const {return m_bAutoValue;}
119 sal_Int16 GetAlignment() const {return m_nAlign;}
120 sal_Int16 GetFieldPos() const {return m_nFieldPos; }
121 bool IsNumeric() const {return m_bNumeric;}
122 bool IsHidden() const {return m_bHidden;}
123 sal_Int32 GetKey() const {return m_nFormatKey;}
124 const ::svt::CellControllerRef& GetController() const {return m_bLocked ? s_xEmptyController : m_xController;}
125 const css::uno::Reference< css::beans::XPropertySet >& GetField() const {return m_xField;}
126 DbGridControl& GetParent() const {return m_rParent;}
127 FmXGridCell* GetCell() const {return m_pCell.get();}
129 css::uno::Reference< css::sdb::XColumn > GetCurrentFieldValue() const;
131 // Drawing a field at a position. If a view is set, it takes over the drawing,
132 // e.g., for checkboxes.
133 void Paint(OutputDevice& rDev,
134 const tools::Rectangle& rRect,
135 const DbGridRow* pRow,
136 const css::uno::Reference< css::util::XNumberFormatter >& xFormatter);
139 // Initializing in the alive mode.
140 // If no ColumnController is set, a default initialization is performed.
141 void CreateControl(sal_Int32 _nFieldPos, const css::uno::Reference< css::beans::XPropertySet >& xField, sal_Int32 nTypeId);
142 void UpdateControl()
144 css::uno::Reference< css::beans::XPropertySet > xField(m_xField);
145 CreateControl(m_nFieldPos, xField, m_nTypeId);
148 // Editing a Zelle
149 void UpdateFromField(const DbGridRow* pRow, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter);
150 bool Commit();
152 // releasing all the data required for the AliveMode
153 void Clear();
155 OUString GetCellText(const DbGridRow* pRow, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) const;
156 OUString GetCellText(const css::uno::Reference< css::sdb::XColumn >& xField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) const;
158 void SetReadOnly(bool bRead){m_bReadOnly = bRead;}
159 void SetObject(sal_Int16 nPos) {m_bObject = m_bReadOnly = true; m_nFieldPos = nPos;}
161 void ImplInitWindow( vcl::Window const & rParent, const InitWindowFacet _eInitWhat );
163 // properties that can bleed through onto the css::frame::Controller
164 sal_Int16 SetAlignment(sal_Int16 _nAlign);
165 // if _nAlign is -1, the alignment is calculated from the type of the field we are bound to
166 // the value really set is returned
167 sal_Int16 SetAlignmentFromModel(sal_Int16 nStandardAlign);
168 // set the alignment according to the "Align"-property of m_xModel, use the given standard
169 // alignment if the property if void, return the really set alignment
171 // column locking
172 bool isLocked() const { return m_bLocked; }
173 void setLock(bool _bLock);
175 private:
176 /** attaches or detaches our cell object to the SctriptEventAttacherManager implemented
177 by our model's parent
179 void impl_toggleScriptManager_nothrow( bool _bAttach );
183 // DbCellControl, provides the data for a CellController.
184 // Is usually only required for complex controls such as combo boxes.
186 class DbCellControl
187 :public cppu::BaseMutex // _before_ the listener, so the listener is to be destroyed first!
188 ,public ::comphelper::OPropertyChangeListener
190 private:
191 rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pModelChangeBroadcaster;
192 rtl::Reference<::comphelper::OPropertyChangeMultiplexer> m_pFieldChangeBroadcaster;
194 private:
195 bool m_bTransparent : 1;
196 bool m_bAlignedController : 1;
197 bool m_bAccessingValueProperty : 1;
199 css::uno::Reference< css::sdbc::XRowSet >
200 m_xCursor;
202 protected:
203 DbGridColumn& m_rColumn;
204 VclPtr<svt::ControlBase> m_pPainter;
205 VclPtr<svt::ControlBase> m_pWindow;
207 protected:
208 // attribute access
209 const css::uno::Reference< css::sdbc::XRowSet >& getCursor() const { return m_xCursor; }
211 // control transparency
212 bool isTransparent( ) const { return m_bTransparent; }
213 void setTransparent( bool _bSet ) { m_bTransparent = _bSet; }
215 // control alignment
216 void setAlignedController( bool _bAlign ) { m_bAlignedController = _bAlign; }
219 /** determined whether or not the value property is locked
220 @see lockValueProperty
222 inline bool isValuePropertyLocked() const;
224 /** locks the listening at the value property.
225 <p>This means that every subsequent change now done on the value property of the model ("Text", or "Value",
226 or whatever) is then ignored.<br/>
227 This base class uses this setting in <method>Commit</method>.</p>
228 @precond
229 Value locking can't be nested
230 @see unlockValueProperty
232 inline void lockValueProperty();
233 /** unlocks the listening at the value property
234 @see lockValueProperty
236 inline void unlockValueProperty();
238 protected:
239 // adds the given property to the list of properties which we listen for
240 void doPropertyListening( const OUString& _rPropertyName );
242 // called whenever a property which affects field settings in general is called
243 // you should overwrite this method for every property you add yourself as listener to
244 // with doPropertyListening
245 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel );
247 // called by _propertyChanged if a property which denotes the column value has changed
248 void implValuePropertyChanged( );
251 public:
252 DbCellControl(DbGridColumn& _rColumn);
253 virtual ~DbCellControl() override;
255 svt::ControlBase& GetWindow() const
257 ENSURE_OR_THROW( m_pWindow, "no window" );
258 return *m_pWindow;
261 // control alignment
262 bool isAlignedController() const { return m_bAlignedController; }
263 void AlignControl(sal_Int16 nAlignment);
265 void SetTextLineColor();
266 void SetTextLineColor(const Color& _rColor);
268 // initializing before a control is displayed
269 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor );
270 virtual ::svt::CellControllerRef CreateController() const = 0;
272 // writing the value into the model
273 bool Commit();
275 // Formatting the field data to output text
276 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) = 0;
278 virtual void Update(){}
279 // Refresh the control by the field data
280 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) = 0;
282 // painting a cell content in the specified rectangle
283 virtual void PaintFieldToCell( OutputDevice& rDev, const tools::Rectangle& rRect, const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter);
284 virtual void PaintCell( OutputDevice& _rDev, const tools::Rectangle& _rRect );
286 void ImplInitWindow( vcl::Window const & rParent, const InitWindowFacet _eInitWhat );
288 double GetValue(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) const;
290 protected:
291 void invalidatedController();
293 /** commits the content of the control (e.g. the text of an edit field) into the column model
294 (e.g. the "Text" property of the model).
295 <p>To be overwritten in derived classes.</p>
296 @see updateFromModel
298 virtual bool commitControl( ) = 0;
300 /** updates the current content of the control (e.g. the text of an edit field) from the column model
301 (e.g. the "Text" property of the model).
302 <p>To be overwritten in derived classes.</p>
303 @precond
304 NULL != _rxModel
305 @precond
306 NULL != m_pWindow
308 @see commitControl
310 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) = 0;
312 protected:
313 // OPropertyChangeListener
314 virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override;
316 private:
317 void implDoPropertyListening( const OUString& _rPropertyName, bool _bWarnIfNotExistent );
319 /// updates the "readonly" setting on m_pWindow, according to the respective property value in the given model
320 void implAdjustReadOnly( const css::uno::Reference< css::beans::XPropertySet >& _rxModel,bool i_bReadOnly );
322 /// updates the "enabled" setting on m_pWindow, according to the respective property value in the given model
323 void implAdjustEnabled( const css::uno::Reference< css::beans::XPropertySet >& _rxModel );
327 inline bool DbCellControl::isValuePropertyLocked() const
329 return m_bAccessingValueProperty;
333 inline void DbCellControl::lockValueProperty()
335 OSL_ENSURE( !isValuePropertyLocked(), "DbCellControl::lockValueProperty: not to be nested!" );
336 m_bAccessingValueProperty = true;
340 inline void DbCellControl::unlockValueProperty()
342 OSL_ENSURE( isValuePropertyLocked(), "DbCellControl::lockValueProperty: not locked so far!" );
343 m_bAccessingValueProperty = false;
347 /** a field which is bound to a column which supports the MaxTextLen property
349 class DbLimitedLengthField : public DbCellControl
351 public:
353 protected:
354 DbLimitedLengthField( DbGridColumn& _rColumn );
356 protected:
357 // DbCellControl
358 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
360 protected:
361 void implSetMaxTextLen( sal_Int16 _nMaxLen )
363 implSetEffectiveMaxTextLen(_nMaxLen);
365 virtual void implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen );
369 class DbTextField final : public DbLimitedLengthField
371 std::unique_ptr<::svt::IEditImplementation> m_pEdit;
372 std::unique_ptr<::svt::IEditImplementation> m_pPainterImplementation;
373 bool m_bIsMultiLineEdit;
375 virtual ~DbTextField( ) override;
377 public:
378 DbTextField(DbGridColumn& _rColumn);
380 ::svt::IEditImplementation* GetEditImplementation() { return m_pEdit.get(); }
381 bool IsMultiLineEdit() const { return m_bIsMultiLineEdit; }
383 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
384 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
385 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
386 virtual ::svt::CellControllerRef CreateController() const override;
387 virtual void PaintFieldToCell( OutputDevice& _rDev, const tools::Rectangle& _rRect,
388 const css::uno::Reference< css::sdb::XColumn >& _rxField,
389 const css::uno::Reference< css::util::XNumberFormatter >& _rxFormatter ) override;
391 private:
392 // DbCellControl
393 virtual bool commitControl( ) override;
394 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
395 // DbLimitedLengthField
396 virtual void implSetEffectiveMaxTextLen( sal_Int32 _nMaxLen ) override;
400 class DbFormattedField final : public DbLimitedLengthField
402 public:
403 DbFormattedField(DbGridColumn& _rColumn);
404 virtual ~DbFormattedField() override;
406 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
407 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
408 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
409 virtual ::svt::CellControllerRef CreateController() const override;
411 private:
412 // DbCellControl
413 virtual bool commitControl( ) override;
414 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
416 // OPropertyChangeListener
417 virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override;
419 css::uno::Reference< css::util::XNumberFormatsSupplier > m_xSupplier;
423 class DbCheckBox final : public DbCellControl
425 public:
426 DbCheckBox(DbGridColumn& _rColumn);
428 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
429 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
430 virtual ::svt::CellControllerRef CreateController() const override;
431 virtual void PaintFieldToCell(OutputDevice& rDev, const tools::Rectangle& rRect,
432 const css::uno::Reference< css::sdb::XColumn >& _rxField,
433 const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
434 virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect) override;
435 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
437 private:
438 // DbCellControl
439 virtual bool commitControl( ) override;
440 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
444 class DbComboBox final : public DbCellControl
447 public:
448 DbComboBox(DbGridColumn& _rColumn);
450 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
451 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
452 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
453 virtual ::svt::CellControllerRef CreateController() const override;
455 void SetList(const css::uno::Any& rItems);
457 private:
458 // DbCellControl
459 virtual bool commitControl( ) override;
460 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
462 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
464 // OPropertyChangeListener
465 virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override;
469 class DbListBox final : public DbCellControl
471 bool m_bBound : 1;
472 css::uno::Sequence< OUString > m_aValueList;
474 public:
475 DbListBox(DbGridColumn& _rColumn);
477 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
478 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
479 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
480 virtual ::svt::CellControllerRef CreateController() const override;
482 void SetList(const css::uno::Any& rItems);
484 private:
485 // DbCellControl
486 virtual bool commitControl( ) override;
487 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
489 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
491 // OPropertyChangeListener
492 virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override;
496 class DbPatternField final : public DbCellControl
498 public:
499 DbPatternField( DbGridColumn& _rColumn, const css::uno::Reference<css::uno::XComponentContext>& _rContext );
500 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
501 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
502 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
503 virtual ::svt::CellControllerRef CreateController() const override;
505 private:
506 /// DbCellControl
507 virtual bool commitControl( ) override;
508 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
510 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
512 OUString impl_formatText(const OUString& _rText);
514 ::std::unique_ptr< ::dbtools::FormattedColumnValue > m_pValueFormatter;
515 ::std::unique_ptr< ::dbtools::FormattedColumnValue > m_pPaintFormatter;
516 css::uno::Reference<css::uno::XComponentContext> m_xContext;
520 class DbSpinField : public DbCellControl
522 private:
523 sal_Int16 m_nStandardAlign;
525 public:
527 protected:
528 DbSpinField( DbGridColumn& _rColumn, sal_Int16 _nStandardAlign = css::awt::TextAlign::RIGHT );
530 public:
531 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& _rxCursor ) override;
532 virtual ::svt::CellControllerRef CreateController() const override;
534 protected:
535 virtual VclPtr<svt::ControlBase> createField(
536 BrowserDataWin* _pParent,
537 bool bSpinButton,
538 const css::uno::Reference< css::beans::XPropertySet >& _rxModel
539 ) = 0;
542 class DbDateField final : public DbSpinField
544 public:
545 DbDateField(DbGridColumn& _rColumn);
546 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
547 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
549 private:
550 // DbCellControl
551 virtual bool commitControl( ) override;
552 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
554 // DbSpinField
555 virtual VclPtr<svt::ControlBase> createField(
556 BrowserDataWin* _pParent,
557 bool bSpinButton,
558 const css::uno::Reference< css::beans::XPropertySet >& _rxModel
559 ) override;
561 /// initializes everything which relates to the properties describing the numeric behaviour
562 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
565 class DbTimeField final : public DbSpinField
567 public:
568 DbTimeField(DbGridColumn& _rColumn);
569 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
570 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
572 private:
573 // DbCellControl
574 virtual bool commitControl( ) override;
575 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
577 // DbSpinField
578 virtual VclPtr<svt::ControlBase> createField(
579 BrowserDataWin* _pParent,
580 bool bSpinButton,
581 const css::uno::Reference< css::beans::XPropertySet >& _rxModel
582 ) override;
584 /// initializes everything which relates to the properties describing the numeric behaviour
585 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
588 class DbCurrencyField final : public DbSpinField
590 public:
591 DbCurrencyField(DbGridColumn& _rColumn);
592 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
593 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
595 private:
596 // DbCellControl
597 virtual bool commitControl( ) override;
598 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
600 // DbSpinField
601 virtual VclPtr<svt::ControlBase> createField(
602 BrowserDataWin* _pParent,
603 bool bSpinButton,
604 const css::uno::Reference< css::beans::XPropertySet >& _rxModel
605 ) override;
607 /// initializes everything which relates to the properties describing the numeric behaviour
608 virtual void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
611 class DbNumericField final : public DbSpinField
613 public:
614 DbNumericField(DbGridColumn& _rColumn);
616 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
617 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
619 private:
620 // DbCellControl
621 virtual bool commitControl( ) override;
622 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
624 // DbSpinField
625 virtual VclPtr<svt::ControlBase> createField(
626 BrowserDataWin* _pParent,
627 bool bSpinButton,
628 const css::uno::Reference< css::beans::XPropertySet >& _rxModel
629 ) override;
631 /// initializes everything which relates to the properties describing the numeric behaviour
632 void implAdjustGenericFieldSetting( const css::uno::Reference< css::beans::XPropertySet >& _rxModel ) override;
635 class DbFilterField final
636 :public DbCellControl
637 ,public ::svxform::OSQLParserClient
639 public:
640 DbFilterField(const css::uno::Reference< css::uno::XComponentContext >& rxContext, DbGridColumn& _rColumn);
641 virtual ~DbFilterField() override;
643 virtual void Init( BrowserDataWin& rParent, const css::uno::Reference< css::sdbc::XRowSet >& xCursor ) override;
644 virtual ::svt::CellControllerRef CreateController() const override;
645 virtual void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect) override;
646 virtual void Update() override;
647 virtual OUString GetFormatText(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter, const Color** ppColor = nullptr) override;
648 virtual void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& _rxField, const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
650 const OUString& GetText() const {return m_aText;}
651 void SetText(const OUString& rText);
653 void SetCommitHdl( const Link<DbFilterField&,void>& rLink ) { m_aCommitLink = rLink; }
655 private:
656 // DbCellControl
657 virtual bool commitControl( ) override;
658 virtual void updateFromModel( css::uno::Reference< css::beans::XPropertySet > _rxModel ) override;
660 void SetList(const css::uno::Any& rItems, bool bComboBox);
661 void CreateControl(BrowserDataWin* pParent, const css::uno::Reference< css::beans::XPropertySet >& xModel);
662 DECL_LINK(OnToggle, weld::CheckButton&, void);
664 css::uno::Sequence< OUString > m_aValueList;
665 OUString m_aText;
666 Link<DbFilterField&,void> m_aCommitLink;
667 sal_Int16 m_nControlClass;
668 bool m_bFilterList : 1;
669 bool m_bFilterListFilled : 1;
673 // Base class providing the access to a grid cell
675 typedef ::cppu::ImplHelper2 < css::awt::XControl
676 , css::form::XBoundControl
677 > FmXGridCell_Base;
678 typedef ::cppu::ImplHelper1 < css::awt::XWindow
679 > FmXGridCell_WindowBase;
680 class FmXGridCell :public ::cppu::OComponentHelper
681 ,public FmXGridCell_Base
682 ,public FmXGridCell_WindowBase
684 protected:
685 ::osl::Mutex m_aMutex;
686 DbGridColumn* m_pColumn;
687 std::unique_ptr<DbCellControl> m_pCellControl;
689 private:
690 ::comphelper::OInterfaceContainerHelper3<css::awt::XWindowListener> m_aWindowListeners;
691 ::comphelper::OInterfaceContainerHelper3<css::awt::XFocusListener> m_aFocusListeners;
692 ::comphelper::OInterfaceContainerHelper3<css::awt::XKeyListener> m_aKeyListeners;
693 ::comphelper::OInterfaceContainerHelper3<css::awt::XMouseListener> m_aMouseListeners;
694 ::comphelper::OInterfaceContainerHelper3<css::awt::XMouseMotionListener> m_aMouseMotionListeners;
696 protected:
697 virtual ~FmXGridCell() override;
699 public:
700 FmXGridCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
701 void init();
703 DECLARE_UNO3_AGG_DEFAULTS(FmXGridCell, OComponentHelper)
704 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
706 void SetTextLineColor();
707 void SetTextLineColor(const Color& _rColor);
709 // XTypeProvider
710 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
711 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
713 // OComponentHelper
714 virtual void SAL_CALL disposing() override;
716 // css::lang::XComponent
717 virtual void SAL_CALL dispose() override {OComponentHelper::dispose();}
718 virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override { OComponentHelper::addEventListener(aListener);}
719 virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener >& aListener) override { OComponentHelper::removeEventListener(aListener);}
721 // css::awt::XControl
722 virtual void SAL_CALL setContext(const css::uno::Reference< css::uno::XInterface >& /*Context*/) override {}
723 virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getContext() override;
724 virtual void SAL_CALL createPeer(const css::uno::Reference< css::awt::XToolkit >& /*Toolkit*/, const css::uno::Reference< css::awt::XWindowPeer >& /*Parent*/) override {}
726 virtual css::uno::Reference< css::awt::XWindowPeer > SAL_CALL getPeer() override {return css::uno::Reference< css::awt::XWindowPeer > ();}
727 virtual sal_Bool SAL_CALL setModel(const css::uno::Reference< css::awt::XControlModel >& /*Model*/) override {return false;}
728 virtual css::uno::Reference< css::awt::XControlModel > SAL_CALL getModel() override;
729 virtual css::uno::Reference< css::awt::XView > SAL_CALL getView() override {return css::uno::Reference< css::awt::XView > ();}
730 virtual void SAL_CALL setDesignMode(sal_Bool /*bOn*/) override {}
731 virtual sal_Bool SAL_CALL isDesignMode() override {return false;}
732 virtual sal_Bool SAL_CALL isTransparent() override {return false;}
734 // css::form::XBoundControl
735 virtual sal_Bool SAL_CALL getLock() override;
736 virtual void SAL_CALL setLock(sal_Bool _bLock) override;
738 // XWindow
739 virtual void SAL_CALL setPosSize( ::sal_Int32 X, ::sal_Int32 Y, ::sal_Int32 Width, ::sal_Int32 Height, ::sal_Int16 Flags ) override;
740 virtual css::awt::Rectangle SAL_CALL getPosSize( ) override;
741 virtual void SAL_CALL setVisible( sal_Bool Visible ) override;
742 virtual void SAL_CALL setEnable( sal_Bool Enable ) override;
743 virtual void SAL_CALL setFocus( ) override;
744 virtual void SAL_CALL addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override;
745 virtual void SAL_CALL removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override;
746 virtual void SAL_CALL addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override;
747 virtual void SAL_CALL removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override;
748 virtual void SAL_CALL addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override;
749 virtual void SAL_CALL removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override;
750 virtual void SAL_CALL addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
751 virtual void SAL_CALL removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override;
752 virtual void SAL_CALL addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
753 virtual void SAL_CALL removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override;
754 virtual void SAL_CALL addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
755 virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override;
757 bool Commit() {return m_pCellControl->Commit();}
758 void ImplInitWindow( vcl::Window const & rParent, const InitWindowFacet _eInitWhat )
759 { m_pCellControl->ImplInitWindow( rParent, _eInitWhat ); }
761 bool isAlignedController() const { return m_pCellControl->isAlignedController(); }
762 void AlignControl(sal_Int16 nAlignment)
763 { m_pCellControl->AlignControl(nAlignment);}
765 protected:
766 // default implementations call our focus listeners, don't forget to call them if you override this
767 virtual void onFocusGained( const css::awt::FocusEvent& _rEvent );
768 virtual void onFocusLost( const css::awt::FocusEvent& _rEvent );
770 private:
771 svt::ControlBase* getEventWindow() const;
772 DECL_LINK(OnFocusGained, LinkParamNone*, void);
773 DECL_LINK(OnFocusLost, LinkParamNone*, void);
774 DECL_LINK(OnMousePress, const MouseEvent&, void);
775 DECL_LINK(OnMouseRelease, const MouseEvent&, void);
776 DECL_LINK(OnMouseMove, const MouseEvent&, void);
777 DECL_LINK(OnKeyInput, const KeyEvent&, void);
778 DECL_LINK(OnKeyRelease, const KeyEvent&, void);
782 class FmXDataCell : public FmXGridCell
784 public:
785 FmXDataCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl )
786 :FmXGridCell( pColumn, std::move(pControl) )
790 virtual void PaintFieldToCell(OutputDevice& rDev,
791 const tools::Rectangle& rRect,
792 const css::uno::Reference< css::sdb::XColumn >& xField,
793 const css::uno::Reference< css::util::XNumberFormatter >& xFormatter);
795 void UpdateFromField(const css::uno::Reference< css::sdb::XColumn >& xField,
796 const css::uno::Reference< css::util::XNumberFormatter >& xFormatter)
797 { m_pCellControl->UpdateFromField(xField, xFormatter); }
799 protected:
800 void UpdateFromColumn();
804 class FmXTextCell : public FmXDataCell
806 protected:
807 bool m_bIsMultiLineText;
809 public:
810 FmXTextCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
812 virtual void PaintFieldToCell(OutputDevice& rDev,
813 const tools::Rectangle& rRect,
814 const css::uno::Reference< css::sdb::XColumn >& xField,
815 const css::uno::Reference< css::util::XNumberFormatter >& xFormatter) override;
817 OUString GetText(const css::uno::Reference< css::sdb::XColumn >& _rxField,
818 const css::uno::Reference< css::util::XNumberFormatter >& xFormatter,
819 const Color** ppColor = nullptr)
820 {return m_pCellControl->GetFormatText(_rxField, xFormatter, ppColor);}
824 typedef ::cppu::ImplHelper2 < css::awt::XTextComponent
825 , css::form::XChangeBroadcaster
826 > FmXEditCell_Base;
827 class FmXEditCell final : public FmXTextCell,
828 public FmXEditCell_Base
830 public:
831 FmXEditCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
833 DECLARE_UNO3_AGG_DEFAULTS(FmXEditCell, FmXTextCell)
834 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
836 // XTypeProvider
837 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
838 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
840 // OComponentHelper
841 virtual void SAL_CALL disposing() override;
843 // css::awt::XTextComponent
844 virtual void SAL_CALL addTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override;
845 virtual void SAL_CALL removeTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override;
846 virtual void SAL_CALL setText(const OUString& aText) override;
847 virtual void SAL_CALL insertText(const css::awt::Selection& Sel, const OUString& Text) override;
848 virtual OUString SAL_CALL getText() override;
849 virtual OUString SAL_CALL getSelectedText() override;
850 virtual void SAL_CALL setSelection(const css::awt::Selection& aSelection) override;
851 virtual css::awt::Selection SAL_CALL getSelection() override;
852 virtual sal_Bool SAL_CALL isEditable() override;
853 virtual void SAL_CALL setEditable(sal_Bool bEditable) override;
854 virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) override;
855 virtual sal_Int16 SAL_CALL getMaxTextLen() override;
857 // XChangeBroadcaster
858 virtual void SAL_CALL addChangeListener( const css::uno::Reference< css::form::XChangeListener >& aListener ) override;
859 virtual void SAL_CALL removeChangeListener( const css::uno::Reference< css::form::XChangeListener >& aListener ) override;
861 private:
862 virtual ~FmXEditCell() override;
864 virtual void onFocusGained( const css::awt::FocusEvent& _rEvent ) override;
865 virtual void onFocusLost( const css::awt::FocusEvent& _rEvent ) override;
867 DECL_LINK(ModifyHdl, LinkParamNone*, void);
869 void onTextChanged();
871 OUString m_sValueOnEnter;
872 ::comphelper::OInterfaceContainerHelper3<css::awt::XTextListener> m_aTextListeners;
873 ::comphelper::OInterfaceContainerHelper3<css::form::XChangeListener> m_aChangeListeners;
874 ::svt::IEditImplementation* m_pEditImplementation;
875 bool m_bOwnEditImplementation;
878 typedef ::cppu::ImplHelper2 < css::awt::XCheckBox
879 , css::awt::XButton
880 > FmXCheckBoxCell_Base;
881 class FmXCheckBoxCell final : public FmXDataCell,
882 public FmXCheckBoxCell_Base
884 ::comphelper::OInterfaceContainerHelper3<css::awt::XItemListener> m_aItemListeners;
885 ::comphelper::OInterfaceContainerHelper3<css::awt::XActionListener> m_aActionListeners;
886 OUString m_aActionCommand;
887 VclPtr<::svt::CheckBoxControl> m_pBox;
889 DECL_LINK(ModifyHdl, LinkParamNone*, void);
891 virtual ~FmXCheckBoxCell() override;
893 public:
894 FmXCheckBoxCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
896 // UNO
897 DECLARE_UNO3_AGG_DEFAULTS(FmXCheckBoxCell, FmXDataCell)
898 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
899 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
900 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
902 // OComponentHelper
903 virtual void SAL_CALL disposing() override;
905 // css::awt::XCheckBox
906 virtual void SAL_CALL addItemListener(const css::uno::Reference< css::awt::XItemListener >& l) override;
907 virtual void SAL_CALL removeItemListener(const css::uno::Reference< css::awt::XItemListener >& l) override;
908 virtual sal_Int16 SAL_CALL getState() override;
909 virtual void SAL_CALL setState(sal_Int16 n) override;
910 virtual void SAL_CALL setLabel(const OUString& Label) override;
911 virtual void SAL_CALL enableTriState(sal_Bool b) override;
913 // XButton
914 virtual void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
915 virtual void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& l ) override;
916 //virtual void SAL_CALL setLabel( const OUString& Label ) throw (css::uno::RuntimeException);
917 virtual void SAL_CALL setActionCommand( const OUString& Command ) override;
920 typedef ::cppu::ImplHelper1 < css::awt::XListBox
921 > FmXListBoxCell_Base;
922 class FmXListBoxCell final : public FmXTextCell
923 , public FmXListBoxCell_Base
925 public:
926 FmXListBoxCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
928 DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell)
929 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
930 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
931 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
933 // OComponentHelper
934 virtual void SAL_CALL disposing() override;
936 // css::awt::XListBox
937 virtual void SAL_CALL addItemListener(const css::uno::Reference< css::awt::XItemListener >& l) override;
938 virtual void SAL_CALL removeItemListener(const css::uno::Reference< css::awt::XItemListener >& l) override;
939 virtual void SAL_CALL addActionListener(const css::uno::Reference< css::awt::XActionListener >& l) override;
940 virtual void SAL_CALL removeActionListener(const css::uno::Reference< css::awt::XActionListener >& l) override;
941 virtual void SAL_CALL addItem(const OUString& aItem, sal_Int16 nPos) override;
942 virtual void SAL_CALL addItems(const css::uno::Sequence< OUString >& aItems, sal_Int16 nPos) override;
943 virtual void SAL_CALL removeItems(sal_Int16 nPos, sal_Int16 nCount) override;
944 virtual sal_Int16 SAL_CALL getItemCount() override;
945 virtual OUString SAL_CALL getItem(sal_Int16 nPos) override;
946 virtual css::uno::Sequence< OUString > SAL_CALL getItems() override;
947 virtual sal_Int16 SAL_CALL getSelectedItemPos() override;
948 virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSelectedItemsPos() override;
949 virtual OUString SAL_CALL getSelectedItem() override;
950 virtual css::uno::Sequence< OUString > SAL_CALL getSelectedItems() override;
951 virtual void SAL_CALL selectItemPos(sal_Int16 nPos, sal_Bool bSelect) override;
952 virtual void SAL_CALL selectItemsPos(const css::uno::Sequence< sal_Int16 >& aPositions, sal_Bool bSelect) override;
953 virtual void SAL_CALL selectItem(const OUString& aItem, sal_Bool bSelect) override;
954 virtual sal_Bool SAL_CALL isMutipleMode() override;
955 virtual void SAL_CALL setMultipleMode(sal_Bool bMulti) override;
956 virtual sal_Int16 SAL_CALL getDropDownLineCount() override;
957 virtual void SAL_CALL setDropDownLineCount(sal_Int16 nLines) override;
958 virtual void SAL_CALL makeVisible(sal_Int16 nEntry) override;
960 private:
961 virtual ~FmXListBoxCell() override;
963 DECL_LINK(ChangedHdl, bool, void);
965 void OnDoubleClick();
967 ::comphelper::OInterfaceContainerHelper3<css::awt::XItemListener> m_aItemListeners;
968 ::comphelper::OInterfaceContainerHelper3<css::awt::XActionListener> m_aActionListeners;
969 VclPtr<::svt::ListBoxControl> m_pBox;
970 sal_uInt16 m_nLines;
971 bool m_bMulti;
975 typedef ::cppu::ImplHelper1 < css::awt::XComboBox
976 > FmXComboBoxCell_Base;
977 class FmXComboBoxCell final : public FmXTextCell
978 , public FmXComboBoxCell_Base
980 private:
981 ::comphelper::OInterfaceContainerHelper3<css::awt::XItemListener> m_aItemListeners;
982 ::comphelper::OInterfaceContainerHelper3<css::awt::XActionListener> m_aActionListeners;
983 VclPtr<::svt::ComboBoxControl> m_pComboBox;
984 sal_uInt16 m_nLines;
986 DECL_LINK(ChangedHdl, bool, void);
988 virtual ~FmXComboBoxCell() override;
990 public:
991 FmXComboBoxCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl );
993 DECLARE_UNO3_AGG_DEFAULTS(FmXListBoxCell, FmXTextCell)
994 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
995 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
996 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
998 // OComponentHelper
999 virtual void SAL_CALL disposing() override;
1001 // XComboBox
1002 virtual void SAL_CALL addItemListener( const css::uno::Reference< css::awt::XItemListener >& Listener ) override;
1003 virtual void SAL_CALL removeItemListener( const css::uno::Reference< css::awt::XItemListener >& Listener ) override;
1004 virtual void SAL_CALL addActionListener( const css::uno::Reference< css::awt::XActionListener >& Listener ) override;
1005 virtual void SAL_CALL removeActionListener( const css::uno::Reference< css::awt::XActionListener >& Listener ) override;
1006 virtual void SAL_CALL addItem( const OUString& Item, ::sal_Int16 Pos ) override;
1007 virtual void SAL_CALL addItems( const css::uno::Sequence< OUString >& Items, ::sal_Int16 Pos ) override;
1008 virtual void SAL_CALL removeItems( ::sal_Int16 nPos, ::sal_Int16 nCount ) override;
1009 virtual ::sal_Int16 SAL_CALL getItemCount( ) override;
1010 virtual OUString SAL_CALL getItem( ::sal_Int16 Pos ) override;
1011 virtual css::uno::Sequence< OUString > SAL_CALL getItems( ) override;
1012 virtual ::sal_Int16 SAL_CALL getDropDownLineCount( ) override;
1013 virtual void SAL_CALL setDropDownLineCount( ::sal_Int16 Lines ) override;
1016 typedef ::cppu::ImplHelper2 < css::awt::XTextComponent
1017 , css::lang::XUnoTunnel
1018 > FmXFilterCell_Base;
1019 class FmXFilterCell final : public FmXGridCell
1020 ,public FmXFilterCell_Base
1022 public:
1023 FmXFilterCell(DbGridColumn* pColumn, std::unique_ptr<DbFilterField> pControl);
1026 DECLARE_UNO3_AGG_DEFAULTS(FmXFilterCell, FmXGridCell)
1027 virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& _rType ) override;
1028 virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override;
1029 virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override;
1031 // XUnoTunnel
1032 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override;
1034 // helpers for XUnoTunnel
1035 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
1037 // painting the filter text
1038 void PaintCell(OutputDevice& rDev, const tools::Rectangle& rRect);
1039 void Update(){m_pCellControl->Update();}
1041 // OComponentHelper
1042 virtual void SAL_CALL disposing() override;
1044 // css::awt::XTextComponent
1045 virtual void SAL_CALL addTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override;
1046 virtual void SAL_CALL removeTextListener(const css::uno::Reference< css::awt::XTextListener >& l) override;
1047 virtual void SAL_CALL setText(const OUString& aText) override;
1048 virtual void SAL_CALL insertText(const css::awt::Selection& Sel, const OUString& Text) override;
1049 virtual OUString SAL_CALL getText() override;
1050 virtual OUString SAL_CALL getSelectedText() override;
1051 virtual void SAL_CALL setSelection(const css::awt::Selection& aSelection) override;
1052 virtual css::awt::Selection SAL_CALL getSelection() override;
1053 virtual sal_Bool SAL_CALL isEditable() override;
1054 virtual void SAL_CALL setEditable(sal_Bool bEditable) override;
1055 virtual void SAL_CALL setMaxTextLen(sal_Int16 nLen) override;
1056 virtual sal_Int16 SAL_CALL getMaxTextLen() override;
1058 private:
1059 DECL_LINK( OnCommit, DbFilterField&, void );
1060 virtual ~FmXFilterCell() override;
1062 ::comphelper::OInterfaceContainerHelper3<css::awt::XTextListener> m_aTextListeners;
1065 #endif // INCLUDED_SVX_SOURCE_INC_GRIDCELL_HXX
1067 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */