1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SVTOOLS_SIMPTABL_HXX
21 #define INCLUDED_SVTOOLS_SIMPTABL_HXX
23 #include <svtools/svtdllapi.h>
24 #include <vcl/headbar.hxx>
25 #include <vcl/svtabbx.hxx>
26 #include <unotools/collatorwrapper.hxx>
27 #include <vcl/commandevent.hxx>
30 class SVT_DLLPUBLIC SvSimpleTableContainer
: public Control
33 VclPtr
<SvSimpleTable
> m_pTable
;
36 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
39 SvSimpleTableContainer( vcl::Window
* pParent
, WinBits nBits
);
40 virtual ~SvSimpleTableContainer() override
;
41 virtual void dispose() override
;
43 void SetTable(SvSimpleTable
* pTable
);
44 SvSimpleTable
* GetTable();
46 virtual void Resize() override
;
48 virtual void GetFocus() override
;
50 virtual FactoryFunction
GetUITestFactory() const override
;
53 class SVT_DLLPUBLIC SvSimpleTable
: public SvHeaderTabListBox
56 SvSimpleTableContainer
& m_rParentTableContainer
;
58 Link
<SvSimpleTable
*, void> aCommandLink
;
60 VclPtr
<HeaderBar
> aHeaderBar
;
62 sal_uInt16 nHeaderItemId
;
67 const CollatorWrapper aCollator
;
69 DECL_LINK( StartDragHdl
, HeaderBar
*, void );
70 DECL_LINK( DragHdl
, HeaderBar
*, void );
71 DECL_LINK( EndDragHdl
, HeaderBar
*, void );
72 DECL_LINK( HeaderBarClick
, HeaderBar
*, void );
73 DECL_LINK( CompareHdl
, const SvSortData
&, sal_Int32
);
77 virtual void NotifyScrolled() override
;
79 virtual void SetTabs() override
;
80 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
82 virtual void HBarClick();
86 virtual void Command( const CommandEvent
& rCEvt
) override
;
88 sal_Int32
ColCompare(SvTreeListEntry
*,SvTreeListEntry
*);
91 SvSimpleTable(SvSimpleTableContainer
& rParent
, WinBits nBits
= WB_BORDER
);
92 virtual ~SvSimpleTable() override
;
93 virtual void dispose() override
;
95 void UpdateViewSize();
97 void InsertHeaderEntry(const OUString
& rText
,
98 sal_uInt16 nCol
=HEADERBAR_APPEND
,
99 HeaderBarItemBits nBits
= HeaderBarItemBits::STDSTYLE
);
101 using SvHeaderTabListBox::SetTabs
;
105 bool IsEnabled() const;
107 void SortByCol(sal_uInt16
, bool bDir
=true);
108 sal_uInt16
GetSortedCol(){ return nSortCol
;}
109 SvLBoxItem
* GetEntryAtPos( SvTreeListEntry
* pEntry
, sal_uInt16 nPos
) const;
111 bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
113 HeaderBar
& GetTheHeaderBar() { return *aHeaderBar
; }
117 #endif // INCLUDED_SVTOOLS_SIMPTABL_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */