1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SFX2_DOCKWIN_HXX
20 #define INCLUDED_SFX2_DOCKWIN_HXX
23 #include <sal/config.h>
24 #include <sal/types.h>
25 #include <vcl/dockwin.hxx>
27 #include <com/sun/star/uno/Reference.hxx>
29 #include <sfx2/dllapi.h>
30 #include <sfx2/childwin.hxx>
32 namespace com::sun::star::frame
{ class XFrame
; }
34 class SfxDockingWindow_Impl
;
36 void SfxDockingWindowFactory( const css::uno::Reference
< css::frame::XFrame
>& rFrame
, std::u16string_view rDockingWindowName
);
37 bool IsDockingWindowVisible( const css::uno::Reference
< css::frame::XFrame
>& rFrame
, std::u16string_view rDockingWindowName
);
39 class SFX2_DLLPUBLIC SfxDockingWindow
: public ResizableDockingWindow
42 std::unique_ptr
<weld::Builder
> m_xBuilder
;
43 std::unique_ptr
<weld::Box
> m_xContainer
;
46 tools::Rectangle aInnerRect
;
47 tools::Rectangle aOuterRect
;
48 SfxBindings
* pBindings
;
51 std::unique_ptr
< SfxDockingWindow_Impl
> pImpl
;
53 SfxDockingWindow(SfxDockingWindow
const &) = delete;
54 SfxDockingWindow
& operator =(SfxDockingWindow
const &) = delete;
57 SfxChildAlignment
CalcAlignment(const Point
& rPos
, tools::Rectangle
& rRect
);
58 virtual Size
CalcDockingSize(SfxChildAlignment
);
59 virtual SfxChildAlignment
60 CheckAlignment(SfxChildAlignment
,SfxChildAlignment
);
62 virtual void Resize() override
;
63 virtual bool PrepareToggleFloatingMode() override
;
64 virtual void ToggleFloatingMode() override
;
65 virtual void StartDocking() override
;
66 virtual bool Docking( const Point
& rPos
, tools::Rectangle
& rRect
) override
;
67 virtual void EndDocking( const tools::Rectangle
& rRect
, bool bFloatMode
) override
;
68 virtual void Resizing( Size
& rSize
) override
;
69 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
70 virtual bool Close() override
;
71 virtual void Move() override
;
73 SAL_DLLPRIVATE SfxChildWindow
* GetChildWindow_Impl() { return pMgr
; }
76 SfxDockingWindow( SfxBindings
*pBindings
,
80 SfxDockingWindow( SfxBindings
*pBindings
,
83 const OUString
& rID
, const OUString
& rUIXMLDescription
);
84 virtual ~SfxDockingWindow() override
;
85 virtual void dispose() override
;
87 void Initialize (SfxChildWinInfo
* pInfo
);
88 virtual void FillInfo(SfxChildWinInfo
&) const;
89 virtual void StateChanged( StateChangedType nStateChange
) override
;
91 void SetDockingRects(const tools::Rectangle
& rOuter
, const tools::Rectangle
& rInner
)
92 { aInnerRect
= rInner
; aOuterRect
= rOuter
; }
93 const tools::Rectangle
& GetInnerRect() const { return aInnerRect
; }
94 const tools::Rectangle
& GetOuterRect() const { return aOuterRect
; }
95 SfxBindings
& GetBindings() const { return *pBindings
; }
96 sal_uInt16
GetType() const { return pMgr
->GetType(); }
97 SfxChildAlignment
GetAlignment() const { return pMgr
->GetAlignment(); }
98 void SetAlignment(SfxChildAlignment eAlign
) { pMgr
->SetAlignment(eAlign
); }
99 const Size
& GetFloatingSize() const { return aFloatSize
; }
100 void SetFloatingSize(const Size
& rSize
) { aFloatSize
=rSize
; }
102 void SetMinOutputSizePixel( const Size
& rSize
);
103 const Size
& GetMinOutputSizePixel() const;
104 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
105 DECL_DLLPRIVATE_LINK(TimerHdl
, Timer
*, void);
107 SAL_DLLPRIVATE
void Initialize_Impl();
108 SAL_DLLPRIVATE
void SetItemSize_Impl( const Size
& rSize
);
109 SAL_DLLPRIVATE
void Disappear_Impl();
110 SAL_DLLPRIVATE
void Reappear_Impl();
111 SAL_DLLPRIVATE
bool IsAutoHide_Impl() const;
112 SAL_DLLPRIVATE
void AutoShow_Impl();
113 SAL_DLLPRIVATE
void ReleaseChildWindow_Impl();
116 class SfxDockingWrapper final
: public SfxChildWindow
119 SfxDockingWrapper( vcl::Window
* pParent
,
121 SfxBindings
* pBindings
,
122 SfxChildWinInfo
* pInfo
);
124 SFX_DECL_CHILDWINDOW(SfxDockingWrapper
);
127 #endif // INCLUDED_SFX2_DOCKWIN_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */