LibreOffice Module canvas (master) 1
dx_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
24
25#include <com/sun/star/lang/XServiceInfo.hpp>
26
27#include <com/sun/star/rendering/XTextLayout.hpp>
28
30
31#include "dx_canvasfont.hxx"
32#include "dx_ibitmap.hxx"
33#include "dx_winstuff.hxx"
34#include "dx_gdiplususer.hxx"
35
36
37/* Definition of TextLayout class */
38namespace dxcanvas
39{
40 typedef ::cppu::WeakComponentImplHelper< css::rendering::XTextLayout,
41 css::lang::XServiceInfo > TextLayout_Base;
42
44 public TextLayout_Base
45 {
46 public:
47 TextLayout( const css::rendering::StringContext& aText,
48 sal_Int8 nDirection,
49 sal_Int64 nRandomSeed,
50 const CanvasFont::ImplRef& rFont );
52 TextLayout(const TextLayout&) = delete;
53 const TextLayout& operator=(const TextLayout&) = delete;
54
56 virtual void SAL_CALL disposing() override;
57
58 // XTextLayout
59 virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) override;
60 virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) override;
61 virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) override;
62 virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) override;
63 virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) override;
64 virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions( ) override;
65 virtual void SAL_CALL applyKashidaPositions( const css::uno::Sequence< sal_Bool >& aPositions ) override;
66 virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds( ) override;
67 virtual double SAL_CALL justify( double nSize ) override;
68 virtual double SAL_CALL combinedJustify( const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > >& aNextLayouts, double nSize ) override;
69 virtual css::rendering::TextHit SAL_CALL getTextHit( const css::geometry::RealPoint2D& aHitPoint ) override;
70 virtual css::rendering::Caret SAL_CALL getCaret( sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures ) override;
71 virtual sal_Int32 SAL_CALL getNextInsertionIndex( sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures ) override;
72 virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
73 virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
74 virtual double SAL_CALL getBaselineOffset( ) override;
75 virtual sal_Int8 SAL_CALL getMainTextDirection( ) override;
76 virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont( ) override;
77 virtual css::rendering::StringContext SAL_CALL getText( ) override;
78
79 // XServiceInfo
80 virtual OUString SAL_CALL getImplementationName() override;
81 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
82 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
83
84 bool draw( const GraphicsSharedPtr& rGraphics,
85 const css::rendering::ViewState& rViewState,
86 const css::rendering::RenderState& rRenderState,
87 const ::basegfx::B2ISize& rOutputOffset,
88 const css::uno::Reference<
89 css::rendering::XGraphicDevice >& xGraphicDevice,
90 bool bAlphaSurface ) const;
91
92 protected:
93 ~TextLayout() override; // we're a ref-counted UNO class. _We_ destroy ourselves.
94
95 private:
96 // NOTE: no need for GDIPlusUserSharedPtr, mpFont implicitly has one already
97
98 css::rendering::StringContext maText;
99 css::uno::Sequence< double > maLogicalAdvancements;
100 css::uno::Sequence< sal_Bool > maKashidaPositions;
103 };
104
105}
106
107/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::rendering::StringContext SAL_CALL getText() override
bool draw(const GraphicsSharedPtr &rGraphics, const css::rendering::ViewState &rViewState, const css::rendering::RenderState &rRenderState, const ::basegfx::B2ISize &rOutputOffset, const css::uno::Reference< css::rendering::XGraphicDevice > &xGraphicDevice, bool bAlphaSurface) const
virtual css::rendering::TextHit SAL_CALL getTextHit(const css::geometry::RealPoint2D &aHitPoint) override
css::rendering::StringContext maText
virtual void SAL_CALL disposing() override
Dispose all internal references.
css::uno::Sequence< sal_Bool > maKashidaPositions
virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements() override
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures() override
virtual double SAL_CALL justify(double nSize) override
CanvasFont::ImplRef mpFont
virtual css::uno::Sequence< sal_Bool > SAL_CALL queryKashidaPositions() override
virtual double SAL_CALL getBaselineOffset() override
TextLayout(const css::rendering::StringContext &aText, sal_Int8 nDirection, sal_Int64 nRandomSeed, const CanvasFont::ImplRef &rFont)
const TextLayout & operator=(const TextLayout &)=delete
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures() override
virtual void SAL_CALL applyLogicalAdvancements(const css::uno::Sequence< double > &aAdvancements) override
virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes() override
virtual void SAL_CALL applyKashidaPositions(const css::uno::Sequence< sal_Bool > &aPositions) override
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual double SAL_CALL combinedJustify(const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > > &aNextLayouts, double nSize) override
virtual sal_Int32 SAL_CALL getNextInsertionIndex(sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds() override
TextLayout(const TextLayout &)=delete
make noncopyable
virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont() override
virtual css::rendering::Caret SAL_CALL getCaret(sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures) override
css::uno::Sequence< double > maLogicalAdvancements
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int8 SAL_CALL getMainTextDirection() override
::cppu::WeakComponentImplHelper< css::rendering::XTextLayout, css::lang::XServiceInfo > TextLayout_Base
std::shared_ptr< Gdiplus::Graphics > GraphicsSharedPtr
Definition: dx_winstuff.hxx:58
unsigned char sal_Bool
signed char sal_Int8