/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// EditBrowseBoxFlags (EBBF) enumclass EditBrowseBoxFlags
{
NONE = 0x0000, /** if this bit is _not_ set, the handle column will be invalidated upon changing the row in the browse box. This is for forcing the row picture to be repainted. If you do not have row pictures or text, you don't need this invalidation, then you would specify this bit to prevent flicker
*/
NO_HANDLE_COLUMN_CONTENT = 0x0001, /** set this bit to activate the cell on a MouseButtonDown, not a MouseButtonUp event
*/
ACTIVATE_ON_BUTTONDOWN = 0x0002, /** if this bit is set and EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT is _not_ set, the handle column is drawn with the text contained in column 0 instead of an image
*/
HANDLE_COLUMN_TEXT = 0x0004,
/** If this bit is set, tab traveling is somewhat modified<br/> If the control gets the focus because the user pressed the TAB key, then the first or last cell (depending on whether the traveling was cycling forward or backward) gets activated. @see Window::GetGetFocusFlags @see GETFOCUS_*
*/
SMART_TAB_TRAVEL = 0x0008,
// commit any current changes. Especially, do any reformatting you need (from input formatting // to output formatting) here virtualvoid CommitModifications();
// suspending the controller is not cumulative! void suspend( ); void resume( ); bool isSuspended( ) const { return bSuspended; }
// sets a link to call when the text is changed by the user void SetModifyHdl(const Link<LinkParamNone*,void>& rLink)
{
m_aModify1Hdl = rLink;
}
// sets an additional link to call when the text is changed by the user void SetAuxModifyHdl(const Link<LinkParamNone*,void>& rLink)
{
m_aModify2Hdl = rLink;
}
virtual OUString GetText( LineEnd /*aSeparator*/ ) const override
{ // ignore the line end - this base implementation does not support it return m_rEdit.get_widget().get_text();
}
virtual OUString GetSelected( LineEnd /*aSeparator*/ ) const override // ignore the line end - this base implementation does not support it
{ int nStartPos, nEndPos;
weld::Entry& rEntry = m_rEdit.get_widget();
rEntry.get_selection_bounds(nStartPos, nEndPos); return rEntry.get_text().copy(std::min(nStartPos, nEndPos), std::abs(nEndPos - nStartPos));
}
/** a multi line edit which can be used in a cell of an EditBrowseBox
*/ class SVT_DLLPUBLIC MultiLineTextCell final : public ControlBase
{ public:
MultiLineTextCell(BrowserDataWin* pParent);
//= EditCellController class SVT_DLLPUBLIC EditCellController : public CellController
{
IEditImplementation* m_pEditImplementation; bool m_bOwnImplementation; // did we create m_pEditImplementation?
// sets a link to call when the text is changed by the user void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
{
m_aModify1Hdl = rHdl;
}
// sets an additional link to call when the text is changed by the user void SetAuxModifyHdl(const Link<LinkParamNone*,void>& rLink)
{
m_aModify2Hdl = rLink;
}
// for pseudo-click when initially clicking in a cell activates // the cell and performs a state change on the button as if // it was clicked on void Clicked();
// sets a link to call when the selection is changed by the user void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
{
m_aModify1Hdl = rHdl;
}
// sets an additional link to call when the selection is changed by the user // bool arg is true when triggered interactively by the user void SetAuxModifyHdl(const Link<bool,void>& rLink)
{
m_aModify2Hdl = rLink;
}
// sets a link to call when the selection is changed by the user void SetModifyHdl(const Link<LinkParamNone*,void>& rHdl)
{
m_aModify1Hdl = rHdl;
}
// sets an additional link to call when the selection is changed, // bool arg is true when triggered interactively by the user void SetAuxModifyHdl(const Link<bool,void>& rLink)
{
m_aModify2Hdl = rLink;
}
class SVT_DLLPUBLIC FormattedControl final : public FormattedControlBase
{ public:
FormattedControl(BrowserDataWin* pParent, bool bSpinVariant);
};
class SVT_DLLPUBLIC DoubleNumericControl final : public FormattedControlBase
{ public:
DoubleNumericControl(BrowserDataWin* pParent, bool bSpinVariant);
};
class SVT_DLLPUBLIC LongCurrencyControl final : public FormattedControlBase
{ public:
LongCurrencyControl(BrowserDataWin* pParent, bool bSpinVariant);
};
class SVT_DLLPUBLIC TimeControl final : public FormattedControlBase
{ public:
TimeControl(BrowserDataWin* pParent, bool bSpinVariant);
};
class SVT_DLLPUBLIC DateControl final : public FormattedControlBase
{ public:
DateControl(BrowserDataWin* pParent, bool bDropDown);
//= FormattedFieldCellController class SVT_DLLPUBLIC FormattedFieldCellController final : public EditCellController
{ public:
FormattedFieldCellController( FormattedControlBase* _pFormatted );
virtualvoid CommitModifications() override;
};
//= EditBrowserHeader class SVT_DLLPUBLIC EditBrowserHeader : public BrowserHeader
{ public:
EditBrowserHeader( BrowseBox* pParent, WinBits nWinBits = WB_BUTTONSTYLE )
:BrowserHeader(pParent, nWinBits){}
protected: virtualvoid DoubleClick() override;
};
//= EditBrowseBox class SVT_DLLPUBLIC EditBrowseBox: public BrowseBox
{ friendclass EditBrowserHeader;
ImplSVEvent * nStartEvent, * nEndEvent, * nCellModifiedEvent; // event ids
VclPtr<vcl::Window> m_pFocusWhileRequest; // In ActivateCell, we grab the focus asynchronously, but if between requesting activation // and the asynchronous event the focus has changed, we won't grab it for ourself.
sal_Int32 nPaintRow; // row being painted
sal_Int32 nEditRow;
sal_uInt16 nEditCol;
bool bHasFocus : 1; mutablebool bPaintStatus : 1; // paint a status (image) in the handle column bool bActiveBeforeTracking;
// should be used instead of GetFieldRectPixel, 'cause this method here takes into account the borders
tools::Rectangle GetCellRect(sal_Int32 nRow, sal_uInt16 nColId, bool bRelToBrowser = true) const; virtual sal_uInt32 GetTotalCellWidth(sal_Int32 nRow, sal_uInt16 nColId);
sal_uInt32 GetAutoColumnWidth(sal_uInt16 nColId);
// callbacks for the data window virtualvoid ImplStartTracking() override; virtualvoid ImplEndTracking() override;
// when changing a row: // CursorMoving: cursor is being moved, but GetCurRow() still provides the old row virtualbool CursorMoving(sal_Int32 nNewRow, sal_uInt16 nNewCol);
// cursor has been moved virtualvoid CursorMoved() override;
virtualvoid CellModified(); // called whenever a cell has been modified virtualbool SaveModified(); // called whenever a cell should be left, and it's content should be saved // return sal_False prevents leaving the cell virtualbool SaveRow(); // commit the current row
// retrieve the image for the row status
Image GetImage(RowStatus) const;
// inserting columns // if you don't set a width, this will be calculated automatically // if the id isn't set the smallest unused will do it ... virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1));
// called whenever (Shift)Tab or Enter is pressed. If true is returned, these keys // result in traveling to the next or to th previous cell virtualbool IsTabAllowed(bool bForward) const;
/** @return The count of additional controls of the control area. */ virtual sal_Int32 GetAccessibleControlCount() const override;
/** Creates the accessible object of an additional control. @param nIndex The 0-based index of the control. @return
The XAccessible interface of the specified control. */ virtual css::uno::Reference< css::accessibility::XAccessible >
CreateAccessibleControl( sal_Int32 nIndex ) override;
/** Sets focus to current cell of the data table. */ virtualvoid GrabTableFocus() override;
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.