19#include <com/sun/star/drawing/FillStyle.hpp>
38#include <editeng/editids.hrc>
48 : StylePreviewRenderer(rShell, rOutputDev, pStyle, nMaxHeight)
52 , maStyleName(mpStyle->
GetName())
65 if (!pItemSet)
return false;
71 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_WEIGHT)) !=
nullptr)
73 aFont.SetWeight(
static_cast<const SvxWeightItem*
>(pItem)->GetWeight());
75 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_POSTURE)) !=
nullptr)
77 aFont.SetItalic(
static_cast<const SvxPostureItem*
>(pItem)->GetPosture());
79 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_CONTOUR)) !=
nullptr)
83 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_SHADOWED)) !=
nullptr)
87 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_RELIEF)) !=
nullptr)
91 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_UNDERLINE)) !=
nullptr)
93 aFont.SetUnderline(
static_cast< const SvxUnderlineItem*
>(pItem)->GetLineStyle());
95 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_OVERLINE)) !=
nullptr)
99 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_STRIKEOUT)) !=
nullptr)
101 aFont.SetStrikeout(
static_cast<const SvxCrossedOutItem*
>(pItem)->GetStrikeout());
103 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_CASEMAP)) !=
nullptr)
107 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_EMPHASISMARK)) !=
nullptr)
111 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_COLOR)) !=
nullptr)
115 if ((pItem = pItemSet->GetItem(SID_ATTR_BRUSH_CHAR)) !=
nullptr)
125 if (aFillStyle == drawing::FillStyle_SOLID)
135 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_FONT)) !=
nullptr)
148 if ((pItem = pItemSet->GetItem(SID_ATTR_CHAR_FONTHEIGHT)) !=
nullptr)
218 aFontDrawPosition.AdjustY((aRectangle.
GetHeight() - aPixelSize.
Height()) / 2 );
222 m_oFont->QuickDrawText( &
mrOutputDev, aFontDrawPosition, rText, 0, rText.getLength(), {} );
const vcl::Font & GetFont() const
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
void SetTextColor(const Color &rColor)
SAL_WARN_UNUSED_RESULT Point LogicToPixel(const Point &rLogicPt) const
void Push(vcl::PushFlags nFlags=vcl::PushFlags::ALL)
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)
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, o3tl::span< const sal_Int32 > pDXArray={}, const SalLayoutGlyphs *pGlyphs=nullptr) const
MapUnit GetMapUnit() const
const OUString & GetName() const
SfxStyleFamily GetFamily() const
virtual std::optional< SfxItemSet > GetItemSetForPreview()
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
sal_uInt32 GetHeight() const
const OUString & GetStyleName() const
const OUString & GetFamilyName() const
void SetCaseMap(const SvxCaseMap eNew)
SfxStyleSheetBase * mpStyle
OutputDevice & mrOutputDev
const SfxObjectShell & mrShell
CommonStylePreviewRenderer(const SfxObjectShell &rShell, OutputDevice &rOutputDev, SfxStyleSheetBase *pStyle, tools::Long nMaxHeight)
virtual ~CommonStylePreviewRenderer() override
virtual bool render(const tools::Rectangle &aRectangle, RenderAlign eRenderAlign=RenderAlign::CENTER) override
std::optional< SvxFont > m_oFont
virtual bool recalculate() override
Size getRenderSize() const
const Size & GetFontSize() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
virtual OUString GetName() const override
UNOTOOLS_DLLPUBLIC bool IsStarSymbol(std::u16string_view rFontName)
sal_Int16 GetCaseMap(sal_Int32 nToken)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)