From b85ff98383942360901b8242cf77366782400426 Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Mon, 22 Oct 2018 18:34:06 +0000 Subject: Change PDFWriterImpl into an OutputDevice It actually changes it into a VirtualDevice and should just be a refactoring. We get rid of the crude stuff in a follow up patch, While at it unfriend PDFWriterImpl from OutputDevice. Change-Id: Id43731ad076690292c30f9f3e05ff0dd58edc5e5 Reviewed-on: https://gerrit.libreoffice.org/62201 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski --- include/vcl/outdev.hxx | 23 +++++++++++------------ include/vcl/pdfwriter.hxx | 6 +++++- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 72d5ae57dca9..4980757a4b1a 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -328,7 +328,6 @@ class VCL_DLLPUBLIC OutputDevice : public virtual VclReferenceBase friend class VirtualDevice; friend class vcl::Window; friend class WorkWindow; - friend class vcl::PDFWriterImpl; friend void ImplHandleResize( vcl::Window* pWindow, long nNewWidth, long nNewHeight ); private: @@ -347,7 +346,7 @@ private: std::unique_ptr mpOutDevStateStack; std::unique_ptr mpOutDevData; std::vector< VCLXGraphics* >* mpUnoGraphicsList; - vcl::PDFWriterImpl* mpPDFWriter; + VclPtr mpPDFWriter; vcl::ExtOutDevData* mpExtOutDevData; // TEMP TEMP TEMP @@ -550,7 +549,7 @@ public: */ bool SupportsOperation( OutDevSupportType ) const; - vcl::PDFWriterImpl* GetPDFWriter() const { return mpPDFWriter; } + vcl::PDFWriterImpl* GetPDFWriter() const; void SetExtOutDevData( vcl::ExtOutDevData* pExtOutDevData ) { mpExtOutDevData = pExtOutDevData; } vcl::ExtOutDevData* GetExtOutDevData() const { return mpExtOutDevData; } @@ -1181,12 +1180,13 @@ public: vcl::TextLayoutCache const* = nullptr) const; std::shared_ptr CreateTextLayoutCache(OUString const&) const; -private: - SAL_DLLPRIVATE void ImplInitTextColor(); - +protected: SAL_DLLPRIVATE void ImplInitTextLineSize(); SAL_DLLPRIVATE void ImplInitAboveTextLineSize(); - + static + SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ); +private: + SAL_DLLPRIVATE void ImplInitTextColor(); SAL_DLLPRIVATE void ImplDrawTextDirect( SalLayout&, bool bTextLines); SAL_DLLPRIVATE void ImplDrawSpecialText( SalLayout& ); @@ -1202,8 +1202,6 @@ private: SAL_DLLPRIVATE void ImplDrawMnemonicLine( long nX, long nY, long nWidth ); - static - SAL_DLLPRIVATE long ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, long nWidth, const OUString& rStr, DrawTextFlags nStyle, const vcl::ITextLayout& _rLayout ); ///@} @@ -1289,12 +1287,15 @@ public: SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); 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; virtual long GetFontExtLeading() const; - private: typedef void ( OutputDevice::* FontUpdateHandler_t )( bool ); @@ -1809,8 +1810,6 @@ public: SAL_DLLPRIVATE DeviceCoordinate LogicWidthToDeviceCoordinate( long nWidth ) const; -private: - /** Convert a logical X coordinate to a device pixel's X coordinate. To get the device's X coordinate, it must calculate the mapping offset diff --git a/include/vcl/pdfwriter.hxx b/include/vcl/pdfwriter.hxx index 04d3e472e649..751f698892f1 100644 --- a/include/vcl/pdfwriter.hxx +++ b/include/vcl/pdfwriter.hxx @@ -78,7 +78,11 @@ class VCL_DLLPUBLIC PDFOutputStream class VCL_DLLPUBLIC PDFWriter { - std::unique_ptr xImplementation; + VclPtr xImplementation; + + PDFWriter(const PDFWriter&) = delete; + PDFWriter& operator=(const PDFWriter&) = delete; + public: // extended line info enum CapType { capButt, capRound, capSquare }; -- cgit