21#include <rtl/ustrbuf.hxx>
33#include <com/sun/star/accessibility/XAccessible.hpp>
48#define HEAD_ARROWSIZE1 4
49#define HEAD_ARROWSIZE2 7
51#define HEADERBAR_TEXTOFF 2
52#define HEADERBAR_ARROWOFF 5
53#define HEADERBAR_SPLITOFF 3
55#define HEADERBAR_DRAGOUTOFF 15
57#define HEAD_HITTEST_ITEM (sal_uInt16(0x0001))
58#define HEAD_HITTEST_DIVIDER (sal_uInt16(0x0002))
135 if (bForeground || bFont)
148 for (
size_t i = 0;
i <
nPos;
i++ )
158 if ( aRect.
Right() > 16000 )
167 bool bLastFixed =
true;
174 if ( rPos.X() < (nX+pItem->mnSize) )
182 nMouseOff = rPos.X()-nX+1;
191 nMouseOff = rPos.X()-(nX+pItem->mnSize);
196 nMouseOff = rPos.X()-nX;
214 nMouseOff = rPos.X()-nX+1;
227 Point aEndPos = aStartPos;
229 aStartPos.X()+2, aStartPos.Y()+2 );
231 if ( nEndPos > nStartPos )
233 aStartPos.AdjustX(3 );
234 aEndPos.setX( aRect2.
Right()-6 );
238 aStartPos.AdjustX( -3 );
239 aEndPos.setX( aRect2.
Left()+6 );
245 if ( nEndPos > nStartPos )
248 Point( aEndPos.X()+1, aEndPos.Y()+3 ) );
250 Point( aEndPos.X()+2, aEndPos.Y()+2 ) );
252 Point( aEndPos.X()+3, aEndPos.Y()+1 ) );
258 Point( aEndPos.X()-1, aEndPos.Y()+3 ) );
260 Point( aEndPos.X()-2, aEndPos.Y()+2 ) );
262 Point( aEndPos.X()-3, aEndPos.Y()+1 ) );
291 if (aRect.
Right() < 0)
305 aCtrlRegion,
nState, aControlValue, OUString());
331 aCtrlRegion,
nState, aControlValue, OUString());
352 pItem->maOutText = pItem->maText;
353 Size aImageSize = pItem->maImage.GetSizePixel();
355 if (!pItem->maOutText.isEmpty())
364 nTestHeight += aTxtSize.
Height();
372 bool bLeftText =
false;
375 nMaxTxtWidth -= aImageSize.
Width();
377 if (nTxtWidth > nMaxTxtWidth)
380 OUStringBuffer
aBuf(pItem->maOutText);
384 aBuf.remove(
aBuf.getLength() - 3 - 1, 1);
387 while ((nTxtWidth > nMaxTxtWidth) && (
aBuf.getLength() > 3));
388 pItem->maOutText =
aBuf.makeStringAndClear();
389 if (pItem->maOutText.getLength() == 3)
392 pItem->maOutText.clear();
402 nTxtPos -= aImageSize.
Width();
408 nTempWidth += aImageSize.
Width();
409 nTxtPos = aRect.
Left() + (aRect.
GetWidth() - nTempWidth) / 2;
411 nTxtPos += aImageSize.
Width();
414 if (nTxtPos + nTxtWidth + nArrowWidth >= aRect.
Right())
418 nTxtPos += aImageSize.
Width();
426 nTxtPos += aImageSize.
Width();
428 nTxtPos += nArrowWidth;
433 if (!pItem->maOutText.isEmpty() || (nArrowWidth && aTxtSize.
Height()))
436 nTempHeight += aImageSize.
Height();
437 nTxtPosY = aRect.
Top()+((aRect.
GetHeight()-nTempHeight)/2);
439 nTxtPosY += aImageSize.
Height();
443 if (!pItem->maOutText.isEmpty())
451 rRenderContext.
DrawText(
Point(nTxtPos, nTxtPosY), pItem->maOutText);
455 rRenderContext.
Pop();
465 nImagePos -= aImageSize.
Width();
467 nImagePos -= nArrowWidth;
471 nImagePos += nTxtWidth;
473 nImagePos += nArrowWidth;
487 nTempHeight += aTxtSize.
Height();
488 nImagePosY = aRect.
Top() + ((aRect.
GetHeight() - nTempHeight) / 2);
490 if (nImagePos + aImageSize.
Width() <= aRect.
Right())
495 rRenderContext.
DrawImage(
Point(nImagePos, nImagePosY), pItem->maImage, nStyle);
504 nArrowX -= nArrowWidth;
510 nArrowX -= aImageSize.
Width();
512 nArrowX += aImageSize.
Width();
534 nState, aControlValue, OUString());
540 nArrowY = nTxtPosY + (aTxtSize.
Height() / 2);
541 else if (aImageSize.
Width() && aImageSize.
Height())
542 nArrowY = nImagePosY + (aImageSize.
Height() / 2);
585 if (
nPos < nItemCount)
671 bNewOutDrag = !aItemRect.
Contains( rMousePos );
676 if ( (rMousePos.Y() >= aItemRect.
Top()) && (rMousePos.Y() <= aItemRect.
Bottom()) )
697 if ( rMousePos.X() <= 0 )
705 (nOldItemDragPos !=
nPos) &&
786 pItem->mnSize += nDelta;
867 sal_uInt16 nCurItemPos;
872 sal_uInt16 nItemCount =
static_cast<sal_uInt16
>(
mvItemList.size());
873 for (sal_uInt16
i = 0;
i < nItemCount;
i++)
915 for (
size_t i = 0;
i < nItemCount;
i++ )
920 if ( aItemRect.
Right() > 16000 )
948 Window::Command( rCEvt );
961 aItemRect.
SetTop( aPt.Y() );
972 if ( pItem->maOutText != pItem->maText )
973 aStr = pItem->maText;
974 else if (!pItem->maText.isEmpty())
989 Window::RequestHelp( rHEvt );
994 Window::StateChanged(
nType );
1018 Window::DataChanged( rDCEvt );
1047 DBG_ASSERT( nItemId,
"HeaderBar::InsertItem(): ItemId == 0" );
1049 "HeaderBar::InsertItem(): ItemId already exists" );
1053 pItem->mnId = nItemId;
1054 pItem->mnBits = nBits;
1055 pItem->mnSize = nSize;
1056 pItem->maText = rText;
1088 if (
nPos == nNewPos )
1093 std::unique_ptr<ImplHeadItem> pItem = std::move(*it);
1095 if ( nNewPos <
nPos )
1124 Scroll( nDelta, 0, aRect );
1129 return static_cast<sal_uInt16
>(
mvItemList.size());
1136 if ( pItem->mnId == nItemId )
1137 return static_cast<sal_uInt16
>(
i);
1176 if ( pItem->mnSize != nNewSize )
1178 pItem->mnSize = nNewSize;
1199 if ( pItem->mnBits != nNewBits )
1201 pItem->mnBits = nNewBits;
1240 if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() )
1244 pItem->maHelpText = pHelp->
GetHelpText( OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ),
this );
1247 return pItem->maHelpText;
1261 tools::Long nImageHeight = pItem->maImage.GetSizePixel().Height();
1263 nImageHeight += aSize.
Height();
1264 if ( nImageHeight > nMaxImageSize )
1265 nMaxImageSize = nImageHeight;
1271 if ( nMaxImageSize > aSize.
Height() )
const StyleSettings & GetStyleSettings() const
static Help * GetHelp()
Gets the application's help.
CommandEventId GetCommand() const
const Point & GetMousePosPixel() const
bool IsMouseEvent() const
DataChangedEventType GetType() const
AllSettingsFlags GetFlags() const
HelpEventMode GetMode() const
const Point & GetMousePosPixel() const
virtual OUString GetHelpText(const OUString &aHelpURL, const weld::Widget *pWidget)
static void ShowQuickHelp(vcl::Window *pParent, const tools::Rectangle &rScreenRect, const OUString &rHelpText, QuickHelpFlags nStyle=QuickHelpFlags::NONE)
static void ShowBalloon(vcl::Window *pParent, const Point &rScreenPos, const tools::Rectangle &, const OUString &rHelpText)
void setNumericVal(tools::Long nNumeric)
void setTristateVal(ButtonValue nTristate)
sal_uInt16 GetClicks() const
const Point & GetPosPixel() const
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
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)
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
void DrawLine(const Point &rStartPt, const Point &rEndPt)
const Wallpaper & GetBackground() const
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.
void SetTextColor(const Color &rColor)
void DrawPixel(const Point &rPt)
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
void SetRasterOp(RasterOp eRasterOp)
void DrawWallpaper(const tools::Rectangle &rRect, const Wallpaper &rWallpaper)
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
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)
const AllSettings & GetSettings() const
bool IsNativeControlSupported(ControlType nType, ControlPart nPart) const
Query the platform layer for control support.
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
bool IsTrackingCanceled() const
const MouseEvent & GetMouseEvent() const
Point OutputToScreenPixel(const Point &rPos) const
const Wallpaper & GetBackground() const
void StartTracking(StartTrackingFlags nFlags=StartTrackingFlags::NONE)
void ApplyControlBackground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
virtual void SetSizePixel(const Size &rNewSize)
bool IsUpdateMode() const
vcl::Font GetDrawPixelFont(::OutputDevice const *pDev) const
tools::Long GetTextHeight() const
Height where any character of the current font fits; in logic coordinates.
const AllSettings & GetSettings() const
void ShowTracking(const tools::Rectangle &rRect, ShowTrackFlags nFlags=ShowTrackFlags::Small)
::OutputDevice const * GetOutDev() const
const Color & GetTextColor() const
virtual void Scroll(tools::Long nHorzScroll, tools::Long nVertScroll, ScrollFlags nFlags=ScrollFlags::NONE)
virtual Size GetSizePixel() const
Size GetOutputSizePixel() const
void SetPointer(PointerStyle)
virtual void Invalidate(InvalidateFlags nFlags=InvalidateFlags::NONE)
void ApplyControlFont(vcl::RenderContext &rRenderContext, const vcl::Font &rDefaultFont)
void SetType(WindowType nType)
Point ScreenToOutputPixel(const Point &rPos) const
void ApplyControlForeground(vcl::RenderContext &rRenderContext, const Color &rDefaultColor)
const OUString & GetHelpText() const
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_ASSERT(sCon, aError)
#define HEAD_HITTEST_ITEM
#define HEADERBAR_TEXTOFF
#define HEAD_HITTEST_DIVIDER
#define HEADERBAR_DRAGOUTOFF
#define HEADERBAR_ARROWOFF
#define HEADERBAR_SPLITOFF
#define HEADERBAR_ITEM_NOTFOUND
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)