Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_SFX2_DOCKWIN_HXX
20 : #define INCLUDED_SFX2_DOCKWIN_HXX
21 :
22 : #include <sal/config.h>
23 : #include <sal/types.h>
24 : #include <vcl/dockwin.hxx>
25 :
26 : #include <com/sun/star/uno/Reference.hxx>
27 : #include <com/sun/star/awt/XWindow.hpp>
28 : #include <com/sun/star/frame/XFrame.hpp>
29 :
30 : #include <sfx2/dllapi.h>
31 : #include <sfx2/childwin.hxx>
32 :
33 : class SfxSplitWindow;
34 : class SfxDockingWindow_Impl;
35 : enum class SplitWindowItemFlags;
36 :
37 : void SFX2_DLLPUBLIC SAL_CALL SfxDockingWindowFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rDockingWindowName );
38 : bool SFX2_DLLPUBLIC SAL_CALL IsDockingWindowVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const OUString& rDockingWindowName );
39 :
40 : class SFX2_DLLPUBLIC SfxDockingWindow : public DockingWindow
41 : {
42 : private:
43 : Rectangle aInnerRect;
44 : Rectangle aOuterRect;
45 : SfxBindings* pBindings;
46 : Size aFloatSize;
47 : SfxChildWindow* pMgr;
48 : SfxDockingWindow_Impl* pImp;
49 :
50 : SfxDockingWindow(SfxDockingWindow &) SAL_DELETED_FUNCTION;
51 : void operator =(SfxDockingWindow &) SAL_DELETED_FUNCTION;
52 :
53 : protected:
54 : SfxChildAlignment CalcAlignment(const Point& rPos, Rectangle& rRect );
55 : void CalcSplitPosition(const Point rPos, Rectangle& rRect,
56 : SfxChildAlignment eAlign);
57 : virtual Size CalcDockingSize(SfxChildAlignment);
58 : virtual SfxChildAlignment
59 : CheckAlignment(SfxChildAlignment,SfxChildAlignment);
60 :
61 : virtual void Resize() SAL_OVERRIDE;
62 : virtual bool PrepareToggleFloatingMode() SAL_OVERRIDE;
63 : virtual void ToggleFloatingMode() SAL_OVERRIDE;
64 : virtual void StartDocking() SAL_OVERRIDE;
65 : virtual bool Docking( const Point& rPos, Rectangle& rRect ) SAL_OVERRIDE;
66 : virtual void EndDocking( const Rectangle& rRect, bool bFloatMode ) SAL_OVERRIDE;
67 : virtual void Resizing( Size& rSize ) SAL_OVERRIDE;
68 : virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
69 : virtual bool Close() SAL_OVERRIDE;
70 : virtual void Move() SAL_OVERRIDE;
71 :
72 0 : SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl() { return pMgr; }
73 :
74 : public:
75 : SfxDockingWindow( SfxBindings *pBindings,
76 : SfxChildWindow *pCW,
77 : vcl::Window* pParent,
78 : WinBits nWinBits=0);
79 : SfxDockingWindow( SfxBindings *pBindings,
80 : SfxChildWindow *pCW,
81 : vcl::Window* pParent,
82 : const ResId& rResId);
83 : SfxDockingWindow( SfxBindings *pBindings,
84 : SfxChildWindow *pCW,
85 : vcl::Window* pParent,
86 : const OString& rID, const OUString& rUIXMLDescription );
87 : virtual ~SfxDockingWindow();
88 : virtual void dispose() SAL_OVERRIDE;
89 :
90 : void Initialize (SfxChildWinInfo* pInfo);
91 : virtual void FillInfo(SfxChildWinInfo&) const;
92 : virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
93 :
94 0 : void SetDockingRects(const Rectangle& rOuter, const Rectangle& rInner)
95 0 : { aInnerRect = rInner; aOuterRect = rOuter; }
96 0 : const Rectangle& GetInnerRect() const { return aInnerRect; }
97 0 : const Rectangle& GetOuterRect() const { return aOuterRect; }
98 5279 : SfxBindings& GetBindings() const { return *pBindings; }
99 30641 : sal_uInt16 GetType() const { return pMgr->GetType(); }
100 29401 : SfxChildAlignment GetAlignment() const { return pMgr->GetAlignment(); }
101 3149 : void SetAlignment(SfxChildAlignment eAlign) { pMgr->SetAlignment(eAlign); }
102 3264 : Size GetFloatingSize() const { return aFloatSize; }
103 3264 : void SetFloatingSize(const Size& rSize) { aFloatSize=rSize; }
104 :
105 : void SetMinOutputSizePixel( const Size& rSize );
106 : Size GetMinOutputSizePixel() const;
107 : virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
108 : DECL_LINK_TYPED(TimerHdl, Idle *, void);
109 :
110 : SAL_DLLPRIVATE void Initialize_Impl();
111 : SAL_DLLPRIVATE SplitWindowItemFlags GetWinBits_Impl() const;
112 : SAL_DLLPRIVATE void SetItemSize_Impl( const Size& rSize );
113 : SAL_DLLPRIVATE void Disappear_Impl();
114 : SAL_DLLPRIVATE void Reappear_Impl();
115 : SAL_DLLPRIVATE bool IsAutoHide_Impl() const;
116 : SAL_DLLPRIVATE void AutoShow_Impl( bool bShow = true );
117 : SAL_DLLPRIVATE void ReleaseChildWindow_Impl();
118 : };
119 :
120 0 : class SfxDockingWrapper : public SfxChildWindow
121 : {
122 : public:
123 : SfxDockingWrapper( vcl::Window* pParent ,
124 : sal_uInt16 nId ,
125 : SfxBindings* pBindings ,
126 : SfxChildWinInfo* pInfo );
127 :
128 : SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
129 : };
130 :
131 : #endif // INCLUDED_SFX2_DOCKWIN_HXX
132 :
133 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|