LibreOffice Module vcl (master) 1
headbar.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 <vcl/headbar.hxx>
21#include <rtl/ustrbuf.hxx>
22#include <tools/debug.hxx>
23
24#include <vcl/svapp.hxx>
25#include <vcl/help.hxx>
26#include <vcl/image.hxx>
28#include <vcl/settings.hxx>
29#include <vcl/commandevent.hxx>
30#include <vcl/event.hxx>
31#include <vcl/ptrstyle.hxx>
32
33#include <com/sun/star/accessibility/XAccessible.hpp>
34
36{
37public:
38 sal_uInt16 mnId;
41 OString maHelpId;
43 OUString maOutText;
44 OUString maText;
45 OUString maHelpText;
46};
47
48#define HEAD_ARROWSIZE1 4
49#define HEAD_ARROWSIZE2 7
50
51#define HEADERBAR_TEXTOFF 2
52#define HEADERBAR_ARROWOFF 5
53#define HEADERBAR_SPLITOFF 3
54
55#define HEADERBAR_DRAGOUTOFF 15
56
57#define HEAD_HITTEST_ITEM (sal_uInt16(0x0001))
58#define HEAD_HITTEST_DIVIDER (sal_uInt16(0x0002))
59
61{
62 mnBorderOff1 = 0;
63 mnBorderOff2 = 0;
64 mnOffset = 0;
65 mnDX = 0;
66 mnDY = 0;
67 mnDragSize = 0;
68 mnStartPos = 0;
69 mnDragPos = 0;
70 mnMouseOff = 0;
71 mnCurItemId = 0;
73 mbDrag = false;
74 mbItemDrag = false;
75 mbOutDrag = false;
76 mbItemMode = false;
77
78 // evaluate StyleBits
79 if ( nWinStyle & WB_DRAG )
80 mbDragable = true;
81 else
82 mbDragable = false;
83 if ( nWinStyle & WB_BUTTONSTYLE )
84 mbButtonStyle = true;
85 else
86 mbButtonStyle = false;
87 if ( nWinStyle & WB_BORDER )
88 {
89 mnBorderOff1 = 1;
90 mnBorderOff2 = 1;
91 }
92 else
93 {
94 if ( nWinStyle & WB_BOTTOMBORDER )
95 mnBorderOff2 = 1;
96 }
97
98 ImplInitSettings( true, true, true );
99}
100
102 : Window(pParent, nWinStyle & WB_3DLOOK)
103{
105 ImplInit(nWinStyle);
107}
108
110{
111 return CalcWindowSizePixel();
112}
113
114HeaderBar::~HeaderBar() = default;
115
117{
118 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
119
120 ApplyControlFont(rRenderContext, rStyleSettings.GetToolFont());
121
122 ApplyControlForeground(rRenderContext, rStyleSettings.GetButtonTextColor());
124
125 ApplyControlBackground(rRenderContext, rStyleSettings.GetFaceColor());
126}
127
128void HeaderBar::ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
129{
130 const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
131
132 if (bFont)
133 ApplyControlFont(*GetOutDev(), rStyleSettings.GetToolFont());
134
135 if (bForeground || bFont)
136 {
139 }
140
141 if (bBackground)
142 ApplyControlBackground(*GetOutDev(), rStyleSettings.GetFaceColor());
143}
144
146{
147 tools::Long nX = -mnOffset;
148 for ( size_t i = 0; i < nPos; i++ )
149 nX += mvItemList[ i ]->mnSize;
150 return nX;
151}
152
154{
155 tools::Rectangle aRect( ImplGetItemPos( nPos ), 0, 0, mnDY-1 );
156 aRect.SetRight( aRect.Left() + mvItemList[ nPos ]->mnSize - 1 );
157 // check for overflow on various systems
158 if ( aRect.Right() > 16000 )
159 aRect.SetRight( 16000 );
160 return aRect;
161}
162
163sal_uInt16 HeaderBar::ImplDoHitTest( const Point& rPos,
164 tools::Long& nMouseOff, sal_uInt16& nPos ) const
165{
166 size_t nCount = static_cast<sal_uInt16>(mvItemList.size());
167 bool bLastFixed = true;
168 tools::Long nX = -mnOffset;
169
170 for ( size_t i = 0; i < nCount; i++ )
171 {
172 auto& pItem = mvItemList[ i ];
173
174 if ( rPos.X() < (nX+pItem->mnSize) )
175 {
176 sal_uInt16 nMode;
177
178 if ( !bLastFixed && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) )
179 {
180 nMode = HEAD_HITTEST_DIVIDER;
181 nPos = i-1;
182 nMouseOff = rPos.X()-nX+1;
183 }
184 else
185 {
186 nPos = i;
187
188 if ( rPos.X() >= (nX+pItem->mnSize-HEADERBAR_SPLITOFF) )
189 {
190 nMode = HEAD_HITTEST_DIVIDER;
191 nMouseOff = rPos.X()-(nX+pItem->mnSize);
192 }
193 else
194 {
195 nMode = HEAD_HITTEST_ITEM;
196 nMouseOff = rPos.X()-nX;
197 }
198 }
199
200 return nMode;
201 }
202
203 bLastFixed = false;
204
205 nX += pItem->mnSize;
206 }
207
208 if ( !bLastFixed )
209 {
210 auto& pItem = mvItemList[ nCount-1 ];
211 if ( (pItem->mnSize < 4) && (rPos.X() < (nX+HEADERBAR_SPLITOFF)) )
212 {
213 nPos = nCount-1;
214 nMouseOff = rPos.X()-nX+1;
216 }
217 }
218
219 return 0;
220}
221
222void HeaderBar::ImplInvertDrag( sal_uInt16 nStartPos, sal_uInt16 nEndPos )
223{
224 tools::Rectangle aRect1 = ImplGetItemRect( nStartPos );
225 tools::Rectangle aRect2 = ImplGetItemRect( nEndPos );
226 Point aStartPos = aRect1.Center();
227 Point aEndPos = aStartPos;
228 tools::Rectangle aStartRect( aStartPos.X()-2, aStartPos.Y()-2,
229 aStartPos.X()+2, aStartPos.Y()+2 );
230
231 if ( nEndPos > nStartPos )
232 {
233 aStartPos.AdjustX(3 );
234 aEndPos.setX( aRect2.Right()-6 );
235 }
236 else
237 {
238 aStartPos.AdjustX( -3 );
239 aEndPos.setX( aRect2.Left()+6 );
240 }
241
243 GetOutDev()->DrawRect( aStartRect );
244 GetOutDev()->DrawLine( aStartPos, aEndPos );
245 if ( nEndPos > nStartPos )
246 {
247 GetOutDev()->DrawLine( Point( aEndPos.X()+1, aEndPos.Y()-3 ),
248 Point( aEndPos.X()+1, aEndPos.Y()+3 ) );
249 GetOutDev()->DrawLine( Point( aEndPos.X()+2, aEndPos.Y()-2 ),
250 Point( aEndPos.X()+2, aEndPos.Y()+2 ) );
251 GetOutDev()->DrawLine( Point( aEndPos.X()+3, aEndPos.Y()-1 ),
252 Point( aEndPos.X()+3, aEndPos.Y()+1 ) );
253 GetOutDev()->DrawPixel( Point( aEndPos.X()+4, aEndPos.Y() ) );
254 }
255 else
256 {
257 GetOutDev()->DrawLine( Point( aEndPos.X()-1, aEndPos.Y()-3 ),
258 Point( aEndPos.X()-1, aEndPos.Y()+3 ) );
259 GetOutDev()->DrawLine( Point( aEndPos.X()-2, aEndPos.Y()-2 ),
260 Point( aEndPos.X()-2, aEndPos.Y()+2 ) );
261 GetOutDev()->DrawLine( Point( aEndPos.X()-3, aEndPos.Y()-1 ),
262 Point( aEndPos.X()-3, aEndPos.Y()+1 ) );
263 GetOutDev()->DrawPixel( Point( aEndPos.X()-4, aEndPos.Y() ) );
264 }
266}
267
268void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos, bool bHigh,
269 const tools::Rectangle& rItemRect, const tools::Rectangle* pRect )
270{
271 ImplControlValue aControlValue(0);
272 tools::Rectangle aCtrlRegion;
274
275 tools::Rectangle aRect = rItemRect;
276
277 // do not display if there is no space
278 if (aRect.GetWidth() <= 1)
279 return;
280
281 // check of rectangle is visible
282 if (pRect)
283 {
284 if (aRect.Right() < pRect->Left())
285 return;
286 else if (aRect.Left() > pRect->Right())
287 return;
288 }
289 else
290 {
291 if (aRect.Right() < 0)
292 return;
293 else if (aRect.Left() > mnDX)
294 return;
295 }
296
297 auto& pItem = mvItemList[nPos];
298 HeaderBarItemBits nBits = pItem->mnBits;
299 const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
300
302 {
303 aCtrlRegion = aRect;
305 aCtrlRegion, nState, aControlValue, OUString());
306
307 }
308 else
309 {
310 // do not draw border
311 aRect.AdjustTop(mnBorderOff1 );
312 aRect.AdjustBottom( -mnBorderOff2 );
313
314 // delete background
315 if ( !pRect )
316 {
317 rRenderContext.DrawWallpaper(aRect, rRenderContext.GetBackground());
318 }
319 }
320
321 Color aSelectionTextColor(COL_TRANSPARENT);
322
324 {
325 aCtrlRegion = aRect;
326 aControlValue.setTristateVal(ButtonValue::On);
328 if (bHigh)
331 aCtrlRegion, nState, aControlValue, OUString());
332 }
333 else
334 {
335 // draw separation line
336 rRenderContext.SetLineColor(rStyleSettings.GetDarkShadowColor());
337 rRenderContext.DrawLine(Point(aRect.Right(), aRect.Top()), Point(aRect.Right(), aRect.Bottom()));
338
339 // draw ButtonStyle
340 // avoid 3D borders
341 if (bHigh)
342 vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 1, true, false, false, &aSelectionTextColor);
343 else if (!mbButtonStyle || (nBits & HeaderBarItemBits::FLAT))
344 vcl::RenderTools::DrawSelectionBackground(rRenderContext, *this, aRect, 0, true, false, false, &aSelectionTextColor);
345 }
346
347 // do not draw if there is no space
348 if (aRect.GetWidth() < 1)
349 return;
350
351 // calculate size and position and draw content
352 pItem->maOutText = pItem->maText;
353 Size aImageSize = pItem->maImage.GetSizePixel();
354 Size aTxtSize(rRenderContext.GetTextWidth(pItem->maOutText), 0);
355 if (!pItem->maOutText.isEmpty())
356 aTxtSize.setHeight( rRenderContext.GetTextHeight() );
357 tools::Long nArrowWidth = 0;
359 nArrowWidth = HEAD_ARROWSIZE2 + HEADERBAR_ARROWOFF;
360
361 // do not draw if there is not enough space for the image
362 tools::Long nTestHeight = aImageSize.Height();
364 nTestHeight += aTxtSize.Height();
365 if ((aImageSize.Width() > aRect.GetWidth()) || (nTestHeight > aRect.GetHeight()))
366 {
367 aImageSize.setWidth( 0 );
368 aImageSize.setHeight( 0 );
369 }
370
371 // cut text to correct length
372 bool bLeftText = false;
373 tools::Long nMaxTxtWidth = aRect.GetWidth() - (HEADERBAR_TEXTOFF * 2) - nArrowWidth;
375 nMaxTxtWidth -= aImageSize.Width();
376 tools::Long nTxtWidth = aTxtSize.Width();
377 if (nTxtWidth > nMaxTxtWidth)
378 {
379 bLeftText = true;
380 OUStringBuffer aBuf(pItem->maOutText + "...");
381 do
382 {
383 aBuf.remove(aBuf.getLength() - 3 - 1, 1);
384 nTxtWidth = rRenderContext.GetTextWidth(aBuf.toString());
385 }
386 while ((nTxtWidth > nMaxTxtWidth) && (aBuf.getLength() > 3));
387 pItem->maOutText = aBuf.makeStringAndClear();
388 if (pItem->maOutText.getLength() == 3)
389 {
390 nTxtWidth = 0;
391 pItem->maOutText.clear();
392 }
393 }
394
395 // calculate text/imageposition
396 tools::Long nTxtPos;
397 if (!bLeftText && (nBits & HeaderBarItemBits::RIGHT))
398 {
399 nTxtPos = aRect.Right() - nTxtWidth - HEADERBAR_TEXTOFF;
401 nTxtPos -= aImageSize.Width();
402 }
403 else if (!bLeftText && (nBits & HeaderBarItemBits::CENTER))
404 {
405 tools::Long nTempWidth = nTxtWidth;
407 nTempWidth += aImageSize.Width();
408 nTxtPos = aRect.Left() + (aRect.GetWidth() - nTempWidth) / 2;
410 nTxtPos += aImageSize.Width();
411 if (nArrowWidth)
412 {
413 if (nTxtPos + nTxtWidth + nArrowWidth >= aRect.Right())
414 {
415 nTxtPos = aRect.Left() + HEADERBAR_TEXTOFF;
417 nTxtPos += aImageSize.Width();
418 }
419 }
420 }
421 else
422 {
423 nTxtPos = aRect.Left() + HEADERBAR_TEXTOFF;
425 nTxtPos += aImageSize.Width();
426 if (nBits & HeaderBarItemBits::RIGHT)
427 nTxtPos += nArrowWidth;
428 }
429
430 // calculate text/imageposition
431 tools::Long nTxtPosY = 0;
432 if (!pItem->maOutText.isEmpty() || (nArrowWidth && aTxtSize.Height()))
433 {
434 tools::Long nTempHeight = aTxtSize.Height();
435 nTempHeight += aImageSize.Height();
436 nTxtPosY = aRect.Top()+((aRect.GetHeight()-nTempHeight)/2);
438 nTxtPosY += aImageSize.Height();
439 }
440
441 // display text
442 if (!pItem->maOutText.isEmpty())
443 {
444 if (aSelectionTextColor != COL_TRANSPARENT)
445 {
446 rRenderContext.Push(vcl::PushFlags::TEXTCOLOR);
447 rRenderContext.SetTextColor(aSelectionTextColor);
448 }
449 if (IsEnabled())
450 rRenderContext.DrawText(Point(nTxtPos, nTxtPosY), pItem->maOutText);
451 else
452 rRenderContext.DrawCtrlText(Point(nTxtPos, nTxtPosY), pItem->maOutText, 0, pItem->maOutText.getLength(), DrawTextFlags::Disable);
453 if (aSelectionTextColor != COL_TRANSPARENT)
454 rRenderContext.Pop();
455 }
456
457 // calculate the position and draw image if it is available
458 tools::Long nImagePosY = 0;
459 if (aImageSize.Width() && aImageSize.Height())
460 {
461 tools::Long nImagePos = nTxtPos;
463 {
464 nImagePos -= aImageSize.Width();
465 if (nBits & HeaderBarItemBits::RIGHT)
466 nImagePos -= nArrowWidth;
467 }
468 else if (nBits & HeaderBarItemBits::RIGHTIMAGE)
469 {
470 nImagePos += nTxtWidth;
471 if (!(nBits & HeaderBarItemBits::RIGHT))
472 nImagePos += nArrowWidth;
473 }
474 else
475 {
476 if (nBits & HeaderBarItemBits::RIGHT )
477 nImagePos = aRect.Right()-aImageSize.Width();
478 else if (nBits & HeaderBarItemBits::CENTER)
479 nImagePos = aRect.Left() + (aRect.GetWidth() - aImageSize.Width()) / 2;
480 else
481 nImagePos = aRect.Left() + HEADERBAR_TEXTOFF;
482 }
483
484 tools::Long nTempHeight = aImageSize.Height();
486 nTempHeight += aTxtSize.Height();
487 nImagePosY = aRect.Top() + ((aRect.GetHeight() - nTempHeight) / 2);
488
489 if (nImagePos + aImageSize.Width() <= aRect.Right())
490 {
492 if (!IsEnabled())
493 nStyle |= DrawImageFlags::Disable;
494 rRenderContext.DrawImage(Point(nImagePos, nImagePosY), pItem->maImage, nStyle);
495 }
496 }
497
499 return;
500
501 tools::Long nArrowX = nTxtPos;
502 if (nBits & HeaderBarItemBits::RIGHT)
503 nArrowX -= nArrowWidth;
504 else
505 nArrowX += nTxtWidth + HEADERBAR_ARROWOFF;
506 if (!(nBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && pItem->maText.isEmpty())
507 {
508 if (nBits & HeaderBarItemBits::RIGHT)
509 nArrowX -= aImageSize.Width();
510 else
511 nArrowX += aImageSize.Width();
512 }
513
514 // is there enough space to draw the item?
515 bool bDraw = true;
516 if (nArrowX < aRect.Left() + HEADERBAR_TEXTOFF)
517 bDraw = false;
518 else if (nArrowX + HEAD_ARROWSIZE2 > aRect.Right())
519 bDraw = false;
520
521 if (!bDraw)
522 return;
523
525 {
526 aCtrlRegion = tools::Rectangle(Point(nArrowX, aRect.Top()), Size(nArrowWidth, aRect.GetHeight()));
527 // control value passes 1 if arrow points down, 0 otherwise
528 aControlValue.setNumericVal((nBits & HeaderBarItemBits::DOWNARROW) ? 1 : 0);
530 if (bHigh)
533 nState, aControlValue, OUString());
534 }
535 else
536 {
537 tools::Long nArrowY;
538 if (aTxtSize.Height())
539 nArrowY = nTxtPosY + (aTxtSize.Height() / 2);
540 else if (aImageSize.Width() && aImageSize.Height())
541 nArrowY = nImagePosY + (aImageSize.Height() / 2);
542 else
543 nArrowY = aRect.Top() + ((aRect.GetHeight() - HEAD_ARROWSIZE2) / 2);
544 nArrowY -= HEAD_ARROWSIZE1 - 1;
546 {
547 rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
548 rRenderContext.DrawLine(Point(nArrowX, nArrowY),
549 Point(nArrowX + HEAD_ARROWSIZE2, nArrowY));
550 rRenderContext.DrawLine(Point(nArrowX, nArrowY),
551 Point(nArrowX + HEAD_ARROWSIZE1, nArrowY + HEAD_ARROWSIZE2));
552 rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
553 rRenderContext.DrawLine(Point(nArrowX + HEAD_ARROWSIZE1, nArrowY + HEAD_ARROWSIZE2),
554 Point(nArrowX + HEAD_ARROWSIZE2, nArrowY));
555 }
556 else
557 {
558 rRenderContext.SetLineColor(rStyleSettings.GetLightColor());
559 rRenderContext.DrawLine(Point(nArrowX, nArrowY + HEAD_ARROWSIZE2),
560 Point(nArrowX + HEAD_ARROWSIZE1, nArrowY));
561 rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
562 rRenderContext.DrawLine(Point(nArrowX, nArrowY + HEAD_ARROWSIZE2),
563 Point(nArrowX + HEAD_ARROWSIZE2, nArrowY + HEAD_ARROWSIZE2));
564 rRenderContext.DrawLine(Point(nArrowX + HEAD_ARROWSIZE2, nArrowY + HEAD_ARROWSIZE2),
565 Point(nArrowX + HEAD_ARROWSIZE1, nArrowY));
566 }
567 }
568}
569
570void HeaderBar::ImplDrawItem(vcl::RenderContext& rRenderContext, sal_uInt16 nPos,
571 bool bHigh, const tools::Rectangle* pRect )
572{
574 ImplDrawItem(rRenderContext, nPos, bHigh, aRect, pRect );
575}
576
577void HeaderBar::ImplUpdate(sal_uInt16 nPos, bool bEnd)
578{
579 if (!(IsVisible() && IsUpdateMode()))
580 return;
581
582 tools::Rectangle aRect;
583 size_t nItemCount = mvItemList.size();
584 if (nPos < nItemCount)
585 aRect = ImplGetItemRect(nPos);
586 else
587 {
588 aRect.SetBottom( mnDY - 1 );
589 if (nItemCount)
590 aRect.SetLeft( ImplGetItemRect(nItemCount - 1).Right() );
591 }
592 if (bEnd)
593 aRect.SetRight( mnDX - 1 );
594 aRect.AdjustTop(mnBorderOff1 );
595 aRect.AdjustBottom( -mnBorderOff2 );
596 Invalidate(aRect);
597}
598
599void HeaderBar::ImplStartDrag( const Point& rMousePos, bool bCommand )
600{
601 sal_uInt16 nPos;
602 sal_uInt16 nHitTest = ImplDoHitTest( rMousePos, mnMouseOff, nPos );
603 if ( !nHitTest )
604 return;
605
606 mbDrag = false;
607 auto& pItem = mvItemList[ nPos ];
608 if ( nHitTest & HEAD_HITTEST_DIVIDER )
609 mbDrag = true;
610 else
611 {
612 if ( ((pItem->mnBits & HeaderBarItemBits::CLICKABLE) && !(pItem->mnBits & HeaderBarItemBits::FLAT)) ||
613 mbDragable )
614 {
615 mbItemMode = true;
616 mbDrag = true;
617 if ( bCommand )
618 {
619 if ( mbDragable )
620 mbItemDrag = true;
621 else
622 {
623 mbItemMode = false;
624 mbDrag = false;
625 }
626 }
627 }
628 else
629 {
630 if ( !bCommand )
631 {
632 mnCurItemId = pItem->mnId;
633 Select();
634 mnCurItemId = 0;
635 }
636 }
637 }
638
639 if ( mbDrag )
640 {
641 mbOutDrag = false;
642 mnCurItemId = pItem->mnId;
645 mnStartPos = rMousePos.X()-mnMouseOff;
647 maStartDragHdl.Call( this );
648 if (mbItemMode)
649 Invalidate();
650 else
651 {
654 }
655 }
656 else
657 mnMouseOff = 0;
658}
659
660void HeaderBar::ImplDrag( const Point& rMousePos )
661{
662 sal_uInt16 nPos = GetItemPos( mnCurItemId );
663
664 mnDragPos = rMousePos.X()-mnMouseOff;
665 if ( mbItemMode )
666 {
667 bool bNewOutDrag;
668
670 bNewOutDrag = !aItemRect.Contains( rMousePos );
671
672 // if needed switch on ItemDrag
673 if ( bNewOutDrag && mbDragable && !mbItemDrag )
674 {
675 if ( (rMousePos.Y() >= aItemRect.Top()) && (rMousePos.Y() <= aItemRect.Bottom()) )
676 {
677 mbItemDrag = true;
678 Invalidate();
679 }
680 }
681
682 sal_uInt16 nOldItemDragPos = mnItemDragPos;
683 if ( mbItemDrag )
684 {
685 bNewOutDrag = (rMousePos.Y() < -HEADERBAR_DRAGOUTOFF) || (rMousePos.Y() > mnDY+HEADERBAR_DRAGOUTOFF);
686
687 if ( bNewOutDrag )
689 else
690 {
691 sal_uInt16 nTempId = GetItemId( Point( rMousePos.X(), 2 ) );
692 if ( nTempId )
693 mnItemDragPos = GetItemPos( nTempId );
694 else
695 {
696 if ( rMousePos.X() <= 0 )
697 mnItemDragPos = 0;
698 else
700 }
701 }
702
703 if ( (mnItemDragPos != nOldItemDragPos) &&
704 (nOldItemDragPos != nPos) &&
705 (nOldItemDragPos != HEADERBAR_ITEM_NOTFOUND) )
706 {
707 ImplInvertDrag( nPos, nOldItemDragPos );
708 Invalidate();
709 }
710 }
711
712 if ( bNewOutDrag != mbOutDrag )
713 Invalidate();
714
715 if ( mbItemDrag )
716 {
717 if ( (mnItemDragPos != nOldItemDragPos) &&
718 (mnItemDragPos != nPos) &&
720 {
721 Invalidate();
723 }
724 }
725
726 mbOutDrag = bNewOutDrag;
727 }
728 else
729 {
731 if ( mnDragPos < aItemRect.Left() )
732 mnDragPos = aItemRect.Left();
733 if ( (mnDragPos < 0) || (mnDragPos > mnDX-1) )
734 HideTracking();
735 else
736 {
739 }
740 }
741}
742
743void HeaderBar::ImplEndDrag( bool bCancel )
744{
745 HideTracking();
746
747 if ( bCancel || mbOutDrag )
748 {
749 if ( mbItemMode && (!mbOutDrag || mbItemDrag) )
750 {
751 Invalidate();
752 }
753
754 mnCurItemId = 0;
755 }
756 else
757 {
758 sal_uInt16 nPos = GetItemPos( mnCurItemId );
759 if ( mbItemMode )
760 {
761 if ( mbItemDrag )
762 {
764 if ( (mnItemDragPos != nPos) &&
766 {
769 }
770 else
771 Invalidate();
772 }
773 else
774 {
775 Select();
776 ImplUpdate( nPos );
777 }
778 }
779 else
780 {
782 if ( nDelta )
783 {
784 auto& pItem = mvItemList[ nPos ];
785 pItem->mnSize += nDelta;
786 ImplUpdate( nPos, true );
787 }
788 }
789 }
790
791 mbDrag = false;
792 EndDrag();
793 mnCurItemId = 0;
795 mbOutDrag = false;
796 mbItemMode = false;
797 mbItemDrag = false;
798}
799
801{
802 if ( !rMEvt.IsLeft() )
803 return;
804
805 if ( rMEvt.GetClicks() == 2 )
806 {
807 tools::Long nTemp;
808 sal_uInt16 nPos;
809 sal_uInt16 nHitTest = ImplDoHitTest( rMEvt.GetPosPixel(), nTemp, nPos );
810 if ( nHitTest )
811 {
812 auto& pItem = mvItemList[ nPos ];
813 if ( nHitTest & HEAD_HITTEST_DIVIDER )
814 mbItemMode = false;
815 else
816 mbItemMode = true;
817 mnCurItemId = pItem->mnId;
818 DoubleClick();
819 mbItemMode = false;
820 mnCurItemId = 0;
821 }
822 }
823 else
824 ImplStartDrag( rMEvt.GetPosPixel(), false );
825}
826
828{
829 tools::Long nTemp1;
830 sal_uInt16 nTemp2;
832 sal_uInt16 nHitTest = ImplDoHitTest( rMEvt.GetPosPixel(), nTemp1, nTemp2 );
833
834 if ( nHitTest & HEAD_HITTEST_DIVIDER )
835 eStyle = PointerStyle::HSizeBar;
836 SetPointer( eStyle );
837}
838
840{
841 Point aMousePos = rTEvt.GetMouseEvent().GetPosPixel();
842
843 if ( rTEvt.IsTrackingEnded() )
845 else
846 ImplDrag( aMousePos );
847}
848
849void HeaderBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
850{
852 {
853 rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetDarkShadowColor());
854 if (mnBorderOff1)
855 rRenderContext.DrawLine(Point(0, 0), Point(mnDX - 1, 0));
856 if (mnBorderOff2)
857 rRenderContext.DrawLine(Point(0, mnDY - 1), Point(mnDX - 1, mnDY - 1));
858 // #i40393# draw left and right border, if WB_BORDER was set in ImplInit()
860 {
861 rRenderContext.DrawLine(Point(0, 0), Point(0, mnDY - 1));
862 rRenderContext.DrawLine(Point(mnDX - 1, 0), Point(mnDX - 1, mnDY - 1));
863 }
864 }
865
866 sal_uInt16 nCurItemPos;
867 if (mbDrag)
868 nCurItemPos = GetItemPos(mnCurItemId);
869 else
870 nCurItemPos = HEADERBAR_ITEM_NOTFOUND;
871 sal_uInt16 nItemCount = static_cast<sal_uInt16>(mvItemList.size());
872 for (sal_uInt16 i = 0; i < nItemCount; i++)
873 ImplDrawItem(rRenderContext, i, (i == nCurItemPos), &rRect);
874}
875
876void HeaderBar::Draw( OutputDevice* pDev, const Point& rPos,
877 SystemTextColorFlags nFlags )
878{
879 Point aPos = pDev->LogicToPixel( rPos );
880 Size aSize = GetSizePixel();
881 tools::Rectangle aRect( aPos, aSize );
882 vcl::Font aFont = GetDrawPixelFont( pDev );
883
884 pDev->Push();
885 pDev->SetMapMode();
886 pDev->SetFont( aFont );
887 if ( nFlags & SystemTextColorFlags::Mono )
888 pDev->SetTextColor( COL_BLACK );
889 else
890 pDev->SetTextColor( GetTextColor() );
891 pDev->SetTextFillColor();
892
893 // draw background
894 {
895 pDev->DrawWallpaper( aRect, GetBackground() );
896 if ( mnBorderOff1 || mnBorderOff2 )
897 {
898 pDev->SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
899 if ( mnBorderOff1 )
900 pDev->DrawLine( aRect.TopLeft(), Point( aRect.Right(), aRect.Top() ) );
901 if ( mnBorderOff2 )
902 pDev->DrawLine( Point( aRect.Left(), aRect.Bottom() ), Point( aRect.Right(), aRect.Bottom() ) );
903 // #i40393# draw left and right border, if WB_BORDER was set in ImplInit()
904 if ( mnBorderOff1 && mnBorderOff2 )
905 {
906 pDev->DrawLine( aRect.TopLeft(), Point( aRect.Left(), aRect.Bottom() ) );
907 pDev->DrawLine( Point( aRect.Right(), aRect.Top() ), Point( aRect.Right(), aRect.Bottom() ) );
908 }
909 }
910 }
911
912 tools::Rectangle aItemRect( aRect );
913 size_t nItemCount = mvItemList.size();
914 for ( size_t i = 0; i < nItemCount; i++ )
915 {
916 aItemRect.SetLeft( aRect.Left()+ImplGetItemPos( i ) );
917 aItemRect.SetRight( aItemRect.Left() + mvItemList[ i ]->mnSize - 1 );
918 // check for overflow on some systems
919 if ( aItemRect.Right() > 16000 )
920 aItemRect.SetRight( 16000 );
921 vcl::Region aRegion( aRect );
922 pDev->SetClipRegion( aRegion );
923 ImplDrawItem(*pDev, i, false, aItemRect, &aRect );
924 pDev->SetClipRegion();
925 }
926
927 pDev->Pop();
928}
929
931{
932 Size aSize = GetOutputSizePixel();
933 if ( IsVisible() && (mnDY != aSize.Height()) )
934 Invalidate();
935 mnDX = aSize.Width();
936 mnDY = aSize.Height();
937}
938
940{
941 if ( rCEvt.IsMouseEvent() && (rCEvt.GetCommand() == CommandEventId::StartDrag) && !mbDrag )
942 {
943 ImplStartDrag( rCEvt.GetMousePosPixel(), true );
944 return;
945 }
946
947 Window::Command( rCEvt );
948}
949
951{
952 sal_uInt16 nItemId = GetItemId( ScreenToOutputPixel( rHEvt.GetMousePosPixel() ) );
953 if ( nItemId )
954 {
956 {
957 tools::Rectangle aItemRect = GetItemRect( nItemId );
958 Point aPt = OutputToScreenPixel( aItemRect.TopLeft() );
959 aItemRect.SetLeft( aPt.X() );
960 aItemRect.SetTop( aPt.Y() );
961 aPt = OutputToScreenPixel( aItemRect.BottomRight() );
962 aItemRect.SetRight( aPt.X() );
963 aItemRect.SetBottom( aPt.Y() );
964
965 OUString aStr = GetHelpText( nItemId );
966 if ( aStr.isEmpty() || !(rHEvt.GetMode() & HelpEventMode::BALLOON) )
967 {
968 auto& pItem = mvItemList[ GetItemPos( nItemId ) ];
969 // Quick-help is only displayed if the text is not fully visible.
970 // Otherwise we display Helptext only if the items do not contain text
971 if ( pItem->maOutText != pItem->maText )
972 aStr = pItem->maText;
973 else if (!pItem->maText.isEmpty())
974 aStr.clear();
975 }
976
977 if (!aStr.isEmpty())
978 {
979 if ( rHEvt.GetMode() & HelpEventMode::BALLOON )
980 Help::ShowBalloon( this, aItemRect.Center(), aItemRect, aStr );
981 else
982 Help::ShowQuickHelp( this, aItemRect, aStr );
983 return;
984 }
985 }
986 }
987
988 Window::RequestHelp( rHEvt );
989}
990
992{
993 Window::StateChanged( nType );
994
996 Invalidate();
997 else if ( (nType == StateChangedType::Zoom) ||
999 {
1000 ImplInitSettings( true, false, false );
1001 Invalidate();
1002 }
1004 {
1005 ImplInitSettings( false, true, false );
1006 Invalidate();
1007 }
1009 {
1010 ImplInitSettings( false, false, true );
1011 Invalidate();
1012 }
1013}
1014
1016{
1017 Window::DataChanged( rDCEvt );
1018
1019 if ( (rDCEvt.GetType() == DataChangedEventType::FONTS) ||
1021 ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) &&
1022 (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) )
1023 {
1024 ImplInitSettings( true, true, true );
1025 Invalidate();
1026 }
1027}
1028
1030{
1031 maEndDragHdl.Call( this );
1032}
1033
1035{
1036 maSelectHdl.Call( this );
1037}
1038
1040{
1041}
1042
1043void HeaderBar::InsertItem( sal_uInt16 nItemId, const OUString& rText,
1044 tools::Long nSize, HeaderBarItemBits nBits, sal_uInt16 nPos )
1045{
1046 DBG_ASSERT( nItemId, "HeaderBar::InsertItem(): ItemId == 0" );
1048 "HeaderBar::InsertItem(): ItemId already exists" );
1049
1050 // create item and insert in the list
1051 std::unique_ptr<ImplHeadItem> pItem(new ImplHeadItem);
1052 pItem->mnId = nItemId;
1053 pItem->mnBits = nBits;
1054 pItem->mnSize = nSize;
1055 pItem->maText = rText;
1056 if ( nPos < mvItemList.size() ) {
1057 auto it = mvItemList.begin();
1058 it += nPos;
1059 mvItemList.insert( it, std::move(pItem) );
1060 } else {
1061 mvItemList.push_back( std::move(pItem) );
1062 }
1063
1064 // update display
1065 ImplUpdate( nPos, true );
1066}
1067
1068void HeaderBar::RemoveItem( sal_uInt16 nItemId )
1069{
1070 sal_uInt16 nPos = GetItemPos( nItemId );
1072 {
1073 if ( nPos < mvItemList.size() ) {
1074 auto it = mvItemList.begin();
1075 it += nPos;
1076 mvItemList.erase( it );
1077 }
1078 }
1079}
1080
1081void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos )
1082{
1083 sal_uInt16 nPos = GetItemPos( nItemId );
1085 return;
1086
1087 if ( nPos == nNewPos )
1088 return;
1089
1090 auto it = mvItemList.begin();
1091 it += nPos;
1092 std::unique_ptr<ImplHeadItem> pItem = std::move(*it);
1093 mvItemList.erase( it );
1094 if ( nNewPos < nPos )
1095 nPos = nNewPos;
1096 it = mvItemList.begin();
1097 it += nNewPos;
1098 mvItemList.insert( it, std::move(pItem) );
1099 ImplUpdate( nPos, true);
1100}
1101
1103{
1104 // delete all items
1105 mvItemList.clear();
1106
1107 ImplUpdate( 0, true );
1108}
1109
1111{
1112 // tdf#129856 (see also #i40393#) invalidate old left and right border area if WB_BORDER was set in ImplInit()
1114 {
1115 Invalidate(tools::Rectangle(0, 0, 1, mnDY));
1117 }
1118
1119 // move area
1121 tools::Long nDelta = mnOffset-nNewOffset;
1122 mnOffset = nNewOffset;
1123 Scroll( nDelta, 0, aRect );
1124}
1125
1126sal_uInt16 HeaderBar::GetItemCount() const
1127{
1128 return static_cast<sal_uInt16>(mvItemList.size());
1129}
1130
1131sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const
1132{
1133 for ( size_t i = 0, n = mvItemList.size(); i < n; ++i ) {
1134 auto& pItem = mvItemList[ i ];
1135 if ( pItem->mnId == nItemId )
1136 return static_cast<sal_uInt16>(i);
1137 }
1139}
1140
1141sal_uInt16 HeaderBar::GetItemId( sal_uInt16 nPos ) const
1142{
1143 ImplHeadItem* pItem = (nPos < mvItemList.size() ) ? mvItemList[ nPos ].get() : nullptr;
1144 if ( pItem )
1145 return pItem->mnId;
1146 else
1147 return 0;
1148}
1149
1150sal_uInt16 HeaderBar::GetItemId( const Point& rPos ) const
1151{
1152 for ( size_t i = 0, n = mvItemList.size(); i < n; ++i ) {
1153 if ( ImplGetItemRect( i ).Contains( rPos ) ) {
1154 return GetItemId( i );
1155 }
1156 }
1157 return 0;
1158}
1159
1160tools::Rectangle HeaderBar::GetItemRect( sal_uInt16 nItemId ) const
1161{
1162 tools::Rectangle aRect;
1163 sal_uInt16 nPos = GetItemPos( nItemId );
1165 aRect = ImplGetItemRect( nPos );
1166 return aRect;
1167}
1168
1169void HeaderBar::SetItemSize( sal_uInt16 nItemId, tools::Long nNewSize )
1170{
1171 sal_uInt16 nPos = GetItemPos( nItemId );
1173 {
1174 auto& pItem = mvItemList[ nPos ];
1175 if ( pItem->mnSize != nNewSize )
1176 {
1177 pItem->mnSize = nNewSize;
1178 ImplUpdate( nPos, true );
1179 }
1180 }
1181}
1182
1183tools::Long HeaderBar::GetItemSize( sal_uInt16 nItemId ) const
1184{
1185 sal_uInt16 nPos = GetItemPos( nItemId );
1187 return mvItemList[ nPos ]->mnSize;
1188 else
1189 return 0;
1190}
1191
1192void HeaderBar::SetItemBits( sal_uInt16 nItemId, HeaderBarItemBits nNewBits )
1193{
1194 sal_uInt16 nPos = GetItemPos( nItemId );
1196 {
1197 auto& pItem = mvItemList[ nPos ];
1198 if ( pItem->mnBits != nNewBits )
1199 {
1200 pItem->mnBits = nNewBits;
1201 ImplUpdate( nPos );
1202 }
1203 }
1204}
1205
1207{
1208 sal_uInt16 nPos = GetItemPos( nItemId );
1210 return mvItemList[ nPos ]->mnBits;
1211 else
1213}
1214
1215void HeaderBar::SetItemText( sal_uInt16 nItemId, const OUString& rText )
1216{
1217 sal_uInt16 nPos = GetItemPos( nItemId );
1219 {
1220 mvItemList[ nPos ]->maText = rText;
1221 ImplUpdate( nPos );
1222 }
1223}
1224
1225OUString HeaderBar::GetItemText( sal_uInt16 nItemId ) const
1226{
1227 sal_uInt16 nPos = GetItemPos( nItemId );
1229 return mvItemList[ nPos ]->maText;
1230 return OUString();
1231}
1232
1233OUString HeaderBar::GetHelpText( sal_uInt16 nItemId ) const
1234{
1235 sal_uInt16 nPos = GetItemPos( nItemId );
1237 {
1238 auto& pItem = mvItemList[ nPos ];
1239 if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() )
1240 {
1241 Help* pHelp = Application::GetHelp();
1242 if ( pHelp )
1243 pItem->maHelpText = pHelp->GetHelpText( OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ), this );
1244 }
1245
1246 return pItem->maHelpText;
1247 }
1248
1249 return OUString();
1250}
1251
1253{
1254 tools::Long nMaxImageSize = 0;
1255 Size aSize( 0, GetTextHeight() );
1256
1257 for (auto& pItem : mvItemList)
1258 {
1259 // take image size into account
1260 tools::Long nImageHeight = pItem->maImage.GetSizePixel().Height();
1261 if ( !(pItem->mnBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && !pItem->maText.isEmpty() )
1262 nImageHeight += aSize.Height();
1263 if ( nImageHeight > nMaxImageSize )
1264 nMaxImageSize = nImageHeight;
1265
1266 // add width
1267 aSize.AdjustWidth(pItem->mnSize );
1268 }
1269
1270 if ( nMaxImageSize > aSize.Height() )
1271 aSize.setHeight( nMaxImageSize );
1272
1273 // add border
1274 if ( mbButtonStyle )
1275 aSize.AdjustHeight(4 );
1276 else
1277 aSize.AdjustHeight(2 );
1279
1280 return aSize;
1281}
1282
1283css::uno::Reference< css::accessibility::XAccessible > HeaderBar::CreateAccessible()
1284{
1285 if ( !mxAccessible.is() )
1286 {
1288
1289 if ( !mxAccessible.is() )
1290 mxAccessible = Window::CreateAccessible();
1291 }
1292
1293 return mxAccessible;
1294}
1295
1296void HeaderBar::SetAccessible( const css::uno::Reference< css::accessibility::XAccessible >& _xAccessible )
1297{
1298 mxAccessible = _xAccessible;
1299}
1300
1301/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DrawImageFlags
SystemTextColorFlags
const StyleSettings & GetStyleSettings() const
static Help * GetHelp()
Gets the application's help.
Definition: svapp.cxx:1352
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
DataChangedEventType GetType() const
Definition: event.hxx:362
AllSettingsFlags GetFlags() const
Definition: event.hxx:363
void MoveItem(sal_uInt16 nItemId, sal_uInt16 nNewPos)
Definition: headbar.cxx:1081
virtual Size GetOptimalSize() const override
Definition: headbar.cxx:109
void Clear()
Definition: headbar.cxx:1102
void SetItemSize(sal_uInt16 nItemId, tools::Long nNewSize)
Definition: headbar.cxx:1169
tools::Long mnDY
Definition: headbar.hxx:212
sal_uInt16 GetItemId(sal_uInt16 nPos) const
Definition: headbar.cxx:1141
VCL_DLLPRIVATE void ImplDrawItem(vcl::RenderContext &rRenderContext, sal_uInt16 nPos, bool bHigh, const tools::Rectangle &rItemRect, const tools::Rectangle *pRect)
Definition: headbar.cxx:268
VCL_DLLPRIVATE void ImplEndDrag(bool bCancel)
Definition: headbar.cxx:743
tools::Rectangle GetItemRect(sal_uInt16 nItemId) const
Definition: headbar.cxx:1160
void RemoveItem(sal_uInt16 nItemId)
Definition: headbar.cxx:1068
std::vector< std::unique_ptr< ImplHeadItem > > mvItemList
Definition: headbar.hxx:207
tools::Long mnDX
Definition: headbar.hxx:211
HeaderBarItemBits GetItemBits(sal_uInt16 nItemId) const
Definition: headbar.cxx:1206
virtual void RequestHelp(const HelpEvent &rHEvt) override
Definition: headbar.cxx:950
virtual void Command(const CommandEvent &rCEvt) override
Definition: headbar.cxx:939
VCL_DLLPRIVATE void ImplInvertDrag(sal_uInt16 nStartPos, sal_uInt16 nEndPos)
Definition: headbar.cxx:222
tools::Long GetItemSize(sal_uInt16 nItemId) const
Definition: headbar.cxx:1183
virtual void MouseMove(const MouseEvent &rMEvt) override
Definition: headbar.cxx:827
virtual void ApplySettings(vcl::RenderContext &rRenderContext) override
Definition: headbar.cxx:116
bool mbItemMode
Definition: headbar.hxx:224
sal_uInt16 mnCurItemId
Definition: headbar.hxx:217
Link< HeaderBar *, void > maEndDragHdl
Definition: headbar.hxx:226
VCL_DLLPRIVATE void ImplDrag(const Point &rPos)
Definition: headbar.cxx:660
void SetItemBits(sal_uInt16 nItemId, HeaderBarItemBits nNewBits)
Definition: headbar.cxx:1192
void SetItemText(sal_uInt16 nItemId, const OUString &rText)
Definition: headbar.cxx:1215
bool mbItemDrag
Definition: headbar.hxx:221
sal_uInt16 mnItemDragPos
Definition: headbar.hxx:218
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: headbar.cxx:1015
Link< HeaderBar *, void > maSelectHdl
Definition: headbar.hxx:227
bool mbDrag
Definition: headbar.hxx:220
VCL_DLLPRIVATE tools::Rectangle ImplGetItemRect(sal_uInt16 nPos) const
Definition: headbar.cxx:153
VCL_DLLPRIVATE void ImplStartDrag(const Point &rPos, bool bCommand)
Definition: headbar.cxx:599
HeaderBar(vcl::Window *pParent, WinBits nWinBits)
Definition: headbar.cxx:101
OUString GetItemText(sal_uInt16 nItemId) const
Definition: headbar.cxx:1225
bool mbButtonStyle
Definition: headbar.hxx:223
void InsertItem(sal_uInt16 nItemId, const OUString &rText, tools::Long nSize, HeaderBarItemBits nBits=HeaderBarItemBits::STDSTYLE, sal_uInt16 nPos=HEADERBAR_APPEND)
Definition: headbar.cxx:1043
tools::Long mnOffset
Definition: headbar.hxx:210
Link< HeaderBar *, void > maStartDragHdl
Definition: headbar.hxx:225
virtual void Select()
Definition: headbar.cxx:1034
virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override
Creates and returns the accessible object of the header bar.
Definition: headbar.cxx:1283
tools::Long mnStartPos
Definition: headbar.hxx:214
tools::Long mnDragPos
Definition: headbar.hxx:215
tools::Long mnBorderOff2
Definition: headbar.hxx:209
VCL_DLLPRIVATE void ImplUpdate(sal_uInt16 nPos, bool bEnd=false)
Definition: headbar.cxx:577
virtual void Tracking(const TrackingEvent &rTEvt) override
Definition: headbar.cxx:839
sal_uInt16 GetItemPos(sal_uInt16 nItemId) const
Definition: headbar.cxx:1131
bool mbDragable
Definition: headbar.hxx:219
void SetOffset(tools::Long nNewOffset)
Definition: headbar.cxx:1110
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: headbar.cxx:876
virtual void Resize() override
Definition: headbar.cxx:930
Link< HeaderBar *, void > maCreateAccessibleHdl
Definition: headbar.hxx:228
void SetAccessible(const css::uno::Reference< css::accessibility::XAccessible > &)
Definition: headbar.cxx:1296
VCL_DLLPRIVATE sal_uInt16 ImplDoHitTest(const Point &rPos, tools::Long &nMouseOff, sal_uInt16 &nPos) const
Definition: headbar.cxx:163
virtual ~HeaderBar() override
bool mbOutDrag
Definition: headbar.hxx:222
VCL_DLLPRIVATE void ImplInitSettings(bool bFont, bool bForeground, bool bBackground)
Definition: headbar.cxx:128
tools::Long mnBorderOff1
Definition: headbar.hxx:208
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: headbar.cxx:849
VCL_DLLPRIVATE void ImplInit(WinBits nWinStyle)
Definition: headbar.cxx:60
Size CalcWindowSizePixel() const
Definition: headbar.cxx:1252
css::uno::Reference< css::accessibility::XAccessible > mxAccessible
Definition: headbar.hxx:231
virtual void EndDrag()
Definition: headbar.cxx:1029
tools::Long mnMouseOff
Definition: headbar.hxx:216
VCL_DLLPRIVATE tools::Long ImplGetItemPos(sal_uInt16 nPos) const
Definition: headbar.cxx:145
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: headbar.cxx:800
sal_uInt16 GetItemCount() const
Definition: headbar.cxx:1126
tools::Long mnDragSize
Definition: headbar.hxx:213
virtual void StateChanged(StateChangedType nStateChange) override
Definition: headbar.cxx:991
virtual void DoubleClick()
Definition: headbar.cxx:1039
HelpEventMode GetMode() const
Definition: event.hxx:208
const Point & GetMousePosPixel() const
Definition: event.hxx:207
Definition: help.hxx:61
virtual OUString GetHelpText(const OUString &aHelpURL, const weld::Widget *pWidget)
Definition: help.cxx:72
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
Definition: help.cxx:180
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
Definition: help.cxx:157
Definition: image.hxx:40
void setNumericVal(tools::Long nNumeric)
void setTristateVal(ButtonValue nTristate)
OString maHelpId
Definition: headbar.cxx:41
OUString maHelpText
Definition: headbar.cxx:45
OUString maOutText
Definition: headbar.cxx:43
Image maImage
Definition: headbar.cxx:42
sal_uInt16 mnId
Definition: headbar.cxx:38
tools::Long mnSize
Definition: headbar.cxx:40
HeaderBarItemBits mnBits
Definition: headbar.cxx:39
OUString maText
Definition: headbar.cxx:44
sal_uInt16 GetClicks() const
Definition: event.hxx:126
const Point & GetPosPixel() const
Definition: event.hxx:123
bool IsLeft() const
Definition: event.hxx:149
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
void DrawCtrlText(const Point &rPos, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, DrawTextFlags nStyle=DrawTextFlags::Mnemonic, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pGlyphs=nullptr)
Definition: text.cxx:2149
void SetFont(const vcl::Font &rNewFont)
Definition: outdev/font.cxx:56
void DrawRect(const tools::Rectangle &rRect)
Definition: rect.cxx:50
void DrawLine(const Point &rStartPt, const Point &rEndPt)
Definition: line.cxx:161
const Wallpaper & GetBackground() const
Definition: outdev.hxx:523
void SetLineColor()
Definition: line.cxx:37
void SetMapMode()
Definition: map.cxx:597
tools::Long GetTextWidth(const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, vcl::text::TextLayoutCache const *=nullptr, SalLayoutGlyphs const *const pLayoutCache=nullptr) const
Width of the text.
Definition: text.cxx:886
void SetTextColor(const Color &rColor)
Definition: text.cxx:716
void DrawPixel(const Point &rPt)
Definition: pixel.cxx:54
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
This is an overloaded member function, provided for convenience. It differs from the above function o...
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
Definition: map.cxx:879
void SetRasterOp(RasterOp eRasterOp)
Definition: outdev.cxx:320
void SetTextFillColor()
Definition: text.cxx:734
void DrawWallpaper(const tools::Rectangle &rRect, const Wallpaper &rWallpaper)
Definition: wallpaper.cxx:35
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
Definition: stack.cxx:32
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: text.cxx:897
void Pop()
Definition: stack.cxx:91
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 DrawText(const Point &rStartPt, const OUString &rStr, sal_Int32 nIndex=0, sal_Int32 nLen=-1, std::vector< tools::Rectangle > *pVector=nullptr, OUString *pDisplayText=nullptr, const SalLayoutGlyphs *pLayoutCache=nullptr)
Definition: text.cxx:797
const AllSettings & GetSettings() const
Definition: outdev.hxx:288
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
constexpr tools::Long Y() const
void setX(tools::Long nX)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
constexpr tools::Long Height() const
tools::Long AdjustHeight(tools::Long n)
void setWidth(tools::Long nWidth)
tools::Long AdjustWidth(tools::Long n)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
const Color & GetDarkShadowColor() const
const Color & GetShadowColor() const
const Color & GetLightColor() const
const vcl::Font & GetToolFont() const
const Color & GetFaceColor() const
const Color & GetButtonTextColor() const
bool IsTrackingEnded() const
Definition: event.hxx:261
bool IsTrackingCanceled() const
Definition: event.hxx:263
const MouseEvent & GetMouseEvent() const
Definition: event.hxx:257
constexpr Point Center() const
constexpr tools::Long GetWidth() const
bool Contains(const Point &rPOINT) const
constexpr void SetLeft(tools::Long v)
constexpr void SetTop(tools::Long v)
constexpr tools::Long Top() const
constexpr Point TopLeft() const
constexpr void SetRight(tools::Long v)
constexpr tools::Long Right() const
tools::Long AdjustTop(tools::Long nVertMoveDelta)
constexpr void SetBottom(tools::Long v)
constexpr Point BottomRight() const
constexpr tools::Long GetHeight() const
tools::Long AdjustBottom(tools::Long nVertMoveDelta)
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
static void DrawSelectionBackground(vcl::RenderContext &rRenderContext, vcl::Window const &rWindow, const tools::Rectangle &rRect, sal_uInt16 nHighlight, bool bChecked, bool bDrawBorder, bool bDrawExtBorderOnly, Color *pSelectionTextColor=nullptr, tools::Long nCornerRadius=0, Color const *pPaintColor=nullptr)
Definition: paint.cxx:324
Point OutputToScreenPixel(const Point &rPos) const
Definition: window.cxx:2806
const Wallpaper & GetBackground() const
Definition: window3.cxx:63
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
Definition: window2.cxx:252
void HideTracking()
Definition: window2.cxx:151
void ApplyControlBackground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
Definition: window2.cxx:558
virtual void SetSizePixel(const Size &rNewSize)
Definition: window2.cxx:1288
bool IsUpdateMode() const
Definition: window2.cxx:1199
vcl::Font GetDrawPixelFont(::OutputDevice const *pDev) const
Definition: window2.cxx:582
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
Definition: window3.cxx:65
const AllSettings & GetSettings() const
Definition: window3.cxx:129
void ShowTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags=ShowTrackFlags::Small)
Definition: window2.cxx:128
void SetTextFillColor()
Definition: window3.cxx:97
::OutputDevice const * GetOutDev() const
Definition: window.cxx:567
const Color & GetTextColor() const
Definition: window3.cxx:109
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
Definition: window.cxx:2944
virtual Size GetSizePixel() const
Definition: window.cxx:2402
Size GetOutputSizePixel() const
Definition: window3.cxx:89
virtual void SetPointer(PointerStyle)
Definition: mouse.cxx:486
bool IsVisible() const
Definition: window2.cxx:1128
void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
Definition: paint.cxx:1143
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
Definition: window2.cxx:478
void SetType(WindowType nType)
Definition: window2.cxx:994
Point ScreenToOutputPixel(const Point &rPos) const
Definition: window.cxx:2812
void ApplyControlForeground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
Definition: window2.cxx:518
bool IsEnabled() const
Definition: window2.cxx:1148
const OUString & GetHelpText() const
Definition: window.cxx:3090
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
#define DBG_ASSERT(sCon, aError)
sal_uInt32 mnSize
sal_Int32 nState
#define HEAD_HITTEST_ITEM
Definition: headbar.cxx:57
#define HEADERBAR_TEXTOFF
Definition: headbar.cxx:51
#define HEAD_HITTEST_DIVIDER
Definition: headbar.cxx:58
#define HEADERBAR_DRAGOUTOFF
Definition: headbar.cxx:55
#define HEADERBAR_ARROWOFF
Definition: headbar.cxx:52
#define HEAD_ARROWSIZE1
Definition: headbar.cxx:48
#define HEAD_ARROWSIZE2
Definition: headbar.cxx:49
#define HEADERBAR_SPLITOFF
Definition: headbar.cxx:53
HeaderBarItemBits
Definition: headbar.hxx:181
#define WB_BOTTOMBORDER
Definition: headbar.hxx:176
#define WB_BUTTONSTYLE
Definition: headbar.hxx:177
#define HEADERBAR_ITEM_NOTFOUND
Definition: headbar.hxx:201
sal_Int64 n
sal_uInt16 nPos
aStr
aBuf
int i
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
long Long
PointerStyle
Definition: ptrstyle.hxx:26
QPRO_FUNC_TYPE nType
Right
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WinBits const WB_DRAG
Definition: wintypes.hxx:152
WinBits const WB_3DLOOK
Definition: wintypes.hxx:118
WinBits const WB_BORDER
Definition: wintypes.hxx:115