renaissance1: #i107215# Do not show PresObjs in previews.
This commit is contained in:
@@ -80,12 +80,16 @@ public:
|
|||||||
ignored and the preview is rendered in normal mode. When
|
ignored and the preview is rendered in normal mode. When
|
||||||
<TRUE/> and high contrast mode is active then the preview is
|
<TRUE/> and high contrast mode is active then the preview is
|
||||||
rendered in high contrast mode.
|
rendered in high contrast mode.
|
||||||
|
@param bDisplayPresentationObjects
|
||||||
|
When <FALSE/> then the PresObj place holders are not displayed
|
||||||
|
in the returned preview.
|
||||||
*/
|
*/
|
||||||
Image RenderPage (
|
Image RenderPage (
|
||||||
const SdPage* pPage,
|
const SdPage* pPage,
|
||||||
const sal_Int32 nWidth,
|
const sal_Int32 nWidth,
|
||||||
const String& sSubstitutionText,
|
const String& sSubstitutionText,
|
||||||
const bool bObeyHighContrastMode = true);
|
const bool bObeyHighContrastMode = true,
|
||||||
|
const bool bDisplayPresentationObjects = true);
|
||||||
|
|
||||||
/** Render a page with the given pixel size.
|
/** Render a page with the given pixel size.
|
||||||
@param pPage
|
@param pPage
|
||||||
@@ -101,12 +105,16 @@ public:
|
|||||||
ignored and the preview is rendered in normal mode. When
|
ignored and the preview is rendered in normal mode. When
|
||||||
<TRUE/> and high contrast mode is active then the preview is
|
<TRUE/> and high contrast mode is active then the preview is
|
||||||
rendered in high contrast mode.
|
rendered in high contrast mode.
|
||||||
|
@param bDisplayPresentationObjects
|
||||||
|
When <FALSE/> then the PresObj place holders are not displayed
|
||||||
|
in the returned preview.
|
||||||
*/
|
*/
|
||||||
Image RenderPage (
|
Image RenderPage (
|
||||||
const SdPage* pPage,
|
const SdPage* pPage,
|
||||||
const Size aPreviewPixelSize,
|
const Size aPreviewPixelSize,
|
||||||
const String& sSubstitutionText,
|
const String& sSubstitutionText,
|
||||||
const bool bObeyHighContrastMode = true);
|
const bool bObeyHighContrastMode = true,
|
||||||
|
const bool bDisplayPresentationObjects = true);
|
||||||
|
|
||||||
/** Render an image that contains the given substitution text instead of a
|
/** Render an image that contains the given substitution text instead of a
|
||||||
slide preview.
|
slide preview.
|
||||||
@@ -143,7 +151,9 @@ private:
|
|||||||
const Size& rPixelSize,
|
const Size& rPixelSize,
|
||||||
const bool bObeyHighContrastMode);
|
const bool bObeyHighContrastMode);
|
||||||
void Cleanup (void);
|
void Cleanup (void);
|
||||||
void PaintPage (const SdPage* pPage);
|
void PaintPage (
|
||||||
|
const SdPage* pPage,
|
||||||
|
const bool bDisplayPresentationObjects);
|
||||||
void PaintSubstitutionText (const String& rSubstitutionText);
|
void PaintSubstitutionText (const String& rSubstitutionText);
|
||||||
void PaintFrame (void);
|
void PaintFrame (void);
|
||||||
|
|
||||||
|
@@ -35,11 +35,12 @@
|
|||||||
#include "view/SlideSorterView.hxx"
|
#include "view/SlideSorterView.hxx"
|
||||||
#include "sdpage.hxx"
|
#include "sdpage.hxx"
|
||||||
#include "Window.hxx"
|
#include "Window.hxx"
|
||||||
|
#include <drawdoc.hxx>
|
||||||
|
#include "DrawDocShell.hxx"
|
||||||
#include <svx/svdtypes.hxx>
|
#include <svx/svdtypes.hxx>
|
||||||
#include <svx/svdpage.hxx>
|
#include <svx/svdpage.hxx>
|
||||||
#include <vcl/bitmapex.hxx>
|
#include <vcl/bitmapex.hxx>
|
||||||
#include <vcl/bmpacc.hxx>
|
#include <vcl/bmpacc.hxx>
|
||||||
|
|
||||||
#include <vcl/pngwrite.hxx>
|
#include <vcl/pngwrite.hxx>
|
||||||
|
|
||||||
const static sal_Int32 gnSuperSampleFactor (2);
|
const static sal_Int32 gnSuperSampleFactor (2);
|
||||||
@@ -80,7 +81,12 @@ Bitmap BitmapFactory::CreateBitmap (
|
|||||||
aSize.Height() *= gnSuperSampleFactor;
|
aSize.Height() *= gnSuperSampleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap aPreview (maRenderer.RenderPage (&rPage, aSize, String()).GetBitmapEx().GetBitmap());
|
Bitmap aPreview (maRenderer.RenderPage (
|
||||||
|
&rPage,
|
||||||
|
aSize,
|
||||||
|
String(),
|
||||||
|
true,
|
||||||
|
false).GetBitmapEx().GetBitmap());
|
||||||
if (bDoSuperSampling && gbAllowSuperSampling)
|
if (bDoSuperSampling && gbAllowSuperSampling)
|
||||||
{
|
{
|
||||||
aPreview.Scale(rPixelSize, BMP_SCALE_INTERPOLATE);
|
aPreview.Scale(rPixelSize, BMP_SCALE_INTERPOLATE);
|
||||||
|
@@ -42,6 +42,8 @@
|
|||||||
#include <editeng/editstat.hxx>
|
#include <editeng/editstat.hxx>
|
||||||
#include <tools/link.hxx>
|
#include <tools/link.hxx>
|
||||||
#include <vcl/svapp.hxx>
|
#include <vcl/svapp.hxx>
|
||||||
|
#include <svx/sdr/contact/viewobjectcontact.hxx>
|
||||||
|
#include <svx/sdr/contact/viewcontact.hxx>
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
using namespace ::com::sun::star::uno;
|
using namespace ::com::sun::star::uno;
|
||||||
@@ -52,6 +54,26 @@ namespace sd {
|
|||||||
const int PreviewRenderer::snSubstitutionTextSize = 11;
|
const int PreviewRenderer::snSubstitutionTextSize = 11;
|
||||||
const int PreviewRenderer::snFrameWidth = 1;
|
const int PreviewRenderer::snFrameWidth = 1;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
/** This incarnation of the ViewObjectContactRedirector filters away all
|
||||||
|
PageObj objects, unconditionally.
|
||||||
|
*/
|
||||||
|
class ViewRedirector : public ::sdr::contact::ViewObjectContactRedirector
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ViewRedirector (void);
|
||||||
|
virtual ~ViewRedirector (void);
|
||||||
|
virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
|
||||||
|
const sdr::contact::ViewObjectContact& rOriginal,
|
||||||
|
const sdr::contact::DisplayInfo& rDisplayInfo);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//===== PreviewRenderer =======================================================
|
||||||
|
|
||||||
PreviewRenderer::PreviewRenderer (
|
PreviewRenderer::PreviewRenderer (
|
||||||
OutputDevice* pTemplate,
|
OutputDevice* pTemplate,
|
||||||
const bool bHasFrame)
|
const bool bHasFrame)
|
||||||
@@ -90,7 +112,8 @@ Image PreviewRenderer::RenderPage (
|
|||||||
const SdPage* pPage,
|
const SdPage* pPage,
|
||||||
const sal_Int32 nWidth,
|
const sal_Int32 nWidth,
|
||||||
const String& rSubstitutionText,
|
const String& rSubstitutionText,
|
||||||
const bool bObeyHighContrastMode)
|
const bool bObeyHighContrastMode,
|
||||||
|
const bool bDisplayPresentationObjects)
|
||||||
{
|
{
|
||||||
if (pPage != NULL)
|
if (pPage != NULL)
|
||||||
{
|
{
|
||||||
@@ -100,7 +123,12 @@ Image PreviewRenderer::RenderPage (
|
|||||||
const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
|
const sal_Int32 nFrameWidth (mbHasFrame ? snFrameWidth : 0);
|
||||||
const sal_Int32 nHeight (sal::static_int_cast<sal_Int32>(
|
const sal_Int32 nHeight (sal::static_int_cast<sal_Int32>(
|
||||||
(nWidth - 2*nFrameWidth) / nAspectRatio + 2*nFrameWidth + 0.5));
|
(nWidth - 2*nFrameWidth) / nAspectRatio + 2*nFrameWidth + 0.5));
|
||||||
return RenderPage (pPage, Size(nWidth,nHeight), rSubstitutionText, bObeyHighContrastMode);
|
return RenderPage (
|
||||||
|
pPage,
|
||||||
|
Size(nWidth,nHeight),
|
||||||
|
rSubstitutionText,
|
||||||
|
bObeyHighContrastMode,
|
||||||
|
bDisplayPresentationObjects);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return Image();
|
return Image();
|
||||||
@@ -113,7 +141,8 @@ Image PreviewRenderer::RenderPage (
|
|||||||
const SdPage* pPage,
|
const SdPage* pPage,
|
||||||
Size aPixelSize,
|
Size aPixelSize,
|
||||||
const String& rSubstitutionText,
|
const String& rSubstitutionText,
|
||||||
const bool bObeyHighContrastMode)
|
const bool bObeyHighContrastMode,
|
||||||
|
const bool bDisplayPresentationObjects)
|
||||||
{
|
{
|
||||||
Image aPreview;
|
Image aPreview;
|
||||||
|
|
||||||
@@ -121,10 +150,10 @@ Image PreviewRenderer::RenderPage (
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Initialize (pPage, aPixelSize, bObeyHighContrastMode))
|
if (Initialize(pPage, aPixelSize, bObeyHighContrastMode))
|
||||||
{
|
{
|
||||||
PaintPage (pPage);
|
PaintPage(pPage, bDisplayPresentationObjects);
|
||||||
PaintSubstitutionText (rSubstitutionText);
|
PaintSubstitutionText(rSubstitutionText);
|
||||||
PaintFrame();
|
PaintFrame();
|
||||||
|
|
||||||
Size aSize (mpPreviewDevice->GetOutputSizePixel());
|
Size aSize (mpPreviewDevice->GetOutputSizePixel());
|
||||||
@@ -165,7 +194,7 @@ Image PreviewRenderer::RenderSubstitution (
|
|||||||
? ViewShell::OUTPUT_DRAWMODE_CONTRAST
|
? ViewShell::OUTPUT_DRAWMODE_CONTRAST
|
||||||
: ViewShell::OUTPUT_DRAWMODE_COLOR);
|
: ViewShell::OUTPUT_DRAWMODE_COLOR);
|
||||||
|
|
||||||
// Set a map mode makes a typical substitution text completely
|
// Set a map mode that makes a typical substitution text completely
|
||||||
// visible.
|
// visible.
|
||||||
MapMode aMapMode (mpPreviewDevice->GetMapMode());
|
MapMode aMapMode (mpPreviewDevice->GetMapMode());
|
||||||
aMapMode.SetMapUnit(MAP_100TH_MM);
|
aMapMode.SetMapUnit(MAP_100TH_MM);
|
||||||
@@ -287,7 +316,9 @@ void PreviewRenderer::Cleanup (void)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PreviewRenderer::PaintPage (const SdPage* pPage)
|
void PreviewRenderer::PaintPage (
|
||||||
|
const SdPage* pPage,
|
||||||
|
const bool bDisplayPresentationObjects)
|
||||||
{
|
{
|
||||||
// Paint the page.
|
// Paint the page.
|
||||||
Rectangle aPaintRectangle (Point(0,0), pPage->GetSize());
|
Rectangle aPaintRectangle (Point(0,0), pPage->GetSize());
|
||||||
@@ -295,18 +326,22 @@ void PreviewRenderer::PaintPage (const SdPage* pPage)
|
|||||||
|
|
||||||
// Turn off online spelling and redlining.
|
// Turn off online spelling and redlining.
|
||||||
SdrOutliner* pOutliner = NULL;
|
SdrOutliner* pOutliner = NULL;
|
||||||
ULONG nOriginalControlWord = 0;
|
ULONG nSavedControlWord (0);
|
||||||
if (mpDocShellOfView!=NULL && mpDocShellOfView->GetDoc()!=NULL)
|
if (mpDocShellOfView!=NULL && mpDocShellOfView->GetDoc()!=NULL)
|
||||||
{
|
{
|
||||||
pOutliner = &mpDocShellOfView->GetDoc()->GetDrawOutliner();
|
pOutliner = &mpDocShellOfView->GetDoc()->GetDrawOutliner();
|
||||||
nOriginalControlWord = pOutliner->GetControlWord();
|
nSavedControlWord = pOutliner->GetControlWord();
|
||||||
pOutliner->SetControlWord(
|
pOutliner->SetControlWord((nSavedControlWord & ~EE_CNTRL_ONLINESPELLING));
|
||||||
(nOriginalControlWord & ~EE_CNTRL_ONLINESPELLING));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use a special redirector to prevent PresObj shapes from being painted.
|
||||||
|
boost::scoped_ptr<ViewRedirector> pRedirector;
|
||||||
|
if ( ! bDisplayPresentationObjects)
|
||||||
|
pRedirector.reset(new ViewRedirector());
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mpView->CompleteRedraw(mpPreviewDevice.get(), aRegion);
|
mpView->CompleteRedraw(mpPreviewDevice.get(), aRegion, pRedirector.get());
|
||||||
}
|
}
|
||||||
catch (const ::com::sun::star::uno::Exception&)
|
catch (const ::com::sun::star::uno::Exception&)
|
||||||
{
|
{
|
||||||
@@ -315,7 +350,7 @@ void PreviewRenderer::PaintPage (const SdPage* pPage)
|
|||||||
|
|
||||||
// Restore the previous online spelling and redlining states.
|
// Restore the previous online spelling and redlining states.
|
||||||
if (pOutliner != NULL)
|
if (pOutliner != NULL)
|
||||||
pOutliner->SetControlWord(nOriginalControlWord);
|
pOutliner->SetControlWord(nSavedControlWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -516,4 +551,56 @@ void PreviewRenderer::Notify(SfxBroadcaster&, const SfxHint& rHint)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//===== ViewRedirector ========================================================
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
ViewRedirector::ViewRedirector (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ViewRedirector::~ViewRedirector (void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
drawinglayer::primitive2d::Primitive2DSequence ViewRedirector::createRedirectedPrimitive2DSequence(
|
||||||
|
const sdr::contact::ViewObjectContact& rOriginal,
|
||||||
|
const sdr::contact::DisplayInfo& rDisplayInfo)
|
||||||
|
{
|
||||||
|
SdrObject* pObject = rOriginal.GetViewContact().TryToGetSdrObject();
|
||||||
|
|
||||||
|
if (pObject==NULL || pObject->GetPage() == NULL)
|
||||||
|
{
|
||||||
|
// not a SdrObject visualisation (maybe e.g. page) or no page
|
||||||
|
return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
|
||||||
|
rOriginal,
|
||||||
|
rDisplayInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool bDoCreateGeometry (pObject->GetPage()->checkVisibility( rOriginal, rDisplayInfo, true));
|
||||||
|
|
||||||
|
if ( ! bDoCreateGeometry
|
||||||
|
&& (pObject->GetObjInventor() != SdrInventor || pObject->GetObjIdentifier() != OBJ_PAGE))
|
||||||
|
{
|
||||||
|
return drawinglayer::primitive2d::Primitive2DSequence();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pObject->IsEmptyPresObj())
|
||||||
|
return drawinglayer::primitive2d::Primitive2DSequence();
|
||||||
|
|
||||||
|
return sdr::contact::ViewObjectContactRedirector::createRedirectedPrimitive2DSequence(
|
||||||
|
rOriginal,
|
||||||
|
rDisplayInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // end of anonymous namespace
|
||||||
|
|
||||||
|
|
||||||
} // end of namespace ::sd
|
} // end of namespace ::sd
|
||||||
|
Reference in New Issue
Block a user