Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_GRAPHITESERVERFONT_HXX
30 : : #define _SV_GRAPHITESERVERFONT_HXX
31 : :
32 : : // We need this to enable namespace support in libgrengine headers.
33 : : #define GR_NAMESPACE
34 : :
35 : : #ifndef MSC
36 : : #include <graphite_layout.hxx>
37 : :
38 : : // Modules
39 : :
40 : : class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
41 : : {
42 : : public:
43 : 0 : GraphiteLayoutImpl(const gr_face * pFace,
44 : : ServerFont & rServerFont) throw()
45 : 0 : : GraphiteLayout(pFace), mrServerFont(rServerFont) {};
46 [ # # ]: 0 : virtual ~GraphiteLayoutImpl() throw() {};
47 : : virtual sal_GlyphId getKashidaGlyph(int & width);
48 : : private:
49 : : ServerFont & mrServerFont;
50 : : };
51 : :
52 : : // This class implments the server font specific parts.
53 : : // @author tse
54 : : //
55 : : class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout
56 : : {
57 : : private:
58 : : // mutable so that the DrawOffset/DrawBase can be set
59 : : mutable GraphiteLayoutImpl maImpl;
60 : : grutils::GrFeatureParser * mpFeatures;
61 : : const sal_Unicode * mpStr;
62 : : public:
63 : : GraphiteServerFontLayout(ServerFont& pServerFont) throw();
64 : :
65 : 0 : virtual bool LayoutText( ImplLayoutArgs& rArgs)
66 : : {
67 : 0 : mpStr = rArgs.mpStr;
68 : 0 : SalLayout::AdjustLayout(rArgs);
69 : 0 : return maImpl.LayoutText(rArgs);
70 : : }; // first step of layout
71 : 0 : virtual void AdjustLayout( ImplLayoutArgs& rArgs)
72 : : {
73 : 0 : SalLayout::AdjustLayout(rArgs);
74 : 0 : maImpl.DrawBase() = maDrawBase;
75 : 0 : maImpl.DrawOffset() = maDrawOffset;
76 : 0 : maImpl.AdjustLayout(rArgs);
77 : 0 : };
78 : 0 : virtual long GetTextWidth() const { return maImpl.GetTextWidth(); }
79 : 0 : virtual long FillDXArray( sal_Int32* dxa ) const { return maImpl.FillDXArray(dxa); }
80 : 0 : virtual int GetTextBreak( long mw, long ce, int f ) const { return maImpl.GetTextBreak(mw, ce, f); }
81 : 0 : virtual void GetCaretPositions( int as, sal_Int32* cxa ) const { maImpl.GetCaretPositions(as, cxa); }
82 : :
83 : : // used by display layers
84 : 0 : virtual int GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s,
85 : : sal_Int32* gaa = NULL, int* cpa = NULL ) const
86 : : {
87 : 0 : maImpl.DrawBase() = maDrawBase;
88 : 0 : maImpl.DrawOffset() = maDrawOffset;
89 : 0 : return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa);
90 : : }
91 : :
92 : 0 : virtual void MoveGlyph( int nStart, long nNewXPos ) { maImpl.MoveGlyph(nStart, nNewXPos); };
93 : 0 : virtual void DropGlyph( int nStart ) { maImpl.DropGlyph(nStart); };
94 : 0 : virtual void Simplify( bool bIsBase ) { maImpl.Simplify(bIsBase); };
95 : :
96 : : virtual ~GraphiteServerFontLayout() throw();
97 : :
98 : : static bool IsGraphiteEnabledFont(ServerFont& rServerFont);
99 : : // For use with PspGraphics
100 : : const sal_Unicode* getTextPtr() const { return mpStr; };
101 : : int getMinCharPos() const { return mnMinCharPos; }
102 : : int getMaxCharPos() const { return mnEndCharPos; }
103 : : };
104 : :
105 : : #endif
106 : : #endif //_SV_GRAPHITESERVERFONT_HXX
107 : :
108 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|