Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/window/brdwin.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 <strings.hrc>
21
#include <svdata.hxx>
22
#include <brdwin.hxx>
23
#include <salframe.hxx>
24
#include <window.h>
25
26
#include <vcl/textrectinfo.hxx>
27
#include <vcl/event.hxx>
28
#include <vcl/decoview.hxx>
29
#include <vcl/salnativewidgets.hxx>
30
#include <vcl/syswin.hxx>
31
#include <vcl/dockwin.hxx>
32
#include <vcl/toolkit/floatwin.hxx>
33
#include <vcl/help.hxx>
34
#include <vcl/notebookbar/NotebookBarAddonsItem.hxx>
35
#include <vcl/toolkit/edit.hxx>
36
#include <vcl/settings.hxx>
37
#include <vcl/toolbox.hxx>
38
#include <vcl/ptrstyle.hxx>
39
40
using namespace ::com::sun::star::uno;
41
42
// useful caption height for title bar buttons
43
0
#define MIN_CAPTION_HEIGHT 18
44
45
namespace vcl {
46
47
void Window::ImplCalcSymbolRect( tools::Rectangle& rRect )
48
0
{
49
    // Add border, not shown in the non-default representation,
50
    // as we want to use it for small buttons
51
0
    rRect.AdjustLeft( -1 );
52
0
    rRect.AdjustTop( -1 );
53
0
    rRect.AdjustRight( 1 );
54
0
    rRect.AdjustBottom( 1 );
55
56
    // we leave 5% room between the symbol and the button border
57
0
    tools::Long nExtraWidth = ((rRect.GetWidth()*50)+500)/1000;
58
0
    tools::Long nExtraHeight = ((rRect.GetHeight()*50)+500)/1000;
59
0
    rRect.AdjustLeft(nExtraWidth );
60
0
    rRect.AdjustRight( -nExtraWidth );
61
0
    rRect.AdjustTop(nExtraHeight );
62
0
    rRect.AdjustBottom( -nExtraHeight );
63
0
}
64
65
} /* namespace vcl */
66
67
static void ImplDrawBrdWinSymbol( vcl::RenderContext& rRenderContext,
68
                                  const tools::Rectangle& rRect, SymbolType eSymbol )
69
0
{
70
    // we leave 5% room between the symbol and the button border
71
0
    DecorationView  aDecoView( &rRenderContext );
72
0
    tools::Rectangle       aTempRect = rRect;
73
0
    vcl::Window::ImplCalcSymbolRect( aTempRect );
74
0
    aDecoView.DrawSymbol( aTempRect, eSymbol,
75
0
                          rRenderContext.GetSettings().GetStyleSettings().GetButtonTextColor() );
76
0
}
77
78
static void ImplDrawBrdWinSymbolButton( vcl::RenderContext& rRenderContext,
79
                                        const tools::Rectangle& rRect,
80
                                        SymbolType eSymbol, DrawButtonFlags nState )
81
0
{
82
0
    bool bMouseOver(nState & DrawButtonFlags::Highlight);
83
0
    nState &= ~DrawButtonFlags::Highlight;
84
85
0
    tools::Rectangle aTempRect;
86
0
    vcl::Window *pWin = rRenderContext.GetOwnerWindow();
87
0
    if( pWin )
88
0
    {
89
0
        if( bMouseOver )
90
0
        {
91
            // provide a bright background for selection effect
92
0
            rRenderContext.SetFillColor( rRenderContext.GetSettings().GetStyleSettings().GetWindowColor() );
93
0
            rRenderContext.SetLineColor();
94
0
            rRenderContext.DrawRect( rRect );
95
0
            rRenderContext.DrawSelectionBackground(rRect, pWin->GetBackgroundColor(), 2,
96
0
                                                   bool(nState & DrawButtonFlags::Pressed),
97
0
                                                   true);
98
0
        }
99
0
        aTempRect = rRect;
100
0
        aTempRect.AdjustLeft( 3 );
101
0
        aTempRect.AdjustRight( -4 );
102
0
        aTempRect.AdjustTop( 3 );
103
0
        aTempRect.AdjustBottom( -4 );
104
0
    }
105
0
    else
106
0
    {
107
0
        DecorationView aDecoView( &rRenderContext );
108
0
        aTempRect = aDecoView.DrawButton( rRect, nState|DrawButtonFlags::Flat );
109
0
    }
110
0
    ImplDrawBrdWinSymbol( rRenderContext, aTempRect, eSymbol );
111
0
}
112
113
114
ImplBorderWindowView::~ImplBorderWindowView()
115
8.32k
{
116
8.32k
}
117
118
bool ImplBorderWindowView::MouseMove( const MouseEvent& )
119
0
{
120
0
    return false;
121
0
}
122
123
bool ImplBorderWindowView::MouseButtonDown( const MouseEvent& )
124
0
{
125
0
    return false;
126
0
}
127
128
bool ImplBorderWindowView::Tracking( const TrackingEvent& )
129
0
{
130
0
    return false;
131
0
}
132
133
OUString ImplBorderWindowView::RequestHelp( const Point&, tools::Rectangle& )
134
0
{
135
0
    return OUString();
136
0
}
137
138
tools::Rectangle ImplBorderWindowView::GetMenuRect() const
139
0
{
140
0
    return tools::Rectangle();
141
0
}
142
143
void ImplBorderWindowView::ImplInitTitle(ImplBorderFrameData* pData)
144
0
{
145
0
    ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
146
147
0
    if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) ||
148
0
          (pData->mnTitleType == BorderWindowTitleType::NONE) )
149
0
    {
150
0
        pData->mnTitleType   = BorderWindowTitleType::NONE;
151
0
        pData->mnTitleHeight = 0;
152
0
    }
153
0
    else
154
0
    {
155
0
        const StyleSettings& rStyleSettings = pData->mpOutDev->GetSettings().GetStyleSettings();
156
0
        if (pData->mnTitleType == BorderWindowTitleType::Tearoff)
157
0
            pData->mnTitleHeight = ToolBox::ImplGetDragWidth(*pData->mpBorderWindow, false) + 2;
158
0
        else
159
0
        {
160
0
            if (pData->mnTitleType == BorderWindowTitleType::Small)
161
0
            {
162
0
                pBorderWindow->SetPointFont(*pBorderWindow->GetOutDev(), rStyleSettings.GetFloatTitleFont() );
163
0
                pData->mnTitleHeight = rStyleSettings.GetFloatTitleHeight();
164
0
            }
165
0
            else // pData->mnTitleType == BorderWindowTitleType::Normal
166
0
            {
167
                // FIXME RenderContext
168
0
                pBorderWindow->SetPointFont(*pBorderWindow->GetOutDev(), rStyleSettings.GetTitleFont());
169
0
                pData->mnTitleHeight = rStyleSettings.GetTitleHeight();
170
0
            }
171
0
            tools::Long nTextHeight = pBorderWindow->GetTextHeight();
172
0
            if (nTextHeight > pData->mnTitleHeight)
173
0
                pData->mnTitleHeight = nTextHeight;
174
0
        }
175
0
    }
176
0
}
177
178
BorderWindowHitTest ImplBorderWindowView::ImplHitTest( ImplBorderFrameData const * pData, const Point& rPos )
179
0
{
180
0
    ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
181
182
0
    if ( pData->maTitleRect.Contains( rPos ) )
183
0
    {
184
0
        if ( pData->maCloseRect.Contains( rPos ) )
185
0
            return BorderWindowHitTest::Close;
186
0
        else if ( pData->maMenuRect.Contains( rPos ) )
187
0
            return BorderWindowHitTest::Menu;
188
0
        else if ( pData->maDockRect.Contains( rPos ) )
189
0
            return BorderWindowHitTest::Dock;
190
0
        else if ( pData->maHideRect.Contains( rPos ) )
191
0
            return BorderWindowHitTest::Hide;
192
0
        else if ( pData->maHelpRect.Contains( rPos ) )
193
0
            return BorderWindowHitTest::Help;
194
0
        else
195
0
            return BorderWindowHitTest::Title;
196
0
    }
197
198
0
    if (pBorderWindow->GetStyle() & WB_SIZEABLE)
199
0
    {
200
0
        tools::Long nSizeWidth = pData->mnNoTitleTop+pData->mnTitleHeight;
201
0
        if ( nSizeWidth < 16 )
202
0
            nSizeWidth = 16;
203
204
        // no corner resize for floating toolbars, which would lead to jumps while formatting
205
        // setting nSizeWidth = 0 will only return pure left,top,right,bottom
206
0
        if( pBorderWindow->GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP) )
207
0
            nSizeWidth = 0;
208
209
0
        if ( rPos.X() < pData->mnLeftBorder )
210
0
        {
211
0
            if ( rPos.Y() < nSizeWidth )
212
0
                return BorderWindowHitTest::TopLeft;
213
0
            else if ( rPos.Y() >= pData->mnHeight-nSizeWidth )
214
0
                return BorderWindowHitTest::BottomLeft;
215
0
            else
216
0
                return BorderWindowHitTest::Left;
217
0
        }
218
0
        else if ( rPos.X() >= pData->mnWidth-pData->mnRightBorder )
219
0
        {
220
0
            if ( rPos.Y() < nSizeWidth )
221
0
                return BorderWindowHitTest::TopRight;
222
0
            else if ( rPos.Y() >= pData->mnHeight-nSizeWidth )
223
0
                return BorderWindowHitTest::BottomRight;
224
0
            else
225
0
                return BorderWindowHitTest::Right;
226
0
        }
227
0
        else if ( rPos.Y() < pData->mnNoTitleTop )
228
0
        {
229
0
            if ( rPos.X() < nSizeWidth )
230
0
                return BorderWindowHitTest::TopLeft;
231
0
            else if ( rPos.X() >= pData->mnWidth-nSizeWidth )
232
0
                return BorderWindowHitTest::TopRight;
233
0
            else
234
0
                return BorderWindowHitTest::Top;
235
0
        }
236
0
        else if ( rPos.Y() >= pData->mnHeight-pData->mnBottomBorder )
237
0
        {
238
0
            if ( rPos.X() < nSizeWidth )
239
0
                return BorderWindowHitTest::BottomLeft;
240
0
            else if ( rPos.X() >= pData->mnWidth-nSizeWidth )
241
0
                return BorderWindowHitTest::BottomRight;
242
0
            else
243
0
                return BorderWindowHitTest::Bottom;
244
0
        }
245
0
    }
246
247
0
    return BorderWindowHitTest::NONE;
248
0
}
249
250
void ImplBorderWindowView::ImplMouseMove( ImplBorderFrameData* pData, const MouseEvent& rMEvt )
251
0
{
252
0
    DrawButtonFlags oldCloseState = pData->mnCloseState;
253
0
    DrawButtonFlags oldMenuState = pData->mnMenuState;
254
0
    pData->mnCloseState &= ~DrawButtonFlags::Highlight;
255
0
    pData->mnMenuState &= ~DrawButtonFlags::Highlight;
256
257
0
    Point aMousePos = rMEvt.GetPosPixel();
258
0
    BorderWindowHitTest nHitTest = ImplHitTest( pData, aMousePos );
259
0
    PointerStyle ePtrStyle = PointerStyle::Arrow;
260
0
    if ( nHitTest & BorderWindowHitTest::Left )
261
0
        ePtrStyle = PointerStyle::WindowWSize;
262
0
    else if ( nHitTest & BorderWindowHitTest::Right )
263
0
        ePtrStyle = PointerStyle::WindowESize;
264
0
    else if ( nHitTest & BorderWindowHitTest::Top )
265
0
        ePtrStyle = PointerStyle::WindowNSize;
266
0
    else if ( nHitTest & BorderWindowHitTest::Bottom )
267
0
        ePtrStyle = PointerStyle::WindowSSize;
268
0
    else if ( nHitTest & BorderWindowHitTest::TopLeft )
269
0
        ePtrStyle = PointerStyle::WindowNWSize;
270
0
    else if ( nHitTest & BorderWindowHitTest::BottomRight )
271
0
        ePtrStyle = PointerStyle::WindowSESize;
272
0
    else if ( nHitTest & BorderWindowHitTest::TopRight )
273
0
        ePtrStyle = PointerStyle::WindowNESize;
274
0
    else if ( nHitTest & BorderWindowHitTest::BottomLeft )
275
0
        ePtrStyle = PointerStyle::WindowSWSize;
276
0
    else if ( nHitTest & BorderWindowHitTest::Close )
277
0
        pData->mnCloseState |= DrawButtonFlags::Highlight;
278
0
    else if ( nHitTest & BorderWindowHitTest::Menu )
279
0
        pData->mnMenuState |= DrawButtonFlags::Highlight;
280
0
    else if ( nHitTest & BorderWindowHitTest::Title &&
281
0
              pData->mnTitleType == BorderWindowTitleType::Tearoff && !rMEvt.IsLeaveWindow() )
282
0
        ePtrStyle = PointerStyle::Move;
283
0
    pData->mpBorderWindow->SetPointer( ePtrStyle );
284
285
0
    if( pData->mnCloseState != oldCloseState )
286
0
        pData->mpBorderWindow->Invalidate( pData->maCloseRect );
287
0
    if( pData->mnMenuState != oldMenuState )
288
0
        pData->mpBorderWindow->Invalidate( pData->maMenuRect );
289
0
}
290
291
OUString ImplBorderWindowView::ImplRequestHelp( ImplBorderFrameData const * pData,
292
                                              const Point& rPos,
293
                                              tools::Rectangle& rHelpRect )
