1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ADDRCONT_HXX
25 #define ADDRCONT_HXX
26 
27 #include <com/sun/star/frame/XFrame.hpp>
28 #include <vcl/splitwin.hxx>
29 #include <vcl/timer.hxx>
30 #include "bibshortcuthandler.hxx"
31 
32 #include "bibmod.hxx"
33 
34 #define TOP_WINDOW							1
35 #define BOTTOM_WINDOW						2
36 
37 class BibDataManager;
38 
39 class BibWindowContainer : public BibWindow		//Window
40 {
41 	private:
42 		// !BibShortCutHandler is also always a Window!
43 		BibShortCutHandler*		pChild;
44 
45 	protected:
46 		virtual void			Resize();
47 
48 	public:
49 		BibWindowContainer( Window* pParent, BibShortCutHandler* pChild, WinBits nStyle = WB_3DLOOK);
50 		~BibWindowContainer();
51 
52 		inline Window*			GetChild();
53 
54 		virtual void			GetFocus();
55 
56 		virtual sal_Bool			HandleShortCutKey( const KeyEvent& rKeyEvent );	// returns true, if key was handled
57 
58         using Window::GetChild;
59 };
60 
GetChild()61 inline Window* BibWindowContainer::GetChild()
62 {
63 	return pChild? pChild->GetWindow() : NULL;
64 }
65 
66 
67 class BibBookContainer: public BibSplitWindow
68 {
69 	private:
70 
71 		::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 			xTopFrameRef;
72 		::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > 			xBottomFrameRef;
73 
74 		::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > 				xTopPeerRef;
75 		::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > 				xBottomPeerRef;
76 
77 		BibDataManager*			pDatMan;
78 		BibWindowContainer*		pTopWin;
79 		BibWindowContainer*		pBottomWin;
80 		sal_Bool					bFirstTime;
81 		HdlBibModul				pBibMod;
82 		Timer					aTimer;
83 
84 		DECL_LINK( SplitHdl, Timer*);
85 
86 	protected:
87 
88 		virtual void			Split();
89 
90         virtual long            PreNotify( NotifyEvent& rNEvt );
91 
92 	public:
93 
94 		BibBookContainer(Window* pParent,BibDataManager*, WinBits nStyle = WB_3DLOOK );
95 		~BibBookContainer();
96 
GetTopWin()97 		inline BibWindow*		GetTopWin() {return pTopWin;}
GetBottomWin()98 		inline BibWindow*		GetBottomWin() {return pBottomWin;}
99 
100 		// !BibShortCutHandler is also always a Window!
101 		void					createTopFrame( BibShortCutHandler* pWin );
102 
103 		void					createBottomFrame( BibShortCutHandler* pWin );
104 
105 		virtual void			GetFocus();
106 
107 		virtual sal_Bool		HandleShortCutKey( const KeyEvent& rKeyEvent );	// returns true, if key was handled
108 };
109 
110 #endif
111