CURSOR_WO_FOCUS = 0x200000, // Allows a cursor which is shown even if the control does not have the focus. This does not affect other // situations which require to temporarily hide the cursor (such as scrolling).
class BrowserDataWin final
:public Control
,public DragSourceHelper
,public DropTargetHelper
{ public:
VclPtr<BrowserHeader> pHeaderBar; // only for BrowserMode::HEADERBAR_NEW bool bInDtor;
AutoTimer aMouseTimer; // recalls MouseMove on dragging out
MouseEvent aRepeatEvt; // a MouseEvent to repeat
Point aLastMousePos; // prevents pseudo-MouseMoves
OUString aRealRowCount; // to show in VScrollBar
std::vector<tools::Rectangle> aInvalidRegion; // invalidated Rectangles during !UpdateMode bool bInPaint; // TRUE while in Paint bool bInCommand; // TRUE while in Command bool bNoHScroll; // no horizontal scrollbar bool bNoVScroll; // no vertical scrollbar bool bAutoHScroll; // autohide horizontaler Scrollbar bool bAutoVScroll; // autohide horizontaler Scrollbar bool bUpdateMode; // not SV-UpdateMode because of Invalidate() bool bAutoSizeLastCol; // last column always fills up window bool bResizeOnPaint; // outstanding resize-event bool bUpdateOnUnlock; // Update() while locked bool bInUpdateScrollbars; // prevents recursions bool bHadRecursion; // a recursion occurred bool bCallingDropCallback; // we're in a callback to AcceptDrop or ExecuteDrop currently
sal_uInt16 nUpdateLock; // lock count, don't call Control::Update()! short nCursorHidden; // new counter for DoHide/ShowCursor
class BrowserAcceptDropEvent : public AcceptDropEvent, public BrowseEvent
{ public:
BrowserAcceptDropEvent( BrowserDataWin* pWin, const AcceptDropEvent& rEvt );
};
class BrowserExecuteDropEvent : public ExecuteDropEvent, public BrowseEvent
{ public:
BrowserExecuteDropEvent( BrowserDataWin* pWin, const ExecuteDropEvent& rEvt );
};
// TODO // The whole selection thingie in this class is somewhat... suspicious to me. // some oddities: // * method parameters named like members (and used in both semantics within the method!) // * the multi selection flag is sometimes used as if it is for row selection, sometimes as if // it's for column selection, too (and sometimes in an even stranger way :) // * it is not really defined like all these hundreds selection related flags/methods work together // and influence each other. I do not understand it very well, but this may be my fault :) // * There is a GetColumnSelection, but it can't be used to determine the selected columns (at least // not without a const_cast) // // We should clearly define this somewhere in the future. Or, even better, we should re-implement this // whole class, which is planned for a long time :) // // sorry for the ranting. could not resist
class SVT_DLLPUBLIC BrowseBox
:public Control
,public DragSourceHelper
,public DropTargetHelper
,public vcl::IAccessibleTableProvider
{ friendclass BrowserDataWin;
private:
VclPtr<BrowserDataWin> pDataWin; // window to display data rows
VclPtr<ScrollAdaptor> pVScroll; // vertical scrollbar
VclPtr<ScrollAdaptor> aHScroll; // horizontal scrollbar
VclPtr<MeasureStatusBar> aStatusBarHeight; // statusbar, just to measure its height
tools::Long m_nDataRowHeight; // height of a single data-row
tools::Long m_nCornerHeight; // height of scrollbox corner
tools::Long m_nCornerWidth; // width of scrollbox corner
tools::Long m_nActualCornerWidth; // size of scrollbox corner
sal_uInt16 nTitleLines; // number of lines in title row
sal_uInt16 nControlAreaWidth; // width of fixed area beneath hscroll bool bColumnCursor; // single columns and fields selectable bool bMultiSelection;// allow multiple selected rows bool bKeepHighlight; // don't hide selection on LoseFocus
bool bHLines; // draw lines between rows bool bVLines; // draw lines between columns bool bBootstrapped; // child windows resized etc.
sal_Int32 nTopRow; // no. of first visible row (0...)
sal_Int32 nCurRow; // no. of row with cursor
sal_Int32 nRowCount; // total number of rows in model
sal_uInt16 nFirstCol; // no. of first visible scrollable column
sal_uInt16 nCurColId; // column id of cursor
tools::Long nResizeX; // mouse position at start of resizing
tools::Long nMinResizeX; // never drag more left
tools::Long nDragX; // last dragged column (MouseMove)
sal_uInt16 nResizeCol; // resize this column in MouseMove bool bResizing; // mouse captured for column resizing
bool bSelect; /// select or deselect bool bSelectionIsVisible; // depending on focus bool bScrolling; // hidden cursor while scrolling bool bNotToggleSel; // set while in ToggleSelection() etc. bool bHasFocus; // set/unset in Get/LoseFocus bool bHideSelect; // hide selection (highlight)
TriState bHideCursor; // hide cursor (frame)
Range aSelRange; // for selection expansion
::std::vector< std::unique_ptr<BrowserColumn> > mvCols; // array of column-descriptions union
{
MultiSelection* pSel; // selected rows for multi-selection
sal_Int32 nSel; // selected row for single-selection
} uRow;
std::unique_ptr<MultiSelection> pColSel; // selected column-ids
bool m_bFocusOnlyCursor; // hide cursor if we don't have the focus
Color m_aCursorColor; // special color for cursor, COL_TRANSPARENT for usual (VCL-painted) "inverted" cursor
BrowserMode m_nCurrentMode; // last argument of SetMode (redundant, as our other members represent the current settings, too)
// software plug for database access // RowCount is counted automatically // (with the help of RowInserted and RowRemoved), so overriding of // the method is needless public: virtual sal_Int32 GetRowCount() const override;
protected: // for display in VScrollBar set it e.g. on "?" void SetRealRowCount( const OUString &rRealRowCount );
// Return Value has to be sal_True always - SeekRow *has* to work! // (else ASSERT) MI: who integrated that? It must not be like that!
/** seeks for the given row position @paramnRow nRowstartsat0
*/ virtualbool SeekRow( sal_Int32 nRow ) = 0;
SAL_DLLPRIVATE void DrawCursor();
SAL_DLLPRIVATE void PaintData(vcl::Window const & rWin, vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); virtualvoid PaintField(vcl::RenderContext& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId) const = 0; // Advice for the subclass: the visible scope of rows has changed. // The subclass is able to announce changes of the model with the // help of the methods RowInserted and RowRemoved. Because of the // new status a paint is induced (SeekRow is called etc). // // parameters: nNewTopRow: number of the new TopRow (can get changed from // VisibleRowsChanged by request of RowInserted and RowDeleted). // nNumRows: number of visible rows (a partial visible row is counted too) // // Possible reason for changing the visible scope: // - in front of the visible scope rows were inserted or removed, so the // numbering of the visible scope has changed // - Scrolling (and thereof resulting in another first visible row) // - Resize the window virtualvoid VisibleRowsChanged( sal_Int32 nNewTopRow, sal_uInt16 nNumRows);
// number of visible rows in the window (incl. "truncated" rows)
sal_uInt16 GetVisibleRows() const;
sal_Int32 GetTopRow() const { return nTopRow; }
sal_uInt16 GetFirstVisibleColNumber() const { return nFirstCol; }
virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) override; // will forward everything got to the second AcceptDrop method virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) override; // will forward everything got to the second ExecuteDrop method
// control of title and data row height void SetDataRowHeight( tools::Long nPixel );
tools::Long GetDataRowHeight() const; void SetTitleLines( sal_uInt16 nLines );
tools::Long GetTitleHeight() const;
/// access to selected methods, to be granted to the BrowserColumn struct BrowserColumnAccess { friendclass BrowserColumn; private: BrowserColumnAccess() { } }; /** public version of PaintField, with selected access rights for the BrowserColumn
*/ void DoPaintField( OutputDevice& rDev, const tools::Rectangle& rRect, sal_uInt16 nColumnId, BrowserColumnAccess ) const
{ PaintField( rDev, rRect, nColumnId ); }
/** suggests a default width for a column containing a given text
/** GetCellText returns the text at the given position @param_nRow thenumberoftherow @param_nColId theIDofthecolumn @return thetextoutofthecell
*/ virtual OUString GetCellText(sal_Int32 _nRow, sal_uInt16 _nColId) const;
/** returns the Rectangle for either the column header bar or the row header bar @param_bIsColumnBar <TRUE/>whencolumnheaderbarisused @return theRectangle
*/ virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar) override;
/** calculates the Rectangle of the table relative to the BrowseBox. @return theRectangle
*/ virtual tools::Rectangle calcTableRect() override;
/// return <TRUE/> if and only if the accessible object for this instance has been created and is alive
SAL_DLLPRIVATE bool isAccessibleAlive( ) const;
public: /** Creates and returns the accessible object of the whole BrowseBox. */ virtual css::uno::Reference<
css::accessibility::XAccessible > CreateAccessible() override;
// Children ---------------------------------------------------------------
/** Creates the accessible object of a data table cell. @paramnRowTherowindexofthecell. @paramnColumnIdThecolumnposofthecell.
@return The XAccessible interface of the specified cell. */ virtual css::uno::Reference<
css::accessibility::XAccessible >
CreateAccessibleCell( sal_Int32 nRow, sal_uInt16 nColumnPos ) override;
/** Creates the accessible object of a row header. @paramnRowTherowindexoftheheader.
@return The XAccessible interface of the specified row header. */ virtual css::uno::Reference<
css::accessibility::XAccessible >
CreateAccessibleRowHeader( sal_Int32 nRow ) override;
/** Creates the accessible object of a column header. @paramnColumnIdThecolumnIDoftheheader.
@return The XAccessible interface of the specified column header. */ virtual css::uno::Reference<
css::accessibility::XAccessible >
CreateAccessibleColumnHeader( sal_uInt16 nColumnPos ) override;
/** Converts a point relative to the data window origin to a cell address. @paramrnRowOut-parameterthattakestherowindex. @paramrnColumnIdOut-parameterthattakesthecolumnID. @paramrPointThepositioninpixelsrelativetothedatawindow.
@return <TRUE/>, if the point could be converted to a valid address. */ virtualbool ConvertPointToCellAddress(
sal_Int32& rnRow, sal_uInt16& rnColumnId, const Point& rPoint ) override;
/** Converts a point relative to the row header bar origin to a row header index. @paramrnRowOut-parameterthattakestherowindex. @paramrPointThepositioninpixelsrelativetotheheaderbar.
@return <TRUE/>, if the point could be converted to a valid index. */ virtualbool ConvertPointToRowHeader( sal_Int32& rnRow, const Point& rPoint ) override;
/** Converts a point relative to the column header bar origin to a column headerindex. @paramrnColumnIdOut-parameterthattakesthecolumnID. @paramrPointThepositioninpixelsrelativetotheheaderbar.
@return <TRUE/>, if the point could be converted to a valid index. */ virtualbool ConvertPointToColumnHeader( sal_uInt16& rnColumnPos, const Point& rPoint ) override;
/** Converts a point relative to the BrowseBox origin to the index of an existingcontrol. @paramrnRowOut-parameterthattakesthe0-basedcontrolindex. @paramrPointThepositioninpixelsrelativetotheBrowseBox.
@return <TRUE/>, if the point could be converted to a valid index. */ virtualbool ConvertPointToControlIndex( sal_Int32& rnIndex, const Point& rPoint ) override;
/** return the name of the specified object. @parameObjType Thetypetoaskfor @param_nPosition Thepositionofatablecell(indexposition),headerbarcolumn/rowcell @return Thenameofthespecifiedobject.
*/ virtual OUString GetAccessibleObjectName( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
/** return the description of the specified object. @parameObjType Thetypetoaskfor @param_nPosition Thepositionofatablecell(indexposition),headerbarcolumn/rowcell @return Thedescriptionofthespecifiedobject.
*/ virtual OUString GetAccessibleObjectDescription( AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition = -1) const override;
/** @return The header text of the specified row. */ virtual OUString GetRowDescription( sal_Int32 nRow ) const override;
/** @return The header text of the specified column. */ virtual OUString GetColumnDescription( sal_uInt16 _nColumn ) const override;
/** Fills the StateSet with all states (except DEFUNC and SHOWING, done by
the accessible object), depending on the specified object type. */ virtualvoid FillAccessibleStateSet(
sal_Int64& rStateSet,
AccessibleBrowseBoxObjType eObjType ) const override;
/** Fills the StateSet with all states for one cell (except DEFUNC and SHOWING, done by
the accessible object). */ virtualvoid FillAccessibleStateSetForCell(
sal_Int64& _rStateSet,
sal_Int32 _nRow, sal_uInt16 _nColumn ) const override;
/** Sets focus to current cell of the data table. */ virtualvoid GrabTableFocus() override;
private: // the following declares some Window/OutputDevice methods private. This happened in the course // of CWS warnings01, which pointed out nameclashs in those methods. If the build breaks in some // upper module, you should investigate whether you really wanted to call base class methods, // or the versions at this class. In the latter case, use the renamed versions above.
// ToTop/ToBottom were never property implemented. If you currently call it, this is most probably wrong // and not doing as intended using Window::ToTop;
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.