summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2019-12-30 20:32:50 +0100
committerTomaž Vajngerl <quikee@gmail.com>2019-12-31 00:09:41 +0100
commitf7a2f63994e22c99010c1d25a4493a8a0c57866e (patch)
tree58465838e7381fff57826b7f7ad87312bce641df /vcl
parent45f208207be6ad23fa6fc22faebfaf676346da80 (diff)
pdf: move PDFPage dependency out of Matrix3 class (append method)
PDFPage should be responsible to append the Matrix3 data and not the other way arround. This is needed so it can be moved into it's own class. Change-Id: I98ca1830e7105b73fe26a0559df99da2b2df4307 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86035 Reviewed-by: Tomaž Vajngerl <quikee@gmail.com> Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx39
-rw-r--r--vcl/source/gdi/pdfwriter_impl.hxx2
2 files changed, 23 insertions, 18 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 9599ca737822..1ec13034a9bf 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -566,7 +566,10 @@ public:
void translate( double tx, double ty );
void invert();
- void append( PDFPage const & rPage, OStringBuffer& rBuffer );
+ double get(size_t i) const
+ {
+ return f[i];
+ }
Point transform( const Point& rPoint ) const;
};
@@ -670,19 +673,6 @@ void Matrix3::invert()
set( fn );
}
-void Matrix3::append( PDFPage const & rPage, OStringBuffer& rBuffer )
-{
- appendDouble( f[0], rBuffer );
- rBuffer.append( ' ' );
- appendDouble( f[1], rBuffer );
- rBuffer.append( ' ' );
- appendDouble( f[2], rBuffer );
- rBuffer.append( ' ' );
- appendDouble( f[3], rBuffer );
- rBuffer.append( ' ' );
- rPage.appendPoint( Point( static_cast<long>(f[4]), static_cast<long>(f[5]) ), rBuffer );
-}
-
PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation )
:
m_pWriter( pWriter ),
@@ -1242,7 +1232,20 @@ void PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal_Int32 nDelta,
rBuffer.append( "S\n" );
}
- PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
+void PDFPage::appendMatrix3(Matrix3 const & rMatrix, OStringBuffer& rBuffer)
+{
+ appendDouble(rMatrix.get(0), rBuffer);
+ rBuffer.append(' ');
+ appendDouble(rMatrix.get(1), rBuffer);
+ rBuffer.append(' ');
+ appendDouble(rMatrix.get(2), rBuffer);
+ rBuffer.append(' ');
+ appendDouble(rMatrix.get(3), rBuffer);
+ rBuffer.append(' ');
+ appendPoint(Point(long(rMatrix.get(4)), long(rMatrix.get(5))), rBuffer);
+}
+
+PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
const css::uno::Reference< css::beans::XMaterialHolder >& xEnc,
PDFWriter& i_rOuterFace)
: VirtualDevice(Application::GetDefaultDevice(), DeviceFormat::DEFAULT, DeviceFormat::NONE, OUTDEV_PDF),
@@ -5860,7 +5863,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
aMat.scale( fTempXScale, fYScale );
aMat.rotate( fAngle+fDeltaAngle );
aMat.translate( aCurPos.X()+aDeltaPos.X(), aCurPos.Y()+aDeltaPos.Y() );
- aMat.append( m_aPages.back(), rLine );
+ m_aPages.back().appendMatrix3(aMat, rLine);
rLine.append( " Tm" );
if( i == 0 || rGlyphs[i-1].m_nMappedFontId != rGlyphs[i].m_nMappedFontId )
{
@@ -5932,7 +5935,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
aMat.scale( fXScale, 1.0 );
aMat.rotate( fAngle );
aMat.translate( aCurPos.X(), aCurPos.Y() );
- aMat.append( m_aPages.back(), rLine );
+ m_aPages.back().appendMatrix3(aMat, rLine);
rLine.append( " Tm\n" );
}
// set up correct font
@@ -7140,7 +7143,7 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long nWidth, FontStrikeout
Matrix3 aMat;
aMat.rotate( fAngle );
aMat.translate( aPos.X(), aPos.Y() );
- aMat.append( m_aPages.back(), aLine );
+ m_aPages.back().appendMatrix3(aMat, aLine);
aLine.append( " cm\n" );
if ( aUnderlineColor.GetTransparency() != 0 )
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 0b155145e250..be201c3be127 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -164,6 +164,8 @@ struct PDFPage
// appends a horizontal waveline with vertical offset (helper for drawWaveLine)
void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 nDelta, OStringBuffer& rBuffer ) const;
+ void appendMatrix3(Matrix3 const & rMatrix, OStringBuffer& rBuffer);
+
double getHeight() const { return m_nPageHeight ? m_nPageHeight : vcl::pdf::g_nInheritedPageHeight; }
};