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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sdext.hxx"
30 
31 #include "pdfiprocessor.hxx"
32 #include "xmlemitter.hxx"
33 #include "pdfihelper.hxx"
34 #include "imagecontainer.hxx"
35 #include "genericelements.hxx"
36 #include "style.hxx"
37 #include "treevisiting.hxx"
38 
39 #include <rtl/string.hxx>
40 #include <rtl/strbuf.hxx>
41 
42 #include <comphelper/sequence.hxx>
43 #include <basegfx/polygon/b2dpolypolygontools.hxx>
44 #include <basegfx/polygon/b2dpolygonclipper.hxx>
45 #include <basegfx/polygon/b2dpolygontools.hxx>
46 #include <basegfx/tools/canvastools.hxx>
47 #include <basegfx/matrix/b2dhommatrix.hxx>
48 #include <basegfx/range/b2irange.hxx>
49 #include <basegfx/range/b2drectangle.hxx>
50 #include <basegfx/matrix/b2dhommatrixtools.hxx>
51 
52 #include <com/sun/star/rendering/XVolatileBitmap.hpp>
53 #include <com/sun/star/geometry/RealSize2D.hpp>
54 #include <com/sun/star/geometry/RealPoint2D.hpp>
55 #include <com/sun/star/geometry/RealRectangle2D.hpp>
56 
57 
58 using namespace com::sun::star;
59 
60 
61 namespace pdfi
62 {
63 
64  PDFIProcessor::PDFIProcessor( const uno::Reference< task::XStatusIndicator >& xStat ,
65             com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >  xContext) :
66 
67     m_xContext(xContext),
68     fYPrevTextPosition(-10000.0),
69     fPrevTextHeight(0.0),
70     fXPrevTextPosition(0.0),
71     fPrevTextWidth(0.0),
72     m_pElFactory( new ElementFactory() ),
73     m_pDocument( m_pElFactory->createDocumentElement() ),
74     m_pCurPage(0),
75     m_pCurElement(0),
76     m_nNextFontId( 1 ),
77     m_aIdToFont(),
78     m_aFontToId(),
79     m_aGCStack(),
80     m_nNextGCId( 1 ),
81     m_aIdToGC(),
82     m_aGCToId(),
83     m_aImages(),
84     m_eTextDirection( LrTb ),
85     m_nPages(0),
86     m_nNextZOrder( 1 ),
87     m_fWordSpace(0.0),
88     m_bIsWhiteSpaceInLine( false ),
89     m_xStatusIndicator( xStat ),
90     m_bHaveTextOnDocLevel(false),
91     m_bMirrorMapperTried(false)
92 {
93     FontAttributes aDefFont;
94     aDefFont.familyName = USTR("Helvetica");
95     aDefFont.isBold     = false;
96     aDefFont.isItalic   = false;
97     aDefFont.size       = 10*PDFI_OUTDEV_RESOLUTION/72;
98     m_aIdToFont[ 0 ]    = aDefFont;
99     m_aFontToId[ aDefFont ] = 0;
100 
101     GraphicsContext aDefGC;
102     m_aGCStack.push_back( aDefGC );
103     m_aIdToGC[ 0 ] = aDefGC;
104     m_aGCToId[ aDefGC ] = 0;
105 }
106 
107 void PDFIProcessor::enableToplevelText()
108 {
109     m_bHaveTextOnDocLevel = true;
110 }
111 
112 void PDFIProcessor::setPageNum( sal_Int32 nPages )
113 {
114     m_nPages = nPages;
115 }
116 
117 
118 void PDFIProcessor::pushState()
119 {
120     m_aGCStack.push_back( m_aGCStack.back() );
121 }
122 
123 void PDFIProcessor::popState()
124 {
125     m_aGCStack.pop_back();
126 }
127 
128 void PDFIProcessor::setFlatness( double value )
129 {
130     getCurrentContext().Flatness = value;
131 }
132 
133 void PDFIProcessor::setTransformation( const geometry::AffineMatrix2D& rMatrix )
134 {
135     basegfx::unotools::homMatrixFromAffineMatrix(
136         getCurrentContext().Transformation,
137         rMatrix );
138 }
139 
140 void PDFIProcessor::setLineDash( const uno::Sequence<double>& dashes,
141                                  double                       /*start*/ )
142 {
143     // TODO(F2): factor in start offset
144     GraphicsContext& rContext( getCurrentContext() );
145     comphelper::sequenceToContainer(rContext.DashArray,dashes);
146 }
147 
148 void PDFIProcessor::setLineJoin(sal_Int8 nJoin)
149 {
150     getCurrentContext().LineJoin = nJoin;
151 }
152 
153 void PDFIProcessor::setLineCap(sal_Int8 nCap)
154 {
155     getCurrentContext().LineCap = nCap;
156 }
157 
158 void PDFIProcessor::setMiterLimit(double)
159 {
160     OSL_TRACE("PDFIProcessor::setMiterLimit(): not supported by ODF");
161 }
162 
163 void PDFIProcessor::setLineWidth(double nWidth)
164 {
165     getCurrentContext().LineWidth = nWidth;
166 }
167 
168 void PDFIProcessor::setFillColor( const rendering::ARGBColor& rColor )
169 {
170     getCurrentContext().FillColor = rColor;
171 }
172 
173 void PDFIProcessor::setStrokeColor( const rendering::ARGBColor& rColor )
174 {
175     getCurrentContext().LineColor = rColor;
176 }
177 
178 void PDFIProcessor::setBlendMode(sal_Int8)
179 {
180     OSL_TRACE("PDFIProcessor::setBlendMode(): not supported by ODF");
181 }
182 
183 void PDFIProcessor::setFont( const FontAttributes& i_rFont )
184 {
185     FontAttributes aChangedFont( i_rFont );
186     GraphicsContext& rGC=getCurrentContext();
187     // for text render modes, please see PDF reference manual
188     aChangedFont.isOutline = ( (rGC.TextRenderMode == 1) || (rGC. TextRenderMode == 2) );
189     FontToIdMap::const_iterator it = m_aFontToId.find( aChangedFont );
190     if( it != m_aFontToId.end() )
191 		rGC.FontId = it->second;
192     else
193     {
194         m_aFontToId[ aChangedFont ] = m_nNextFontId;
195         m_aIdToFont[ m_nNextFontId ] = aChangedFont;
196         rGC.FontId = m_nNextFontId;
197         m_nNextFontId++;
198     }
199 }
200 
201 void PDFIProcessor::setTextRenderMode( sal_Int32 i_nMode )
202 {
203     GraphicsContext& rGC=getCurrentContext();
204     rGC.TextRenderMode = i_nMode;
205     IdToFontMap::iterator it = m_aIdToFont.find( rGC.FontId );
206     if( it != m_aIdToFont.end() )
207         setFont( it->second );
208 }
209 
210 sal_Int32 PDFIProcessor::getFontId( const FontAttributes& rAttr ) const
211 {
212     const sal_Int32 nCurFont = getCurrentContext().FontId;
213     const_cast<PDFIProcessor*>(this)->setFont( rAttr );
214     const sal_Int32 nFont = getCurrentContext().FontId;
215     const_cast<PDFIProcessor*>(this)->getCurrentContext().FontId = nCurFont;
216 
217     return nFont;
218 }
219 
220 // line diagnose block - start
221 void PDFIProcessor::processGlyphLine()
222 {
223 	if( m_GlyphsList.size()<1 )
224 		return;
225 
226     double fPreAvarageSpaceValue= 0.0;
227     double fAvarageDiffCharSpaceValue= 0.0;
228     double fMinPreSpaceValue= 0.0;
229     double fMaxPreSpaceValue= 0.0;
230     double fNullSpaceBreakerAvaregeSpaceValue = 0.0;
231 
232     unsigned int    nSpaceCount( 0 );
233     unsigned int    nDiffSpaceCount( 0 );
234     unsigned int    nNullSpaceBreakerCount=0;
235     bool preSpaceNull(true);
236 
237     for ( unsigned int i=0; i<m_GlyphsList.size()-1; i++ ) // i=1 because the first glyph doesn't have a prevGlyphSpace value
238     {
239         if( m_GlyphsList[i].getPrevGlyphsSpace()>0.0 )
240         {
241            if( fMinPreSpaceValue>m_GlyphsList[i].getPrevGlyphsSpace() )
242                fMinPreSpaceValue=m_GlyphsList[i].getPrevGlyphsSpace();
243 
244            if( fMaxPreSpaceValue<m_GlyphsList[i].getPrevGlyphsSpace() )
245                fMaxPreSpaceValue=m_GlyphsList[i].getPrevGlyphsSpace();
246 
247            fPreAvarageSpaceValue+= m_GlyphsList[i].getPrevGlyphsSpace();
248            nSpaceCount++;
249         }
250     }
251 
252     if( nSpaceCount!=0 )
253      fPreAvarageSpaceValue= fPreAvarageSpaceValue/( nSpaceCount );
254 
255     for ( unsigned int i=0; i<m_GlyphsList.size()-1; i++ ) // i=1 because the first glyph doesn't have a prevGlyphSpace value
256     {
257        if ( m_GlyphsList[i].getPrevGlyphsSpace()==0.0 )
258        {
259             if (
260                  ( m_GlyphsList[i+1].getPrevGlyphsSpace()>0.0)&&
261                  ( fPreAvarageSpaceValue>m_GlyphsList[i+1].getPrevGlyphsSpace())
262                )
263             {
264               fNullSpaceBreakerAvaregeSpaceValue+=m_GlyphsList[i+1].getPrevGlyphsSpace();
265               nNullSpaceBreakerCount++;
266             }
267         }
268     }
269 
270     if( ( fNullSpaceBreakerAvaregeSpaceValue!= 0.0 )&&
271         ( fNullSpaceBreakerAvaregeSpaceValue < fPreAvarageSpaceValue )
272       )
273     {
274         fPreAvarageSpaceValue = fNullSpaceBreakerAvaregeSpaceValue;
275     }
276 
277     for ( unsigned int i=0; i<m_GlyphsList.size()-1; i++ ) // i=1 cose the first Glypth dont have prevGlyphSpace value
278     {
279         if  ( ( m_GlyphsList[i].getPrevGlyphsSpace()>0.0 )
280             )
281         {
282           if (
283               ( m_GlyphsList[i].getPrevGlyphsSpace()  <= fPreAvarageSpaceValue )&&
284               ( m_GlyphsList[i+1].getPrevGlyphsSpace()<= fPreAvarageSpaceValue )
285              )
286           {
287                double temp= m_GlyphsList[i].getPrevGlyphsSpace()-m_GlyphsList[i+1].getPrevGlyphsSpace();
288 
289                if(temp!=0.0)
290                {
291                  if( temp< 0.0)
292                   temp= temp* -1.0;
293 
294                  fAvarageDiffCharSpaceValue+=temp;
295                  nDiffSpaceCount++;
296                }
297           }
298         }
299 
300     }
301 
302     if (
303          ( nNullSpaceBreakerCount>0 )
304        )
305     {
306        fNullSpaceBreakerAvaregeSpaceValue=fNullSpaceBreakerAvaregeSpaceValue/nNullSpaceBreakerCount;
307     }
308 
309     if (
310          ( nDiffSpaceCount>0 )&&(fAvarageDiffCharSpaceValue>0)
311        )
312     {
313         fAvarageDiffCharSpaceValue= fAvarageDiffCharSpaceValue/ nDiffSpaceCount;
314     }
315 
316     ParagraphElement* pPara= NULL ;
317     FrameElement* pFrame= NULL ;
318 
319 	if(m_GlyphsList.size()>0)
320 	{
321 		pFrame = m_pElFactory->createFrameElement( m_GlyphsList[0].getCurElement(), getGCId( getTransformGlyphContext( m_GlyphsList[0])) );
322 		pFrame->ZOrder = m_nNextZOrder++;
323 		pPara = m_pElFactory->createParagraphElement( pFrame );
324 
325 
326 
327         processGlyph( 0,
328                   m_GlyphsList[0],
329                   pPara,
330                   pFrame,
331                   m_bIsWhiteSpaceInLine );
332 
333 
334     }
335 
336 
337     preSpaceNull=false;
338 
339     for ( unsigned int i=1; i<m_GlyphsList.size()-1; i++ )
340     {
341         double fPrevDiffCharSpace= m_GlyphsList[i].getPrevGlyphsSpace()-m_GlyphsList[i-1].getPrevGlyphsSpace();
342         double fPostDiffCharSpace= m_GlyphsList[i].getPrevGlyphsSpace()-m_GlyphsList[i+1].getPrevGlyphsSpace();
343 
344 
345          if(
346              preSpaceNull && (m_GlyphsList[i].getPrevGlyphsSpace()!= 0.0)
347             )
348          {
349                preSpaceNull=false;
350               if( fNullSpaceBreakerAvaregeSpaceValue > m_GlyphsList[i].getPrevGlyphsSpace() )
351 			  {
352                 processGlyph( 0,
353                                       m_GlyphsList[i],
354                               pPara,
355                               pFrame,
356                               m_bIsWhiteSpaceInLine );
357 
358 			  }
359 			  else
360 			  {
361                 processGlyph( 1,
362                               m_GlyphsList[i],
363                               pPara,
364                               pFrame,
365                               m_bIsWhiteSpaceInLine );
366 
367 			  }
368 
369          }
370          else
371          {
372             if (
373                 ( ( m_GlyphsList[i].getPrevGlyphsSpace()<= fPreAvarageSpaceValue )&&
374                   ( fPrevDiffCharSpace<=fAvarageDiffCharSpaceValue )&&
375                   ( fPostDiffCharSpace<=fAvarageDiffCharSpaceValue )
376                 ) ||
377                 ( m_GlyphsList[i].getPrevGlyphsSpace() == 0.0 )
378             )
379             {
380                 preSpaceNull=true;
381 
382             processGlyph( 0,
383                         m_GlyphsList[i],
384                         pPara,
385                         pFrame,
386                         m_bIsWhiteSpaceInLine );
387 
388             }
389             else
390             {
391                 processGlyph( 1,
392                         m_GlyphsList[i],
393                         pPara,
394                         pFrame,
395                         m_bIsWhiteSpaceInLine );
396 
397             }
398 
399          }
400 
401     }
402 
403     if(m_GlyphsList.size()>1)
404      processGlyph( 0,
405                   m_GlyphsList[m_GlyphsList.size()-1],
406                   pPara,
407                   pFrame,
408                   m_bIsWhiteSpaceInLine );
409 
410     m_GlyphsList.clear();
411 }
412 
413 void PDFIProcessor::processGlyph( double       fPreAvarageSpaceValue,
414                                   CharGlyph&   aGlyph,
415                                   ParagraphElement* pPara,
416                                   FrameElement* pFrame,
417                                   bool         bIsWhiteSpaceInLine
418                                       )
419 {
420     if( !bIsWhiteSpaceInLine )
421     {
422         bool flag=( 0 < fPreAvarageSpaceValue );
423 
424         drawCharGlyphs(  aGlyph.getGlyph(),
425                          aGlyph.getRect(),
426                          aGlyph.getFontMatrix(),
427                          aGlyph.getGC(),
428                          aGlyph.getCurElement(),
429                          pPara,
430                          pFrame,
431                          flag);
432     }
433     else
434     {
435         drawCharGlyphs( aGlyph.getGlyph(),
436                         aGlyph.getRect(),
437                         aGlyph.getFontMatrix(),
438                         aGlyph.getGC(),
439                         aGlyph.getCurElement(),
440                         pPara,
441                         pFrame,
442                         false );
443     }
444 }
445 
446 void PDFIProcessor::drawGlyphLine( const rtl::OUString&             rGlyphs,
447                                    const geometry::RealRectangle2D& rRect,
448                                    const geometry::Matrix2D&        rFontMatrix )
449 {
450     double isFirstLine= fYPrevTextPosition+ fXPrevTextPosition+ fPrevTextHeight+ fPrevTextWidth ;
451     if(
452         (  ( ( fYPrevTextPosition!= rRect.Y1 ) ) ||
453            ( ( fXPrevTextPosition > rRect.X2 ) ) ||
454            ( ( fXPrevTextPosition+fPrevTextWidth*1.3)<rRect.X1 )
455         )  && ( isFirstLine> 0.0 )
456     )
457     {
458         processGlyphLine();
459     }
460 
461     CharGlyph aGlyph;
462 
463     aGlyph.setGlyph ( rGlyphs );
464     aGlyph.setRect  ( rRect );
465     aGlyph.setFontMatrix ( rFontMatrix );
466     aGlyph.setGraphicsContext ( getCurrentContext() );
467     getGCId(getCurrentContext());
468     aGlyph.setCurElement( m_pCurElement );
469 
470     aGlyph.setYPrevGlyphPosition( fYPrevTextPosition );
471     aGlyph.setXPrevGlyphPosition( fXPrevTextPosition );
472     aGlyph.setPrevGlyphHeight  ( fPrevTextHeight );
473     aGlyph.setPrevGlyphWidth   ( fPrevTextWidth );
474 
475     m_GlyphsList.push_back( aGlyph );
476 
477     fYPrevTextPosition  = rRect.Y1;
478     fXPrevTextPosition  = rRect.X2;
479     fPrevTextHeight     = rRect.Y2-rRect.Y1;
480     fPrevTextWidth      = rRect.X2-rRect.X1;
481 
482     if( !m_bIsWhiteSpaceInLine )
483     {
484         static rtl::OUString tempWhiteSpaceStr( 0x20 );
485         static rtl::OUString tempWhiteSpaceNonBreakingStr( 0xa0 );
486         m_bIsWhiteSpaceInLine=(rGlyphs.equals( tempWhiteSpaceStr ) || rGlyphs.equals( tempWhiteSpaceNonBreakingStr ));
487     }
488 }
489 
490 GraphicsContext& PDFIProcessor::getTransformGlyphContext( CharGlyph& rGlyph )
491 {
492     geometry::RealRectangle2D   rRect = rGlyph.getRect();
493     geometry::Matrix2D          rFontMatrix = rGlyph.getFontMatrix();
494 
495     rtl::OUString tempStr( 32 );
496     geometry::RealRectangle2D aRect(rRect);
497 
498     basegfx::B2DHomMatrix aFontMatrix;
499     basegfx::unotools::homMatrixFromMatrix(
500         aFontMatrix,
501         rFontMatrix );
502 
503     FontAttributes aFontAttrs = m_aIdToFont[ rGlyph.getGC().FontId ];
504 
505     // add transformation to GC
506     basegfx::B2DHomMatrix aFontTransform(basegfx::tools::createTranslateB2DHomMatrix(-rRect.X1, -rRect.Y1));
507     aFontTransform *= aFontMatrix;
508     aFontTransform.translate( rRect.X1, rRect.Y1 );
509 
510 
511     rGlyph.getGC().Transformation = rGlyph.getGC().Transformation * aFontTransform;
512     getGCId(rGlyph.getGC());
513 
514   return rGlyph.getGC();
515 }
516 void PDFIProcessor::drawCharGlyphs( rtl::OUString&             rGlyphs,
517                                     geometry::RealRectangle2D& rRect,
518                                     geometry::Matrix2D&         ,
519                                     GraphicsContext aGC,
520                                     Element*  ,
521                                     ParagraphElement* pPara,
522                                     FrameElement* pFrame,
523                                     bool bSpaceFlag )
524 {
525 
526 
527     rtl::OUString tempStr( 32 );
528     geometry::RealRectangle2D aRect(rRect);
529 
530     ::basegfx::B2DRange aRect2;
531     calcTransformedRectBounds( aRect2,
532                                               ::basegfx::unotools::b2DRectangleFromRealRectangle2D(aRect),
533                                               aGC.Transformation );
534    // check whether there was a previous draw frame
535 
536     TextElement* pText = m_pElFactory->createTextElement( pPara,
537                                                           getGCId(aGC),
538                                                           aGC.FontId );
539     if( bSpaceFlag )
540         pText->Text.append( tempStr );
541 
542 	pText->Text.append( rGlyphs );
543 
544     pText->x = aRect2.getMinX() ;
545     pText->y = aRect2.getMinY() ;
546     pText->w = 0.0;  // ToDO P2: 1.1 is a hack for solving of size auto-grow problem
547     pText->h = aRect2.getHeight(); // ToDO P2: 1.1 is a hack for solving of size auto-grow problem
548 
549     pPara->updateGeometryWith( pText );
550 
551     if( pFrame )
552       pFrame->updateGeometryWith( pPara );
553 
554 }
555 void PDFIProcessor::drawGlyphs( const rtl::OUString&             rGlyphs,
556                                 const geometry::RealRectangle2D& rRect,
557                                 const geometry::Matrix2D&        rFontMatrix )
558 {
559      drawGlyphLine( rGlyphs, rRect, rFontMatrix );
560 }
561 
562 void PDFIProcessor::endText()
563 {
564     TextElement* pText = dynamic_cast<TextElement*>(m_pCurElement);
565     if( pText )
566         m_pCurElement = pText->Parent;
567 }
568 
569 void PDFIProcessor::setupImage(ImageId nImage)
570 {
571     const GraphicsContext& rGC( getCurrentContext() );
572 
573     basegfx::B2DHomMatrix aTrans( rGC.Transformation );
574 
575     // check for rotation, which is the other way around in ODF
576     basegfx::B2DTuple aScale, aTranslation;
577     double fRotate, fShearX;
578     rGC.Transformation.decompose( aScale, aTranslation, fRotate, fShearX );
579     // TODDO(F4): correcting rotation when fShearX != 0 ?
580     if( fRotate != 0.0 )
581     {
582 
583         // try to create a Transformation that corrects for the wrong rotation
584         aTrans.identity();
585         aTrans.scale( aScale.getX(), aScale.getY() );
586         aTrans.rotate( -fRotate );
587 
588         basegfx::B2DRange aRect( 0, 0, 1, 1 );
589         aRect.transform( aTrans );
590 
591         // TODO(F3) treat translation correctly
592         // the corrections below work for multiples of 90 degree
593         // which is a common case (landscape/portrait/seascape)
594         // we need a general solution here; however this needs to
595         // work in sync with DrawXmlEmitter::fillFrameProps and WriterXmlEmitter::fillFrameProps
596         // admittedly this is a lame workaround and fails for arbitrary rotation
597         double fQuadrant = fmod( fRotate, 2.0*M_PI ) / M_PI_2;
598         int nQuadrant = (int)fQuadrant;
599         if( nQuadrant < 0 )
600             nQuadrant += 4;
601         if( nQuadrant == 1 )
602         {
603             aTranslation.setX( aTranslation.getX() + aRect.getHeight() + aRect.getWidth());
604             aTranslation.setY( aTranslation.getY() + aRect.getHeight() );
605         }
606         if( nQuadrant == 3 )
607             aTranslation.setX( aTranslation.getX() - aRect.getHeight() );
608 
609         aTrans.translate( aTranslation.getX(),
610                           aTranslation.getY() );
611     }
612 
613     bool bMirrorVertical = aScale.getY() > 0;
614 
615     // transform unit rect to determine view box
616     basegfx::B2DRange aRect( 0, 0, 1, 1 );
617     aRect.transform( aTrans );
618 
619     // TODO(F3): Handle clip
620     const sal_Int32 nGCId = getGCId(rGC);
621     FrameElement* pFrame = m_pElFactory->createFrameElement( m_pCurElement, nGCId );
622     ImageElement* pImageElement = m_pElFactory->createImageElement( pFrame, nGCId, nImage );
623     pFrame->x = pImageElement->x = aRect.getMinX();
624     pFrame->y = pImageElement->y = aRect.getMinY();
625     pFrame->w = pImageElement->w = aRect.getWidth();
626     pFrame->h = pImageElement->h = aRect.getHeight();
627     pFrame->ZOrder = m_nNextZOrder++;
628 
629     if( bMirrorVertical )
630     {
631         pFrame->MirrorVertical = pImageElement->MirrorVertical = true;
632         pFrame->x        += aRect.getWidth();
633         pImageElement->x += aRect.getWidth();
634         pFrame->y        += aRect.getHeight();
635         pImageElement->y += aRect.getHeight();
636     }
637 }
638 
639 void PDFIProcessor::drawMask(const uno::Sequence<beans::PropertyValue>& xBitmap,
640                              bool                                       /*bInvert*/ )
641 {
642     // TODO(F3): Handle mask and inversion
643     setupImage( m_aImages.addImage(xBitmap) );
644 }
645 
646 void PDFIProcessor::drawImage(const uno::Sequence<beans::PropertyValue>& xBitmap )
647 {
648     setupImage( m_aImages.addImage(xBitmap) );
649 }
650 
651 void PDFIProcessor::drawColorMaskedImage(const uno::Sequence<beans::PropertyValue>& xBitmap,
652                                          const uno::Sequence<uno::Any>&             /*xMaskColors*/ )
653 {
654     // TODO(F3): Handle mask colors
655     setupImage( m_aImages.addImage(xBitmap) );
656 }
657 
658 void PDFIProcessor::drawMaskedImage(const uno::Sequence<beans::PropertyValue>& xBitmap,
659                                     const uno::Sequence<beans::PropertyValue>& /*xMask*/,
660                                     bool                                       /*bInvertMask*/)
661 {
662     // TODO(F3): Handle mask and inversion
663     setupImage( m_aImages.addImage(xBitmap) );
664 }
665 
666 void PDFIProcessor::drawAlphaMaskedImage(const uno::Sequence<beans::PropertyValue>& xBitmap,
667                                          const uno::Sequence<beans::PropertyValue>& /*xMask*/)
668 {
669     // TODO(F3): Handle mask
670 
671     setupImage( m_aImages.addImage(xBitmap) );
672 
673 }
674 
675 void PDFIProcessor::strokePath( const uno::Reference< rendering::XPolyPolygon2D >& rPath )
676 {
677     basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
678     aPoly.transform(getCurrentContext().Transformation);
679 
680     PolyPolyElement* pPoly = m_pElFactory->createPolyPolyElement(
681         m_pCurElement,
682         getGCId(getCurrentContext()),
683         aPoly,
684         PATH_STROKE );
685     pPoly->updateGeometry();
686     pPoly->ZOrder = m_nNextZOrder++;
687 }
688 
689 void PDFIProcessor::fillPath( const uno::Reference< rendering::XPolyPolygon2D >& rPath )
690 {
691     basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
692     aPoly.transform(getCurrentContext().Transformation);
693 
694     PolyPolyElement* pPoly = m_pElFactory->createPolyPolyElement(
695         m_pCurElement,
696         getGCId(getCurrentContext()),
697         aPoly,
698         PATH_FILL );
699     pPoly->updateGeometry();
700     pPoly->ZOrder = m_nNextZOrder++;
701 }
702 
703 void PDFIProcessor::eoFillPath( const uno::Reference< rendering::XPolyPolygon2D >& rPath )
704 {
705     basegfx::B2DPolyPolygon aPoly=basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
706     aPoly.transform(getCurrentContext().Transformation);
707 
708     PolyPolyElement* pPoly = m_pElFactory->createPolyPolyElement(
709         m_pCurElement,
710         getGCId(getCurrentContext()),
711         aPoly,
712         PATH_EOFILL );
713     pPoly->updateGeometry();
714     pPoly->ZOrder = m_nNextZOrder++;
715 }
716 
717 void PDFIProcessor::intersectClip(const uno::Reference< rendering::XPolyPolygon2D >& rPath)
718 {
719     // TODO(F3): interpret fill mode
720     basegfx::B2DPolyPolygon aNewClip = basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
721     aNewClip.transform(getCurrentContext().Transformation);
722     basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip;
723 
724     if( aCurClip.count() )  // #i92985# adapted API from (..., false, false) to (..., true, false)
725         aNewClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( aCurClip, aNewClip, true, false );
726 
727     getCurrentContext().Clip = aNewClip;
728 }
729 
730 void PDFIProcessor::intersectEoClip(const uno::Reference< rendering::XPolyPolygon2D >& rPath)
731 {
732     // TODO(F3): interpret fill mode
733     basegfx::B2DPolyPolygon aNewClip = basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(rPath);
734     aNewClip.transform(getCurrentContext().Transformation);
735     basegfx::B2DPolyPolygon aCurClip = getCurrentContext().Clip;
736 
737     if( aCurClip.count() )  // #i92985# adapted API from (..., false, false) to (..., true, false)
738         aNewClip = basegfx::tools::clipPolyPolygonOnPolyPolygon( aCurClip, aNewClip, true, false );
739 
740     getCurrentContext().Clip = aNewClip;
741 }
742 
743 void PDFIProcessor::hyperLink( const geometry::RealRectangle2D& rBounds,
744                                const ::rtl::OUString&           rURI )
745 {
746     if( rURI.getLength() )
747     {
748         HyperlinkElement* pLink = m_pElFactory->createHyperlinkElement(
749             &m_pCurPage->Hyperlinks,
750             rURI );
751         pLink->x = rBounds.X1;
752         pLink->y = rBounds.Y1;
753         pLink->w = rBounds.X2-rBounds.X1;
754         pLink->h = rBounds.Y2-rBounds.Y1;
755     }
756 }
757 
758 const FontAttributes& PDFIProcessor::getFont( sal_Int32 nFontId ) const
759 {
760     IdToFontMap::const_iterator it = m_aIdToFont.find( nFontId );
761     if( it == m_aIdToFont.end() )
762         it = m_aIdToFont.find( 0 );
763     return it->second;
764 }
765 
766 sal_Int32 PDFIProcessor::getGCId( const GraphicsContext& rGC )
767 {
768     sal_Int32 nGCId = 0;
769     GCToIdMap::const_iterator it = m_aGCToId.find( rGC );
770     if( it != m_aGCToId.end() )
771         nGCId = it->second;
772     else
773     {
774         m_aGCToId[ rGC ] = m_nNextGCId;
775         m_aIdToGC[ m_nNextGCId ] = rGC;
776         nGCId = m_nNextGCId;
777         m_nNextGCId++;
778     }
779 
780     return nGCId;
781 }
782 
783 const GraphicsContext& PDFIProcessor::getGraphicsContext( sal_Int32 nGCId ) const
784 {
785     IdToGCMap::const_iterator it = m_aIdToGC.find( nGCId );
786     if( it == m_aIdToGC.end() )
787         it = m_aIdToGC.find( 0 );
788     return it->second;
789 }
790 
791 void PDFIProcessor::endPage()
792 {
793 	processGlyphLine(); // draw last line
794     if( m_xStatusIndicator.is()
795         && m_pCurPage
796         && m_pCurPage->PageNumber == m_nPages
797     )
798         m_xStatusIndicator->end();
799 }
800 
801 void PDFIProcessor::startPage( const geometry::RealSize2D& rSize )
802 {
803     // initial clip is to page bounds
804     getCurrentContext().Clip = basegfx::B2DPolyPolygon(
805         basegfx::tools::createPolygonFromRect(
806             basegfx::B2DRange( 0, 0, rSize.Width, rSize.Height )));
807 
808     sal_Int32 nNextPageNr = m_pCurPage ? m_pCurPage->PageNumber+1 : 1;
809     if( m_xStatusIndicator.is() )
810     {
811         if( nNextPageNr == 1 )
812             startIndicator( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
813         m_xStatusIndicator->setValue( nNextPageNr );
814     }
815     m_pCurPage = m_pElFactory->createPageElement(m_pDocument.get(), nNextPageNr);
816     m_pCurElement = m_pCurPage;
817     m_pCurPage->w = rSize.Width;
818     m_pCurPage->h = rSize.Height;
819     m_nNextZOrder = 1;
820 
821 
822 }
823 
824 void PDFIProcessor::emit( XmlEmitter&               rEmitter,
825                           const TreeVisitorFactory& rVisitorFactory )
826 {
827 #if OSL_DEBUG_LEVEL > 1
828     m_pDocument->emitStructure( 0 );
829 #endif
830 
831     ElementTreeVisitorSharedPtr optimizingVisitor(
832         rVisitorFactory.createOptimizingVisitor(*this));
833     // FIXME: localization
834     startIndicator( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
835     m_pDocument->visitedBy( *optimizingVisitor, std::list<Element*>::iterator());
836 
837 #if OSL_DEBUG_LEVEL > 1
838     m_pDocument->emitStructure( 0 );
839 #endif
840 
841     // get styles
842     StyleContainer aStyles;
843     ElementTreeVisitorSharedPtr finalizingVisitor(
844         rVisitorFactory.createStyleCollectingVisitor(aStyles,*this));
845     // FIXME: localization
846 
847     m_pDocument->visitedBy( *finalizingVisitor, std::list<Element*>::iterator() );
848 
849     EmitContext aContext( rEmitter, aStyles, m_aImages, *this, m_xStatusIndicator, m_xContext );
850     ElementTreeVisitorSharedPtr aEmittingVisitor(
851         rVisitorFactory.createEmittingVisitor(aContext, *this));
852 
853     PropertyMap aProps;
854     // document prolog
855     #define OASIS_STR "urn:oasis:names:tc:opendocument:xmlns:"
856     aProps[ USTR( "xmlns:office" ) ]      = USTR( OASIS_STR "office:1.0" );
857     aProps[ USTR( "xmlns:style" ) ]       = USTR( OASIS_STR "style:1.0" );
858     aProps[ USTR( "xmlns:text" ) ]        = USTR( OASIS_STR "text:1.0" );
859     aProps[ USTR( "xmlns:svg" ) ]         = USTR( OASIS_STR "svg-compatible:1.0" );
860     aProps[ USTR( "xmlns:table" ) ]       = USTR( OASIS_STR "table:1.0" );
861     aProps[ USTR( "xmlns:draw" ) ]        = USTR( OASIS_STR "drawing:1.0" );
862     aProps[ USTR( "xmlns:fo" ) ]          = USTR( OASIS_STR "xsl-fo-compatible:1.0" );
863     aProps[ USTR( "xmlns:xlink" )]        = USTR( "http://www.w3.org/1999/xlink" );
864     aProps[ USTR( "xmlns:dc" )]           = USTR( "http://purl.org/dc/elements/1.1/" );
865     aProps[ USTR( "xmlns:number" )]       = USTR( OASIS_STR "datastyle:1.0" );
866     aProps[ USTR( "xmlns:presentation" )] = USTR( OASIS_STR "presentation:1.0" );
867     aProps[ USTR( "xmlns:math" )]         = USTR( "http://www.w3.org/1998/Math/MathML" );
868     aProps[ USTR( "xmlns:form" )]         = USTR( OASIS_STR "form:1.0" );
869     aProps[ USTR( "xmlns:script" )]       = USTR( OASIS_STR "script:1.0" );
870     aProps[ USTR( "xmlns:dom" )]          = USTR( "http://www.w3.org/2001/xml-events" );
871     aProps[ USTR( "xmlns:xforms" )]       = USTR( "http://www.w3.org/2002/xforms" );
872     aProps[ USTR( "xmlns:xsd" )]          = USTR( "http://www.w3.org/2001/XMLSchema" );
873     aProps[ USTR( "xmlns:xsi" )]          = USTR( "http://www.w3.org/2001/XMLSchema-instance" );
874     aProps[ USTR( "office:version" ) ]    = USTR( "1.0" );
875     aProps[ USTR( "office:version" ) ]    = USTR( "1.0" );
876 
877     aContext.rEmitter.beginTag( "office:document", aProps );
878 
879     // emit style list
880     aStyles.emit( aContext, *aEmittingVisitor );
881 
882     m_pDocument->visitedBy( *aEmittingVisitor, std::list<Element*>::iterator() );
883     aContext.rEmitter.endTag( "office:document" );
884     endIndicator();
885 }
886 
887 void PDFIProcessor::startIndicator( const rtl::OUString& rText, sal_Int32 nElements )
888 {
889     if( nElements == -1 )
890         nElements = m_nPages;
891     if( m_xStatusIndicator.is() )
892     {
893         sal_Int32 nUnicodes = rText.getLength();
894         rtl::OUStringBuffer aStr( nUnicodes*2 );
895         const sal_Unicode* pText = rText.getStr();
896         for( int i = 0; i < nUnicodes; i++ )
897         {
898             if( nUnicodes-i > 1&&
899                 pText[i]   == '%' &&
900                 pText[i+1] == 'd'
901             )
902             {
903                 aStr.append( nElements );
904                 i++;
905             }
906             else
907                 aStr.append( pText[i] );
908         }
909         m_xStatusIndicator->start( aStr.makeStringAndClear(), nElements );
910     }
911 }
912 
913 void PDFIProcessor::endIndicator()
914 {
915     if( m_xStatusIndicator.is() )
916         m_xStatusIndicator->end();
917 }
918 
919 void PDFIProcessor::sortDocument( bool bDeep )
920 {
921     for( std::list< Element* >::iterator it = m_pDocument->Children.begin();
922          it != m_pDocument->Children.end(); ++it )
923     {
924         if( dynamic_cast<PageElement*>(*it) != NULL )
925             sortElements( *it, bDeep );
926     }
927 }
928 
929 static bool lr_tb_sort( Element* pLeft, Element* pRight )
930 {
931     // first: top-bottom sorting
932 
933     // Note: allow for 10% overlap on text lines since text lines are usually
934     // of the same order as font height whereas the real paint area
935     // of text is usually smaller
936     double fudge_factor = 1.0;
937     if( dynamic_cast< TextElement* >(pLeft) || dynamic_cast< TextElement* >(pRight) )
938         fudge_factor = 0.9;
939 
940     // if left's lower boundary is above right's upper boundary
941     // then left is smaller
942     if( pLeft->y+pLeft->h*fudge_factor < pRight->y )
943         return true;
944     // if right's lower boundary is above left's upper boundary
945     // then left is definitely not smaller
946     if( pRight->y+pRight->h*fudge_factor < pLeft->y )
947         return false;
948 
949     // by now we have established that left and right are inside
950     // a "line", that is they have vertical overlap
951     // second: left-right sorting
952     // if left's right boundary is left to right's left boundary
953     // then left is smaller
954     if( pLeft->x+pLeft->w < pRight->x )
955         return true;
956     // if right's right boundary is left to left's left boundary
957     // then left is definitely not smaller
958     if( pRight->x+pRight->w < pLeft->x )
959         return false;
960 
961     // here we have established vertical and horizontal overlap
962     // so sort left first, top second
963     if( pLeft->x < pRight->x )
964         return true;
965     if( pRight->x < pLeft->x )
966         return false;
967     if( pLeft->y < pRight->y )
968         return true;
969 
970     return false;
971 }
972 
973 void PDFIProcessor::sortElements( Element* pEle, bool bDeep )
974 {
975     if( pEle->Children.empty() )
976         return;
977 
978     if( bDeep )
979     {
980         for( std::list< Element* >::iterator it = pEle->Children.begin();
981              it != pEle->Children.end(); ++it )
982         {
983             sortElements( *it, bDeep );
984         }
985     }
986     // HACK: the stable sort member on std::list that takes a
987     // strict weak ordering requires member templates - which we
988     // do not have on all compilers. so we need to use std::stable_sort
989     // here - which does need random access iterators which the
990     // list iterators are not.
991     // so we need to copy the Element* to an array, stable sort that and
992     // copy them back.
993     std::vector<Element*> aChildren;
994     while( ! pEle->Children.empty() )
995     {
996         aChildren.push_back( pEle->Children.front() );
997         pEle->Children.pop_front();
998     }
999     switch( m_eTextDirection )
1000     {
1001         case LrTb:
1002         default:
1003         std::stable_sort( aChildren.begin(), aChildren.end(), lr_tb_sort );
1004         break;
1005     }
1006     int nChildren = aChildren.size();
1007     for( int i = 0; i < nChildren; i++ )
1008         pEle->Children.push_back( aChildren[i] );
1009 }
1010 
1011 
1012 ::basegfx::B2DRange& PDFIProcessor::calcTransformedRectBounds( ::basegfx::B2DRange&			outRect,
1013                                                         const ::basegfx::B2DRange&		inRect,
1014                                                         const ::basegfx::B2DHomMatrix& 	transformation )
1015         {
1016             outRect.reset();
1017 
1018             if( inRect.isEmpty() )
1019                 return outRect;
1020 
1021             // transform all four extremal points of the rectangle,
1022             // take bounding rect of those.
1023 
1024             // transform left-top point
1025             outRect.expand( transformation * inRect.getMinimum() );
1026 
1027             // transform bottom-right point
1028             outRect.expand( transformation * inRect.getMaximum() );
1029 
1030             ::basegfx::B2DPoint aPoint;
1031 
1032             // transform top-right point
1033             aPoint.setX( inRect.getMaxX() );
1034             aPoint.setY( inRect.getMinY() );
1035 
1036             aPoint *= transformation;
1037             outRect.expand( aPoint );
1038 
1039             // transform bottom-left point
1040             aPoint.setX( inRect.getMinX() );
1041             aPoint.setY( inRect.getMaxY() );
1042 
1043             aPoint *= transformation;
1044             outRect.expand( aPoint );
1045 
1046             // over and out.
1047             return outRect;
1048         }
1049 
1050 // helper method: get a mirrored string
1051 rtl::OUString PDFIProcessor::mirrorString( const rtl::OUString& i_rString )
1052 {
1053     if( ! m_xMirrorMapper.is() && ! m_bMirrorMapperTried )
1054     {
1055     	m_bMirrorMapperTried = true;
1056         uno::Reference< lang::XMultiComponentFactory > xMSF(  m_xContext->getServiceManager(), uno::UNO_SET_THROW );
1057         uno::Reference < uno::XInterface > xInterface = xMSF->createInstanceWithContext(::rtl::OUString::createFromAscii("com.sun.star.awt.StringMirror"), m_xContext);
1058     	m_xMirrorMapper = uno::Reference< util::XStringMapping >( xInterface, uno::UNO_QUERY );
1059         #if OSL_DEBUG_LEVEL > 1
1060         if( m_xMirrorMapper.is() )
1061             fprintf( stderr, "using mirror mapper service\n" );
1062         #endif
1063     }
1064     if( m_xMirrorMapper.is() )
1065     {
1066         uno::Sequence< rtl::OUString > aSeq( 1 );
1067         aSeq.getArray()[0] = i_rString;
1068         m_xMirrorMapper->mapStrings( aSeq );
1069         return  aSeq[0];
1070     }
1071 
1072     prepareMirrorMap();
1073     sal_Int32 nLen = i_rString.getLength();
1074     rtl::OUStringBuffer aRet( nLen );
1075     for(int i = nLen - 1; i >= 0; i--)
1076     {
1077         sal_Unicode cChar = i_rString[ i ];
1078         aRet.append( m_aMirrorMap[cChar] );
1079     }
1080     return aRet.makeStringAndClear();
1081 }
1082 
1083 void PDFIProcessor::prepareMirrorMap()
1084 {
1085     if( m_aMirrorMap.empty() )
1086     {
1087         #if OSL_DEBUG_LEVEL > 1
1088         fprintf( stderr, "falling back to static mirror list\n" );
1089         #endif
1090 
1091         m_aMirrorMap.reserve( 0x10000 );
1092         for( int i = 0; i < 0x10000; i++ )
1093             m_aMirrorMap.push_back( sal_Unicode(i) );
1094 
1095         m_aMirrorMap[ 0x0028 ] = 0x0029; // LEFT PARENTHESIS
1096         m_aMirrorMap[ 0x0029 ] = 0x0028; // RIGHT PARENTHESIS
1097         m_aMirrorMap[ 0x003C ] = 0x003E; // LESS-THAN SIGN
1098         m_aMirrorMap[ 0x003E ] = 0x003C; // GREATER-THAN SIGN
1099         m_aMirrorMap[ 0x005B ] = 0x005D; // LEFT SQUARE BRACKET
1100         m_aMirrorMap[ 0x005D ] = 0x005B; // RIGHT SQUARE BRACKET
1101         m_aMirrorMap[ 0x007B ] = 0x007D; // LEFT CURLY BRACKET
1102         m_aMirrorMap[ 0x007D ] = 0x007B; // RIGHT CURLY BRACKET
1103         m_aMirrorMap[ 0x00AB ] = 0x00BB; // LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
1104         m_aMirrorMap[ 0x00BB ] = 0x00AB; // RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
1105         m_aMirrorMap[ 0x0F3A ] = 0x0F3B; // TIBETAN MARK GUG RTAGS GYON
1106         m_aMirrorMap[ 0x0F3B ] = 0x0F3A; // TIBETAN MARK GUG RTAGS GYAS
1107         m_aMirrorMap[ 0x0F3C ] = 0x0F3D; // TIBETAN MARK ANG KHANG GYON
1108         m_aMirrorMap[ 0x0F3D ] = 0x0F3C; // TIBETAN MARK ANG KHANG GYAS
1109         m_aMirrorMap[ 0x169B ] = 0x169C; // OGHAM FEATHER MARK
1110         m_aMirrorMap[ 0x169C ] = 0x169B; // OGHAM REVERSED FEATHER MARK
1111         m_aMirrorMap[ 0x2039 ] = 0x203A; // SINGLE LEFT-POINTING ANGLE QUOTATION MARK
1112         m_aMirrorMap[ 0x203A ] = 0x2039; // SINGLE RIGHT-POINTING ANGLE QUOTATION MARK
1113         m_aMirrorMap[ 0x2045 ] = 0x2046; // LEFT SQUARE BRACKET WITH QUILL
1114         m_aMirrorMap[ 0x2046 ] = 0x2045; // RIGHT SQUARE BRACKET WITH QUILL
1115         m_aMirrorMap[ 0x207D ] = 0x207E; // SUPERSCRIPT LEFT PARENTHESIS
1116         m_aMirrorMap[ 0x207E ] = 0x207D; // SUPERSCRIPT RIGHT PARENTHESIS
1117         m_aMirrorMap[ 0x208D ] = 0x208E; // SUBSCRIPT LEFT PARENTHESIS
1118         m_aMirrorMap[ 0x208E ] = 0x208D; // SUBSCRIPT RIGHT PARENTHESIS
1119         m_aMirrorMap[ 0x2208 ] = 0x220B; // ELEMENT OF
1120         m_aMirrorMap[ 0x2209 ] = 0x220C; // NOT AN ELEMENT OF
1121         m_aMirrorMap[ 0x220A ] = 0x220D; // SMALL ELEMENT OF
1122         m_aMirrorMap[ 0x220B ] = 0x2208; // CONTAINS AS MEMBER
1123         m_aMirrorMap[ 0x220C ] = 0x2209; // DOES NOT CONTAIN AS MEMBER
1124         m_aMirrorMap[ 0x220D ] = 0x220A; // SMALL CONTAINS AS MEMBER
1125         m_aMirrorMap[ 0x2215 ] = 0x29F5; // DIVISION SLASH
1126         m_aMirrorMap[ 0x223C ] = 0x223D; // TILDE OPERATOR
1127         m_aMirrorMap[ 0x223D ] = 0x223C; // REVERSED TILDE
1128         m_aMirrorMap[ 0x2243 ] = 0x22CD; // ASYMPTOTICALLY EQUAL TO
1129         m_aMirrorMap[ 0x2252 ] = 0x2253; // APPROXIMATELY EQUAL TO OR THE IMAGE OF
1130         m_aMirrorMap[ 0x2253 ] = 0x2252; // IMAGE OF OR APPROXIMATELY EQUAL TO
1131         m_aMirrorMap[ 0x2254 ] = 0x2255; // COLON EQUALS
1132         m_aMirrorMap[ 0x2255 ] = 0x2254; // EQUALS COLON
1133         m_aMirrorMap[ 0x2264 ] = 0x2265; // LESS-THAN OR EQUAL TO
1134         m_aMirrorMap[ 0x2265 ] = 0x2264; // GREATER-THAN OR EQUAL TO
1135         m_aMirrorMap[ 0x2266 ] = 0x2267; // LESS-THAN OVER EQUAL TO
1136         m_aMirrorMap[ 0x2267 ] = 0x2266; // GREATER-THAN OVER EQUAL TO
1137         m_aMirrorMap[ 0x2268 ] = 0x2269; // [BEST FIT] LESS-THAN BUT NOT EQUAL TO
1138         m_aMirrorMap[ 0x2269 ] = 0x2268; // [BEST FIT] GREATER-THAN BUT NOT EQUAL TO
1139         m_aMirrorMap[ 0x226A ] = 0x226B; // MUCH LESS-THAN
1140         m_aMirrorMap[ 0x226B ] = 0x226A; // MUCH GREATER-THAN
1141         m_aMirrorMap[ 0x226E ] = 0x226F; // [BEST FIT] NOT LESS-THAN
1142         m_aMirrorMap[ 0x226F ] = 0x226E; // [BEST FIT] NOT GREATER-THAN
1143         m_aMirrorMap[ 0x2270 ] = 0x2271; // [BEST FIT] NEITHER LESS-THAN NOR EQUAL TO
1144         m_aMirrorMap[ 0x2271 ] = 0x2270; // [BEST FIT] NEITHER GREATER-THAN NOR EQUAL TO
1145         m_aMirrorMap[ 0x2272 ] = 0x2273; // [BEST FIT] LESS-THAN OR EQUIVALENT TO
1146         m_aMirrorMap[ 0x2273 ] = 0x2272; // [BEST FIT] GREATER-THAN OR EQUIVALENT TO
1147         m_aMirrorMap[ 0x2274 ] = 0x2275; // [BEST FIT] NEITHER LESS-THAN NOR EQUIVALENT TO
1148         m_aMirrorMap[ 0x2275 ] = 0x2274; // [BEST FIT] NEITHER GREATER-THAN NOR EQUIVALENT TO
1149         m_aMirrorMap[ 0x2276 ] = 0x2277; // LESS-THAN OR GREATER-THAN
1150         m_aMirrorMap[ 0x2277 ] = 0x2276; // GREATER-THAN OR LESS-THAN
1151         m_aMirrorMap[ 0x2278 ] = 0x2279; // [BEST FIT] NEITHER LESS-THAN NOR GREATER-THAN
1152         m_aMirrorMap[ 0x2279 ] = 0x2278; // [BEST FIT] NEITHER GREATER-THAN NOR LESS-THAN
1153         m_aMirrorMap[ 0x227A ] = 0x227B; // PRECEDES
1154         m_aMirrorMap[ 0x227B ] = 0x227A; // SUCCEEDS
1155         m_aMirrorMap[ 0x227C ] = 0x227D; // PRECEDES OR EQUAL TO
1156         m_aMirrorMap[ 0x227D ] = 0x227C; // SUCCEEDS OR EQUAL TO
1157         m_aMirrorMap[ 0x227E ] = 0x227F; // [BEST FIT] PRECEDES OR EQUIVALENT TO
1158         m_aMirrorMap[ 0x227F ] = 0x227E; // [BEST FIT] SUCCEEDS OR EQUIVALENT TO
1159         m_aMirrorMap[ 0x2280 ] = 0x2281; // [BEST FIT] DOES NOT PRECEDE
1160         m_aMirrorMap[ 0x2281 ] = 0x2280; // [BEST FIT] DOES NOT SUCCEED
1161         m_aMirrorMap[ 0x2282 ] = 0x2283; // SUBSET OF
1162         m_aMirrorMap[ 0x2283 ] = 0x2282; // SUPERSET OF
1163         m_aMirrorMap[ 0x2284 ] = 0x2285; // [BEST FIT] NOT A SUBSET OF
1164         m_aMirrorMap[ 0x2285 ] = 0x2284; // [BEST FIT] NOT A SUPERSET OF
1165         m_aMirrorMap[ 0x2286 ] = 0x2287; // SUBSET OF OR EQUAL TO
1166         m_aMirrorMap[ 0x2287 ] = 0x2286; // SUPERSET OF OR EQUAL TO
1167         m_aMirrorMap[ 0x2288 ] = 0x2289; // [BEST FIT] NEITHER A SUBSET OF NOR EQUAL TO
1168         m_aMirrorMap[ 0x2289 ] = 0x2288; // [BEST FIT] NEITHER A SUPERSET OF NOR EQUAL TO
1169         m_aMirrorMap[ 0x228A ] = 0x228B; // [BEST FIT] SUBSET OF WITH NOT EQUAL TO
1170         m_aMirrorMap[ 0x228B ] = 0x228A; // [BEST FIT] SUPERSET OF WITH NOT EQUAL TO
1171         m_aMirrorMap[ 0x228F ] = 0x2290; // SQUARE IMAGE OF
1172         m_aMirrorMap[ 0x2290 ] = 0x228F; // SQUARE ORIGINAL OF
1173         m_aMirrorMap[ 0x2291 ] = 0x2292; // SQUARE IMAGE OF OR EQUAL TO
1174         m_aMirrorMap[ 0x2292 ] = 0x2291; // SQUARE ORIGINAL OF OR EQUAL TO
1175         m_aMirrorMap[ 0x2298 ] = 0x29B8; // CIRCLED DIVISION SLASH
1176         m_aMirrorMap[ 0x22A2 ] = 0x22A3; // RIGHT TACK
1177         m_aMirrorMap[ 0x22A3 ] = 0x22A2; // LEFT TACK
1178         m_aMirrorMap[ 0x22A6 ] = 0x2ADE; // ASSERTION
1179         m_aMirrorMap[ 0x22A8 ] = 0x2AE4; // TRUE
1180         m_aMirrorMap[ 0x22A9 ] = 0x2AE3; // FORCES
1181         m_aMirrorMap[ 0x22AB ] = 0x2AE5; // DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE
1182         m_aMirrorMap[ 0x22B0 ] = 0x22B1; // PRECEDES UNDER RELATION
1183         m_aMirrorMap[ 0x22B1 ] = 0x22B0; // SUCCEEDS UNDER RELATION
1184         m_aMirrorMap[ 0x22B2 ] = 0x22B3; // NORMAL SUBGROUP OF
1185         m_aMirrorMap[ 0x22B3 ] = 0x22B2; // CONTAINS AS NORMAL SUBGROUP
1186         m_aMirrorMap[ 0x22B4 ] = 0x22B5; // NORMAL SUBGROUP OF OR EQUAL TO
1187         m_aMirrorMap[ 0x22B5 ] = 0x22B4; // CONTAINS AS NORMAL SUBGROUP OR EQUAL TO
1188         m_aMirrorMap[ 0x22B6 ] = 0x22B7; // ORIGINAL OF
1189         m_aMirrorMap[ 0x22B7 ] = 0x22B6; // IMAGE OF
1190         m_aMirrorMap[ 0x22C9 ] = 0x22CA; // LEFT NORMAL FACTOR SEMIDIRECT PRODUCT
1191         m_aMirrorMap[ 0x22CA ] = 0x22C9; // RIGHT NORMAL FACTOR SEMIDIRECT PRODUCT
1192         m_aMirrorMap[ 0x22CB ] = 0x22CC; // LEFT SEMIDIRECT PRODUCT
1193         m_aMirrorMap[ 0x22CC ] = 0x22CB; // RIGHT SEMIDIRECT PRODUCT
1194         m_aMirrorMap[ 0x22CD ] = 0x2243; // REVERSED TILDE EQUALS
1195         m_aMirrorMap[ 0x22D0 ] = 0x22D1; // DOUBLE SUBSET
1196         m_aMirrorMap[ 0x22D1 ] = 0x22D0; // DOUBLE SUPERSET
1197         m_aMirrorMap[ 0x22D6 ] = 0x22D7; // LESS-THAN WITH DOT
1198         m_aMirrorMap[ 0x22D7 ] = 0x22D6; // GREATER-THAN WITH DOT
1199         m_aMirrorMap[ 0x22D8 ] = 0x22D9; // VERY MUCH LESS-THAN
1200         m_aMirrorMap[ 0x22D9 ] = 0x22D8; // VERY MUCH GREATER-THAN
1201         m_aMirrorMap[ 0x22DA ] = 0x22DB; // LESS-THAN EQUAL TO OR GREATER-THAN
1202         m_aMirrorMap[ 0x22DB ] = 0x22DA; // GREATER-THAN EQUAL TO OR LESS-THAN
1203         m_aMirrorMap[ 0x22DC ] = 0x22DD; // EQUAL TO OR LESS-THAN
1204         m_aMirrorMap[ 0x22DD ] = 0x22DC; // EQUAL TO OR GREATER-THAN
1205         m_aMirrorMap[ 0x22DE ] = 0x22DF; // EQUAL TO OR PRECEDES
1206         m_aMirrorMap[ 0x22DF ] = 0x22DE; // EQUAL TO OR SUCCEEDS
1207         m_aMirrorMap[ 0x22E0 ] = 0x22E1; // [BEST FIT] DOES NOT PRECEDE OR EQUAL
1208         m_aMirrorMap[ 0x22E1 ] = 0x22E0; // [BEST FIT] DOES NOT SUCCEED OR EQUAL
1209         m_aMirrorMap[ 0x22E2 ] = 0x22E3; // [BEST FIT] NOT SQUARE IMAGE OF OR EQUAL TO
1210         m_aMirrorMap[ 0x22E3 ] = 0x22E2; // [BEST FIT] NOT SQUARE ORIGINAL OF OR EQUAL TO
1211         m_aMirrorMap[ 0x22E4 ] = 0x22E5; // [BEST FIT] SQUARE IMAGE OF OR NOT EQUAL TO
1212         m_aMirrorMap[ 0x22E5 ] = 0x22E4; // [BEST FIT] SQUARE ORIGINAL OF OR NOT EQUAL TO
1213         m_aMirrorMap[ 0x22E6 ] = 0x22E7; // [BEST FIT] LESS-THAN BUT NOT EQUIVALENT TO
1214         m_aMirrorMap[ 0x22E7 ] = 0x22E6; // [BEST FIT] GREATER-THAN BUT NOT EQUIVALENT TO
1215         m_aMirrorMap[ 0x22E8 ] = 0x22E9; // [BEST FIT] PRECEDES BUT NOT EQUIVALENT TO
1216         m_aMirrorMap[ 0x22E9 ] = 0x22E8; // [BEST FIT] SUCCEEDS BUT NOT EQUIVALENT TO
1217         m_aMirrorMap[ 0x22EA ] = 0x22EB; // [BEST FIT] NOT NORMAL SUBGROUP OF
1218         m_aMirrorMap[ 0x22EB ] = 0x22EA; // [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP
1219         m_aMirrorMap[ 0x22EC ] = 0x22ED; // [BEST FIT] NOT NORMAL SUBGROUP OF OR EQUAL TO
1220         m_aMirrorMap[ 0x22ED ] = 0x22EC; // [BEST FIT] DOES NOT CONTAIN AS NORMAL SUBGROUP OR EQUAL
1221         m_aMirrorMap[ 0x22F0 ] = 0x22F1; // UP RIGHT DIAGONAL ELLIPSIS
1222         m_aMirrorMap[ 0x22F1 ] = 0x22F0; // DOWN RIGHT DIAGONAL ELLIPSIS
1223         m_aMirrorMap[ 0x22F2 ] = 0x22FA; // ELEMENT OF WITH LONG HORIZONTAL STROKE
1224         m_aMirrorMap[ 0x22F3 ] = 0x22FB; // ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
1225         m_aMirrorMap[ 0x22F4 ] = 0x22FC; // SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
1226         m_aMirrorMap[ 0x22F6 ] = 0x22FD; // ELEMENT OF WITH OVERBAR
1227         m_aMirrorMap[ 0x22F7 ] = 0x22FE; // SMALL ELEMENT OF WITH OVERBAR
1228         m_aMirrorMap[ 0x22FA ] = 0x22F2; // CONTAINS WITH LONG HORIZONTAL STROKE
1229         m_aMirrorMap[ 0x22FB ] = 0x22F3; // CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
1230         m_aMirrorMap[ 0x22FC ] = 0x22F4; // SMALL CONTAINS WITH VERTICAL BAR AT END OF HORIZONTAL STROKE
1231         m_aMirrorMap[ 0x22FD ] = 0x22F6; // CONTAINS WITH OVERBAR
1232         m_aMirrorMap[ 0x22FE ] = 0x22F7; // SMALL CONTAINS WITH OVERBAR
1233         m_aMirrorMap[ 0x2308 ] = 0x2309; // LEFT CEILING
1234         m_aMirrorMap[ 0x2309 ] = 0x2308; // RIGHT CEILING
1235         m_aMirrorMap[ 0x230A ] = 0x230B; // LEFT FLOOR
1236         m_aMirrorMap[ 0x230B ] = 0x230A; // RIGHT FLOOR
1237         m_aMirrorMap[ 0x2329 ] = 0x232A; // LEFT-POINTING ANGLE BRACKET
1238         m_aMirrorMap[ 0x232A ] = 0x2329; // RIGHT-POINTING ANGLE BRACKET
1239         m_aMirrorMap[ 0x2768 ] = 0x2769; // MEDIUM LEFT PARENTHESIS ORNAMENT
1240         m_aMirrorMap[ 0x2769 ] = 0x2768; // MEDIUM RIGHT PARENTHESIS ORNAMENT
1241         m_aMirrorMap[ 0x276A ] = 0x276B; // MEDIUM FLATTENED LEFT PARENTHESIS ORNAMENT
1242         m_aMirrorMap[ 0x276B ] = 0x276A; // MEDIUM FLATTENED RIGHT PARENTHESIS ORNAMENT
1243         m_aMirrorMap[ 0x276C ] = 0x276D; // MEDIUM LEFT-POINTING ANGLE BRACKET ORNAMENT
1244         m_aMirrorMap[ 0x276D ] = 0x276C; // MEDIUM RIGHT-POINTING ANGLE BRACKET ORNAMENT
1245         m_aMirrorMap[ 0x276E ] = 0x276F; // HEAVY LEFT-POINTING ANGLE QUOTATION MARK ORNAMENT
1246         m_aMirrorMap[ 0x276F ] = 0x276E; // HEAVY RIGHT-POINTING ANGLE QUOTATION MARK ORNAMENT
1247         m_aMirrorMap[ 0x2770 ] = 0x2771; // HEAVY LEFT-POINTING ANGLE BRACKET ORNAMENT
1248         m_aMirrorMap[ 0x2771 ] = 0x2770; // HEAVY RIGHT-POINTING ANGLE BRACKET ORNAMENT
1249         m_aMirrorMap[ 0x2772 ] = 0x2773; // LIGHT LEFT TORTOISE SHELL BRACKET
1250         m_aMirrorMap[ 0x2773 ] = 0x2772; // LIGHT RIGHT TORTOISE SHELL BRACKET
1251         m_aMirrorMap[ 0x2774 ] = 0x2775; // MEDIUM LEFT CURLY BRACKET ORNAMENT
1252         m_aMirrorMap[ 0x2775 ] = 0x2774; // MEDIUM RIGHT CURLY BRACKET ORNAMENT
1253         m_aMirrorMap[ 0x27C3 ] = 0x27C4; // OPEN SUBSET
1254         m_aMirrorMap[ 0x27C4 ] = 0x27C3; // OPEN SUPERSET
1255         m_aMirrorMap[ 0x27C5 ] = 0x27C6; // LEFT S-SHAPED BAG DELIMITER
1256         m_aMirrorMap[ 0x27C6 ] = 0x27C5; // RIGHT S-SHAPED BAG DELIMITER
1257         m_aMirrorMap[ 0x27C8 ] = 0x27C9; // REVERSE SOLIDUS PRECEDING SUBSET
1258         m_aMirrorMap[ 0x27C9 ] = 0x27C8; // SUPERSET PRECEDING SOLIDUS
1259         m_aMirrorMap[ 0x27D5 ] = 0x27D6; // LEFT OUTER JOIN
1260         m_aMirrorMap[ 0x27D6 ] = 0x27D5; // RIGHT OUTER JOIN
1261         m_aMirrorMap[ 0x27DD ] = 0x27DE; // LONG RIGHT TACK
1262         m_aMirrorMap[ 0x27DE ] = 0x27DD; // LONG LEFT TACK
1263         m_aMirrorMap[ 0x27E2 ] = 0x27E3; // WHITE CONCAVE-SIDED DIAMOND WITH LEFTWARDS TICK
1264         m_aMirrorMap[ 0x27E3 ] = 0x27E2; // WHITE CONCAVE-SIDED DIAMOND WITH RIGHTWARDS TICK
1265         m_aMirrorMap[ 0x27E4 ] = 0x27E5; // WHITE SQUARE WITH LEFTWARDS TICK
1266         m_aMirrorMap[ 0x27E5 ] = 0x27E4; // WHITE SQUARE WITH RIGHTWARDS TICK
1267         m_aMirrorMap[ 0x27E6 ] = 0x27E7; // MATHEMATICAL LEFT WHITE SQUARE BRACKET
1268         m_aMirrorMap[ 0x27E7 ] = 0x27E6; // MATHEMATICAL RIGHT WHITE SQUARE BRACKET
1269         m_aMirrorMap[ 0x27E8 ] = 0x27E9; // MATHEMATICAL LEFT ANGLE BRACKET
1270         m_aMirrorMap[ 0x27E9 ] = 0x27E8; // MATHEMATICAL RIGHT ANGLE BRACKET
1271         m_aMirrorMap[ 0x27EA ] = 0x27EB; // MATHEMATICAL LEFT DOUBLE ANGLE BRACKET
1272         m_aMirrorMap[ 0x27EB ] = 0x27EA; // MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET
1273         m_aMirrorMap[ 0x27EC ] = 0x27ED; // MATHEMATICAL LEFT WHITE TORTOISE SHELL BRACKET
1274         m_aMirrorMap[ 0x27ED ] = 0x27EC; // MATHEMATICAL RIGHT WHITE TORTOISE SHELL BRACKET
1275         m_aMirrorMap[ 0x27EE ] = 0x27EF; // MATHEMATICAL LEFT FLATTENED PARENTHESIS
1276         m_aMirrorMap[ 0x27EF ] = 0x27EE; // MATHEMATICAL RIGHT FLATTENED PARENTHESIS
1277         m_aMirrorMap[ 0x2983 ] = 0x2984; // LEFT WHITE CURLY BRACKET
1278         m_aMirrorMap[ 0x2984 ] = 0x2983; // RIGHT WHITE CURLY BRACKET
1279         m_aMirrorMap[ 0x2985 ] = 0x2986; // LEFT WHITE PARENTHESIS
1280         m_aMirrorMap[ 0x2986 ] = 0x2985; // RIGHT WHITE PARENTHESIS
1281         m_aMirrorMap[ 0x2987 ] = 0x2988; // Z NOTATION LEFT IMAGE BRACKET
1282         m_aMirrorMap[ 0x2988 ] = 0x2987; // Z NOTATION RIGHT IMAGE BRACKET
1283         m_aMirrorMap[ 0x2989 ] = 0x298A; // Z NOTATION LEFT BINDING BRACKET
1284         m_aMirrorMap[ 0x298A ] = 0x2989; // Z NOTATION RIGHT BINDING BRACKET
1285         m_aMirrorMap[ 0x298B ] = 0x298C; // LEFT SQUARE BRACKET WITH UNDERBAR
1286         m_aMirrorMap[ 0x298C ] = 0x298B; // RIGHT SQUARE BRACKET WITH UNDERBAR
1287         m_aMirrorMap[ 0x298D ] = 0x2990; // LEFT SQUARE BRACKET WITH TICK IN TOP CORNER
1288         m_aMirrorMap[ 0x298E ] = 0x298F; // RIGHT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
1289         m_aMirrorMap[ 0x298F ] = 0x298E; // LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER
1290         m_aMirrorMap[ 0x2990 ] = 0x298D; // RIGHT SQUARE BRACKET WITH TICK IN TOP CORNER
1291         m_aMirrorMap[ 0x2991 ] = 0x2992; // LEFT ANGLE BRACKET WITH DOT
1292         m_aMirrorMap[ 0x2992 ] = 0x2991; // RIGHT ANGLE BRACKET WITH DOT
1293         m_aMirrorMap[ 0x2993 ] = 0x2994; // LEFT ARC LESS-THAN BRACKET
1294         m_aMirrorMap[ 0x2994 ] = 0x2993; // RIGHT ARC GREATER-THAN BRACKET
1295         m_aMirrorMap[ 0x2995 ] = 0x2996; // DOUBLE LEFT ARC GREATER-THAN BRACKET
1296         m_aMirrorMap[ 0x2996 ] = 0x2995; // DOUBLE RIGHT ARC LESS-THAN BRACKET
1297         m_aMirrorMap[ 0x2997 ] = 0x2998; // LEFT BLACK TORTOISE SHELL BRACKET
1298         m_aMirrorMap[ 0x2998 ] = 0x2997; // RIGHT BLACK TORTOISE SHELL BRACKET
1299         m_aMirrorMap[ 0x29B8 ] = 0x2298; // CIRCLED REVERSE SOLIDUS
1300         m_aMirrorMap[ 0x29C0 ] = 0x29C1; // CIRCLED LESS-THAN
1301         m_aMirrorMap[ 0x29C1 ] = 0x29C0; // CIRCLED GREATER-THAN
1302         m_aMirrorMap[ 0x29C4 ] = 0x29C5; // SQUARED RISING DIAGONAL SLASH
1303         m_aMirrorMap[ 0x29C5 ] = 0x29C4; // SQUARED FALLING DIAGONAL SLASH
1304         m_aMirrorMap[ 0x29CF ] = 0x29D0; // LEFT TRIANGLE BESIDE VERTICAL BAR
1305         m_aMirrorMap[ 0x29D0 ] = 0x29CF; // VERTICAL BAR BESIDE RIGHT TRIANGLE
1306         m_aMirrorMap[ 0x29D1 ] = 0x29D2; // BOWTIE WITH LEFT HALF BLACK
1307         m_aMirrorMap[ 0x29D2 ] = 0x29D1; // BOWTIE WITH RIGHT HALF BLACK
1308         m_aMirrorMap[ 0x29D4 ] = 0x29D5; // TIMES WITH LEFT HALF BLACK
1309         m_aMirrorMap[ 0x29D5 ] = 0x29D4; // TIMES WITH RIGHT HALF BLACK
1310         m_aMirrorMap[ 0x29D8 ] = 0x29D9; // LEFT WIGGLY FENCE
1311         m_aMirrorMap[ 0x29D9 ] = 0x29D8; // RIGHT WIGGLY FENCE
1312         m_aMirrorMap[ 0x29DA ] = 0x29DB; // LEFT DOUBLE WIGGLY FENCE
1313         m_aMirrorMap[ 0x29DB ] = 0x29DA; // RIGHT DOUBLE WIGGLY FENCE
1314         m_aMirrorMap[ 0x29F5 ] = 0x2215; // REVERSE SOLIDUS OPERATOR
1315         m_aMirrorMap[ 0x29F8 ] = 0x29F9; // BIG SOLIDUS
1316         m_aMirrorMap[ 0x29F9 ] = 0x29F8; // BIG REVERSE SOLIDUS
1317         m_aMirrorMap[ 0x29FC ] = 0x29FD; // LEFT-POINTING CURVED ANGLE BRACKET
1318         m_aMirrorMap[ 0x29FD ] = 0x29FC; // RIGHT-POINTING CURVED ANGLE BRACKET
1319         m_aMirrorMap[ 0x2A2B ] = 0x2A2C; // MINUS SIGN WITH FALLING DOTS
1320         m_aMirrorMap[ 0x2A2C ] = 0x2A2B; // MINUS SIGN WITH RISING DOTS
1321         m_aMirrorMap[ 0x2A2D ] = 0x2A2E; // PLUS SIGN IN LEFT HALF CIRCLE
1322         m_aMirrorMap[ 0x2A2E ] = 0x2A2D; // PLUS SIGN IN RIGHT HALF CIRCLE
1323         m_aMirrorMap[ 0x2A34 ] = 0x2A35; // MULTIPLICATION SIGN IN LEFT HALF CIRCLE
1324         m_aMirrorMap[ 0x2A35 ] = 0x2A34; // MULTIPLICATION SIGN IN RIGHT HALF CIRCLE
1325         m_aMirrorMap[ 0x2A3C ] = 0x2A3D; // INTERIOR PRODUCT
1326         m_aMirrorMap[ 0x2A3D ] = 0x2A3C; // RIGHTHAND INTERIOR PRODUCT
1327         m_aMirrorMap[ 0x2A64 ] = 0x2A65; // Z NOTATION DOMAIN ANTIRESTRICTION
1328         m_aMirrorMap[ 0x2A65 ] = 0x2A64; // Z NOTATION RANGE ANTIRESTRICTION
1329         m_aMirrorMap[ 0x2A79 ] = 0x2A7A; // LESS-THAN WITH CIRCLE INSIDE
1330         m_aMirrorMap[ 0x2A7A ] = 0x2A79; // GREATER-THAN WITH CIRCLE INSIDE
1331         m_aMirrorMap[ 0x2A7D ] = 0x2A7E; // LESS-THAN OR SLANTED EQUAL TO
1332         m_aMirrorMap[ 0x2A7E ] = 0x2A7D; // GREATER-THAN OR SLANTED EQUAL TO
1333         m_aMirrorMap[ 0x2A7F ] = 0x2A80; // LESS-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
1334         m_aMirrorMap[ 0x2A80 ] = 0x2A7F; // GREATER-THAN OR SLANTED EQUAL TO WITH DOT INSIDE
1335         m_aMirrorMap[ 0x2A81 ] = 0x2A82; // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
1336         m_aMirrorMap[ 0x2A82 ] = 0x2A81; // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE
1337         m_aMirrorMap[ 0x2A83 ] = 0x2A84; // LESS-THAN OR SLANTED EQUAL TO WITH DOT ABOVE RIGHT
1338         m_aMirrorMap[ 0x2A84 ] = 0x2A83; // GREATER-THAN OR SLANTED EQUAL TO WITH DOT ABOVE LEFT
1339         m_aMirrorMap[ 0x2A8B ] = 0x2A8C; // LESS-THAN ABOVE DOUBLE-LINE EQUAL ABOVE GREATER-THAN
1340         m_aMirrorMap[ 0x2A8C ] = 0x2A8B; // GREATER-THAN ABOVE DOUBLE-LINE EQUAL ABOVE LESS-THAN
1341         m_aMirrorMap[ 0x2A91 ] = 0x2A92; // LESS-THAN ABOVE GREATER-THAN ABOVE DOUBLE-LINE EQUAL
1342         m_aMirrorMap[ 0x2A92 ] = 0x2A91; // GREATER-THAN ABOVE LESS-THAN ABOVE DOUBLE-LINE EQUAL
1343         m_aMirrorMap[ 0x2A93 ] = 0x2A94; // LESS-THAN ABOVE SLANTED EQUAL ABOVE GREATER-THAN ABOVE SLANTED EQUAL
1344         m_aMirrorMap[ 0x2A94 ] = 0x2A93; // GREATER-THAN ABOVE SLANTED EQUAL ABOVE LESS-THAN ABOVE SLANTED EQUAL
1345         m_aMirrorMap[ 0x2A95 ] = 0x2A96; // SLANTED EQUAL TO OR LESS-THAN
1346         m_aMirrorMap[ 0x2A96 ] = 0x2A95; // SLANTED EQUAL TO OR GREATER-THAN
1347         m_aMirrorMap[ 0x2A97 ] = 0x2A98; // SLANTED EQUAL TO OR LESS-THAN WITH DOT INSIDE
1348         m_aMirrorMap[ 0x2A98 ] = 0x2A97; // SLANTED EQUAL TO OR GREATER-THAN WITH DOT INSIDE
1349         m_aMirrorMap[ 0x2A99 ] = 0x2A9A; // DOUBLE-LINE EQUAL TO OR LESS-THAN
1350         m_aMirrorMap[ 0x2A9A ] = 0x2A99; // DOUBLE-LINE EQUAL TO OR GREATER-THAN
1351         m_aMirrorMap[ 0x2A9B ] = 0x2A9C; // DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN
1352         m_aMirrorMap[ 0x2A9C ] = 0x2A9B; // DOUBLE-LINE SLANTED EQUAL TO OR GREATER-THAN
1353         m_aMirrorMap[ 0x2AA1 ] = 0x2AA2; // DOUBLE NESTED LESS-THAN
1354         m_aMirrorMap[ 0x2AA2 ] = 0x2AA1; // DOUBLE NESTED GREATER-THAN
1355         m_aMirrorMap[ 0x2AA6 ] = 0x2AA7; // LESS-THAN CLOSED BY CURVE
1356         m_aMirrorMap[ 0x2AA7 ] = 0x2AA6; // GREATER-THAN CLOSED BY CURVE
1357         m_aMirrorMap[ 0x2AA8 ] = 0x2AA9; // LESS-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
1358         m_aMirrorMap[ 0x2AA9 ] = 0x2AA8; // GREATER-THAN CLOSED BY CURVE ABOVE SLANTED EQUAL
1359         m_aMirrorMap[ 0x2AAA ] = 0x2AAB; // SMALLER THAN
1360         m_aMirrorMap[ 0x2AAB ] = 0x2AAA; // LARGER THAN
1361         m_aMirrorMap[ 0x2AAC ] = 0x2AAD; // SMALLER THAN OR EQUAL TO
1362         m_aMirrorMap[ 0x2AAD ] = 0x2AAC; // LARGER THAN OR EQUAL TO
1363         m_aMirrorMap[ 0x2AAF ] = 0x2AB0; // PRECEDES ABOVE SINGLE-LINE EQUALS SIGN
1364         m_aMirrorMap[ 0x2AB0 ] = 0x2AAF; // SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN
1365         m_aMirrorMap[ 0x2AB3 ] = 0x2AB4; // PRECEDES ABOVE EQUALS SIGN
1366         m_aMirrorMap[ 0x2AB4 ] = 0x2AB3; // SUCCEEDS ABOVE EQUALS SIGN
1367         m_aMirrorMap[ 0x2ABB ] = 0x2ABC; // DOUBLE PRECEDES
1368         m_aMirrorMap[ 0x2ABC ] = 0x2ABB; // DOUBLE SUCCEEDS
1369         m_aMirrorMap[ 0x2ABD ] = 0x2ABE; // SUBSET WITH DOT
1370         m_aMirrorMap[ 0x2ABE ] = 0x2ABD; // SUPERSET WITH DOT
1371         m_aMirrorMap[ 0x2ABF ] = 0x2AC0; // SUBSET WITH PLUS SIGN BELOW
1372         m_aMirrorMap[ 0x2AC0 ] = 0x2ABF; // SUPERSET WITH PLUS SIGN BELOW
1373         m_aMirrorMap[ 0x2AC1 ] = 0x2AC2; // SUBSET WITH MULTIPLICATION SIGN BELOW
1374         m_aMirrorMap[ 0x2AC2 ] = 0x2AC1; // SUPERSET WITH MULTIPLICATION SIGN BELOW
1375         m_aMirrorMap[ 0x2AC3 ] = 0x2AC4; // SUBSET OF OR EQUAL TO WITH DOT ABOVE
1376         m_aMirrorMap[ 0x2AC4 ] = 0x2AC3; // SUPERSET OF OR EQUAL TO WITH DOT ABOVE
1377         m_aMirrorMap[ 0x2AC5 ] = 0x2AC6; // SUBSET OF ABOVE EQUALS SIGN
1378         m_aMirrorMap[ 0x2AC6 ] = 0x2AC5; // SUPERSET OF ABOVE EQUALS SIGN
1379         m_aMirrorMap[ 0x2ACD ] = 0x2ACE; // SQUARE LEFT OPEN BOX OPERATOR
1380         m_aMirrorMap[ 0x2ACE ] = 0x2ACD; // SQUARE RIGHT OPEN BOX OPERATOR
1381         m_aMirrorMap[ 0x2ACF ] = 0x2AD0; // CLOSED SUBSET
1382         m_aMirrorMap[ 0x2AD0 ] = 0x2ACF; // CLOSED SUPERSET
1383         m_aMirrorMap[ 0x2AD1 ] = 0x2AD2; // CLOSED SUBSET OR EQUAL TO
1384         m_aMirrorMap[ 0x2AD2 ] = 0x2AD1; // CLOSED SUPERSET OR EQUAL TO
1385         m_aMirrorMap[ 0x2AD3 ] = 0x2AD4; // SUBSET ABOVE SUPERSET
1386         m_aMirrorMap[ 0x2AD4 ] = 0x2AD3; // SUPERSET ABOVE SUBSET
1387         m_aMirrorMap[ 0x2AD5 ] = 0x2AD6; // SUBSET ABOVE SUBSET
1388         m_aMirrorMap[ 0x2AD6 ] = 0x2AD5; // SUPERSET ABOVE SUPERSET
1389         m_aMirrorMap[ 0x2ADE ] = 0x22A6; // SHORT LEFT TACK
1390         m_aMirrorMap[ 0x2AE3 ] = 0x22A9; // DOUBLE VERTICAL BAR LEFT TURNSTILE
1391         m_aMirrorMap[ 0x2AE4 ] = 0x22A8; // VERTICAL BAR DOUBLE LEFT TURNSTILE
1392         m_aMirrorMap[ 0x2AE5 ] = 0x22AB; // DOUBLE VERTICAL BAR DOUBLE LEFT TURNSTILE
1393         m_aMirrorMap[ 0x2AEC ] = 0x2AED; // DOUBLE STROKE NOT SIGN
1394         m_aMirrorMap[ 0x2AED ] = 0x2AEC; // REVERSED DOUBLE STROKE NOT SIGN
1395         m_aMirrorMap[ 0x2AF7 ] = 0x2AF8; // TRIPLE NESTED LESS-THAN
1396         m_aMirrorMap[ 0x2AF8 ] = 0x2AF7; // TRIPLE NESTED GREATER-THAN
1397         m_aMirrorMap[ 0x2AF9 ] = 0x2AFA; // DOUBLE-LINE SLANTED LESS-THAN OR EQUAL TO
1398         m_aMirrorMap[ 0x2AFA ] = 0x2AF9; // DOUBLE-LINE SLANTED GREATER-THAN OR EQUAL TO
1399         m_aMirrorMap[ 0x2E02 ] = 0x2E03; // LEFT SUBSTITUTION BRACKET
1400         m_aMirrorMap[ 0x2E03 ] = 0x2E02; // RIGHT SUBSTITUTION BRACKET
1401         m_aMirrorMap[ 0x2E04 ] = 0x2E05; // LEFT DOTTED SUBSTITUTION BRACKET
1402         m_aMirrorMap[ 0x2E05 ] = 0x2E04; // RIGHT DOTTED SUBSTITUTION BRACKET
1403         m_aMirrorMap[ 0x2E09 ] = 0x2E0A; // LEFT TRANSPOSITION BRACKET
1404         m_aMirrorMap[ 0x2E0A ] = 0x2E09; // RIGHT TRANSPOSITION BRACKET
1405         m_aMirrorMap[ 0x2E0C ] = 0x2E0D; // LEFT RAISED OMISSION BRACKET
1406         m_aMirrorMap[ 0x2E0D ] = 0x2E0C; // RIGHT RAISED OMISSION BRACKET
1407         m_aMirrorMap[ 0x2E1C ] = 0x2E1D; // LEFT LOW PARAPHRASE BRACKET
1408         m_aMirrorMap[ 0x2E1D ] = 0x2E1C; // RIGHT LOW PARAPHRASE BRACKET
1409         m_aMirrorMap[ 0x2E20 ] = 0x2E21; // LEFT VERTICAL BAR WITH QUILL
1410         m_aMirrorMap[ 0x2E21 ] = 0x2E20; // RIGHT VERTICAL BAR WITH QUILL
1411         m_aMirrorMap[ 0x2E22 ] = 0x2E23; // TOP LEFT HALF BRACKET
1412         m_aMirrorMap[ 0x2E23 ] = 0x2E22; // TOP RIGHT HALF BRACKET
1413         m_aMirrorMap[ 0x2E24 ] = 0x2E25; // BOTTOM LEFT HALF BRACKET
1414         m_aMirrorMap[ 0x2E25 ] = 0x2E24; // BOTTOM RIGHT HALF BRACKET
1415         m_aMirrorMap[ 0x2E26 ] = 0x2E27; // LEFT SIDEWAYS U BRACKET
1416         m_aMirrorMap[ 0x2E27 ] = 0x2E26; // RIGHT SIDEWAYS U BRACKET
1417         m_aMirrorMap[ 0x2E28 ] = 0x2E29; // LEFT DOUBLE PARENTHESIS
1418         m_aMirrorMap[ 0x2E29 ] = 0x2E28; // RIGHT DOUBLE PARENTHESIS
1419         m_aMirrorMap[ 0x3008 ] = 0x3009; // LEFT ANGLE BRACKET
1420         m_aMirrorMap[ 0x3009 ] = 0x3008; // RIGHT ANGLE BRACKET
1421         m_aMirrorMap[ 0x300A ] = 0x300B; // LEFT DOUBLE ANGLE BRACKET
1422         m_aMirrorMap[ 0x300B ] = 0x300A; // RIGHT DOUBLE ANGLE BRACKET
1423         m_aMirrorMap[ 0x300C ] = 0x300D; // [BEST FIT] LEFT CORNER BRACKET
1424         m_aMirrorMap[ 0x300D ] = 0x300C; // [BEST FIT] RIGHT CORNER BRACKET
1425         m_aMirrorMap[ 0x300E ] = 0x300F; // [BEST FIT] LEFT WHITE CORNER BRACKET
1426         m_aMirrorMap[ 0x300F ] = 0x300E; // [BEST FIT] RIGHT WHITE CORNER BRACKET
1427         m_aMirrorMap[ 0x3010 ] = 0x3011; // LEFT BLACK LENTICULAR BRACKET
1428         m_aMirrorMap[ 0x3011 ] = 0x3010; // RIGHT BLACK LENTICULAR BRACKET
1429         m_aMirrorMap[ 0x3014 ] = 0x3015; // LEFT TORTOISE SHELL BRACKET
1430         m_aMirrorMap[ 0x3015 ] = 0x3014; // RIGHT TORTOISE SHELL BRACKET
1431         m_aMirrorMap[ 0x3016 ] = 0x3017; // LEFT WHITE LENTICULAR BRACKET
1432         m_aMirrorMap[ 0x3017 ] = 0x3016; // RIGHT WHITE LENTICULAR BRACKET
1433         m_aMirrorMap[ 0x3018 ] = 0x3019; // LEFT WHITE TORTOISE SHELL BRACKET
1434         m_aMirrorMap[ 0x3019 ] = 0x3018; // RIGHT WHITE TORTOISE SHELL BRACKET
1435         m_aMirrorMap[ 0x301A ] = 0x301B; // LEFT WHITE SQUARE BRACKET
1436         m_aMirrorMap[ 0x301B ] = 0x301A; // RIGHT WHITE SQUARE BRACKET
1437         m_aMirrorMap[ 0xFE59 ] = 0xFE5A; // SMALL LEFT PARENTHESIS
1438         m_aMirrorMap[ 0xFE5A ] = 0xFE59; // SMALL RIGHT PARENTHESIS
1439         m_aMirrorMap[ 0xFE5B ] = 0xFE5C; // SMALL LEFT CURLY BRACKET
1440         m_aMirrorMap[ 0xFE5C ] = 0xFE5B; // SMALL RIGHT CURLY BRACKET
1441         m_aMirrorMap[ 0xFE5D ] = 0xFE5E; // SMALL LEFT TORTOISE SHELL BRACKET
1442         m_aMirrorMap[ 0xFE5E ] = 0xFE5D; // SMALL RIGHT TORTOISE SHELL BRACKET
1443         m_aMirrorMap[ 0xFE64 ] = 0xFE65; // SMALL LESS-THAN SIGN
1444         m_aMirrorMap[ 0xFE65 ] = 0xFE64; // SMALL GREATER-THAN SIGN
1445         m_aMirrorMap[ 0xFF08 ] = 0xFF09; // FULLWIDTH LEFT PARENTHESIS
1446         m_aMirrorMap[ 0xFF09 ] = 0xFF08; // FULLWIDTH RIGHT PARENTHESIS
1447         m_aMirrorMap[ 0xFF1C ] = 0xFF1E; // FULLWIDTH LESS-THAN SIGN
1448         m_aMirrorMap[ 0xFF1E ] = 0xFF1C; // FULLWIDTH GREATER-THAN SIGN
1449         m_aMirrorMap[ 0xFF3B ] = 0xFF3D; // FULLWIDTH LEFT SQUARE BRACKET
1450         m_aMirrorMap[ 0xFF3D ] = 0xFF3B; // FULLWIDTH RIGHT SQUARE BRACKET
1451         m_aMirrorMap[ 0xFF5B ] = 0xFF5D; // FULLWIDTH LEFT CURLY BRACKET
1452         m_aMirrorMap[ 0xFF5D ] = 0xFF5B; // FULLWIDTH RIGHT CURLY BRACKET
1453         m_aMirrorMap[ 0xFF5F ] = 0xFF60; // FULLWIDTH LEFT WHITE PARENTHESIS
1454         m_aMirrorMap[ 0xFF60 ] = 0xFF5F; // FULLWIDTH RIGHT WHITE PARENTHESIS
1455         m_aMirrorMap[ 0xFF62 ] = 0xFF63; // [BEST FIT] HALFWIDTH LEFT CORNER BRACKET
1456         m_aMirrorMap[ 0xFF63 ] = 0xFF62; // [BEST FIT] HALFWIDTH RIGHT CORNER BRACKET
1457     }
1458 }
1459 
1460 }
1461