Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SVTOOLS_SIMPTABL_HXX
21 : #define INCLUDED_SVTOOLS_SIMPTABL_HXX
22 :
23 : #include <svtools/svtdllapi.h>
24 : #include <svtools/headbar.hxx>
25 : #include <svtools/svtabbx.hxx>
26 :
27 : class SvSimpleTable;
28 0 : class SVT_DLLPUBLIC SvSimpleTableContainer : public Control
29 : {
30 : private:
31 : SvSimpleTable* m_pTable;
32 :
33 : protected:
34 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
35 :
36 : public:
37 : SvSimpleTableContainer( Window* pParent, const ResId& rResId );
38 : SvSimpleTableContainer( Window* pParent, WinBits nBits = WB_BORDER );
39 :
40 : void SetTable(SvSimpleTable* pTable);
41 :
42 : virtual void Resize() SAL_OVERRIDE;
43 :
44 : virtual void GetFocus() SAL_OVERRIDE;
45 : };
46 :
47 : class SVT_DLLPUBLIC SvSimpleTable : public SvHeaderTabListBox
48 : {
49 : private:
50 : SvSimpleTableContainer& m_rParentTableContainer;
51 :
52 : Link aHeaderBarClickLink;
53 : Link aHeaderBarDblClickLink;
54 : Link aCommandLink;
55 : CommandEvent aCEvt;
56 : HeaderBar aHeaderBar;
57 : long nOldPos;
58 : sal_uInt16 nHeaderItemId;
59 : bool bPaintFlag;
60 : bool bSortDirection;
61 : sal_uInt16 nSortCol;
62 :
63 : DECL_LINK( StartDragHdl, HeaderBar* );
64 : DECL_LINK( DragHdl, HeaderBar* );
65 : DECL_LINK( EndDragHdl, HeaderBar* );
66 : DECL_LINK( HeaderBarClick, HeaderBar* );
67 : DECL_LINK( HeaderBarDblClick, HeaderBar* );
68 : DECL_LINK( CompareHdl, SvSortData* );
69 :
70 : protected:
71 :
72 : virtual void NotifyScrolled() SAL_OVERRIDE;
73 :
74 : virtual void SetTabs() SAL_OVERRIDE;
75 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
76 :
77 : virtual void HBarClick();
78 : virtual void HBarDblClick();
79 : virtual void HBarStartDrag();
80 : virtual void HBarDrag();
81 : virtual void HBarEndDrag();
82 :
83 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
84 :
85 : virtual sal_Int32 ColCompare(SvTreeListEntry*,SvTreeListEntry*);
86 : public:
87 :
88 : SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
89 : virtual ~SvSimpleTable();
90 :
91 : void UpdateViewSize();
92 :
93 : void InsertHeaderEntry(const OUString& rText,
94 : sal_uInt16 nCol=HEADERBAR_APPEND,
95 : HeaderBarItemBits nBits = HIB_STDSTYLE);
96 :
97 : void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
98 :
99 : void ClearHeader();
100 :
101 : void ShowTable();
102 : void HideTable();
103 : bool IsVisible() const;
104 :
105 : void EnableTable();
106 : void DisableTable();
107 : bool IsEnabled() const;
108 :
109 : sal_uInt16 GetSelectedCol();
110 : void SortByCol(sal_uInt16, bool bDir=true);
111 0 : bool GetSortDirection(){ return bSortDirection;}
112 0 : sal_uInt16 GetSortedCol(){ return nSortCol;}
113 : SvLBoxItem* GetEntryAtPos( SvTreeListEntry* pEntry, sal_uInt16 nPos ) const;
114 :
115 : CommandEvent GetCommandEvent()const;
116 0 : inline bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
117 :
118 0 : void SetCommandHdl( const Link& rLink ) { aCommandLink = rLink; }
119 : const Link& GetCommandHdl() const { return aCommandLink; }
120 :
121 0 : void SetHeaderBarClickHdl( const Link& rLink ) { aHeaderBarClickLink = rLink; }
122 : const Link& GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
123 :
124 : void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
125 : const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
126 :
127 : void SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
128 :
129 0 : HeaderBar& GetTheHeaderBar() {return aHeaderBar;}
130 : };
131 :
132 :
133 : #endif // INCLUDED_SVTOOLS_SIMPTABL_HXX
134 :
135 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|