LibreOffice Module canvas (master) 1
cairo_textlayout.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
23
24#include <com/sun/star/lang/XServiceInfo.hpp>
25#include <com/sun/star/rendering/RenderState.hpp>
26#include <com/sun/star/rendering/ViewState.hpp>
27#include <com/sun/star/rendering/XTextLayout.hpp>
28
29#include <vcl/outdev.hxx>
30
31#include "cairo_canvasfont.hxx"
32
33
34/* Definition of TextLayout class */
35
36namespace cairocanvas
37{
38 typedef ::comphelper::WeakComponentImplHelper< css::rendering::XTextLayout,
39 css::lang::XServiceInfo > TextLayout_Base;
40
42 {
43 public:
45 TextLayout(const TextLayout&) = delete;
46 const TextLayout& operator=(const TextLayout&) = delete;
47
48 TextLayout( css::rendering::StringContext aText,
49 sal_Int8 nDirection,
50 sal_Int64 nRandomSeed,
52 SurfaceProviderRef rRefDevice );
53
55 virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
56
57 // XTextLayout
58 virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) override;
59 virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) override;
60 virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) override;
61 virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) override;
62 virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) override;
63 virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions( ) override;
64 virtual void SAL_CALL applyKashidaPositions( const css::uno::Sequence< sal_Bool >& aPositions ) override;
65 virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) override;
66 virtual double SAL_CALL justify( double nSize ) override;
67 virtual double SAL_CALL combinedJustify( const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > >& aNextLayouts, double nSize ) override;
68 virtual css::rendering::TextHit SAL_CALL getTextHit( const css::geometry::RealPoint2D& aHitPoint ) override;
69 virtual css::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) override;
70 virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) override;
71 virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
72 virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
73 virtual double SAL_CALL getBaselineOffset( ) override;
74 virtual sal_Int8 SAL_CALL getMainTextDirection( ) override;
75 virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont( ) override;
76 virtual css::rendering::StringContext SAL_CALL getText( ) override;
77
78 // XServiceInfo
79 virtual OUString SAL_CALL getImplementationName() override;
80 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
81 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
82
83 void draw( OutputDevice& rOutDev,
84 const Point& rOutpos,
85 const css::rendering::ViewState& viewState,
86 const css::rendering::RenderState& renderState ) const;
87
89 const css::uno::Sequence< double >& inputOffsets,
90 const css::rendering::ViewState& viewState,
91 const css::rendering::RenderState& renderState ) const;
92
93 protected:
94 virtual ~TextLayout() override; // we're a ref-counted UNO class. _We_ destroy ourselves.
95
96 private:
97 css::rendering::StringContext maText;
98 css::uno::Sequence< double > maLogicalAdvancements;
99 css::uno::Sequence< sal_Bool > maKashidaPositions;
103 };
104
105}
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Sequence< sal_Bool > maKashidaPositions
virtual sal_Int8 SAL_CALL getMainTextDirection() override
virtual css::rendering::TextHit SAL_CALL getTextHit(const css::geometry::RealPoint2D &aHitPoint) override
virtual double SAL_CALL combinedJustify(const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > > &aNextLayouts, double nSize) override
virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes() override
TextLayout(css::rendering::StringContext aText, sal_Int8 nDirection, sal_Int64 nRandomSeed, CanvasFont::Reference rFont, SurfaceProviderRef rRefDevice)
virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds() override
virtual css::rendering::StringContext SAL_CALL getText() override
virtual double SAL_CALL justify(double nSize) override
virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont() override
virtual double SAL_CALL getBaselineOffset() override
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures() override
virtual void disposing(std::unique_lock< std::mutex > &rGuard) override
Dispose all internal references.
virtual OUString SAL_CALL getImplementationName() override
KernArray setupTextOffsets(const css::uno::Sequence< double > &inputOffsets, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) const
const TextLayout & operator=(const TextLayout &)=delete
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual void SAL_CALL applyKashidaPositions(const css::uno::Sequence< sal_Bool > &aPositions) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures() override
virtual ~TextLayout() override
TextLayout(const TextLayout &)=delete
make noncopyable
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int32 SAL_CALL getNextInsertionIndex(sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures) override
virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements() override
SurfaceProviderRef mpRefDevice
css::uno::Sequence< double > maLogicalAdvancements
css::rendering::StringContext maText
virtual css::rendering::Caret SAL_CALL getCaret(sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures) override
virtual void SAL_CALL applyLogicalAdvancements(const css::uno::Sequence< double > &aAdvancements) override
CanvasFont::Reference mpFont
void draw(OutputDevice &rOutDev, const Point &rOutpos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) const
virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions() override
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
::comphelper::WeakComponentImplHelper< css::rendering::XTextLayout, css::lang::XServiceInfo > TextLayout_Base
class SAL_LOPLUGIN_ANNOTATE("crosscast") SurfaceProvider typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef
Target interface for XCachedPrimitive implementations.
unsigned char sal_Bool
signed char sal_Int8