Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / vcl / inc / graphite_serverfont.hxx
blob180ed69236d98f8295cf6afc5dbb133858f54354
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
21 #define INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
23 // We need this to enable namespace support in libgrengine headers.
24 #define GR_NAMESPACE
26 #ifndef _MSC_VER
27 #include <graphite_layout.hxx>
29 class PhysicalFontFace;
31 // Modules
33 class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
35 public:
36 GraphiteLayoutImpl(const gr_face * pFace,
37 ServerFont & rServerFont) throw()
38 : GraphiteLayout(pFace), mrServerFont(rServerFont) {};
39 virtual ~GraphiteLayoutImpl() throw() {};
40 virtual sal_GlyphId getKashidaGlyph(int & width) SAL_OVERRIDE;
41 private:
42 ServerFont & mrServerFont;
45 // This class implments the server font specific parts.
46 // @author tse
48 class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout
50 private:
51 // mutable so that the DrawOffset/DrawBase can be set
52 mutable GraphiteLayoutImpl maImpl;
53 grutils::GrFeatureParser * mpFeatures;
54 const sal_Unicode * mpStr;
55 public:
56 GraphiteServerFontLayout(ServerFont& pServerFont) throw();
58 virtual bool LayoutText( ImplLayoutArgs& rArgs) SAL_OVERRIDE
60 mpStr = rArgs.mpStr;
61 SalLayout::AdjustLayout(rArgs);
62 return maImpl.LayoutText(rArgs);
63 }; // first step of layout
64 virtual void AdjustLayout( ImplLayoutArgs& rArgs) SAL_OVERRIDE
66 SalLayout::AdjustLayout(rArgs);
67 maImpl.DrawBase() = maDrawBase;
68 maImpl.DrawOffset() = maDrawOffset;
69 maImpl.AdjustLayout(rArgs);
71 virtual long GetTextWidth() const SAL_OVERRIDE { return maImpl.GetTextWidth(); }
72 virtual long FillDXArray( sal_Int32* dxa ) const SAL_OVERRIDE { return maImpl.FillDXArray(dxa); }
73 virtual sal_Int32 GetTextBreak(long mw, long ce, int f) const SAL_OVERRIDE
74 { return maImpl.GetTextBreak(mw, ce, f); }
75 virtual void GetCaretPositions( int as, sal_Int32* cxa ) const SAL_OVERRIDE { maImpl.GetCaretPositions(as, cxa); }
77 // used by display layers
78 virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s,
79 sal_Int32* gaa = NULL, int* cpa = NULL,
80 const PhysicalFontFace** pFallbackFonts = NULL ) const SAL_OVERRIDE
82 maImpl.DrawBase() = maDrawBase;
83 maImpl.DrawOffset() = maDrawOffset;
84 return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa, pFallbackFonts);
87 virtual void MoveGlyph( int nStart, long nNewXPos ) SAL_OVERRIDE { maImpl.MoveGlyph(nStart, nNewXPos); };
88 virtual void DropGlyph( int nStart ) SAL_OVERRIDE { maImpl.DropGlyph(nStart); };
89 virtual void Simplify( bool bIsBase ) SAL_OVERRIDE { maImpl.Simplify(bIsBase); };
91 virtual ~GraphiteServerFontLayout() throw();
93 static bool IsGraphiteEnabledFont(ServerFont& rServerFont);
94 // For use with PspGraphics
95 const sal_Unicode* getTextPtr() const { return mpStr; };
96 int getMinCharPos() const { return mnMinCharPos; }
97 int getMaxCharPos() const { return mnEndCharPos; }
100 #endif
101 #endif // INCLUDED_VCL_INC_GRAPHITE_SERVERFONT_HXX
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */