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