Update ooo320-m1
[ooovba.git] / binfilter / inc / bf_svtools / sectctr.hxx
blobc64b1a2857cae5d32ad35c6713cf4137da831347
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sectctr.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SV_SECTCTR_HXX
32 #define _SV_SECTCTR_HXX
34 #ifndef _SV_SV_H
35 #include <vcl/sv.h>
36 #endif
37 #ifndef _SV_CTRL_HXX
38 #include <vcl/ctrl.hxx>
39 #endif
41 class ScrollBar;
42 class ScrollBarBox;
43 namespace binfilter
46 class SvSection;
47 class ImplSplitWindow;
49 #define SECTION_APPEND ((USHORT)0xFFFF)
50 #define SECTION_NOTFOUND ((USHORT)0xFFFF)
52 #define WB_SECTION_STYLE WB_VSCROLL | WB_HSCROLL | WB_TABSTOP
54 class SvSectionControl : public Control
56 private:
58 Window aSplitWinContainer;
59 ImplSplitWindow* pSplitWin;
60 ScrollBar* pVScrollBar;
61 ScrollBar* pHScrollBar;
62 ScrollBarBox* pScrollBarBox;
63 DockingWindow* pDummy;
64 long nRealHeight;
65 long nMaxHeight;
66 long nMinWidth;
67 Wallpaper aWallpaper;
69 DECL_LINK( ScrollHdl, ScrollBar* );
70 DECL_LINK( EndScrollHdl, ScrollBar* );
73 protected:
75 virtual void Resize();
76 virtual void Paint( const Rectangle& rRect );
77 virtual void StateChanged( StateChangedType nStateChange );
78 virtual void DataChanged( const DataChangedEvent& rDCEvt );
79 virtual void Command( const CommandEvent& rCEvt );
80 virtual long PreNotify( NotifyEvent& rNEvt );
81 virtual long Notify( NotifyEvent& rNEvt );
82 virtual long KeyEventNotify( const KeyEvent& rKEvt );
83 using Control::SetPosSizePixel;
84 virtual void SetPosSizePixel( long nX, long nY,long nWidth, long nHeight,USHORT nFlags);
88 long CalcMaxHeight();
89 long CalcRealHeight();
90 long CalcSectionWidth();
92 void SetScrollBars(BOOL bVert,BOOL bHorz);
93 void ShowScrollBarBox();
94 void UpdateScrollBars();
96 BOOL VScrollResize(Size &aSize);
97 BOOL HScrollResize(Size &aSize);
98 void SetChildPos(long nPos, BOOL bScrolling = TRUE);
100 public:
101 SvSectionControl( Window* pParent,WinBits nStyle = WB_SECTION_STYLE);
102 SvSectionControl( Window* pParent, const ResId& rResId );
103 ~SvSectionControl();
106 void InsertSection( USHORT nSectionId,SvSection* pSection,long nSize,USHORT nPos);
107 void InsertSection( USHORT nSectionId,SvSection* pSection,USHORT nPos);
108 void RemoveSection( USHORT nSectionId );
109 void Clear();
111 USHORT GetSectionCount() const;
112 USHORT GetSectionId( USHORT nPos ) const;
113 USHORT GetSectionPos( USHORT nSectionId ) const;
114 USHORT GetSectionId( const Point& rPos ) const;
116 void SetSectionSize( USHORT nId, long nNewSize );
117 long GetSectionSize( USHORT nId ) const;
120 void SetCurSectionId( USHORT nSectionId );
121 USHORT GetCurSectionId() const;
123 void SetFirstSectionId( USHORT nSectionId );
124 USHORT GetFirstSectionId() const { return GetSectionId( mnFirstSectionPos ); }
126 void MakeVisible( USHORT nSectionId );
129 void SetSectionWidth( USHORT nSectionId, long nWidth);
130 long GetSectionWidth( USHORT nSectionId ) const;
132 void SetSection( USHORT nSectionId, SvSection* pPage );
133 SvSection* GetSection( USHORT nSectionId ) const;
135 void SetSectionText( USHORT nSectionId, const XubString& rText );
136 XubString GetSectionText( USHORT nSectionId ) const;
138 void SetHelpText( USHORT nSectionId, const XubString& rText );
139 const XubString& GetHelpText( USHORT nSectionId ) const;
141 void SetHelpId( USHORT nSectionId, ULONG nHelpId );
142 ULONG GetHelpId( USHORT nSectionId ) const;
144 void SetHelpText( const XubString& rText )
145 { Control::SetHelpText( rText ); }
146 const XubString& GetHelpText() const
147 { return Control::GetHelpText(); }
149 void SetHelpId( ULONG nId )
150 { Control::SetHelpId( nId ); }
151 ULONG GetHelpId() const
152 { return Control::GetHelpId(); }
154 using Control::SetBackground;
155 void SetBackground( const Wallpaper& rBackground ){aWallpaper=rBackground; }
156 const Wallpaper& GetBackground() const { return aWallpaper; }
162 #endif