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