Branch libreoffice-5-0-4
[LibreOffice.git] / canvas / source / directx / dx_canvasfont.hxx
blobebb3d559af391b1cabfd8724da4c0d5c13f3d9d0
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 #ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASFONT_HXX
21 #define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASFONT_HXX
23 #include <cppuhelper/compbase2.hxx>
24 #include <comphelper/broadcasthelper.hxx>
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/rendering/XCanvas.hpp>
28 #include <com/sun/star/rendering/XCanvasFont.hpp>
30 #include <rtl/ref.hxx>
32 #include <boost/shared_ptr.hpp>
33 #include <boost/utility.hpp>
35 #include "dx_winstuff.hxx"
36 #include "dx_gdiplususer.hxx"
39 /* Definition of CanvasFont class */
41 namespace dxcanvas
43 typedef ::boost::shared_ptr< Gdiplus::Font > FontSharedPtr;
44 typedef ::boost::shared_ptr< Gdiplus::FontFamily > FontFamilySharedPtr;
46 typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::rendering::XCanvasFont,
47 ::com::sun::star::lang::XServiceInfo > CanvasFont_Base;
49 class CanvasFont : public ::comphelper::OBaseMutex,
50 public CanvasFont_Base,
51 private ::boost::noncopyable
53 public:
54 typedef rtl::Reference<CanvasFont> ImplRef;
56 CanvasFont( const ::com::sun::star::rendering::FontRequest& fontRequest,
57 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& extraFontProperties,
58 const ::com::sun::star::geometry::Matrix2D& fontMatrix );
60 /// Dispose all internal references
61 virtual void SAL_CALL disposing();
63 // XCanvasFont
64 virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XTextLayout > SAL_CALL createTextLayout( const ::com::sun::star::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) throw (::com::sun::star::uno::RuntimeException);
65 virtual ::com::sun::star::rendering::FontRequest SAL_CALL getFontRequest( ) throw (::com::sun::star::uno::RuntimeException);
66 virtual ::com::sun::star::rendering::FontMetrics SAL_CALL getFontMetrics( ) throw (::com::sun::star::uno::RuntimeException);
67 virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getAvailableSizes( ) throw (::com::sun::star::uno::RuntimeException);
68 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) throw (::com::sun::star::uno::RuntimeException);
70 // XServiceInfo
71 virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
72 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
73 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
75 double getCellAscent() const;
76 double getEmHeight() const;
77 FontSharedPtr getFont() const;
78 const ::com::sun::star::geometry::Matrix2D& getFontMatrix() const;
80 private:
81 GDIPlusUserSharedPtr mpGdiPlusUser;
82 FontFamilySharedPtr mpFontFamily;
83 FontSharedPtr mpFont;
84 ::com::sun::star::rendering::FontRequest maFontRequest;
85 ::com::sun::star::geometry::Matrix2D maFontMatrix;
90 #endif // INCLUDED_CANVAS_SOURCE_DIRECTX_DX_CANVASFONT_HXX
92 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */