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