LibreOffice Module canvas (master) 1
dx_canvasfont.hxx
Go to the documentation of this file.
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#pragma once
21
24
25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/rendering/XCanvas.hpp>
27#include <com/sun/star/rendering/XCanvasFont.hpp>
28
29#include <rtl/ref.hxx>
30
31#include <memory>
32
33#include "dx_winstuff.hxx"
34#include "dx_gdiplususer.hxx"
35
36
37/* Definition of CanvasFont class */
38
39namespace dxcanvas
40{
41 typedef std::shared_ptr< Gdiplus::Font > FontSharedPtr;
42 typedef std::shared_ptr< Gdiplus::FontFamily > FontFamilySharedPtr;
43
44 typedef ::cppu::WeakComponentImplHelper< css::rendering::XCanvasFont,
45 css::lang::XServiceInfo > CanvasFont_Base;
46
48 public CanvasFont_Base
49 {
50 public:
53 CanvasFont(const CanvasFont&) = delete;
54 const CanvasFont& operator=(const CanvasFont&) = delete;
55
56 CanvasFont( const css::rendering::FontRequest& fontRequest,
57 const css::uno::Sequence< css::beans::PropertyValue >& extraFontProperties,
58 const css::geometry::Matrix2D& fontMatrix );
59
61 virtual void SAL_CALL disposing() override;
62
63 // XCanvasFont
64 virtual css::uno::Reference< css::rendering::XTextLayout > SAL_CALL createTextLayout( const css::rendering::StringContext& aText, sal_Int8 nDirection, sal_Int64 nRandomSeed ) override;
65 virtual css::rendering::FontRequest SAL_CALL getFontRequest( ) override;
66 virtual css::rendering::FontMetrics SAL_CALL getFontMetrics( ) override;
67 virtual css::uno::Sequence< double > SAL_CALL getAvailableSizes( ) override;
68 virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getExtraFontProperties( ) override;
69
70 // XServiceInfo
71 virtual OUString SAL_CALL getImplementationName() override;
72 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
73 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
74
75 double getCellAscent() const;
76 double getEmHeight() const;
77 FontSharedPtr getFont() const;
78 const css::geometry::Matrix2D& getFontMatrix() const;
79 sal_uInt32 getEmphasisMark() const { return mnEmphasisMark; }
80
81 private:
85 css::rendering::FontRequest maFontRequest;
86 sal_uInt32 mnEmphasisMark;
87 css::geometry::Matrix2D maFontMatrix;
88 };
89
90}
91
92/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
FontSharedPtr mpFont
css::rendering::FontRequest maFontRequest
const css::geometry::Matrix2D & getFontMatrix() const
GDIPlusUserSharedPtr mpGdiPlusUser
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
double getEmHeight() const
rtl::Reference< CanvasFont > ImplRef
FontFamilySharedPtr mpFontFamily
virtual css::rendering::FontRequest SAL_CALL getFontRequest() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
sal_uInt32 getEmphasisMark() const
const CanvasFont & operator=(const CanvasFont &)=delete
css::geometry::Matrix2D maFontMatrix
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getExtraFontProperties() override
CanvasFont(const CanvasFont &)=delete
make noncopyable
virtual css::uno::Sequence< double > SAL_CALL getAvailableSizes() override
virtual css::uno::Reference< css::rendering::XTextLayout > SAL_CALL createTextLayout(const css::rendering::StringContext &aText, sal_Int8 nDirection, sal_Int64 nRandomSeed) override
double getCellAscent() const
virtual css::rendering::FontMetrics SAL_CALL getFontMetrics() override
virtual void SAL_CALL disposing() override
Dispose all internal references.
CanvasFont(const css::rendering::FontRequest &fontRequest, const css::uno::Sequence< css::beans::PropertyValue > &extraFontProperties, const css::geometry::Matrix2D &fontMatrix)
FontSharedPtr getFont() const
virtual OUString SAL_CALL getImplementationName() override
::cppu::WeakComponentImplHelper< css::rendering::XCanvasFont, css::lang::XServiceInfo > CanvasFont_Base
std::shared_ptr< Gdiplus::FontFamily > FontFamilySharedPtr
GDIPlusUser::GDIPlusUserSharedPtr GDIPlusUserSharedPtr
std::shared_ptr< Gdiplus::Font > FontSharedPtr
unsigned char sal_Bool
signed char sal_Int8