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 <svtools/headbar.hxx>
25 #include <svtools/svtabbx.hxx>
26 #include <unotools/intlwrapper.hxx>
29 class SVT_DLLPUBLIC SvSimpleTableContainer
: public Control
32 VclPtr
<SvSimpleTable
> m_pTable
;
35 virtual bool PreNotify( NotifyEvent
& rNEvt
) SAL_OVERRIDE
;
38 SvSimpleTableContainer( vcl::Window
* pParent
, WinBits nBits
= WB_BORDER
);
39 virtual ~SvSimpleTableContainer();
40 virtual void dispose() SAL_OVERRIDE
;
42 void SetTable(SvSimpleTable
* pTable
);
44 virtual void Resize() SAL_OVERRIDE
;
46 virtual void GetFocus() SAL_OVERRIDE
;
49 class SVT_DLLPUBLIC SvSimpleTable
: public SvHeaderTabListBox
52 SvSimpleTableContainer
& m_rParentTableContainer
;
54 Link
<> aHeaderBarClickLink
;
55 Link
<> aHeaderBarDblClickLink
;
58 VclPtr
<HeaderBar
> aHeaderBar
;
60 sal_uInt16 nHeaderItemId
;
65 const CollatorWrapper aCollator
;
67 DECL_LINK( StartDragHdl
, HeaderBar
* );
68 DECL_LINK( DragHdl
, HeaderBar
* );
69 DECL_LINK( EndDragHdl
, HeaderBar
* );
70 DECL_LINK( HeaderBarClick
, HeaderBar
* );
71 DECL_LINK( HeaderBarDblClick
, HeaderBar
* );
72 DECL_LINK( CompareHdl
, SvSortData
* );
76 virtual void NotifyScrolled() SAL_OVERRIDE
;
78 virtual void SetTabs() SAL_OVERRIDE
;
79 virtual void Paint( vcl::RenderContext
& rRenderContext
, const Rectangle
& rRect
) SAL_OVERRIDE
;
81 virtual void HBarClick();
87 virtual void Command( const CommandEvent
& rCEvt
) SAL_OVERRIDE
;
89 virtual sal_Int32
ColCompare(SvTreeListEntry
*,SvTreeListEntry
*);
92 SvSimpleTable(SvSimpleTableContainer
& rParent
, WinBits nBits
= WB_BORDER
);
93 virtual ~SvSimpleTable();
94 virtual void dispose() SAL_OVERRIDE
;
96 void UpdateViewSize();
98 void InsertHeaderEntry(const OUString
& rText
,
99 sal_uInt16 nCol
=HEADERBAR_APPEND
,
100 HeaderBarItemBits nBits
= HeaderBarItemBits::STDSTYLE
);
102 void SetTabs(const long* pTabs
, MapUnit
= MAP_APPFONT
);
108 bool IsVisible() const;
112 bool IsEnabled() const;
114 sal_uInt16
GetSelectedCol();
115 void SortByCol(sal_uInt16
, bool bDir
=true);
116 bool GetSortDirection(){ return bSortDirection
;}
117 sal_uInt16
GetSortedCol(){ return nSortCol
;}
118 SvLBoxItem
* GetEntryAtPos( SvTreeListEntry
* pEntry
, sal_uInt16 nPos
) const;
120 CommandEvent
GetCommandEvent()const { return aCEvt
;}
121 inline bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
123 void SetCommandHdl( const Link
<>& rLink
) { aCommandLink
= rLink
; }
124 const Link
<>& GetCommandHdl() const { return aCommandLink
; }
126 void SetHeaderBarClickHdl( const Link
<>& rLink
) { aHeaderBarClickLink
= rLink
; }
127 const Link
<>& GetHeaderBarClickHdl() const { return aHeaderBarClickLink
; }
129 void SetHeaderBarDblClickHdl( const Link
<>& rLink
) { aHeaderBarDblClickLink
= rLink
; }
130 const Link
<>& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink
; }
132 void SetHeaderBarHelpId(const OString
& rHelpId
) { aHeaderBar
->SetHelpId(rHelpId
); }
134 HeaderBar
& GetTheHeaderBar() { return *aHeaderBar
.get(); }
138 #endif // INCLUDED_SVTOOLS_SIMPTABL_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */