LibreOffice Module sd (master) 1
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
sd::PreviewRenderer Class Referencefinal

#include <PreviewRenderer.hxx>

Inheritance diagram for sd::PreviewRenderer:
[legend]
Collaboration diagram for sd::PreviewRenderer:
[legend]

Public Member Functions

 PreviewRenderer (const bool bPaintFrame=true)
 Create a new preview renderer that takes some of its initial values from the given output device. More...
 
virtual ~PreviewRenderer () override
 
Image RenderPage (const SdPage *pPage, const sal_Int32 nWidth)
 Render a page with the given pixel size. More...
 
Image RenderPage (const SdPage *pPage, const Size aPreviewPixelSize, const bool bObeyHighContrastMode, const bool bDisplayPresentationObjects=true)
 Render a page with the given pixel size. More...
 
Image RenderSubstitution (const Size &rPreviewPixelSize, const OUString &sSubstitutionText)
 Render an image that contains the given substitution text instead of a slide preview. More...
 
Image ScaleBitmap (const BitmapEx &rBitmap, int nWidth)
 Scale the given bitmap by keeping its aspect ratio to the desired width. More...
 
- Public Member Functions inherited from SfxListener
 SfxListener ()
 
 SfxListener (const SfxListener &rCopy)
 
virtual ~SfxListener () COVERITY_NOEXCEPT_FALSE
 
void StartListening (SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
 
void EndListening (SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
 
void EndListeningAll ()
 
bool IsListening (SfxBroadcaster &rBroadcaster) const
 
sal_uInt16 GetBroadcasterCount () const
 
SfxBroadcasterGetBroadcasterJOE (sal_uInt16 nNo) const
 
virtual void Notify (SfxBroadcaster &rBC, const SfxHint &rHint)
 
void RemoveBroadcaster_Impl (SfxBroadcaster &rBC)
 
virtual bool IsSdrView () const
 

Protected Member Functions

virtual void Notify (SfxBroadcaster &rBC, const SfxHint &rHint) override
 

Private Member Functions

bool Initialize (const SdPage *pPage, const Size &rPixelSize, const bool bObeyHighContrastMode)
 
void PaintPage (const SdPage *pPage, const bool bDisplayPresentationObjects)
 
void PaintSubstitutionText (const OUString &rSubstitutionText)
 
void PaintFrame ()
 
void SetupOutputSize (const SdPage &rPage, const Size &rPixelSize)
 Set up the map mode so that the given page is renderer into a bitmap with the specified width. More...
 
void ProvideView (DrawDocShell *pDocShell)
 When mpView is empty then create a new view and initialize it. More...
 

Private Attributes

ScopedVclPtr< VirtualDevicempPreviewDevice
 
::std::unique_ptr< DrawViewmpView
 
DrawDocShellmpDocShellOfView
 
const Color maFrameColor
 
const bool mbHasFrame
 

Static Private Attributes

static const int snSubstitutionTextSize = 11
 
static const int snFrameWidth = 1
 

Detailed Description

Definition at line 35 of file PreviewRenderer.hxx.

Constructor & Destructor Documentation

◆ PreviewRenderer()

sd::PreviewRenderer::PreviewRenderer ( const bool  bPaintFrame = true)

Create a new preview renderer that takes some of its initial values from the given output device.

Parameters
bPaintFrameWhen <TRUE> (the default) then a frame is painted around the preview. This makes the actual preview smaller.

Definition at line 67 of file PreviewRenderer.cxx.

References ColorConfig, Create(), DOCBOUNDARIES, Application::GetSettings(), and mpPreviewDevice.

◆ ~PreviewRenderer()

sd::PreviewRenderer::~PreviewRenderer ( )
overridevirtual

Definition at line 78 of file PreviewRenderer.cxx.

References SfxListener::EndListening(), and mpDocShellOfView.

Member Function Documentation

◆ Initialize()

bool sd::PreviewRenderer::Initialize ( const SdPage pPage,
const Size rPixelSize,
const bool  bObeyHighContrastMode 
)
private

◆ Notify()

void sd::PreviewRenderer::Notify ( SfxBroadcaster rBC,
const SfxHint rHint 
)
overrideprotectedvirtual

Reimplemented from SfxListener.

Definition at line 462 of file PreviewRenderer.cxx.

References SfxHint::GetId(), mpDocShellOfView, and mpView.

◆ PaintFrame()

void sd::PreviewRenderer::PaintFrame ( )
private

Definition at line 335 of file PreviewRenderer.cxx.

References maFrameColor, mbHasFrame, and mpPreviewDevice.

Referenced by RenderPage(), and RenderSubstitution().

◆ PaintPage()

void sd::PreviewRenderer::PaintPage ( const SdPage pPage,
const bool  bDisplayPresentationObjects 
)
private

◆ PaintSubstitutionText()

void sd::PreviewRenderer::PaintSubstitutionText ( const OUString &  rSubstitutionText)
private

◆ ProvideView()

void sd::PreviewRenderer::ProvideView ( DrawDocShell pDocShell)
private

When mpView is empty then create a new view and initialize it.

Otherwise just initialize it.

Definition at line 382 of file PreviewRenderer.cxx.

References SfxListener::EndListening(), VclPtr< class reference_type >::get(), mpDocShellOfView, mpPreviewDevice, mpView, and SfxListener::StartListening().

Referenced by Initialize().

◆ RenderPage() [1/2]

Image sd::PreviewRenderer::RenderPage ( const SdPage pPage,
const sal_Int32  nWidth 
)

Render a page with the given pixel size.

Use this version when only the width of the preview is known to the caller. The height is then calculated according to the aspect ratio of the given page.

Parameters
pPageThe page to render.
nWidthThe width of the preview in device coordinates. The high contrast mode of the application is ignored and the preview is rendered in normal mode.

Definition at line 84 of file PreviewRenderer.cxx.

References SdrPage::GetSize(), Size::Height(), mbHasFrame, RenderPage(), snFrameWidth, and Size::Width().

Referenced by sd::slidesorter::cache::BitmapFactory::CreateBitmap(), sd::presenter::SlideRenderer::CreatePreview(), sd::sidebar::PagePreviewProvider::operator()(), and RenderPage().

◆ RenderPage() [2/2]

Image sd::PreviewRenderer::RenderPage ( const SdPage pPage,
const Size  aPreviewPixelSize,
const bool  bObeyHighContrastMode,
const bool  bDisplayPresentationObjects = true 
)

Render a page with the given pixel size.

Parameters
pPageThe page to render.
aPreviewPixelSizeThe size in device coordinates of the preview.
bObeyHighContrastModeWhen <FALSE> then the high contrast mode of the application is ignored and the preview is rendered in normal mode. When <TRUE> and high contrast mode is active then the preview is rendered in high contrast mode.
bDisplayPresentationObjectsWhen <FALSE> then the PresObj place holders are not displayed in the returned preview.

Definition at line 105 of file PreviewRenderer.cxx.

References DBG_UNHANDLED_EXCEPTION, Initialize(), mpPreviewDevice, mpView, PaintFrame(), PaintPage(), and PaintSubstitutionText().

◆ RenderSubstitution()

Image sd::PreviewRenderer::RenderSubstitution ( const Size rPreviewPixelSize,
const OUString &  sSubstitutionText 
)

◆ ScaleBitmap()

Image sd::PreviewRenderer::ScaleBitmap ( const BitmapEx rBitmap,
int  nWidth 
)

◆ SetupOutputSize()

void sd::PreviewRenderer::SetupOutputSize ( const SdPage rPage,
const Size rPixelSize 
)
private

Set up the map mode so that the given page is renderer into a bitmap with the specified width.

Parameters
rPageThe page for which the preview is created.
rPixelSizeThe size of the resulting preview bitmap. Note that this size includes the frame. The actual preview is smaller accordingly.

Definition at line 351 of file PreviewRenderer.cxx.

References SdrPage::GetSize(), Size::Height(), Size::IsEmpty(), mbHasFrame, mpPreviewDevice, MapMode::SetMapUnit(), MapMode::SetOrigin(), MapMode::SetScaleX(), MapMode::SetScaleY(), snFrameWidth, and Size::Width().

Referenced by Initialize().

Member Data Documentation

◆ maFrameColor

const Color sd::PreviewRenderer::maFrameColor
private

Definition at line 107 of file PreviewRenderer.hxx.

Referenced by PaintFrame(), and ScaleBitmap().

◆ mbHasFrame

const bool sd::PreviewRenderer::mbHasFrame
private

Definition at line 108 of file PreviewRenderer.hxx.

Referenced by PaintFrame(), RenderPage(), RenderSubstitution(), and SetupOutputSize().

◆ mpDocShellOfView

DrawDocShell* sd::PreviewRenderer::mpDocShellOfView
private

Definition at line 106 of file PreviewRenderer.hxx.

Referenced by Notify(), PaintPage(), ProvideView(), and ~PreviewRenderer().

◆ mpPreviewDevice

ScopedVclPtr<VirtualDevice> sd::PreviewRenderer::mpPreviewDevice
private

◆ mpView

::std::unique_ptr<DrawView> sd::PreviewRenderer::mpView
private

Definition at line 105 of file PreviewRenderer.hxx.

Referenced by Initialize(), Notify(), PaintPage(), ProvideView(), and RenderPage().

◆ snFrameWidth

const int sd::PreviewRenderer::snFrameWidth = 1
staticprivate

Definition at line 111 of file PreviewRenderer.hxx.

Referenced by RenderPage(), RenderSubstitution(), and SetupOutputSize().

◆ snSubstitutionTextSize

const int sd::PreviewRenderer::snSubstitutionTextSize = 11
staticprivate

Definition at line 109 of file PreviewRenderer.hxx.

Referenced by PaintSubstitutionText().


The documentation for this class was generated from the following files: