Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVX_SIMPTABL_HXX
30 : : #define _SVX_SIMPTABL_HXX
31 : :
32 : : #include <vcl/morebtn.hxx>
33 : :
34 : : #include <vcl/combobox.hxx>
35 : :
36 : : #include <vcl/group.hxx>
37 : : #include <svtools/headbar.hxx>
38 : : #include <svtools/svtabbx.hxx>
39 : : #include <vcl/lstbox.hxx>
40 : : #include "svx/svxdllapi.h"
41 : :
42 : : class SvxSimpleTable;
43 [ # # ]: 0 : class SVX_DLLPUBLIC SvxSimpleTableContainer : public Control
44 : : {
45 : : private:
46 : : SvxSimpleTable* m_pTable;
47 : :
48 : : protected:
49 : : virtual long PreNotify( NotifyEvent& rNEvt );
50 : :
51 : : public:
52 : : SvxSimpleTableContainer( Window* pParent, const ResId& rResId );
53 : :
54 : : void SetTable(SvxSimpleTable* pTable);
55 : :
56 : : virtual void SetSizePixel(const Size& rNewSize);
57 : : virtual void GetFocus();
58 : : };
59 : :
60 : : class SVX_DLLPUBLIC SvxSimpleTable : public SvHeaderTabListBox
61 : : {
62 : : private:
63 : : SvxSimpleTableContainer& m_rParentTableContainer;
64 : :
65 : : Link aHeaderBarClickLink;
66 : : Link aHeaderBarDblClickLink;
67 : : Link aCommandLink;
68 : : CommandEvent aCEvt;
69 : : HeaderBar aHeaderBar;
70 : : long nOldPos;
71 : : sal_uInt16 nHeaderItemId;
72 : : sal_Bool bResizeFlag;
73 : : sal_Bool bPaintFlag;
74 : : sal_Bool bSortDirection;
75 : : sal_uInt16 nSortCol;
76 : :
77 : : DECL_LINK( StartDragHdl, HeaderBar* );
78 : : DECL_LINK( DragHdl, HeaderBar* );
79 : : DECL_LINK( EndDragHdl, HeaderBar* );
80 : : DECL_LINK( HeaderBarClick, HeaderBar* );
81 : : DECL_LINK( HeaderBarDblClick, HeaderBar* );
82 : : DECL_LINK( CompareHdl, SvSortData* );
83 : :
84 : : protected:
85 : :
86 : : virtual void NotifyScrolled();
87 : :
88 : : virtual void SetTabs();
89 : : virtual void Paint( const Rectangle& rRect );
90 : :
91 : : virtual void HBarClick();
92 : : virtual void HBarDblClick();
93 : : virtual void HBarStartDrag();
94 : : virtual void HBarDrag();
95 : : virtual void HBarEndDrag();
96 : :
97 : : virtual void Command( const CommandEvent& rCEvt );
98 : :
99 : : virtual StringCompare ColCompare(SvLBoxEntry*,SvLBoxEntry*);
100 : : public:
101 : :
102 : : SvxSimpleTable(SvxSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
103 : : ~SvxSimpleTable();
104 : :
105 : : void UpdateViewSize();
106 : :
107 : : void InsertHeaderEntry(const rtl::OUString& rText,
108 : : sal_uInt16 nCol=HEADERBAR_APPEND,
109 : : HeaderBarItemBits nBits = HIB_STDSTYLE);
110 : :
111 : : void SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
112 : :
113 : : void ClearHeader();
114 : :
115 : : // to be removed all calls of the related methods are redirected to *Table() methods
116 : : using Window::Show;
117 : : using Window::Hide;
118 : : using Window::Enable;
119 : : using Window::Disable;
120 : : using Window::ToTop;
121 : :
122 : : void Show();
123 : : void Hide();
124 : : void Enable();
125 : : void Disable();
126 : : void ToTop();
127 : :
128 : : // remove until this line
129 : :
130 : : void ShowTable();
131 : : void HideTable();
132 : : sal_Bool IsVisible() const;
133 : :
134 : : void EnableTable();
135 : : void DisableTable();
136 : : sal_Bool IsEnabled() const;
137 : :
138 : : sal_uInt16 GetSelectedCol();
139 : : void SortByCol(sal_uInt16,sal_Bool bDir=sal_True);
140 : 0 : sal_Bool GetSortDirection(){ return bSortDirection;}
141 : 0 : sal_uInt16 GetSortedCol(){ return nSortCol;}
142 : : SvLBoxItem* GetEntryAtPos( SvLBoxEntry* pEntry, sal_uInt16 nPos ) const;
143 : :
144 : : CommandEvent GetCommandEvent()const;
145 : : inline sal_Bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
146 : :
147 : 0 : void SetCommandHdl( const Link& rLink ) { aCommandLink = rLink; }
148 : : const Link& GetCommandHdl() const { return aCommandLink; }
149 : :
150 : 0 : void SetHeaderBarClickHdl( const Link& rLink ) { aHeaderBarClickLink = rLink; }
151 : : const Link& GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
152 : :
153 : : void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
154 : : const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
155 : :
156 : : void SetHeaderBarHelpId(const rtl::OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
157 : :
158 : 0 : HeaderBar& GetTheHeaderBar() {return aHeaderBar;}
159 : : };
160 : :
161 : :
162 : : #endif // _SVX_SIMPTABL_HXX
163 : :
164 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|