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