22#include <osl/diagnose.h>
52 return pDataWin->AcceptDrop( aTransformed );
60 return pDataWin->ExecuteDrop( aTransformed );
81 return pDataWin->GetDataFlavorExVector();
82 return GetDataFlavorExVector();
88 if (
pDataWin->bCallingDropCallback )
89 return pDataWin->IsDropFormatSupported( _nFormat );
91 return DropTargetHelper::IsDropFormatSupported( _nFormat );
106 if ( StateChangedType::Mirroring == nStateChange )
118 else if ( StateChangedType::InitShow == nStateChange )
140 else if (StateChangedType::Zoom == nStateChange)
148 for (
auto & pCol :
mvCols)
152 pHeaderBar->
SetItemSize( pCol->GetId(), pCol->Width() );
158 else if (StateChangedType::Enable == nStateChange)
161 bool bHandleCol = !
mvCols.empty() && (0 ==
mvCols[ 0 ]->GetId());
163 bool bHeaderBar(
pDataWin->pHeaderBar);
245 std::vector<tools::Rectangle> aHighlightList;
246 sal_Int32 nLastRowInRect = 0;
253 sal_Int32 nBottomRow =
nTopRow +
267 if ( !aHighlightList.empty() && nLastRowInRect == ( nRow - 1 ) )
268 aHighlightList[ 0 ].Union( aAddRect );
270 aHighlightList.emplace( aHighlightList.begin(), aAddRect );
271 nLastRowInRect = nRow;
275 while ( !aHighlightList.empty() )
277 pDataWin->Invalidate( aHighlightList.back() );
278 aHighlightList.pop_back();
284 nColId =
pColSel->NextSelected() )
302 bool bReallyHide =
false;
360 pDataWin->GetOutDev()->SetFillColor();
361 pDataWin->GetOutDev()->SetLineColor( rCol );
362 pDataWin->GetOutDev()->DrawRect( aCursor );
363 pDataWin->GetOutDev()->SetLineColor( aOldLineColor );
364 pDataWin->GetOutDev()->SetFillColor( aOldFillColor );
373 if ( nItemPos >=
mvCols.size() )
375 return mvCols[ nItemPos ]->Width();
399 for (
auto const & pCol :
mvCols)
400 if ( pCol->GetId() == nColumnId )
401 return pCol->IsFrozen();
485 nSBHeight =
static_cast<sal_uLong>(nSBHeight *
static_cast<double>(
GetZoom()));
486 nSBWidth =
static_cast<sal_uLong>(nSBWidth *
static_cast<double>(
GetZoom()));
490 sal_uInt16 nOldVisibleRows = 0;
505 nDataHeight -= nSBHeight;
509 nDataWidth -= nSBWidth;
514 Size( nDataWidth, nDataHeight ) );
516 sal_uInt16 nVisibleRows = 0;
522 if ( nVisibleRows != nOldVisibleRows )
530 aInvalidArea.SetLeft( 0 );
557 bool bHandleCol = pFirstCol && pFirstCol->
GetId() == 0;
558 bool bHeaderBar(
pDataWin->pHeaderBar);
589 for (nCol = 0; nCol <
mvCols.size() && nX < rRect.
Right(); ++nCol)
596 if (bHeaderBar && bHandleCol && nCol > 0)
602 if ( pCol->
Width() > 4 )
607 aButtonFrame.
Draw(rRenderContext);
616 rRenderContext.
Pop();
624 if ( !bHeaderBar && nCol ==
mvCols.size() )
633 rRenderContext.
Pop();
645 rRenderContext.
Pop();
655 if ((aRealSize.
Width() < 3) || (aRealSize.
Height() < 3))
666 if (nFlags & SystemTextColorFlags::Mono)
677 Point(aRealPos.
X() + aRealSize.
Width() - 1, aRealPos.
Y()));
682 Point(aRealPos.
X() + 1, aRealPos.
Y() + aRealSize.
Height() - 1));
725 Point aHeaderPos(pFirstCol && (pFirstCol->
GetId() == 0) ? pFirstCol->
Width() : 0, 0);
726 Size aHeaderSize(aRealSize.
Width() - aHeaderPos.
X(), nTitleHeight);
728 aHeaderPos += aRealPos;
736 pBar->
Draw(pDev, aHeaderPos, nFlags);
740 if (pFirstCol && (pFirstCol->
GetId() == 0) && (pFirstCol->
Width() > 4))
743 Size( pFirstCol->
Width()-1, nTitleHeight-1 ),
745 aButtonFrame.
Draw( *pDev );
751 Point( aRealPos.
X() + pFirstCol->
Width() - 1, aRealPos.
Y() + nTitleHeight-1 ) );
753 Point( aRealPos.
X() + pFirstCol->
Width() - 1, aRealPos.
Y() + nTitleHeight-1 ) );
767 bool bBackground =
pDataWin->IsControlBackground();
797 Size aOverallAreaSize = _bForeignDevice ? _rRect.
GetSize() :
pDataWin->GetOutputSizePixel();
805 if (!_bForeignDevice && nDataRowHeight)
807 nRelTopRow = (
static_cast<sal_uLong>(_rRect.
Top()) / nDataRowHeight);
808 nRelBottomRow =
static_cast<sal_uLong>(_rRect.
Bottom()) / nDataRowHeight;
812 Point aPos( aOverallAreaPos.
X(), nRelTopRow * nDataRowHeight + aOverallAreaPos.
Y() );
822 nHLineX += aOverallAreaPos.
X();
829 ++nRelRow, aPos.
AdjustY(nDataRowHeight ) )
840 OSL_FAIL(
"BrowseBox::ImplPaintData: SeekRow failed");
843 aPos.
setX( aOverallAreaPos.
X() );
863 for ( nCol = 0; nCol <
mvCols.size(); ++nCol )
869 if ( aPos.
X() >= _rRect.
Right() )
873 if ( nCol < nFirstCol && !pCol->
IsFrozen() )
881 OSL_FAIL(
"BrowseBox::PaintData : nFirstCol is probably invalid !");
889 if ( bColAutoHighlight )
910 Size aFieldSize(pCol->
Width(), nDataRowHeight);
912 if (aPos.
X() + aFieldSize.
Width() > aOverallAreaBRPos.
X())
913 aFieldSize.
setWidth( aOverallAreaBRPos.
X() - aPos.
X() );
915 if (aPos.
Y() + aFieldSize.
Height() > aOverallAreaBRPos.
Y() + 1)
918 if (pCol->
GetId() != 0)
920 aFieldSize.
setHeight( aOverallAreaBRPos.
Y() + 1 - aPos.
Y() );
926 pCol->
Draw( *
this, _rOut, aPos );
932 if ( bColAutoHighlight )
958 if (nY <= aOverallAreaBRPos.
Y())
962 : aOverallAreaBRPos.
X(),
968 if (aPos.
Y() > aOverallAreaBRPos.
Y() + 1)
969 aPos.
setY( aOverallAreaBRPos.
Y() + 1 );
983 Point( aOverallAreaPos.
X() - 1, aPos.
Y() - 1 ),
995 : aOverallAreaBRPos.
Y() ) );
1001 Point aVertPos( aOverallAreaPos.
X() - 1, aOverallAreaPos.
Y() );
1003 for (
size_t nCol = 0; nCol <
mvCols.size(); ++nCol )
1009 if ( nCol < nFirstCol && !pCol->
IsFrozen() )
1012 pCol =
mvCols[ nCol ].get();
1021 if ( aVertPos.
X() > _rRect.
Right() )
1025 if ( pCol->
GetId() != 0 )
1029 : aPos.
Y() + nDeltaY ) );
1058 if (
pDataWin->bInUpdateScrollbars )
1063 pDataWin->bInUpdateScrollbars =
true;
1074 bool bNeedsVScroll =
false;
1075 sal_Int32 nMaxRows = 0;
1080 bNeedsVScroll =
pDataWin->bAutoVScroll
1085 if ( !bNeedsVScroll )
1090 Size aNewSize( aDataWinSize );
1092 aDataWinSize = aNewSize;
1097 Size aNewSize( aDataWinSize );
1099 aDataWinSize = aNewSize;
1106 bool bNeedsHScroll =
pDataWin->bAutoHScroll
1109 if ( !bNeedsHScroll )
1121 Size aNewSize( aDataWinSize );
1123 aDataWinSize = aNewSize;
1136 short nScrollCols = short(
mvCols.size()) -
static_cast<short>(nFrozenCols);
1141 :
static_cast<short>( nLastCol -
nFirstCol );
1145 short nRange = std::max( nScrollCols,
short(0) );
1146 aHScroll->SetVisibleSize( nVisibleHSize );
1155 if ( bNeedsHScroll && !
aHScroll->IsVisible() )
1164 OSL_FAIL(
"BrowseBox: nTopRow > nRowCount");
1170 pVScroll->SetVisibleSize( nVisibleSize ? nVisibleSize : 1 );
1178 if ( bNeedsVScroll && !
pVScroll->IsVisible() )
1204 for (
size_t nCol = 0;
1210 nWidth +=
mvCols[ nCol ]->Width();
1213 pDataWin->pHeaderBar->SetOffset( nWidth );
1216 pDataWin->bInUpdateScrollbars =
false;
1229 if ( bWasUpdate == bUpdate )
1237 pDataWin->SetUpdateMode( bUpdate );
1265 for (
size_t nCol = 0;
1291 auto nCurScrollRow = nTopRow;
1292 auto nPos = rScrollbar.adjustment_get_value();
1293 ScrollRows(
nPos - nCurScrollRow);
1297 rScrollbar.get_scroll_type() == ScrollType::Drag &&
1300 OUString aTip = OUString::number(
nPos) +
"/";
1301 if (!pDataWin->GetRealRowCount().isEmpty())
1302 aTip += pDataWin->GetRealRowCount();
1304 aTip += OUString::number(rScrollbar.adjustment_get_upper());
1312 auto nCurScrollCol = nFirstCol - FrozenColCount();
1313 ScrollColumns(rScrollbar.adjustment_get_value() - nCurScrollCol);
1318 pBar->SetDragSize( pDataWin->GetOutputSizePixel().Height() );
1334 for (
size_t nCol = 0; nCol <
mvCols.size() && nX < nWidth; ++nCol )
1344 if ( pCol->
GetId() && std::abs( nR - rEvtPos.
X() ) < 2 )
1357 else if ( nX < rEvtPos.
X() && nR > rEvtPos.
X() )
1378 SAL_INFO(
"svtools",
"BrowseBox::MouseMove( MouseEvent )" );
1383 for (
size_t nCol = 0;
1392 sal_uInt16 nR =
static_cast<sal_uInt16
>(nX + pCol->
Width() - 1);
1398 aNewPointer = PointerStyle::HSplit;
1414 ShowTrackFlags::Split|ShowTrackFlags::TrackWindow );
1473 if ( rEvt.
GetRow() >= 0 )
1489 else if ( ( rEvt.
GetMode() & ( MouseEventModifiers::SELECT | MouseEventModifiers::SIMPLECLICK ) ) &&
1510 if ( rEvt.
GetRow() >= 0 )
1522 uRow.pSel->SelectAll(
false);
1531 if ( rEvt.
GetMode() & MouseEventModifiers::RANGESELECT )
1549 else if ( rEvt.
GetMode() & MouseEventModifiers::MULTISELECT )
1662 if ( !bAlt && !bCtrl && !bShift )
1688 if ( !bAlt && !bCtrl && bShift )
1702 if ( !bAlt && bCtrl && !bShift )
1753 for ( sal_Int32 nRow =
GetCurRow(); nRow >= 0; --nRow )
1764 for ( sal_Int32 nRow =
GetCurRow(); nRow < nRows; ++nRow )
1797 bool bDone =
GoToRow( nRow - 1,
false );
1894 if ( pHeaderBar && pHeaderBar->
IsDragable() )
1899 bool bMoveAllowed =
false;
1903 bMoveAllowed =
true;
1908 bMoveAllowed =
true;
1916 if ( bColumnSelected )
1952 if ( _bIsColumnBar )
1954 nWidth =
pDataWin->GetOutputSizePixel().Width();
IMPL_LINK(BrowseBox, VertScrollHdl, weld::Scrollbar &, rScrollbar, void)
static bool bExtendedMode
#define BROWSER_CURSORDOWN
#define BROWSER_SELECTDOWN
#define BROWSER_CURSORLEFT
#define BROWSER_CURSORHOME
#define BROWSER_CURSOREND
constexpr sal_Int32 BROWSER_ENDOFSELECTION
#define BROWSER_SELECTEND
#define BROWSER_MOVECOLUMNRIGHT
#define BROWSER_SELECTHOME
#define BROWSER_INVALIDID
#define BROWSER_CURSORENDOFSCREEN
#define BROWSER_ENHANCESELECTION
#define BROWSER_CURSORENDOFFILE
#define BROWSER_MOVECOLUMNLEFT
#define BROWSER_CURSORPAGEUP
#define BROWSER_CURSORTOPOFSCREEN
#define BROWSER_CURSORPAGEDOWN
#define BROWSER_CURSORRIGHT
#define BROWSER_CURSORTOPOFFILE
#define BROWSER_SELECTCOLUMN
const StyleSettings & GetStyleSettings() const
SVT_DLLPRIVATE void AutoSizeLastColumn()
bool IsDropFormatSupported(SotClipboardFormatId nFormat) const
tools::Long GetDataRowHeight() const
sal_uInt16 GetColumnId(sal_uInt16 nPos) const
void SetUpdateMode(bool bUpdate)
tools::Rectangle GetControlArea() const
SVT_DLLPRIVATE void ExpandRowSelection(const BrowserMouseEvent &rEvt)
SVT_DLLPRIVATE sal_uInt16 FrozenColCount() const
tools::Long m_nCornerHeight
virtual void CursorMoved()
virtual void Command(const CommandEvent &rEvt) override
virtual void MouseButtonDown(const MouseEvent &rEvt) override
VclPtr< BrowserDataWin > pDataWin
bool bSelectionIsVisible
select or deselect
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
tools::Long GetTitleHeight() const
virtual tools::Long QueryMinimumRowHeight()
SVT_DLLPRIVATE void ColumnInserted(sal_uInt16 nPos)
virtual sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt) override
VclPtr< ScrollAdaptor > pVScroll
sal_Int32 GetCurRow() const
sal_uInt16 GetSelectColumnCount() const
virtual void ImplStartTracking()
virtual tools::Rectangle calcTableRect(bool _bOnScreen=true) override
calculates the Rectangle of the table
virtual void StateChanged(StateChangedType nStateChange) override
virtual sal_Int8 AcceptDrop(const AcceptDropEvent &rEvt) override
tools::Long m_nDataRowHeight
void SetColumnPos(sal_uInt16 nColumnId, sal_uInt16 nPos)
sal_uLong nControlAreaWidth
virtual void GrabFocus() override
virtual void DoubleClick(const BrowserMouseEvent &rEvt)
sal_uInt16 ColCount() const
void SelectColumnPos(sal_uInt16 nCol, bool _bSelect, bool bMakeVisible)
SVT_DLLPRIVATE tools::Long GetFrozenWidth() const
bool GoToRowColumnId(sal_Int32 nRow, sal_uInt16 nColId)
virtual bool ProcessKey(const KeyEvent &rEvt)
bool PaintCursorIfHiddenOnce() const
virtual void MouseButtonUp(const MouseEvent &rEvt) override
sal_Int32 ScrollColumns(sal_Int32 nColumns)
virtual void ColumnResized(sal_uInt16 nColId)
virtual tools::Rectangle calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen=true) override
returns the Rectangle for either the column header bar or the row header bar
void SetColumnWidth(sal_uInt16 nColumnId, sal_uLong nWidth)
sal_uInt16 GetColumnPos(sal_uInt16 nColumnId) const
void SetCursorColor(const Color &_rCol)
void SelectColumnId(sal_uInt16 nColId)
sal_Int32 GetSelectRowCount() const
const DataFlavorExVector & GetDataFlavors() const
virtual void SelectAll() override
virtual void StartDrag(sal_Int8 _nAction, const Point &_rPosPixel) override
static const sal_uInt16 HandleColumnId
sal_Int32 ScrollRows(sal_Int32 nRows)
sal_uInt16 GetCurColumnId() const
bool GetUpdateMode() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
SVT_DLLPRIVATE tools::Long ImpGetDataRowHeight() const
tools::Rectangle GetFieldRectPixel(sal_Int32 nRow, sal_uInt16 nColId, bool bRelToBrowser=true) const
void Dispatch(sal_uInt16 nId)
virtual tools::Rectangle GetWindowExtentsAbsolute() const override
virtual void ChildFocusIn()
bool GoToRow(sal_Int32 nRow, bool bRowColMove, bool bDoNotModifySelection=false)
virtual void Resize() override
virtual tools::Rectangle GetWindowExtentsRelative(const vcl::Window &rRelativeWindow) const override
virtual vcl::Window * GetAccessibleParentWindow() const override
virtual bool SeekRow(sal_Int32 nRow)=0
seeks for the given row position
virtual void MouseMove(const MouseEvent &rEvt) override
sal_uInt16 GetColumnAtXPosPixel(tools::Long nX) const
SVT_DLLPRIVATE void UpdateScrollbars()
tools::Long m_nActualCornerWidth
virtual sal_Int32 GetRowCount() const override
SVT_DLLPRIVATE void ToggleSelection()
short GetCursorHideCount() const
virtual void VisibleRowsChanged(sal_Int32 nNewTopRow, sal_uInt16 nNumRows)
tools::Long m_nCornerWidth
virtual void SetNoSelection() override
virtual void KeyInput(const KeyEvent &rEvt) override
void PaintData(vcl::Window const &rWin, vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
SVT_DLLPRIVATE tools::Long GetBarHeight() const
::std::vector< std::unique_ptr< BrowserColumn > > mvCols
bool GoToColumnId(sal_uInt16 nColId, bool bMakeVisible, bool bRowColMove=false)
bool IsColumnSelected(sal_uInt16 nColumnId) const
bool IsFrozen(sal_uInt16 nColumnId) const
void ImplPaintData(OutputDevice &_rOut, const tools::Rectangle &_rRect, bool _bForeignDevice)
virtual void SelectRow(sal_Int32 nRow, bool _bSelect=true, bool bExpand=true) override
virtual void ColumnMoved(sal_uInt16 nColId)
virtual void ImplEndTracking()
virtual void RowHeightChanged()
called when the row height has been changed interactively
void MakeFieldVisible(sal_Int32 nRow, sal_uInt16 nColId)
virtual void ChildFocusOut()
VclPtr< ScrollAdaptor > aHScroll
std::unique_ptr< MultiSelection > pColSel
sal_uLong GetColumnWidth(sal_uInt16 nColumnId) const
virtual bool IsRowSelected(sal_Int32 nRow) const override
sal_uInt16 GetColumn() const
sal_uInt16 GetColumnId() const
void SetWidth(sal_uLong nNewWidthPixel, const Fraction &rCurrentZoom)
void Draw(BrowseBox const &rBox, OutputDevice &rDev, const Point &rPos)
virtual void StateChanged(StateChangedType nStateChange) override
static bool IsQuickHelpEnabled()
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
const vcl::KeyCode & GetKeyCode() const
MouseEventModifiers GetMode() const
sal_uInt16 GetModifier() const
sal_uInt16 GetClicks() const
sal_uInt16 GetButtons() const
const Point & GetPosPixel() const
void SetFont(const vcl::Font &rNewFont)
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
void SetTextColor(const Color &rColor)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
const Color & GetLineColor() const
const Color & GetTextColor() const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
const AllSettings & GetSettings() const
const Color & GetFillColor() const
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
bool Contains(tools::Long nIs) const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_Int32 GetScrollBarSize() const
const Color & GetDarkShadowColor() const
const Color & GetShadowColor() const
const Color & GetHighlightColor() const
const Color & GetFaceColor() const
const Color & GetHighlightTextColor() const
reference_type * get() const
sal_uInt16 GetCode() const
Point OutputToScreenPixel(const Point &rPos) const
void SetUpdateMode(bool bUpdate)
bool IsReallyVisible() const
Point LogicToPixel(const Point &rLogicPt) const
virtual void SetSizePixel(const Size &rNewSize)
virtual void Command(const CommandEvent &rCEvt)
tools::Long CalcZoom(tools::Long n) const
bool IsUpdateMode() const
virtual void EnableRTL(bool bEnable=true)
const Fraction & GetZoom() const
const AllSettings & GetSettings() const
virtual void KeyInput(const KeyEvent &rKEvt)
void SetZoom(const Fraction &rZoom)
virtual void ShowFocus(const tools::Rectangle &rRect)
bool IsRTLEnabled() const
Point PixelToLogic(const Point &rDevicePt) const
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
virtual void SetPointer(PointerStyle)
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
virtual void SetPosSizePixel(const Point &rNewPos, const Size &rNewSize)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_ASSERT(sCon, aError)
virtual sal_uInt32 GetId() const override
::std::vector< DataFlavorEx > DataFlavorExVector
constexpr sal_uInt16 KEY_HOME
constexpr sal_uInt16 KEY_LEFT
constexpr sal_uInt16 KEY_PAGEDOWN
constexpr sal_uInt16 KEY_TAB
constexpr sal_uInt16 KEY_UP
constexpr sal_uInt16 KEY_RIGHT
constexpr sal_uInt16 KEY_DOWN
constexpr sal_uInt16 KEY_SPACE
constexpr sal_uInt16 KEY_PAGEUP
constexpr sal_uInt16 KEY_END
#define SAL_INFO(area, stream)
if(aStr !=aBuf) UpdateName_Impl(m_xFollowLb.get()
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)