LCOV - code coverage report
Current view: top level - vcl/source/gdi - oldprintadaptor.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 40 0.0 %
Date: 2012-08-25 Functions: 0 13 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 66 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "vcl/oldprintadaptor.hxx"
      31                 :            : #include "vcl/gdimtf.hxx"
      32                 :            : 
      33                 :            : #include "com/sun/star/awt/Size.hpp"
      34                 :            : 
      35                 :            : #include <vector>
      36                 :            : 
      37                 :            : namespace vcl
      38                 :            : {
      39                 :          0 :     struct AdaptorPage
      40                 :            :     {
      41                 :            :         GDIMetaFile                     maPage;
      42                 :            :         com::sun::star::awt::Size       maPageSize;
      43                 :            :     };
      44                 :            : 
      45                 :          0 :     struct ImplOldStyleAdaptorData
      46                 :            :     {
      47                 :            :         std::vector< AdaptorPage >  maPages;
      48                 :            :     };
      49                 :            : }
      50                 :            : 
      51                 :            : using namespace vcl;
      52                 :            : using namespace cppu;
      53                 :            : using namespace com::sun::star;
      54                 :            : using namespace com::sun::star::uno;
      55                 :            : using namespace com::sun::star::beans;
      56                 :            : 
      57                 :          0 : OldStylePrintAdaptor::OldStylePrintAdaptor( const boost::shared_ptr< Printer >& i_pPrinter )
      58                 :            :     : PrinterController( i_pPrinter )
      59 [ #  # ][ #  # ]:          0 :     , mpData( new ImplOldStyleAdaptorData() )
      60                 :            : {
      61                 :          0 : }
      62                 :            : 
      63                 :          0 : OldStylePrintAdaptor::~OldStylePrintAdaptor()
      64                 :            : {
      65         [ #  # ]:          0 :     delete mpData;
      66         [ #  # ]:          0 : }
      67                 :            : 
      68                 :          0 : void OldStylePrintAdaptor::StartPage()
      69                 :            : {
      70 [ #  # ][ #  # ]:          0 :     Size aPaperSize( getPrinter()->PixelToLogic( getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
         [ #  # ][ #  # ]
                 [ #  # ]
      71 [ #  # ][ #  # ]:          0 :     mpData->maPages.push_back( AdaptorPage() );
                 [ #  # ]
      72         [ #  # ]:          0 :     mpData->maPages.back().maPageSize.Width = aPaperSize.getWidth();
      73         [ #  # ]:          0 :     mpData->maPages.back().maPageSize.Height = aPaperSize.getHeight();
      74 [ #  # ][ #  # ]:          0 :     getPrinter()->SetConnectMetaFile( &mpData->maPages.back().maPage );
                 [ #  # ]
      75                 :            : 
      76                 :            :     // copy state into metafile
      77 [ #  # ][ #  # ]:          0 :     boost::shared_ptr<Printer> pPrinter( getPrinter() );
      78         [ #  # ]:          0 :     pPrinter->SetMapMode( pPrinter->GetMapMode() );
      79         [ #  # ]:          0 :     pPrinter->SetFont( pPrinter->GetFont() );
      80         [ #  # ]:          0 :     pPrinter->SetDrawMode( pPrinter->GetDrawMode() );
      81         [ #  # ]:          0 :     pPrinter->SetLineColor( pPrinter->GetLineColor() );
      82 [ #  # ][ #  # ]:          0 :     pPrinter->SetFillColor( pPrinter->GetFillColor() );
      83                 :          0 : }
      84                 :            : 
      85                 :          0 : void OldStylePrintAdaptor::EndPage()
      86                 :            : {
      87                 :          0 :     getPrinter()->SetConnectMetaFile( NULL );
      88                 :          0 :     mpData->maPages.back().maPage.WindStart();
      89                 :          0 : }
      90                 :            : 
      91                 :          0 : int  OldStylePrintAdaptor::getPageCount() const
      92                 :            : {
      93                 :          0 :     return int(mpData->maPages.size());
      94                 :            : }
      95                 :            : 
      96                 :          0 : Sequence< PropertyValue > OldStylePrintAdaptor::getPageParameters( int i_nPage ) const
      97                 :            : {
      98                 :          0 :     Sequence< PropertyValue > aRet( 1 );
      99 [ #  # ][ #  # ]:          0 :     aRet[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PageSize") );
     100         [ #  # ]:          0 :     if( i_nPage < int(mpData->maPages.size() ) )
     101 [ #  # ][ #  # ]:          0 :         aRet[0].Value = makeAny( mpData->maPages[i_nPage].maPageSize );
     102                 :            :     else
     103                 :            :     {
     104                 :          0 :         awt::Size aEmpty( 0, 0  );
     105 [ #  # ][ #  # ]:          0 :         aRet[0].Value = makeAny( aEmpty );
     106                 :            :     }
     107                 :          0 :     return aRet;
     108                 :            : }
     109                 :            : 
     110                 :          0 : void OldStylePrintAdaptor::printPage( int i_nPage ) const
     111                 :            : {
     112         [ #  # ]:          0 :     if( i_nPage < int(mpData->maPages.size()) )
     113                 :            :    {
     114                 :          0 :        mpData->maPages[ i_nPage ].maPage.WindStart();
     115                 :          0 :        mpData->maPages[ i_nPage ].maPage.Play( getPrinter().get() );
     116                 :            :    }
     117                 :          0 : }
     118                 :            : 
     119                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10