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 ADDRCONT_HXX
29 #define ADDRCONT_HXX
30 
31 #include <com/sun/star/frame/XFrame.hpp>
32 #include <vcl/splitwin.hxx>
33 #include <vcl/timer.hxx>
34 #include "bibshortcuthandler.hxx"
35 
36 #include "bibmod.hxx"
37 
38 #define TOP_WINDOW							1
39 #define BOTTOM_WINDOW						2
40 
41 class BibDataManager;
42 
43 class BibWindowContainer : public BibWindow		//Window
44 {
45 	private:
46 		// !BibShortCutHandler is also always a Window!
47 		BibShortCutHandler*		pChild;
48 
49 	protected:
50 		virtual void			Resize();
51 
52 	public:
53 		BibWindowContainer( Window* pParent, BibShortCutHandler* pChild, WinBits nStyle = WB_3DLOOK);
54 		~BibWindowContainer();
55 
56 		inline Window*			GetChild();
57 
58 		virtual void			GetFocus();
59 
60 		virtual sal_Bool			HandleShortCutKey( const KeyEvent& rKeyEvent );	// returns true, if key was handled
61 
62         using Window::GetChild;
63 };
64 
65 inline Window* BibWindowContainer::GetChild()
66 {
67 	return pChild? pChild->GetWindow() : NULL;
68 }
69 
70 
71 class BibBookContainer: public BibSplitWindow
72 {
73 	private:
74 
75 		::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 			xTopFrameRef;
76 		::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 			xBottomFrameRef;
77 
78 		::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > 				xTopPeerRef;
79 		::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > 				xBottomPeerRef;
80 
81 		BibDataManager*			pDatMan;
82 		BibWindowContainer*		pTopWin;
83 		BibWindowContainer*		pBottomWin;
84 		sal_Bool					bFirstTime;
85 		HdlBibModul				pBibMod;
86 		Timer					aTimer;
87 
88 		DECL_LINK( SplitHdl, Timer*);
89 
90 	protected:
91 
92 		virtual void			Split();
93 
94         virtual long            PreNotify( NotifyEvent& rNEvt );
95 
96 	public:
97 
98 		BibBookContainer(Window* pParent,BibDataManager*, WinBits nStyle = WB_3DLOOK );
99 		~BibBookContainer();
100 
101 		inline BibWindow*		GetTopWin() {return pTopWin;}
102 		inline BibWindow*		GetBottomWin() {return pBottomWin;}
103 
104 		// !BibShortCutHandler is also always a Window!
105 		void					createTopFrame( BibShortCutHandler* pWin );
106 
107 		void					createBottomFrame( BibShortCutHandler* pWin );
108 
109 		virtual void			GetFocus();
110 
111 		virtual sal_Bool		HandleShortCutKey( const KeyEvent& rKeyEvent );	// returns true, if key was handled
112 };
113 
114 #endif
115