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 : #include <unotools/intlwrapper.hxx>
27 :
28 : class SvSimpleTable;
29 0 : class SVT_DLLPUBLIC SvSimpleTableContainer : public Control
30 : {
31 : private:
32 : SvSimpleTable* m_pTable;
33 :
34 : protected:
35 : virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
36 :
37 : public:
38 : SvSimpleTableContainer( vcl::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 : const CollatorWrapper aCollator;
64 :
65 : DECL_LINK( StartDragHdl, HeaderBar* );
66 : DECL_LINK( DragHdl, HeaderBar* );
67 : DECL_LINK( EndDragHdl, HeaderBar* );
68 : DECL_LINK( HeaderBarClick, HeaderBar* );
69 : DECL_LINK( HeaderBarDblClick, HeaderBar* );
70 : DECL_LINK( CompareHdl, SvSortData* );
71 :
72 : protected:
73 :
74 : virtual void NotifyScrolled() SAL_OVERRIDE;
75 :
76 : virtual void SetTabs() SAL_OVERRIDE;
77 : virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
78 :
79 : virtual void HBarClick();
80 : virtual void HBarDblClick();
81 : virtual void HBarStartDrag();
82 : virtual void HBarDrag();
83 : virtual void HBarEndDrag();
84 :
85 : virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
86 :
87 : virtual sal_Int32 ColCompare(SvTreeListEntry*,SvTreeListEntry*);
88 : public:
89 :
90 : SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
91 : virtual ~SvSimpleTable();
92 :
93 : void UpdateViewSize();
94 :
95 : void InsertHeaderEntry(const OUString& rText,
96 : sal_uInt16 nCol=HEADERBAR_APPEND,
97 : HeaderBarItemBits nBits = HIB_STDSTYLE);
98 :
99 : void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
100 :
101 : void ClearHeader();
102 :
103 : void ShowTable();
104 : void HideTable();
105 : bool IsVisible() const;
106 :
107 : void EnableTable();
108 : void DisableTable();
109 : bool IsEnabled() const;
110 :
111 : sal_uInt16 GetSelectedCol();
112 : void SortByCol(sal_uInt16, bool bDir=true);
113 0 : bool GetSortDirection(){ return bSortDirection;}
114 0 : sal_uInt16 GetSortedCol(){ return nSortCol;}
115 : SvLBoxItem* GetEntryAtPos( SvTreeListEntry* pEntry, sal_uInt16 nPos ) const;
116 :
117 0 : CommandEvent GetCommandEvent()const { return aCEvt;}
118 0 : inline bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
119 :
120 0 : void SetCommandHdl( const Link& rLink ) { aCommandLink = rLink; }
121 : const Link& GetCommandHdl() const { return aCommandLink; }
122 :
123 0 : void SetHeaderBarClickHdl( const Link& rLink ) { aHeaderBarClickLink = rLink; }
124 : const Link& GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
125 :
126 : void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
127 : const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
128 :
129 : void SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
130 :
131 0 : HeaderBar& GetTheHeaderBar() {return aHeaderBar;}
132 : };
133 :
134 :
135 : #endif // INCLUDED_SVTOOLS_SIMPTABL_HXX
136 :
137 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|