update emoji autocorrect entries from po-files
[LibreOffice.git] / vcl / source / gdi / oldprintadaptor.cxx
blobb71d9dd15654bfae1e86d15ff22269e03b08120e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "vcl/oldprintadaptor.hxx"
21 #include "vcl/gdimtf.hxx"
23 #include "com/sun/star/awt/Size.hpp"
25 #include <vector>
27 namespace vcl
29 struct AdaptorPage
31 GDIMetaFile maPage;
32 com::sun::star::awt::Size maPageSize;
35 struct ImplOldStyleAdaptorData
37 std::vector< AdaptorPage > maPages;
41 using namespace vcl;
42 using namespace cppu;
43 using namespace com::sun::star;
44 using namespace com::sun::star::uno;
45 using namespace com::sun::star::beans;
47 OldStylePrintAdaptor::OldStylePrintAdaptor( const VclPtr< Printer >& i_xPrinter )
48 : PrinterController( i_xPrinter )
49 , mpData( new ImplOldStyleAdaptorData() )
53 OldStylePrintAdaptor::~OldStylePrintAdaptor()
55 delete mpData;
58 void OldStylePrintAdaptor::StartPage()
60 Size aPaperSize( getPrinter()->PixelToLogic( getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
61 mpData->maPages.push_back( AdaptorPage() );
62 mpData->maPages.back().maPageSize.Width = aPaperSize.getWidth();
63 mpData->maPages.back().maPageSize.Height = aPaperSize.getHeight();
64 getPrinter()->SetConnectMetaFile( &mpData->maPages.back().maPage );
66 // copy state into metafile
67 VclPtr<Printer> xPrinter( getPrinter() );
68 xPrinter->SetMapMode(xPrinter->GetMapMode());
69 xPrinter->SetFont(xPrinter->GetFont());
70 xPrinter->SetDrawMode(xPrinter->GetDrawMode());
71 xPrinter->SetLineColor(xPrinter->GetLineColor());
72 xPrinter->SetFillColor(xPrinter->GetFillColor());
75 void OldStylePrintAdaptor::EndPage()
77 getPrinter()->SetConnectMetaFile( NULL );
78 mpData->maPages.back().maPage.WindStart();
81 int OldStylePrintAdaptor::getPageCount() const
83 return int(mpData->maPages.size());
86 Sequence< PropertyValue > OldStylePrintAdaptor::getPageParameters( int i_nPage ) const
88 Sequence< PropertyValue > aRet( 1 );
89 aRet[0].Name = "PageSize";
90 if( i_nPage < int(mpData->maPages.size() ) )
91 aRet[0].Value = makeAny( mpData->maPages[i_nPage].maPageSize );
92 else
94 awt::Size aEmpty( 0, 0 );
95 aRet[0].Value = makeAny( aEmpty );
97 return aRet;
100 void OldStylePrintAdaptor::printPage( int i_nPage ) const
102 if( i_nPage < int(mpData->maPages.size()) )
104 mpData->maPages[ i_nPage ].maPage.WindStart();
105 mpData->maPages[ i_nPage ].maPage.Play( getPrinter().get() );
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */