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