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