LCOV - code coverage report
Current view: top level - sdext/source/pdfimport/inc - contentsink.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 16 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.hxx>
      24             : #include <com/sun/star/uno/Sequence.hxx>
      25             : #include <com/sun/star/rendering/ARGBColor.hpp>
      26             : #include <boost/shared_ptr.hpp>
      27             : 
      28             : namespace com { namespace sun { namespace star {
      29             : namespace rendering
      30             : {
      31             :     class  XPolyPolygon2D;
      32             : }
      33             : namespace geometry
      34             : {
      35             :     struct Matrix2D;
      36             :     struct AffineMatrix2D;
      37             :     struct RealRectangle2D;
      38             :     struct RealPoint2D;
      39             :     struct RealSize2D;
      40             : }
      41             : namespace beans
      42             : {
      43             :     struct PropertyValue;
      44             : } } } }
      45             : 
      46             : namespace pdfi
      47             : {
      48           0 :     struct FontAttributes
      49             :     {
      50           0 :         FontAttributes( const OUString& familyName_,
      51             :                         bool                 isBold_,
      52             :                         bool                 isItalic_,
      53             :                         bool                 isUnderline_,
      54             :                         bool                 isOutline_,
      55             :                         double               size_ ) :
      56             :             familyName(familyName_),
      57             :             isBold(isBold_),
      58             :             isItalic(isItalic_),
      59             :             isUnderline(isUnderline_),
      60             :             isOutline(isOutline_),
      61           0 :             size(size_)
      62           0 :         {}
      63             : 
      64           0 :         FontAttributes() :
      65             :             familyName(),
      66             :             isBold(false),
      67             :             isItalic(false),
      68             :             isUnderline(false),
      69             :             isOutline(false),
      70           0 :             size(0.0)
      71           0 :         {}
      72             : 
      73             :         OUString     familyName;
      74             :         bool                isBold;
      75             :         bool                isItalic;
      76             :         bool                isUnderline;
      77             :         bool                isOutline;
      78             :         double              size; // device pixel
      79             : 
      80           0 :         bool operator==(const FontAttributes& rFont) const
      81             :         {
      82           0 :             return familyName == rFont.familyName &&
      83           0 :                 !isBold == !rFont.isBold &&
      84           0 :                 !isItalic == !rFont.isItalic &&
      85           0 :                 !isUnderline == !rFont.isUnderline &&
      86           0 :                 !isOutline == !rFont.isOutline &&
      87           0 :                 size == rFont.size;
      88             :         }
      89             :     };
      90             : 
      91             :     /** (preliminary) API wrapper around xpdf
      92             : 
      93             :         Wraps the functionality currently used from xpdf's OutputDev
      94             :         interface. Subject to change.
      95             :      */
      96           0 :     struct ContentSink
      97             :     {
      98           0 :         virtual ~ContentSink() {}
      99             : 
     100             :         /// Total number of pages for upcoming document
     101             :         virtual void setPageNum( sal_Int32 nNumPages ) = 0;
     102             :         virtual void startPage( const ::com::sun::star::geometry::RealSize2D& rSize ) = 0;
     103             :         virtual void endPage() = 0;
     104             : 
     105             :         virtual void hyperLink( const ::com::sun::star::geometry::RealRectangle2D& rBounds,
     106             :                                 const OUString&                             rURI ) = 0;
     107             : 
     108             :         virtual void pushState() = 0;
     109             :         virtual void popState() = 0;
     110             : 
     111             :         virtual void setFlatness( double ) = 0;
     112             :         virtual void setTransformation( const ::com::sun::star::geometry::AffineMatrix2D& rMatrix ) = 0;
     113             :         virtual void setLineDash( const ::com::sun::star::uno::Sequence<double>& dashes,
     114             :                                   double                                         start ) = 0;
     115             :         virtual void setLineJoin( sal_Int8 lineJoin ) = 0;
     116             :         virtual void setLineCap( sal_Int8 lineCap ) = 0;
     117             :         virtual void setMiterLimit(double) = 0;
     118             :         virtual void setLineWidth(double) = 0;
     119             :         virtual void setFillColor( const ::com::sun::star::rendering::ARGBColor& rColor ) = 0;
     120             :         virtual void setStrokeColor( const ::com::sun::star::rendering::ARGBColor& rColor ) = 0;
     121             :         virtual void setBlendMode( sal_Int8 blendMode ) = 0;
     122             :         virtual void setFont( const FontAttributes& rFont ) = 0;
     123             :         virtual void setTextRenderMode( sal_Int32 ) = 0;
     124             : 
     125             : 
     126             :         virtual void strokePath( const ::com::sun::star::uno::Reference<
     127             :                                        ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
     128             :         virtual void fillPath( const ::com::sun::star::uno::Reference<
     129             :                                      ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
     130             :         virtual void eoFillPath( const ::com::sun::star::uno::Reference<
     131             :                                        ::com::sun::star::rendering::XPolyPolygon2D >& rPath ) = 0;
     132             : 
     133             :         virtual void intersectClip(const ::com::sun::star::uno::Reference<
     134             :                                          ::com::sun::star::rendering::XPolyPolygon2D >& rPath) = 0;
     135             :         virtual void intersectEoClip(const ::com::sun::star::uno::Reference<
     136             :                                            ::com::sun::star::rendering::XPolyPolygon2D >& rPath) = 0;
     137             : 
     138             :         virtual void drawGlyphs( const OUString&                               rGlyphs,
     139             :                                  const ::com::sun::star::geometry::RealRectangle2D& rRect,
     140             :                                  const ::com::sun::star::geometry::Matrix2D&        rFontMatrix ) = 0;
     141             : 
     142             :         /// issued when a sequence of associated glyphs is drawn
     143             :         virtual void endText() = 0;
     144             : 
     145             :         /// draws given bitmap as a mask (using current fill color)
     146             :         virtual void drawMask(const ::com::sun::star::uno::Sequence<
     147             :                                     ::com::sun::star::beans::PropertyValue>& xBitmap,
     148             :                               bool                                           bInvert ) = 0;
     149             :         /// Given image must already be color-mapped and normalized to sRGB.
     150             :         virtual void drawImage(const ::com::sun::star::uno::Sequence<
     151             :                                      ::com::sun::star::beans::PropertyValue>& xBitmap ) = 0;
     152             :         /** Given image must already be color-mapped and normalized to sRGB.
     153             : 
     154             :             maskColors must contain two sequences of color components
     155             :          */
     156             :         virtual void drawColorMaskedImage(const ::com::sun::star::uno::Sequence<
     157             :                                                 ::com::sun::star::beans::PropertyValue>& xBitmap,
     158             :                                           const ::com::sun::star::uno::Sequence<
     159             :                                                 ::com::sun::star::uno::Any>&             xMaskColors ) = 0;
     160             :         virtual void drawMaskedImage(const ::com::sun::star::uno::Sequence<
     161             :                                            ::com::sun::star::beans::PropertyValue>& xBitmap,
     162             :                                      const ::com::sun::star::uno::Sequence<
     163             :                                            ::com::sun::star::beans::PropertyValue>& xMask,
     164             :                                      bool                                             bInvertMask) = 0;
     165             :         virtual void drawAlphaMaskedImage(const ::com::sun::star::uno::Sequence<
     166             :                                                 ::com::sun::star::beans::PropertyValue>& xImage,
     167             :                                           const ::com::sun::star::uno::Sequence<
     168             :                                                 ::com::sun::star::beans::PropertyValue>& xMask) = 0;
     169             :     };
     170             : 
     171             :     typedef boost::shared_ptr<ContentSink> ContentSinkSharedPtr;
     172             : }
     173             : 
     174             : #endif // INCLUDED_SDEXT_SOURCE_PDFIMPORT_INC_CONTENTSINK_HXX
     175             : 
     176             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10