294
0
{
295
0
    TranslateId pHelpId;
296
0
    OUString aHelpStr;
297
0
    BorderWindowHitTest nHitTest = ImplHitTest( pData, rPos );
298
0
    if ( nHitTest != BorderWindowHitTest::NONE )
299
0
    {
300
0
        if ( nHitTest & BorderWindowHitTest::Close )
301
0
        {
302
0
            pHelpId     = SV_HELPTEXT_CLOSE;
303
0
            rHelpRect   = pData->maCloseRect;
304
0
        }
305
0
        else if ( nHitTest & BorderWindowHitTest::Dock )
306
0
        {
307
0
            pHelpId     = SV_HELPTEXT_MAXIMIZE;
308
0
            rHelpRect   = pData->maDockRect;
309
0
        }
310
0
        else if ( nHitTest & BorderWindowHitTest::Hide )
311
0
        {
312
0
            pHelpId     = SV_HELPTEXT_MINIMIZE;
313
0
            rHelpRect   = pData->maHideRect;
314
0
        }
315
0
        else if ( nHitTest & BorderWindowHitTest::Help )
316
0
        {
317
0
            pHelpId     = SV_HELPTEXT_HELP;
318
0
            rHelpRect   = pData->maHelpRect;
319
0
        }
320
0
        else if ( nHitTest & BorderWindowHitTest::Title )
321
0
        {
322
0
            if( !pData->maTitleRect.IsEmpty() )
323
0
            {
324
                // tooltip only if title truncated
325
0
                if( pData->mbTitleClipped )
326
0
                {
327
0
                    rHelpRect   = pData->maTitleRect;
328
                    // no help id, use window title as help string
329
0
                    aHelpStr    = pData->mpBorderWindow->GetText();
330
0
                }
331
0
            }
332
0
        }
333
0
    }
334
335
0
    if (pHelpId)
336
0
        aHelpStr = VclResId(pHelpId);
337
338
0
    return aHelpStr;
339
0
}
340
341
tools::Long ImplBorderWindowView::ImplCalcTitleWidth( const ImplBorderFrameData* pData )
342
0
{
343
    // title is not visible therefore no width
344
0
    if ( !pData->mnTitleHeight )
345
0
        return 0;
346
347
0
    ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
348
0
    tools::Long nTitleWidth = pBorderWindow->GetTextWidth( pBorderWindow->GetText() )+6;
349
0
    auto nCloseRectWidth = pData->maCloseRect.GetWidth();
350
0
    assert(nCloseRectWidth >= 0 && "coverity 2023.12.2");
351
0
    nTitleWidth += nCloseRectWidth;
352
0
    auto nDockRectWidth = pData->maDockRect.GetWidth();
353
0
    assert(nDockRectWidth >= 0 && "coverity 2023.12.2");
354
0
    nTitleWidth += nDockRectWidth;
355
0
    auto nMenuRectWidth = pData->maMenuRect.GetWidth();
356
0
    assert(nMenuRectWidth >= 0 && "coverity 2023.12.2");
357
0
    nTitleWidth += nMenuRectWidth;
358
0
    auto nHideRectWidth = pData->maHideRect.GetWidth();
359
0
    assert(nHideRectWidth >= 0 && "coverity 2023.12.2");
360
0
    nTitleWidth += nHideRectWidth;
361
0
    auto nHelpRectWidth = pData->maHelpRect.GetWidth();
362
0
    assert(nHelpRectWidth >= 0 && "coverity 2023.12.2");
363
0
    nTitleWidth += nHelpRectWidth;
364
0
    nTitleWidth += pData->mnLeftBorder+pData->mnRightBorder;
365
0
    return nTitleWidth;
366
0
}
367
368
369
ImplNoBorderWindowView::ImplNoBorderWindowView()
370
8.57k
{
371
8.57k
}
372
373
void ImplNoBorderWindowView::Init( OutputDevice*, tools::Long, tools::Long )
374
8.57k
{
375
8.57k
}
376
377
void ImplNoBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
378
                                        sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
379
8.57k
{
380
8.57k
    rLeftBorder     = 0;
381
8.57k
    rTopBorder      = 0;
382
8.57k
    rRightBorder    = 0;
383
8.57k
    rBottomBorder   = 0;
384
8.57k
}
385
386
tools::Long ImplNoBorderWindowView::CalcTitleWidth() const
387
0
{
388
0
    return 0;
389
0
}
390
391
void ImplNoBorderWindowView::DrawWindow(vcl::RenderContext&, const Point*)
392
0
{
393
0
}
394
395
ImplSmallBorderWindowView::ImplSmallBorderWindowView( ImplBorderWindow* pBorderWindow )
396
4.16k
    : mpBorderWindow(pBorderWindow)
397
4.16k
    , mpOutDev(nullptr)
398
4.16k
    , mnWidth(0)
399
4.16k
    , mnHeight(0)
400
4.16k
    , mnLeftBorder(0)
401
4.16k
    , mnTopBorder(0)
402
4.16k
    , mnRightBorder(0)
403
4.16k
    , mnBottomBorder(0)
404
4.16k
    , mbNWFBorder(false)
405
4.16k
{
406
4.16k
}
407
408
void ImplSmallBorderWindowView::Init( OutputDevice* pDev, tools::Long nWidth, tools::Long nHeight )
409
12.4k
{
410
12.4k
    mpOutDev    = pDev;
411
12.4k
    mnWidth     = nWidth;
412
12.4k
    mnHeight    = nHeight;
413
12.4k
    mbNWFBorder = false;
414
415
12.4k
    vcl::Window *pWin = mpOutDev->GetOwnerWindow();
416
12.4k
    vcl::Window *pCtrl = nullptr;
417
12.4k
    vcl::Window *pSubEdit = nullptr;
418
12.4k
    if (pWin)
419
12.4k
        pCtrl = mpBorderWindow->GetWindow(GetWindowType::Client);
420
421
12.4k
    tools::Long nOrigLeftBorder = mnLeftBorder;
422
12.4k
    tools::Long nOrigTopBorder = mnTopBorder;
423
12.4k
    tools::Long nOrigRightBorder = mnRightBorder;
424
12.4k
    tools::Long nOrigBottomBorder = mnBottomBorder;
425
426
12.4k
    WindowBorderStyle nBorderStyle = mpBorderWindow->GetBorderStyle();
427
12.4k
    if ( nBorderStyle & WindowBorderStyle::NOBORDER )
428
4.16k
    {
429
4.16k
        mnLeftBorder    = 0;
430
4.16k
        mnTopBorder     = 0;
431
4.16k
        mnRightBorder   = 0;
432
4.16k
        mnBottomBorder  = 0;
433
4.16k
    }
434
8.32k
    else
435
8.32k
    {
436
        // FIXME: this is currently only on macOS, check with other
437
        // platforms
438
8.32k
        if( ImplGetSVData()->maNWFData.mbNoFocusRects && !( nBorderStyle & WindowBorderStyle::NWF ) )
439
0
        {
440
            // for native widget drawing we must find out what
441
            // control this border belongs to
442
0
            ControlType aCtrlType = ControlType::Generic;
443
0
            ControlPart aCtrlPart = ControlPart::Entire;
444
0
            if (pCtrl && !(pCtrl->GetBorderStyle() & WindowBorderStyle::NONATIVEBORDER))
445
0
            {
446
0
                switch( pCtrl->GetType() )
447
0
                {
448
0
                    case WindowType::LISTBOX:
449
0
                        if( pCtrl->GetStyle() & WB_DROPDOWN )
450
0
                        {
451
0
                            aCtrlType = ControlType::Listbox;
452
0
                            mbNWFBorder = true;
453
0
                            pSubEdit = static_cast<Edit*>(pCtrl)->GetSubEdit();
454
0
                        }
455
0
                        break;
456
0
                    case WindowType::LISTBOXWINDOW:
457
0
                        aCtrlType = ControlType::Listbox;
458
0
                        aCtrlPart = ControlPart::ListboxWindow;
459
0
                        mbNWFBorder = true;
460
0
                        break;
461
0
                    case WindowType::COMBOBOX:
462
0
                        if( pCtrl->GetStyle() & WB_DROPDOWN )
463
0
                        {
464
0
                            aCtrlType = ControlType::Combobox;
465
0
                            mbNWFBorder = true;
466
0
                            pSubEdit = static_cast<Edit*>(pCtrl)->GetSubEdit();
467
0
                        }
468
0
                        break;
469
0
                    case WindowType::MULTILINEEDIT:
470
0
                        aCtrlType = ControlType::MultilineEditbox;
471
0
                        mbNWFBorder = true;
472
0
                        break;
473
0
                    case WindowType::EDIT:
474
0
                    case WindowType::PATTERNFIELD:
475
0
                    case WindowType::METRICFIELD:
476
0
                    case WindowType::CURRENCYFIELD:
477
0
                    case WindowType::DATEFIELD:
478
0
                    case WindowType::TIMEFIELD:
479
0
                    case WindowType::SPINFIELD:
480
0
                    case WindowType::FORMATTEDFIELD:
481
0
                        mbNWFBorder = true;
482
0
                        if (pCtrl->GetStyle() & WB_SPIN)
483
0
                            aCtrlType = ControlType::Spinbox;
484
0
                        else
485
0
                            aCtrlType = ControlType::Editbox;
486
0
                        pSubEdit = static_cast<Edit*>(pCtrl)->GetSubEdit();
487
0
                        break;
488
0
                    default:
489
0
                        break;
490
0
                }
491
0
            }
492
0
            if( mbNWFBorder )
493
0
            {
494
0
                ImplControlValue aControlValue;
495
0
                Size aMinSize( mnWidth, mnHeight );
496
0
                if( aMinSize.Width() < 10 ) aMinSize.setWidth( 10 );
497
0
                if( aMinSize.Height() < 10 ) aMinSize.setHeight( 10 );
498
0
                tools::Rectangle aCtrlRegion( Point(), aMinSize );
499
0
                tools::Rectangle aBounds, aContent;
500
0
                if( pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion,
501
0
                                                  ControlState::ENABLED, aControlValue,
502
0
                                                  aBounds, aContent ) )
503
0
                {
504
0
                    aBounds.AdjustLeft(mnLeftBorder);
505
0
                    aBounds.AdjustRight(-mnRightBorder);
506
0
                    aBounds.AdjustTop(mnTopBorder);
507
0
                    aBounds.AdjustBottom(-mnBottomBorder);
508
0
                    aContent.AdjustLeft(mnLeftBorder);
509
0
                    aContent.AdjustRight(-mnRightBorder);
510
0
                    aContent.AdjustTop(mnTopBorder);
511
0
                    aContent.AdjustBottom(-mnBottomBorder);
512
0
                    mnLeftBorder    = aContent.Left() - aBounds.Left();
513
0
                    mnRightBorder   = aBounds.Right() - aContent.Right();
514
0
                    mnTopBorder     = aContent.Top() - aBounds.Top();
515
0
                    mnBottomBorder  = aBounds.Bottom() - aContent.Bottom();
516
0
                    if( mnWidth && mnHeight )
517
0
                    {
518
519
0
                        mpBorderWindow->SetPaintTransparent( true );
520
0
                        mpBorderWindow->SetBackground();
521
0
                        if (!pCtrl->IsControlBackground())
522
0
                        {
523
0
                            pCtrl->SetPaintTransparent(true);
524
0
                            if (pSubEdit)
525
0
                                pSubEdit->SetPaintTransparent(true);
526
0
                        }
527
528
0
                        vcl::Window* pCompoundParent = nullptr;
529
0
                        if( pWin->GetParent() && pWin->GetParent()->IsCompoundControl() )
530
0
                            pCompoundParent = pWin->GetParent();
531
532
0
                        if( pCompoundParent )
533
0
                            pCompoundParent->SetPaintTransparent( true );
534
535
0
                        if( mnWidth < aBounds.GetWidth() || mnHeight < aBounds.GetHeight() )
536
0
                        {
537
0
                            if( ! pCompoundParent ) // compound controls have to fix themselves
538
0
                            {
539
0
                                Point aPos( mpBorderWindow->GetPosPixel() );
540
0
                                if( mnWidth < aBounds.GetWidth() )
541
0
                                    aPos.AdjustX( -((aBounds.GetWidth() - mnWidth) / 2) );
542
0
                                if( mnHeight < aBounds.GetHeight() )
543
0
                                    aPos.AdjustY( -((aBounds.GetHeight() - mnHeight) / 2) );
544
0
                                mpBorderWindow->SetPosSizePixel( aPos, aBounds.GetSize() );
545
0
                            }
546
0
                        }
547
0
                    }
548
0
                }
549
0
                else
550
0
                    mbNWFBorder = false;
551
0
            }
552
0
        }
553
554
8.32k
        if( ! mbNWFBorder )
555
8.32k
        {
556
8.32k
            DrawFrameStyle nStyle = DrawFrameStyle::NONE;
557
8.32k
            DrawFrameFlags nFlags = DrawFrameFlags::NoDraw;
558
            // move border outside if border was converted or if the BorderWindow is a frame window,
559
8.32k
            if ( mpBorderWindow->mbSmallOutBorder )
560
0
                nStyle = DrawFrameStyle::DoubleOut;
561
8.32k
            else if ( nBorderStyle & WindowBorderStyle::NWF )
562
0
                nStyle = DrawFrameStyle::NWF;
563
8.32k
            else
564
8.32k
                nStyle = DrawFrameStyle::DoubleIn;
565
8.32k
            if ( nBorderStyle & WindowBorderStyle::MONO )
566
0
                nFlags |= DrawFrameFlags::Mono;
567
568
8.32k
            DecorationView  aDecoView( mpOutDev );
569
8.32k
            tools::Rectangle       aRect( 0, 0, 10, 10 );
570
8.32k
            tools::Rectangle       aCalcRect = aDecoView.DrawFrame( aRect, nStyle, nFlags );
571
8.32k
            mnLeftBorder    = aCalcRect.Left();
572
8.32k
            mnTopBorder     = aCalcRect.Top();
573
8.32k
            mnRightBorder   = aRect.Right()-aCalcRect.Right();
574
8.32k
            mnBottomBorder  = aRect.Bottom()-aCalcRect.Bottom();
575
8.32k
        }
576
8.32k
    }
577
578
12.4k
    if (pCtrl)
579
12.4k
    {
580
        //fdo#57090 If the borders have changed, then trigger a queue_resize on
581
        //the bordered window, which will resync its borders at that point
582
12.4k
        if (nOrigLeftBorder != mnLeftBorder ||
583
4.16k
            nOrigTopBorder != mnTopBorder ||
584
4.16k
            nOrigRightBorder != mnRightBorder ||
585
4.16k
            nOrigBottomBorder != mnBottomBorder)
586
8.32k
        {
587
8.32k
            pCtrl->queue_resize();
588
8.32k
        }
589
12.4k
    }
590
12.4k
}
591
592
void ImplSmallBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
593
                                           sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
594
24.9k
{
595
24.9k
    rLeftBorder     = mnLeftBorder;
596
24.9k
    rTopBorder      = mnTopBorder;
597
24.9k
    rRightBorder    = mnRightBorder;
598
24.9k
    rBottomBorder   = mnBottomBorder;
599
24.9k
}
600
601
tools::Long ImplSmallBorderWindowView::CalcTitleWidth() const
602
0
{
603
0
    return 0;
604
0
}
605
606
void ImplSmallBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, const Point*)
607
0
{
608
0
    WindowBorderStyle nBorderStyle = mpBorderWindow->GetBorderStyle();
609
0
    if (nBorderStyle & WindowBorderStyle::NOBORDER)
610
0
        return;
611
612
0
    bool bNativeOK = false;
613
    // for native widget drawing we must find out what
614
    // control this border belongs to
615
0
    vcl::Window* pCtrl = mpBorderWindow->GetWindow(GetWindowType::Client);
616
617
0
    ControlType aCtrlType = ControlType::Generic;
618
0
    ControlPart aCtrlPart = ControlPart::Entire;
619
0
    if (pCtrl)
620
0
    {
621
0
        switch (pCtrl->GetType())
622
0
        {
623
0
            case WindowType::MULTILINEEDIT:
624
0
                aCtrlType = ControlType::MultilineEditbox;
625
0
                break;
626
0
            case WindowType::EDIT:
627
0
            case WindowType::PATTERNFIELD:
628
0
            case WindowType::METRICFIELD:
629
0
            case WindowType::CURRENCYFIELD:
630
0
            case WindowType::DATEFIELD:
631
0
            case WindowType::TIMEFIELD:
632
0
            case WindowType::SPINFIELD:
633
0
            case WindowType::FORMATTEDFIELD:
634
0
                if (pCtrl->GetStyle() & WB_SPIN)
635
0
                    aCtrlType = ControlType::Spinbox;
636
0
                else
637
0
                    aCtrlType = ControlType::Editbox;
638
0
                break;
639
640
0
            case WindowType::LISTBOX:
641
0
            case WindowType::MULTILISTBOX:
642
0
            case WindowType::TREELISTBOX:
643
0
                aCtrlType = ControlType::Listbox;
644
0
                if (pCtrl->GetStyle() & WB_DROPDOWN)
645
0
                    aCtrlPart = ControlPart::Entire;
646
0
                else
647
0
                    aCtrlPart = ControlPart::ListboxWindow;
648
0
                break;
649
650
0
            case WindowType::LISTBOXWINDOW:
651
0
                aCtrlType = ControlType::Listbox;
652
0
                aCtrlPart = ControlPart::ListboxWindow;
653
0
                break;
654
655
0
            case WindowType::COMBOBOX:
656
0
            case WindowType::PATTERNBOX:
657
0
            case WindowType::NUMERICBOX:
658
0
            case WindowType::METRICBOX:
659
0
            case WindowType::CURRENCYBOX:
660
0
            case WindowType::DATEBOX:
661
0
            case WindowType::TIMEBOX:
662
0
            case WindowType::LONGCURRENCYBOX:
663
0
                if (pCtrl->GetStyle() & WB_DROPDOWN)
664
0
                {
665
0
                    aCtrlType = ControlType::Combobox;
666
0
                    aCtrlPart = ControlPart::Entire;
667
0
                }
668
0
                else
669
0
                {
670
0
                    aCtrlType = ControlType::Listbox;
671
0
                    aCtrlPart = ControlPart::ListboxWindow;
672
0
                }
673
0
                break;
674
675
0
            default:
676
0
                break;
677
0
        }
678
0
    }
679
680
0
    if (aCtrlType != ControlType::Generic && pCtrl->IsNativeControlSupported(aCtrlType, aCtrlPart))
681
0
    {
682
0
        ImplControlValue aControlValue;
683
0
        ControlState nState = ControlState::ENABLED;
684
685
0
        if (!mpBorderWindow->IsEnabled())
686
0
            nState &= ~ControlState::ENABLED;
687
0
        if (mpBorderWindow->HasFocus() || pCtrl->HasFocus() || pCtrl->HasChildPathFocus())
688
0
            nState |= ControlState::FOCUSED;
689
690
0
        bool bMouseOver = pCtrl->IsMouseOver();
691
0
        if (!bMouseOver)
692
0
        {
693
0
            vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild);
694
0
            while(pCtrlChild)
695
0
            {
696
0
                bMouseOver = pCtrlChild->IsMouseOver();
697
0
                if (bMouseOver)
698
0
                    break;
699
0
                pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next);
700
0
            }
701
0
        }
702
703
0
        if (bMouseOver)
704
0
            nState |= ControlState::ROLLOVER;
705
706
0
        Point aPoint;
707
0
        tools::Rectangle aCtrlRegion(aPoint, Size(mnWidth, mnHeight));
708
709
0
        tools::Rectangle aBoundingRgn(aPoint, Size(mnWidth, mnHeight));
710
0
        tools::Rectangle aContentRgn(aCtrlRegion);
711
0
        if (!ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize &&
712
0
            rRenderContext.GetNativeControlRegion(aCtrlType, aCtrlPart, aCtrlRegion,
713
0
                                         nState, aControlValue,
714
0
                                         aBoundingRgn, aContentRgn))
715
0
        {
716
0
            aCtrlRegion=aContentRgn;
717
0
        }
718
719
0
        Color aBackgroundColor = COL_AUTO;
720
0
        if (pCtrl->IsControlBackground())
721
0
            aBackgroundColor = pCtrl->GetBackgroundColor();
722
0
        bNativeOK = rRenderContext.DrawNativeControl(aCtrlType, aCtrlPart, aCtrlRegion, nState, aControlValue, OUString(), aBackgroundColor);
723
724
        // if the native theme draws the spinbuttons in one call, make sure the proper settings
725
        // are passed, this might force a redraw though... (TODO: improve)
726
0
        if ((aCtrlType == ControlType::Spinbox) && !pCtrl->IsNativeControlSupported(ControlType::Spinbox, ControlPart::ButtonUp))
727
0
        {
728
0
            Edit* pEdit = static_cast<Edit*>(pCtrl)->GetSubEdit();
729
0
            if (pEdit && !pEdit->SupportsDoubleBuffering())
730
0
                pCtrl->Paint(*pCtrl->GetOutDev(), tools::Rectangle());  // make sure the buttons are also drawn as they might overwrite the border
731
0
        }
732
0
    }
733
734
0
    if (bNativeOK)
735
0
        return;
736
737
0
    DrawFrameStyle nStyle = DrawFrameStyle::NONE;
738
0
    DrawFrameFlags nFlags = DrawFrameFlags::NONE;
739
    // move border outside if border was converted or if the border window is a frame window,
740
0
    if (mpBorderWindow->mbSmallOutBorder)
741
0
        nStyle = DrawFrameStyle::DoubleOut;
742
0
    else if (nBorderStyle & WindowBorderStyle::NWF)
743
0
        nStyle = DrawFrameStyle::NWF;
744
0
    else
745
0
        nStyle = DrawFrameStyle::DoubleIn;
746
0
    if (nBorderStyle & WindowBorderStyle::MONO)
747
0
        nFlags |= DrawFrameFlags::Mono;
748
0
    if (nBorderStyle & WindowBorderStyle::MENU)
749
0
        nFlags |= DrawFrameFlags::Menu;
750
    // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners
751
0
    if (mpBorderWindow == mpBorderWindow->ImplGetFrameWindow())
752
0
        nFlags |= DrawFrameFlags::WindowBorder;
753
754
0
    DecorationView aDecoView(&rRenderContext);
755
0
    tools::Rectangle aInRect(Point(), Size(mnWidth, mnHeight));
756
0
    aDecoView.DrawFrame(aInRect, nStyle, nFlags);
757
0
}
758
759
760
ImplStdBorderWindowView::ImplStdBorderWindowView( ImplBorderWindow* pBorderWindow )
761
0
{
762
0
    maFrameData.mpBorderWindow  = pBorderWindow;
763
0
    maFrameData.mbDragFull      = false;
764
0
    maFrameData.mnHitTest       = BorderWindowHitTest::NONE;
765
0
    maFrameData.mnCloseState    = DrawButtonFlags::NONE;
766
0
    maFrameData.mnDockState     = DrawButtonFlags::NONE;
767
0
    maFrameData.mnMenuState     = DrawButtonFlags::NONE;
768
0
    maFrameData.mnHideState     = DrawButtonFlags::NONE;
769
0
    maFrameData.mnHelpState     = DrawButtonFlags::NONE;
770
0
    maFrameData.mbTitleClipped  = false;
771
0
}
772
773
ImplStdBorderWindowView::~ImplStdBorderWindowView()
774
0
{
775
0
}
776
777
bool ImplStdBorderWindowView::MouseMove( const MouseEvent& rMEvt )
778
0
{
779
0
    ImplMouseMove( &maFrameData, rMEvt );
780
0
    return true;
781
0
}
782
783
bool ImplStdBorderWindowView::MouseButtonDown( const MouseEvent& rMEvt )
784
0
{
785
0
    ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
786
787
0
    if ( rMEvt.IsLeft() || rMEvt.IsRight() )
788
0
    {
789
0
        maFrameData.maMouseOff = rMEvt.GetPosPixel();
790
0
        maFrameData.mnHitTest = ImplHitTest( &maFrameData, maFrameData.maMouseOff );
791
0
        if ( maFrameData.mnHitTest != BorderWindowHitTest::NONE )
792
0
        {
793
0
            DragFullOptions nDragFullTest = DragFullOptions::NONE;
794
0
            bool bTracking = true;
795
0
            bool bHitTest = true;
796
797
0
            if ( maFrameData.mnHitTest & BorderWindowHitTest::Close )
798
0
            {
799
0
                maFrameData.mnCloseState |= DrawButtonFlags::Pressed;
800
0
                pBorderWindow->InvalidateBorder();
801
0
            }
802
0
            else if ( maFrameData.mnHitTest & BorderWindowHitTest::Dock )
803
0
            {
804
0
                maFrameData.mnDockState |= DrawButtonFlags::Pressed;
805
0
                pBorderWindow->InvalidateBorder();
806
0
            }
807
0
            else if ( maFrameData.mnHitTest & BorderWindowHitTest::Menu )
808
0
            {
809
0
                maFrameData.mnMenuState |= DrawButtonFlags::Pressed;
810
0
                pBorderWindow->InvalidateBorder();
811
812
                // call handler already on mouse down
813
0
                if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
814
0
                {
815
0
                    SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
816
0
                    pClientWindow->TitleButtonClick( TitleButton::Menu );
817
0
                }
818
819
0
                maFrameData.mnMenuState &= ~DrawButtonFlags::Pressed;
820
0
                pBorderWindow->InvalidateBorder();
821
822
0
                bTracking = false;
823
0
            }
824
0
            else if ( maFrameData.mnHitTest & BorderWindowHitTest::Hide )
825
0
            {
826
0
                maFrameData.mnHideState |= DrawButtonFlags::Pressed;
827
0
                pBorderWindow->InvalidateBorder();
828
0
            }
829
0
            else if ( maFrameData.mnHitTest & BorderWindowHitTest::Help )
830
0
            {
831
0
                maFrameData.mnHelpState |= DrawButtonFlags::Pressed;
832
0
                pBorderWindow->InvalidateBorder();
833
0
            }
834
0
            else
835
0
            {
836
0
                if ( rMEvt.GetClicks() == 1 )
837
0
                {
838
0
                    Point aPos  = pBorderWindow->GetPosPixel();
839
0
                    Size  aSize = pBorderWindow->GetOutputSizePixel();
840
0
                    maFrameData.mnTrackX      = aPos.X();
841
0
                    maFrameData.mnTrackY      = aPos.Y();
842
0
                    maFrameData.mnTrackWidth  = aSize.Width();
843
0
                    maFrameData.mnTrackHeight = aSize.Height();
844
845
0
                    if (maFrameData.mnHitTest & BorderWindowHitTest::Title)
846
0
                        nDragFullTest = DragFullOptions::WindowMove;
847
0
                    else
848
0
                        nDragFullTest = DragFullOptions::WindowSize;
849
0
                }
850
0
                else
851
0
                {
852
0
                    bTracking = false;
853
854
0
                    if ( (maFrameData.mnHitTest & BorderWindowHitTest::Title) &&
855
0
                         ((rMEvt.GetClicks() % 2) == 0) )
856
0
                    {
857
0
                        maFrameData.mnHitTest = BorderWindowHitTest::NONE;
858
0
                        bHitTest = false;
859
860
0
                        if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
861
0
                        {
862
0
                            SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
863
                            // always perform docking on double click, no button required
864
0
                            pClientWindow->TitleButtonClick( TitleButton::Docking );
865
0
                        }
866
0
                    }
867
0
                }
868
0
            }
869
870
0
            if ( bTracking )
871
0
            {
872
0
                maFrameData.mbDragFull = false;
873
0
                if ( nDragFullTest != DragFullOptions::NONE )
874
0
                    maFrameData.mbDragFull = true;   // always fulldrag for proper docking, ignore system settings
875
0
                pBorderWindow->StartTracking();
876
0
            }
877
0
            else if ( bHitTest )
878
0
                maFrameData.mnHitTest = BorderWindowHitTest::NONE;
879
0
        }
880
0
    }
881
882
0
    return true;
883
0
}
884
885
bool ImplStdBorderWindowView::Tracking( const TrackingEvent& rTEvt )
886
0
{
887
0
    ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
888
889
0
    if ( rTEvt.IsTrackingEnded() )
890
0
    {
891
0
        BorderWindowHitTest nHitTest = maFrameData.mnHitTest;
892
0
        maFrameData.mnHitTest = BorderWindowHitTest::NONE;
893
894
0
        if ( nHitTest & BorderWindowHitTest::Close )
895
0
        {
896
0
            if ( maFrameData.mnCloseState & DrawButtonFlags::Pressed )
897
0
            {
898
0
                maFrameData.mnCloseState &= ~DrawButtonFlags::Pressed;
899
0
                pBorderWindow->InvalidateBorder();
900
901
                // do not call a Click-Handler when aborting
902
0
                if ( !rTEvt.IsTrackingCanceled() )
903
0
                {
904
                    // dispatch to correct window type (why is Close() not virtual ??? )
905
                    // TODO: make Close() virtual
906
0
                    VclPtr<vcl::Window> pWin = pBorderWindow->ImplGetClientWindow()->ImplGetWindow();
907
0
                    SystemWindow  *pSysWin  = dynamic_cast<SystemWindow* >(pWin.get());
908
0
                    DockingWindow *pDockWin = dynamic_cast<DockingWindow*>(pWin.get());
909
0
                    if ( pSysWin )
910
0
                        pSysWin->Close();
911
0
                    else if ( pDockWin )
912
0
                        pDockWin->Close();
913
0
                }
914
0
            }
915
0
        }
916
0
        else if ( nHitTest & BorderWindowHitTest::Dock )
917
0
        {
918
0
            if ( maFrameData.mnDockState & DrawButtonFlags::Pressed )
919
0
            {
920
0
                maFrameData.mnDockState &= ~DrawButtonFlags::Pressed;
921
0
                pBorderWindow->InvalidateBorder();
922
923
                // do not call a Click-Handler when aborting
924
0
                if ( !rTEvt.IsTrackingCanceled() )
925
0
                {
926
0
                    if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
927
0
                    {
928
0
                        SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
929
0
                        pClientWindow->TitleButtonClick( TitleButton::Docking );
930
0
                    }
931
0
                }
932
0
            }
933
0
        }
934
0
        else if ( nHitTest & BorderWindowHitTest::Menu )
935
0
        {
936
0
            if ( maFrameData.mnMenuState & DrawButtonFlags::Pressed )
937
0
            {
938
0
                maFrameData.mnMenuState &= ~DrawButtonFlags::Pressed;
939
0
                pBorderWindow->InvalidateBorder();
940
941
                // handler already called on mouse down
942
0
            }
943
0
        }
944
0
        else if ( nHitTest & BorderWindowHitTest::Hide )
945
0
        {
946
0
            if ( maFrameData.mnHideState & DrawButtonFlags::Pressed )
947
0
            {
948
0
                maFrameData.mnHideState &= ~DrawButtonFlags::Pressed;
949
0
                pBorderWindow->InvalidateBorder();
950
951
                // do not call a Click-Handler when aborting
952
0
                if ( !rTEvt.IsTrackingCanceled() )
953
0
                {
954
0
                    if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
955
0
                    {
956
0
                        SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
957
0
                        pClientWindow->TitleButtonClick( TitleButton::Hide );
958
0
                    }
959
0
                }
960
0
            }
961
0
        }
962
0
        else if ( nHitTest & BorderWindowHitTest::Help )
963
0
        {
964
0
            if ( maFrameData.mnHelpState & DrawButtonFlags::Pressed )
965
0
            {
966
0
                maFrameData.mnHelpState &= ~DrawButtonFlags::Pressed;
967
0
                pBorderWindow->InvalidateBorder();
968
0
            }
969
0
        }
970
0
        else
971
0
        {
972
0
            if ( maFrameData.mbDragFull )
973
0
            {
974
                // restore old state when aborting
975
0
                if ( rTEvt.IsTrackingCanceled() )
976
0
                    pBorderWindow->SetPosSizePixel( Point( maFrameData.mnTrackX, maFrameData.mnTrackY ), Size( maFrameData.mnTrackWidth, maFrameData.mnTrackHeight ) );
977
0
            }
978
0
            else
979
0
            {
980
0
                pBorderWindow->HideTracking();
981
0
                if ( !rTEvt.IsTrackingCanceled() )
982
0
                    pBorderWindow->SetPosSizePixel( Point( maFrameData.mnTrackX, maFrameData.mnTrackY ), Size( maFrameData.mnTrackWidth, maFrameData.mnTrackHeight ) );
983
0
            }
984
985
0
            if ( !rTEvt.IsTrackingCanceled() )
986
0
            {
987
0
                if ( pBorderWindow->ImplGetClientWindow()->ImplIsFloatingWindow() )
988
0
                {
989
0
                    if ( static_cast<FloatingWindow*>(pBorderWindow->ImplGetClientWindow())->IsInPopupMode() )
990
0
                        static_cast<FloatingWindow*>(pBorderWindow->ImplGetClientWindow())->EndPopupMode( FloatWinPopupEndFlags::TearOff );
991
0
                }
992
0
            }
993
0
        }
994
0
    }
995
0
    else if ( !rTEvt.GetMouseEvent().IsSynthetic() )
996
0
    {
997
0
        Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
998
999
0
        if ( maFrameData.mnHitTest & BorderWindowHitTest::Close )
1000
0
        {
1001
0
            if ( maFrameData.maCloseRect.Contains( aMousePos ) )
1002
0
            {
1003
0
                if ( !(maFrameData.mnCloseState & DrawButtonFlags::Pressed) )
1004
0
                {
1005
0
                    maFrameData.mnCloseState |= DrawButtonFlags::Pressed;
1006
0
                    pBorderWindow->InvalidateBorder();
1007
0
                }
1008
0
            }
1009
0
            else
1010
0
            {
1011
0
                if ( maFrameData.mnCloseState & DrawButtonFlags::Pressed )
1012
0
                {
1013
0
                    maFrameData.mnCloseState &= ~DrawButtonFlags::Pressed;
1014
0
                    pBorderWindow->InvalidateBorder();
1015
0
                }
1016
0
            }
1017
0
        }
1018
0
        else if ( maFrameData.mnHitTest & BorderWindowHitTest::Dock )
1019
0
        {
1020
0
            if ( maFrameData.maDockRect.Contains( aMousePos ) )
1021
0
            {
1022
0
                if ( !(maFrameData.mnDockState & DrawButtonFlags::Pressed) )
1023
0
                {
1024
0
                    maFrameData.mnDockState |= DrawButtonFlags::Pressed;
1025
0
                    pBorderWindow->InvalidateBorder();
1026
0
                }
1027
0
            }
1028
0
            else
1029
0
            {
1030
0
                if ( maFrameData.mnDockState & DrawButtonFlags::Pressed )
1031
0
                {
1032
0
                    maFrameData.mnDockState &= ~DrawButtonFlags::Pressed;
1033
0
                    pBorderWindow->InvalidateBorder();
1034
0
                }
1035
0
            }
1036
0
        }
1037
0
        else if ( maFrameData.mnHitTest & BorderWindowHitTest::Menu )
1038
0
        {
1039
0
            if ( maFrameData.maMenuRect.Contains( aMousePos ) )
1040
0
            {
1041
0
                if ( !(maFrameData.mnMenuState & DrawButtonFlags::Pressed) )
1042
0
                {
1043
0
                    maFrameData.mnMenuState |= DrawButtonFlags::Pressed;
1044
0
                    pBorderWindow->InvalidateBorder();
1045
0
                }
1046
0
            }
1047
0
            else
1048
0
            {
1049
0
                if ( maFrameData.mnMenuState & DrawButtonFlags::Pressed )
1050
0
                {
1051
0
                    maFrameData.mnMenuState &= ~DrawButtonFlags::Pressed;
1052
0
                    pBorderWindow->InvalidateBorder();
1053
0
                }
1054
0
            }
1055
0
        }
1056
0
        else if ( maFrameData.mnHitTest & BorderWindowHitTest::Hide )
1057
0
        {
1058
0
            if ( maFrameData.maHideRect.Contains( aMousePos ) )
1059
0
            {
1060
0
                if ( !(maFrameData.mnHideState & DrawButtonFlags::Pressed) )
1061
0
                {
1062
0
                    maFrameData.mnHideState |= DrawButtonFlags::Pressed;
1063
0
                    pBorderWindow->InvalidateBorder();
1064
0
                }
1065
0
            }
1066
0
            else
1067
0
            {
1068
0
                if ( maFrameData.mnHideState & DrawButtonFlags::Pressed )
1069
0
                {
1070
0
                    maFrameData.mnHideState &= ~DrawButtonFlags::Pressed;
1071
0
                    pBorderWindow->InvalidateBorder();
1072
0
                }
1073
0
            }
1074
0
        }
1075
0
        else if ( maFrameData.mnHitTest & BorderWindowHitTest::Help )
1076
0
        {
1077
0
            if ( maFrameData.maHelpRect.Contains( aMousePos ) )
1078
0
            {
1079
0
                if ( !(maFrameData.mnHelpState & DrawButtonFlags::Pressed) )
1080
0
                {
1081
0
                    maFrameData.mnHelpState |= DrawButtonFlags::Pressed;
1082
0
                    pBorderWindow->InvalidateBorder();
1083
0
                }
1084
0
            }
1085
0
            else
1086
0
            {
1087
0
                if ( maFrameData.mnHelpState & DrawButtonFlags::Pressed )
1088
0
                {
1089
0
                    maFrameData.mnHelpState &= ~DrawButtonFlags::Pressed;
1090
0
                    pBorderWindow->InvalidateBorder();
1091
0
                }
1092
0
            }
1093
0
        }
1094
0
        else
1095
0
        {
1096
0
            aMousePos.AdjustX( -(maFrameData.maMouseOff.X()) );
1097
0
            aMousePos.AdjustY( -(maFrameData.maMouseOff.Y()) );
1098
1099
0
            if ( maFrameData.mnHitTest & BorderWindowHitTest::Title )
1100
0
            {
1101
0
                maFrameData.mpBorderWindow->SetPointer( PointerStyle::Move );
1102
1103
0
                Point aPos = pBorderWindow->GetPosPixel();
1104
0
                aPos.AdjustX(aMousePos.X() );
1105
0
                aPos.AdjustY(aMousePos.Y() );
1106
0
                if ( maFrameData.mbDragFull )
1107
0
                {
1108
0
                    pBorderWindow->SetPosPixel( aPos );
1109
0
                    pBorderWindow->ImplUpdateAll();
1110
0
                    pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
1111
0
                }
1112
0
                else
1113
0
                {
1114
0
                    maFrameData.mnTrackX = aPos.X();
1115
0
                    maFrameData.mnTrackY = aPos.Y();
1116
0
                    pBorderWindow->ShowTracking( tools::Rectangle( pBorderWindow->ScreenToOutputPixel( aPos ), pBorderWindow->GetOutputSizePixel() ), ShowTrackFlags::Big );
1117
0
                }
1118
0
            }
1119
0
            else
1120
0
            {
1121
0
                Point       aOldPos         = pBorderWindow->GetPosPixel();
1122
0
                Size        aSize           = pBorderWindow->GetSizePixel();
1123
0
                tools::Rectangle   aNewRect( aOldPos, aSize );
1124
0
                tools::Long        nOldWidth       = aSize.Width();
1125
0
                tools::Long        nOldHeight      = aSize.Height();
1126
0
                tools::Long        nBorderWidth    = maFrameData.mnLeftBorder+maFrameData.mnRightBorder;
1127
0
                tools::Long        nBorderHeight   = maFrameData.mnTopBorder+maFrameData.mnBottomBorder;
1128
0
                tools::Long        nMinWidth       = pBorderWindow->mnMinWidth+nBorderWidth;
1129
0
                tools::Long        nMinHeight      = pBorderWindow->mnMinHeight+nBorderHeight;
1130
0
                tools::Long        nMinWidth2      = nBorderWidth;
1131
0
                tools::Long        nMaxWidth       = pBorderWindow->mnMaxWidth+nBorderWidth;
1132
0
                tools::Long        nMaxHeight      = pBorderWindow->mnMaxHeight+nBorderHeight;
1133
1134
0
                if ( maFrameData.mnTitleHeight )
1135
0
                {
1136
0
                    nMinWidth2 += 4;
1137
1138
0
                    if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
1139
0
                        nMinWidth2 += maFrameData.maCloseRect.GetWidth();
1140
0
                }
1141
0
                if ( nMinWidth2 > nMinWidth )
1142
0
                    nMinWidth = nMinWidth2;
1143
0
                if ( maFrameData.mnHitTest & (BorderWindowHitTest::Left | BorderWindowHitTest::TopLeft | BorderWindowHitTest::BottomLeft) )
1144
0
                {
1145
0
                    aNewRect.AdjustLeft(aMousePos.X() );
1146
0
                    if ( aNewRect.GetWidth() < nMinWidth )
1147
0
                        aNewRect.SetLeft( aNewRect.Right()-nMinWidth+1 );
1148
0
                    else if ( aNewRect.GetWidth() > nMaxWidth )
1149
0
                        aNewRect.SetLeft( aNewRect.Right()-nMaxWidth+1 );
1150
0
                }
1151
0
                else if ( maFrameData.mnHitTest & (BorderWindowHitTest::Right | BorderWindowHitTest::TopRight | BorderWindowHitTest::BottomRight) )
1152
0
                {
1153
0
                    aNewRect.AdjustRight(aMousePos.X() );
1154
0
                    if ( aNewRect.GetWidth() < nMinWidth )
1155
0
                        aNewRect.SetRight( aNewRect.Left()+nMinWidth+1 );
1156
0
                    else if ( aNewRect.GetWidth() > nMaxWidth )
1157
0
                        aNewRect.SetRight( aNewRect.Left()+nMaxWidth+1 );
1158
0
                }
1159
0
                if ( maFrameData.mnHitTest & (BorderWindowHitTest::Top | BorderWindowHitTest::TopLeft | BorderWindowHitTest::TopRight) )
1160
0
                {
1161
0
                    aNewRect.AdjustTop(aMousePos.Y() );
1162
0
                    if ( aNewRect.GetHeight() < nMinHeight )
1163
0
                        aNewRect.SetTop( aNewRect.Bottom()-nMinHeight+1 );
1164
0
                    else if ( aNewRect.GetHeight() > nMaxHeight )
1165
0
                        aNewRect.SetTop( aNewRect.Bottom()-nMaxHeight+1 );
1166
0
                }
1167
0
                else if ( maFrameData.mnHitTest & (BorderWindowHitTest::Bottom | BorderWindowHitTest::BottomLeft | BorderWindowHitTest::BottomRight) )
1168
0
                {
1169
0
                    aNewRect.AdjustBottom(aMousePos.Y() );
1170
0
                    if ( aNewRect.GetHeight() < nMinHeight )
1171
0
                        aNewRect.SetBottom( aNewRect.Top()+nMinHeight+1 );
1172
0
                    else if ( aNewRect.GetHeight() > nMaxHeight )
1173
0
                        aNewRect.SetBottom( aNewRect.Top()+nMaxHeight+1 );
1174
0
                }
1175
1176
                // call Resizing-Handler for SystemWindows
1177
0
                if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
1178
0
                {
1179
                    // adjust size for Resizing-call
1180
0
                    aSize = aNewRect.GetSize();
1181
0
                    aSize.AdjustWidth( -nBorderWidth );
1182
0
                    aSize.AdjustHeight( -nBorderHeight );
1183
0
                    static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow())->Resizing( aSize );
1184
0
                    aSize.AdjustWidth(nBorderWidth );
1185
0
                    aSize.AdjustHeight(nBorderHeight );
1186
0
                    if ( aSize.Width() < nMinWidth )
1187
0
                        aSize.setWidth( nMinWidth );
1188
0
                    if ( aSize.Height() < nMinHeight )
1189
0
                        aSize.setHeight( nMinHeight );
1190
0
                    if ( aSize.Width() > nMaxWidth )
1191
0
                        aSize.setWidth( nMaxWidth );
1192
0
                    if ( aSize.Height() > nMaxHeight )
1193
0
                        aSize.setHeight( nMaxHeight );
1194
0
                    if ( maFrameData.mnHitTest & (BorderWindowHitTest::Left | BorderWindowHitTest::TopLeft | BorderWindowHitTest::BottomLeft) )
1195
0
                        aNewRect.SetLeft( aNewRect.Right()-aSize.Width()+1 );
1196
0
                    else
1197
0
                        aNewRect.SetRight( aNewRect.Left()+aSize.Width()-1 );
1198
0
                    if ( maFrameData.mnHitTest & (BorderWindowHitTest::Top | BorderWindowHitTest::TopLeft | BorderWindowHitTest::TopRight) )
1199
0
                        aNewRect.SetTop( aNewRect.Bottom()-aSize.Height()+1 );
1200
0
                    else
1201
0
                        aNewRect.SetBottom( aNewRect.Top()+aSize.Height()-1 );
1202
0
                }
1203
1204
0
                if ( maFrameData.mbDragFull )
1205
0
                {
1206
                    // no move (only resize) if position did not change
1207
0
                    if( aOldPos != aNewRect.TopLeft() )
1208
0
                        pBorderWindow->setPosSizePixel( aNewRect.Left(), aNewRect.Top(),
1209
0
                                                    aNewRect.GetWidth(), aNewRect.GetHeight() );
1210
0
                    else
1211
0
                        pBorderWindow->setPosSizePixel( aNewRect.Left(), aNewRect.Top(),
1212
0
                                                    aNewRect.GetWidth(), aNewRect.GetHeight(), PosSizeFlags::Size );
1213
1214
0
                    pBorderWindow->ImplUpdateAll();
1215
0
                    pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
1216
0
                    if ( maFrameData.mnHitTest & (BorderWindowHitTest::Right | BorderWindowHitTest::TopRight | BorderWindowHitTest::BottomRight) )
1217
0
                        maFrameData.maMouseOff.AdjustX(aNewRect.GetWidth()-nOldWidth );
1218
0
                    if ( maFrameData.mnHitTest & (BorderWindowHitTest::Bottom | BorderWindowHitTest::BottomLeft | BorderWindowHitTest::BottomRight) )
1219
0
                        maFrameData.maMouseOff.AdjustY(aNewRect.GetHeight()-nOldHeight );
1220
0
                }
1221
0
                else
1222
0
                {
1223
0
                    maFrameData.mnTrackX        = aNewRect.Left();
1224
0
                    maFrameData.mnTrackY        = aNewRect.Top();
1225
0
                    maFrameData.mnTrackWidth    = aNewRect.GetWidth();
1226
0
                    maFrameData.mnTrackHeight   = aNewRect.GetHeight();
1227
0
                    pBorderWindow->ShowTracking( tools::Rectangle( pBorderWindow->ScreenToOutputPixel( aNewRect.TopLeft() ), aNewRect.GetSize() ), ShowTrackFlags::Big );
1228
0
                }
1229
0
            }
1230
0
        }
1231
0
    }
1232
1233
0
    return true;
1234
0
}
1235
1236
OUString ImplStdBorderWindowView::RequestHelp( const Point& rPos, tools::Rectangle& rHelpRect )
1237
0
{
1238
0
    return ImplRequestHelp( &maFrameData, rPos, rHelpRect );
1239
0
}
1240
1241
tools::Rectangle ImplStdBorderWindowView::GetMenuRect() const
1242
0
{
1243
0
    return maFrameData.maMenuRect;
1244
0
}
1245
1246
void ImplStdBorderWindowView::Init( OutputDevice* pDev, tools::Long nWidth, tools::Long nHeight )
1247
0
{
1248
0
    ImplBorderFrameData*    pData = &maFrameData;
1249
0
    ImplBorderWindow*       pBorderWindow = maFrameData.mpBorderWindow;
1250
0
    const StyleSettings&    rStyleSettings = pDev->GetSettings().GetStyleSettings();
1251
0
    DecorationView          aDecoView( pDev );
1252
0
    tools::Rectangle               aRect( 0, 0, 10, 10 );
1253
0
    tools::Rectangle               aCalcRect = aDecoView.DrawFrame( aRect, DrawFrameStyle::DoubleOut, DrawFrameFlags::NoDraw );
1254
1255
0
    pData->mpOutDev         = pDev;
1256
0
    pData->mnWidth          = nWidth;
1257
0
    pData->mnHeight         = nHeight;
1258
1259
0
    pData->mnTitleType      = pBorderWindow->mnTitleType;
1260
1261
0
    if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) || (pData->mnTitleType == BorderWindowTitleType::NONE) )
1262
0
        pData->mnBorderSize = 0;
1263
0
    else if ( pData->mnTitleType == BorderWindowTitleType::Tearoff )
1264
0
        pData->mnBorderSize = 0;
1265
0
    else
1266
0
        pData->mnBorderSize = StyleSettings::GetBorderSize();
1267
0
    pData->mnLeftBorder     = aCalcRect.Left();
1268
0
    pData->mnTopBorder      = aCalcRect.Top();
1269
0
    pData->mnRightBorder    = aRect.Right()-aCalcRect.Right();
1270
0
    pData->mnBottomBorder   = aRect.Bottom()-aCalcRect.Bottom();
1271
0
    pData->mnLeftBorder    += pData->mnBorderSize;
1272
0
    pData->mnTopBorder     += pData->mnBorderSize;
1273
0
    pData->mnRightBorder   += pData->mnBorderSize;
1274
0
    pData->mnBottomBorder  += pData->mnBorderSize;
1275
0
    pData->mnNoTitleTop     = pData->mnTopBorder;
1276
1277
0
    ImplInitTitle(&maFrameData);
1278
0
    if (pData->mnTitleHeight)
1279
0
    {
1280
        // to improve symbol display force a minimum title height
1281
0
        if (pData->mnTitleType != BorderWindowTitleType::Tearoff &&
1282
0
            pData->mnTitleHeight < MIN_CAPTION_HEIGHT)
1283
0
            pData->mnTitleHeight = MIN_CAPTION_HEIGHT;
1284
1285
        // set a proper background for drawing
1286
        // highlighted buttons in the title
1287
0
        pBorderWindow->SetBackground( rStyleSettings.GetFaceColor() );
1288
1289
0
        pData->maTitleRect.SetLeft( pData->mnLeftBorder );
1290
0
        pData->maTitleRect.SetRight( nWidth-pData->mnRightBorder-1 );
1291
0
        pData->maTitleRect.SetTop( pData->mnTopBorder );
1292
0
        pData->maTitleRect.SetBottom( pData->maTitleRect.Top()+pData->mnTitleHeight-1 );
1293
1294
0
        if ( pData->mnTitleType & (BorderWindowTitleType::Normal | BorderWindowTitleType::Small) )
1295
0
        {
1296
0
            tools::Long nRight         = pData->maTitleRect.Right() - 3;
1297
0
            tools::Long const nItemTop = pData->maTitleRect.Top() + 2;
1298
0
            tools::Long const nItemBottom = pData->maTitleRect.Bottom() - 2;
1299
1300
0
            auto addSquareOnRight = [&nRight, nItemTop, nItemBottom](
1301
0
                tools::Rectangle & rect, tools::Long gap)
1302
0
            {
1303
0
                rect.SetTop( nItemTop );
1304
0
                rect.SetBottom( nItemBottom );
1305
0
                rect.SetRight( nRight );
1306
0
                rect.SetLeft( rect.Right() - rect.GetHeight() + 1 );
1307
0
                nRight -= rect.GetWidth() + gap;
1308
0
            };
1309
1310
0
            if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
1311
0
            {
1312
0
                addSquareOnRight(pData->maCloseRect, 3);
1313
0
            }
1314
1315
0
            if ( pBorderWindow->mbMenuBtn )
1316
0
            {
1317
0
                addSquareOnRight(pData->maMenuRect, 0);
1318
0
            }
1319
1320
0
            if ( pBorderWindow->mbDockBtn )
1321
0
            {
1322
0
                addSquareOnRight(pData->maDockRect, 0);
1323
0
            }
1324
1325
0
            if ( pBorderWindow->mbHideBtn )
1326
0
            {
1327
0
                addSquareOnRight(pData->maHideRect, 0);
1328
0
            }
1329
0
        }
1330
0
        else
1331
0
        {
1332
0
            pData->maCloseRect.SetEmpty();
1333
0
            pData->maDockRect.SetEmpty();
1334
0
            pData->maMenuRect.SetEmpty();
1335
0
            pData->maHideRect.SetEmpty();
1336
0
            pData->maHelpRect.SetEmpty();
1337
0
        }
1338
1339
0
        pData->mnTopBorder  += pData->mnTitleHeight;
1340
0
    }
1341
0
    else
1342
0
    {
1343
0
        pData->maTitleRect.SetEmpty();
1344
0
        pData->maCloseRect.SetEmpty();
1345
0
        pData->maDockRect.SetEmpty();
1346
0
        pData->maMenuRect.SetEmpty();
1347
0
        pData->maHideRect.SetEmpty();
1348
0
        pData->maHelpRect.SetEmpty();
1349
0
    }
1350
0
}
1351
1352
void ImplStdBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
1353
                                         sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1354
0
{
1355
0
    rLeftBorder     = maFrameData.mnLeftBorder;
1356
0
    rTopBorder      = maFrameData.mnTopBorder;
1357
0
    rRightBorder    = maFrameData.mnRightBorder;
1358
0
    rBottomBorder   = maFrameData.mnBottomBorder;
1359
0
}
1360
1361
tools::Long ImplStdBorderWindowView::CalcTitleWidth() const
1362
0
{
1363
0
    return ImplCalcTitleWidth( &maFrameData );
1364
0
}
1365
1366
void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset)
1367
0
{
1368
0
    ImplBorderFrameData* pData = &maFrameData;
1369
0
    ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
1370
0
    Point aTmpPoint = pOffset ? *pOffset : Point();
1371
0
    tools::Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
1372
0
    const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
1373
0
    Color aFaceColor(rStyleSettings.GetFaceColor());
1374
0
    Color aFrameColor(aFaceColor);
1375
1376
0
    aFrameColor.DecreaseContrast(sal_uInt8(0.5 * 255));
1377
1378
    // Draw Frame
1379
0
    vcl::Region oldClipRgn(rRenderContext.GetClipRegion());
1380
1381
    // for popups, don't draw part of the frame
1382
0
    const bool bShowJunctionToLauncher = !(pData->mnTitleType & (BorderWindowTitleType::Normal | BorderWindowTitleType::Small));
1383
0
    if (bShowJunctionToLauncher && !ImplGetSVData()->maNWFData.mbNoFrameJunctionForPopups)
1384
0
    {
1385
0
        FloatingWindow* pWin = dynamic_cast<FloatingWindow*>(pData->mpBorderWindow->GetWindow(GetWindowType::Client));
1386
0
        if (pWin)
1387
0
        {
1388
0
            vcl::Region aClipRgn(aInRect);
1389
0
            AbsoluteScreenPixelRectangle aItemClipRect(pWin->ImplGetItemEdgeClipRect());
1390
0
            if (!aItemClipRect.IsEmpty())
1391
0
            {
1392
0
                tools::Rectangle aTmp(pData->mpBorderWindow->AbsoluteScreenToOutputPixel(aItemClipRect.TopLeft()), aItemClipRect.GetSize());
1393
0
                aClipRgn.Exclude(aTmp);
1394
0
                rRenderContext.SetClipRegion(aClipRgn);
1395
0
            }
1396
0
        }
1397
0
    }
1398
1399
    // single line frame
1400
0
    rRenderContext.SetLineColor(aFrameColor);
1401
0
    rRenderContext.SetFillColor();
1402
0
    rRenderContext.DrawRect(aInRect);
1403
0
    aInRect.AdjustLeft( 1 );
1404
0
    aInRect.AdjustRight( -1 );
1405
0
    aInRect.AdjustTop( 1 );
1406
0
    aInRect.AdjustBottom( -1 );
1407
1408
    // restore
1409
0
    if (!(pData->mnTitleType & (BorderWindowTitleType::Normal | BorderWindowTitleType::Small)))
1410
0
        rRenderContext.SetClipRegion(oldClipRgn);
1411
1412
    // Draw Border
1413
0
    rRenderContext.SetLineColor();
1414
0
    tools::Long nBorderSize = pData->mnBorderSize;
1415
0
    if (nBorderSize)
1416
0
    {
1417
0
        rRenderContext.SetFillColor(rStyleSettings.GetFaceColor());
1418
0
        rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Left(), aInRect.Top()),
1419
0
                                 Size(aInRect.GetWidth(), nBorderSize)));
1420
0
        rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Left(), aInRect.Top() + nBorderSize),
1421
0
                                 Size(nBorderSize, aInRect.GetHeight() - nBorderSize)));
1422
0
        rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Left(), aInRect.Bottom() - nBorderSize + 1),
1423
0
                                 Size(aInRect.GetWidth(), nBorderSize)));
1424
0
        rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Right()-nBorderSize + 1, aInRect.Top() + nBorderSize),
1425
0
                                 Size(nBorderSize, aInRect.GetHeight() - nBorderSize)));
1426
0
    }
1427
1428
    // Draw Title
1429
0
    if (!pData->maTitleRect.IsEmpty())
1430
0
    {
1431
0
        aInRect = pData->maTitleRect;
1432
1433
        // use no gradient anymore, just a static titlecolor
1434
0
        if (pData->mnTitleType == BorderWindowTitleType::Tearoff)
1435
0
            rRenderContext.SetFillColor(rStyleSettings.GetFaceGradientColor());
1436
0
        else if (pData->mnTitleType == BorderWindowTitleType::Popup)
1437
0
            rRenderContext.SetFillColor(aFaceColor);
1438
0
        else
1439
0
            rRenderContext.SetFillColor(aFrameColor);
1440
1441
0
        rRenderContext.SetTextColor(rStyleSettings.GetButtonTextColor());
1442
0
        tools::Rectangle aTitleRect(pData->maTitleRect);
1443
0
        if(pOffset)
1444
0
            aTitleRect.Move(pOffset->X(), pOffset->Y());
1445
0
        rRenderContext.DrawRect(aTitleRect);
1446
1447
0
        if (pData->mnTitleType != BorderWindowTitleType::Tearoff)
1448
0
        {
1449
0
            aInRect.AdjustLeft(2 );
1450
0
            aInRect.AdjustRight( -2 );
1451
1452
0
            if (!pData->maHelpRect.IsEmpty())
1453
0
                aInRect.SetRight( pData->maHelpRect.Left() - 2 );
1454
0
            else if (!pData->maHideRect.IsEmpty())
1455
0
                aInRect.SetRight( pData->maHideRect.Left() - 2 );
1456
0
            else if (!pData->maDockRect.IsEmpty())
1457
0
                aInRect.SetRight( pData->maDockRect.Left() - 2 );
1458
0
            else if (!pData->maMenuRect.IsEmpty())
1459
0
                aInRect.SetRight( pData->maMenuRect.Left() - 2 );
1460
0
            else if (!pData->maCloseRect.IsEmpty())
1461
0
                aInRect.SetRight( pData->maCloseRect.Left() - 2 );
1462
1463
0
            if (pOffset)
1464
0
                aInRect.Move(pOffset->X(), pOffset->Y());
1465
1466
0
            DrawTextFlags nTextStyle = DrawTextFlags::Left | DrawTextFlags::VCenter | DrawTextFlags::EndEllipsis | DrawTextFlags::Clip;
1467
1468
            // must show tooltip ?
1469
0
            TextRectInfo aInfo;
1470
0
            rRenderContext.GetTextRect(aInRect, pBorderWindow->GetText(), nTextStyle, &aInfo);
1471
0
            pData->mbTitleClipped = aInfo.IsEllipses();
1472
1473
0
            rRenderContext.DrawText(aInRect, pBorderWindow->GetText(), nTextStyle);
1474
0
        }
1475
0
        else
1476
0
        {
1477
0
            ToolBox::ImplDrawGrip(rRenderContext, aTitleRect, ToolBox::ImplGetDragWidth(rRenderContext, false),
1478
0
                                  WindowAlign::Left, false);
1479
0
        }
1480
0
    }
1481
1482
0
    if (!pData->maCloseRect.IsEmpty())
1483
0
    {
1484
0
        tools::Rectangle aSymbolRect(pData->maCloseRect);
1485
0
        if (pOffset)
1486
0
            aSymbolRect.Move(pOffset->X(), pOffset->Y());
1487
0
        ImplDrawBrdWinSymbolButton(rRenderContext, aSymbolRect, SymbolType::CLOSE, pData->mnCloseState);
1488
0
    }
1489
0
    if (!pData->maDockRect.IsEmpty())
1490
0
    {
1491
0
        tools::Rectangle aSymbolRect(pData->maDockRect);
1492
0
        if (pOffset)
1493
0
            aSymbolRect.Move(pOffset->X(), pOffset->Y());
1494
0
        ImplDrawBrdWinSymbolButton(rRenderContext, aSymbolRect, SymbolType::DOCK, pData->mnDockState);
1495
0
    }
1496
0
    if (!pData->maMenuRect.IsEmpty())
1497
0
    {
1498
0
        tools::Rectangle aSymbolRect(pData->maMenuRect);
1499
0
        if (pOffset)
1500
0
            aSymbolRect.Move(pOffset->X(), pOffset->Y());
1501
0
        ImplDrawBrdWinSymbolButton(rRenderContext, aSymbolRect, SymbolType::MENU, pData->mnMenuState);
1502
0
    }
1503
0
    if (!pData->maHideRect.IsEmpty())
1504
0
    {
1505
0
        tools::Rectangle aSymbolRect(pData->maHideRect);
1506
0
        if (pOffset)
1507
0
            aSymbolRect.Move(pOffset->X(), pOffset->Y());
1508
0
        ImplDrawBrdWinSymbolButton(rRenderContext, aSymbolRect, SymbolType::HIDE, pData->mnHideState);
1509
0
    }
1510
1511
0
    if (!pData->maHelpRect.IsEmpty())
1512
0
    {
1513
0
        tools::Rectangle aSymbolRect(pData->maHelpRect);
1514
0
        if (pOffset)
1515
0
            aSymbolRect.Move(pOffset->X(), pOffset->Y());
1516
0
        ImplDrawBrdWinSymbolButton(rRenderContext, aSymbolRect, SymbolType::HELP, pData->mnHelpState);
1517
0
    }
1518
0
}
1519
1520
void ImplBorderWindow::ImplInit( vcl::Window* pParent,
1521
                                 WinBits nStyle, BorderWindowStyle nTypeStyle,
1522
                                 SystemParentData* pSystemParentData
1523
                                 )
1524
12.7k
{
1525
    // remove all unwanted WindowBits
1526
12.7k
    WinBits nOrgStyle = nStyle;
1527
12.7k
    WinBits nTestStyle = (WB_MOVEABLE | WB_SIZEABLE | WB_CLOSEABLE | WB_STANDALONE | WB_DIALOGCONTROL | WB_NODIALOGCONTROL | WB_SYSTEMFLOATWIN | WB_INTROWIN | WB_DEFAULTWIN | WB_TOOLTIPWIN | WB_NOSHADOW | WB_OWNERDRAWDECORATION | WB_SYSTEMCHILDWINDOW  | WB_POPUP);
1528
12.7k
    if ( nTypeStyle & BorderWindowStyle::App )
1529
0
        nTestStyle |= WB_APP;
1530
12.7k
    nStyle &= nTestStyle;
1531
1532
12.7k
    mpWindowImpl->mbBorderWin       = true;
1533
12.7k
    mbSmallOutBorder    = false;
1534
12.7k
    if ( nTypeStyle & BorderWindowStyle::Frame )
1535
8.57k
    {
1536
8.57k
        mpWindowImpl->mbOverlapWin = true;
1537
8.57k
        mpWindowImpl->mbFrame = true;
1538
1539
8.57k
        if( nStyle & WB_SYSTEMCHILDWINDOW )
1540
0
        {
1541
0
            mbFrameBorder               = false;
1542
0
        }
1543
8.57k
        else if( nStyle & (WB_OWNERDRAWDECORATION | WB_POPUP) )
1544
0
        {
1545
0
            mbFrameBorder   = (nOrgStyle & WB_NOBORDER) == 0;
1546
0
        }
1547
8.57k
        else
1548
8.57k
        {
1549
8.57k
            mbFrameBorder   = false;
1550
            // closeable windows may have a border as well, eg. system floating windows without caption
1551
8.57k
            if ( (nOrgStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE/* | WB_CLOSEABLE*/)) == WB_BORDER )
1552
0
                mbSmallOutBorder = true;
1553
8.57k
        }
1554
8.57k
    }
1555
4.16k
    else if ( nTypeStyle & BorderWindowStyle::Overlap )
1556
0
    {
1557
0
        mpWindowImpl->mbOverlapWin  = true;
1558
0
        mbFrameBorder   = true;
1559
0
    }
1560
4.16k
    else
1561
4.16k
        mbFrameBorder   = false;
1562
1563
12.7k
    if ( nTypeStyle & BorderWindowStyle::Float )
1564
0
        mbFloatWindow = true;
1565
12.7k
    else
1566
12.7k
        mbFloatWindow = false;
1567
1568
12.7k
    Window::ImplInit( pParent, nStyle, pSystemParentData );
1569
12.7k
    SetBackground();
1570
12.7k
    SetTextFillColor();
1571
1572
12.7k
    mpMenuBarWindow = nullptr;
1573
12.7k
    mnMinWidth      = 0;
1574
12.7k
    mnMinHeight     = 0;
1575
12.7k
    mnMaxWidth      = SHRT_MAX;
1576
12.7k
    mnMaxHeight     = SHRT_MAX;
1577
12.7k
    mnOrgMenuHeight = 0;
1578
12.7k
    mbMenuHide      = false;
1579
12.7k
    mbDockBtn       = false;
1580
12.7k
    mbMenuBtn       = false;
1581
12.7k
    mbHideBtn       = false;
1582
12.7k
    mbDisplayActive = IsActive();
1583
1584
12.7k
    if ( nTypeStyle & BorderWindowStyle::Float )
1585
0
        mnTitleType = BorderWindowTitleType::Small;
1586
12.7k
    else
1587
12.7k
        mnTitleType = BorderWindowTitleType::Normal;
1588
12.7k
    mnBorderStyle   = WindowBorderStyle::NORMAL;
1589
12.7k
    InitView();
1590
12.7k
}
1591
1592
ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent,
1593
                                    SystemParentData* pSystemParentData,
1594
                                    WinBits nStyle, BorderWindowStyle nTypeStyle
1595
8.57k
                                    ) : Window( WindowType::BORDERWINDOW )
1596
8.57k
{
1597
8.57k
    ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData );
1598
8.57k
}
Unexecuted instantiation: ImplBorderWindow::ImplBorderWindow(vcl::Window*, SystemParentData*, long, BorderWindowStyle)
ImplBorderWindow::ImplBorderWindow(vcl::Window*, SystemParentData*, long, BorderWindowStyle)
Line
Count
Source
1595
8.57k
                                    ) : Window( WindowType::BORDERWINDOW )
1596
8.57k
{
1597
8.57k
    ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData );
1598
8.57k
}
1599
1600
ImplBorderWindow::ImplBorderWindow( vcl::Window* pParent, WinBits nStyle ,
1601
                                    BorderWindowStyle nTypeStyle ) :
1602
4.16k
    Window( WindowType::BORDERWINDOW )
1603
4.16k
{
1604
4.16k
    ImplInit( pParent, nStyle, nTypeStyle, nullptr );
1605
4.16k
}
Unexecuted instantiation: ImplBorderWindow::ImplBorderWindow(vcl::Window*, long, BorderWindowStyle)
ImplBorderWindow::ImplBorderWindow(vcl::Window*, long, BorderWindowStyle)
Line
Count
Source
1602
4.16k
    Window( WindowType::BORDERWINDOW )
1603
4.16k
{
1604
4.16k
    ImplInit( pParent, nStyle, nTypeStyle, nullptr );
1605
4.16k
}
1606
1607
ImplBorderWindow::~ImplBorderWindow()
1608
8.32k
{
1609
8.32k
    disposeOnce();
1610
8.32k
}
1611
1612
void ImplBorderWindow::dispose()
1613
8.32k
{
1614
8.32k
    mpBorderView.reset();
1615
8.32k
    mpMenuBarWindow.reset();
1616
8.32k
    mpNotebookBar.disposeAndClear();
1617
8.32k
    vcl::Window::dispose();
1618
8.32k
}
1619
1620
void ImplBorderWindow::MouseMove( const MouseEvent& rMEvt )
1621
0
{
1622
0
    if (mpBorderView)
1623
0
        mpBorderView->MouseMove( rMEvt );
1624
0
}
1625
1626
void ImplBorderWindow::MouseButtonDown( const MouseEvent& rMEvt )
1627
0
{
1628
0
    if (mpBorderView)
1629
0
        mpBorderView->MouseButtonDown( rMEvt );
1630
0
}
1631
1632
void ImplBorderWindow::Tracking( const TrackingEvent& rTEvt )
1633
0
{
1634
0
    if (mpBorderView)
1635
0
        mpBorderView->Tracking( rTEvt );
1636
0
}
1637
1638
void ImplBorderWindow::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& )
1639
0
{
1640
0
    if (mpBorderView)
1641
0
        mpBorderView->DrawWindow(rRenderContext);
1642
0
}
1643
1644
void ImplBorderWindow::Draw( OutputDevice* pOutDev, const Point& rPos )
1645
0
{
1646
0
    if (mpBorderView)
1647
0
        mpBorderView->DrawWindow(*pOutDev, &rPos);
1648
0
}
1649
1650
void ImplBorderWindow::Activate()
1651
0
{
1652
0
    SetDisplayActive( true );
1653
0
    Window::Activate();
1654
0
}
1655
1656
void ImplBorderWindow::Deactivate()
1657
8.57k
{
1658
    // remove active windows from the ruler, also ignore the Deactivate
1659
    // if a menu becomes active
1660
8.57k
    if (GetActivateMode() != ActivateModeFlags::NONE && !ImplGetSVData()->mpWinData->mbNoDeactivate)
1661
8.57k
        SetDisplayActive( false );
1662
8.57k
    Window::Deactivate();
1663
8.57k
}
1664
1665
void ImplBorderWindow::RequestHelp( const HelpEvent& rHEvt )
1666
0
{
1667
    // no keyboard help for border window
1668
0
    if ( rHEvt.GetMode() & (HelpEventMode::BALLOON | HelpEventMode::QUICK) && !rHEvt.KeyboardActivated() )
1669
0
    {
1670
0
        Point       aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
1671
0
        tools::Rectangle   aHelpRect;
1672
0
        OUString    aHelpStr( mpBorderView->RequestHelp( aMousePosPixel, aHelpRect ) );
1673
1674
        // retrieve rectangle
1675
0
        if ( !aHelpStr.isEmpty() )
1676
0
        {
1677
0
            aHelpRect.SetPos( OutputToScreenPixel( aHelpRect.TopLeft() ) );
1678
0
            if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
1679
0
                Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aHelpStr );
1680
0
            else
1681
0
                Help::ShowQuickHelp( this, aHelpRect, aHelpStr );
1682
0
            return;
1683
0
        }
1684
0
    }
1685
1686
0
    Window::RequestHelp( rHEvt );
1687
0
}
1688
1689
void ImplBorderWindow::Resize()
1690
4.16k
{
1691
4.16k
    Size aSize = GetOutputSizePixel();
1692
1693
4.16k
    vcl::Window* pClientWindow = ImplGetClientWindow();
1694
1695
4.16k
    sal_Int32 nLeftBorder;
1696
4.16k
    sal_Int32 nTopBorder;
1697
4.16k
    sal_Int32 nRightBorder;
1698
4.16k
    sal_Int32 nBottomBorder;
1699
4.16k
    mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1700
1701
4.16k
    if (mpMenuBarWindow)
1702
0
    {
1703
0
        tools::Long nMenuHeight = mpMenuBarWindow->GetSizePixel().Height();
1704
0
        if ( mbMenuHide )
1705
0
        {
1706
0
            if ( nMenuHeight )
1707
0
                mnOrgMenuHeight = nMenuHeight;
1708
0
            nMenuHeight = 0;
1709
0
        }
1710
0
        else
1711
0
        {
1712
0
            if ( !nMenuHeight )
1713
0
                nMenuHeight = mnOrgMenuHeight;
1714
0
        }
1715
0
        mpMenuBarWindow->setPosSizePixel(
1716
0
                nLeftBorder, nTopBorder,
1717
0
                aSize.Width()-nLeftBorder-nRightBorder,
1718
0
                nMenuHeight);
1719
1720
        // shift the notebookbar down accordingly
1721
0
        nTopBorder += nMenuHeight;
1722
0
    }
1723
1724
4.16k
    if (mpNotebookBar)
1725
0
    {
1726
0
        tools::Long nNotebookBarHeight = mpNotebookBar->GetSizePixel().Height();
1727
0
        mpNotebookBar->setPosSizePixel(
1728
0
                nLeftBorder, nTopBorder,
1729
0
                aSize.Width() - nLeftBorder - nRightBorder,
1730
0
                nNotebookBarHeight);
1731
0
    }
1732
1733
4.16k
    GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder,
1734
4.16k
               pClientWindow->mpWindowImpl->mnRightBorder, pClientWindow->mpWindowImpl->mnBottomBorder );
1735
4.16k
    pClientWindow->ImplPosSizeWindow( pClientWindow->mpWindowImpl->mnLeftBorder,
1736
4.16k
                                      pClientWindow->mpWindowImpl->mnTopBorder,
1737
4.16k
                                      aSize.Width()-pClientWindow->mpWindowImpl->mnLeftBorder-pClientWindow->mpWindowImpl->mnRightBorder,
1738
4.16k
                                      aSize.Height()-pClientWindow->mpWindowImpl->mnTopBorder-pClientWindow->mpWindowImpl->mnBottomBorder,
1739
4.16k
                                      PosSizeFlags::X | PosSizeFlags::Y |
1740
4.16k
                                      PosSizeFlags::Width | PosSizeFlags::Height );
1741
1742
    // UpdateView
1743
4.16k
    mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1744
4.16k
    InvalidateBorder();
1745
1746
4.16k
    Window::Resize();
1747
4.16k
}
1748
1749
void ImplBorderWindow::StateChanged( StateChangedType nType )
1750
12.5k
{
1751
12.5k
    if ( (nType == StateChangedType::Text) ||
1752
8.32k
         (nType == StateChangedType::Data) )
1753
4.19k
    {
1754
4.19k
        if (IsReallyVisible() && mbFrameBorder)
1755
0
            InvalidateBorder();
1756
4.19k
    }
1757
1758
12.5k
    Window::StateChanged( nType );
1759
12.5k
}
1760
1761
void ImplBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
1762
2
{
1763
2
    if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1764
2
         (rDCEvt.GetType() == DataChangedEventType::FONTSUBSTITUTION) ||
1765
2
         ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1766
2
          (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1767
2
    {
1768
2
        if ( !mpWindowImpl->mbFrame || (GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP)) )
1769
0
            UpdateView( true, ImplGetWindow()->GetOutputSizePixel() );
1770
2
    }
1771
1772
2
    Window::DataChanged( rDCEvt );
1773
2
}
1774
1775
void ImplBorderWindow::InitView()
1776
12.7k
{
1777
12.7k
    if ( mbSmallOutBorder )
1778
0
        mpBorderView.reset(new ImplSmallBorderWindowView( this ));
1779
12.7k
    else if ( mpWindowImpl->mbFrame )
1780
8.57k
    {
1781
8.57k
        if( mbFrameBorder )
1782
0
            mpBorderView.reset(new ImplStdBorderWindowView( this ));
1783
8.57k
        else
1784
8.57k
            mpBorderView.reset(new ImplNoBorderWindowView);
1785
8.57k
    }
1786
4.16k
    else if ( !mbFrameBorder )
1787
4.16k
        mpBorderView.reset(new ImplSmallBorderWindowView( this ));
1788
0
    else
1789
0
        mpBorderView.reset(new ImplStdBorderWindowView( this ));
1790
12.7k
    Size aSize = GetOutputSizePixel();
1791
12.7k
    mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1792
12.7k
}
1793
1794
void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize )
1795
4.16k
{
1796
4.16k
    sal_Int32 nLeftBorder;
1797
4.16k
    sal_Int32 nTopBorder;
1798
4.16k
    sal_Int32 nRightBorder;
1799
4.16k
    sal_Int32 nBottomBorder;
1800
4.16k
    Size aOldSize = GetSizePixel();
1801
4.16k
    Size aOutputSize = rNewOutSize;
1802
1803
4.16k
    if ( bNewView )
1804
0
    {
1805
0
        mpBorderView.reset();
1806
0
        InitView();
1807
0
    }
1808
4.16k
    else
1809
4.16k
    {
1810
4.16k
        Size aSize = aOutputSize;
1811
4.16k
        mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1812
4.16k
        aSize.AdjustWidth(nLeftBorder+nRightBorder );
1813
4.16k
        aSize.AdjustHeight(nTopBorder+nBottomBorder );
1814
4.16k
        mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1815
4.16k
    }
1816
1817
4.16k
    vcl::Window* pClientWindow = ImplGetClientWindow();
1818
4.16k
    if ( pClientWindow )
1819
4.16k
    {
1820
4.16k
        GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder,
1821
4.16k
                   pClientWindow->mpWindowImpl->mnRightBorder, pClientWindow->mpWindowImpl->mnBottomBorder );
1822
4.16k
    }
1823
4.16k
    GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1824
4.16k
    if ( aOldSize.Width() || aOldSize.Height() )
1825
0
    {
1826
0
        aOutputSize.AdjustWidth(nLeftBorder+nRightBorder );
1827
0
        aOutputSize.AdjustHeight(nTopBorder+nBottomBorder );
1828
0
        if ( aOutputSize == GetSizePixel() )
1829
0
            InvalidateBorder();
1830
0
        else
1831
0
            SetSizePixel( aOutputSize );
1832
0
    }
1833
4.16k
}
1834
1835
void ImplBorderWindow::InvalidateBorder()
1836
4.16k
{
1837
4.16k
    if ( !IsReallyVisible() )
1838
4.16k
        return;
1839
1840
    // invalidate only if we have a border
1841
0
    sal_Int32 nLeftBorder;
1842
0
    sal_Int32 nTopBorder;
1843
0
    sal_Int32 nRightBorder;
1844
0
    sal_Int32 nBottomBorder;
1845
0
    mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1846
0
    if ( !(nLeftBorder || nTopBorder || nRightBorder || nBottomBorder) )
1847
0
        return;
1848
1849
0
    tools::Rectangle   aWinRect( Point( 0, 0 ), GetOutputSizePixel() );
1850
0
    vcl::Region      aRegion( aWinRect );
1851
0
    aWinRect.AdjustLeft(nLeftBorder );
1852
0
    aWinRect.AdjustTop(nTopBorder );
1853
0
    aWinRect.AdjustRight( -nRightBorder );
1854
0
    aWinRect.AdjustBottom( -nBottomBorder );
1855
    // no output area anymore, now invalidate all
1856
0
    if ( (aWinRect.Right() < aWinRect.Left()) ||
1857
0
         (aWinRect.Bottom() < aWinRect.Top()) )
1858
0
        Invalidate( InvalidateFlags::NoChildren );
1859
0
    else
1860
0
    {
1861
0
        aRegion.Exclude( aWinRect );
1862
0
        Invalidate( aRegion, InvalidateFlags::NoChildren );
1863
0
    }
1864
0
}
1865
1866
void ImplBorderWindow::SetDisplayActive( bool bActive )
1867
8.57k
{
1868
8.57k
    if ( mbDisplayActive != bActive )
1869
0
    {
1870
0
        mbDisplayActive = bActive;
1871
0
        if ( mbFrameBorder )
1872
0
            InvalidateBorder();
1873
0
    }
1874
8.57k
}
1875
1876
void ImplBorderWindow::SetTitleType( BorderWindowTitleType nTitleType, const Size& rSize )
1877
0
{
1878
0
    mnTitleType = nTitleType;
1879
0
    UpdateView( false, rSize );
1880
0
}
1881
1882
void ImplBorderWindow::SetBorderStyle( WindowBorderStyle nStyle )
1883
4.16k
{
1884
4.16k
    if ( !mbFrameBorder && (mnBorderStyle != nStyle) )
1885
4.16k
    {
1886
4.16k
        mnBorderStyle = nStyle;
1887
4.16k
        UpdateView( false, ImplGetWindow()->GetOutputSizePixel() );
1888
4.16k
    }
1889
4.16k
}
1890
1891
void ImplBorderWindow::SetCloseButton()
1892
0
{
1893
0
    SetStyle( GetStyle() | WB_CLOSEABLE );
1894
0
    Size aSize = GetOutputSizePixel();
1895
0
    mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1896
0
    InvalidateBorder();
1897
0
}
1898
1899
void ImplBorderWindow::SetDockButton( bool bDockButton )
1900
0
{
1901
0
    mbDockBtn = bDockButton;
1902
0
    Size aSize = GetOutputSizePixel();
1903
0
    mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1904
0
    InvalidateBorder();
1905
0
}
1906
1907
void ImplBorderWindow::SetHideButton( bool bHideButton )
1908
0
{
1909
0
    mbHideBtn = bHideButton;
1910
0
    Size aSize = GetOutputSizePixel();
1911
0
    mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1912
0
    InvalidateBorder();
1913
0
}
1914
1915
void ImplBorderWindow::SetMenuButton( bool bMenuButton )
1916
0
{
1917
0
    mbMenuBtn = bMenuButton;
1918
0
    Size aSize = GetOutputSizePixel();
1919
0
    mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1920
0
    InvalidateBorder();
1921
0
}
1922
1923
void ImplBorderWindow::UpdateMenuHeight()
1924
0
{
1925
0
    Resize();
1926
0
}
1927
1928
void ImplBorderWindow::SetMenuBarWindow( vcl::Window* pWindow )
1929
0
{
1930
0
    mpMenuBarWindow = pWindow;
1931
0
    UpdateMenuHeight();
1932
0
    if ( pWindow )
1933
0
        pWindow->Show();
1934
0
}
1935
1936
void ImplBorderWindow::SetMenuBarMode( bool bHide )
1937
0
{
1938
0
    mbMenuHide = bHide;
1939
0
    UpdateMenuHeight();
1940
0
}
1941
1942
void ImplBorderWindow::SetNotebookBar(const OUString& rUIXMLDescription,
1943
                                      const css::uno::Reference<css::frame::XFrame>& rFrame,
1944
                                      std::unique_ptr<NotebookBarAddonsItem> pNotebookBarAddonsItem)
1945
0
{
1946
0
    if (mpNotebookBar)
1947
0
        mpNotebookBar.disposeAndClear();
1948
0
    mpNotebookBar = VclPtr<NotebookBar>::Create(this, "NotebookBar", rUIXMLDescription, rFrame,
1949
0
                                                std::move(pNotebookBarAddonsItem));
1950
0
    Resize();
1951
0
}
1952
1953
void ImplBorderWindow::CloseNotebookBar()
1954
0
{
1955
0
    if (mpNotebookBar)
1956
0
        mpNotebookBar.disposeAndClear();
1957
0
    mpNotebookBar = nullptr;
1958
0
    Resize();
1959
0
}
1960
1961
void ImplBorderWindow::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
1962
                                  sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1963
25.2k
{
1964
25.2k
    mpBorderView->GetBorder(rLeftBorder, rTopBorder, rRightBorder, rBottomBorder);
1965
1966
25.2k
    if (mpMenuBarWindow && !mbMenuHide)
1967
0
        rTopBorder += mpMenuBarWindow->GetSizePixel().Height();
1968
1969
25.2k
    if (mpNotebookBar && mpNotebookBar->IsVisible())
1970
0
        rTopBorder += mpNotebookBar->GetSizePixel().Height();
1971
25.2k
}
1972
1973
tools::Long ImplBorderWindow::CalcTitleWidth() const
1974
0
{
1975
0
    return mpBorderView->CalcTitleWidth();
1976
0
}
1977
1978
tools::Rectangle ImplBorderWindow::GetMenuRect() const
1979
0
{
1980
0
    return mpBorderView->GetMenuRect();
1981
0
}
1982
1983
Size ImplBorderWindow::GetOptimalSize() const
1984
0
{
1985
0
    const vcl::Window* pClientWindow = ImplGetClientWindow();
1986
0
    if (pClientWindow)
1987
0
        return pClientWindow->GetOptimalSize();
1988
0
    return Size(mnMinWidth, mnMinHeight);
1989
0
}
1990
1991
void ImplBorderWindow::queue_resize(StateChangedType eReason)
1992
16.6k
{
1993
    //if we are floating, then we don't want to inform our parent that it needs
1994
    //to calculate a new layout allocation. Because while we are a child
1995
    //of our parent we are not embedded into the parent so it doesn't care
1996
    //about us.
1997
16.6k
    if (mbFloatWindow)
1998
0
        return;
1999
16.6k
    vcl::Window::queue_resize(eReason);
2000
16.6k
}
2001
2002
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */