LibreOffice Module sd (master) 1
|
#include <PreviewRenderer.hxx>
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 |
SfxBroadcaster * | GetBroadcasterJOE (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< VirtualDevice > | mpPreviewDevice |
::std::unique_ptr< DrawView > | mpView |
DrawDocShell * | mpDocShellOfView |
const Color | maFrameColor |
const bool | mbHasFrame |
Static Private Attributes | |
static const int | snSubstitutionTextSize = 11 |
static const int | snFrameWidth = 1 |
Definition at line 35 of file PreviewRenderer.hxx.
sd::PreviewRenderer::PreviewRenderer | ( | const bool | bPaintFrame = true | ) |
Create a new preview renderer that takes some of its initial values from the given output device.
bPaintFrame | When <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.
|
overridevirtual |
Definition at line 78 of file PreviewRenderer.cxx.
References SfxListener::EndListening(), and mpDocShellOfView.
|
private |
Definition at line 198 of file PreviewRenderer.cxx.
References COL_AUTO(), svtools::DOCCOLOR, EE_CHAR_LANGUAGE(), SdrPageView::GetApplicationDocumentColor(), svtools::ColorConfig::GetColorValue(), SdDrawDocument::GetDocSh(), SdrModel::GetDrawOutliner(), SdDrawDocument::GetLanguage(), SdrPage::GetPageNum(), SdrPage::getSdrModelFromSdrPage(), Application::GetSettings(), SdrPage::IsMasterPage(), mpPreviewDevice, mpView, svtools::ColorConfigValue::nColor, sd::OUTPUT_DRAWMODE_COLOR, sd::OUTPUT_DRAWMODE_CONTRAST, ProvideView(), SdrPageView::SetApplicationDocumentColor(), and SetupOutputSize().
Referenced by RenderPage().
|
overrideprotectedvirtual |
Reimplemented from SfxListener.
Definition at line 462 of file PreviewRenderer.cxx.
References SfxHint::GetId(), mpDocShellOfView, and mpView.
|
private |
Definition at line 335 of file PreviewRenderer.cxx.
References maFrameColor, mbHasFrame, and mpPreviewDevice.
Referenced by RenderPage(), and RenderSubstitution().
|
private |
Definition at line 270 of file PreviewRenderer.cxx.
References DBG_UNHANDLED_EXCEPTION, VclPtr< class reference_type >::get(), sd::DrawDocShell::GetDoc(), SdrModel::GetDrawOutliner(), SdrPage::GetSize(), mpDocShellOfView, mpPreviewDevice, and mpView.
Referenced by RenderPage().
|
private |
Definition at line 307 of file PreviewRenderer.cxx.
References Height, mpPreviewDevice, vcl::Font::SetFontHeight(), and snSubstitutionTextSize.
Referenced by RenderPage(), and RenderSubstitution().
|
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().
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.
pPage | The page to render. |
nWidth | The 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().
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.
pPage | The page to render. |
aPreviewPixelSize | The size in device coordinates of the preview. |
bObeyHighContrastMode | When <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. |
bDisplayPresentationObjects | When <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().
Image sd::PreviewRenderer::RenderSubstitution | ( | const Size & | rPreviewPixelSize, |
const OUString & | sSubstitutionText | ||
) |
Render an image that contains the given substitution text instead of a slide preview.
aPreviewPixelSize | The size in device coordinates of the image. |
Definition at line 140 of file PreviewRenderer.cxx.
References DBG_UNHANDLED_EXCEPTION, svtools::DOCCOLOR, svtools::ColorConfig::GetColorValue(), Application::GetSettings(), mbHasFrame, mpPreviewDevice, svtools::ColorConfigValue::nColor, sd::OUTPUT_DRAWMODE_COLOR, sd::OUTPUT_DRAWMODE_CONTRAST, PaintFrame(), PaintSubstitutionText(), MapMode::SetMapUnit(), MapMode::SetOrigin(), MapMode::SetScaleX(), MapMode::SetScaleY(), snFrameWidth, and Size::Width().
Scale the given bitmap by keeping its aspect ratio to the desired width.
Add a frame to it afterwards.
Definition at line 410 of file PreviewRenderer.cxx.
References Application::GetSettings(), BitmapEx::GetSizePixel(), AllSettings::GetStyleSettings(), Size::Height(), maFrameColor, mpPreviewDevice, sd::OUTPUT_DRAWMODE_COLOR, sd::OUTPUT_DRAWMODE_CONTRAST, BitmapEx::Scale(), MapMode::SetMapUnit(), MapMode::SetOrigin(), MapMode::SetScaleX(), MapMode::SetScaleY(), and Size::Width().
Referenced by sd::sidebar::MasterPageDescriptor::UpdatePreview().
Set up the map mode so that the given page is renderer into a bitmap with the specified width.
rPage | The page for which the preview is created. |
rPixelSize | The 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().
|
private |
Definition at line 107 of file PreviewRenderer.hxx.
Referenced by PaintFrame(), and ScaleBitmap().
|
private |
Definition at line 108 of file PreviewRenderer.hxx.
Referenced by PaintFrame(), RenderPage(), RenderSubstitution(), and SetupOutputSize().
|
private |
Definition at line 106 of file PreviewRenderer.hxx.
Referenced by Notify(), PaintPage(), ProvideView(), and ~PreviewRenderer().
|
private |
Definition at line 104 of file PreviewRenderer.hxx.
Referenced by Initialize(), PaintFrame(), PaintPage(), PaintSubstitutionText(), PreviewRenderer(), ProvideView(), RenderPage(), RenderSubstitution(), ScaleBitmap(), and SetupOutputSize().
|
private |
Definition at line 105 of file PreviewRenderer.hxx.
Referenced by Initialize(), Notify(), PaintPage(), ProvideView(), and RenderPage().
|
staticprivate |
Definition at line 111 of file PreviewRenderer.hxx.
Referenced by RenderPage(), RenderSubstitution(), and SetupOutputSize().
|
staticprivate |
Definition at line 109 of file PreviewRenderer.hxx.
Referenced by PaintSubstitutionText().