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