1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "pdfwriter_impl.hxx"
21 #include <vcl/bitmapex.hxx>
25 PDFWriter::AnyWidget::~AnyWidget()
29 PDFWriter::PDFWriter( const PDFWriter::PDFWriterContext
& rContext
, const css::uno::Reference
< css::beans::XMaterialHolder
>& xEnc
)
31 xImplementation( VclPtr
<PDFWriterImpl
>::Create(rContext
, xEnc
, *this) )
35 PDFWriter::~PDFWriter()
39 OutputDevice
* PDFWriter::GetReferenceDevice()
41 return xImplementation
.get();
44 void PDFWriter::NewPage( double nPageWidth
, double nPageHeight
, Orientation eOrientation
)
46 xImplementation
->newPage( nPageWidth
, nPageHeight
, eOrientation
);
49 bool PDFWriter::Emit()
51 return xImplementation
->emit();
54 void PDFWriter::SetDocumentLocale( const css::lang::Locale
& rLoc
)
56 xImplementation
->setDocumentLocale( rLoc
);
59 void PDFWriter::SetFont( const vcl::Font
& rFont
)
61 xImplementation
->setFont( rFont
);
64 void PDFWriter::DrawText( const Point
& rPos
, const OUString
& rText
)
66 xImplementation
->drawText( rPos
, rText
, 0, rText
.getLength() );
69 void PDFWriter::DrawTextLine(
72 FontStrikeout eStrikeout
,
73 FontLineStyle eUnderline
,
74 FontLineStyle eOverline
)
76 xImplementation
->drawTextLine( rPos
, nWidth
, eStrikeout
, eUnderline
, eOverline
, false/*bUnderlineAbove*/ );
79 void PDFWriter::DrawTextArray(
80 const Point
& rStartPt
,
86 xImplementation
->drawTextArray( rStartPt
, rStr
, pDXAry
, nIndex
, nLen
);
89 void PDFWriter::DrawStretchText(
90 const Point
& rStartPt
,
96 xImplementation
->drawStretchText( rStartPt
, nWidth
, rStr
, nIndex
, nLen
);
99 void PDFWriter::DrawText(
100 const tools::Rectangle
& rRect
,
101 const OUString
& rStr
,
102 DrawTextFlags nStyle
)
104 xImplementation
->drawText( rRect
, rStr
, nStyle
);
107 void PDFWriter::DrawLine( const Point
& rStart
, const Point
& rStop
)
109 xImplementation
->drawLine( rStart
, rStop
);
112 void PDFWriter::DrawLine( const Point
& rStart
, const Point
& rStop
, const LineInfo
& rInfo
)
114 xImplementation
->drawLine( rStart
, rStop
, rInfo
);
117 void PDFWriter::DrawPolygon( const tools::Polygon
& rPoly
)
119 xImplementation
->drawPolygon( rPoly
);
122 void PDFWriter::DrawPolyLine( const tools::Polygon
& rPoly
)
124 xImplementation
->drawPolyLine( rPoly
);
127 void PDFWriter::DrawRect( const tools::Rectangle
& rRect
)
129 xImplementation
->drawRectangle( rRect
);
132 void PDFWriter::DrawRect( const tools::Rectangle
& rRect
, sal_uLong nHorzRound
, sal_uLong nVertRound
)
134 xImplementation
->drawRectangle( rRect
, nHorzRound
, nVertRound
);
137 void PDFWriter::DrawEllipse( const tools::Rectangle
& rRect
)
139 xImplementation
->drawEllipse( rRect
);
142 void PDFWriter::DrawArc( const tools::Rectangle
& rRect
, const Point
& rStart
, const Point
& rStop
)
144 xImplementation
->drawArc( rRect
, rStart
, rStop
, false, false );
147 void PDFWriter::DrawPie( const tools::Rectangle
& rRect
, const Point
& rStart
, const Point
& rStop
)
149 xImplementation
->drawArc( rRect
, rStart
, rStop
, true, false );
152 void PDFWriter::DrawChord( const tools::Rectangle
& rRect
, const Point
& rStart
, const Point
& rStop
)
154 xImplementation
->drawArc( rRect
, rStart
, rStop
, false, true );
157 void PDFWriter::DrawPolyLine( const tools::Polygon
& rPoly
, const LineInfo
& rInfo
)
159 xImplementation
->drawPolyLine( rPoly
, rInfo
);
162 void PDFWriter::DrawPolyLine( const tools::Polygon
& rPoly
, const ExtLineInfo
& rInfo
)
164 xImplementation
->drawPolyLine( rPoly
, rInfo
);
167 void PDFWriter::DrawPolyPolygon( const tools::PolyPolygon
& rPolyPoly
)
169 xImplementation
->drawPolyPolygon( rPolyPoly
);
172 void PDFWriter::DrawPixel( const Point
& rPos
, const Color
& rColor
)
174 xImplementation
->drawPixel( rPos
, rColor
);
177 void PDFWriter::DrawBitmap( const Point
& rDestPt
, const Size
& rDestSize
, const Bitmap
& rBitmap
, const Graphic
& rGraphic
)
179 xImplementation
->drawBitmap( rDestPt
, rDestSize
, rBitmap
, rGraphic
);
182 void PDFWriter::DrawBitmapEx( const Point
& rDestPt
, const Size
& rDestSize
, const BitmapEx
& rBitmap
)
184 xImplementation
->drawBitmap( rDestPt
, rDestSize
, rBitmap
);
187 void PDFWriter::DrawHatch( const tools::PolyPolygon
& rPolyPoly
, const Hatch
& rHatch
)
189 xImplementation
->drawHatch( rPolyPoly
, rHatch
);
192 void PDFWriter::DrawGradient( const tools::Rectangle
& rRect
, const Gradient
& rGradient
)
194 xImplementation
->drawGradient( rRect
, rGradient
);
197 void PDFWriter::DrawGradient( const tools::PolyPolygon
& rPolyPoly
, const Gradient
& rGradient
)
199 xImplementation
->push(PushFlags::CLIPREGION
);
200 xImplementation
->setClipRegion( rPolyPoly
.getB2DPolyPolygon() );
201 xImplementation
->drawGradient( rPolyPoly
.GetBoundRect(), rGradient
);
202 xImplementation
->pop();
205 void PDFWriter::DrawWallpaper( const tools::Rectangle
& rRect
, const Wallpaper
& rWallpaper
)
207 xImplementation
->drawWallpaper( rRect
, rWallpaper
);
210 void PDFWriter::DrawTransparent( const tools::PolyPolygon
& rPolyPoly
, sal_uInt16 nTransparencePercent
)
212 xImplementation
->drawTransparent( rPolyPoly
, nTransparencePercent
);
215 void PDFWriter::BeginTransparencyGroup()
217 xImplementation
->beginTransparencyGroup();
220 void PDFWriter::EndTransparencyGroup( const tools::Rectangle
& rRect
, sal_uInt16 nTransparentPercent
)
222 xImplementation
->endTransparencyGroup( rRect
, nTransparentPercent
);
225 void PDFWriter::Push( PushFlags nFlags
)
227 xImplementation
->push( nFlags
);
230 void PDFWriter::Pop()
232 xImplementation
->pop();
235 void PDFWriter::SetMapMode( const MapMode
& rMapMode
)
237 xImplementation
->setMapMode( rMapMode
);
240 void PDFWriter::SetLineColor( const Color
& rColor
)
242 xImplementation
->setLineColor( rColor
);
245 void PDFWriter::SetFillColor( const Color
& rColor
)
247 xImplementation
->setFillColor( rColor
);
250 void PDFWriter::SetClipRegion()
252 xImplementation
->clearClipRegion();
255 void PDFWriter::SetClipRegion( const basegfx::B2DPolyPolygon
& rRegion
)
257 xImplementation
->setClipRegion( rRegion
);
260 void PDFWriter::MoveClipRegion( long nHorzMove
, long nVertMove
)
262 xImplementation
->moveClipRegion( nHorzMove
, nVertMove
);
265 void PDFWriter::IntersectClipRegion( const basegfx::B2DPolyPolygon
& rRegion
)
267 xImplementation
->intersectClipRegion( rRegion
);
270 void PDFWriter::IntersectClipRegion( const tools::Rectangle
& rRect
)
272 xImplementation
->intersectClipRegion( rRect
);
275 void PDFWriter::SetLayoutMode( ComplexTextLayoutFlags nMode
)
277 xImplementation
->setLayoutMode( nMode
);
280 void PDFWriter::SetDigitLanguage( LanguageType eLang
)
282 xImplementation
->setDigitLanguage( eLang
);
285 void PDFWriter::SetTextColor( const Color
& rColor
)
287 xImplementation
->setTextColor( rColor
);
290 void PDFWriter::SetTextFillColor()
292 xImplementation
->setTextFillColor();
295 void PDFWriter::SetTextFillColor( const Color
& rColor
)
297 xImplementation
->setTextFillColor( rColor
);
300 void PDFWriter::SetTextLineColor()
302 xImplementation
->setTextLineColor();
305 void PDFWriter::SetTextLineColor( const Color
& rColor
)
307 xImplementation
->setTextLineColor( rColor
);
310 void PDFWriter::SetOverlineColor()
312 xImplementation
->setOverlineColor();
315 void PDFWriter::SetOverlineColor( const Color
& rColor
)
317 xImplementation
->setOverlineColor( rColor
);
320 void PDFWriter::SetTextAlign( ::TextAlign eAlign
)
322 xImplementation
->setTextAlign( eAlign
);
325 void PDFWriter::DrawJPGBitmap( SvStream
& rStreamData
, bool bIsTrueColor
, const Size
& rSrcSizePixel
, const tools::Rectangle
& rTargetArea
, const Bitmap
& rMask
, const Graphic
& rGraphic
)
327 xImplementation
->drawJPGBitmap( rStreamData
, bIsTrueColor
, rSrcSizePixel
, rTargetArea
, rMask
, rGraphic
);
330 sal_Int32
PDFWriter::CreateLink( const tools::Rectangle
& rRect
, sal_Int32 nPageNr
)
332 return xImplementation
->createLink( rRect
, nPageNr
);
335 sal_Int32
PDFWriter::CreateScreen(const tools::Rectangle
& rRect
, sal_Int32 nPageNr
)
337 return xImplementation
->createScreen(rRect
, nPageNr
);
340 sal_Int32
PDFWriter::RegisterDestReference( sal_Int32 nDestId
, const tools::Rectangle
& rRect
, sal_Int32 nPageNr
, DestAreaType eType
)
342 return xImplementation
->registerDestReference( nDestId
, rRect
, nPageNr
, eType
);
345 sal_Int32
PDFWriter::CreateNamedDest( const OUString
& sDestName
, const tools::Rectangle
& rRect
, sal_Int32 nPageNr
, PDFWriter::DestAreaType eType
)
347 return xImplementation
->createNamedDest( sDestName
, rRect
, nPageNr
, eType
);
349 sal_Int32
PDFWriter::CreateDest( const tools::Rectangle
& rRect
, sal_Int32 nPageNr
, PDFWriter::DestAreaType eType
)
351 return xImplementation
->createDest( rRect
, nPageNr
, eType
);
354 void PDFWriter::SetLinkDest( sal_Int32 nLinkId
, sal_Int32 nDestId
)
356 xImplementation
->setLinkDest( nLinkId
, nDestId
);
359 void PDFWriter::SetLinkURL( sal_Int32 nLinkId
, const OUString
& rURL
)
361 xImplementation
->setLinkURL( nLinkId
, rURL
);
364 void PDFWriter::SetScreenURL(sal_Int32 nScreenId
, const OUString
& rURL
)
366 xImplementation
->setScreenURL(nScreenId
, rURL
);
369 void PDFWriter::SetScreenStream(sal_Int32 nScreenId
, const OUString
& rURL
)
371 xImplementation
->setScreenStream(nScreenId
, rURL
);
374 void PDFWriter::SetLinkPropertyID( sal_Int32 nLinkId
, sal_Int32 nPropertyId
)
376 xImplementation
->setLinkPropertyId( nLinkId
, nPropertyId
);
379 sal_Int32
PDFWriter::CreateOutlineItem( sal_Int32 nParent
, const OUString
& rText
, sal_Int32 nDestID
)
381 return xImplementation
->createOutlineItem( nParent
, rText
, nDestID
);
384 void PDFWriter::CreateNote( const tools::Rectangle
& rRect
, const PDFNote
& rNote
, sal_Int32 nPageNr
)
386 xImplementation
->createNote( rRect
, rNote
, nPageNr
);
389 sal_Int32
PDFWriter::BeginStructureElement( PDFWriter::StructElement eType
, const OUString
& rAlias
)
391 return xImplementation
->beginStructureElement( eType
, rAlias
);
394 void PDFWriter::EndStructureElement()
396 xImplementation
->endStructureElement();
399 void PDFWriter::SetCurrentStructureElement( sal_Int32 nID
)
401 xImplementation
->setCurrentStructureElement( nID
);
404 void PDFWriter::SetStructureAttribute( enum StructAttribute eAttr
, enum StructAttributeValue eVal
)
406 xImplementation
->setStructureAttribute( eAttr
, eVal
);
409 void PDFWriter::SetStructureAttributeNumerical( enum StructAttribute eAttr
, sal_Int32 nValue
)
411 xImplementation
->setStructureAttributeNumerical( eAttr
, nValue
);
414 void PDFWriter::SetStructureBoundingBox( const tools::Rectangle
& rRect
)
416 xImplementation
->setStructureBoundingBox( rRect
);
419 void PDFWriter::SetActualText( const OUString
& rText
)
421 xImplementation
->setActualText( rText
);
424 void PDFWriter::SetAlternateText( const OUString
& rText
)
426 xImplementation
->setAlternateText( rText
);
429 void PDFWriter::SetPageTransition( PDFWriter::PageTransition eType
, sal_uInt32 nMilliSec
, sal_Int32 nPageNr
)
431 xImplementation
->setPageTransition( eType
, nMilliSec
, nPageNr
);
434 sal_Int32
PDFWriter::CreateControl( const PDFWriter::AnyWidget
& rControl
)
436 return xImplementation
->createControl( rControl
);
439 PDFOutputStream::~PDFOutputStream()
443 void PDFWriter::AddStream( const OUString
& rMimeType
, PDFOutputStream
* pStream
)
445 xImplementation
->addStream( rMimeType
, pStream
);
448 std::set
< PDFWriter::ErrorCode
> const & PDFWriter::GetErrors() const
450 return xImplementation
->getErrors();
453 css::uno::Reference
< css::beans::XMaterialHolder
>
454 PDFWriter::InitEncryption( const OUString
& i_rOwnerPassword
,
455 const OUString
& i_rUserPassword
458 return PDFWriterImpl::initEncryption( i_rOwnerPassword
, i_rUserPassword
);
461 void PDFWriter::PlayMetafile( const GDIMetaFile
& i_rMTF
, const vcl::PDFWriter::PlayMetafileContext
& i_rPlayContext
, PDFExtOutDevData
* i_pData
)
463 xImplementation
->playMetafile( i_rMTF
, i_pData
, i_rPlayContext
);
466 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */