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