xref: /aoo41x/main/vcl/inc/sallayout.hxx (revision ddde725d)
1cdf0e10cSrcweir /*************************************************************************
2cdf0e10cSrcweir  *
3cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4cdf0e10cSrcweir  *
5cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6cdf0e10cSrcweir  *
7cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8cdf0e10cSrcweir  *
9cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10cdf0e10cSrcweir  *
11cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14cdf0e10cSrcweir  *
15cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20cdf0e10cSrcweir  *
21cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25cdf0e10cSrcweir  *
26cdf0e10cSrcweir  ************************************************************************/
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #ifndef _SV_SALLAYOUT_HXX
29cdf0e10cSrcweir #define _SV_SALLAYOUT_HXX
30cdf0e10cSrcweir 
31cdf0e10cSrcweir #include <tools/gen.hxx>
32cdf0e10cSrcweir #include <vector>
33*ddde725dSArmin Le Grand #include <basegfx/polygon/b2dpolypolygon.hxx>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir #ifndef _TOOLS_LANG_HXX
36cdf0e10cSrcweir typedef unsigned short LanguageType;
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include <vector>
40cdf0e10cSrcweir #include <list>
41cdf0e10cSrcweir #include <vcl/dllapi.h>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir // for typedef sal_UCS4
44cdf0e10cSrcweir #include <vcl/vclenum.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir class SalGraphics;
47cdf0e10cSrcweir class ImplFontData;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir #define MAX_FALLBACK 16
50cdf0e10cSrcweir 
51cdf0e10cSrcweir // ----------------
52cdf0e10cSrcweir // - LayoutOption -
53cdf0e10cSrcweir // ----------------
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #define SAL_LAYOUT_BIDI_RTL                 0x0001
56cdf0e10cSrcweir #define SAL_LAYOUT_BIDI_STRONG              0x0002
57cdf0e10cSrcweir #define SAL_LAYOUT_RIGHT_ALIGN              0x0004
58cdf0e10cSrcweir #define SAL_LAYOUT_KERNING_PAIRS            0x0010
59cdf0e10cSrcweir #define SAL_LAYOUT_KERNING_ASIAN            0x0020
60cdf0e10cSrcweir #define SAL_LAYOUT_VERTICAL                 0x0040
61cdf0e10cSrcweir #define SAL_LAYOUT_COMPLEX_DISABLED         0x0100
62cdf0e10cSrcweir #define SAL_LAYOUT_ENABLE_LIGATURES         0x0200
63cdf0e10cSrcweir #define SAL_LAYOUT_SUBSTITUTE_DIGITS        0x0400
64cdf0e10cSrcweir #define SAL_LAYOUT_KASHIDA_JUSTIFICATON     0x0800
65cdf0e10cSrcweir #define SAL_LAYOUT_DISABLE_GLYPH_PROCESSING 0x1000
66cdf0e10cSrcweir #define SAL_LAYOUT_FOR_FALLBACK             0x2000
67cdf0e10cSrcweir 
68cdf0e10cSrcweir // -----------------
69cdf0e10cSrcweir 
70cdf0e10cSrcweir // used for managing runs e.g. for BiDi, glyph and script fallback
71cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC ImplLayoutRuns
72cdf0e10cSrcweir {
73cdf0e10cSrcweir private:
74cdf0e10cSrcweir     int                 mnRunIndex;
75cdf0e10cSrcweir     std::vector<int>    maRuns;
76cdf0e10cSrcweir 
77cdf0e10cSrcweir public:
78cdf0e10cSrcweir             ImplLayoutRuns() { mnRunIndex = 0; maRuns.reserve(8); }
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     void    Clear()             { maRuns.clear(); }
81cdf0e10cSrcweir     bool    AddPos( int nCharPos, bool bRTL );
82cdf0e10cSrcweir     bool    AddRun( int nMinRunPos, int nEndRunPos, bool bRTL );
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     bool    IsEmpty() const     { return maRuns.empty(); }
85cdf0e10cSrcweir     void    ResetPos()          { mnRunIndex = 0; }
86cdf0e10cSrcweir     void    NextRun()           { mnRunIndex += 2; }
87cdf0e10cSrcweir     bool    GetRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL ) const;
88cdf0e10cSrcweir     bool    GetNextPos( int* nCharPos, bool* bRTL );
89cdf0e10cSrcweir     bool    PosIsInRun( int nCharPos ) const;
90cdf0e10cSrcweir     bool    PosIsInAnyRun( int nCharPos ) const;
91cdf0e10cSrcweir };
92cdf0e10cSrcweir 
93cdf0e10cSrcweir // -----------------
94cdf0e10cSrcweir 
95cdf0e10cSrcweir class ImplLayoutArgs
96cdf0e10cSrcweir {
97cdf0e10cSrcweir public:
98cdf0e10cSrcweir     // string related inputs
99cdf0e10cSrcweir     int                 mnFlags;
100cdf0e10cSrcweir     int                 mnLength;
101cdf0e10cSrcweir     int                 mnMinCharPos;
102cdf0e10cSrcweir     int                 mnEndCharPos;
103cdf0e10cSrcweir     const xub_Unicode*  mpStr;
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     // positioning related inputs
106cdf0e10cSrcweir     const sal_Int32*    mpDXArray;          // in pixel units
107cdf0e10cSrcweir     long                mnLayoutWidth;      // in pixel units
108cdf0e10cSrcweir     int                 mnOrientation;      // in 0-3600 system
109cdf0e10cSrcweir 
110cdf0e10cSrcweir     // data for bidi and glyph+script fallback
111cdf0e10cSrcweir     ImplLayoutRuns      maRuns;
112cdf0e10cSrcweir     ImplLayoutRuns      maReruns;
113cdf0e10cSrcweir 
114cdf0e10cSrcweir public:
115cdf0e10cSrcweir                 ImplLayoutArgs( const xub_Unicode* pStr, int nLength,
116cdf0e10cSrcweir                     int nMinCharPos, int nEndCharPos, int nFlags );
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     void        SetLayoutWidth( long nWidth )       { mnLayoutWidth = nWidth; }
119cdf0e10cSrcweir     void        SetDXArray( const sal_Int32* pDXArray )  { mpDXArray = pDXArray; }
120cdf0e10cSrcweir     void        SetOrientation( int nOrientation )  { mnOrientation = nOrientation; }
121cdf0e10cSrcweir 
122cdf0e10cSrcweir     void        ResetPos()
123cdf0e10cSrcweir                     { maRuns.ResetPos(); }
124cdf0e10cSrcweir     bool        GetNextPos( int* nCharPos, bool* bRTL )
125cdf0e10cSrcweir                     { return maRuns.GetNextPos( nCharPos, bRTL ); }
126cdf0e10cSrcweir     bool        GetNextRun( int* nMinRunPos, int* nEndRunPos, bool* bRTL );
127cdf0e10cSrcweir     bool        NeedFallback( int nCharPos, bool bRTL )
128cdf0e10cSrcweir                     { return maReruns.AddPos( nCharPos, bRTL ); }
129cdf0e10cSrcweir     bool        NeedFallback( int nMinRunPos, int nEndRunPos, bool bRTL )
130cdf0e10cSrcweir                     { return maReruns.AddRun( nMinRunPos, nEndRunPos, bRTL ); }
131cdf0e10cSrcweir     // methods used by BiDi and glyph fallback
132cdf0e10cSrcweir     bool        NeedFallback() const
133cdf0e10cSrcweir                     { return !maReruns.IsEmpty(); }
134cdf0e10cSrcweir     bool        PrepareFallback();
135cdf0e10cSrcweir 
136cdf0e10cSrcweir protected:
137cdf0e10cSrcweir     void        AddRun( int nMinCharPos, int nEndCharPos, bool bRTL );
138cdf0e10cSrcweir };
139cdf0e10cSrcweir 
140cdf0e10cSrcweir // helper functions often used with ImplLayoutArgs
141cdf0e10cSrcweir bool IsDiacritic( sal_UCS4 );
142cdf0e10cSrcweir int GetVerticalFlags( sal_UCS4 );
143cdf0e10cSrcweir sal_UCS4 GetVerticalChar( sal_UCS4 );
144cdf0e10cSrcweir // #i80090# GetMirroredChar also needed outside vcl, moved to svapp.hxx
145cdf0e10cSrcweir // VCL_DLLPUBLIC sal_UCS4 GetMirroredChar( sal_UCS4 );
146cdf0e10cSrcweir sal_UCS4 GetLocalizedChar( sal_UCS4, LanguageType );
147cdf0e10cSrcweir VCL_PLUGIN_PUBLIC const char* GetAutofallback( sal_UCS4 ) ;
148cdf0e10cSrcweir 
149cdf0e10cSrcweir // -------------
150cdf0e10cSrcweir // - SalLayout -
151cdf0e10cSrcweir // -------------
152cdf0e10cSrcweir 
153cdf0e10cSrcweir typedef sal_uInt32 sal_GlyphId;
154cdf0e10cSrcweir 
155cdf0e10cSrcweir // Glyph Flags
156cdf0e10cSrcweir #define GF_NONE     0x00000000
157cdf0e10cSrcweir #define GF_FLAGMASK 0xFF800000
158cdf0e10cSrcweir #define GF_IDXMASK  ~GF_FLAGMASK
159cdf0e10cSrcweir #define GF_ISCHAR   0x00800000
160cdf0e10cSrcweir #define GF_ROTL     0x01000000
161cdf0e10cSrcweir // caution !!!
162cdf0e10cSrcweir #define GF_VERT     0x02000000
163cdf0e10cSrcweir // GF_VERT is only for windows implementation
164cdf0e10cSrcweir // (win/source/gdi/salgdi3.cxx, win/source/gdi/winlayout.cxx)
165cdf0e10cSrcweir // don't use this elsewhere !!!
166cdf0e10cSrcweir #define GF_ROTR     0x03000000
167cdf0e10cSrcweir #define GF_ROTMASK  0x03000000
168cdf0e10cSrcweir #define GF_UNHINTED 0x04000000
169cdf0e10cSrcweir #define GF_GSUB     0x08000000
170cdf0e10cSrcweir #define GF_FONTMASK 0xF0000000
171cdf0e10cSrcweir #define GF_FONTSHIFT 28
172cdf0e10cSrcweir 
173cdf0e10cSrcweir #define GF_DROPPED  0xFFFFFFFF
174cdf0e10cSrcweir 
175cdf0e10cSrcweir // all positions/widths are in font units
176cdf0e10cSrcweir // one exception: drawposition is in pixel units
177cdf0e10cSrcweir 
178cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC SalLayout
179cdf0e10cSrcweir {
180cdf0e10cSrcweir public:
181cdf0e10cSrcweir     // used by upper layers
182cdf0e10cSrcweir     Point&          DrawBase()                              { return maDrawBase; }
183cdf0e10cSrcweir     const Point&    DrawBase() const                        { return maDrawBase; }
184cdf0e10cSrcweir     Point&          DrawOffset()                            { return maDrawOffset; }
185cdf0e10cSrcweir     const Point&    DrawOffset() const                      { return maDrawOffset; }
186cdf0e10cSrcweir     Point           GetDrawPosition( const Point& rRelative = Point(0,0) ) const;
187cdf0e10cSrcweir 
188cdf0e10cSrcweir     virtual bool    LayoutText( ImplLayoutArgs& ) = 0;  // first step of layouting
189cdf0e10cSrcweir     virtual void    AdjustLayout( ImplLayoutArgs& );    // adjusting after fallback etc.
190cdf0e10cSrcweir     virtual void    InitFont() const {}
191cdf0e10cSrcweir     virtual void    DrawText( SalGraphics& ) const = 0;
192cdf0e10cSrcweir 
193cdf0e10cSrcweir     int             GetUnitsPerPixel() const                { return mnUnitsPerPixel; }
194cdf0e10cSrcweir     int             GetOrientation() const                  { return mnOrientation; }
195cdf0e10cSrcweir 
196cdf0e10cSrcweir     virtual const ImplFontData* GetFallbackFontData( sal_GlyphId ) const;
197cdf0e10cSrcweir 
198cdf0e10cSrcweir     // methods using string indexing
199cdf0e10cSrcweir     virtual int     GetTextBreak( long nMaxWidth, long nCharExtra=0, int nFactor=1 ) const = 0;
200cdf0e10cSrcweir     virtual long    FillDXArray( sal_Int32* pDXArray ) const = 0;
201cdf0e10cSrcweir     virtual long    GetTextWidth() const { return FillDXArray( NULL ); }
202cdf0e10cSrcweir     virtual void    GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const = 0;
203cdf0e10cSrcweir     virtual bool    IsKashidaPosValid ( int /*nCharPos*/ ) const { return true; } // i60594
204cdf0e10cSrcweir 
205cdf0e10cSrcweir     // methods using glyph indexing
206cdf0e10cSrcweir     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdAry, Point& rPos, int&,
207cdf0e10cSrcweir                         sal_Int32* pGlyphAdvAry = NULL, int* pCharPosAry = NULL ) const = 0;
208cdf0e10cSrcweir     virtual bool    GetOutline( SalGraphics&, ::basegfx::B2DPolyPolygonVector& ) const;
209cdf0e10cSrcweir     virtual bool    GetBoundRect( SalGraphics&, Rectangle& ) const;
210cdf0e10cSrcweir 
211cdf0e10cSrcweir     virtual bool    IsSpacingGlyph( sal_GlyphId ) const;
212cdf0e10cSrcweir 
213cdf0e10cSrcweir     // reference counting
214cdf0e10cSrcweir     void            Reference() const;
215cdf0e10cSrcweir     void            Release() const;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir     // used by glyph+font+script fallback
218cdf0e10cSrcweir     virtual void    MoveGlyph( int nStart, long nNewXPos ) = 0;
219cdf0e10cSrcweir     virtual void    DropGlyph( int nStart ) = 0;
220cdf0e10cSrcweir     virtual void    Simplify( bool bIsBase ) = 0;
221cdf0e10cSrcweir     virtual void    DisableGlyphInjection( bool /*bDisable*/ ) {}
222cdf0e10cSrcweir 
223cdf0e10cSrcweir protected:
224cdf0e10cSrcweir     // used by layout engines
225cdf0e10cSrcweir                     SalLayout();
226cdf0e10cSrcweir     virtual         ~SalLayout();
227cdf0e10cSrcweir 
228cdf0e10cSrcweir     // used by layout layers
229cdf0e10cSrcweir     void            SetUnitsPerPixel( int n )               { mnUnitsPerPixel = n; }
230cdf0e10cSrcweir     void            SetOrientation( int nOrientation )      // in 0-3600 system
231cdf0e10cSrcweir                     { mnOrientation = nOrientation; }
232cdf0e10cSrcweir 
233cdf0e10cSrcweir     static int      CalcAsianKerning( sal_UCS4, bool bLeft, bool bVertical );
234cdf0e10cSrcweir 
235cdf0e10cSrcweir private:
236cdf0e10cSrcweir     // enforce proper copy semantic
237cdf0e10cSrcweir     SAL_DLLPRIVATE  SalLayout( const SalLayout& );
238cdf0e10cSrcweir     SAL_DLLPRIVATE  SalLayout& operator=( const SalLayout& );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir protected:
241cdf0e10cSrcweir     int             mnMinCharPos;
242cdf0e10cSrcweir     int             mnEndCharPos;
243cdf0e10cSrcweir     int             mnLayoutFlags;
244cdf0e10cSrcweir 
245cdf0e10cSrcweir     int             mnUnitsPerPixel;
246cdf0e10cSrcweir     int             mnOrientation;
247cdf0e10cSrcweir 
248cdf0e10cSrcweir     mutable int     mnRefCount;
249cdf0e10cSrcweir     mutable Point   maDrawOffset;
250cdf0e10cSrcweir     Point           maDrawBase;
251cdf0e10cSrcweir };
252cdf0e10cSrcweir 
253cdf0e10cSrcweir // ------------------
254cdf0e10cSrcweir // - MultiSalLayout -
255cdf0e10cSrcweir // ------------------
256cdf0e10cSrcweir 
257cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC MultiSalLayout : public SalLayout
258cdf0e10cSrcweir {
259cdf0e10cSrcweir public:
260cdf0e10cSrcweir     virtual void    DrawText( SalGraphics& ) const;
261cdf0e10cSrcweir     virtual int     GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const;
262cdf0e10cSrcweir     virtual long    FillDXArray( sal_Int32* pDXArray ) const;
263cdf0e10cSrcweir     virtual void    GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const;
264cdf0e10cSrcweir     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos,
265cdf0e10cSrcweir                         int&, sal_Int32* pGlyphAdvAry, int* pCharPosAry ) const;
266cdf0e10cSrcweir     virtual bool    GetOutline( SalGraphics&, ::basegfx::B2DPolyPolygonVector& ) const;
267cdf0e10cSrcweir     virtual bool    GetBoundRect( SalGraphics&, Rectangle& ) const;
268cdf0e10cSrcweir 
269cdf0e10cSrcweir     // used only by OutputDevice::ImplLayout, TODO: make friend
270cdf0e10cSrcweir     explicit        MultiSalLayout( SalLayout& rBaseLayout,
271cdf0e10cSrcweir                          const ImplFontData* pBaseFont = NULL );
272cdf0e10cSrcweir     virtual bool    AddFallback( SalLayout& rFallbackLayout,
273cdf0e10cSrcweir                          ImplLayoutRuns&, const ImplFontData* pFallbackFont );
274cdf0e10cSrcweir     virtual bool    LayoutText( ImplLayoutArgs& );
275cdf0e10cSrcweir     virtual void    AdjustLayout( ImplLayoutArgs& );
276cdf0e10cSrcweir     virtual void    InitFont() const;
277cdf0e10cSrcweir 
278cdf0e10cSrcweir     virtual const ImplFontData* GetFallbackFontData( sal_GlyphId ) const;
279cdf0e10cSrcweir 
280cdf0e10cSrcweir     void SetInComplete(bool bInComplete = true);
281cdf0e10cSrcweir 
282cdf0e10cSrcweir protected:
283cdf0e10cSrcweir     virtual         ~MultiSalLayout();
284cdf0e10cSrcweir 
285cdf0e10cSrcweir private:
286cdf0e10cSrcweir     // dummy implementations
287cdf0e10cSrcweir     virtual void    MoveGlyph( int, long ) {}
288cdf0e10cSrcweir     virtual void    DropGlyph( int ) {}
289cdf0e10cSrcweir     virtual void    Simplify( bool ) {}
290cdf0e10cSrcweir 
291cdf0e10cSrcweir     // enforce proper copy semantic
292cdf0e10cSrcweir     SAL_DLLPRIVATE  MultiSalLayout( const MultiSalLayout& );
293cdf0e10cSrcweir     SAL_DLLPRIVATE  MultiSalLayout& operator=( const MultiSalLayout& );
294cdf0e10cSrcweir 
295cdf0e10cSrcweir private:
296cdf0e10cSrcweir     SalLayout*      mpLayouts[ MAX_FALLBACK ];
297cdf0e10cSrcweir     const ImplFontData* mpFallbackFonts[ MAX_FALLBACK ];
298cdf0e10cSrcweir     ImplLayoutRuns  maFallbackRuns[ MAX_FALLBACK ];
299cdf0e10cSrcweir     int             mnLevel;
300cdf0e10cSrcweir     bool            mbInComplete;
301cdf0e10cSrcweir };
302cdf0e10cSrcweir 
303cdf0e10cSrcweir // --------------------
304cdf0e10cSrcweir // - GenericSalLayout -
305cdf0e10cSrcweir // --------------------
306cdf0e10cSrcweir 
307cdf0e10cSrcweir struct GlyphItem
308cdf0e10cSrcweir {
309cdf0e10cSrcweir     int     mnFlags;
310cdf0e10cSrcweir     int     mnCharPos;      // index in string
311cdf0e10cSrcweir     int     mnOrigWidth;    // original glyph width
312cdf0e10cSrcweir     int     mnNewWidth;     // width after adjustments
313cdf0e10cSrcweir     sal_GlyphId mnGlyphIndex;
314cdf0e10cSrcweir     Point   maLinearPos;    // absolute position of non rotated string
315cdf0e10cSrcweir 
316cdf0e10cSrcweir public:
317cdf0e10cSrcweir             GlyphItem() {}
318cdf0e10cSrcweir 
319cdf0e10cSrcweir             GlyphItem( int nCharPos, sal_GlyphId nGlyphIndex, const Point& rLinearPos,
320cdf0e10cSrcweir                 long nFlags, int nOrigWidth )
321cdf0e10cSrcweir             :   mnFlags(nFlags), mnCharPos(nCharPos),
322cdf0e10cSrcweir                 mnOrigWidth(nOrigWidth), mnNewWidth(nOrigWidth),
323cdf0e10cSrcweir                 mnGlyphIndex(nGlyphIndex), maLinearPos(rLinearPos)
324cdf0e10cSrcweir             {}
325cdf0e10cSrcweir 
326cdf0e10cSrcweir     enum{ FALLBACK_MASK=0xFF, IS_IN_CLUSTER=0x100, IS_RTL_GLYPH=0x200, IS_DIACRITIC=0x400 };
327cdf0e10cSrcweir 
328cdf0e10cSrcweir     bool    IsClusterStart() const	{ return ((mnFlags & IS_IN_CLUSTER) == 0); }
329cdf0e10cSrcweir     bool    IsRTLGlyph() const		{ return ((mnFlags & IS_RTL_GLYPH) != 0); }
330cdf0e10cSrcweir     bool    IsDiacritic() const		{ return ((mnFlags & IS_DIACRITIC) != 0); }
331cdf0e10cSrcweir };
332cdf0e10cSrcweir 
333cdf0e10cSrcweir // ---------------
334cdf0e10cSrcweir 
335cdf0e10cSrcweir typedef std::list<GlyphItem> GlyphList;
336cdf0e10cSrcweir typedef std::vector<GlyphItem> GlyphVector;
337cdf0e10cSrcweir 
338cdf0e10cSrcweir // ---------------
339cdf0e10cSrcweir 
340cdf0e10cSrcweir class VCL_PLUGIN_PUBLIC GenericSalLayout : public SalLayout
341cdf0e10cSrcweir {
342cdf0e10cSrcweir public:
343cdf0e10cSrcweir     // used by layout engines
344cdf0e10cSrcweir     void            AppendGlyph( const GlyphItem& );
345cdf0e10cSrcweir     virtual void    AdjustLayout( ImplLayoutArgs& );
346cdf0e10cSrcweir     virtual void    ApplyDXArray( ImplLayoutArgs& );
347cdf0e10cSrcweir     virtual void    Justify( long nNewWidth );
348cdf0e10cSrcweir     void            KashidaJustify( long nIndex, int nWidth );
349cdf0e10cSrcweir     void            ApplyAsianKerning( const sal_Unicode*, int nLength );
350cdf0e10cSrcweir     void            SortGlyphItems();
351cdf0e10cSrcweir 
352cdf0e10cSrcweir     // used by upper layers
353cdf0e10cSrcweir     virtual long    GetTextWidth() const;
354cdf0e10cSrcweir     virtual long    FillDXArray( sal_Int32* pDXArray ) const;
355cdf0e10cSrcweir     virtual int     GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const;
356cdf0e10cSrcweir     virtual void    GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const;
357cdf0e10cSrcweir 
358cdf0e10cSrcweir     // used by display layers
359cdf0e10cSrcweir     virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIdxAry, Point& rPos, int&,
360cdf0e10cSrcweir                         sal_Int32* pGlyphAdvAry = NULL, int* pCharPosAry = NULL ) const;
361cdf0e10cSrcweir 
362cdf0e10cSrcweir protected:
363cdf0e10cSrcweir                     GenericSalLayout();
364cdf0e10cSrcweir     virtual         ~GenericSalLayout();
365cdf0e10cSrcweir 
366cdf0e10cSrcweir     // for glyph+font+script fallback
367cdf0e10cSrcweir     virtual void    MoveGlyph( int nStart, long nNewXPos );
368cdf0e10cSrcweir     virtual void    DropGlyph( int nStart );
369cdf0e10cSrcweir     virtual void    Simplify( bool bIsBase );
370cdf0e10cSrcweir 
371cdf0e10cSrcweir     bool            GetCharWidths( sal_Int32* pCharWidths ) const;
372cdf0e10cSrcweir 
373cdf0e10cSrcweir private:
374cdf0e10cSrcweir     GlyphItem*      mpGlyphItems;   // TODO: change to GlyphList
375cdf0e10cSrcweir     int             mnGlyphCount;
376cdf0e10cSrcweir     int             mnGlyphCapacity;
377cdf0e10cSrcweir     mutable Point   maBasePoint;
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     // enforce proper copy semantic
380cdf0e10cSrcweir     SAL_DLLPRIVATE  GenericSalLayout( const GenericSalLayout& );
381cdf0e10cSrcweir     SAL_DLLPRIVATE  GenericSalLayout& operator=( const GenericSalLayout& );
382cdf0e10cSrcweir };
383cdf0e10cSrcweir 
384cdf0e10cSrcweir #undef SalGraphics
385cdf0e10cSrcweir 
386cdf0e10cSrcweir #endif // _SV_SALLAYOUT_HXX
387