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 #ifndef INCLUDED_CANVAS_SOURCE_VCL_TEXTLAYOUT_HXX
21 #define INCLUDED_CANVAS_SOURCE_VCL_TEXTLAYOUT_HXX
22 
23 #include <cppuhelper/compbase.hxx>
24 #include <cppuhelper/basemutex.hxx>
25 
26 #include <com/sun/star/lang/XServiceInfo.hpp>
27 #include <com/sun/star/rendering/StringContext.hpp>
28 #include <com/sun/star/rendering/XTextLayout.hpp>
29 
30 #include "canvasfont.hxx"
31 #include "impltools.hxx"
32 
33 
34 /* Definition of TextLayout class */
35 
36 namespace vclcanvas
37 {
38  typedef ::cppu::WeakComponentImplHelper< css::rendering::XTextLayout,
39  css::lang::XServiceInfo > TextLayout_Base;
40 
41  class TextLayout : public ::cppu::BaseMutex,
42  public TextLayout_Base
43  {
44  public:
46  TextLayout(const TextLayout&) = delete;
47  const TextLayout& operator=(const TextLayout&) = delete;
48 
49  TextLayout( const css::rendering::StringContext& aText,
50  sal_Int8 nDirection,
51  const CanvasFont::Reference& rFont,
52  const css::uno::Reference<
53  css::rendering::XGraphicDevice>& xDevice,
54  const OutDevProviderSharedPtr& rOutDev );
55 
57  virtual void SAL_CALL disposing() override;
58 
59  // XTextLayout
60  virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes( ) override;
61  virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures( ) override;
62  virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures( ) override;
63  virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements( ) override;
64  virtual void SAL_CALL applyLogicalAdvancements( const css::uno::Sequence< double >& aAdvancements ) 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 
88  private:
89  void setupTextOffsets( long* outputOffsets,
90  const css::uno::Sequence< double >& inputOffsets,
91  const css::rendering::ViewState& viewState,
92  const css::rendering::RenderState& renderState ) const;
93 
94  css::rendering::StringContext maText;
95  css::uno::Sequence< double > maLogicalAdvancements;
97  css::uno::Reference< css::rendering::XGraphicDevice> mxDevice;
100  };
101 
102 }
103 
104 #endif // INCLUDED_CANVAS_SOURCE_VCL_TEXTLAYOUT_HXX
105 
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::shared_ptr< OutDevProvider > OutDevProviderSharedPtr
virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL getFont() override
Definition: textlayout.cxx:312
css::uno::Sequence< double > maLogicalAdvancements
Definition: textlayout.hxx:95
signed char sal_Int8
CanvasFont::Reference mpFont
Definition: textlayout.hxx:96
virtual sal_Int8 SAL_CALL getMainTextDirection() override
Definition: textlayout.cxx:305
virtual css::uno::Sequence< css::uno::Reference< css::rendering::XPolyPolygon2D > > SAL_CALL queryTextShapes() override
Definition: textlayout.cxx:101
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryMeasures() override
Definition: textlayout.cxx:195
virtual OUString SAL_CALL getImplementationName() override
Definition: textlayout.cxx:412
void setupTextOffsets(long *outputOffsets, const css::uno::Sequence< double > &inputOffsets, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) const
virtual void SAL_CALL applyLogicalAdvancements(const css::uno::Sequence< double > &aAdvancements) override
virtual double SAL_CALL justify(double nSize) override
Definition: textlayout.cxx:256
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryVisualHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Definition: textlayout.cxx:287
void draw(OutputDevice &rOutDev, const Point &rOutpos, const css::rendering::ViewState &viewState, const css::rendering::RenderState &renderState) const
virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL queryLogicalHighlighting(sal_Int32 nStartIndex, sal_Int32 nEndIndex) override
Definition: textlayout.cxx:293
::cppu::WeakComponentImplHelper< css::rendering::XTextLayout, css::lang::XServiceInfo > TextLayout_Base
Definition: textlayout.hxx:39
virtual css::rendering::StringContext SAL_CALL getText() override
Definition: textlayout.cxx:319
virtual sal_Int32 SAL_CALL getNextInsertionIndex(sal_Int32 nStartIndex, sal_Int32 nCaretAdvancement, sal_Bool bExcludeLigatures) override
Definition: textlayout.cxx:281
TextLayout(const TextLayout &)=delete
make noncopyable
virtual css::geometry::RealRectangle2D SAL_CALL queryTextBounds() override
Definition: textlayout.cxx:218
css::rendering::StringContext maText
Definition: textlayout.hxx:94
unsigned char sal_Bool
virtual css::uno::Sequence< double > SAL_CALL queryLogicalAdvancements() override
Definition: textlayout.cxx:201
virtual double SAL_CALL combinedJustify(const css::uno::Sequence< css::uno::Reference< css::rendering::XTextLayout > > &aNextLayouts, double nSize) override
virtual css::rendering::Caret SAL_CALL getCaret(sal_Int32 nInsertionIndex, sal_Bool bExcludeLigatures) override
Definition: textlayout.cxx:275
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: textlayout.cxx:422
virtual void SAL_CALL disposing() override
Dispose all internal references.
Definition: textlayout.cxx:91
OutDevProviderSharedPtr mpOutDevProvider
Definition: textlayout.hxx:98
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: textlayout.cxx:417
virtual double SAL_CALL getBaselineOffset() override
Definition: textlayout.cxx:299
css::uno::Reference< css::rendering::XGraphicDevice > mxDevice
Definition: textlayout.hxx:97
const TextLayout & operator=(const TextLayout &)=delete
virtual css::rendering::TextHit SAL_CALL getTextHit(const css::geometry::RealPoint2D &aHitPoint) override
virtual css::uno::Sequence< css::geometry::RealRectangle2D > SAL_CALL queryInkMeasures() override
Definition: textlayout.cxx:148