xref: /aoo42x/main/sfx2/inc/sfx2/dockwin.hxx (revision cdf0e10c)
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 #ifndef _SFXDOCKWIN_HXX
28 #define _SFXDOCKWIN_HXX
29 
30 #include "sal/config.h"
31 #include "sal/types.h"
32 #include <vcl/dockwin.hxx>
33 
34 #include <com/sun/star/uno/Reference.hxx>
35 #include <com/sun/star/awt/XWindow.hpp>
36 #include <com/sun/star/frame/XFrame.hpp>
37 
38 #include "sfx2/dllapi.h"
39 #include <sfx2/childwin.hxx>
40 
41 class SfxSplitWindow;
42 class SfxDockingWindow_Impl;
43 
44 void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
45 bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& rDockingWindowName );
46 
47 class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
48 {
49 private:
50 	Rectangle               aInnerRect;
51 	Rectangle               aOuterRect;
52 	SfxBindings*            pBindings;
53 	Size                    aFloatSize;
54 	SfxChildWindow*         pMgr;
55 	SfxDockingWindow_Impl*  pImp;
56 
57     SAL_DLLPRIVATE SfxDockingWindow(SfxDockingWindow &); // not defined
58     SAL_DLLPRIVATE void operator =(SfxDockingWindow &); // not defined
59 
60 protected:
61 	SfxChildAlignment   CalcAlignment(const Point& rPos, Rectangle& rRect );
62 	void                CalcSplitPosition(const Point rPos, Rectangle& rRect,
63 							SfxChildAlignment eAlign);
64 	virtual Size        CalcDockingSize(SfxChildAlignment);
65 	virtual SfxChildAlignment
66 						CheckAlignment(SfxChildAlignment,SfxChildAlignment);
67 
68 	virtual void        Resize();
69 	virtual sal_Bool        PrepareToggleFloatingMode();
70 	virtual void        ToggleFloatingMode();
71 	virtual void        StartDocking();
72 	virtual sal_Bool        Docking( const Point& rPos, Rectangle& rRect );
73 	virtual void        EndDocking( const Rectangle& rRect, sal_Bool bFloatMode );
74 	virtual void        Resizing( Size& rSize );
75 	virtual void        Paint( const Rectangle& rRect );
76 	virtual sal_Bool        Close();
77     virtual void        Move();
78 
79 //#if 0 // _SOLAR__PRIVATE
80 	SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl()	{ return pMgr; }
81 //#endif
82 
83 public:
84 						SfxDockingWindow( SfxBindings *pBindings,
85 										  SfxChildWindow *pCW,
86 										  Window* pParent,
87 										  WinBits nWinBits=0);
88 						SfxDockingWindow( SfxBindings *pBindings,
89 										  SfxChildWindow *pCW,
90 										  Window* pParent,
91 										  const ResId& rResId);
92 						~SfxDockingWindow();
93 
94 	void                Initialize (SfxChildWinInfo* pInfo);
95 	virtual void        FillInfo(SfxChildWinInfo&) const;
96 	virtual void		StateChanged( StateChangedType nStateChange );
97 
98 	void                SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
99 							{ aInnerRect = rInner; aOuterRect = rOuter; }
100 	const Rectangle&    GetInnerRect() const					{ return aInnerRect; }
101 	const Rectangle&    GetOuterRect() const					{ return aOuterRect; }
102 	SfxBindings&        GetBindings() const						{ return *pBindings; }
103 	sal_uInt16              GetType() const							{ return pMgr->GetType(); }
104 	SfxChildAlignment   GetAlignment() const					{ return pMgr->GetAlignment(); }
105 	void                SetAlignment(SfxChildAlignment eAlign)	{ pMgr->SetAlignment(eAlign); }
106 	Size                GetFloatingSize() const					{ return aFloatSize; }
107 	void                SetFloatingSize(const Size& rSize)		{ aFloatSize=rSize; }
108 
109 	void                SetMinOutputSizePixel( const Size& rSize );
110 	Size                GetMinOutputSizePixel() const;
111 	virtual long		Notify( NotifyEvent& rNEvt );
112 	virtual void        FadeIn( sal_Bool );
113     void                AutoShow( sal_Bool bShow = sal_True );
114 	DECL_LINK( TimerHdl, Timer* );
115 
116 //#if 0 // _SOLAR__PRIVATE
117 	SAL_DLLPRIVATE void Initialize_Impl();
118 	SAL_DLLPRIVATE sal_uInt16 GetWinBits_Impl() const;
119 	SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
120 	SAL_DLLPRIVATE void Disappear_Impl();
121 	SAL_DLLPRIVATE void Reappear_Impl();
122 	SAL_DLLPRIVATE sal_Bool IsAutoHide_Impl() const;
123 	SAL_DLLPRIVATE sal_Bool IsPinned_Impl() const;
124 	SAL_DLLPRIVATE void AutoShow_Impl( sal_Bool bShow = sal_True );
125 	SAL_DLLPRIVATE void Pin_Impl( sal_Bool bPinned );
126 	SAL_DLLPRIVATE SfxSplitWindow* GetSplitWindow_Impl() const;
127     SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
128 //#endif
129 };
130 
131 class SfxDockingWrapper : public SfxChildWindow
132 {
133 	public:
134 		SfxDockingWrapper( Window* pParent ,
135 						   sal_uInt16 nId ,
136 						   SfxBindings* pBindings ,
137 						   SfxChildWinInfo* pInfo );
138 
139 		SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
140 };
141 
142 #endif // #ifndef _SFXDOCKWIN_HXX
143