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
;
35 enum class SplitWindowItemFlags
;
37 void SfxDockingWindowFactory( const css::uno::Reference
< css::frame::XFrame
>& rFrame
, std::u16string_view rDockingWindowName
);
38 bool IsDockingWindowVisible( const css::uno::Reference
< css::frame::XFrame
>& rFrame
, std::u16string_view rDockingWindowName
);
40 class SFX2_DLLPUBLIC SfxDockingWindow
: public ResizableDockingWindow
43 std::unique_ptr
<weld::Builder
> m_xBuilder
;
44 std::unique_ptr
<weld::Box
> m_xContainer
;
47 tools::Rectangle aInnerRect
;
48 tools::Rectangle aOuterRect
;
49 SfxBindings
* pBindings
;
52 std::unique_ptr
< SfxDockingWindow_Impl
> pImpl
;
54 SfxDockingWindow(SfxDockingWindow
const &) = delete;
55 SfxDockingWindow
& operator =(SfxDockingWindow
const &) = delete;
58 SfxChildAlignment
CalcAlignment(const Point
& rPos
, tools::Rectangle
& rRect
);
59 virtual Size
CalcDockingSize(SfxChildAlignment
);
60 virtual SfxChildAlignment
61 CheckAlignment(SfxChildAlignment
,SfxChildAlignment
);
63 virtual void Resize() override
;
64 virtual bool PrepareToggleFloatingMode() override
;
65 virtual void ToggleFloatingMode() override
;
66 virtual void StartDocking() override
;
67 virtual bool Docking( const Point
& rPos
, tools::Rectangle
& rRect
) override
;
68 virtual void EndDocking( const tools::Rectangle
& rRect
, bool bFloatMode
) override
;
69 virtual void Resizing( Size
& rSize
) override
;
70 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
71 virtual bool Close() override
;
72 virtual void Move() override
;
74 SAL_DLLPRIVATE SfxChildWindow
* GetChildWindow_Impl() { return pMgr
; }
77 SfxDockingWindow( SfxBindings
*pBindings
,
81 SfxDockingWindow( SfxBindings
*pBindings
,
84 const OUString
& rID
, const OUString
& rUIXMLDescription
);
85 virtual ~SfxDockingWindow() override
;
86 virtual void dispose() override
;
88 void Initialize (SfxChildWinInfo
* pInfo
);
89 virtual void FillInfo(SfxChildWinInfo
&) const;
90 virtual void StateChanged( StateChangedType nStateChange
) override
;
92 void SetDockingRects(const tools::Rectangle
& rOuter
, const tools::Rectangle
& rInner
)
93 { aInnerRect
= rInner
; aOuterRect
= rOuter
; }
94 const tools::Rectangle
& GetInnerRect() const { return aInnerRect
; }
95 const tools::Rectangle
& GetOuterRect() const { return aOuterRect
; }
96 SfxBindings
& GetBindings() const { return *pBindings
; }
97 sal_uInt16
GetType() const { return pMgr
->GetType(); }
98 SfxChildAlignment
GetAlignment() const { return pMgr
->GetAlignment(); }
99 void SetAlignment(SfxChildAlignment eAlign
) { pMgr
->SetAlignment(eAlign
); }
100 const Size
& GetFloatingSize() const { return aFloatSize
; }
101 void SetFloatingSize(const Size
& rSize
) { aFloatSize
=rSize
; }
103 void SetMinOutputSizePixel( const Size
& rSize
);
104 const Size
& GetMinOutputSizePixel() const;
105 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
106 DECL_DLLPRIVATE_LINK(TimerHdl
, Timer
*, void);
108 SAL_DLLPRIVATE
void Initialize_Impl();
109 SAL_DLLPRIVATE
void SetItemSize_Impl( const Size
& rSize
);
110 SAL_DLLPRIVATE
void Disappear_Impl();
111 SAL_DLLPRIVATE
void Reappear_Impl();
112 SAL_DLLPRIVATE
bool IsAutoHide_Impl() const;
113 SAL_DLLPRIVATE
void AutoShow_Impl();
114 SAL_DLLPRIVATE
void ReleaseChildWindow_Impl();
117 class SfxDockingWrapper final
: public SfxChildWindow
120 SfxDockingWrapper( vcl::Window
* pParent
,
122 SfxBindings
* pBindings
,
123 SfxChildWinInfo
* pInfo
);
125 SFX_DECL_CHILDWINDOW(SfxDockingWrapper
);
128 #endif // INCLUDED_SFX2_DOCKWIN_HXX
130 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */