34#include <rtl/math.hxx>
42const double gnPreviewOffsetScale = 1.0 / 8.0;
44::tools::Rectangle GrowRectangle (const ::tools::Rectangle& rBox,
const sal_Int32 nOffset)
46 return ::tools::Rectangle (
47 rBox.Left() - nOffset,
49 rBox.Right() + nOffset,
50 rBox.Bottom() + nOffset);
53sal_Int32 RoundToInt (
const double nValue) {
return sal_Int32(::rtl::math::round(nValue)); }
80 if (pTransferable ==
nullptr)
83 std::shared_ptr<controller::TransferableData>
pData (
87 sal_Int32 nSelectionCount (0);
93 if (pDataDocShell !=
nullptr)
96 if (pDataDocument !=
nullptr)
100 Create(
pData->GetRepresentatives(), nSelectionCount);
104 const ::std::vector<controller::TransferableData::Representative>& rRepresentatives,
105 const sal_Int32 nSelectionCount)
108 const std::shared_ptr<view::PageObjectLayouter>& pPageObjectLayouter (
111 const Size aOriginalPreviewSize (pPageObjectLayouter->GetPreviewSize());
113 const double nPreviewScale (0.5);
114 const Size aPreviewSize (
115 RoundToInt(aOriginalPreviewSize.
Width()*nPreviewScale),
116 RoundToInt(aOriginalPreviewSize.
Height()*nPreviewScale));
117 const sal_Int32 nOffset (
118 RoundToInt(std::min(aPreviewSize.
Width(),aPreviewSize.
Height()) * gnPreviewOffsetScale));
121 sal_Int32
nCount (rRepresentatives.size());
132 pContent->SetOutputSizePixel(aIconSize);
134 pContent->SetFillColor();
138 PaintPageCount(*pContent, nSelectionCount, aPreviewSize, aOffset);
140 maIcon = pContent->GetBitmapEx(
Point(0,0), aIconSize);
146 const Size& rPreviewSize,
147 const sal_Int32 nOffset,
148 const ::std::vector<controller::TransferableData::Representative>& rRepresentatives)
const
150 const Point aOffset (0,rRepresentatives.size()==1 ? -nOffset : 0);
153 Point aPageOffset (0,0);
154 double nTransparency (0);
163 aPageOffset =
Point(0, nOffset);
164 nTransparency = 0.85;
167 aPageOffset =
Point(nOffset, 0);
168 nTransparency = 0.75;
171 aPageOffset =
Point(2*nOffset, 2*nOffset);
172 nTransparency = 0.65;
175 aPageOffset += aOffset;
181 aPreview.
Scale(rPreviewSize, BmpScaleFlag::BestQuality);
186 if (rRepresentatives[
nIndex].mbIsExcluded)
193 if (nIconWidth>0 && nIconHeight>0)
206 aPageOffset.
X()+rPreviewSize.
Width()-1,
207 aPageOffset.
Y()+rPreviewSize.
Height()-1);
233 const sal_Int32 nSelectionCount,
234 const Size& rPreviewSize,
235 const Point& rFirstPageOffset)
const
243 OUString sNumber (OUString::number(nSelectionCount));
253 Point aTextLocation(rFirstPageOffset);
255 aTextLocation +=
Point(
261 static const sal_Int32
nBorder = 5;
276 const Point aTopLeft (
296 const ::tools::Rectangle&)
319 std::shared_ptr<LayeredDevice> pLayeredDevice (
323 pLayeredDevice->RegisterPainter(shared_from_this(),
gnLayerIndex);
336 std::shared_ptr<LayeredDevice> pLayeredDevice (
342 pLayeredDevice->RemovePainter(shared_from_this(),
gnLayerIndex);
SlideSorter & mrSlideSorter
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
const Size & GetSizePixel() const
vcl::Region GetClipRegion() const
void DrawBitmapEx(const Point &rDestPt, const BitmapEx &rBitmapEx)
void SetFont(const vcl::Font &rNewFont)
void DrawRect(const tools::Rectangle &rRect)
bool GetTextBoundRect(tools::Rectangle &rRect, const OUString &rStr, sal_Int32 nBase=0, sal_Int32 nIndex=0, sal_Int32 nLen=-1, sal_uLong nLayoutWidth=0, KernArraySpan aDXArray=KernArraySpan(), o3tl::span< const sal_Bool > pKashidaArray={}, const SalLayoutGlyphs *pGlyphs=nullptr) const
void SetTextColor(const Color &rColor)
void DrawImage(const Point &rPos, const Image &rImage, DrawImageFlags nStyle=DrawImageFlags::NONE)
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)
void DrawTransparent(const tools::PolyPolygon &rPolyPoly, sal_uInt16 nTransparencePercent)
void IntersectClipRegion(const tools::Rectangle &rRect)
constexpr tools::Long Y() const
tools::Long AdjustY(tools::Long nVertMove)
tools::Long AdjustX(tools::Long nHorzMove)
constexpr tools::Long X() const
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
const SfxObjectShellRef & GetDocShell() const
bool HasPageBookmarks() const
const std::vector< OUString > & GetPageBookmarks() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
SdDrawDocument * GetDoc()
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
std::shared_ptr< view::Theme > const & GetTheme() const
Return the active theme which gives access to colors and fonts.
const VclPtr< sd::Window > & GetContentWindow() const
Return the content window.
view::SlideSorterView & GetView() const
static std::shared_ptr< TransferableData > GetFromTransferable(const SdTransferable *pTransferable)
InsertionIndicatorOverlay(SlideSorter &rSlideSorter)
Point PaintRepresentatives(OutputDevice &rContent, const Size &rPreviewSize, const sal_Int32 nOffset, const ::std::vector< controller::TransferableData::Representative > &rPages) const
virtual void SetLayerInvalidator(const SharedILayerInvalidator &rpInvalidator) override
void SetLocation(const Point &rPosition)
Given a position in model coordinates this method calculates the insertion marker both as an index in...
SlideSorter & mrSlideSorter
void Create(const SdTransferable *pTransferable)
virtual void Paint(OutputDevice &rDevice, const ::tools::Rectangle &rRepaintArea) override
SharedILayerInvalidator mpLayerInvalidator
std::unique_ptr< FramePainter > mpShadowPainter
::tools::Rectangle GetBoundingBox() const
virtual ~InsertionIndicatorOverlay() override
void PaintPageCount(OutputDevice &rDevice, const sal_Int32 nSelectionCount, const Size &rPreviewSize, const Point &rFirstPageOffset) const
Calculate the size and position of page objects displayed by a slide sorter.
std::shared_ptr< PageObjectLayouter > const & GetPageObjectLayouter() const
view::Layouter & GetLayouter()
const std::shared_ptr< LayeredDevice > & GetLayeredDevice() const
Collection of colors and styles that are used to paint the slide sorter view.
static std::shared_ptr< vcl::Font > GetFont(const FontType eType, const OutputDevice &rDevice)
@ Color_PageCountFontColor
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define suppress_fun_call_w_exception(expr)
std::unique_ptr< sal_Int32[]> pData
tools::Long const nBorder
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
const sal_Int32 gnLayerIndex
std::shared_ptr< ILayerInvalidator > SharedILayerInvalidator
const sal_Int32 gnShadowBorder