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 )
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 +
"...");
383 aBuf.remove(
aBuf.getLength() - 3 - 1, 1);
386 while ((nTxtWidth > nMaxTxtWidth) && (
aBuf.getLength() > 3));
387 pItem->maOutText =
aBuf.makeStringAndClear();
388 if (pItem->maOutText.getLength() == 3)
391 pItem->maOutText.clear();
401 nTxtPos -= aImageSize.
Width();
407 nTempWidth += aImageSize.
Width();
408 nTxtPos = aRect.
Left() + (aRect.
GetWidth() - nTempWidth) / 2;
410 nTxtPos += aImageSize.
Width();
413 if (nTxtPos + nTxtWidth + nArrowWidth >= aRect.
Right())
417 nTxtPos += aImageSize.
Width();
425 nTxtPos += aImageSize.
Width();
427 nTxtPos += nArrowWidth;
432 if (!pItem->maOutText.isEmpty() || (nArrowWidth && aTxtSize.
Height()))
435 nTempHeight += aImageSize.
Height();
436 nTxtPosY = aRect.
Top()+((aRect.
GetHeight()-nTempHeight)/2);
438 nTxtPosY += aImageSize.
Height();
442 if (!pItem->maOutText.isEmpty())
450 rRenderContext.
DrawText(
Point(nTxtPos, nTxtPosY), pItem->maOutText);
454 rRenderContext.
Pop();
464 nImagePos -= aImageSize.
Width();
466 nImagePos -= nArrowWidth;
470 nImagePos += nTxtWidth;
472 nImagePos += nArrowWidth;
486 nTempHeight += aTxtSize.
Height();
487 nImagePosY = aRect.
Top() + ((aRect.
GetHeight() - nTempHeight) / 2);
489 if (nImagePos + aImageSize.
Width() <= aRect.
Right())
494 rRenderContext.
DrawImage(
Point(nImagePos, nImagePosY), pItem->maImage, nStyle);
503 nArrowX -= nArrowWidth;
509 nArrowX -= aImageSize.
Width();
511 nArrowX += aImageSize.
Width();
533 nState, aControlValue, OUString());
539 nArrowY = nTxtPosY + (aTxtSize.
Height() / 2);
540 else if (aImageSize.
Width() && aImageSize.
Height())
541 nArrowY = nImagePosY + (aImageSize.
Height() / 2);
584 if (
nPos < nItemCount)
670 bNewOutDrag = !aItemRect.
Contains( rMousePos );
675 if ( (rMousePos.
Y() >= aItemRect.
Top()) && (rMousePos.
Y() <= aItemRect.
Bottom()) )
696 if ( rMousePos.
X() <= 0 )
704 (nOldItemDragPos !=
nPos) &&
785 pItem->mnSize += nDelta;
866 sal_uInt16 nCurItemPos;
871 sal_uInt16 nItemCount =
static_cast<sal_uInt16
>(
mvItemList.size());
872 for (sal_uInt16
i = 0;
i < nItemCount;
i++)
914 for (
size_t i = 0;
i < nItemCount;
i++ )
919 if ( aItemRect.
Right() > 16000 )
947 Window::Command( rCEvt );
971 if ( pItem->maOutText != pItem->maText )
972 aStr = pItem->maText;
973 else if (!pItem->maText.isEmpty())
988 Window::RequestHelp( rHEvt );
993 Window::StateChanged(
nType );
1017 Window::DataChanged( rDCEvt );
1046 DBG_ASSERT( nItemId,
"HeaderBar::InsertItem(): ItemId == 0" );
1048 "HeaderBar::InsertItem(): ItemId already exists" );
1052 pItem->mnId = nItemId;
1053 pItem->mnBits = nBits;
1054 pItem->mnSize = nSize;
1055 pItem->maText = rText;
1087 if (
nPos == nNewPos )
1092 std::unique_ptr<ImplHeadItem> pItem = std::move(*it);
1094 if ( nNewPos <
nPos )
1123 Scroll( nDelta, 0, aRect );
1128 return static_cast<sal_uInt16
>(
mvItemList.size());
1135 if ( pItem->mnId == nItemId )
1136 return static_cast<sal_uInt16
>(
i);
1175 if ( pItem->mnSize != nNewSize )
1177 pItem->mnSize = nNewSize;
1198 if ( pItem->mnBits != nNewBits )
1200 pItem->mnBits = nNewBits;
1239 if ( pItem->maHelpText.isEmpty() && !pItem->maHelpId.isEmpty() )
1243 pItem->maHelpText = pHelp->
GetHelpText( OStringToOUString( pItem->maHelpId, RTL_TEXTENCODING_UTF8 ),
this );
1246 return pItem->maHelpText;
1260 tools::Long nImageHeight = pItem->maImage.GetSizePixel().Height();
1262 nImageHeight += aSize.
Height();
1263 if ( nImageHeight > nMaxImageSize )
1264 nMaxImageSize = nImageHeight;
1270 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 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
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
virtual void SetPointer(PointerStyle)
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)