Coverage Report

Created: 2025-12-08 09:28

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/include/sfx2/dockwin.hxx
Line
Count
Source
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 <memory>
23
#include <sal/config.h>
24
#include <sal/types.h>
25
#include <vcl/dockwin.hxx>
26
27
#include <com/sun/star/uno/Reference.hxx>
28
29
#include <sfx2/dllapi.h>
30
#include <sfx2/childwin.hxx>
31
32
namespace com::sun::star::frame { class XFrame; }
33
34
class SfxDockingWindow_Impl;
35
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 );
38
39
class SFX2_DLLPUBLIC SfxDockingWindow : public ResizableDockingWindow
40
{
41
protected:
42
    std::unique_ptr<weld::Builder> m_xBuilder;
43
    std::unique_ptr<weld::Box> m_xContainer;
44
45
private:
46
    tools::Rectangle               aInnerRect;
47
    tools::Rectangle               aOuterRect;
48
    SfxBindings*            pBindings;
49
    Size                    aFloatSize;
50
    SfxChildWindow*         pMgr;
51
    std::unique_ptr< SfxDockingWindow_Impl >  pImpl;
52
53
    SfxDockingWindow(SfxDockingWindow const &) = delete;
54
    SfxDockingWindow& operator =(SfxDockingWindow const &) = delete;
55
56
protected:
57
    SfxChildAlignment   CalcAlignment(const Point& rPos, tools::Rectangle& rRect );
58
    virtual Size        CalcDockingSize(SfxChildAlignment);
59
    virtual SfxChildAlignment
60
                        CheckAlignment(SfxChildAlignment,SfxChildAlignment);
61
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;
72
73
0
    SAL_DLLPRIVATE SfxChildWindow* GetChildWindow_Impl()    { return pMgr; }
74
75
public:
76
                        SfxDockingWindow( SfxBindings *pBindings,
77
                                          SfxChildWindow *pCW,
78
                                          vcl::Window* pParent,
79
                                          WinBits nWinBits);
80
                        SfxDockingWindow( SfxBindings *pBindings,
81
                                          SfxChildWindow *pCW,
82
                                          vcl::Window* pParent,
83
                                          const OUString& rID, const OUString& rUIXMLDescription );
84
                        virtual ~SfxDockingWindow() override;
85
    virtual void        dispose() override;
86
87
    void                Initialize (SfxChildWinInfo* pInfo);
88
    virtual void        FillInfo(SfxChildWinInfo&) const;
89
    virtual void        StateChanged( StateChangedType nStateChange ) override;
90
91
    void                SetDockingRects(const tools::Rectangle& rOuter, const tools::Rectangle& rInner)
92
0
                            { aInnerRect = rInner; aOuterRect = rOuter; }
93
0
    const tools::Rectangle&    GetInnerRect() const                    { return aInnerRect; }
94
0
    const tools::Rectangle&    GetOuterRect() const                    { return aOuterRect; }
95
0
    SfxBindings&        GetBindings() const                     { return *pBindings; }
96
0
    sal_uInt16          GetType() const                         { return pMgr->GetType(); }
97
0
    SfxChildAlignment   GetAlignment() const                    { return pMgr->GetAlignment(); }
98
0
    void                SetAlignment(SfxChildAlignment eAlign)  { pMgr->SetAlignment(eAlign); }
99
0
    const Size&         GetFloatingSize() const                 { return aFloatSize; }
100
0
    void                SetFloatingSize(const Size& rSize)      { aFloatSize=rSize; }
101
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);
106
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();
114
};
115
116
class SfxDockingWrapper final : public SfxChildWindow
117
{
118
    public:
119
        SfxDockingWrapper( vcl::Window* pParent ,
120
                           sal_uInt16 nId ,
121
                           SfxBindings* pBindings ,
122
                           SfxChildWinInfo* pInfo );
123
124
        SFX_DECL_CHILDWINDOW(SfxDockingWrapper);
125
};
126
127
#endif // INCLUDED_SFX2_DOCKWIN_HXX
128
129
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */