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