LibreOffice Module canvas (master) 1
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/StringContext.hpp>
26#include <com/sun/star/rendering/XTextLayout.hpp>
27
28#include "canvasfont.hxx"
29#include "impltools.hxx"
30
31/* Definition of TextLayout class */
32
33namespace vclcanvas
34{
35 typedef ::comphelper::WeakComponentImplHelper< css::rendering::XTextLayout,
36 css::lang::XServiceInfo > TextLayout_Base;
37
39 {
40 public:
42 TextLayout(const TextLayout&) = delete;
43 const TextLayout& operator=(const TextLayout&) = delete;
44
45 TextLayout( css::rendering::StringContext aText,
46 sal_Int8 nDirection,
48 css::uno::Reference<
49 css::rendering::XGraphicDevice> xDevice,
51
53 virtual void disposing(std::unique_lock<std::mutex>& rGuard) override;
54
55 // XTextLayout
56 virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) override;
57 virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) override;
58 virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) override;
59 virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) override;
60 virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) override;
61 virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions( ) override;
62 virtual void SAL_CALL applyKashidaPositions( const css::uno::Sequence< sal_Bool >& aPositions ) override;
63 virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) override;
64 virtual double SAL_CALL justify( double nSize ) override;
65 virtual double SAL_CALL combinedJustify( const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > >& aNextLayouts, double nSize ) override;
66 virtual css::rendering::TextHit SAL_CALL getTextHit( const css::geometry::RealPoint2D& aHitPoint ) override;
67 virtual css::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) override;
68 virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) override;
69 virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
70 virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
71 virtual double SAL_CALL getBaselineOffset( ) override;
72 virtual sal_Int8 SAL_CALL getMainTextDirection( ) override;
73 virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont( ) override;
74 virtual css::rendering::StringContext SAL_CALL getText( ) override;
75
76 // XServiceInfo
77 virtual OUString SAL_CALL getImplementationName() override;
78 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
79 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
80
81 void draw( OutputDevice& rOutDev,
82 const Point& rOutpos,
83 const css::rendering::ViewState& viewState,
84 const css::rendering::RenderState& renderState ) const;
85
86 private:
88 const css::uno::Sequence< double >& inputOffsets,
89 const css::rendering::ViewState& viewState,
90 const css::rendering::RenderState& renderState ) const;
91
92 css::rendering::StringContext maText;
93 css::uno::Sequence< double > maLogicalAdvancements;
94 css::uno::Sequence< sal_Bool > maKashidaPositions;
96 css::uno::Reference< css::rendering::XGraphicDevice> mxDevice;
99 };
100
101}
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual sal_Int32 SAL_CALL getNextInsertionIndex(sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures) override
Definition: textlayout.cxx:301
virtual void SAL_CALL applyLogicalAdvancements(const css::uno::Sequence< double > &aAdvancements) override
TextLayout(css::rendering::StringContext aText, sal_Int8 nDirection, CanvasFont::Reference rFont, css::uno::Reference< css::rendering::XGraphicDevice > xDevice, OutDevProviderSharedPtr xOutDev)
KernArray setupTextOffsets(const css::uno::Sequence< double > &inputOffsets, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) const
virtual css::rendering::Caret SAL_CALL getCaret(sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures) override
Definition: textlayout.cxx:295
virtual double SAL_CALL justify(double nSize) override
Definition: textlayout.cxx:276
virtual css::rendering::StringContext SAL_CALL getText() override
Definition: textlayout.cxx:339
virtual void SAL_CALL applyKashidaPositions(const css::uno::Sequence< sal_Bool > &aPositions) override
virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions() override
Definition: textlayout.cxx:221
virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds() override
Definition: textlayout.cxx:238
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Definition: textlayout.cxx:313
css::uno::Sequence< double > maLogicalAdvancements
Definition: textlayout.hxx:93
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: textlayout.cxx:444
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures() override
Definition: textlayout.cxx:198
OutDevProviderSharedPtr mpOutDevProvider
Definition: textlayout.hxx:97
css::uno::Sequence< sal_Bool > maKashidaPositions
Definition: textlayout.hxx:94
const TextLayout & operator=(const TextLayout &)=delete
virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements() override
Definition: textlayout.cxx:204
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Definition: textlayout.cxx:307
virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes() override
Definition: textlayout.cxx:103
virtual OUString SAL_CALL getImplementationName() override
Definition: textlayout.cxx:439
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: textlayout.cxx:449
virtual double SAL_CALL getBaselineOffset() override
Definition: textlayout.cxx:319
TextLayout(const TextLayout &)=delete
make noncopyable
virtual double SAL_CALL combinedJustify(const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > > &aNextLayouts, double nSize) override
virtual void disposing(std::unique_lock< std::mutex > &rGuard) override
Dispose all internal references.
Definition: textlayout.cxx:90
CanvasFont::Reference mpFont
Definition: textlayout.hxx:95
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures() override
Definition: textlayout.cxx:151
css::rendering::StringContext maText
Definition: textlayout.hxx:92
virtual sal_Int8 SAL_CALL getMainTextDirection() override
Definition: textlayout.cxx:325
void draw(OutputDevice &rOutDev, const Point &rOutpos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) const
virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont() override
Definition: textlayout.cxx:332
css::uno::Reference< css::rendering::XGraphicDevice > mxDevice
Definition: textlayout.hxx:96
virtual css::rendering::TextHit SAL_CALL getTextHit(const css::geometry::RealPoint2D &aHitPoint) override
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
::comphelper::WeakComponentImplHelper< css::rendering::XTextLayout, css::lang::XServiceInfo > TextLayout_Base
Definition: textlayout.hxx:36
unsigned char sal_Bool
signed char sal_Int8