Coverage Report

Created: 2026-02-14 09:37

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/window/dockmgr.cxx
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
20
#include <tools/time.hxx>
21
#include <sal/log.hxx>
22
#include <o3tl/deleter.hxx>
23
24
#include <brdwin.hxx>
25
#include <svdata.hxx>
26
#include <window.h>
27
28
#include <comphelper/OAccessible.hxx>
29
30
#include <vcl/event.hxx>
31
#include <vcl/toolkit/floatwin.hxx>
32
#include <vcl/dockwin.hxx>
33
#include <vcl/toolbox.hxx>
34
#include <vcl/svapp.hxx>
35
#include <vcl/timer.hxx>
36
#include <vcl/settings.hxx>
37
38
#include "impldockingwrapper.hxx"
39
40
0
#define DOCKWIN_FLOATSTYLES         (WB_SIZEABLE | WB_MOVEABLE | WB_CLOSEABLE | WB_STANDALONE)
41
42
namespace {
43
44
class ImplDockFloatWin2 : public FloatingWindow
45
{
46
private:
47
    ImplDockingWindowWrapper*  mpDockWin;
48
    sal_uInt64      mnLastTicks;
49
    Timer           m_aDockTimer;
50
    Timer           m_aEndDockTimer;
51
    Point           maDockPos;
52
    tools::Rectangle       maDockRect;
53
    bool            mbInMove;
54
    ImplSVEvent *   mnLastUserEvent;
55
56
    DECL_LINK(DockingHdl, void *, void);
57
    DECL_LINK(DockTimerHdl, Timer *, void);
58
    DECL_LINK(EndDockTimerHdl, Timer *, void);
59
public:
60
    ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
61
                      ImplDockingWindowWrapper* pDockingWin );
62
    virtual ~ImplDockFloatWin2() override;
63
    virtual void dispose() override;
64
65
    virtual void    Move() override;
66
    virtual void    Resize() override;
67
    virtual void    TitleButtonClick( TitleButton nButton ) override;
68
    virtual void    Resizing( Size& rSize ) override;
69
    virtual bool    Close() override;
70
};
71
72
}
73
74
ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits,
75
                                    ImplDockingWindowWrapper* pDockingWin ) :
76
0
        FloatingWindow( pParent, nWinBits ),
77
0
        mpDockWin( pDockingWin ),
78
0
        mnLastTicks( tools::Time::GetSystemTicks() ),
79
0
        m_aDockTimer("vcl::ImplDockFloatWin2 m_aDockTimer"),
80
0
        m_aEndDockTimer( "vcl::ImplDockFloatWin2 m_aEndDockTimer" ),
81
0
        mbInMove( false ),
82
0
        mnLastUserEvent( nullptr )
83
0
{
84
    // copy state of DockingWindow
85
0
    if ( pDockingWin )
86
0
    {
87
0
        GetOutDev()->SetSettings( pDockingWin->GetWindow()->GetSettings() );
88
0
        Enable( pDockingWin->GetWindow()->IsEnabled(), false );
89
0
        EnableInput( pDockingWin->GetWindow()->IsInputEnabled(), false );
90
0
        AlwaysEnableInput( pDockingWin->GetWindow()->IsAlwaysEnableInput(), false );
91
0
        EnableAlwaysOnTop( pDockingWin->GetWindow()->IsAlwaysOnTopEnabled() );
92
0
        SetActivateMode( pDockingWin->GetWindow()->GetActivateMode() );
93
0
    }
94
95
0
    SetBackground( GetSettings().GetStyleSettings().GetFaceColor() );
96
97
0
    m_aDockTimer.SetInvokeHandler( LINK( this, ImplDockFloatWin2, DockTimerHdl ) );
98
0
    m_aDockTimer.SetPriority( TaskPriority::HIGH_IDLE );
99
0
    m_aDockTimer.SetTimeout( 50 );
100
101
0
    m_aEndDockTimer.SetInvokeHandler( LINK( this, ImplDockFloatWin2, EndDockTimerHdl ) );
102
0
    m_aEndDockTimer.SetPriority( TaskPriority::HIGH_IDLE );
103
0
    m_aEndDockTimer.SetTimeout( 50 );
104
0
}
105
106
ImplDockFloatWin2::~ImplDockFloatWin2()
107
0
{
108
0
    disposeOnce();
109
0
}
110
111
void ImplDockFloatWin2::dispose()
112
0
{
113
0
    if( mnLastUserEvent )
114
0
        Application::RemoveUserEvent( mnLastUserEvent );
115
0
    FloatingWindow::dispose();
116
0
}
117
118
IMPL_LINK_NOARG(ImplDockFloatWin2, DockTimerHdl, Timer *, void)
119
0
{
120
0
    SAL_WARN_IF( !mpDockWin->IsFloatingMode(), "vcl", "docktimer called but not floating" );
121
122
0
    PointerState aState = GetPointerState();
123
124
0
    if( aState.mnState & KEY_MOD1 )
125
0
    {
126
        // i43499 CTRL disables docking now
127
0
        mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
128
0
        if( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) )
129
0
            m_aDockTimer.Start();
130
0
    }
131
0
    else if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) )
132
0
    {
133
0
        mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
134
0
        mpDockWin->EndDocking( maDockRect, false );
135
0
    }
136
0
    else
137
0
    {
138
0
        mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, ShowTrackFlags::Big | ShowTrackFlags::TrackWindow );
139
0
        m_aDockTimer.Start();
140
0
    }
141
0
}
142
143
IMPL_LINK_NOARG(ImplDockFloatWin2, EndDockTimerHdl, Timer *, void)
144
0
{
145
0
    SAL_WARN_IF( !mpDockWin->IsFloatingMode(), "vcl", "enddocktimer called but not floating" );
146
147
0
    PointerState aState = GetPointerState();
148
0
    if( ! ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) )
149
0
    {
150
0
        mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
151
0
        mpDockWin->EndDocking( maDockRect, true );
152
0
    }
153
0
    else
154
0
        m_aEndDockTimer.Start();
155
0
}
156
157
IMPL_LINK_NOARG(ImplDockFloatWin2, DockingHdl, void*, void)
158
0
{
159
    // called during move of a floating window
160
0
    mnLastUserEvent = nullptr;
161
162
0
    vcl::Window *pDockingArea = mpDockWin->GetWindow()->GetParent();
163
0
    PointerState aState = pDockingArea->GetPointerState();
164
165
0
    bool bRealMove = true;
166
0
    if( GetStyle() & WB_OWNERDRAWDECORATION )
167
0
    {
168
        // for windows with ownerdraw decoration
169
        // we allow docking only when the window was moved
170
        // by dragging its caption
171
        // and ignore move request due to resizing
172
0
        vcl::Window *pBorder = GetWindow( GetWindowType::Border );
173
0
        if( pBorder != this )
174
0
        {
175
0
            tools::Rectangle aBorderRect( Point(), pBorder->GetSizePixel() );
176
0
            sal_Int32 nLeft, nTop, nRight, nBottom;
177
0
            GetBorder( nLeft, nTop, nRight, nBottom );
178
            // limit borderrect to the caption part only and without the resizing borders
179
0
            aBorderRect.SetBottom( aBorderRect.Top() + nTop );
180
0
            aBorderRect.AdjustLeft(nLeft );
181
0
            aBorderRect.AdjustRight( -nRight );
182
183
0
            PointerState aBorderState = pBorder->GetPointerState();
184
0
            bRealMove = aBorderRect.Contains( aBorderState.maPos );
185
0
        }
186
0
    }
187
188
0
    if( mpDockWin->GetWindow()->IsVisible() &&
189
0
        (tools::Time::GetSystemTicks() - mnLastTicks > 500) &&
190
0
        ( aState.mnState & ( MOUSE_LEFT | MOUSE_MIDDLE | MOUSE_RIGHT ) ) &&
191
0
        !(aState.mnState & KEY_MOD1) && // i43499 CTRL disables docking now
192
0
        bRealMove )
193
0
    {
194
0
        maDockPos = pDockingArea->OutputToScreenPixel( pDockingArea->AbsoluteScreenToOutputPixel( OutputToAbsoluteScreenPixel( Point() ) ) );
195
0
        maDockRect = tools::Rectangle( maDockPos, mpDockWin->GetSizePixel() );
196
197
        // mouse pos in screen pixels
198
0
        Point aMousePos = pDockingArea->OutputToScreenPixel( aState.maPos );
199
200
0
        if( ! mpDockWin->IsDocking() )
201
0
            mpDockWin->StartDocking( aMousePos, maDockRect );
202
203
0
        bool bFloatMode = mpDockWin->Docking( aMousePos, maDockRect );
204
205
0
        if( ! bFloatMode )
206
0
        {
207
            // indicates that the window could be docked at maDockRect
208
0
            maDockRect.SetPos( mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ScreenToOutputPixel(
209
0
                 maDockRect.TopLeft() ) );
210
0
            mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->ShowTracking( maDockRect, ShowTrackFlags::Big | ShowTrackFlags::TrackWindow );
211
0
            m_aEndDockTimer.Stop();
212
0
            m_aDockTimer.Invoke();
213
0
        }
214
0
        else
215
0
        {
216
0
            mpDockWin->GetWindow()->GetParent()->ImplGetFrameWindow()->HideTracking();
217
0
            m_aDockTimer.Stop();
218
0
            m_aEndDockTimer.Invoke();
219
0
        }
220
0
    }
221
0
    mbInMove = false;
222
0
}
223
224
void ImplDockFloatWin2::Move()
225
0
{
226
0
    if( mbInMove )
227
0
        return;
228
229
0
    mbInMove = true;
230
0
    FloatingWindow::Move();
231
0
    mpDockWin->GetWindow()->Move();
232
233
    /*
234
     *  note: the window should only dock if KEY_MOD1 is pressed
235
     *  and the user releases all mouse buttons. The real problem here
236
     *  is that we don't get mouse events (at least not on X)
237
     *  if the mouse is on the decoration. So we have to start an
238
     *  awkward timer based process that polls the modifier/buttons
239
     *  to see whether they are in the right condition shortly after the
240
     *  last Move message.
241
     */
242
0
    if( ! mnLastUserEvent )
243
0
        mnLastUserEvent = Application::PostUserEvent( LINK( this, ImplDockFloatWin2, DockingHdl ), nullptr, true );
244
0
}
245
246
void ImplDockFloatWin2::Resize()
247
0
{
248
    // forwarding of resize only required if we have no borderwindow ( GetWindow() then returns 'this' )
249
0
    if( GetWindow( GetWindowType::Border ) == this )
250
0
    {
251
0
        FloatingWindow::Resize();
252
0
        Size aSize( GetSizePixel() );
253
0
        mpDockWin->GetWindow()->ImplPosSizeWindow( 0, 0, aSize.Width(), aSize.Height(), PosSizeFlags::PosSize ); // TODO: is this needed ???
254
0
    }
255
0
}
256
257
void ImplDockFloatWin2::TitleButtonClick( TitleButton nButton )
258
0
{
259
0
    FloatingWindow::TitleButtonClick( nButton );
260
0
    mpDockWin->TitleButtonClick( nButton );
261
0
}
262
263
void ImplDockFloatWin2::Resizing( Size& rSize )
264
0
{
265
0
    FloatingWindow::Resizing( rSize );
266
0
    mpDockWin->Resizing( rSize );
267
0
}
268
269
bool ImplDockFloatWin2::Close()
270
0
{
271
0
    return true;
272
0
}
273
274
DockingManager::DockingManager()
275
2
{
276
2
}
277
278
DockingManager::~DockingManager()
279
2
{
280
2
}
281
282
ImplDockingWindowWrapper* DockingManager::GetDockingWindowWrapper( const vcl::Window *pWindow )
283
78.8k
{
284
78.8k
    for( const auto& xWrapper : mvDockingWindows )
285
0
    {
286
0
        if (xWrapper && xWrapper->mpDockingWindow == pWindow)
287
0
            return xWrapper.get();
288
0
    }
289
78.8k
    return nullptr;
290
78.8k
}
291
292
bool DockingManager::IsDockable( const vcl::Window *pWindow )
293
26.2k
{
294
26.2k
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
295
296
    /*
297
    if( pWindow->HasDockingHandler() )
298
        return true;
299
    */
300
26.2k
    return (pWrapper != nullptr);
301
26.2k
}
302
303
bool DockingManager::IsFloating( const vcl::Window *pWindow )
304
0
{
305
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
306
0
    if( pWrapper )
307
0
        return pWrapper->IsFloatingMode();
308
0
    else
309
0
        return false;
310
0
}
311
312
bool DockingManager::IsLocked( const vcl::Window *pWindow )
313
0
{
314
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
315
0
    return pWrapper && pWrapper->IsLocked();
316
0
}
317
318
void DockingManager::Lock( const vcl::Window *pWindow )
319
0
{
320
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
321
0
    if( pWrapper )
322
0
        pWrapper->Lock();
323
0
}
324
325
void DockingManager::Unlock( const vcl::Window *pWindow )
326
0
{
327
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
328
0
    if( pWrapper )
329
0
        pWrapper->Unlock();
330
0
}
331
332
void DockingManager::SetFloatingMode( const vcl::Window *pWindow, bool bFloating )
333
0
{
334
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
335
0
    if( pWrapper )
336
0
        pWrapper->SetFloatingMode( bFloating );
337
0
}
338
339
void DockingManager::StartPopupMode( const vcl::Window *pWindow, const tools::Rectangle& rRect, FloatWinPopupFlags nFlags )
340
0
{
341
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
342
0
    if( pWrapper )
343
0
        pWrapper->StartPopupMode( rRect, nFlags );
344
0
}
345
346
void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWindow, FloatWinPopupFlags nFlags )
347
0
{
348
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
349
0
    if( pWrapper )
350
0
        pWrapper->StartPopupMode( pParentToolBox, nFlags );
351
0
}
352
353
void DockingManager::StartPopupMode( ToolBox *pParentToolBox, const vcl::Window *pWindow )
354
0
{
355
0
    StartPopupMode( pParentToolBox, pWindow, FloatWinPopupFlags::AllowTearOff         |
356
0
                    FloatWinPopupFlags::AllMouseButtonClose  |
357
0
                    FloatWinPopupFlags::NoMouseUpClose );
358
0
}
359
360
bool DockingManager::IsInPopupMode( const vcl::Window *pWindow )
361
0
{
362
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
363
0
    return pWrapper && pWrapper->IsInPopupMode();
364
0
}
365
366
void DockingManager::EndPopupMode( const vcl::Window *pWin )
367
0
{
368
0
    ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin );
369
0
    if( pWrapper && pWrapper->GetFloatingWindow() && static_cast<FloatingWindow*>(pWrapper->GetFloatingWindow())->IsInPopupMode() )
370
0
        static_cast<FloatingWindow*>(pWrapper->GetFloatingWindow())->EndPopupMode();
371
0
}
372
373
SystemWindow* DockingManager::GetFloatingWindow(const vcl::Window *pWin)
374
0
{
375
0
    ImplDockingWindowWrapper *pWrapper = GetDockingWindowWrapper( pWin );
376
0
    if (pWrapper)
377
0
        return pWrapper->GetFloatingWindow();
378
0
    return nullptr;
379
0
}
380
381
void DockingManager::SetPopupModeEndHdl( const vcl::Window *pWindow, const Link<FloatingWindow*,void>& rLink )
382
0
{
383
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
384
0
    if( pWrapper )
385
0
        pWrapper->SetPopupModeEndHdl(rLink);
386
0
}
387
388
void DockingManager::AddWindow( const vcl::Window *pWindow )
389
0
{
390
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
391
0
    if( pWrapper )
392
0
        return;
393
0
    mvDockingWindows.emplace_back( new ImplDockingWindowWrapper( pWindow ) );
394
0
}
395
396
void DockingManager::RemoveWindow( const vcl::Window *pWindow )
397
82.1k
{
398
82.1k
    for( auto it = mvDockingWindows.begin(); it != mvDockingWindows.end(); ++it )
399
0
    {
400
0
        const auto& xWrapper = *it;
401
0
        if (xWrapper && xWrapper->mpDockingWindow == pWindow)
402
0
        {
403
            // deleting wrappers calls set of actions which may want to use
404
            // wrapper we want to delete - avoid crash using temporary owner
405
            // while erasing
406
0
            auto pTemporaryOwner = std::move(*it);
407
0
            mvDockingWindows.erase( it );
408
0
            break;
409
0
        }
410
0
    }
411
82.1k
}
412
413
void DockingManager::SetPosSizePixel( vcl::Window const *pWindow, tools::Long nX, tools::Long nY,
414
                                    tools::Long nWidth, tools::Long nHeight,
415
                                    PosSizeFlags nFlags )
416
0
{
417
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
418
0
    if( pWrapper )
419
0
        pWrapper->setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
420
0
}
421
422
tools::Rectangle DockingManager::GetPosSizePixel( const vcl::Window *pWindow )
423
0
{
424
0
    tools::Rectangle aRect;
425
0
    ImplDockingWindowWrapper* pWrapper = GetDockingWindowWrapper( pWindow );
426
0
    if( pWrapper )
427
0
        aRect = tools::Rectangle( pWrapper->GetPosPixel(), pWrapper->GetSizePixel() );
428
429
0
    return aRect;
430
0
}
431
432
class ImplPopupFloatWin : public FloatingWindow
433
{
434
private:
435
    bool mbToolBox;
436
437
public:
438
    ImplPopupFloatWin( vcl::Window* pParent, bool bToolBox );
439
    virtual ~ImplPopupFloatWin() override;
440
    virtual rtl::Reference<comphelper::OAccessible> CreateAccessible() override;
441
};
442
443
ImplPopupFloatWin::ImplPopupFloatWin( vcl::Window* pParent, bool bToolBox ) :
444
0
    FloatingWindow( pParent, bToolBox ? WB_BORDER | WB_POPUP | WB_SYSTEMWINDOW | WB_NOSHADOW : WB_STDPOPUP ),
445
0
    mbToolBox( bToolBox )
446
0
{
447
0
}
Unexecuted instantiation: ImplPopupFloatWin::ImplPopupFloatWin(vcl::Window*, bool)
Unexecuted instantiation: ImplPopupFloatWin::ImplPopupFloatWin(vcl::Window*, bool)
448
449
ImplPopupFloatWin::~ImplPopupFloatWin()
450
0
{
451
0
    disposeOnce();
452
0
}
453
454
rtl::Reference<comphelper::OAccessible> ImplPopupFloatWin::CreateAccessible()
455
0
{
456
0
    if ( !mbToolBox )
457
0
        return FloatingWindow::CreateAccessible();
458
459
    // switch off direct accessibility support for this window
460
461
    // this is to avoid appearance of this window as standalone window in the accessibility hierarchy
462
    // as this window is only used as a helper for subtoolbars that are not teared-off, the parent toolbar
463
    // has to provide accessibility support (as implemented in the toolkit)
464
    // so the contained toolbar should appear as child of the corresponding toolbar item of the parent toolbar
465
0
    return {};
466
0
}
467
468
ImplDockingWindowWrapper::ImplDockingWindowWrapper( const vcl::Window *pWindow )
469
0
    : mpDockingWindow(const_cast<vcl::Window*>(pWindow))
470
0
    , mpFloatWin(nullptr)
471
0
    , mpOldBorderWin(nullptr)
472
0
    , mpParent(pWindow->GetParent())
473
0
    , maMaxOutSize( SHRT_MAX, SHRT_MAX )
474
0
    , mnTrackX(0)
475
0
    , mnTrackY(0)
476
0
    , mnTrackWidth(0)
477
0
    , mnTrackHeight(0)
478
0
    , mnDockLeft(0)
479
0
    , mnDockTop(0)
480
0
    , mnDockRight(0)
481
0
    , mnDockBottom(0)
482
0
    , mnFloatBits(WB_BORDER | WB_CLOSEABLE | WB_SIZEABLE | (pWindow->GetStyle() & DOCKWIN_FLOATSTYLES))
483
0
    , mbDockCanceled(false)
484
0
    , mbDocking(false)
485
0
    , mbLastFloatMode(false)
486
0
    , mbDockBtn(false)
487
0
    , mbHideBtn(false)
488
    // must be enabled in Window::Notify to prevent permanent docking during mouse move
489
0
    , mbStartDockingEnabled(false)
490
0
    , mbLocked(false)
491
0
{
492
0
    assert(mpDockingWindow);
493
0
    DockingWindow *pDockWin = dynamic_cast< DockingWindow* > ( mpDockingWindow.get() );
494
0
    if( pDockWin )
495
0
        mnFloatBits = pDockWin->GetFloatStyle();
496
0
}
497
498
ImplDockingWindowWrapper::~ImplDockingWindowWrapper()
499
0
{
500
0
    if ( IsFloatingMode() )
501
0
    {
502
0
        GetWindow()->Show( false, ShowFlags::NoFocusChange );
503
0
        SetFloatingMode(false);
504
0
    }
505
0
}
506
507
void ImplDockingWindowWrapper::ImplStartDocking( const Point& rPos )
508
0
{
509
0
    if( !mbStartDockingEnabled )
510
0
        return;
511
512
0
    maMouseOff      = rPos;
513
0
    mbDocking       = true;
514
0
    mbLastFloatMode = IsFloatingMode();
515
516
    // calculate FloatingBorder
517
0
    VclPtr<FloatingWindow> pWin;
518
0
    if ( mpFloatWin )
519
0
        pWin = mpFloatWin;
520
0
    else
521
0
        pWin = VclPtr<ImplDockFloatWin2>::Create( mpParent, mnFloatBits, nullptr );
522
0
    pWin->GetBorder( mnDockLeft, mnDockTop, mnDockRight, mnDockBottom );
523
0
    if ( !mpFloatWin )
524
0
        pWin.disposeAndClear();
525
526
0
    Point   aPos    = GetWindow()->OutputToScreenPixel( Point() );
527
0
    Size    aSize   = GetWindow()->GetOutputSizePixel();
528
0
    mnTrackX        = aPos.X();
529
0
    mnTrackY        = aPos.Y();
530
0
    mnTrackWidth    = aSize.Width();
531
0
    mnTrackHeight   = aSize.Height();
532
533
0
    if ( mbLastFloatMode )
534
0
    {
535
0
        maMouseOff.AdjustX(mnDockLeft );
536
0
        maMouseOff.AdjustY(mnDockTop );
537
0
        mnTrackX        -= mnDockLeft;
538
0
        mnTrackY        -= mnDockTop;
539
0
        mnTrackWidth    += mnDockLeft+mnDockRight;
540
0
        mnTrackHeight   += mnDockTop+mnDockBottom;
541
0
    }
542
543
0
    vcl::Window *pDockingArea = GetWindow()->GetParent();
544
0
    vcl::Window::PointerState aState = pDockingArea->GetPointerState();
545
546
    // mouse pos in screen pixels
547
0
    Point aMousePos = pDockingArea->OutputToScreenPixel( aState.maPos );
548
0
    Point aDockPos = pDockingArea->AbsoluteScreenToOutputPixel( GetWindow()->OutputToAbsoluteScreenPixel( GetWindow()->GetPosPixel() ) );
549
0
    tools::Rectangle aDockRect( aDockPos, GetWindow()->GetSizePixel() );
550
0
    StartDocking( aMousePos, aDockRect );
551
552
0
    GetWindow()->ImplUpdateAll();
553
0
    GetWindow()->ImplGetFrameWindow()->ImplUpdateAll();
554
555
0
    GetWindow()->StartTracking( StartTrackingFlags::KeyMod );
556
0
}
557
558
void ImplDockingWindowWrapper::Tracking( const TrackingEvent& rTEvt )
559
0
{
560
    // used during docking of a currently docked window
561
0
    if ( !mbDocking )
562
0
        return;
563
564
0
    if ( rTEvt.IsTrackingEnded() )
565
0
    {
566
0
        mbDocking = false;
567
0
        GetWindow()->HideTracking();
568
0
        if ( rTEvt.IsTrackingCanceled() )
569
0
        {
570
0
            mbDockCanceled = true;
571
0
            EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
572
0
            mbDockCanceled = false;
573
0
        }
574
0
        else
575
0
            EndDocking( tools::Rectangle( Point( mnTrackX, mnTrackY ), Size( mnTrackWidth, mnTrackHeight ) ), mbLastFloatMode );
576
0
    }
577
    // Docking only upon non-synthetic MouseEvents
578
0
    else if ( !rTEvt.GetMouseEvent().IsSynthetic() || rTEvt.GetMouseEvent().IsModifierChanged() )
579
0
    {
580
0
        Point   aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
581
0
        Point   aFrameMousePos = GetWindow()->OutputToScreenPixel( aMousePos );
582
0
        Size    aFrameSize = GetWindow()->ImplGetFrameWindow()->GetOutputSizePixel();
583
0
        if ( aFrameMousePos.X() < 0 )
584
0
            aFrameMousePos.setX( 0 );
585
0
        if ( aFrameMousePos.Y() < 0 )
586
0
            aFrameMousePos.setY( 0 );
587
0
        if ( aFrameMousePos.X() > aFrameSize.Width()-1 )
588
0
            aFrameMousePos.setX( aFrameSize.Width()-1 );
589
0
        if ( aFrameMousePos.Y() > aFrameSize.Height()-1 )
590
0
            aFrameMousePos.setY( aFrameSize.Height()-1 );
591
0
        aMousePos = GetWindow()->ScreenToOutputPixel( aFrameMousePos );
592
0
        aMousePos.AdjustX( -(maMouseOff.X()) );
593
0
        aMousePos.AdjustY( -(maMouseOff.Y()) );
594
0
        Point aPos = GetWindow()->OutputToScreenPixel( aMousePos );
595
0
        tools::Rectangle aTrackRect( aPos, Size( mnTrackWidth, mnTrackHeight ) );
596
0
        tools::Rectangle aCompRect = aTrackRect;
597
0
        aPos.AdjustX(maMouseOff.X() );
598
0
        aPos.AdjustY(maMouseOff.Y() );
599
600
0
        bool bFloatMode = Docking( aPos, aTrackRect );
601
602
0
        if ( mbLastFloatMode != bFloatMode )
603
0
        {
604
0
            if ( bFloatMode )
605
0
            {
606
0
                aTrackRect.AdjustLeft( -mnDockLeft );
607
0
                aTrackRect.AdjustTop( -mnDockTop );
608
0
                aTrackRect.AdjustRight(mnDockRight );
609
0
                aTrackRect.AdjustBottom(mnDockBottom );
610
0
            }
611
0
            else
612
0
            {
613
0
                if ( aCompRect == aTrackRect )
614
0
                {
615
0
                    aTrackRect.AdjustLeft(mnDockLeft );
616
0
                    aTrackRect.AdjustTop(mnDockTop );
617
0
                    aTrackRect.AdjustRight( -mnDockRight );
618
0
                    aTrackRect.AdjustBottom( -mnDockBottom );
619
0
                }
620
0
            }
621
0
            mbLastFloatMode = bFloatMode;
622
0
        }
623
624
0
        ShowTrackFlags nTrackStyle;
625
0
        if ( bFloatMode )
626
0
            nTrackStyle = ShowTrackFlags::Object;
627
0
        else
628
0
            nTrackStyle = ShowTrackFlags::Big;
629
0
        tools::Rectangle aShowTrackRect = aTrackRect;
630
0
        aShowTrackRect.SetPos( GetWindow()->ScreenToOutputPixel( aShowTrackRect.TopLeft() ) );
631
632
0
        GetWindow()->ShowTracking( aShowTrackRect, nTrackStyle );
633
634
        // calculate mouse offset again, as the rectangle was changed
635
0
        maMouseOff.setX( aPos.X() - aTrackRect.Left() );
636
0
        maMouseOff.setY( aPos.Y() - aTrackRect.Top() );
637
638
0
        mnTrackX        = aTrackRect.Left();
639
0
        mnTrackY        = aTrackRect.Top();
640
0
        mnTrackWidth    = aTrackRect.GetWidth();
641
0
        mnTrackHeight   = aTrackRect.GetHeight();
642
0
    }
643
0
}
644
645
void ImplDockingWindowWrapper::StartDocking( const Point& rPoint, tools::Rectangle const & rRect )
646
0
{
647
0
    DockingData data( rPoint, rRect, IsFloatingMode() );
648
649
0
    GetWindow()->CallEventListeners( VclEventId::WindowStartDocking, &data );
650
0
    mbDocking = true;
651
0
}
652
653
bool ImplDockingWindowWrapper::Docking( const Point& rPoint, tools::Rectangle& rRect )
654
0
{
655
0
    DockingData data( rPoint, rRect, IsFloatingMode() );
656
657
0
    GetWindow()->CallEventListeners( VclEventId::WindowDocking, &data );
658
0
    rRect = data.maTrackRect;
659
0
    return data.mbFloating;
660
0
}
661
662
void ImplDockingWindowWrapper::EndDocking( const tools::Rectangle& rRect, bool bFloatMode )
663
0
{
664
0
    tools::Rectangle aRect( rRect );
665
666
0
    bool bOrigDockCanceled = mbDockCanceled;
667
0
    if (bFloatMode && !StyleSettings::GetDockingFloatsSupported())
668
0
        mbDockCanceled = true;
669
670
0
    if ( !IsDockingCanceled() )
671
0
    {
672
0
        bool bShow = false;
673
0
        if ( bFloatMode != IsFloatingMode() )
674
0
        {
675
0
            GetWindow()->Show( false, ShowFlags::NoFocusChange );
676
0
            SetFloatingMode( bFloatMode );
677
0
            bShow = true;
678
0
            if ( bFloatMode )
679
0
            {
680
                // #i44800# always use outputsize - as in all other places
681
0
                mpFloatWin->SetOutputSizePixel( aRect.GetSize() );
682
0
                mpFloatWin->SetPosPixel( aRect.TopLeft() );
683
0
            }
684
0
        }
685
0
        if ( !bFloatMode )
686
0
        {
687
0
            Point aPos = aRect.TopLeft();
688
0
            aPos = GetWindow()->GetParent()->ScreenToOutputPixel( aPos );
689
0
            GetWindow()->SetPosSizePixel( aPos, aRect.GetSize() );
690
0
        }
691
692
0
        if ( bShow )
693
0
            GetWindow()->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
694
0
    }
695
696
0
    EndDockingData data( aRect, IsFloatingMode(), IsDockingCanceled() );
697
0
    GetWindow()->CallEventListeners( VclEventId::WindowEndDocking, &data );
698
699
0
    mbDocking = false;
700
701
    // must be enabled in Window::Notify to prevent permanent docking during mouse move
702
0
    mbStartDockingEnabled = false;
703
704
0
    mbDockCanceled = bOrigDockCanceled;
705
0
}
706
707
bool ImplDockingWindowWrapper::PrepareToggleFloatingMode()
708
0
{
709
0
    bool bFloating = true;
710
0
    GetWindow()->CallEventListeners( VclEventId::WindowPrepareToggleFloating, &bFloating );
711
0
    return bFloating;
712
0
}
713
714
void ImplDockingWindowWrapper::ToggleFloatingMode()
715
0
{
716
    // notify dockingwindow/toolbox
717
    // note: this must be done *before* notifying the
718
    //       listeners to have the toolbox in the proper state
719
0
    if( GetWindow()->IsDockingWindow() )
720
0
        static_cast<DockingWindow*>(GetWindow())->ToggleFloatingMode();
721
722
    // now notify listeners
723
0
    GetWindow()->CallEventListeners( VclEventId::WindowToggleFloating );
724
725
    // must be enabled in Window::Notify to prevent permanent docking during mouse move
726
0
    mbStartDockingEnabled = false;
727
0
}
728
729
void ImplDockingWindowWrapper::TitleButtonClick( TitleButton nType )
730
0
{
731
0
    if( nType == TitleButton::Menu )
732
0
    {
733
0
        ToolBox *pToolBox = dynamic_cast< ToolBox* >( GetWindow() );
734
0
        if( pToolBox )
735
0
        {
736
0
            pToolBox->ExecuteCustomMenu();
737
0
        }
738
0
    }
739
0
    if( nType == TitleButton::Docking )
740
0
    {
741
0
        SetFloatingMode( !IsFloatingMode() );
742
0
    }
743
0
}
744
745
void ImplDockingWindowWrapper::Resizing( Size& rSize )
746
0
{
747
    // TODO: add virtual Resizing() to class Window, so we can get rid of class DockingWindow
748
0
    DockingWindow *pDockingWindow = dynamic_cast< DockingWindow* >( GetWindow() );
749
0
    if( pDockingWindow )
750
0
        pDockingWindow->Resizing( rSize );
751
0
}
752
753
void ImplDockingWindowWrapper::ShowMenuTitleButton( bool bVisible )
754
0
{
755
0
    if ( mpFloatWin )
756
0
        mpFloatWin->ShowTitleButton( TitleButton::Menu, bVisible );
757
0
}
758
759
void ImplDockingWindowWrapper::ImplPreparePopupMode()
760
0
{
761
0
    VclPtr<vcl::Window> xWindow = GetWindow();
762
0
    xWindow->Show( false, ShowFlags::NoFocusChange );
763
764
    // prepare reparenting
765
0
    vcl::Window* pRealParent = xWindow->GetWindow( GetWindowType::Parent );
766
0
    mpOldBorderWin = xWindow->GetWindow( GetWindowType::Border );
767
0
    if( mpOldBorderWin.get() == xWindow )
768
0
        mpOldBorderWin = nullptr;  // no border window found
769
770
    // the new parent for popup mode
771
0
    VclPtrInstance<ImplPopupFloatWin> pWin( mpParent, xWindow->GetType() == WindowType::TOOLBOX );
772
0
    pWin->SetPopupModeEndHdl( LINK( this, ImplDockingWindowWrapper, PopupModeEnd ) );
773
774
    // At least for DockingWindow, GetText() has a side effect of setting deferred
775
    // properties. This must be done before setting the border window (see below),
776
    // so that the border width will end up in mpWindowImpl->mnBorderWidth, not in
777
    // the border window (See DockingWindow::setPosSizeOnContainee() and
778
    // DockingWindow::GetOptimalSize()).
779
0
    pWin->SetText( xWindow->GetText() );
780
0
    pWin->SetOutputSizePixel( xWindow->GetSizePixel() );
781
782
0
    xWindow->mpWindowImpl->mpBorderWindow  = nullptr;
783
0
    xWindow->mpWindowImpl->mnLeftBorder    = 0;
784
0
    xWindow->mpWindowImpl->mnTopBorder     = 0;
785
0
    xWindow->mpWindowImpl->mnRightBorder   = 0;
786
0
    xWindow->mpWindowImpl->mnBottomBorder  = 0;
787
788
    // reparent borderwindow and window
789
0
    if ( mpOldBorderWin )
790
0
        mpOldBorderWin->SetParent( pWin );
791
0
    xWindow->SetParent( pWin );
792
793
    // correct border window pointers
794
0
    xWindow->mpWindowImpl->mpBorderWindow = pWin;
795
0
    pWin->mpWindowImpl->mpClientWindow = xWindow;
796
0
    xWindow->mpWindowImpl->mpRealParent = pRealParent;
797
798
    // set mpFloatWin not until all window positioning is done !!!
799
    // (SetPosPixel etc. check for valid mpFloatWin pointer)
800
0
    mpFloatWin = pWin;
801
0
}
802
803
void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWinPopupFlags nFlags )
804
0
{
805
    // do nothing if window is floating
806
0
    if( IsFloatingMode() )
807
0
        return;
808
809
0
    ImplPreparePopupMode();
810
811
    // don't allow tearoff, if globally disabled
812
0
    if( !StyleSettings::GetDockingFloatsSupported() )
813
0
        nFlags &= ~FloatWinPopupFlags::AllowTearOff;
814
815
    // if the subtoolbar was opened via keyboard make sure that key events
816
    // will go into subtoolbar
817
0
    if( pParentToolBox->IsKeyEvent() )
818
0
        nFlags |= FloatWinPopupFlags::GrabFocus;
819
820
0
    mpFloatWin->StartPopupMode( pParentToolBox, nFlags );
821
0
    GetWindow()->Show();
822
    // grab focus (again) after showing docking window, as e.g. a11y focus
823
    // events require window to be visible first
824
0
    if (nFlags & FloatWinPopupFlags::GrabFocus)
825
0
        mpFloatWin->GrabFocus();
826
827
0
    if( pParentToolBox->IsKeyEvent() )
828
0
    {
829
        // send HOME key to subtoolbar in order to select first item
830
0
        KeyEvent aEvent( 0, vcl::KeyCode( KEY_HOME ) );
831
0
        GetWindow()->KeyInput(aEvent);
832
0
    }
833
0
}
834
835
void ImplDockingWindowWrapper::StartPopupMode( const tools::Rectangle& rRect, FloatWinPopupFlags nFlags )
836
0
{
837
    // do nothing if window is floating
838
0
    if( IsFloatingMode() )
839
0
        return;
840
841
0
    ImplPreparePopupMode();
842
0
    mpFloatWin->StartPopupMode( rRect, nFlags );
843
0
    GetWindow()->Show();
844
    // grab focus (again) after showing docking window, as e.g. a11y focus
845
    // events require window to be visible first
846
0
    if (nFlags & FloatWinPopupFlags::GrabFocus)
847
0
        mpFloatWin->GrabFocus();
848
0
}
849
850
IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)
851
0
{
852
0
    VclPtr<vcl::Window> xWindow = GetWindow();
853
0
    xWindow->Show( false, ShowFlags::NoFocusChange );
854
855
    // set parameter for handler before destroying floating window
856
0
    EndPopupModeData aData( mpFloatWin->GetWindow( GetWindowType::Border )->GetPosPixel(), mpFloatWin->IsPopupModeTearOff() );
857
858
    // before deleting change parent back, so we can delete the floating window alone
859
0
    vcl::Window* pRealParent = xWindow->GetWindow( GetWindowType::Parent );
860
0
    xWindow->mpWindowImpl->mpBorderWindow = nullptr;
861
0
    if ( mpOldBorderWin )
862
0
    {
863
0
        xWindow->SetParent( mpOldBorderWin );
864
0
        static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder(
865
0
            xWindow->mpWindowImpl->mnLeftBorder, xWindow->mpWindowImpl->mnTopBorder,
866
0
            xWindow->mpWindowImpl->mnRightBorder, xWindow->mpWindowImpl->mnBottomBorder );
867
0
        mpOldBorderWin->Resize();
868
0
    }
869
0
    xWindow->mpWindowImpl->mpBorderWindow = mpOldBorderWin;
870
0
    xWindow->SetParent( pRealParent );
871
0
    xWindow->mpWindowImpl->mpRealParent = pRealParent;
872
873
    // take ownership to local variable to protect against maPopupModeEndHdl destroying this object
874
0
    auto xFloatWin = std::move(mpFloatWin);
875
0
    maPopupModeEndHdl.Call(xFloatWin);
876
0
    xFloatWin.disposeAndClear();
877
878
    // call handler - which will destroy the window and thus the wrapper as well !
879
0
    xWindow->CallEventListeners( VclEventId::WindowEndPopupMode, &aData );
880
0
}
881
882
bool ImplDockingWindowWrapper::IsInPopupMode() const
883
0
{
884
0
    if( GetFloatingWindow() )
885
0
        return static_cast<FloatingWindow*>(GetFloatingWindow())->IsInPopupMode();
886
0
    else
887
0
        return false;
888
0
}
889
890
void ImplDockingWindowWrapper::SetFloatingMode( bool bFloatMode )
891
0
{
892
    // do nothing if window is docked and locked
893
0
    if( !IsFloatingMode() && IsLocked() )
894
0
        return;
895
896
0
    if ( IsFloatingMode() == bFloatMode )
897
0
        return;
898
899
0
    if ( !PrepareToggleFloatingMode() )
900
0
        return;
901
902
0
    bool bVisible = GetWindow()->IsVisible();
903
904
0
    if ( bFloatMode )
905
0
    {
906
0
        GetWindow()->Show( false, ShowFlags::NoFocusChange );
907
908
0
        maDockPos = GetWindow()->GetPosPixel();
909
910
0
        vcl::Window* pRealParent = GetWindow()->GetWindow( GetWindowType::Parent );
911
0
        mpOldBorderWin = GetWindow()->GetWindow( GetWindowType::Border );
912
0
        if( mpOldBorderWin == mpDockingWindow )
913
0
            mpOldBorderWin = nullptr;  // no border window found
914
915
0
        VclPtrInstance<ImplDockFloatWin2> pWin(
916
0
                                 mpParent,
917
0
                                 mnFloatBits & ( WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE ) ?
918
0
                                  mnFloatBits | WB_SYSTEMWINDOW
919
0
                                  | WB_OWNERDRAWDECORATION
920
0
                                  : mnFloatBits,
921
0
                                 this );
922
923
        // At least for DockingWindow, GetText() has a side effect of setting deferred
924
        // properties. This must be done before setting the border window (see below),
925
        // so that the border width will end up in mpWindowImpl->mnBorderWidth, not in
926
        // the border window (See DockingWindow::setPosSizeOnContainee() and
927
        // DockingWindow::GetOptimalSize()).
928
0
        pWin->SetText( GetWindow()->GetText() );
929
930
0
        GetWindow()->mpWindowImpl->mpBorderWindow  = nullptr;
931
0
        GetWindow()->mpWindowImpl->mnLeftBorder    = 0;
932
0
        GetWindow()->mpWindowImpl->mnTopBorder     = 0;
933
0
        GetWindow()->mpWindowImpl->mnRightBorder   = 0;
934
0
        GetWindow()->mpWindowImpl->mnBottomBorder  = 0;
935
936
        // if the parent gets destroyed, we also have to reset the parent of the BorderWindow
937
0
        if ( mpOldBorderWin )
938
0
            mpOldBorderWin->SetParent( pWin );
939
0
        GetWindow()->SetParent( pWin );
940
0
        pWin->SetPosPixel( Point() );
941
942
0
        GetWindow()->mpWindowImpl->mpBorderWindow = pWin;
943
0
        pWin->mpWindowImpl->mpClientWindow = mpDockingWindow;
944
0
        GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
945
946
0
        pWin->SetOutputSizePixel( GetWindow()->GetSizePixel() );
947
0
        pWin->SetPosPixel( maFloatPos );
948
        // pass on DockingData to FloatingWindow
949
0
        pWin->ShowTitleButton( TitleButton::Docking, mbDockBtn );
950
0
        pWin->ShowTitleButton( TitleButton::Hide, mbHideBtn );
951
0
        pWin->SetMinOutputSizePixel( maMinOutSize );
952
0
        pWin->SetMaxOutputSizePixel( maMaxOutSize );
953
954
0
        mpFloatWin      = pWin;
955
956
0
        if ( bVisible )
957
0
            GetWindow()->Show( true, ShowFlags::NoFocusChange | ShowFlags::NoActivate );
958
959
0
        ToggleFloatingMode();
960
0
    }
961
0
    else
962
0
    {
963
0
        GetWindow()->Show( false, ShowFlags::NoFocusChange );
964
965
        // store FloatingData in FloatingWindow
966
0
        maFloatPos      = mpFloatWin->GetPosPixel();
967
0
        mbDockBtn       = mpFloatWin->IsTitleButtonVisible( TitleButton::Docking );
968
0
        mbHideBtn       = mpFloatWin->IsTitleButtonVisible( TitleButton::Hide );
969
0
        maMinOutSize    = mpFloatWin->GetMinOutputSizePixel();
970
0
        maMaxOutSize    = mpFloatWin->GetMaxOutputSizePixel();
971
972
0
        vcl::Window* pRealParent = GetWindow()->GetWindow( GetWindowType::Parent ); //mpWindowImpl->mpRealParent;
973
0
        GetWindow()->mpWindowImpl->mpBorderWindow = nullptr;
974
0
        if ( mpOldBorderWin )
975
0
        {
976
0
            GetWindow()->SetParent( mpOldBorderWin );
977
0
            static_cast<ImplBorderWindow*>(mpOldBorderWin.get())->GetBorder(
978
0
                GetWindow()->mpWindowImpl->mnLeftBorder, GetWindow()->mpWindowImpl->mnTopBorder,
979
0
                GetWindow()->mpWindowImpl->mnRightBorder, GetWindow()->mpWindowImpl->mnBottomBorder );
980
0
            mpOldBorderWin->Resize();
981
0
        }
982
0
        GetWindow()->mpWindowImpl->mpBorderWindow = mpOldBorderWin;
983
0
        GetWindow()->SetParent( pRealParent );
984
0
        GetWindow()->mpWindowImpl->mpRealParent = pRealParent;
985
986
0
        mpFloatWin.disposeAndClear();
987
0
        GetWindow()->SetPosPixel( maDockPos );
988
989
0
        if ( bVisible )
990
0
            GetWindow()->Show();
991
992
0
        ToggleFloatingMode();
993
994
0
    }
995
0
}
996
997
void ImplDockingWindowWrapper::SetFloatStyle( WinBits nStyle )
998
0
{
999
0
    mnFloatBits = nStyle;
1000
0
}
1001
1002
1003
void ImplDockingWindowWrapper::setPosSizePixel( tools::Long nX, tools::Long nY,
1004
                                     tools::Long nWidth, tools::Long nHeight,
1005
                                     PosSizeFlags nFlags )
1006
0
{
1007
0
    if ( mpFloatWin )
1008
0
        mpFloatWin->setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
1009
0
    else
1010
0
        GetWindow()->setPosSizePixel( nX, nY, nWidth, nHeight, nFlags );
1011
0
}
1012
1013
Point ImplDockingWindowWrapper::GetPosPixel() const
1014
0
{
1015
0
    if ( mpFloatWin )
1016
0
        return mpFloatWin->GetPosPixel();
1017
0
    else
1018
0
        return mpDockingWindow->GetPosPixel();
1019
0
}
1020
1021
Size ImplDockingWindowWrapper::GetSizePixel() const
1022
0
{
1023
0
    if ( mpFloatWin )
1024
0
        return mpFloatWin->GetSizePixel();
1025
0
    else
1026
0
        return mpDockingWindow->GetSizePixel();
1027
0
}
1028
1029
// old inlines from DockingWindow
1030
1031
void ImplDockingWindowWrapper::SetMinOutputSizePixel( const Size& rSize )
1032
0
{
1033
0
    if ( mpFloatWin )
1034
0
        mpFloatWin->SetMinOutputSizePixel( rSize );
1035
0
    maMinOutSize = rSize;
1036
0
}
1037
1038
void ImplDockingWindowWrapper::SetMaxOutputSizePixel( const Size& rSize )
1039
0
{
1040
0
    if ( mpFloatWin )
1041
0
        mpFloatWin->SetMaxOutputSizePixel( rSize );
1042
0
    maMaxOutSize = rSize;
1043
0
}
1044
1045
bool ImplDockingWindowWrapper::IsFloatingMode() const
1046
0
{
1047
0
    return (mpFloatWin != nullptr);
1048
0
}
1049
1050
void    ImplDockingWindowWrapper::SetDragArea( const tools::Rectangle& rRect )
1051
0
{
1052
0
    maDragArea = rRect;
1053
0
}
1054
1055
1056
void ImplDockingWindowWrapper::Lock()
1057
0
{
1058
0
    mbLocked = true;
1059
    // only toolbars support locking
1060
0
    ToolBox *pToolBox = dynamic_cast< ToolBox * >( GetWindow() );
1061
0
    if( pToolBox )
1062
0
        pToolBox->Lock( mbLocked );
1063
0
}
1064
1065
void ImplDockingWindowWrapper::Unlock()
1066
0
{
1067
0
    mbLocked = false;
1068
    // only toolbars support locking
1069
0
    ToolBox *pToolBox = dynamic_cast< ToolBox * >( GetWindow() );
1070
0
    if( pToolBox )
1071
0
        pToolBox->Lock( mbLocked );
1072
0
}
1073
1074
SystemWindow* ImplDockingWindowWrapper::GetFloatingWindow() const
1075
0
{
1076
0
    return mpFloatWin;
1077
0
}
1078
1079
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */