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