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 _SVX_SIMPTABL_HXX
21 : #define _SVX_SIMPTABL_HXX
22 :
23 : #include <vcl/morebtn.hxx>
24 :
25 : #include <vcl/combobox.hxx>
26 :
27 : #include <vcl/group.hxx>
28 : #include <svtools/headbar.hxx>
29 : #include <svtools/svtabbx.hxx>
30 : #include <vcl/lstbox.hxx>
31 : #include "svx/svxdllapi.h"
32 :
33 : class SvxSimpleTable;
34 0 : class SVX_DLLPUBLIC SvxSimpleTableContainer : public Control
35 : {
36 : private:
37 : SvxSimpleTable* m_pTable;
38 :
39 : protected:
40 : virtual long PreNotify( NotifyEvent& rNEvt );
41 :
42 : public:
43 : SvxSimpleTableContainer( Window* pParent, const ResId& rResId );
44 : SvxSimpleTableContainer( Window* pParent, WinBits nBits = WB_BORDER );
45 :
46 : void SetTable(SvxSimpleTable* pTable);
47 :
48 : virtual void Resize();
49 :
50 : virtual void GetFocus();
51 : };
52 :
53 : class SVX_DLLPUBLIC SvxSimpleTable : public SvHeaderTabListBox
54 : {
55 : private:
56 : SvxSimpleTableContainer& m_rParentTableContainer;
57 :
58 : Link aHeaderBarClickLink;
59 : Link aHeaderBarDblClickLink;
60 : Link aCommandLink;
61 : CommandEvent aCEvt;
62 : HeaderBar aHeaderBar;
63 : long nOldPos;
64 : sal_uInt16 nHeaderItemId;
65 : sal_Bool bResizeFlag;
66 : sal_Bool bPaintFlag;
67 : sal_Bool bSortDirection;
68 : sal_uInt16 nSortCol;
69 :
70 : DECL_LINK( StartDragHdl, HeaderBar* );
71 : DECL_LINK( DragHdl, HeaderBar* );
72 : DECL_LINK( EndDragHdl, HeaderBar* );
73 : DECL_LINK( HeaderBarClick, HeaderBar* );
74 : DECL_LINK( HeaderBarDblClick, HeaderBar* );
75 : DECL_LINK( CompareHdl, SvSortData* );
76 :
77 : protected:
78 :
79 : virtual void NotifyScrolled();
80 :
81 : virtual void SetTabs();
82 : virtual void Paint( const Rectangle& rRect );
83 :
84 : virtual void HBarClick();
85 : virtual void HBarDblClick();
86 : virtual void HBarStartDrag();
87 : virtual void HBarDrag();
88 : virtual void HBarEndDrag();
89 :
90 : virtual void Command( const CommandEvent& rCEvt );
91 :
92 : virtual StringCompare ColCompare(SvTreeListEntry*,SvTreeListEntry*);
93 : public:
94 :
95 : SvxSimpleTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
96 : ~SvxSimpleTable();
97 :
98 : void UpdateViewSize();
99 :
100 : void InsertHeaderEntry(const OUString& rText,
101 : sal_uInt16 nCol=HEADERBAR_APPEND,
102 : HeaderBarItemBits nBits = HIB_STDSTYLE);
103 :
104 : void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
105 :
106 : void ClearHeader();
107 :
108 : // to be removed all calls of the related methods are redirected to *Table() methods
109 : using Window::Show;
110 : using Window::Hide;
111 : using Window::Enable;
112 : using Window::Disable;
113 : using Window::ToTop;
114 :
115 : void Show();
116 : void Hide();
117 : void Enable();
118 : void Disable();
119 : void ToTop();
120 :
121 : // remove until this line
122 :
123 : void ShowTable();
124 : void HideTable();
125 : sal_Bool IsVisible() const;
126 :
127 : void EnableTable();
128 : void DisableTable();
129 : sal_Bool IsEnabled() const;
130 :
131 : sal_uInt16 GetSelectedCol();
132 : void SortByCol(sal_uInt16,sal_Bool bDir=sal_True);
133 0 : sal_Bool GetSortDirection(){ return bSortDirection;}
134 0 : sal_uInt16 GetSortedCol(){ return nSortCol;}
135 : SvLBoxItem* GetEntryAtPos( SvTreeListEntry* pEntry, sal_uInt16 nPos ) const;
136 :
137 : CommandEvent GetCommandEvent()const;
138 0 : inline sal_Bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
139 :
140 0 : void SetCommandHdl( const Link& rLink ) { aCommandLink = rLink; }
141 : const Link& GetCommandHdl() const { return aCommandLink; }
142 :
143 0 : void SetHeaderBarClickHdl( const Link& rLink ) { aHeaderBarClickLink = rLink; }
144 : const Link& GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
145 :
146 : void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
147 : const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
148 :
149 : void SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
150 :
151 0 : HeaderBar& GetTheHeaderBar() {return aHeaderBar;}
152 : };
153 :
154 :
155 : #endif // _SVX_SIMPTABL_HXX
156 :
157 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|