1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <comphelper/compbase.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/geometry/Matrix2D.hpp>
26 #include <com/sun/star/rendering/FontRequest.hpp>
27 #include <com/sun/star/rendering/XCanvasFont.hpp>
28 #include <com/sun/star/rendering/XGraphicDevice.hpp>
30 #include <vcl/font.hxx>
32 #include <vclwrapper.hxx>
34 #include "outdevprovider.hxx"
37 /* Definition of CanvasFont class */
41 typedef ::comphelper::WeakComponentImplHelper
< css::rendering::XCanvasFont
,
42 css::lang::XServiceInfo
> CanvasFont_Base
;
44 class CanvasFont
: public CanvasFont_Base
47 typedef rtl::Reference
<CanvasFont
> Reference
;
50 CanvasFont(const CanvasFont
&) = delete;
51 const CanvasFont
& operator=(const CanvasFont
&) = delete;
53 CanvasFont( const css::rendering::FontRequest
& fontRequest
,
54 const css::uno::Sequence
< css::beans::PropertyValue
>& extraFontProperties
,
55 const css::geometry::Matrix2D
& rFontMatrix
,
56 css::rendering::XGraphicDevice
& rDevice
,
57 const OutDevProviderSharedPtr
& rOutDevProvider
);
59 /// Dispose all internal references
60 virtual void disposing(std::unique_lock
<std::mutex
>& rGuard
) override
;
63 virtual css::uno::Reference
< css::rendering::XTextLayout
> SAL_CALL
createTextLayout( const css::rendering::StringContext
& aText
, sal_Int8 nDirection
, sal_Int64 nRandomSeed
) override
;
64 virtual css::rendering::FontRequest SAL_CALL
getFontRequest( ) override
;
65 virtual css::rendering::FontMetrics SAL_CALL
getFontMetrics( ) override
;
66 virtual css::uno::Sequence
< double > SAL_CALL
getAvailableSizes( ) override
;
67 virtual css::uno::Sequence
< css::beans::PropertyValue
> SAL_CALL
getExtraFontProperties( ) override
;
70 virtual OUString SAL_CALL
getImplementationName() override
;
71 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
72 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
74 vcl::Font
const & getVCLFont() const;
76 const css::geometry::Matrix2D
& getFontMatrix() const;
79 ::canvas::vcltools::VCLObject
<vcl::Font
> maFont
;
80 css::rendering::FontRequest maFontRequest
;
81 css::uno::Reference
< css::rendering::XGraphicDevice
> mpRefDevice
;
82 OutDevProviderSharedPtr mpOutDevProvider
;
83 css::geometry::Matrix2D maFontMatrix
;
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */