1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SV_GRAPHITESERVERFONT_HXX
25 #define _SV_GRAPHITESERVERFONT_HXX
26 
27 // We need this to enable namespace support in libgrengine headers.
28 #define GR_NAMESPACE
29 
30 #ifndef MSC
31 #include <graphite_layout.hxx>
32 #include <graphite_adaptors.hxx>
33 
34 // Modules
35 
36 class VCL_PLUGIN_PUBLIC GraphiteLayoutImpl : public GraphiteLayout
37 {
38 public:
GraphiteLayoutImpl(const gr::Font & font,const grutils::GrFeatureParser * features,GraphiteFontAdaptor * pFont)39     GraphiteLayoutImpl(const gr::Font & font, const grutils::GrFeatureParser * features, GraphiteFontAdaptor * pFont) throw()
40     : GraphiteLayout(font, features), mpFont(pFont) {};
~GraphiteLayoutImpl()41     virtual ~GraphiteLayoutImpl() throw() {};
42     virtual sal_GlyphId getKashidaGlyph(int & width);
43 private:
44     GraphiteFontAdaptor * mpFont;
45 };
46 
47 // This class implments the server font specific parts.
48 // @author tse
49 //
50 class VCL_PLUGIN_PUBLIC GraphiteServerFontLayout : public ServerFontLayout
51 {
52 private:
53         mutable GraphiteFontAdaptor * mpFont;
54         // mutable so that the DrawOffset/DrawBase can be set
55         mutable GraphiteLayoutImpl maImpl;
56 public:
57         explicit GraphiteServerFontLayout( GraphiteFontAdaptor* font ) throw();
58 
LayoutText(ImplLayoutArgs & rArgs)59         virtual bool  LayoutText( ImplLayoutArgs& rArgs) { SalLayout::AdjustLayout(rArgs); return maImpl.LayoutText(rArgs); };    // first step of layout
AdjustLayout(ImplLayoutArgs & rArgs)60         virtual void  AdjustLayout( ImplLayoutArgs& rArgs)
61         {
62             SalLayout::AdjustLayout(rArgs);
63             maImpl.DrawBase() = maDrawBase;
64             maImpl.DrawOffset() = maDrawOffset;
65             maImpl.AdjustLayout(rArgs);
66         };
GetTextWidth() const67         virtual long    GetTextWidth() const                           { return maImpl.GetTextWidth(); }
FillDXArray(sal_Int32 * dxa) const68         virtual long    FillDXArray( sal_Int32* dxa ) const                 { return maImpl.FillDXArray(dxa); }
GetTextBreak(long mw,long ce,int f) const69         virtual int     GetTextBreak( long mw, long ce, int f ) const  { return maImpl.GetTextBreak(mw, ce, f); }
GetCaretPositions(int as,sal_Int32 * cxa) const70         virtual void    GetCaretPositions( int as, sal_Int32* cxa ) const   { maImpl.GetCaretPositions(as, cxa); }
71 
72         // used by display layers
GetNextGlyphs(int l,sal_GlyphId * gia,Point & p,int & s,sal_Int32 * gaa=NULL,int * cpa=NULL) const73         virtual int     GetNextGlyphs( int l, sal_GlyphId* gia, Point& p, int& s,
74                         sal_Int32* gaa = NULL, int* cpa = NULL ) const
75         {
76             maImpl.DrawBase() = maDrawBase;
77             maImpl.DrawOffset() = maDrawOffset;
78             return maImpl.GetNextGlyphs(l, gia, p, s, gaa, cpa);
79         }
80 
MoveGlyph(int nStart,long nNewXPos)81         virtual void    MoveGlyph( int nStart, long nNewXPos ) { maImpl.MoveGlyph(nStart, nNewXPos); };
DropGlyph(int nStart)82         virtual void    DropGlyph( int nStart ) { maImpl.DropGlyph(nStart); };
Simplify(bool bIsBase)83         virtual void    Simplify( bool bIsBase ) { maImpl.Simplify(bIsBase); };
84 
85         virtual ~GraphiteServerFontLayout() throw();
86 
87 // For use with PspGraphics
88         const sal_Unicode* getTextPtr() const;
getMinCharPos() const89         int getMinCharPos() const { return mnMinCharPos; }
getMaxCharPos() const90         int getMaxCharPos() const { return mnEndCharPos; }
91 };
92 
93 #endif
94 #endif //_SV_GRAPHITESERVERFONT_HXX
95