summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2018-10-23 14:01:24 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2018-10-24 14:42:26 +0200
commit6217cfd414ee86b160313c0a71b7d62e1eb3db14 (patch)
tree1471e49de2c68a0cc4d0f42bfb37dc8bffb883bf
parenta27d9845935149005342c74736a961068e6bf242 (diff)
Introduce OutputDevice type OUTDEV_PDF
Originally I thought mpPDFWriter can be used to create PDF from any OutputDevice, but it's actually just set for the internal VirtualDevice of the PDF writer. So this gets rid of all the special mpPDFWriter and GetPDFWriter() handling and replaces it with checks for OUTDEV_PDF. But since ImplPDFWriter used to be a OUTDEV_VIRDEV, this also introduces OutputDevice::IsVirtual(), which now replaces most of the direct OUTDEV_VIRDEV checks. Change-Id: I11824143b6b8833ecc81119762448cbdf1145dbc Reviewed-on: https://gerrit.libreoffice.org/62257 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
-rw-r--r--chart2/source/controller/main/ChartWindow.cxx3
-rw-r--r--editeng/source/editeng/editobj2.hxx3
-rw-r--r--editeng/source/editeng/impedit3.cxx2
-rw-r--r--editeng/source/editeng/impedit4.cxx5
-rw-r--r--include/svx/sdrpaintwindow.hxx2
-rw-r--r--include/vcl/outdev.hxx10
-rw-r--r--include/vcl/print.hxx2
-rw-r--r--include/vcl/virdev.hxx14
-rw-r--r--sc/source/ui/view/printfun.cxx4
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx18
-rw-r--r--sd/source/ui/view/sdview.cxx18
-rw-r--r--svx/source/sdr/contact/objectcontactofobjlistpainter.cxx2
-rw-r--r--svx/source/sdr/contact/objectcontactofpageview.cxx2
-rw-r--r--svx/source/svdraw/sdrpaintwindow.cxx2
-rw-r--r--sw/source/core/doc/notxtfrm.cxx5
-rw-r--r--sw/source/core/txtnode/fntcache.cxx8
-rw-r--r--sw/source/core/view/vnew.cxx2
-rw-r--r--vcl/inc/salgdi.hxx1
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx3
-rw-r--r--vcl/source/gdi/print2.cxx8
-rw-r--r--vcl/source/gdi/salgdilayout.cxx32
-rw-r--r--vcl/source/gdi/virdev.cxx12
-rw-r--r--vcl/source/outdev/clipping.cxx4
-rw-r--r--vcl/source/outdev/font.cxx56
-rw-r--r--vcl/source/outdev/hatch.cxx6
-rw-r--r--vcl/source/outdev/nativecontrols.cxx2
-rw-r--r--vcl/source/outdev/outdev.cxx16
-rw-r--r--vcl/source/outdev/text.cxx2
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx4
29 files changed, 98 insertions, 150 deletions
diff --git a/chart2/source/controller/main/ChartWindow.cxx b/chart2/source/controller/main/ChartWindow.cxx
index 0453a6ed48d3..57f245fe8db4 100644
--- a/chart2/source/controller/main/ChartWindow.cxx
+++ b/chart2/source/controller/main/ChartWindow.cxx
@@ -90,8 +90,7 @@ void ChartWindow::PrePaint(vcl::RenderContext& )
void ChartWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect)
{
- if (comphelper::LibreOfficeKit::isActive()
- && rRenderContext.GetOutDevType() != OutDevType::OUTDEV_VIRDEV)
+ if (comphelper::LibreOfficeKit::isActive() && !rRenderContext.IsVirtual())
return;
m_bInPaint = true;
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 7da37fc2f31d..9ec7bb698108 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -112,10 +112,11 @@ public:
OutputDevice* GetRefDevPtr() const { return nRefDevPtr; }
sal_uLong GetPaperWidth() const { return nPaperWidth; }
OutDevType GetRefDevType() const { return eRefDevType; }
+ bool RefDevIsVirtual() const
+ { return (eRefDevType == OUTDEV_VIRDEV) || (eRefDevType == OUTDEV_PDF); }
const MapMode& GetRefMapMode() const { return aRefMapMode; }
sal_uInt16 GetStretchX() const { return nStretchX; }
sal_uInt16 GetStretchY() const { return nStretchY; }
-
};
class ContentInfo
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index c4938eb3f075..14e2510024aa 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2831,7 +2831,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
{
// #i75566# Do not use AutoColor when printing OR Pdf export
const bool bPrinting(OUTDEV_PRINTER == pOut->GetOutDevType());
- const bool bPDFExporting(nullptr != pOut->GetPDFWriter());
+ const bool bPDFExporting(OUTDEV_PDF == pOut->GetOutDevType());
if ( IsAutoColorEnabled() && !bPrinting && !bPDFExporting)
{
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 64bc7443014e..4be47ec63d4a 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1178,9 +1178,8 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject
&& ( pPortionInfo->GetStretchX() == nStretchX )
&& ( pPortionInfo->GetStretchY() == nStretchY ) )
{
- if ( ( pPortionInfo->GetRefDevPtr() == GetRefDevice() ) ||
- ( ( pPortionInfo->GetRefDevType() == OUTDEV_VIRDEV ) &&
- ( GetRefDevice()->GetOutDevType() == OUTDEV_VIRDEV ) ) )
+ if ( (pPortionInfo->GetRefDevPtr() == GetRefDevice()) ||
+ (pPortionInfo->RefDevIsVirtual() && GetRefDevice()->IsVirtual()) )
bUsePortionInfo = true;
}
diff --git a/include/svx/sdrpaintwindow.hxx b/include/svx/sdrpaintwindow.hxx
index 92d928da71d2..c99c578f0da3 100644
--- a/include/svx/sdrpaintwindow.hxx
+++ b/include/svx/sdrpaintwindow.hxx
@@ -115,7 +115,7 @@ public:
bool OutputToWindow() const { return (OUTDEV_WINDOW == mpOutputDevice->GetOutDevType()); }
// Is OutDev a VirtualDevice?
- bool OutputToVirtualDevice() const { return (OUTDEV_VIRDEV == mpOutputDevice->GetOutDevType()); }
+ bool OutputIsVirtualDevice() const { return mpOutputDevice->IsVirtual(); }
// Is OutDev a recording MetaFile?
bool OutputToRecordingMetaFile() const;
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 4980757a4b1a..04bd178ed300 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -298,7 +298,7 @@ namespace o3tl
template<> struct typed_flags<InvertFlags> : is_typed_flags<InvertFlags, 0x0007> {};
}
-enum OutDevType { OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV };
+enum OutDevType { OUTDEV_WINDOW, OUTDEV_PRINTER, OUTDEV_VIRDEV, OUTDEV_PDF };
enum class OutDevViewType { DontKnow, PrintPreview, SlideShow };
@@ -346,7 +346,6 @@ private:
std::unique_ptr<OutDevStateStack> mpOutDevStateStack;
std::unique_ptr<ImplOutDevData> mpOutDevData;
std::vector< VCLXGraphics* >* mpUnoGraphicsList;
- VclPtr<OutputDevice> mpPDFWriter;
vcl::ExtOutDevData* mpExtOutDevData;
// TEMP TEMP TEMP
@@ -542,6 +541,10 @@ public:
}
OutDevType GetOutDevType() const { return meOutDevType; }
+ bool IsVirtual() const
+ {
+ return (meOutDevType == OUTDEV_VIRDEV) || (meOutDevType == OUTDEV_PDF);
+ }
/** Query an OutputDevice to see whether it supports a specific operation
@@ -549,8 +552,6 @@ public:
*/
bool SupportsOperation( OutDevSupportType ) const;
- vcl::PDFWriterImpl* GetPDFWriter() const;
-
void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; }
vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; }
@@ -1290,7 +1291,6 @@ protected:
SAL_DLLPRIVATE const LogicalFontInstance* GetFontInstance() const;
SAL_DLLPRIVATE long GetEmphasisAscent() const { return mnEmphasisAscent; }
SAL_DLLPRIVATE long GetEmphasisDescent() const { return mnEmphasisDescent; }
- SAL_DLLPRIVATE void SetPDFWriter(vcl::PDFWriterImpl* pPDFWriter);
virtual void InitFont() const;
virtual void SetFontOrientation( LogicalFontInstance* const pFontInstance ) const;
diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx
index d5f4f6d86635..ae3c773cf934 100644
--- a/include/vcl/print.hxx
+++ b/include/vcl/print.hxx
@@ -44,11 +44,11 @@ struct SalPrinterQueueInfo;
class SalPrinter;
class VirtualDevice;
enum class SalPrinterError;
-namespace vcl { class Window; }
namespace vcl {
class PrinterController;
class PrintDialog;
+ class Window;
}
namespace weld { class Window; }
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index f608b5797844..48bd4ff4c507 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -21,8 +21,8 @@
#define INCLUDED_VCL_VIRDEV_HXX
#include <vcl/dllapi.h>
-#include <vcl/salgtype.hxx>
#include <vcl/outdev.hxx>
+#include <vcl/salgtype.hxx>
#include <memory>
class SalVirtualDevice;
@@ -89,8 +89,12 @@ protected:
Device format of the generated virtual device. Use DeviceFormat::DEFAULT here, to
indicate: take default screen depth. Only DeviceFormat::BITMASK
is the other possibility to denote a binary mask.
+
+ @param eOutDevType
+ This real virtual output device type.
*/
- explicit VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat, DeviceFormat eAlphaFormat);
+ explicit VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
+ DeviceFormat eAlphaFormat, OutDevType eOutDevType);
public:
@@ -102,7 +106,7 @@ public:
is the other possibility to denote a binary mask.
*/
explicit VirtualDevice(DeviceFormat eFormat = DeviceFormat::DEFAULT)
- : VirtualDevice(nullptr, eFormat, DeviceFormat::NONE) {}
+ : VirtualDevice(nullptr, eFormat, DeviceFormat::NONE, OUTDEV_VIRDEV) {}
/** Create a virtual device of size 1x1
@@ -116,7 +120,7 @@ public:
*/
explicit VirtualDevice(const OutputDevice& rCompDev,
DeviceFormat eFormat = DeviceFormat::DEFAULT)
- : VirtualDevice(&rCompDev, eFormat, DeviceFormat::NONE) {}
+ : VirtualDevice(&rCompDev, eFormat, DeviceFormat::NONE, OUTDEV_VIRDEV) {}
/** Create a virtual device of size 1x1 with alpha channel
@@ -135,7 +139,7 @@ public:
*/
explicit VirtualDevice(const OutputDevice& rCompDev,
DeviceFormat eFormat, DeviceFormat eAlphaFormat)
- : VirtualDevice(&rCompDev, eFormat, eAlphaFormat) {}
+ : VirtualDevice(&rCompDev, eFormat, eAlphaFormat, OUTDEV_VIRDEV) {}
/** Create a virtual device using an existing system dependent device or graphics context
Any rendering will happen directly on the context and not on any intermediate bitmap.
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index d3011c54caed..0d9e18bd2a00 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -575,7 +575,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
//! SetUseStyleColor ??
- if ( bMetaFile && pDev->GetOutDevType() == OUTDEV_VIRDEV )
+ if ( bMetaFile && pDev->IsVirtual() )
aOutputData.SetSnapPixel();
Point aLogStart = pDev->PixelToLogic(Point(nScrX, nScrY), MapMode(MapUnit::Map100thMM));
@@ -1199,7 +1199,7 @@ static void lcl_DrawGraphic( const SvxBrushItem &rBrush, vcl::RenderContext *pOu
GraphicObject aObject( *pGraphic );
- if( pOut->GetPDFWriter() &&
+ if( pOut->GetOutDevType() == OUTDEV_PDF &&
(aObject.GetType() == GraphicType::Bitmap || aObject.GetType() == GraphicType::Default) )
{
// For PDF export, every draw
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 6d47265791e3..bdd61533eb38 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -1961,19 +1961,13 @@ void SAL_CALL SdXImpressDocument::render( sal_Int32 nRenderer, const uno::Any& r
SdrOutliner& rOutl = mpDoc->GetDrawOutliner();
bool bScreenDisplay(true);
- if(bScreenDisplay && pOut && OUTDEV_PRINTER == pOut->GetOutDevType())
- {
- // #i75566# printing; suppress AutoColor BackgroundColor generation
- // for visibility reasons by giving GetPageBackgroundColor()
- // the needed hint
- bScreenDisplay = false;
- }
-
- if(bScreenDisplay && pOut && pOut->GetPDFWriter())
- {
- // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
+ // #i75566# printing; suppress AutoColor BackgroundColor generation
+ // for visibility reasons by giving GetPageBackgroundColor()
+ // the needed hint
+ // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing)
+ if (pOut && ((OUTDEV_PRINTER == pOut->GetOutDevType())
+ || (OUTDEV_PDF == pOut->GetOutDevType())))
bScreenDisplay = false;
- }
// #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
// hint value if screen display. Only then the AutoColor mechanisms shall be applied
diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx
index 258d5d6d05ee..caee8aba20c0 100644
--- a/sd/source/ui/view/sdview.cxx
+++ b/sd/source/ui/view/sdview.cxx
@@ -470,19 +470,13 @@ void View::CompleteRedraw(OutputDevice* pOutDev, const vcl::Region& rReg, sdr::c
SdrOutliner& rOutl = mrDoc.GetDrawOutliner();
bool bScreenDisplay(true);
- if(bScreenDisplay && pOutDev && OUTDEV_PRINTER == pOutDev->GetOutDevType())
- {
- // #i75566# printing; suppress AutoColor BackgroundColor generation
- // for visibility reasons by giving GetPageBackgroundColor()
- // the needed hint
- bScreenDisplay = false;
- }
-
- if(bScreenDisplay && pOutDev && pOutDev->GetPDFWriter())
- {
- // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see above)
+ // #i75566# printing; suppress AutoColor BackgroundColor generation
+ // for visibility reasons by giving GetPageBackgroundColor()
+ // the needed hint
+ // #i75566# PDF export; suppress AutoColor BackgroundColor generation (see printing)
+ if (pOutDev && ((OUTDEV_PRINTER == pOutDev->GetOutDevType())
+ || (OUTDEV_PDF == pOutDev->GetOutDevType())))
bScreenDisplay = false;
- }
// #i75566# Name change GetBackgroundColor -> GetPageBackgroundColor and
// hint value if screen display. Only then the AutoColor mechanisms shall be applied
diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
index 2e89227ff93d..cd1c49457bfe 100644
--- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
+++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
@@ -138,7 +138,7 @@ bool ObjectContactOfObjListPainter::isOutputToRecordingMetaFile() const
// pdf export?
bool ObjectContactOfObjListPainter::isOutputToPDFFile() const
{
- return (nullptr != mrTargetOutputDevice.GetPDFWriter());
+ return OUTDEV_PDF == mrTargetOutputDevice.GetOutDevType();
}
OutputDevice* ObjectContactOfObjListPainter::TryToGetOutputDevice() const
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index e4b4b6ca1de9..6a2247bcd6c2 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -396,7 +396,7 @@ namespace sdr
// pdf export?
bool ObjectContactOfPageView::isOutputToPDFFile() const
{
- return (nullptr != mrPageWindow.GetPaintWindow().GetOutputDevice().GetPDFWriter());
+ return OUTDEV_PDF == mrPageWindow.GetPaintWindow().GetOutputDevice().GetOutDevType();
}
// gray display mode
diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx
index 65dbfc8f156d..0eb8e5c0db29 100644
--- a/svx/source/svdraw/sdrpaintwindow.cxx
+++ b/svx/source/svdraw/sdrpaintwindow.cxx
@@ -284,7 +284,7 @@ void SdrPaintWindow::PreparePreRenderDevice()
const bool bPrepareBufferedOutput(
mrPaintView.IsBufferedOutputAllowed()
&& !OutputToPrinter()
- && !OutputToVirtualDevice()
+ && !OutputIsVirtualDevice()
&& !OutputToRecordingMetaFile());
if(bPrepareBufferedOutput)
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 9b84ca53b1e1..308f8714ca3b 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1108,8 +1108,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
pVout = pOut;
pOut = pShell->GetOut();
}
- else if( pShell->GetWin() &&
- OUTDEV_VIRDEV == pOut->GetOutDevType() )
+ else if( pShell->GetWin() && pOut->IsVirtual() )
{
pVout = pOut;
pOut = pShell->GetWin();
@@ -1117,7 +1116,7 @@ void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfAr
else
pVout = nullptr;
- OSL_ENSURE( OUTDEV_VIRDEV != pOut->GetOutDevType() ||
+ OSL_ENSURE( !pOut->IsVirtual() ||
pShell->GetViewOptions()->IsPDFExport() || pShell->isOutputToWindow(),
"pOut should not be a virtual device" );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 9166965dfb7e..855af057bcec 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -870,7 +870,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
{
OSL_ENSURE( bNoAdjust && !bUseScrFont, "Outdev Check failed" );
}
- else if ( OUTDEV_VIRDEV == rRefDev.GetOutDevType() )
+ else if ( rRefDev.IsVirtual() )
{
OSL_ENSURE( !bNoAdjust && bUseScrFont, "Outdev Check failed" );
}
@@ -879,14 +879,14 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
OSL_FAIL( "Outdev Check failed" );
}
}
- else if ( OUTDEV_VIRDEV == rInf.GetOut().GetOutDevType() && ! pWin )
+ else if ( OUTDEV_PDF == rInf.GetOut().GetOutDevType() && ! pWin )
{
// PDF export
if ( OUTDEV_PRINTER == rRefDev.GetOutDevType() )
{
OSL_ENSURE( !bNoAdjust && bUseScrFont, "Outdev Check failed" );
}
- else if ( OUTDEV_VIRDEV == rRefDev.GetOutDevType() )
+ else if ( rRefDev.IsVirtual() )
{
OSL_ENSURE( !bNoAdjust && bUseScrFont, "Outdev Check failed" );
}
@@ -903,7 +903,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
{
OSL_ENSURE( !bNoAdjust && bUseScrFont, "Outdev Check failed" );
}
- else if ( OUTDEV_VIRDEV == rRefDev.GetOutDevType() )
+ else if ( rRefDev.IsVirtual() )
{
OSL_ENSURE( !bNoAdjust && bUseScrFont, "Outdev Check failed" );
}
diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx
index ba029c6c9f77..bef6f80521eb 100644
--- a/sw/source/core/view/vnew.cxx
+++ b/sw/source/core/view/vnew.cxx
@@ -85,7 +85,7 @@ void SwViewShell::Init( const SwViewOption *pNewOpt )
SAL_INFO( "sw.core", "View::Init - before InitPrt" );
OutputDevice* pPDFOut = nullptr;
- if ( mpOut && mpOut->GetPDFWriter() )
+ if (mpOut && (OUTDEV_PDF == mpOut->GetOutDevType()))
pPDFOut = mpOut;
// Only setup the printer if we need one:
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 19fac921d2fb..eb96cfa22a13 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -665,6 +665,7 @@ protected:
/// flags which hold the SetAntialiasing() value from OutputDevice
bool m_bAntiAliasB2DDraw : 1;
+ inline long GetDeviceWidth(const OutputDevice* pOutDev) const;
};
#endif // INCLUDED_VCL_INC_SALGDI_HXX
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 5d430e2a560d..0148c11c40c4 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -1683,7 +1683,7 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
const css::uno::Reference< css::beans::XMaterialHolder >& xEnc,
PDFWriter& i_rOuterFace)
- : VirtualDevice(DeviceFormat::DEFAULT),
+ : VirtualDevice(Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::NONE, OUTDEV_PDF),
m_aMapMode( MapUnit::MapPoint, Point(), Fraction( 1, pointToPixel(1) ), Fraction( 1, pointToPixel(1) ) ),
m_nCurrentStructElement( 0 ),
m_bEmitStructure( true ),
@@ -1810,7 +1810,6 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
SetOutputSizePixel( Size( 640, 480 ) );
SetMapMode(MapMode(MapUnit::MapMM));
- SetPDFWriter(this);
}
PDFWriterImpl::~PDFWriterImpl()
diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx
index 0baf00099ac0..8390b97286ab 100644
--- a/vcl/source/gdi/print2.cxx
+++ b/vcl/source/gdi/print2.cxx
@@ -1096,13 +1096,13 @@ bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf,
Point aPageOffset;
Size aTmpSize( GetOutputSizePixel() );
- if( GetPDFWriter() )
+ if( meOutDevType == OUTDEV_PDF )
{
- aTmpSize = GetPDFWriter()->getCurPageSize();
- aTmpSize = LogicToPixel( aTmpSize, MapMode( MapUnit::MapPoint ) );
+ auto pPdfWriter = static_cast<vcl::PDFWriterImpl*>(this);
+ aTmpSize = LogicToPixel(pPdfWriter->getCurPageSize(), MapMode(MapUnit::MapPoint));
// also add error code to PDFWriter
- GetPDFWriter()->insertError( vcl::PDFWriter::Warning_Transparency_Converted );
+ pPdfWriter->insertError(vcl::PDFWriter::Warning_Transparency_Converted);
}
else if( meOutDevType == OUTDEV_PRINTER )
{
diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx
index d28c751f42a9..2bb5b47d3b80 100644
--- a/vcl/source/gdi/salgdilayout.cxx
+++ b/vcl/source/gdi/salgdilayout.cxx
@@ -118,14 +118,15 @@ long SalGraphics::mirror2( long x, const OutputDevice *pOutDev ) const
return x;
}
-void SalGraphics::mirror( long& x, const OutputDevice *pOutDev ) const
+inline long SalGraphics::GetDeviceWidth(const OutputDevice* pOutDev) const
{
- long w;
- if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
- w = pOutDev->GetOutputWidthPixel();
- else
- w = GetGraphicsWidth();
+ return (pOutDev && pOutDev->IsVirtual())
+ ? pOutDev->GetOutputWidthPixel() : GetGraphicsWidth();
+}
+void SalGraphics::mirror( long& x, const OutputDevice *pOutDev ) const
+{
+ const long w = GetDeviceWidth(pOutDev);
if( w )
{
if( pOutDev && pOutDev->ImplIsAntiparallel() )
@@ -150,12 +151,7 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev ) const
void SalGraphics::mirror( long& x, long nWidth, const OutputDevice *pOutDev, bool bBack ) const
{
- long w;
- if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
- w = pOutDev->GetOutputWidthPixel();
- else
- w = GetGraphicsWidth();
-
+ const long w = GetDeviceWidth(pOutDev);
if( w )
{
if( pOutDev && pOutDev->ImplIsAntiparallel() )
@@ -181,18 +177,12 @@ void SalGraphics::mirror( long& x, long nWidth, const OutputDevice *pOutDev, boo
}
else if( m_nLayout & SalLayoutFlags::BiDiRtl )
x = w-nWidth-x;
-
}
}
bool SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint *pPtAry2, const OutputDevice *pOutDev ) const
{
- long w;
- if( pOutDev && pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
- w = pOutDev->GetOutputWidthPixel();
- else
- w = GetGraphicsWidth();
-
+ const long w = GetDeviceWidth(pOutDev);
if( w )
{
sal_uInt32 i, j;
@@ -315,9 +305,7 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP
const basegfx::B2DHomMatrix& SalGraphics::getMirror( const OutputDevice* i_pOutDev ) const
{
// get mirroring transformation
- const long w(nullptr != i_pOutDev && OUTDEV_VIRDEV == i_pOutDev->GetOutDevType()
- ? i_pOutDev->GetOutputWidthPixel()
- : GetGraphicsWidth());
+ const long w = GetDeviceWidth(i_pOutDev);
SAL_WARN_IF( !w, "vcl", "missing graphics width" );
if(w != m_aLastMirrorW)
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 284706c1a730..93b876577269 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -164,7 +164,7 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
if ( pOutDev->GetOutDevType() == OUTDEV_PRINTER )
mbScreenComp = false;
- else if ( pOutDev->GetOutDevType() == OUTDEV_VIRDEV )
+ else if ( pOutDev->IsVirtual() )
mbScreenComp = static_cast<const VirtualDevice*>(pOutDev)->mbScreenComp;
mbDevOutput = true;
@@ -198,13 +198,15 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
pSVData->maGDIData.mpFirstVirDev = this;
}
-VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat, DeviceFormat eAlphaFormat)
- : OutputDevice(OUTDEV_VIRDEV)
+VirtualDevice::VirtualDevice(const OutputDevice* pCompDev, DeviceFormat eFormat,
+ DeviceFormat eAlphaFormat, OutDevType eOutDevType)
+ : OutputDevice(eOutDevType)
, meFormat(eFormat)
, meAlphaFormat(eAlphaFormat)
{
- SAL_INFO( "vcl.virdev",
- "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat) << ", " << static_cast<int>(eAlphaFormat) << " )" );
+ SAL_INFO( "vcl.virdev", "VirtualDevice::VirtualDevice( " << static_cast<int>(eFormat)
+ << ", " << static_cast<int>(eAlphaFormat)
+ << ", " << static_cast<int>(eOutDevType) << " )" );
ImplInitVirDev(pCompDev ? pCompDev : Application::GetDefaultDevice(), 0, 0);
}
diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx
index e852d6ebd873..8f7fcbbc98f5 100644
--- a/vcl/source/outdev/clipping.cxx
+++ b/vcl/source/outdev/clipping.cxx
@@ -153,8 +153,8 @@ void OutputDevice::InitClipRegion()
// #102532# Respect output offset also for clip region
vcl::Region aRegion( ImplPixelToDevicePixel( maRegion ) );
- const bool bClipDeviceBounds( ! GetPDFWriter()
- && GetOutDevType() != OUTDEV_PRINTER );
+ const bool bClipDeviceBounds((OUTDEV_PDF != GetOutDevType())
+ && (OUTDEV_PRINTER != GetOutDevType()));
if( bClipDeviceBounds )
{
// Perform actual rect clip against outdev
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 981e087e8330..432aa87101c0 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -527,27 +527,20 @@ void OutputDevice::ImplClearFontData( const bool bNewFontLists )
mpGraphics->ReleaseFonts();
}
-// if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
- {
- ImplSVData* pSVData = ImplGetSVData();
+ ImplSVData* pSVData = ImplGetSVData();
- if (mxFontCache && mxFontCache != pSVData->maGDIData.mxScreenFontCache)
- mxFontCache->Invalidate();
+ if (mxFontCache && mxFontCache != pSVData->maGDIData.mxScreenFontCache)
+ mxFontCache->Invalidate();
- if ( bNewFontLists )
- {
- // we need a graphics
- if ( AcquireGraphics() )
- {
- if (mxFontCollection && mxFontCollection != pSVData->maGDIData.mxScreenFontList)
- mxFontCollection->Clear();
+ if (bNewFontLists && AcquireGraphics())
+ {
+ if (mxFontCollection && mxFontCollection != pSVData->maGDIData.mxScreenFontList)
+ mxFontCollection->Clear();
- if( GetPDFWriter() )
- {
- mxFontCollection.reset();
- mxFontCache.reset();
- }
- }
+ if (GetOutDevType() == OUTDEV_PDF)
+ {
+ mxFontCollection.reset();
+ mxFontCache.reset();
}
}
@@ -570,26 +563,17 @@ void OutputDevice::RefreshFontData( const bool bNewFontLists )
void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
{
-// if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
- {
- ImplSVData* pSVData = ImplGetSVData();
+ ImplSVData* pSVData = ImplGetSVData();
- if ( bNewFontLists )
+ if (bNewFontLists && AcquireGraphics())
+ {
+ if (GetOutDevType() == OUTDEV_PDF)
{
- // we need a graphics
- if ( AcquireGraphics() )
- {
- if( GetPDFWriter() )
- {
- mxFontCollection = pSVData->maGDIData.mxScreenFontList->Clone();
- mxFontCache.reset(new ImplFontCache);
- }
- else
- {
- mpGraphics->GetDevFontList( mxFontCollection.get() );
- }
- }
+ mxFontCollection = pSVData->maGDIData.mxScreenFontList->Clone();
+ mxFontCache.reset(new ImplFontCache);
}
+ else
+ mpGraphics->GetDevFontList( mxFontCollection.get() );
}
// also update child windows if needed
@@ -1017,7 +1001,7 @@ bool OutputDevice::ImplNewFont() const
DBG_TESTSOLARMUTEX();
// get correct font list on the PDF writer if necessary
- if( GetPDFWriter() )
+ if (GetOutDevType() == OUTDEV_PDF)
{
const ImplSVData* pSVData = ImplGetSVData();
if( mxFontCollection == pSVData->maGDIData.mxScreenFontList
diff --git a/vcl/source/outdev/hatch.cxx b/vcl/source/outdev/hatch.cxx
index 00ec13562d46..a5c4f355dcc8 100644
--- a/vcl/source/outdev/hatch.cxx
+++ b/vcl/source/outdev/hatch.cxx
@@ -401,10 +401,8 @@ void OutputDevice::DrawHatchLine( const tools::Line& rLine, const tools::PolyPol
{
for( long i = 0; i < nPCounter; i += 2 )
{
- if( GetPDFWriter() )
- {
- GetPDFWriter()->drawLine( pPtBuffer[ i ], pPtBuffer[ i+1 ] );
- }
+ if (GetOutDevType() == OUTDEV_PDF)
+ static_cast<vcl::PDFWriterImpl*>(this)->drawLine(pPtBuffer[ i ], pPtBuffer[ i+1 ]);
else
{
const Point aPt1( ImplLogicToDevicePixel( pPtBuffer[ i ] ) );
diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx
index b96dc63c13fe..740d54ecc86b 100644
--- a/vcl/source/outdev/nativecontrols.cxx
+++ b/vcl/source/outdev/nativecontrols.cxx
@@ -50,6 +50,8 @@ static bool EnableNativeWidget( const OutputDevice& i_rDevice )
}
}
+ case OUTDEV_PDF:
+ SAL_FALLTHROUGH;
case OUTDEV_VIRDEV:
{
const vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() );
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 98af9d0ba0ce..275f0c1845e5 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -34,8 +34,6 @@
#include <outdevstatestack.hxx>
#include <PhysicalFontCollection.hxx>
-#include "../gdi/pdfwriter_impl.hxx"
-
#ifdef DISABLE_DYNLOADING
// Linking all needed LO code into one .so/executable, these already
// exist in the tools library, so put them in the anonymous namespace
@@ -64,7 +62,6 @@ OutputDevice::OutputDevice(OutDevType eOutDevType) :
mpDeviceFontList = nullptr;
mpDeviceFontSizeList = nullptr;
mpOutDevStateStack.reset(new OutDevStateStack);
- mpPDFWriter = nullptr;
mpAlphaVDev = nullptr;
mpExtOutDevData = nullptr;
mnOutOffX = 0;
@@ -144,8 +141,6 @@ OutputDevice::~OutputDevice()
void OutputDevice::dispose()
{
- mpPDFWriter.disposeAndClear();
-
if ( GetUnoGraphicsList() )
{
UnoWrapperBase* pWrapper = UnoWrapperBase::GetUnoWrapper( false );
@@ -762,15 +757,4 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize,
return bDrawn;
}
-vcl::PDFWriterImpl* OutputDevice::GetPDFWriter() const
-{
- return static_cast<vcl::PDFWriterImpl*>(mpPDFWriter.get());
-}
-
-void OutputDevice::SetPDFWriter(vcl::PDFWriterImpl* pPDFWriter)
-{
- mpPDFWriter = pPDFWriter;
- ImplUpdateFontData();
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 3bc2ced9a3b5..d23c2137be35 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -274,7 +274,7 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout,
long nOldX = rSalLayout.DrawBase().X();
if( HasMirroredGraphics() )
{
- long w = meOutDevType == OUTDEV_VIRDEV ? mnOutWidth : mpGraphics->GetGraphicsWidth();
+ long w = IsVirtual() ? mnOutWidth : mpGraphics->GetGraphicsWidth();
long x = rSalLayout.DrawBase().X();
rSalLayout.DrawBase().setX( w - 1 - x );
if( !IsRTLEnabled() )
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 0de4d5b0e129..d2b92d8623b8 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -540,7 +540,7 @@ cairo::SurfaceSharedPtr X11SalGraphics::CreateSurface( const OutputDevice& rRefD
if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW )
return cairo::SurfaceSharedPtr(new cairo::X11Surface(getSysData(static_cast<const vcl::Window&>(rRefDevice)),
x,y,width,height));
- if( rRefDevice.GetOutDevType() == OUTDEV_VIRDEV )
+ if( rRefDevice.IsVirtual() )
return cairo::SurfaceSharedPtr(new cairo::X11Surface(getSysData(static_cast<const VirtualDevice&>(rRefDevice)),
x,y,width,height));
return cairo::SurfaceSharedPtr();
@@ -557,7 +557,7 @@ cairo::SurfaceSharedPtr X11SalGraphics::CreateBitmapSurface( const OutputDevice&
{
if( rRefDevice.GetOutDevType() == OUTDEV_WINDOW )
return cairo::SurfaceSharedPtr(new cairo::X11Surface(getSysData(static_cast<const vcl::Window&>(rRefDevice)), rData ));
- else if( rRefDevice.GetOutDevType() == OUTDEV_VIRDEV )
+ else if( rRefDevice.IsVirtual() )
return cairo::SurfaceSharedPtr(new cairo::X11Surface(getSysData(static_cast<const VirtualDevice&>(rRefDevice)), rData ));
}