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.Contains( rPos ) )
179  {
180  if ( pData->maCloseRect.Contains( rPos ) )
182  else if ( pData->maMenuRect.Contains( rPos ) )
184  else if ( pData->maDockRect.Contains( rPos ) )
186  else if ( pData->maHideRect.Contains( rPos ) )
188  else if ( pData->maHelpRect.Contains( 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  TranslateId pHelpId;
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;
477  Size aMinSize( mnWidth, mnHeight );
478  if( aMinSize.Width() < 10 ) aMinSize.setWidth( 10 );
479  if( aMinSize.Height() < 10 ) aMinSize.setHeight( 10 );
480  tools::Rectangle aCtrlRegion( Point(), aMinSize );
481  tools::Rectangle aBounds, aContent;
482  if( pWin->GetNativeControlRegion( aCtrlType, aCtrlPart, aCtrlRegion,
483  ControlState::ENABLED, aControlValue,
484  aBounds, aContent ) )
485  {
486  aBounds.AdjustLeft(mnLeftBorder);
487  aBounds.AdjustRight(-mnRightBorder);
488  aBounds.AdjustTop(mnTopBorder);
489  aBounds.AdjustBottom(-mnBottomBorder);
490  aContent.AdjustLeft(mnLeftBorder);
491  aContent.AdjustRight(-mnRightBorder);
492  aContent.AdjustTop(mnTopBorder);
493  aContent.AdjustBottom(-mnBottomBorder);
494  mnLeftBorder = aContent.Left() - aBounds.Left();
495  mnRightBorder = aBounds.Right() - aContent.Right();
496  mnTopBorder = aContent.Top() - aBounds.Top();
497  mnBottomBorder = aBounds.Bottom() - aContent.Bottom();
498  if( mnWidth && mnHeight )
499  {
500 
503  if (!pCtrl->IsControlBackground())
504  pCtrl->SetPaintTransparent(true);
505 
506  vcl::Window* pCompoundParent = nullptr;
507  if( pWin->GetParent() && pWin->GetParent()->IsCompoundControl() )
508  pCompoundParent = pWin->GetParent();
509 
510  if( pCompoundParent )
511  pCompoundParent->SetPaintTransparent( true );
512 
513  if( mnWidth < aBounds.GetWidth() || mnHeight < aBounds.GetHeight() )
514  {
515  if( ! pCompoundParent ) // compound controls have to fix themselves
516  {
517  Point aPos( mpBorderWindow->GetPosPixel() );
518  if( mnWidth < aBounds.GetWidth() )
519  aPos.AdjustX( -((aBounds.GetWidth() - mnWidth) / 2) );
520  if( mnHeight < aBounds.GetHeight() )
521  aPos.AdjustY( -((aBounds.GetHeight() - mnHeight) / 2) );
522  mpBorderWindow->SetPosSizePixel( aPos, aBounds.GetSize() );
523  }
524  }
525  }
526  }
527  else
528  mbNWFBorder = false;
529  }
530  }
531 
532  if( ! mbNWFBorder )
533  {
536  // move border outside if border was converted or if the BorderWindow is a frame window,
538  nStyle = DrawFrameStyle::DoubleOut;
539  else if ( nBorderStyle & WindowBorderStyle::NWF )
540  nStyle = DrawFrameStyle::NWF;
541  else
542  nStyle = DrawFrameStyle::DoubleIn;
543  if ( nBorderStyle & WindowBorderStyle::MONO )
544  nFlags |= DrawFrameFlags::Mono;
545 
546  DecorationView aDecoView( mpOutDev );
547  tools::Rectangle aRect( 0, 0, 10, 10 );
548  tools::Rectangle aCalcRect = aDecoView.DrawFrame( aRect, nStyle, nFlags );
549  mnLeftBorder = aCalcRect.Left();
550  mnTopBorder = aCalcRect.Top();
551  mnRightBorder = aRect.Right()-aCalcRect.Right();
552  mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
553  }
554  }
555 
556  if (pCtrl)
557  {
558  //fdo#57090 If the borders have changed, then trigger a queue_resize on
559  //the bordered window, which will resync its borders at that point
560  if (nOrigLeftBorder != mnLeftBorder ||
561  nOrigTopBorder != mnTopBorder ||
562  nOrigRightBorder != mnRightBorder ||
563  nOrigBottomBorder != mnBottomBorder)
564  {
565  pCtrl->queue_resize();
566  }
567  }
568 }
569 
570 void ImplSmallBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
571  sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
572 {
573  rLeftBorder = mnLeftBorder;
574  rTopBorder = mnTopBorder;
575  rRightBorder = mnRightBorder;
576  rBottomBorder = mnBottomBorder;
577 }
578 
580 {
581  return 0;
582 }
583 
585 {
587  if (nBorderStyle & WindowBorderStyle::NOBORDER)
588  return;
589 
590  bool bNativeOK = false;
591  // for native widget drawing we must find out what
592  // control this border belongs to
594 
595  ControlType aCtrlType = ControlType::Generic;
596  ControlPart aCtrlPart = ControlPart::Entire;
597  if (pCtrl)
598  {
599  switch (pCtrl->GetType())
600  {
601  case WindowType::MULTILINEEDIT:
602  aCtrlType = ControlType::MultilineEditbox;
603  break;
604  case WindowType::EDIT:
605  case WindowType::PATTERNFIELD:
606  case WindowType::METRICFIELD:
607  case WindowType::CURRENCYFIELD:
608  case WindowType::DATEFIELD:
609  case WindowType::TIMEFIELD:
610  case WindowType::SPINFIELD:
611  case WindowType::FORMATTEDFIELD:
612  if (pCtrl->GetStyle() & WB_SPIN)
613  aCtrlType = ControlType::Spinbox;
614  else
615  aCtrlType = ControlType::Editbox;
616  break;
617 
618  case WindowType::LISTBOX:
619  case WindowType::MULTILISTBOX:
620  case WindowType::TREELISTBOX:
621  aCtrlType = ControlType::Listbox;
622  if (pCtrl->GetStyle() & WB_DROPDOWN)
623  aCtrlPart = ControlPart::Entire;
624  else
625  aCtrlPart = ControlPart::ListboxWindow;
626  break;
627 
628  case WindowType::LISTBOXWINDOW:
629  aCtrlType = ControlType::Listbox;
630  aCtrlPart = ControlPart::ListboxWindow;
631  break;
632 
633  case WindowType::COMBOBOX:
634  case WindowType::PATTERNBOX:
635  case WindowType::NUMERICBOX:
636  case WindowType::METRICBOX:
637  case WindowType::CURRENCYBOX:
638  case WindowType::DATEBOX:
639  case WindowType::TIMEBOX:
640  case WindowType::LONGCURRENCYBOX:
641  if (pCtrl->GetStyle() & WB_DROPDOWN)
642  {
643  aCtrlType = ControlType::Combobox;
644  aCtrlPart = ControlPart::Entire;
645  }
646  else
647  {
648  aCtrlType = ControlType::Listbox;
649  aCtrlPart = ControlPart::ListboxWindow;
650  }
651  break;
652 
653  default:
654  break;
655  }
656  }
657 
658  if (aCtrlType != ControlType::Generic && pCtrl->IsNativeControlSupported(aCtrlType, aCtrlPart))
659  {
660  ImplControlValue aControlValue;
662 
663  if (!mpBorderWindow->IsEnabled())
664  nState &= ~ControlState::ENABLED;
665  if (mpBorderWindow->HasFocus())
666  nState |= ControlState::FOCUSED;
667  else if(mbNWFBorder)
668  {
669  // FIXME: this is currently only on macOS, see if other platforms can profit
670 
671  // FIXME: for macOS focus rings all controls need to support GetNativeControlRegion
672  // for the dropdown style
673  if (pCtrl->HasFocus() || pCtrl->HasChildPathFocus())
674  nState |= ControlState::FOCUSED;
675  }
676 
677  bool bMouseOver = false;
678  vcl::Window *pCtrlChild = pCtrl->GetWindow(GetWindowType::FirstChild);
679  while(pCtrlChild)
680  {
681  bMouseOver = pCtrlChild->IsMouseOver();
682  if (bMouseOver)
683  break;
684  pCtrlChild = pCtrlChild->GetWindow(GetWindowType::Next);
685  }
686 
687  if (bMouseOver)
688  nState |= ControlState::ROLLOVER;
689 
690  Point aPoint;
691  tools::Rectangle aCtrlRegion(aPoint, Size(mnWidth, mnHeight));
692 
693  tools::Rectangle aBoundingRgn(aPoint, Size(mnWidth, mnHeight));
694  tools::Rectangle aContentRgn(aCtrlRegion);
695  if (!ImplGetSVData()->maNWFData.mbCanDrawWidgetAnySize &&
696  rRenderContext.GetNativeControlRegion(aCtrlType, aCtrlPart, aCtrlRegion,
697  nState, aControlValue,
698  aBoundingRgn, aContentRgn))
699  {
700  aCtrlRegion=aContentRgn;
701  }
702 
703  Color aBackgroundColor = COL_AUTO;
704  if (pCtrl->IsControlBackground())
705  aBackgroundColor = pCtrl->GetBackgroundColor();
706  bNativeOK = rRenderContext.DrawNativeControl(aCtrlType, aCtrlPart, aCtrlRegion, nState, aControlValue, OUString(), aBackgroundColor);
707 
708  // if the native theme draws the spinbuttons in one call, make sure the proper settings
709  // are passed, this might force a redraw though... (TODO: improve)
711  {
712  Edit* pEdit = static_cast<Edit*>(pCtrl)->GetSubEdit();
713  if (pEdit && !pEdit->SupportsDoubleBuffering())
714  pCtrl->Paint(*pCtrl->GetOutDev(), tools::Rectangle()); // make sure the buttons are also drawn as they might overwrite the border
715  }
716  }
717 
718  if (bNativeOK)
719  return;
720 
723  // move border outside if border was converted or if the border window is a frame window,
725  nStyle = DrawFrameStyle::DoubleOut;
726  else if (nBorderStyle & WindowBorderStyle::NWF)
727  nStyle = DrawFrameStyle::NWF;
728  else
729  nStyle = DrawFrameStyle::DoubleIn;
730  if (nBorderStyle & WindowBorderStyle::MONO)
731  nFlags |= DrawFrameFlags::Mono;
732  if (nBorderStyle & WindowBorderStyle::MENU)
733  nFlags |= DrawFrameFlags::Menu;
734  // tell DrawFrame that we're drawing a window border of a frame window to avoid round corners
737 
738  DecorationView aDecoView(&rRenderContext);
740  aDecoView.DrawFrame(aInRect, nStyle, nFlags);
741 }
742 
743 
745 {
746  maFrameData.mpBorderWindow = pBorderWindow;
747  maFrameData.mbDragFull = false;
754  maFrameData.mbTitleClipped = false;
755 }
756 
758 {
759 }
760 
762 {
763  ImplMouseMove( &maFrameData, rMEvt );
764  return true;
765 }
766 
768 {
770 
771  if ( rMEvt.IsLeft() || rMEvt.IsRight() )
772  {
776  {
777  DragFullOptions nDragFullTest = DragFullOptions::NONE;
778  bool bTracking = true;
779  bool bHitTest = true;
780 
782  {
784  pBorderWindow->InvalidateBorder();
785  }
787  {
789  pBorderWindow->InvalidateBorder();
790  }
792  {
794  pBorderWindow->InvalidateBorder();
795 
796  // call handler already on mouse down
797  if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
798  {
799  SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
800  pClientWindow->TitleButtonClick( TitleButton::Menu );
801  }
802 
804  pBorderWindow->InvalidateBorder();
805 
806  bTracking = false;
807  }
809  {
811  pBorderWindow->InvalidateBorder();
812  }
814  {
816  pBorderWindow->InvalidateBorder();
817  }
818  else
819  {
820  if ( rMEvt.GetClicks() == 1 )
821  {
822  Point aPos = pBorderWindow->GetPosPixel();
823  Size aSize = pBorderWindow->GetOutputSizePixel();
824  maFrameData.mnTrackX = aPos.X();
825  maFrameData.mnTrackY = aPos.Y();
826  maFrameData.mnTrackWidth = aSize.Width();
827  maFrameData.mnTrackHeight = aSize.Height();
828 
830  nDragFullTest = DragFullOptions::WindowMove;
831  else
832  nDragFullTest = DragFullOptions::WindowSize;
833  }
834  else
835  {
836  bTracking = false;
837 
839  ((rMEvt.GetClicks() % 2) == 0) )
840  {
842  bHitTest = false;
843 
844  if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
845  {
846  SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
847  // always perform docking on double click, no button required
848  pClientWindow->TitleButtonClick( TitleButton::Docking );
849  }
850  }
851  }
852  }
853 
854  if ( bTracking )
855  {
856  maFrameData.mbDragFull = false;
857  if ( nDragFullTest != DragFullOptions::NONE )
858  maFrameData.mbDragFull = true; // always fulldrag for proper docking, ignore system settings
859  pBorderWindow->StartTracking();
860  }
861  else if ( bHitTest )
863  }
864  }
865 
866  return true;
867 }
868 
870 {
872 
873  if ( rTEvt.IsTrackingEnded() )
874  {
877 
878  if ( nHitTest & BorderWindowHitTest::Close )
879  {
881  {
883  pBorderWindow->InvalidateBorder();
884 
885  // do not call a Click-Handler when aborting
886  if ( !rTEvt.IsTrackingCanceled() )
887  {
888  // dispatch to correct window type (why is Close() not virtual ??? )
889  // TODO: make Close() virtual
890  VclPtr<vcl::Window> pWin = pBorderWindow->ImplGetClientWindow()->ImplGetWindow();
891  SystemWindow *pSysWin = dynamic_cast<SystemWindow* >(pWin.get());
892  DockingWindow *pDockWin = dynamic_cast<DockingWindow*>(pWin.get());
893  if ( pSysWin )
894  pSysWin->Close();
895  else if ( pDockWin )
896  pDockWin->Close();
897  }
898  }
899  }
900  else if ( nHitTest & BorderWindowHitTest::Dock )
901  {
903  {
905  pBorderWindow->InvalidateBorder();
906 
907  // do not call a Click-Handler when aborting
908  if ( !rTEvt.IsTrackingCanceled() )
909  {
910  if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
911  {
912  SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
913  pClientWindow->TitleButtonClick( TitleButton::Docking );
914  }
915  }
916  }
917  }
918  else if ( nHitTest & BorderWindowHitTest::Menu )
919  {
921  {
923  pBorderWindow->InvalidateBorder();
924 
925  // handler already called on mouse down
926  }
927  }
928  else if ( nHitTest & BorderWindowHitTest::Hide )
929  {
931  {
933  pBorderWindow->InvalidateBorder();
934 
935  // do not call a Click-Handler when aborting
936  if ( !rTEvt.IsTrackingCanceled() )
937  {
938  if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
939  {
940  SystemWindow* pClientWindow = static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow());
941  pClientWindow->TitleButtonClick( TitleButton::Hide );
942  }
943  }
944  }
945  }
946  else if ( nHitTest & BorderWindowHitTest::Help )
947  {
949  {
951  pBorderWindow->InvalidateBorder();
952  }
953  }
954  else
955  {
956  if ( maFrameData.mbDragFull )
957  {
958  // restore old state when aborting
959  if ( rTEvt.IsTrackingCanceled() )
961  }
962  else
963  {
964  pBorderWindow->HideTracking();
965  if ( !rTEvt.IsTrackingCanceled() )
967  }
968 
969  if ( !rTEvt.IsTrackingCanceled() )
970  {
971  if ( pBorderWindow->ImplGetClientWindow()->ImplIsFloatingWindow() )
972  {
973  if ( static_cast<FloatingWindow*>(pBorderWindow->ImplGetClientWindow())->IsInPopupMode() )
974  static_cast<FloatingWindow*>(pBorderWindow->ImplGetClientWindow())->EndPopupMode( FloatWinPopupEndFlags::TearOff );
975  }
976  }
977  }
978  }
979  else if ( !rTEvt.GetMouseEvent().IsSynthetic() )
980  {
981  Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
982 
984  {
985  if ( maFrameData.maCloseRect.Contains( aMousePos ) )
986  {
988  {
990  pBorderWindow->InvalidateBorder();
991  }
992  }
993  else
994  {
996  {
998  pBorderWindow->InvalidateBorder();
999  }
1000  }
1001  }
1003  {
1004  if ( maFrameData.maDockRect.Contains( aMousePos ) )
1005  {
1007  {
1009  pBorderWindow->InvalidateBorder();
1010  }
1011  }
1012  else
1013  {
1015  {
1017  pBorderWindow->InvalidateBorder();
1018  }
1019  }
1020  }
1022  {
1023  if ( maFrameData.maMenuRect.Contains( aMousePos ) )
1024  {
1026  {
1028  pBorderWindow->InvalidateBorder();
1029  }
1030  }
1031  else
1032  {
1034  {
1036  pBorderWindow->InvalidateBorder();
1037  }
1038  }
1039  }
1041  {
1042  if ( maFrameData.maHideRect.Contains( aMousePos ) )
1043  {
1045  {
1047  pBorderWindow->InvalidateBorder();
1048  }
1049  }
1050  else
1051  {
1053  {
1055  pBorderWindow->InvalidateBorder();
1056  }
1057  }
1058  }
1060  {
1061  if ( maFrameData.maHelpRect.Contains( aMousePos ) )
1062  {
1064  {
1066  pBorderWindow->InvalidateBorder();
1067  }
1068  }
1069  else
1070  {
1072  {
1074  pBorderWindow->InvalidateBorder();
1075  }
1076  }
1077  }
1078  else
1079  {
1080  aMousePos.AdjustX( -(maFrameData.maMouseOff.X()) );
1081  aMousePos.AdjustY( -(maFrameData.maMouseOff.Y()) );
1082 
1084  {
1086 
1087  Point aPos = pBorderWindow->GetPosPixel();
1088  aPos.AdjustX(aMousePos.X() );
1089  aPos.AdjustY(aMousePos.Y() );
1090  if ( maFrameData.mbDragFull )
1091  {
1092  pBorderWindow->SetPosPixel( aPos );
1093  pBorderWindow->ImplUpdateAll();
1094  pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
1095  }
1096  else
1097  {
1098  maFrameData.mnTrackX = aPos.X();
1099  maFrameData.mnTrackY = aPos.Y();
1100  pBorderWindow->ShowTracking( tools::Rectangle( pBorderWindow->ScreenToOutputPixel( aPos ), pBorderWindow->GetOutputSizePixel() ), ShowTrackFlags::Big );
1101  }
1102  }
1103  else
1104  {
1105  Point aOldPos = pBorderWindow->GetPosPixel();
1106  Size aSize = pBorderWindow->GetSizePixel();
1107  tools::Rectangle aNewRect( aOldPos, aSize );
1108  tools::Long nOldWidth = aSize.Width();
1109  tools::Long nOldHeight = aSize.Height();
1112  tools::Long nMinWidth = pBorderWindow->mnMinWidth+nBorderWidth;
1113  tools::Long nMinHeight = pBorderWindow->mnMinHeight+nBorderHeight;
1114  tools::Long nMinWidth2 = nBorderWidth;
1115  tools::Long nMaxWidth = pBorderWindow->mnMaxWidth+nBorderWidth;
1116  tools::Long nMaxHeight = pBorderWindow->mnMaxHeight+nBorderHeight;
1117 
1118  if ( maFrameData.mnTitleHeight )
1119  {
1120  nMinWidth2 += 4;
1121 
1122  if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
1123  nMinWidth2 += maFrameData.maCloseRect.GetWidth();
1124  }
1125  if ( nMinWidth2 > nMinWidth )
1126  nMinWidth = nMinWidth2;
1128  {
1129  aNewRect.AdjustLeft(aMousePos.X() );
1130  if ( aNewRect.GetWidth() < nMinWidth )
1131  aNewRect.SetLeft( aNewRect.Right()-nMinWidth+1 );
1132  else if ( aNewRect.GetWidth() > nMaxWidth )
1133  aNewRect.SetLeft( aNewRect.Right()-nMaxWidth+1 );
1134  }
1136  {
1137  aNewRect.AdjustRight(aMousePos.X() );
1138  if ( aNewRect.GetWidth() < nMinWidth )
1139  aNewRect.SetRight( aNewRect.Left()+nMinWidth+1 );
1140  else if ( aNewRect.GetWidth() > nMaxWidth )
1141  aNewRect.SetRight( aNewRect.Left()+nMaxWidth+1 );
1142  }
1144  {
1145  aNewRect.AdjustTop(aMousePos.Y() );
1146  if ( aNewRect.GetHeight() < nMinHeight )
1147  aNewRect.SetTop( aNewRect.Bottom()-nMinHeight+1 );
1148  else if ( aNewRect.GetHeight() > nMaxHeight )
1149  aNewRect.SetTop( aNewRect.Bottom()-nMaxHeight+1 );
1150  }
1152  {
1153  aNewRect.AdjustBottom(aMousePos.Y() );
1154  if ( aNewRect.GetHeight() < nMinHeight )
1155  aNewRect.SetBottom( aNewRect.Top()+nMinHeight+1 );
1156  else if ( aNewRect.GetHeight() > nMaxHeight )
1157  aNewRect.SetBottom( aNewRect.Top()+nMaxHeight+1 );
1158  }
1159 
1160  // call Resizing-Handler for SystemWindows
1161  if ( pBorderWindow->ImplGetClientWindow()->IsSystemWindow() )
1162  {
1163  // adjust size for Resizing-call
1164  aSize = aNewRect.GetSize();
1165  aSize.AdjustWidth( -nBorderWidth );
1166  aSize.AdjustHeight( -nBorderHeight );
1167  static_cast<SystemWindow*>(pBorderWindow->ImplGetClientWindow())->Resizing( aSize );
1168  aSize.AdjustWidth(nBorderWidth );
1169  aSize.AdjustHeight(nBorderHeight );
1170  if ( aSize.Width() < nMinWidth )
1171  aSize.setWidth( nMinWidth );
1172  if ( aSize.Height() < nMinHeight )
1173  aSize.setHeight( nMinHeight );
1174  if ( aSize.Width() > nMaxWidth )
1175  aSize.setWidth( nMaxWidth );
1176  if ( aSize.Height() > nMaxHeight )
1177  aSize.setHeight( nMaxHeight );
1179  aNewRect.SetLeft( aNewRect.Right()-aSize.Width()+1 );
1180  else
1181  aNewRect.SetRight( aNewRect.Left()+aSize.Width()-1 );
1183  aNewRect.SetTop( aNewRect.Bottom()-aSize.Height()+1 );
1184  else
1185  aNewRect.SetBottom( aNewRect.Top()+aSize.Height()-1 );
1186  }
1187 
1188  if ( maFrameData.mbDragFull )
1189  {
1190  // no move (only resize) if position did not change
1191  if( aOldPos != aNewRect.TopLeft() )
1192  pBorderWindow->setPosSizePixel( aNewRect.Left(), aNewRect.Top(),
1193  aNewRect.GetWidth(), aNewRect.GetHeight() );
1194  else
1195  pBorderWindow->setPosSizePixel( aNewRect.Left(), aNewRect.Top(),
1196  aNewRect.GetWidth(), aNewRect.GetHeight(), PosSizeFlags::Size );
1197 
1198  pBorderWindow->ImplUpdateAll();
1199  pBorderWindow->ImplGetFrameWindow()->ImplUpdateAll();
1201  maFrameData.maMouseOff.AdjustX(aNewRect.GetWidth()-nOldWidth );
1203  maFrameData.maMouseOff.AdjustY(aNewRect.GetHeight()-nOldHeight );
1204  }
1205  else
1206  {
1207  maFrameData.mnTrackX = aNewRect.Left();
1208  maFrameData.mnTrackY = aNewRect.Top();
1209  maFrameData.mnTrackWidth = aNewRect.GetWidth();
1210  maFrameData.mnTrackHeight = aNewRect.GetHeight();
1211  pBorderWindow->ShowTracking( tools::Rectangle( pBorderWindow->ScreenToOutputPixel( aNewRect.TopLeft() ), aNewRect.GetSize() ), ShowTrackFlags::Big );
1212  }
1213  }
1214  }
1215  }
1216 
1217  return true;
1218 }
1219 
1220 OUString ImplStdBorderWindowView::RequestHelp( const Point& rPos, tools::Rectangle& rHelpRect )
1221 {
1222  return ImplRequestHelp( &maFrameData, rPos, rHelpRect );
1223 }
1224 
1226 {
1227  return maFrameData.maMenuRect;
1228 }
1229 
1231 {
1233  ImplBorderWindow* pBorderWindow = maFrameData.mpBorderWindow;
1234  const StyleSettings& rStyleSettings = pDev->GetSettings().GetStyleSettings();
1235  DecorationView aDecoView( pDev );
1236  tools::Rectangle aRect( 0, 0, 10, 10 );
1238 
1239  pData->mpOutDev = pDev;
1240  pData->mnWidth = nWidth;
1241  pData->mnHeight = nHeight;
1242 
1243  pData->mnTitleType = pBorderWindow->mnTitleType;
1244 
1245  if ( !(pBorderWindow->GetStyle() & (WB_MOVEABLE | WB_POPUP)) || (pData->mnTitleType == BorderWindowTitleType::NONE) )
1246  pData->mnBorderSize = 0;
1247  else if ( pData->mnTitleType == BorderWindowTitleType::Tearoff )
1248  pData->mnBorderSize = 0;
1249  else
1251  pData->mnLeftBorder = aCalcRect.Left();
1252  pData->mnTopBorder = aCalcRect.Top();
1253  pData->mnRightBorder = aRect.Right()-aCalcRect.Right();
1254  pData->mnBottomBorder = aRect.Bottom()-aCalcRect.Bottom();
1255  pData->mnLeftBorder += pData->mnBorderSize;
1256  pData->mnTopBorder += pData->mnBorderSize;
1257  pData->mnRightBorder += pData->mnBorderSize;
1258  pData->mnBottomBorder += pData->mnBorderSize;
1259  pData->mnNoTitleTop = pData->mnTopBorder;
1260 
1262  if (pData->mnTitleHeight)
1263  {
1264  // to improve symbol display force a minimum title height
1268 
1269  // set a proper background for drawing
1270  // highlighted buttons in the title
1271  pBorderWindow->SetBackground( rStyleSettings.GetFaceColor() );
1272 
1273  pData->maTitleRect.SetLeft( pData->mnLeftBorder );
1274  pData->maTitleRect.SetRight( nWidth-pData->mnRightBorder-1 );
1275  pData->maTitleRect.SetTop( pData->mnTopBorder );
1276  pData->maTitleRect.SetBottom( pData->maTitleRect.Top()+pData->mnTitleHeight-1 );
1277 
1279  {
1280  tools::Long nRight = pData->maTitleRect.Right() - 3;
1281  tools::Long const nItemTop = pData->maTitleRect.Top() + 2;
1282  tools::Long const nItemBottom = pData->maTitleRect.Bottom() - 2;
1283 
1284  auto addSquareOnRight = [&nRight, nItemTop, nItemBottom](
1285  tools::Rectangle & rect, tools::Long gap)
1286  {
1287  rect.SetTop( nItemTop );
1288  rect.SetBottom( nItemBottom );
1289  rect.SetRight( nRight );
1290  rect.SetLeft( rect.Right() - rect.GetHeight() + 1 );
1291  nRight -= rect.GetWidth() + gap;
1292  };
1293 
1294  if ( pBorderWindow->GetStyle() & WB_CLOSEABLE )
1295  {
1296  addSquareOnRight(pData->maCloseRect, 3);
1297  }
1298 
1299  if ( pBorderWindow->mbMenuBtn )
1300  {
1301  addSquareOnRight(pData->maMenuRect, 0);
1302  }
1303 
1304  if ( pBorderWindow->mbDockBtn )
1305  {
1306  addSquareOnRight(pData->maDockRect, 0);
1307  }
1308 
1309  if ( pBorderWindow->mbHideBtn )
1310  {
1311  addSquareOnRight(pData->maHideRect, 0);
1312  }
1313  }
1314  else
1315  {
1316  pData->maCloseRect.SetEmpty();
1317  pData->maDockRect.SetEmpty();
1318  pData->maMenuRect.SetEmpty();
1319  pData->maHideRect.SetEmpty();
1320  pData->maHelpRect.SetEmpty();
1321  }
1322 
1323  pData->mnTopBorder += pData->mnTitleHeight;
1324  }
1325  else
1326  {
1327  pData->maTitleRect.SetEmpty();
1328  pData->maCloseRect.SetEmpty();
1329  pData->maDockRect.SetEmpty();
1330  pData->maMenuRect.SetEmpty();
1331  pData->maHideRect.SetEmpty();
1332  pData->maHelpRect.SetEmpty();
1333  }
1334 }
1335 
1336 void ImplStdBorderWindowView::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
1337  sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1338 {
1339  rLeftBorder = maFrameData.mnLeftBorder;
1340  rTopBorder = maFrameData.mnTopBorder;
1341  rRightBorder = maFrameData.mnRightBorder;
1342  rBottomBorder = maFrameData.mnBottomBorder;
1343 }
1344 
1346 {
1347  return ImplCalcTitleWidth( &maFrameData );
1348 }
1349 
1350 void ImplStdBorderWindowView::DrawWindow(vcl::RenderContext& rRenderContext, const Point* pOffset)
1351 {
1353  ImplBorderWindow* pBorderWindow = pData->mpBorderWindow;
1354  Point aTmpPoint = pOffset ? *pOffset : Point();
1355  tools::Rectangle aInRect( aTmpPoint, Size( pData->mnWidth, pData->mnHeight ) );
1356  const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
1357  Color aFaceColor(rStyleSettings.GetFaceColor());
1358  Color aFrameColor(aFaceColor);
1359 
1360  aFrameColor.DecreaseContrast(sal_uInt8(0.5 * 255));
1361 
1362  // Draw Frame
1363  vcl::Region oldClipRgn(rRenderContext.GetClipRegion());
1364 
1365  // for popups, don't draw part of the frame
1367  {
1369  if (pWin)
1370  {
1371  vcl::Region aClipRgn(aInRect);
1372  tools::Rectangle aItemClipRect(pWin->ImplGetItemEdgeClipRect());
1373  if (!aItemClipRect.IsEmpty())
1374  {
1375  aItemClipRect.SetPos(pData->mpBorderWindow->AbsoluteScreenToOutputPixel(aItemClipRect.TopLeft()));
1376  aClipRgn.Exclude(aItemClipRect);
1377  rRenderContext.SetClipRegion(aClipRgn);
1378  }
1379  }
1380  }
1381 
1382  // single line frame
1383  rRenderContext.SetLineColor(aFrameColor);
1384  rRenderContext.SetFillColor();
1385  rRenderContext.DrawRect(aInRect);
1386  aInRect.AdjustLeft( 1 );
1387  aInRect.AdjustRight( -1 );
1388  aInRect.AdjustTop( 1 );
1389  aInRect.AdjustBottom( -1 );
1390 
1391  // restore
1393  rRenderContext.SetClipRegion(oldClipRgn);
1394 
1395  // Draw Border
1396  rRenderContext.SetLineColor();
1397  tools::Long nBorderSize = pData->mnBorderSize;
1398  if (nBorderSize)
1399  {
1400  rRenderContext.SetFillColor(rStyleSettings.GetFaceColor());
1401  rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Left(), aInRect.Top()),
1402  Size(aInRect.GetWidth(), nBorderSize)));
1403  rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Left(), aInRect.Top() + nBorderSize),
1404  Size(nBorderSize, aInRect.GetHeight() - nBorderSize)));
1405  rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Left(), aInRect.Bottom() - nBorderSize + 1),
1406  Size(aInRect.GetWidth(), nBorderSize)));
1407  rRenderContext.DrawRect(tools::Rectangle(Point(aInRect.Right()-nBorderSize + 1, aInRect.Top() + nBorderSize),
1408  Size(nBorderSize, aInRect.GetHeight() - nBorderSize)));
1409  }
1410 
1411  // Draw Title
1412  if (!pData->maTitleRect.IsEmpty())
1413  {
1414  aInRect = pData->maTitleRect;
1415 
1416  // use no gradient anymore, just a static titlecolor
1418  rRenderContext.SetFillColor(rStyleSettings.GetFaceGradientColor());
1419  else if (pData->mnTitleType == BorderWindowTitleType::Popup)
1420  rRenderContext.SetFillColor(aFaceColor);
1421  else
1422  rRenderContext.SetFillColor(aFrameColor);
1423 
1424  rRenderContext.SetTextColor(rStyleSettings.GetButtonTextColor());
1425  tools::Rectangle aTitleRect(pData->maTitleRect);
1426  if(pOffset)
1427  aTitleRect.Move(pOffset->X(), pOffset->Y());
1428  rRenderContext.DrawRect(aTitleRect);
1429 
1431  {
1432  aInRect.AdjustLeft(2 );
1433  aInRect.AdjustRight( -2 );
1434 
1435  if (!pData->maHelpRect.IsEmpty())
1436  aInRect.SetRight( pData->maHelpRect.Left() - 2 );
1437  else if (!pData->maHideRect.IsEmpty())
1438  aInRect.SetRight( pData->maHideRect.Left() - 2 );
1439  else if (!pData->maDockRect.IsEmpty())
1440  aInRect.SetRight( pData->maDockRect.Left() - 2 );
1441  else if (!pData->maMenuRect.IsEmpty())
1442  aInRect.SetRight( pData->maMenuRect.Left() - 2 );
1443  else if (!pData->maCloseRect.IsEmpty())
1444  aInRect.SetRight( pData->maCloseRect.Left() - 2 );
1445 
1446  if (pOffset)
1447  aInRect.Move(pOffset->X(), pOffset->Y());
1448 
1450 
1451  // must show tooltip ?
1452  TextRectInfo aInfo;
1453  rRenderContext.GetTextRect(aInRect, pBorderWindow->GetText(), nTextStyle, &aInfo);
1454  pData->mbTitleClipped = aInfo.IsEllipses();
1455 
1456  rRenderContext.DrawText(aInRect, pBorderWindow->GetText(), nTextStyle);
1457  }
1458  else
1459  {
1460  ToolBox::ImplDrawGrip(rRenderContext, aTitleRect, ToolBox::ImplGetDragWidth(rRenderContext, false),
1461  WindowAlign::Left, false);
1462  }
1463  }
1464 
1465  if (!pData->maCloseRect.IsEmpty())
1466  {
1467  tools::Rectangle aSymbolRect(pData->maCloseRect);
1468  if (pOffset)
1469  aSymbolRect.Move(pOffset->X(), pOffset->Y());
1470  ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::CLOSE, pData->mnCloseState);
1471  }
1472  if (!pData->maDockRect.IsEmpty())
1473  {
1474  tools::Rectangle aSymbolRect(pData->maDockRect);
1475  if (pOffset)
1476  aSymbolRect.Move(pOffset->X(), pOffset->Y());
1477  ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::DOCK, pData->mnDockState);
1478  }
1479  if (!pData->maMenuRect.IsEmpty())
1480  {
1481  tools::Rectangle aSymbolRect(pData->maMenuRect);
1482  if (pOffset)
1483  aSymbolRect.Move(pOffset->X(), pOffset->Y());
1484  ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::MENU, pData->mnMenuState);
1485  }
1486  if (!pData->maHideRect.IsEmpty())
1487  {
1488  tools::Rectangle aSymbolRect(pData->maHideRect);
1489  if (pOffset)
1490  aSymbolRect.Move(pOffset->X(), pOffset->Y());
1491  ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::HIDE, pData->mnHideState);
1492  }
1493 
1494  if (!pData->maHelpRect.IsEmpty())
1495  {
1496  tools::Rectangle aSymbolRect(pData->maHelpRect);
1497  if (pOffset)
1498  aSymbolRect.Move(pOffset->X(), pOffset->Y());
1499  ImplDrawBrdWinSymbolButton(&rRenderContext, aSymbolRect, SymbolType::HELP, pData->mnHelpState);
1500  }
1501 }
1502 
1504  WinBits nStyle, BorderWindowStyle nTypeStyle,
1505  SystemParentData* pSystemParentData
1506  )
1507 {
1508  // remove all unwanted WindowBits
1509  WinBits nOrgStyle = nStyle;
1511  if ( nTypeStyle & BorderWindowStyle::App )
1512  nTestStyle |= WB_APP;
1513  nStyle &= nTestStyle;
1514 
1515  mpWindowImpl->mbBorderWin = true;
1516  mbSmallOutBorder = false;
1517  if ( nTypeStyle & BorderWindowStyle::Frame )
1518  {
1519  if( nStyle & WB_SYSTEMCHILDWINDOW )
1520  {
1521  mpWindowImpl->mbOverlapWin = true;
1522  mpWindowImpl->mbFrame = true;
1523  mbFrameBorder = false;
1524  }
1525  else if( nStyle & (WB_OWNERDRAWDECORATION | WB_POPUP) )
1526  {
1527  mpWindowImpl->mbOverlapWin = true;
1528  mpWindowImpl->mbFrame = true;
1529  mbFrameBorder = (nOrgStyle & WB_NOBORDER) == 0;
1530  }
1531  else
1532  {
1533  mpWindowImpl->mbOverlapWin = true;
1534  mpWindowImpl->mbFrame = true;
1535  mbFrameBorder = false;
1536  // closeable windows may have a border as well, eg. system floating windows without caption
1537  if ( (nOrgStyle & (WB_BORDER | WB_NOBORDER | WB_MOVEABLE | WB_SIZEABLE/* | WB_CLOSEABLE*/)) == WB_BORDER )
1538  mbSmallOutBorder = true;
1539  }
1540  }
1541  else if ( nTypeStyle & BorderWindowStyle::Overlap )
1542  {
1543  mpWindowImpl->mbOverlapWin = true;
1544  mbFrameBorder = true;
1545  }
1546  else
1547  mbFrameBorder = false;
1548 
1549  if ( nTypeStyle & BorderWindowStyle::Float )
1550  mbFloatWindow = true;
1551  else
1552  mbFloatWindow = false;
1553 
1554  Window::ImplInit( pParent, nStyle, pSystemParentData );
1555  SetBackground();
1556  SetTextFillColor();
1557 
1558  mpMenuBarWindow = nullptr;
1559  mnMinWidth = 0;
1560  mnMinHeight = 0;
1561  mnMaxWidth = SHRT_MAX;
1562  mnMaxHeight = SHRT_MAX;
1563  mnOrgMenuHeight = 0;
1564  mbMenuHide = false;
1565  mbDockBtn = false;
1566  mbMenuBtn = false;
1567  mbHideBtn = false;
1569 
1570  if ( nTypeStyle & BorderWindowStyle::Float )
1572  else
1575  InitView();
1576 }
1577 
1579  SystemParentData* pSystemParentData,
1580  WinBits nStyle, BorderWindowStyle nTypeStyle
1582 {
1583  ImplInit( pParent, nStyle, nTypeStyle, pSystemParentData );
1584 }
1585 
1587  BorderWindowStyle nTypeStyle ) :
1589 {
1590  ImplInit( pParent, nStyle, nTypeStyle, nullptr );
1591 }
1592 
1594 {
1595  disposeOnce();
1596 }
1597 
1599 {
1600  mpBorderView.reset();
1604 }
1605 
1607 {
1608  if (mpBorderView)
1609  mpBorderView->MouseMove( rMEvt );
1610 }
1611 
1613 {
1614  if (mpBorderView)
1615  mpBorderView->MouseButtonDown( rMEvt );
1616 }
1617 
1619 {
1620  if (mpBorderView)
1621  mpBorderView->Tracking( rTEvt );
1622 }
1623 
1625 {
1626  if (mpBorderView)
1627  mpBorderView->DrawWindow(rRenderContext);
1628 }
1629 
1630 void ImplBorderWindow::Draw( OutputDevice* pOutDev, const Point& rPos )
1631 {
1632  if (mpBorderView)
1633  mpBorderView->DrawWindow(*pOutDev, &rPos);
1634 }
1635 
1637 {
1638  SetDisplayActive( true );
1639  Window::Activate();
1640 }
1641 
1643 {
1644  // remove active windows from the ruler, also ignore the Deactivate
1645  // if a menu becomes active
1646  if (GetActivateMode() != ActivateModeFlags::NONE && !ImplGetSVData()->mpWinData->mbNoDeactivate)
1647  SetDisplayActive( false );
1648  Window::Deactivate();
1649 }
1650 
1652 {
1653  // no keyboard help for border window
1654  if ( rHEvt.GetMode() & (HelpEventMode::BALLOON | HelpEventMode::QUICK) && !rHEvt.KeyboardActivated() )
1655  {
1656  Point aMousePosPixel = ScreenToOutputPixel( rHEvt.GetMousePosPixel() );
1657  tools::Rectangle aHelpRect;
1658  OUString aHelpStr( mpBorderView->RequestHelp( aMousePosPixel, aHelpRect ) );
1659 
1660  // retrieve rectangle
1661  if ( !aHelpStr.isEmpty() )
1662  {
1663  aHelpRect.SetPos( OutputToScreenPixel( aHelpRect.TopLeft() ) );
1664  if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
1665  Help::ShowBalloon( this, aHelpRect.Center(), aHelpRect, aHelpStr );
1666  else
1667  Help::ShowQuickHelp( this, aHelpRect, aHelpStr );
1668  return;
1669  }
1670  }
1671 
1672  Window::RequestHelp( rHEvt );
1673 }
1674 
1676 {
1677  Size aSize = GetOutputSizePixel();
1678 
1679  vcl::Window* pClientWindow = ImplGetClientWindow();
1680 
1681  sal_Int32 nLeftBorder;
1682  sal_Int32 nTopBorder;
1683  sal_Int32 nRightBorder;
1684  sal_Int32 nBottomBorder;
1685  mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1686 
1687  if (mpMenuBarWindow)
1688  {
1689  tools::Long nMenuHeight = mpMenuBarWindow->GetSizePixel().Height();
1690  if ( mbMenuHide )
1691  {
1692  if ( nMenuHeight )
1693  mnOrgMenuHeight = nMenuHeight;
1694  nMenuHeight = 0;
1695  }
1696  else
1697  {
1698  if ( !nMenuHeight )
1699  nMenuHeight = mnOrgMenuHeight;
1700  }
1702  nLeftBorder, nTopBorder,
1703  aSize.Width()-nLeftBorder-nRightBorder,
1704  nMenuHeight);
1705 
1706  // shift the notebookbar down accordingly
1707  nTopBorder += nMenuHeight;
1708  }
1709 
1710  if (mpNotebookBar)
1711  {
1712  tools::Long nNotebookBarHeight = mpNotebookBar->GetSizePixel().Height();
1713 
1714  const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
1715  const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
1716  // since size of notebookbar changes, to make common persona for menubar
1717  // and notebookbar persona should be set again with changed coordinates
1718  if (!aPersona.IsEmpty())
1719  {
1720  Wallpaper aWallpaper(aPersona);
1721  aWallpaper.SetStyle(WallpaperStyle::TopRight);
1722  aWallpaper.SetRect(tools::Rectangle(Point(0, -nTopBorder),
1723  Size(aSize.Width() - nLeftBorder - nRightBorder,
1724  nNotebookBarHeight + nTopBorder)));
1725  mpNotebookBar->SetBackground(aWallpaper);
1726  }
1727 
1729  nLeftBorder, nTopBorder,
1730  aSize.Width() - nLeftBorder - nRightBorder,
1731  nNotebookBarHeight);
1732  }
1733 
1734  GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder,
1735  pClientWindow->mpWindowImpl->mnRightBorder, pClientWindow->mpWindowImpl->mnBottomBorder );
1736  pClientWindow->ImplPosSizeWindow( pClientWindow->mpWindowImpl->mnLeftBorder,
1737  pClientWindow->mpWindowImpl->mnTopBorder,
1738  aSize.Width()-pClientWindow->mpWindowImpl->mnLeftBorder-pClientWindow->mpWindowImpl->mnRightBorder,
1739  aSize.Height()-pClientWindow->mpWindowImpl->mnTopBorder-pClientWindow->mpWindowImpl->mnBottomBorder,
1742 
1743  // UpdateView
1744  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1745  InvalidateBorder();
1746 
1747  Window::Resize();
1748 }
1749 
1751 {
1752  if ( (nType == StateChangedType::Text) ||
1753  (nType == StateChangedType::Data) )
1754  {
1755  if (IsReallyVisible() && mbFrameBorder)
1756  InvalidateBorder();
1757  }
1758 
1759  Window::StateChanged( nType );
1760 }
1761 
1763 {
1764  if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1766  ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1767  (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1768  {
1769  if ( !mpWindowImpl->mbFrame || (GetStyle() & (WB_OWNERDRAWDECORATION | WB_POPUP)) )
1771  }
1772 
1773  Window::DataChanged( rDCEvt );
1774 }
1775 
1777 {
1778  if ( mbSmallOutBorder )
1779  mpBorderView.reset(new ImplSmallBorderWindowView( this ));
1780  else if ( mpWindowImpl->mbFrame )
1781  {
1782  if( mbFrameBorder )
1783  mpBorderView.reset(new ImplStdBorderWindowView( this ));
1784  else
1786  }
1787  else if ( !mbFrameBorder )
1788  mpBorderView.reset(new ImplSmallBorderWindowView( this ));
1789  else
1790  mpBorderView.reset(new ImplStdBorderWindowView( this ));
1791  Size aSize = GetOutputSizePixel();
1792  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1793 }
1794 
1795 void ImplBorderWindow::UpdateView( bool bNewView, const Size& rNewOutSize )
1796 {
1797  sal_Int32 nLeftBorder;
1798  sal_Int32 nTopBorder;
1799  sal_Int32 nRightBorder;
1800  sal_Int32 nBottomBorder;
1801  Size aOldSize = GetSizePixel();
1802  Size aOutputSize = rNewOutSize;
1803 
1804  if ( bNewView )
1805  {
1806  mpBorderView.reset();
1807  InitView();
1808  }
1809  else
1810  {
1811  Size aSize = aOutputSize;
1812  mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1813  aSize.AdjustWidth(nLeftBorder+nRightBorder );
1814  aSize.AdjustHeight(nTopBorder+nBottomBorder );
1815  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1816  }
1817 
1818  vcl::Window* pClientWindow = ImplGetClientWindow();
1819  if ( pClientWindow )
1820  {
1821  GetBorder( pClientWindow->mpWindowImpl->mnLeftBorder, pClientWindow->mpWindowImpl->mnTopBorder,
1822  pClientWindow->mpWindowImpl->mnRightBorder, pClientWindow->mpWindowImpl->mnBottomBorder );
1823  }
1824  GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1825  if ( aOldSize.Width() || aOldSize.Height() )
1826  {
1827  aOutputSize.AdjustWidth(nLeftBorder+nRightBorder );
1828  aOutputSize.AdjustHeight(nTopBorder+nBottomBorder );
1829  if ( aOutputSize == GetSizePixel() )
1830  InvalidateBorder();
1831  else
1832  SetSizePixel( aOutputSize );
1833  }
1834 }
1835 
1837 {
1838  if ( !IsReallyVisible() )
1839  return;
1840 
1841  // invalidate only if we have a border
1842  sal_Int32 nLeftBorder;
1843  sal_Int32 nTopBorder;
1844  sal_Int32 nRightBorder;
1845  sal_Int32 nBottomBorder;
1846  mpBorderView->GetBorder( nLeftBorder, nTopBorder, nRightBorder, nBottomBorder );
1847  if ( !(nLeftBorder || nTopBorder || nRightBorder || nBottomBorder) )
1848  return;
1849 
1850  tools::Rectangle aWinRect( Point( 0, 0 ), GetOutputSizePixel() );
1851  vcl::Region aRegion( aWinRect );
1852  aWinRect.AdjustLeft(nLeftBorder );
1853  aWinRect.AdjustTop(nTopBorder );
1854  aWinRect.AdjustRight( -nRightBorder );
1855  aWinRect.AdjustBottom( -nBottomBorder );
1856  // no output area anymore, now invalidate all
1857  if ( (aWinRect.Right() < aWinRect.Left()) ||
1858  (aWinRect.Bottom() < aWinRect.Top()) )
1860  else
1861  {
1862  aRegion.Exclude( aWinRect );
1864  }
1865 }
1866 
1868 {
1869  if ( mbDisplayActive != bActive )
1870  {
1871  mbDisplayActive = bActive;
1872  if ( mbFrameBorder )
1873  InvalidateBorder();
1874  }
1875 }
1876 
1878 {
1879  mnTitleType = nTitleType;
1880  UpdateView( false, rSize );
1881 }
1882 
1884 {
1885  if ( !mbFrameBorder && (mnBorderStyle != nStyle) )
1886  {
1887  mnBorderStyle = nStyle;
1889  }
1890 }
1891 
1893 {
1895  Size aSize = GetOutputSizePixel();
1896  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1897  InvalidateBorder();
1898 }
1899 
1900 void ImplBorderWindow::SetDockButton( bool bDockButton )
1901 {
1902  mbDockBtn = bDockButton;
1903  Size aSize = GetOutputSizePixel();
1904  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1905  InvalidateBorder();
1906 }
1907 
1908 void ImplBorderWindow::SetHideButton( bool bHideButton )
1909 {
1910  mbHideBtn = bHideButton;
1911  Size aSize = GetOutputSizePixel();
1912  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1913  InvalidateBorder();
1914 }
1915 
1916 void ImplBorderWindow::SetMenuButton( bool bMenuButton )
1917 {
1918  mbMenuBtn = bMenuButton;
1919  Size aSize = GetOutputSizePixel();
1920  mpBorderView->Init( GetOutDev(), aSize.Width(), aSize.Height() );
1921  InvalidateBorder();
1922 }
1923 
1925 {
1926  Resize();
1927 }
1928 
1930 {
1931  mpMenuBarWindow = pWindow;
1932  UpdateMenuHeight();
1933  if ( pWindow )
1934  pWindow->Show();
1935 }
1936 
1938 {
1939  mbMenuHide = bHide;
1940  UpdateMenuHeight();
1941 }
1942 
1943 void ImplBorderWindow::SetNotebookBar(const OUString& rUIXMLDescription,
1944  const css::uno::Reference<css::frame::XFrame>& rFrame,
1945  const NotebookBarAddonsItem& aNotebookBarAddonsItem)
1946 {
1947  if (mpNotebookBar)
1949  mpNotebookBar = VclPtr<NotebookBar>::Create(this, "NotebookBar", rUIXMLDescription, rFrame,
1950  aNotebookBarAddonsItem);
1951  Resize();
1952 }
1953 
1955 {
1956  if (mpNotebookBar)
1958  mpNotebookBar = nullptr;
1959  Resize();
1960 }
1961 
1962 void ImplBorderWindow::GetBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder,
1963  sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const
1964 {
1965  mpBorderView->GetBorder(rLeftBorder, rTopBorder, rRightBorder, rBottomBorder);
1966 
1967  if (mpMenuBarWindow && !mbMenuHide)
1968  rTopBorder += mpMenuBarWindow->GetSizePixel().Height();
1969 
1971  rTopBorder += mpNotebookBar->GetSizePixel().Height();
1972 }
1973 
1975 {
1976  return mpBorderView->CalcTitleWidth();
1977 }
1978 
1980 {
1981  return mpBorderView->GetMenuRect();
1982 }
1983 
1985 {
1986  const vcl::Window* pClientWindow = ImplGetClientWindow();
1987  if (pClientWindow)
1988  return pClientWindow->GetOptimalSize();
1989  return Size(mnMinWidth, mnMinHeight);
1990 }
1991 
1993 {
1994  //if we are floating, then we don't want to inform our parent that it needs
1995  //to calculate a new layout allocation. Because while we are a child
1996  //of our parent we are not embedded into the parent so it doesn't care
1997  //about us.
1998  if (mbFloatWindow)
1999  return;
2000  vcl::Window::queue_resize(eReason);
2001 }
2002 
2003 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
tools::Long mnWidth
Definition: brdwin.hxx:185
virtual Point GetPosPixel() const
Definition: window.cxx:2796
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:1110
void CloseNotebookBar()
Definition: brdwin.cxx:1954
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:853
ActivateModeFlags GetActivateMode() const
Definition: window2.cxx:1160
virtual tools::Long CalcTitleWidth() const override
Definition: brdwin.cxx:1345
static BorderWindowHitTest ImplHitTest(ImplBorderFrameData const *pData, const Point &rPos)
Definition: brdwin.cxx:174
SAL_DLLPRIVATE bool ImplIsFloatingWindow() const
Definition: window2.cxx:934
virtual void DrawWindow(vcl::RenderContext &rRenderContext, const Point *pOffset=nullptr) override
Definition: brdwin.cxx:1350
void SetCloseButton()
Definition: brdwin.cxx:1892
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:744
virtual void Deactivate() override
Definition: brdwin.cxx:1642
virtual bool MouseButtonDown(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:767
static tools::Long ImplCalcTitleWidth(const ImplBorderFrameData *pData)
Definition: brdwin.cxx:337
WinBits const WB_NODIALOGCONTROL
constexpr tools::Long Left() const
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: brdwin.cxx:1598
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: brdwin.cxx:1618
bool Contains(const Point &rPOINT) const
std::unique_ptr< sal_Int32[]> pData
BorderWindowTitleType mnTitleType
Definition: brdwin.hxx:204
VclPtr< ImplBorderWindow > mpBorderWindow
Definition: brdwin.hxx:176
Point AbsoluteScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2867
long Long
void disposeAndClear()
Definition: vclptr.hxx:200
void SetDisplayActive(bool bActive)
Definition: brdwin.cxx:1867
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:804
virtual void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const override
Definition: brdwin.cxx:570
virtual void Resize() override
Definition: brdwin.cxx:1675
void HideTracking()
Definition: window2.cxx:150
virtual Size GetSizePixel() const
Definition: window.cxx:2404
SAL_DLLPRIVATE vcl::Window * ImplGetFrameWindow() const
Definition: window2.cxx:924
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1285
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:1836
VclPtr< OutputDevice > mpOutDev
Definition: brdwin.hxx:177
virtual void StateChanged(StateChangedType nType) override
Definition: brdwin.cxx:1750
tools::Rectangle DrawButton(const tools::Rectangle &rRect, DrawButtonFlags nStyle)
Definition: decoview.cxx:898
SAL_DLLPRIVATE void ImplUpdateAll()
Definition: paint.cxx:988
void ImplInit(vcl::Window *pParent, WinBits nStyle, BorderWindowStyle nTypeStyle, SystemParentData *pParentData)
Definition: brdwin.cxx:1503
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: window.cxx:140
constexpr int nBorderWidth
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:251
bool HasChildPathFocus(bool bSystemWindow=false) const
Definition: window.cxx:3009
DrawTextFlags
HelpEventMode GetMode() const
Definition: event.hxx:208
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:1921
#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
SymbolType
Definition: vclenum.hxx:73
void ShowTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags=ShowTrackFlags::Small)
Definition: window2.cxx:127
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 mnMaxWidth
Definition: brdwin.hxx:90
constexpr tools::Long GetWidth() const
virtual tools::Long CalcTitleWidth() const override
Definition: brdwin.cxx:579
virtual void queue_resize(StateChangedType eReason=StateChangedType::Layout)
Definition: window2.cxx:1350
sal_Int32 mnTopBorder
Definition: brdwin.hxx:192
tools::Rectangle maHideRect
Definition: brdwin.hxx:182
virtual OUString GetText() const
Definition: window.cxx:3060
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
OUString VclResId(TranslateId aId)
Definition: svdata.cxx:260
constexpr void SetLeft(tools::Long v)
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:262
tools::Long mnTitleHeight
Definition: brdwin.hxx:197
WinBits const WB_DIALOGCONTROL
bool IsEmpty() const
Definition: BitmapEx.cxx:177
ImplSVData * ImplGetSVData()
Definition: svdata.cxx:76
void UpdateView(bool bNewView, const Size &rNewOutSize)
Definition: brdwin.cxx:1795
void SetLineColor()
Definition: line.cxx:36
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:1220
bool IsLeaveWindow() const
Definition: event.hxx:140
void SetRect(const tools::Rectangle &rRect)
Definition: wall.hxx:84
bool IsSystemWindow() const
Definition: window2.cxx:1020
void DrawSelectionBackground(const tools::Rectangle &rRect, sal_uInt16 highlight, bool bChecked, bool bDrawBorder)
Definition: window.cxx:3464
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: brdwin.cxx:1651
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:1929
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:1143
tools::Long mnBorderSize
Definition: brdwin.hxx:196
friend class ImplSmallBorderWindowView
Definition: brdwin.hxx:81
virtual bool Tracking(const TrackingEvent &rTEvt)
Definition: brdwin.cxx:124
constexpr tools::Long Right() const
void SetFillColor()
Definition: fill.cxx:29
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:175
const AllSettings & GetSettings() const
Definition: window3.cxx:129
virtual ~ImplStdBorderWindowView() override
Definition: brdwin.cxx:757
WindowBorderStyle mnBorderStyle
Definition: brdwin.hxx:94
void SetTextColor(const Color &rColor)
Definition: text.cxx:714
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:483
tools::Long CalcTitleWidth() const
Definition: brdwin.cxx:1974
constexpr tools::Long Top() const
WinBits const WB_TOOLTIPWIN
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: brdwin.cxx:1624
void UpdateMenuHeight()
Definition: brdwin.cxx:1924
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.
constexpr void SetRight(tools::Long v)
WinBits const WB_DROPDOWN
const AllSettings & GetSettings() const
Definition: outdev.hxx:295
void SetPaintTransparent(bool bTransparent)
Definition: paint.cxx:1025
tools::Rectangle GetMenuRect() const
Definition: brdwin.cxx:1979
constexpr void SetBottom(tools::Long v)
BorderWindowHitTest mnHitTest
Definition: brdwin.hxx:198
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:1612
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2814
bool KeyboardActivated() const
Definition: event.hxx:209
void SetBorderStyle(WindowBorderStyle nStyle)
Definition: brdwin.cxx:1883
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:1120
SAL_DLLPRIVATE vcl::Window * ImplGetClientWindow() const
Definition: window2.cxx:888
constexpr void SetTop(tools::Long v)
virtual tools::Rectangle GetMenuRect() const
Definition: brdwin.cxx:134
virtual void Activate() override
Definition: brdwin.cxx:1636
bool IsTrackingEnded() const
Definition: event.hxx:261
void SetStyle(WinBits nStyle)
Definition: window.cxx:1964
bool IsCompoundControl() const
Definition: window2.cxx:1216
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:1291
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: brdwin.cxx:1762
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:335
void SetPointFont(vcl::RenderContext &rRenderContext, const vcl::Font &rFont)
Definition: window.cxx:2175
constexpr tools::Long Bottom() const
void SetNotebookBar(const OUString &rUIXMLDescription, const css::uno::Reference< css::frame::XFrame > &rFrame, const NotebookBarAddonsItem &aNotebookBarAddonsItem)
Definition: brdwin.cxx:1943
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:2668
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:869
void SetMenuBarMode(bool bHide)
Definition: brdwin.cxx:1937
BorderWindowHitTest
Definition: brdwin.hxx:44
void SetPointer(PointerStyle)
Definition: mouse.cxx:486
bool mbSmallOutBorder
Definition: brdwin.hxx:96
bool mbDisplayActive
Definition: brdwin.hxx:102
void Exclude(const tools::Rectangle &rRegion)
Definition: region.cxx:679
constexpr Size GetSize() const
virtual void GetBorder(sal_Int32 &rLeftBorder, sal_Int32 &rTopBorder, sal_Int32 &rRightBorder, sal_Int32 &rBottomBorder) const override
Definition: brdwin.cxx:1336
static sal_Int32 GetBorderSize()
void Draw(OutputDevice *pDev, const Point &rPos)
Definition: brdwin.cxx:1630
bool IsMouseOver() const
Definition: mouse.cxx:620
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:1225
virtual Size GetOptimalSize() const override
Definition: brdwin.cxx:1984
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:1962
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:1908
bool IsVisible() const
Definition: window2.cxx:1125
void SetTitleType(BorderWindowTitleType nTitleType, const Size &rSize)
Definition: brdwin.cxx:1877
void SetDockButton(bool bDockButton)
Definition: brdwin.cxx:1900
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
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
sal_Int32 GetTitleHeight() const
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect)
Definition: paint.cxx:1020
const vcl::Font & GetFloatTitleFont() const
bool IsActive() const
Definition: window2.cxx:1206
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:1230
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:1992
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:997
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:584
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: window3.cxx:66
reference_type * get() const
Get the body.
Definition: vclptr.hxx:143
bool IsEnabled() const
Definition: window2.cxx:1145
ImplBorderWindow(const ImplBorderWindow &)=delete
tools::Long AdjustLeft(tools::Long nHorzMoveDelta)
virtual bool Close()
Definition: dockwin.cxx:625
virtual ~ImplBorderWindow() override
Definition: brdwin.cxx:1593
void DrawSymbol(const tools::Rectangle &rRect, SymbolType eType, const Color &rColor, DrawSymbolFlags nStyle=DrawSymbolFlags::NONE)
Definition: decoview.cxx:761
bool IsTrackingCanceled() const
Definition: event.hxx:263
virtual void TitleButtonClick(TitleButton nButton)
Definition: syswin.cxx:287
WinBits GetStyle() const
Definition: window2.cxx:976
bool IsRight() const
Definition: event.hxx:153
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2808
SAL_DLLPRIVATE int ImplGetDragWidth() const
Definition: toolbox.cxx:152
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:347
const MouseEvent & GetMouseEvent() const
Definition: event.hxx:257
bool IsReallyVisible() const
Definition: window2.cxx:1130
tools::Long mnNoTitleTop
Definition: brdwin.hxx:195
tools::Rectangle maDockRect
Definition: brdwin.hxx:180
bool HasFocus() const
Definition: window.cxx:2986
WinBits const WB_SPIN
bool SupportsDoubleBuffering() const
Can the widget derived from this Window do the double-buffering via RenderContext properly...
Definition: window.cxx:3859
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:795
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:1923
void SetMenuButton(bool bMenuButton)
Definition: brdwin.cxx:1916
sal_Int32 nState
virtual void SetPosPixel(const Point &rNewPos)
Definition: window2.cxx:1280
tools::Long mnTrackWidth
Definition: brdwin.hxx:189
virtual bool MouseMove(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:761
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:249
SAL_DLLPRIVATE void ImplPosSizeWindow(tools::Long nX, tools::Long nY, tools::Long nWidth, tools::Long nHeight, PosSizeFlags nFlags)
Definition: window.cxx:1460
virtual tools::Long CalcTitleWidth() const override
Definition: brdwin.cxx:372
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: brdwin.cxx:1606
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
Definition: help.cxx:157
bool m_bDetectedRangeSegmentation false
constexpr tools::Long GetHeight() const
void Show(bool bVisible=true, ShowFlags nFlags=ShowFlags::NONE)
Definition: window.cxx:2189