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