LCOV - code coverage report
Current view: top level - filter/source/msfilter - util.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 173 333 52.0 %
Date: 2014-04-11 Functions: 16 20 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <rtl/ustring.hxx>
      11             : #include <rtl/strbuf.hxx>
      12             : #include <unotools/fontcvt.hxx>
      13             : #include <unotools/fontdefs.hxx>
      14             : #include <vcl/svapp.hxx>
      15             : #include <filter/msfilter/util.hxx>
      16             : #include <boost/unordered_map.hpp>
      17             : 
      18             : namespace msfilter {
      19             : namespace util {
      20             : 
      21        3141 : rtl_TextEncoding getBestTextEncodingFromLocale(const ::com::sun::star::lang::Locale &rLocale)
      22             : {
      23             :     // Obviously not comprehensive, feel free to expand these, they're for ultimate fallbacks
      24             :     // in last-ditch broken-file-format cases to guess the right 8bit encodings
      25        3141 :     const OUString &rLanguage = rLocale.Language;
      26        3141 :     if (rLanguage == "cs" || rLanguage == "hu" || rLanguage == "pl")
      27           0 :         return RTL_TEXTENCODING_MS_1250;
      28        3141 :     if (rLanguage == "ru" || rLanguage == "uk")
      29           1 :         return RTL_TEXTENCODING_MS_1251;
      30        3140 :     if (rLanguage == "el")
      31           0 :         return RTL_TEXTENCODING_MS_1253;
      32        3140 :     if (rLanguage == "tr")
      33           0 :         return RTL_TEXTENCODING_MS_1254;
      34        3140 :     if (rLanguage == "lt")
      35           1 :         return RTL_TEXTENCODING_MS_1257;
      36        3139 :     return RTL_TEXTENCODING_MS_1252;
      37             : }
      38             : 
      39        9608 : sal_uInt32 BGRToRGB(sal_uInt32 nColor)
      40             : {
      41             :     sal_uInt8
      42        9608 :         r(static_cast<sal_uInt8>(nColor&0xFF)),
      43        9608 :         g(static_cast<sal_uInt8>(((nColor)>>8)&0xFF)),
      44        9608 :         b(static_cast<sal_uInt8>((nColor>>16)&0xFF)),
      45        9608 :         t(static_cast<sal_uInt8>((nColor>>24)&0xFF));
      46        9608 :     nColor = (t<<24) + (r<<16) + (g<<8) + b;
      47        9608 :     return nColor;
      48             : }
      49             : 
      50          94 : DateTime DTTM2DateTime( long lDTTM )
      51             : {
      52             :     /*
      53             :     mint    short   :6  0000003F    minutes (0-59)
      54             :     hr      short   :5  000007C0    hours (0-23)
      55             :     dom     short   :5  0000F800    days of month (1-31)
      56             :     mon     short   :4  000F0000    months (1-12)
      57             :     yr      short   :9  1FF00000    years (1900-2411)-1900
      58             :     wdy     short   :3  E0000000    weekday(Sunday=0
      59             :                                             Monday=1
      60             :     ( wdy can be ignored )                  Tuesday=2
      61             :                                             Wednesday=3
      62             :                                             Thursday=4
      63             :                                             Friday=5
      64             :                                             Saturday=6)
      65             :     */
      66          94 :     DateTime aDateTime(Date( 0 ), Time( 0 ));
      67          94 :     if( lDTTM )
      68             :     {
      69          29 :         sal_uInt16 lMin = (sal_uInt16)(lDTTM & 0x0000003F);
      70          29 :         lDTTM >>= 6;
      71          29 :         sal_uInt16 lHour= (sal_uInt16)(lDTTM & 0x0000001F);
      72          29 :         lDTTM >>= 5;
      73          29 :         sal_uInt16 lDay = (sal_uInt16)(lDTTM & 0x0000001F);
      74          29 :         lDTTM >>= 5;
      75          29 :         sal_uInt16 lMon = (sal_uInt16)(lDTTM & 0x0000000F);
      76          29 :         lDTTM >>= 4;
      77          29 :         sal_uInt16 lYear= (sal_uInt16)(lDTTM & 0x000001FF) + 1900;
      78          29 :         aDateTime = DateTime(Date(lDay, lMon, lYear), Time(lHour, lMin));
      79             :     }
      80          94 :     return aDateTime;
      81             : }
      82             : 
      83          28 : sal_Unicode bestFitOpenSymbolToMSFont(sal_Unicode cChar,
      84             :     rtl_TextEncoding& rChrSet, OUString& rFontName, bool bDisableUnicodeSupport)
      85             : {
      86          28 :     StarSymbolToMSMultiFont *pConvert = CreateStarSymbolToMSMultiFont();
      87          28 :     OUString sFont = pConvert->ConvertChar(cChar);
      88          28 :     delete pConvert;
      89          28 :     if (!sFont.isEmpty())
      90             :     {
      91          28 :         cChar = static_cast< sal_Unicode >(cChar | 0xF000);
      92          28 :         rFontName = sFont;
      93          28 :         rChrSet = RTL_TEXTENCODING_SYMBOL;
      94             :     }
      95           0 :     else if (!bDisableUnicodeSupport && (cChar < 0xE000 || cChar > 0xF8FF))
      96             :     {
      97             :         /*
      98             :           Ok we can't fit into a known windows unicode font, but
      99             :           we are not in the private area, so we are a
     100             :           standardized symbol, so turn off the symbol bit and
     101             :           let words own font substitution kick in
     102             :         */
     103           0 :         rChrSet = RTL_TEXTENCODING_UNICODE;
     104           0 :         sal_Int32 nIndex = 0;
     105           0 :         rFontName = ::GetNextFontToken(rFontName, nIndex);
     106             :     }
     107             :     else
     108             :     {
     109             :         /*
     110             :           Well we don't have an available substition, and we're
     111             :           in our private area, so give up and show a standard
     112             :           bullet symbol
     113             :         */
     114           0 :         rFontName = "Wingdings";
     115           0 :         cChar = static_cast< sal_Unicode >(0x6C);
     116             :     }
     117          28 :     return cChar;
     118             : }
     119             : 
     120             : /*
     121             :   http://social.msdn.microsoft.com/Forums/hu-HU/os_openXML-ecma/thread/1bf1f185-ee49-4314-94e7-f4e1563b5c00
     122             : 
     123             :   The following information is being submitted to the standards working group as
     124             :   a proposed resolution to a defect report and is not yet part of ISO 29500-1.
     125             :   ...
     126             :   For each Unicode character in DrawingML text, the font face can be any of four
     127             :   font "slots": latin ($21.1.2.3.7), cs ($21.1.2.3.1), ea ($21.1.2.3.3), or sym
     128             :   ($21.1.2.3.10), as specified in the following table. For all ranges not
     129             :   explicitly called out below, the ea font shall be used.
     130             : 
     131             :   U+0000-U+007F Use latin font
     132             :   U+0080-U+00A6 Use latin font
     133             :   U+00A9-U+00AF Use latin font
     134             :   U+00B2-U+00B3 Use latin font
     135             :   U+00B5-U+00D6 Use latin font
     136             :   U+00D8-U+00F6 Use latin font
     137             :   U+00F8-U+058F Use latin font
     138             :   U+0590-U+074F Use cs font
     139             :   U+0780-U+07BF Use cs font
     140             :   U+0900-U+109F Use cs font
     141             :   U+10A0-U+10FF Use latin font
     142             :   U+1200-U+137F Use latin font
     143             :   U+13A0-U+177F Use latin font
     144             :   U+1D00-U+1D7F Use latin font
     145             :   U+1E00-U+1FFF Use latin font
     146             :   U+1780-U+18AF Use cs font
     147             :   U+2000-U+200B Use latin font
     148             :   U+200C-U+200F Use cs font
     149             :   U+2010-U+2029 Use latin font Except, for the quote characters in the range
     150             :     2018 - 201E, use ea font if the text has one of the following language
     151             :     identifiers: ii-CN, ja-JP, ko-KR, zh-CN, zh-HK, zh-MO, zh-SG, zh-TW.
     152             :   U+202A-U+202F Use cs font
     153             :   U+2030-U+2046 Use latin font
     154             :   U+204A-U+245F Use latin font
     155             :   U+2670-U+2671 Use cs font
     156             :   U+27C0-U+2BFF Use latin font
     157             :   U+3099-U+309A Use ea font
     158             :   U+D835 Use latin font
     159             :   U+F000-U+F0FF Symbol, use sym font
     160             :   U+FB00-U+FB17 Use latin font
     161             :   U+FB1D-U+FB4F Use cs font
     162             :   U+FE50-U+FE6F Use latin font
     163             :   Otherwise Use ea font
     164             : */
     165           0 : TextCategory categorizeCodePoint(sal_uInt32 codePoint, const OUString &rBcp47LanguageTag)
     166             : {
     167           0 :     TextCategory eRet = ea;
     168           0 :     if (codePoint <= 0x007F)
     169           0 :         eRet = latin;
     170           0 :     else if (0x0080 <= codePoint && codePoint <= 0x00A6)
     171           0 :         eRet = latin;
     172           0 :     else if (0x00A9 <= codePoint && codePoint <= 0x00AF)
     173           0 :         eRet = latin;
     174           0 :     else if (0x00B2 <= codePoint && codePoint <= 0x00B3)
     175           0 :         eRet = latin;
     176           0 :     else if (0x00B5 <= codePoint && codePoint <= 0x00D6)
     177           0 :         eRet = latin;
     178           0 :     else if (0x00D8 <= codePoint && codePoint <= 0x00F6)
     179           0 :         eRet = latin;
     180           0 :     else if (0x00F8 <= codePoint && codePoint <= 0x058F)
     181           0 :         eRet = latin;
     182           0 :     else if (0x0590 <= codePoint && codePoint <= 0x074F)
     183           0 :         eRet = cs;
     184           0 :     else if (0x0780 <= codePoint && codePoint <= 0x07BF)
     185           0 :         eRet = cs;
     186           0 :     else if (0x0900 <= codePoint && codePoint <= 0x109F)
     187           0 :         eRet = cs;
     188           0 :     else if (0x10A0 <= codePoint && codePoint <= 0x10FF)
     189           0 :         eRet = latin;
     190           0 :     else if (0x1200 <= codePoint && codePoint <= 0x137F)
     191           0 :         eRet = latin;
     192           0 :     else if (0x13A0 <= codePoint && codePoint <= 0x177F)
     193           0 :         eRet = latin;
     194           0 :     else if (0x1D00 <= codePoint && codePoint <= 0x1D7F)
     195           0 :         eRet = latin;
     196           0 :     else if (0x1E00 <= codePoint && codePoint <= 0x1FFF)
     197           0 :         eRet = latin;
     198           0 :     else if (0x1780 <= codePoint && codePoint <= 0x18AF)
     199           0 :         eRet = cs;
     200           0 :     else if (0x2000 <= codePoint && codePoint <= 0x200B)
     201           0 :         eRet = latin;
     202           0 :     else if (0x200C <= codePoint && codePoint <= 0x200F)
     203           0 :         eRet = cs;
     204           0 :     else if (0x2010 <= codePoint && codePoint <= 0x2029)
     205             :     {
     206           0 :         eRet = latin;
     207           0 :         if (0x2018 <= codePoint && codePoint <= 0x201E)
     208             :         {
     209           0 :             if (rBcp47LanguageTag == "ii-CN" ||
     210           0 :                 rBcp47LanguageTag == "ja-JP" ||
     211           0 :                 rBcp47LanguageTag == "ko-KR" ||
     212           0 :                 rBcp47LanguageTag == "zh-CN" ||
     213           0 :                 rBcp47LanguageTag == "zh-HK" ||
     214           0 :                 rBcp47LanguageTag == "zh-MO" ||
     215           0 :                 rBcp47LanguageTag == "zh-SG" ||
     216           0 :                 rBcp47LanguageTag == "zh-TW")
     217             :             {
     218           0 :                 eRet = ea;
     219             :             }
     220             :         }
     221             :     }
     222           0 :     else if (0x202A <= codePoint && codePoint <= 0x202F)
     223           0 :         eRet = cs;
     224           0 :     else if (0x2030 <= codePoint && codePoint <= 0x2046)
     225           0 :         eRet = latin;
     226           0 :     else if (0x204A <= codePoint && codePoint <= 0x245F)
     227           0 :         eRet = latin;
     228           0 :     else if (0x2670 <= codePoint && codePoint <= 0x2671)
     229           0 :         eRet = latin;
     230           0 :     else if (0x27C0 <= codePoint && codePoint <= 0x2BFF)
     231           0 :         eRet = latin;
     232           0 :     else if (0x3099 <= codePoint && codePoint <= 0x309A)
     233           0 :         eRet = ea;
     234           0 :     else if (0xD835 == codePoint)
     235           0 :         eRet = latin;
     236           0 :     else if (0xF000 <= codePoint && codePoint <= 0xF0FF)
     237           0 :         eRet = sym;
     238           0 :     else if (0xFB00 <= codePoint && codePoint <= 0xFB17)
     239           0 :         eRet = latin;
     240           0 :     else if (0xFB1D <= codePoint && codePoint <= 0xFB4F)
     241           0 :         eRet = cs;
     242           0 :     else if (0xFE50 <= codePoint && codePoint <= 0xFE6F)
     243           0 :         eRet = latin;
     244           0 :     return eRet;
     245             : }
     246             : 
     247       40828 : OString ConvertColor( const Color &rColor, bool bAutoColor )
     248             : {
     249       40828 :     OString color( "auto" );
     250             : 
     251       40828 :     if (bAutoColor && rColor.GetColor() == OOXML_COLOR_AUTO)
     252       10973 :         return color;
     253             : 
     254       29855 :     if ( rColor.GetColor() != COL_AUTO )
     255             :     {
     256       28266 :         const char pHexDigits[] = "0123456789ABCDEF";
     257       28266 :         char pBuffer[] = "000000";
     258             : 
     259       28266 :         pBuffer[0] = pHexDigits[ ( rColor.GetRed()   >> 4 ) & 0x0F ];
     260       28266 :         pBuffer[1] = pHexDigits[   rColor.GetRed()          & 0x0F ];
     261       28266 :         pBuffer[2] = pHexDigits[ ( rColor.GetGreen() >> 4 ) & 0x0F ];
     262       28266 :         pBuffer[3] = pHexDigits[   rColor.GetGreen()        & 0x0F ];
     263       28266 :         pBuffer[4] = pHexDigits[ ( rColor.GetBlue()  >> 4 ) & 0x0F ];
     264       28266 :         pBuffer[5] = pHexDigits[   rColor.GetBlue()         & 0x0F ];
     265             : 
     266       28266 :         color = OString( pBuffer );
     267             :     }
     268       29855 :     return color;
     269             : }
     270             : 
     271             : #define IN2MM100( v )    static_cast< sal_Int32 >( (v) * 2540.0 + 0.5 )
     272             : #define MM2MM100( v )    static_cast< sal_Int32 >( (v) * 100.0 + 0.5 )
     273             : 
     274             : static const ApiPaperSize spPaperSizeTable[] =
     275             : {
     276             :     { 0, 0 },                                                //  0 - (undefined)
     277             :     { IN2MM100( 8.5 ),       IN2MM100( 11 )      },          //  1 - Letter paper
     278             :     { IN2MM100( 8.5 ),       IN2MM100( 11 )      },          //  2 - Letter small paper
     279             :     { IN2MM100( 11 ),        IN2MM100( 17 )      },          //  3 - Tabloid paper
     280             :     { IN2MM100( 17 ),        IN2MM100( 11 )      },          //  4 - Ledger paper
     281             :     { IN2MM100( 8.5 ),       IN2MM100( 14 )      },          //  5 - Legal paper
     282             :     { IN2MM100( 5.5 ),       IN2MM100( 8.5 )     },          //  6 - Statement paper
     283             :     { IN2MM100( 7.25 ),      IN2MM100( 10.5 )    },          //  7 - Executive paper
     284             :     { MM2MM100( 297 ),       MM2MM100( 420 )     },          //  8 - A3 paper
     285             :     { MM2MM100( 210 ),       MM2MM100( 297 )     },          //  9 - A4 paper
     286             :     { MM2MM100( 210 ),       MM2MM100( 297 )     },          // 10 - A4 small paper
     287             :     { MM2MM100( 148 ),       MM2MM100( 210 )     },          // 11 - A5 paper
     288             :     { MM2MM100( 250 ),       MM2MM100( 353 )     },          // 12 - B4 paper
     289             :     { MM2MM100( 176 ),       MM2MM100( 250 )     },          // 13 - B5 paper
     290             :     { IN2MM100( 8.5 ),       IN2MM100( 13 )      },          // 14 - Folio paper
     291             :     { MM2MM100( 215 ),       MM2MM100( 275 )     },          // 15 - Quarto paper
     292             :     { IN2MM100( 10 ),        IN2MM100( 14 )      },          // 16 - Standard paper
     293             :     { IN2MM100( 11 ),        IN2MM100( 17 )      },          // 17 - Standard paper
     294             :     { IN2MM100( 8.5 ),       IN2MM100( 11 )      },          // 18 - Note paper
     295             :     { IN2MM100( 3.875 ),     IN2MM100( 8.875 )   },          // 19 - #9 envelope
     296             :     { IN2MM100( 4.125 ),     IN2MM100( 9.5 )     },          // 20 - #10 envelope
     297             :     { IN2MM100( 4.5 ),       IN2MM100( 10.375 )  },          // 21 - #11 envelope
     298             :     { IN2MM100( 4.75 ),      IN2MM100( 11 )      },          // 22 - #12 envelope
     299             :     { IN2MM100( 5 ),         IN2MM100( 11.5 )    },          // 23 - #14 envelope
     300             :     { IN2MM100( 17 ),        IN2MM100( 22 )      },          // 24 - C paper
     301             :     { IN2MM100( 22 ),        IN2MM100( 34 )      },          // 25 - D paper
     302             :     { IN2MM100( 34 ),        IN2MM100( 44 )      },          // 26 - E paper
     303             :     { MM2MM100( 110 ),       MM2MM100( 220 )     },          // 27 - DL envelope
     304             :     { MM2MM100( 162 ),       MM2MM100( 229 )     },          // 28 - C5 envelope
     305             :     { MM2MM100( 324 ),       MM2MM100( 458 )     },          // 29 - C3 envelope
     306             :     { MM2MM100( 229 ),       MM2MM100( 324 )     },          // 30 - C4 envelope
     307             :     { MM2MM100( 114 ),       MM2MM100( 162 )     },          // 31 - C6 envelope
     308             :     { MM2MM100( 114 ),       MM2MM100( 229 )     },          // 32 - C65 envelope
     309             :     { MM2MM100( 250 ),       MM2MM100( 353 )     },          // 33 - B4 envelope
     310             :     { MM2MM100( 176 ),       MM2MM100( 250 )     },          // 34 - B5 envelope
     311             :     { MM2MM100( 176 ),       MM2MM100( 125 )     },          // 35 - B6 envelope
     312             :     { MM2MM100( 110 ),       MM2MM100( 230 )     },          // 36 - Italy envelope
     313             :     { IN2MM100( 3.875 ),     IN2MM100( 7.5 )     },          // 37 - Monarch envelope
     314             :     { IN2MM100( 3.625 ),     IN2MM100( 6.5 )     },          // 38 - 6 3/4 envelope
     315             :     { IN2MM100( 14.875 ),    IN2MM100( 11 )      },          // 39 - US standard fanfold
     316             :     { IN2MM100( 8.5 ),       IN2MM100( 12 )      },          // 40 - German standard fanfold
     317             :     { IN2MM100( 8.5 ),       IN2MM100( 13 )      },          // 41 - German legal fanfold
     318             :     { MM2MM100( 250 ),       MM2MM100( 353 )     },          // 42 - ISO B4
     319             :     { MM2MM100( 200 ),       MM2MM100( 148 )     },          // 43 - Japanese double postcard
     320             :     { IN2MM100( 9 ),         IN2MM100( 11 )      },          // 44 - Standard paper
     321             :     { IN2MM100( 10 ),        IN2MM100( 11 )      },          // 45 - Standard paper
     322             :     { IN2MM100( 15 ),        IN2MM100( 11 )      },          // 46 - Standard paper
     323             :     { MM2MM100( 220 ),       MM2MM100( 220 )     },          // 47 - Invite envelope
     324             :     { 0, 0 },                                                // 48 - (undefined)
     325             :     { 0, 0 },                                                // 49 - (undefined)
     326             :     { IN2MM100( 9.275 ),     IN2MM100( 12 )      },          // 50 - Letter extra paper
     327             :     { IN2MM100( 9.275 ),     IN2MM100( 15 )      },          // 51 - Legal extra paper
     328             :     { IN2MM100( 11.69 ),     IN2MM100( 18 )      },          // 52 - Tabloid extra paper
     329             :     { MM2MM100( 236 ),       MM2MM100( 322 )     },          // 53 - A4 extra paper
     330             :     { IN2MM100( 8.275 ),     IN2MM100( 11 )      },          // 54 - Letter transverse paper
     331             :     { MM2MM100( 210 ),       MM2MM100( 297 )     },          // 55 - A4 transverse paper
     332             :     { IN2MM100( 9.275 ),     IN2MM100( 12 )      },          // 56 - Letter extra transverse paper
     333             :     { MM2MM100( 227 ),       MM2MM100( 356 )     },          // 57 - SuperA/SuperA/A4 paper
     334             :     { MM2MM100( 305 ),       MM2MM100( 487 )     },          // 58 - SuperB/SuperB/A3 paper
     335             :     { IN2MM100( 8.5 ),       IN2MM100( 12.69 )   },          // 59 - Letter plus paper
     336             :     { MM2MM100( 210 ),       MM2MM100( 330 )     },          // 60 - A4 plus paper
     337             :     { MM2MM100( 148 ),       MM2MM100( 210 )     },          // 61 - A5 transverse paper
     338             :     { MM2MM100( 182 ),       MM2MM100( 257 )     },          // 62 - JIS B5 transverse paper
     339             :     { MM2MM100( 322 ),       MM2MM100( 445 )     },          // 63 - A3 extra paper
     340             :     { MM2MM100( 174 ),       MM2MM100( 235 )     },          // 64 - A5 extra paper
     341             :     { MM2MM100( 201 ),       MM2MM100( 276 )     },          // 65 - ISO B5 extra paper
     342             :     { MM2MM100( 420 ),       MM2MM100( 594 )     },          // 66 - A2 paper
     343             :     { MM2MM100( 297 ),       MM2MM100( 420 )     },          // 67 - A3 transverse paper
     344             :     { MM2MM100( 322 ),       MM2MM100( 445 )     }           // 68 - A3 extra transverse paper
     345             : };
     346             : 
     347           2 : sal_Int32 PaperSizeConv::getMSPaperSizeIndex( const com::sun::star::awt::Size& rSize )
     348             : {
     349           2 :     sal_Int32 nElems = SAL_N_ELEMENTS( spPaperSizeTable );
     350             :     // Need to find the best match for current size
     351           2 :     sal_Int32 nDeltaWidth = 0;
     352           2 :     sal_Int32 nDeltaHeight = 0;
     353             : 
     354           2 :     sal_Int32 nPaperSizeIndex = 0; // Undefined
     355           2 :     const ApiPaperSize* pItem = spPaperSizeTable;
     356           2 :     const ApiPaperSize* pEnd =  spPaperSizeTable + nElems;
     357         140 :     for ( ; pItem != pEnd; ++pItem )
     358             :     {
     359         138 :         sal_Int32 nCurDeltaHeight = std::abs( pItem->mnHeight - rSize.Height );
     360         138 :         sal_Int32 nCurDeltaWidth = std::abs( pItem->mnWidth - rSize.Width );
     361         138 :         if ( pItem == spPaperSizeTable ) // initialize delta with first item
     362             :         {
     363           2 :             nDeltaWidth = nCurDeltaWidth;
     364           2 :             nDeltaHeight = nCurDeltaHeight;
     365             :         }
     366             :         else
     367             :         {
     368         136 :             if ( nCurDeltaWidth < nDeltaWidth && nCurDeltaHeight < nDeltaHeight )
     369             :             {
     370           3 :                 nDeltaWidth = nCurDeltaWidth;
     371           3 :                 nDeltaHeight = nCurDeltaHeight;
     372           3 :                 nPaperSizeIndex = (pItem - spPaperSizeTable);
     373             :             }
     374             :         }
     375             :     }
     376           2 :     sal_Int32 nTol = 10; // hmm not sure is this the best way
     377           2 :     if ( nDeltaWidth <= nTol && nDeltaHeight <= nTol )
     378           2 :         return nPaperSizeIndex;
     379           0 :     return 0;
     380             : }
     381             : 
     382          52 : const ApiPaperSize& PaperSizeConv::getApiSizeForMSPaperSizeIndex( sal_Int32 nMSOPaperIndex )
     383             : {
     384          52 :     sal_Int32 nElems = SAL_N_ELEMENTS( spPaperSizeTable );
     385          52 :     if ( nMSOPaperIndex  < 0 || nMSOPaperIndex > nElems - 1 )
     386           0 :         return spPaperSizeTable[ 0 ];
     387          52 :     return spPaperSizeTable[ nMSOPaperIndex ];
     388             : }
     389             : 
     390         284 : OUString findQuotedText( const OUString& rCommand,
     391             :                 const sal_Char* cStartQuote, const sal_Unicode uEndQuote )
     392             : {
     393         284 :     OUString sRet;
     394         568 :     OUString sStartQuote( OUString::createFromAscii(cStartQuote) );
     395         284 :     sal_Int32 nStartIndex = rCommand.indexOf( sStartQuote );
     396         284 :     if( nStartIndex >= 0 )
     397             :     {
     398         174 :         sal_Int32 nStartLength = sStartQuote.getLength();
     399         174 :         sal_Int32 nEndIndex = rCommand.indexOf( uEndQuote, nStartIndex + nStartLength);
     400         174 :         if( nEndIndex > nStartIndex )
     401             :         {
     402         172 :             sRet = rCommand.copy( nStartIndex + nStartLength, nEndIndex - nStartIndex - nStartLength);
     403             :         }
     404             :     }
     405         568 :     return sRet;
     406             : 
     407             : }
     408             : 
     409          12 : WW8ReadFieldParams::WW8ReadFieldParams( const OUString& _rData )
     410             :     : aData( _rData )
     411             :     , nFnd( 0 )
     412             :     , nNext( 0 )
     413          12 :     , nSavPtr( 0 )
     414             : {
     415             : 
     416             :     /*
     417             :         First look for an opening bracket or a space or a quatation mark or a backslash, so that the field (i.e. INCLUDEPICTURE or EINFUEGENGRAFIK or...) gets oread over
     418             :     */
     419          12 :     const sal_Int32 nLen = aData.getLength();
     420             : 
     421          34 :     while ( nNext<nLen && aData[nNext]==' ' )
     422          10 :         ++nNext;
     423             : 
     424         135 :     while ( nNext<nLen )
     425             :     {
     426         122 :         const sal_Unicode c = aData[nNext];
     427         122 :         if ( c==' ' || c=='"' || c=='\\' || c==132 || c==0x201c )
     428             :             break;
     429         111 :         ++nNext;
     430             :     }
     431             : 
     432          12 :     nFnd      = nNext;
     433          12 :     nSavPtr   = nNext;
     434          12 : }
     435             : 
     436             : 
     437          12 : WW8ReadFieldParams::~WW8ReadFieldParams()
     438             : {
     439             : 
     440          12 : }
     441             : 
     442             : 
     443          10 : OUString WW8ReadFieldParams::GetResult() const
     444             : {
     445          10 :     if (nFnd<0 && nSavPtr>nFnd)
     446           0 :         return OUString();
     447             :     else
     448             :     {
     449          10 :         return nSavPtr < nFnd ? aData.copy(nFnd) : aData.copy(nFnd, nSavPtr-nFnd);
     450             :     }
     451             : }
     452             : 
     453             : 
     454           0 : bool WW8ReadFieldParams::GoToTokenParam()
     455             : {
     456           0 :     const sal_Int32 nOld = nNext;
     457           0 :     if( -2 == SkipToNextToken() )
     458           0 :         return GetTokenSttPtr()>=0;
     459           0 :     nNext = nOld;
     460           0 :     return false;
     461             : }
     462             : 
     463             : // ret: -2: NOT a '\' parameter but normal text
     464          26 : sal_Int32 WW8ReadFieldParams::SkipToNextToken()
     465             : {
     466          26 :     if ( nNext<0 || nNext>=aData.getLength() )
     467           5 :         return -1;
     468             : 
     469          21 :     nFnd = FindNextStringPiece(nNext);
     470          21 :     if ( nFnd<0 )
     471           6 :         return -1;
     472             : 
     473          15 :     nSavPtr = nNext;
     474             : 
     475          15 :     if (nFnd+1<aData.getLength() && aData[nFnd+1]!='\\' && aData[nFnd]=='\\')
     476             :     {
     477           4 :         const sal_Int32 nRet = aData[++nFnd];
     478           4 :         nNext = ++nFnd;             // and set after
     479           4 :         return nRet;
     480             :     }
     481             : 
     482          11 :     if ( nSavPtr>0 && (aData[nSavPtr-1]=='"' || aData[nSavPtr-1]==0x201d ) )
     483             :     {
     484           5 :         --nSavPtr;
     485             :     }
     486          11 :     return -2;
     487             : }
     488             : 
     489             : // FindNextPara searches the next backslash parameter or the next string
     490             : // until the next blank or "\" or closing quatation mark
     491             : // or the end of the string of pStr.
     492             : //
     493             : // Output ppNext (if ppNext != 0) Suchbeginn fuer naechsten Parameter bzw. 0
     494             : //
     495             : // Return value: 0 if end of string reached,
     496             : //             ansonsten Anfang des Paramters bzw. der Zeichenkette
     497             : //
     498          21 : sal_Int32 WW8ReadFieldParams::FindNextStringPiece(const sal_Int32 nStart)
     499             : {
     500          21 :     const sal_Int32 nLen = aData.getLength();
     501          21 :     sal_Int32  n = nStart<0  ? nFnd : nStart;  // start
     502             :     sal_Int32 n2;          // end
     503             : 
     504          21 :     nNext = -1;        // if not found -> Default
     505             : 
     506          66 :     while ( n<nLen && aData[n]==' ' )
     507          24 :         ++n;
     508             : 
     509          21 :     if ( n==nLen )
     510           6 :         return -1;
     511             : 
     512          15 :     if ( aData[n]==0x13 )
     513             :     {
     514             :         // Skip the nested field code since it's not supported
     515           0 :         while ( n<nLen && aData[n]!=0x14 )
     516           0 :             ++n;
     517           0 :         if ( n==nLen )
     518           0 :             return -1;
     519             :     }
     520             : 
     521             :     // quotation marks before paragraph?
     522          15 :     if ( aData[n]=='"' || aData[n]==0x201c || aData[n]==132 || aData[n]==0x14 )
     523             :     {
     524           5 :         n++;                        // read over quatation marks
     525           5 :         n2 = n;                     // search for the end from here on
     526         141 :         while(     (nLen > n2)
     527         136 :                 && (aData[n2] != '"')
     528         131 :                 && (aData[n2] != 0x201d)
     529         131 :                 && (aData[n2] != 147)
     530         267 :                 && (aData[n2] != 0x15) )
     531         131 :             n2++;                   // search for the end of the paragraph
     532             :     }
     533             :     else                        // no quotation mark
     534             :     {
     535          10 :         n2 = n;                     // search for the end from here on
     536         112 :         while ( n2<nLen && aData[n2]!=' ' ) // search for the end of the paragraph
     537             :         {
     538          96 :             if ( aData[n2]=='\\' )
     539             :             {
     540           4 :                 if ( n2+1<nLen && aData[n2+1]=='\\' )
     541           0 :                     n2 += 2;        // double backslash -> OK
     542             :                 else
     543             :                 {
     544           4 :                     if( n2 > n )
     545           0 :                         n2--;
     546           4 :                     break;          // single backslash -> end
     547             :                 }
     548             :             }
     549             :             else
     550          92 :                 n2++;               // no backslash -> OK
     551             :         }
     552             :     }
     553          15 :     if( nLen > n2 )
     554             :     {
     555          14 :         if (aData[n2]!=' ') ++n2;
     556          14 :         nNext = n2;
     557             :     }
     558          15 :     return n;
     559             : }
     560             : 
     561             : 
     562             : 
     563             : // read parameters "1-3" or 1-3 with both values between 1 and nMax
     564           0 : bool WW8ReadFieldParams::GetTokenSttFromTo(sal_Int32* pFrom, sal_Int32* pTo, sal_Int32 nMax)
     565             : {
     566           0 :     sal_Int32 nStart = 0;
     567           0 :     sal_Int32 nEnd   = 0;
     568           0 :     if ( GoToTokenParam() )
     569             :     {
     570             : 
     571           0 :         const OUString sParams( GetResult() );
     572             : 
     573           0 :         sal_Int32 nIndex = 0;
     574           0 :         const OUString sStart( sParams.getToken(0, '-', nIndex) );
     575           0 :         if (nIndex>=0)
     576             :         {
     577           0 :             nStart = sStart.toInt32();
     578           0 :             nEnd   = sParams.copy(nIndex).toInt32();
     579           0 :         }
     580             :     }
     581           0 :     if( pFrom ) *pFrom = nStart;
     582           0 :     if( pTo )   *pTo   = nEnd;
     583             : 
     584           0 :     return nStart && nEnd && (nMax >= nStart) && (nMax >= nEnd);
     585             : }
     586             : 
     587           0 : EquationResult Read_SubF_Combined(WW8ReadFieldParams& rReadParam)
     588             : {
     589           0 :     EquationResult aResult;
     590             : 
     591           0 :     OUString sCombinedCharacters;
     592           0 :     WW8ReadFieldParams aOriFldParam = rReadParam;
     593           0 :     const sal_Int32 cGetChar = rReadParam.SkipToNextToken();
     594           0 :     switch( cGetChar )
     595             :     {
     596             :     case 'a':
     597             :     case 'A':
     598           0 :         if ( !rReadParam.GetResult().startsWithIgnoreAsciiCase("d") )
     599             :         {
     600           0 :             break;
     601             :         }
     602           0 :         (void)rReadParam.SkipToNextToken();
     603             :         // intentional fall-through
     604             :     case -2:
     605             :         {
     606           0 :             if ( rReadParam.GetResult().startsWithIgnoreAsciiCase("(") )
     607             :             {
     608           0 :                 for (int i=0;i<2;i++)
     609             :                 {
     610           0 :                     if ('s' == rReadParam.SkipToNextToken())
     611             :                     {
     612           0 :                         const sal_Int32 cChar = rReadParam.SkipToNextToken();
     613           0 :                         if (-2 != rReadParam.SkipToNextToken())
     614           0 :                             break;
     615           0 :                         const OUString sF = rReadParam.GetResult();
     616           0 :                         if ((('u' == cChar) && sF.startsWithIgnoreAsciiCase("p"))
     617           0 :                             || (('d' == cChar) && sF.startsWithIgnoreAsciiCase("o")))
     618             :                         {
     619           0 :                             if (-2 == rReadParam.SkipToNextToken())
     620             :                             {
     621           0 :                                 OUString sPart = rReadParam.GetResult();
     622           0 :                                 sal_Int32 nBegin = sPart.indexOf('(');
     623             : 
     624             :                                 // Word disallows brackets in this field, which
     625             :                                 // aids figuring out the case of an end of )) vs )
     626           0 :                                 sal_Int32 nEnd = sPart.indexOf(')');
     627             : 
     628           0 :                                 if (nBegin != -1 && nEnd != -1)
     629             :                                 {
     630           0 :                                     sCombinedCharacters +=
     631           0 :                                         sPart.copy(nBegin+1,nEnd-nBegin-1);
     632           0 :                                 }
     633             :                             }
     634           0 :                         }
     635             :                     }
     636             :                 }
     637           0 :                 if (!sCombinedCharacters.isEmpty())
     638             :                 {
     639           0 :                     aResult.sType = "CombinedCharacters";
     640           0 :                     aResult.sResult = sCombinedCharacters;
     641             :                 }
     642             :                 else
     643             :                 {
     644           0 :                     const OUString sPart = aOriFldParam.GetResult();
     645           0 :                     sal_Int32 nBegin = sPart.indexOf('(');
     646           0 :                     sal_Int32 nEnd = sPart.indexOf(',');
     647           0 :                     if ( nEnd == -1 )
     648             :                     {
     649           0 :                         nEnd = sPart.indexOf(')');
     650             :                     }
     651           0 :                     if ( nBegin != -1 && nEnd != -1 )
     652             :                     {
     653             :                         // skip certain leading characters
     654           0 :                         for (int i = nBegin;i < nEnd-1;i++)
     655             :                         {
     656           0 :                             const sal_Unicode cC = sPart[nBegin+1];
     657           0 :                             if ( cC < 32 )
     658             :                             {
     659           0 :                                 nBegin++;
     660             :                             }
     661             :                             else
     662           0 :                                 break;
     663             :                         }
     664           0 :                         sCombinedCharacters = sPart.copy( nBegin+1, nEnd-nBegin-1 );
     665           0 :                         if ( !sCombinedCharacters.isEmpty() )
     666             :                         {
     667           0 :                             aResult.sType = "Input";
     668           0 :                             aResult.sResult = sCombinedCharacters;
     669             :                         }
     670           0 :                     }
     671             :                 }
     672             :             }
     673             :         }
     674             :     default:
     675           0 :         break;
     676             :     }
     677           0 :     return aResult;
     678             : }
     679             : 
     680           1 : EquationResult ParseCombinedChars(const OUString& rStr)
     681             : {
     682           1 :     EquationResult aResult;
     683           2 :     WW8ReadFieldParams aReadParam( rStr );
     684           1 :     const sal_Int32 cChar = aReadParam.SkipToNextToken();
     685           1 :     if ('o' == cChar || 'O' == cChar)
     686           0 :         aResult = Read_SubF_Combined(aReadParam);
     687           2 :     return aResult;
     688             : }
     689             : 
     690             : struct CustomShapeTypeTranslationTable
     691             : {
     692             :     const char* sOOo;
     693             :     const char* sMSO;
     694             : };
     695             : 
     696             : static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] =
     697             : {
     698             :     // { "non-primitive", mso_sptMin },
     699             :     { "rectangle", "rect" },
     700             :     { "round-rectangle", "roundRect" },
     701             :     { "ellipse", "ellipse" },
     702             :     { "diamond", "diamond" },
     703             :     { "isosceles-triangle", "triangle" },
     704             :     { "right-triangle", "rtTriangle" },
     705             :     { "parallelogram", "parallelogram" },
     706             :     { "trapezoid", "trapezoid" },
     707             :     { "hexagon", "hexagon" },
     708             :     { "octagon", "octagon" },
     709             :     { "cross", "plus" },
     710             :     { "star5", "star5" },
     711             :     { "right-arrow", "rightArrow" },
     712             :     // { "mso-spt14", mso_sptThickArrow },
     713             :     { "pentagon-right", "homePlate" },
     714             :     { "cube", "cube" },
     715             :     // { "mso-spt17", mso_sptBalloon },
     716             :     // { "mso-spt18", mso_sptSeal },
     717             :     { "mso-spt19", "arc" },
     718             :     { "mso-spt20", "line" },
     719             :     { "mso-spt21", "plaque" },
     720             :     { "can", "can" },
     721             :     { "ring", "donut" },
     722             :     { "mso-spt24", "textPlain" },
     723             :     { "mso-spt25", "textStop" },
     724             :     { "mso-spt26", "textTriangle" },
     725             :     { "mso-spt27", "textCanDown" },
     726             :     { "mso-spt28", "textWave1" },
     727             :     { "mso-spt29", "textArchUpPour" },
     728             :     { "mso-spt30", "textCanDown" },
     729             :     { "mso-spt31", "textArchUp" },
     730             :     { "mso-spt32", "straightConnector1" },
     731             :     { "mso-spt33", "bentConnector2" },
     732             :     { "mso-spt34", "bentConnector3" },
     733             :     { "mso-spt35", "bentConnector4" },
     734             :     { "mso-spt36", "bentConnector5" },
     735             :     { "mso-spt37", "curvedConnector2" },
     736             :     { "mso-spt38", "curvedConnector3" },
     737             :     { "mso-spt39", "curvedConnector4" },
     738             :     { "mso-spt40", "curvedConnector5" },
     739             :     { "mso-spt41", "callout1" },
     740             :     { "mso-spt42", "callout2" },
     741             :     { "mso-spt43", "callout3" },
     742             :     { "mso-spt44", "accentCallout1" },
     743             :     { "mso-spt45", "accentCallout2" },
     744             :     { "mso-spt46", "accentCallout3" },
     745             :     { "line-callout-1", "borderCallout1" },
     746             :     { "line-callout-2", "borderCallout2" },
     747             :     { "line-callout-3", "borderCallout3" },
     748             :     { "mso-spt49", "borderCallout3" },
     749             :     { "mso-spt50", "accentBorderCallout1" },
     750             :     { "mso-spt51", "accentBorderCallout2" },
     751             :     { "mso-spt52", "accentBorderCallout3" },
     752             :     { "mso-spt53", "ribbon" },
     753             :     { "mso-spt54", "ribbon2" },
     754             :     { "chevron", "chevron" },
     755             :     { "pentagon", "pentagon" },
     756             :     { "forbidden", "noSmoking" },
     757             :     { "star8", "star8" },
     758             :     { "mso-spt59", "star16" },
     759             :     { "mso-spt60", "star32" },
     760             :     { "rectangular-callout", "wedgeRectCallout" },
     761             :     { "round-rectangular-callout", "wedgeRoundRectCallout" },
     762             :     { "round-callout", "wedgeEllipseCallout" },
     763             :     { "mso-spt64", "wave" },
     764             :     { "paper", "foldedCorner" },
     765             :     { "left-arrow", "leftArrow" },
     766             :     { "down-arrow", "downArrow" },
     767             :     { "up-arrow", "upArrow" },
     768             :     { "left-right-arrow", "leftRightArrow" },
     769             :     { "up-down-arrow", "upDownArrow" },
     770             :     { "mso-spt71", "irregularSeal1" },
     771             :     { "bang", "irregularSeal2" },
     772             :     { "lightning", "lightningBolt" },
     773             :     { "heart", "heart" },
     774             :     { "quad-arrow", "quadArrow" },
     775             :     { "left-arrow-callout", "leftArrowCallout" },
     776             :     { "right-arrow-callout", "rightArrowCallout" },
     777             :     { "up-arrow-callout", "upArrowCallout" },
     778             :     { "down-arrow-callout", "downArrowCallout" },
     779             :     { "left-right-arrow-callout", "leftRightArrowCallout" },
     780             :     { "up-down-arrow-callout", "upDownArrowCallout" },
     781             :     { "quad-arrow-callout", "quadArrowCallout" },
     782             :     { "quad-bevel", "bevel" },
     783             :     { "left-bracket", "leftBracket" },
     784             :     { "right-bracket", "rightBracket" },
     785             :     { "left-brace", "leftBrace" },
     786             :     { "right-brace", "rightBrace" },
     787             :     { "mso-spt89", "leftUpArrow" },
     788             :     { "mso-spt90", "bentUpArrow" },
     789             :     { "mso-spt91", "bentArrow" },
     790             :     { "star24", "star24" },
     791             :     { "striped-right-arrow", "stripedRightArrow" },
     792             :     { "notched-right-arrow", "notchedRightArrow" },
     793             :     { "block-arc", "blockArc" },
     794             :     { "smiley", "smileyFace" },
     795             :     { "vertical-scroll", "verticalScroll" },
     796             :     { "horizontal-scroll", "horizontalScroll" },
     797             :     { "circular-arrow", "circularArrow" },
     798             :     { "mso-spt100", "pie" }, // looks like MSO_SPT is wrong here
     799             :     { "mso-spt101", "uturnArrow" },
     800             :     { "mso-spt102", "curvedRightArrow" },
     801             :     { "mso-spt103", "curvedLeftArrow" },
     802             :     { "mso-spt104", "curvedUpArrow" },
     803             :     { "mso-spt105", "curvedDownArrow" },
     804             :     { "cloud-callout", "cloudCallout" },
     805             :     { "mso-spt107", "ellipseRibbon" },
     806             :     { "mso-spt108", "ellipseRibbon2" },
     807             :     { "flowchart-process", "flowChartProcess" },
     808             :     { "flowchart-decision", "flowChartDecision" },
     809             :     { "flowchart-data", "flowChartInputOutput" },
     810             :     { "flowchart-predefined-process", "flowChartPredefinedProcess" },
     811             :     { "flowchart-internal-storage", "flowChartInternalStorage" },
     812             :     { "flowchart-document", "flowChartDocument" },
     813             :     { "flowchart-multidocument", "flowChartMultidocument" },
     814             :     { "flowchart-terminator", "flowChartTerminator" },
     815             :     { "flowchart-preparation", "flowChartPreparation" },
     816             :     { "flowchart-manual-input", "flowChartManualInput" },
     817             :     { "flowchart-manual-operation", "flowChartManualOperation" },
     818             :     { "flowchart-connector", "flowChartConnector" },
     819             :     { "flowchart-card", "flowChartPunchedCard" },
     820             :     { "flowchart-punched-tape", "flowChartPunchedTape" },
     821             :     { "flowchart-summing-junction", "flowChartSummingJunction" },
     822             :     { "flowchart-or", "flowChartOr" },
     823             :     { "flowchart-collate", "flowChartCollate" },
     824             :     { "flowchart-sort", "flowChartSort" },
     825             :     { "flowchart-extract", "flowChartExtract" },
     826             :     { "flowchart-merge", "flowChartMerge" },
     827             :     { "mso-spt129", "flowChartOfflineStorage" },
     828             :     { "flowchart-stored-data", "flowChartOnlineStorage" },
     829             :     { "flowchart-sequential-access", "flowChartMagneticTape" },
     830             :     { "flowchart-magnetic-disk", "flowChartMagneticDisk" },
     831             :     { "flowchart-direct-access-storage", "flowChartMagneticDrum" },
     832             :     { "flowchart-display", "flowChartDisplay" },
     833             :     { "flowchart-delay", "flowChartDelay" },
     834             :     // { "fontwork-plain-text", "textPlainText" },
     835             :     // { "fontwork-stop", "textStop" },
     836             :     // { "fontwork-triangle-up", "textTriangle" },
     837             :     // { "fontwork-triangle-down", "textTriangleInverted" },
     838             :     // { "fontwork-chevron-up", "textChevron" },
     839             :     // { "fontwork-chevron-down", "textChevronInverted" },
     840             :     // { "mso-spt142", "textRingInside" },
     841             :     // { "mso-spt143", "textRingOutside" },
     842             :     // { "fontwork-arch-up-curve", "textArchUpCurve" },
     843             :     // { "fontwork-arch-down-curve", "textArchDownCurve" },
     844             :     // { "fontwork-circle-curve", "textCircleCurve" },
     845             :     // { "fontwork-open-circle-curve", "textButtonCurve" },
     846             :     // { "fontwork-arch-up-pour", "textArchUpPour" },
     847             :     // { "fontwork-arch-down-pour", "textArchDownPour" },
     848             :     // { "fontwork-circle-pour", "textCirclePour" },
     849             :     // { "fontwork-open-circle-pour", "textButtonPour" },
     850             :     // { "fontwork-curve-up", "textCurveUp" },
     851             :     // { "fontwork-curve-down", "textCurveDown" },
     852             :     // { "fontwork-fade-up-and-right", "textCascadeUp" },
     853             :     // { "fontwork-fade-up-and-left", "textCascadeDown" },
     854             :     // { "fontwork-wave", "textWave1" },
     855             :     // { "mso-spt157", "textWave2" },
     856             :     // { "mso-spt158", "textWave3" },
     857             :     // { "mso-spt159", "textWave4" },
     858             :     // { "fontwork-inflate", "textInflate" },
     859             :     // { "mso-spt161", "textDeflate" },
     860             :     // { "mso-spt162", "textInflateBottom" },
     861             :     // { "mso-spt163", "textDeflateBottom" },
     862             :     // { "mso-spt164", "textInflateTop" },
     863             :     // { "mso-spt165", "textDeflateTop" },
     864             :     // { "mso-spt166", "textDeflateInflate" },
     865             :     // { "mso-spt167", "textDeflateInflateDeflate" },
     866             :     // { "fontwork-fade-right", "textFadeRight" },
     867             :     // { "fontwork-fade-left", "textFadeLeft" },
     868             :     // { "fontwork-fade-up", "textFadeUp" },
     869             :     // { "fontwork-fade-down", "textFadeDown" },
     870             :     // { "fontwork-slant-up", "textSlantUp" },
     871             :     // { "fontwork-slant-down", "textSlantDown" },
     872             :     // { "mso-spt174", "textCanUp" },
     873             :     // { "mso-spt175", "textCanDown" },
     874             :     { "flowchart-alternate-process", "flowChartAlternateProcess" },
     875             :     { "flowchart-off-page-connector", "flowChartOffpageConnector" },
     876             :     { "mso-spt178", "callout1" },
     877             :     { "mso-spt179", "accentCallout1" },
     878             :     { "mso-spt180", "borderCallout1" },
     879             :     { "mso-spt182", "leftRightUpArrow" },
     880             :     { "sun", "sun" },
     881             :     { "moon", "moon" },
     882             :     { "bracket-pair", "bracketPair" },
     883             :     { "brace-pair", "bracePair" },
     884             :     { "star4", "star4" },
     885             :     { "mso-spt188", "doubleWave" },
     886             :     { "mso-spt189", "actionButtonBlank" },
     887             :     { "mso-spt190", "actionButtonHome" },
     888             :     { "mso-spt191", "actionButtonHelp" },
     889             :     { "mso-spt192", "actionButtonInformation" },
     890             :     { "mso-spt193", "actionButtonForwardNext" },
     891             :     { "mso-spt194", "actionButtonBackPrevious" },
     892             :     { "mso-spt195", "actionButtonEnd" },
     893             :     { "mso-spt196", "actionButtonBeginning" },
     894             :     { "mso-spt197", "actionButtonReturn" },
     895             :     { "mso-spt198", "actionButtonDocument" },
     896             :     { "mso-spt199", "actionButtonSound" },
     897             :     { "mso-spt200", "actionButtonMovie" },
     898             :     // { "mso-spt201", "hostControl" },
     899             :     { "mso-spt202", "rect" },
     900             :     { "ooxml-actionButtonSound", "actionButtonSound" },
     901             :     { "ooxml-borderCallout1", "borderCallout1" },
     902             :     { "ooxml-plaqueTabs", "plaqueTabs" },
     903             :     { "ooxml-curvedLeftArrow", "curvedLeftArrow" },
     904             :     { "ooxml-octagon", "octagon" },
     905             :     { "ooxml-leftRightRibbon", "leftRightRibbon" },
     906             :     { "ooxml-actionButtonInformation", "actionButtonInformation" },
     907             :     { "ooxml-bentConnector5", "bentConnector5" },
     908             :     { "ooxml-circularArrow", "circularArrow" },
     909             :     { "ooxml-downArrowCallout", "downArrowCallout" },
     910             :     { "ooxml-mathMinus", "mathMinus" },
     911             :     { "ooxml-gear9", "gear9" },
     912             :     { "ooxml-round1Rect", "round1Rect" },
     913             :     { "ooxml-sun", "sun" },
     914             :     { "ooxml-plaque", "plaque" },
     915             :     { "ooxml-chevron", "chevron" },
     916             :     { "ooxml-flowChartPreparation", "flowChartPreparation" },
     917             :     { "ooxml-diagStripe", "diagStripe" },
     918             :     { "ooxml-pentagon", "pentagon" },
     919             :     { "ooxml-funnel", "funnel" },
     920             :     { "ooxml-chartStar", "chartStar" },
     921             :     { "ooxml-accentBorderCallout1", "accentBorderCallout1" },
     922             :     { "ooxml-notchedRightArrow", "notchedRightArrow" },
     923             :     { "ooxml-rightBracket", "rightBracket" },
     924             :     { "ooxml-flowChartOffpageConnector", "flowChartOffpageConnector" },
     925             :     { "ooxml-leftRightArrow", "leftRightArrow" },
     926             :     { "ooxml-decagon", "decagon" },
     927             :     { "ooxml-actionButtonHelp", "actionButtonHelp" },
     928             :     { "ooxml-star24", "star24" },
     929             :     { "ooxml-mathDivide", "mathDivide" },
     930             :     { "ooxml-curvedConnector4", "curvedConnector4" },
     931             :     { "ooxml-flowChartOr", "flowChartOr" },
     932             :     { "ooxml-borderCallout3", "borderCallout3" },
     933             :     { "ooxml-upDownArrowCallout", "upDownArrowCallout" },
     934             :     { "ooxml-flowChartDecision", "flowChartDecision" },
     935             :     { "ooxml-leftRightArrowCallout", "leftRightArrowCallout" },
     936             :     { "ooxml-flowChartManualOperation", "flowChartManualOperation" },
     937             :     { "ooxml-snipRoundRect", "snipRoundRect" },
     938             :     { "ooxml-mathPlus", "mathPlus" },
     939             :     { "ooxml-actionButtonForwardNext", "actionButtonForwardNext" },
     940             :     { "ooxml-can", "can" },
     941             :     { "ooxml-foldedCorner", "foldedCorner" },
     942             :     { "ooxml-star32", "star32" },
     943             :     { "ooxml-flowChartInternalStorage", "flowChartInternalStorage" },
     944             :     { "ooxml-upDownArrow", "upDownArrow" },
     945             :     { "ooxml-irregularSeal2", "irregularSeal2" },
     946             :     { "ooxml-mathEqual", "mathEqual" },
     947             :     { "ooxml-star12", "star12" },
     948             :     { "ooxml-uturnArrow", "uturnArrow" },
     949             :     { "ooxml-squareTabs", "squareTabs" },
     950             :     { "ooxml-leftRightUpArrow", "leftRightUpArrow" },
     951             :     { "ooxml-homePlate", "homePlate" },
     952             :     { "ooxml-dodecagon", "dodecagon" },
     953             :     { "ooxml-leftArrowCallout", "leftArrowCallout" },
     954             :     { "ooxml-chord", "chord" },
     955             :     { "ooxml-quadArrowCallout", "quadArrowCallout" },
     956             :     { "ooxml-actionButtonBeginning", "actionButtonBeginning" },
     957             :     { "ooxml-ellipse", "ellipse" },
     958             :     { "ooxml-actionButtonEnd", "actionButtonEnd" },
     959             :     { "ooxml-arc", "arc" },
     960             :     { "ooxml-star16", "star16" },
     961             :     { "ooxml-parallelogram", "parallelogram" },
     962             :     { "ooxml-bevel", "bevel" },
     963             :     { "ooxml-roundRect", "roundRect" },
     964             :     { "ooxml-accentCallout1", "accentCallout1" },
     965             :     { "ooxml-flowChartSort", "flowChartSort" },
     966             :     { "ooxml-star8", "star8" },
     967             :     { "ooxml-flowChartAlternateProcess", "flowChartAlternateProcess" },
     968             :     { "ooxml-moon", "moon" },
     969             :     { "ooxml-star6", "star6" },
     970             :     { "ooxml-round2SameRect", "round2SameRect" },
     971             :     { "ooxml-nonIsoscelesTrapezoid", "nonIsoscelesTrapezoid" },
     972             :     { "ooxml-diamond", "diamond" },
     973             :     { "ooxml-ellipseRibbon", "ellipseRibbon" },
     974             :     { "ooxml-callout2", "callout2" },
     975             :     { "ooxml-pie", "pie" },
     976             :     { "ooxml-star4", "star4" },
     977             :     { "ooxml-flowChartPredefinedProcess", "flowChartPredefinedProcess" },
     978             :     { "ooxml-flowChartPunchedTape", "flowChartPunchedTape" },
     979             :     { "ooxml-curvedConnector2", "curvedConnector2" },
     980             :     { "ooxml-bentConnector3", "bentConnector3" },
     981             :     { "ooxml-cornerTabs", "cornerTabs" },
     982             :     { "ooxml-hexagon", "hexagon" },
     983             :     { "ooxml-flowChartConnector", "flowChartConnector" },
     984             :     { "ooxml-flowChartMagneticDisk", "flowChartMagneticDisk" },
     985             :     { "ooxml-heart", "heart" },
     986             :     { "ooxml-ribbon2", "ribbon2" },
     987             :     { "ooxml-bracePair", "bracePair" },
     988             :     { "ooxml-flowChartExtract", "flowChartExtract" },
     989             :     { "ooxml-actionButtonHome", "actionButtonHome" },
     990             :     { "ooxml-accentBorderCallout3", "accentBorderCallout3" },
     991             :     { "ooxml-flowChartOfflineStorage", "flowChartOfflineStorage" },
     992             :     { "ooxml-irregularSeal1", "irregularSeal1" },
     993             :     { "ooxml-quadArrow", "quadArrow" },
     994             :     { "ooxml-leftBrace", "leftBrace" },
     995             :     { "ooxml-leftBracket", "leftBracket" },
     996             :     { "ooxml-blockArc", "blockArc" },
     997             :     { "ooxml-curvedConnector3", "curvedConnector3" },
     998             :     { "ooxml-wedgeRoundRectCallout", "wedgeRoundRectCallout" },
     999             :     { "ooxml-actionButtonMovie", "actionButtonMovie" },
    1000             :     { "ooxml-flowChartOnlineStorage", "flowChartOnlineStorage" },
    1001             :     { "ooxml-gear6", "gear6" },
    1002             :     { "ooxml-halfFrame", "halfFrame" },
    1003             :     { "ooxml-snip2SameRect", "snip2SameRect" },
    1004             :     { "ooxml-triangle", "triangle" },
    1005             :     { "ooxml-teardrop", "teardrop" },
    1006             :     { "ooxml-flowChartDocument", "flowChartDocument" },
    1007             :     { "ooxml-rightArrowCallout", "rightArrowCallout" },
    1008             :     { "ooxml-rightBrace", "rightBrace" },
    1009             :     { "ooxml-chartPlus", "chartPlus" },
    1010             :     { "ooxml-flowChartManualInput", "flowChartManualInput" },
    1011             :     { "ooxml-flowChartMerge", "flowChartMerge" },
    1012             :     { "ooxml-line", "line" },
    1013             :     { "ooxml-downArrow", "downArrow" },
    1014             :     { "ooxml-upArrow", "upArrow" },
    1015             :     { "ooxml-curvedDownArrow", "curvedDownArrow" },
    1016             :     { "ooxml-actionButtonReturn", "actionButtonReturn" },
    1017             :     { "ooxml-flowChartInputOutput", "flowChartInputOutput" },
    1018             :     { "ooxml-bracketPair", "bracketPair" },
    1019             :     { "ooxml-smileyFace", "smileyFace" },
    1020             :     { "ooxml-actionButtonBlank", "actionButtonBlank" },
    1021             :     { "ooxml-wave", "wave" },
    1022             :     { "ooxml-swooshArrow", "swooshArrow" },
    1023             :     { "ooxml-flowChartSummingJunction", "flowChartSummingJunction" },
    1024             :     { "ooxml-lightningBolt", "lightningBolt" },
    1025             :     { "ooxml-flowChartDisplay", "flowChartDisplay" },
    1026             :     { "ooxml-actionButtonBackPrevious", "actionButtonBackPrevious" },
    1027             :     { "ooxml-frame", "frame" },
    1028             :     { "ooxml-rtTriangle", "rtTriangle" },
    1029             :     { "ooxml-flowChartMagneticTape", "flowChartMagneticTape" },
    1030             :     { "ooxml-curvedRightArrow", "curvedRightArrow" },
    1031             :     { "ooxml-leftUpArrow", "leftUpArrow" },
    1032             :     { "ooxml-wedgeEllipseCallout", "wedgeEllipseCallout" },
    1033             :     { "ooxml-doubleWave", "doubleWave" },
    1034             :     { "ooxml-bentArrow", "bentArrow" },
    1035             :     { "ooxml-star10", "star10" },
    1036             :     { "ooxml-leftArrow", "leftArrow" },
    1037             :     { "ooxml-curvedUpArrow", "curvedUpArrow" },
    1038             :     { "ooxml-snip1Rect", "snip1Rect" },
    1039             :     { "ooxml-ellipseRibbon2", "ellipseRibbon2" },
    1040             :     { "ooxml-plus", "plus" },
    1041             :     { "ooxml-accentCallout3", "accentCallout3" },
    1042             :     { "ooxml-leftCircularArrow", "leftCircularArrow" },
    1043             :     { "ooxml-rightArrow", "rightArrow" },
    1044             :     { "ooxml-flowChartPunchedCard", "flowChartPunchedCard" },
    1045             :     { "ooxml-snip2DiagRect", "snip2DiagRect" },
    1046             :     { "ooxml-verticalScroll", "verticalScroll" },
    1047             :     { "ooxml-star7", "star7" },
    1048             :     { "ooxml-chartX", "chartX" },
    1049             :     { "ooxml-cloud", "cloud" },
    1050             :     { "ooxml-cube", "cube" },
    1051             :     { "ooxml-round2DiagRect", "round2DiagRect" },
    1052             :     { "ooxml-flowChartMultidocument", "flowChartMultidocument" },
    1053             :     { "ooxml-actionButtonDocument", "actionButtonDocument" },
    1054             :     { "ooxml-flowChartTerminator", "flowChartTerminator" },
    1055             :     { "ooxml-flowChartDelay", "flowChartDelay" },
    1056             :     { "ooxml-curvedConnector5", "curvedConnector5" },
    1057             :     { "ooxml-horizontalScroll", "horizontalScroll" },
    1058             :     { "ooxml-bentConnector4", "bentConnector4" },
    1059             :     { "ooxml-leftRightCircularArrow", "leftRightCircularArrow" },
    1060             :     { "ooxml-wedgeRectCallout", "wedgeRectCallout" },
    1061             :     { "ooxml-accentCallout2", "accentCallout2" },
    1062             :     { "ooxml-flowChartMagneticDrum", "flowChartMagneticDrum" },
    1063             :     { "ooxml-corner", "corner" },
    1064             :     { "ooxml-borderCallout2", "borderCallout2" },
    1065             :     { "ooxml-donut", "donut" },
    1066             :     { "ooxml-flowChartCollate", "flowChartCollate" },
    1067             :     { "ooxml-mathNotEqual", "mathNotEqual" },
    1068             :     { "ooxml-bentConnector2", "bentConnector2" },
    1069             :     { "ooxml-mathMultiply", "mathMultiply" },
    1070             :     { "ooxml-heptagon", "heptagon" },
    1071             :     { "ooxml-rect", "rect" },
    1072             :     { "ooxml-accentBorderCallout2", "accentBorderCallout2" },
    1073             :     { "ooxml-pieWedge", "pieWedge" },
    1074             :     { "ooxml-upArrowCallout", "upArrowCallout" },
    1075             :     { "ooxml-flowChartProcess", "flowChartProcess" },
    1076             :     { "ooxml-star5", "star5" },
    1077             :     { "ooxml-lineInv", "lineInv" },
    1078             :     { "ooxml-straightConnector1", "straightConnector1" },
    1079             :     { "ooxml-stripedRightArrow", "stripedRightArrow" },
    1080             :     { "ooxml-callout3", "callout3" },
    1081             :     { "ooxml-bentUpArrow", "bentUpArrow" },
    1082             :     { "ooxml-noSmoking", "noSmoking" },
    1083             :     { "ooxml-trapezoid", "trapezoid" },
    1084             :     { "ooxml-cloudCallout", "cloudCallout" },
    1085             :     { "ooxml-callout1", "callout1" },
    1086             :     { "ooxml-ribbon", "ribbon" },
    1087             :     { "ooxml-rect", "rect" },
    1088             : };
    1089             : 
    1090             : static struct {
    1091             :     const char* sDML;
    1092             :     MSO_SPT nVML;
    1093             : } const pDMLToVMLTable[] = {
    1094             :     {"notPrimitive", mso_sptNotPrimitive},
    1095             :     {"rectangle", mso_sptRectangle},
    1096             :     {"roundRectangle", mso_sptRoundRectangle},
    1097             :     {"ellipse", mso_sptEllipse},
    1098             :     {"diamond", mso_sptDiamond},
    1099             :     {"triangle", mso_sptIsocelesTriangle},
    1100             :     {"rtTriangle", mso_sptRightTriangle},
    1101             :     {"parallelogram", mso_sptParallelogram},
    1102             :     {"trapezoid", mso_sptTrapezoid},
    1103             :     {"hexagon", mso_sptHexagon},
    1104             :     {"octagon", mso_sptOctagon},
    1105             :     {"plus", mso_sptPlus},
    1106             :     {"star5", mso_sptStar},
    1107             :     {"rightArrow", mso_sptArrow},
    1108             :     {"thickArrow", mso_sptThickArrow},
    1109             :     {"homePlate", mso_sptHomePlate},
    1110             :     {"cube", mso_sptCube},
    1111             :     {"wedgeRoundRectCallout", mso_sptBalloon},
    1112             :     {"star16", mso_sptSeal},
    1113             :     {"arc", mso_sptArc},
    1114             :     {"line", mso_sptLine},
    1115             :     {"plaque", mso_sptPlaque},
    1116             :     {"can", mso_sptCan},
    1117             :     {"donut", mso_sptDonut},
    1118             :     {"textPlain", mso_sptTextSimple},
    1119             :     {"textStop", mso_sptTextOctagon},
    1120             :     {"textTriangle", mso_sptTextHexagon},
    1121             :     {"textCanDown", mso_sptTextCurve},
    1122             :     {"textWave1", mso_sptTextWave},
    1123             :     {"textArchUpPour", mso_sptTextRing},
    1124             :     {"textCanDown", mso_sptTextOnCurve},
    1125             :     {"textArchUp", mso_sptTextOnRing},
    1126             :     {"straightConnector1", mso_sptStraightConnector1},
    1127             :     {"bentConnector2", mso_sptBentConnector2},
    1128             :     {"bentConnector3", mso_sptBentConnector3},
    1129             :     {"bentConnector4", mso_sptBentConnector4},
    1130             :     {"bentConnector5", mso_sptBentConnector5},
    1131             :     {"curvedConnector2", mso_sptCurvedConnector2},
    1132             :     {"curvedConnector3", mso_sptCurvedConnector3},
    1133             :     {"curvedConnector4", mso_sptCurvedConnector4},
    1134             :     {"curvedConnector5", mso_sptCurvedConnector5},
    1135             :     {"callout1", mso_sptCallout1},
    1136             :     {"callout2", mso_sptCallout2},
    1137             :     {"callout3", mso_sptCallout3},
    1138             :     {"accentCallout1", mso_sptAccentCallout1},
    1139             :     {"accentCallout2", mso_sptAccentCallout2},
    1140             :     {"accentCallout3", mso_sptAccentCallout3},
    1141             :     {"borderCallout1", mso_sptBorderCallout1},
    1142             :     {"borderCallout2", mso_sptBorderCallout2},
    1143             :     {"borderCallout3", mso_sptBorderCallout3},
    1144             :     {"accentBorderCallout1", mso_sptAccentBorderCallout1},
    1145             :     {"accentBorderCallout2", mso_sptAccentBorderCallout2},
    1146             :     {"accentBorderCallout3", mso_sptAccentBorderCallout3},
    1147             :     {"ribbon", mso_sptRibbon},
    1148             :     {"ribbon2", mso_sptRibbon2},
    1149             :     {"chevron", mso_sptChevron},
    1150             :     {"pentagon", mso_sptPentagon},
    1151             :     {"noSmoking", mso_sptNoSmoking},
    1152             :     {"star8", mso_sptSeal8},
    1153             :     {"star16", mso_sptSeal16},
    1154             :     {"star32", mso_sptSeal32},
    1155             :     {"wedgeRectCallout", mso_sptWedgeRectCallout},
    1156             :     {"wedgeRoundRectCallout", mso_sptWedgeRRectCallout},
    1157             :     {"wedgeEllipseCallout", mso_sptWedgeEllipseCallout},
    1158             :     {"wave", mso_sptWave},
    1159             :     {"foldedCorner", mso_sptFoldedCorner},
    1160             :     {"leftArrow", mso_sptLeftArrow},
    1161             :     {"downArrow", mso_sptDownArrow},
    1162             :     {"upArrow", mso_sptUpArrow},
    1163             :     {"leftRightArrow", mso_sptLeftRightArrow},
    1164             :     {"upDownArrow", mso_sptUpDownArrow},
    1165             :     {"irregularSeal1", mso_sptIrregularSeal1},
    1166             :     {"irregularSeal2", mso_sptIrregularSeal2},
    1167             :     {"lightningBolt", mso_sptLightningBolt},
    1168             :     {"heart", mso_sptHeart},
    1169             :     {"pictureFrame", mso_sptPictureFrame},
    1170             :     {"quadArrow", mso_sptQuadArrow},
    1171             :     {"leftArrowCallout", mso_sptLeftArrowCallout},
    1172             :     {"rightArrowCallout", mso_sptRightArrowCallout},
    1173             :     {"upArrowCallout", mso_sptUpArrowCallout},
    1174             :     {"downArrowCallout", mso_sptDownArrowCallout},
    1175             :     {"leftRightArrowCallout", mso_sptLeftRightArrowCallout},
    1176             :     {"upDownArrowCallout", mso_sptUpDownArrowCallout},
    1177             :     {"quadArrowCallout", mso_sptQuadArrowCallout},
    1178             :     {"bevel", mso_sptBevel},
    1179             :     {"leftBracket", mso_sptLeftBracket},
    1180             :     {"rightBracket", mso_sptRightBracket},
    1181             :     {"leftBrace", mso_sptLeftBrace},
    1182             :     {"rightBrace", mso_sptRightBrace},
    1183             :     {"leftUpArrow", mso_sptLeftUpArrow},
    1184             :     {"bentUpArrow", mso_sptBentUpArrow},
    1185             :     {"bentArrow", mso_sptBentArrow},
    1186             :     {"star24", mso_sptSeal24},
    1187             :     {"stripedRightArrow", mso_sptStripedRightArrow},
    1188             :     {"notchedRightArrow", mso_sptNotchedRightArrow},
    1189             :     {"blockArc", mso_sptBlockArc},
    1190             :     {"smileyFace", mso_sptSmileyFace},
    1191             :     {"verticalScroll", mso_sptVerticalScroll},
    1192             :     {"horizontalScroll", mso_sptHorizontalScroll},
    1193             :     {"circularArrow", mso_sptCircularArrow},
    1194             :     {"notchedCircularArrow", mso_sptNotchedCircularArrow},
    1195             :     {"uturnArrow", mso_sptUturnArrow},
    1196             :     {"curvedRightArrow", mso_sptCurvedRightArrow},
    1197             :     {"curvedLeftArrow", mso_sptCurvedLeftArrow},
    1198             :     {"curvedUpArrow", mso_sptCurvedUpArrow},
    1199             :     {"curvedDownArrow", mso_sptCurvedDownArrow},
    1200             :     {"cloudCallout", mso_sptCloudCallout},
    1201             :     {"ellipseRibbon", mso_sptEllipseRibbon},
    1202             :     {"ellipseRibbon2", mso_sptEllipseRibbon2},
    1203             :     {"flowChartProcess", mso_sptFlowChartProcess},
    1204             :     {"flowChartDecision", mso_sptFlowChartDecision},
    1205             :     {"flowChartInputOutput", mso_sptFlowChartInputOutput},
    1206             :     {"flowChartPredefinedProcess", mso_sptFlowChartPredefinedProcess},
    1207             :     {"flowChartInternalStorage", mso_sptFlowChartInternalStorage},
    1208             :     {"flowChartDocument", mso_sptFlowChartDocument},
    1209             :     {"flowChartMultidocument", mso_sptFlowChartMultidocument},
    1210             :     {"flowChartTerminator", mso_sptFlowChartTerminator},
    1211             :     {"flowChartPreparation", mso_sptFlowChartPreparation},
    1212             :     {"flowChartManualInput", mso_sptFlowChartManualInput},
    1213             :     {"flowChartManualOperation", mso_sptFlowChartManualOperation},
    1214             :     {"flowChartConnector", mso_sptFlowChartConnector},
    1215             :     {"flowChartPunchedCard", mso_sptFlowChartPunchedCard},
    1216             :     {"flowChartPunchedTape", mso_sptFlowChartPunchedTape},
    1217             :     {"flowChartSummingJunction", mso_sptFlowChartSummingJunction},
    1218             :     {"flowChartOr", mso_sptFlowChartOr},
    1219             :     {"flowChartCollate", mso_sptFlowChartCollate},
    1220             :     {"flowChartSort", mso_sptFlowChartSort},
    1221             :     {"flowChartExtract", mso_sptFlowChartExtract},
    1222             :     {"flowChartMerge", mso_sptFlowChartMerge},
    1223             :     {"flowChartOfflineStorage", mso_sptFlowChartOfflineStorage},
    1224             :     {"flowChartOnlineStorage", mso_sptFlowChartOnlineStorage},
    1225             :     {"flowChartMagneticTape", mso_sptFlowChartMagneticTape},
    1226             :     {"flowChartMagneticDisk", mso_sptFlowChartMagneticDisk},
    1227             :     {"flowChartMagneticDrum", mso_sptFlowChartMagneticDrum},
    1228             :     {"flowChartDisplay", mso_sptFlowChartDisplay},
    1229             :     {"flowChartDelay", mso_sptFlowChartDelay},
    1230             :     {"textPlain", mso_sptTextPlainText},
    1231             :     {"textStop", mso_sptTextStop},
    1232             :     {"textTriangle", mso_sptTextTriangle},
    1233             :     {"textTriangleInverted", mso_sptTextTriangleInverted},
    1234             :     {"textChevron", mso_sptTextChevron},
    1235             :     {"textChevronInverted", mso_sptTextChevronInverted},
    1236             :     {"textRingInside", mso_sptTextRingInside},
    1237             :     {"textRingOutside", mso_sptTextRingOutside},
    1238             :     {"textArchUp", mso_sptTextArchUpCurve},
    1239             :     {"textArchDown", mso_sptTextArchDownCurve},
    1240             :     {"textCircle", mso_sptTextCircleCurve},
    1241             :     {"textButton", mso_sptTextButtonCurve},
    1242             :     {"textArchUpPour", mso_sptTextArchUpPour},
    1243             :     {"textArchDownPour", mso_sptTextArchDownPour},
    1244             :     {"textCirclePour", mso_sptTextCirclePour},
    1245             :     {"textButtonPour", mso_sptTextButtonPour},
    1246             :     {"textCurveUp", mso_sptTextCurveUp},
    1247             :     {"textCurveDown", mso_sptTextCurveDown},
    1248             :     {"textCascadeUp", mso_sptTextCascadeUp},
    1249             :     {"textCascadeDown", mso_sptTextCascadeDown},
    1250             :     {"textWave1", mso_sptTextWave1},
    1251             :     {"textWave2", mso_sptTextWave2},
    1252             :     {"textWave3", mso_sptTextWave3},
    1253             :     {"textWave4", mso_sptTextWave4},
    1254             :     {"textInflate", mso_sptTextInflate},
    1255             :     {"textDeflate", mso_sptTextDeflate},
    1256             :     {"textInflateBottom", mso_sptTextInflateBottom},
    1257             :     {"textDeflateBottom", mso_sptTextDeflateBottom},
    1258             :     {"textInflateTop", mso_sptTextInflateTop},
    1259             :     {"textDeflateTop", mso_sptTextDeflateTop},
    1260             :     {"textDeflateInflate", mso_sptTextDeflateInflate},
    1261             :     {"textDeflateInflateDeflate", mso_sptTextDeflateInflateDeflate},
    1262             :     {"textFadeRight", mso_sptTextFadeRight},
    1263             :     {"textFadeLeft", mso_sptTextFadeLeft},
    1264             :     {"textFadeUp", mso_sptTextFadeUp},
    1265             :     {"textFadeDown", mso_sptTextFadeDown},
    1266             :     {"textSlantUp", mso_sptTextSlantUp},
    1267             :     {"textSlantDown", mso_sptTextSlantDown},
    1268             :     {"textCanUp", mso_sptTextCanUp},
    1269             :     {"textCanDown", mso_sptTextCanDown},
    1270             :     {"flowChartAlternateProcess", mso_sptFlowChartAlternateProcess},
    1271             :     {"flowChartOffpageConnector", mso_sptFlowChartOffpageConnector},
    1272             :     {"callout1", mso_sptCallout90},
    1273             :     {"accentCallout1", mso_sptAccentCallout90},
    1274             :     {"borderCallout1", mso_sptBorderCallout90},
    1275             :     {"accentBorderCallout1", mso_sptAccentBorderCallout90},
    1276             :     {"leftRightUpArrow", mso_sptLeftRightUpArrow},
    1277             :     {"sun", mso_sptSun},
    1278             :     {"moon", mso_sptMoon},
    1279             :     {"bracketPair", mso_sptBracketPair},
    1280             :     {"bracePair", mso_sptBracePair},
    1281             :     {"star4", mso_sptSeal4},
    1282             :     {"doubleWave", mso_sptDoubleWave},
    1283             :     {"actionButtonBlank", mso_sptActionButtonBlank},
    1284             :     {"actionButtonHome", mso_sptActionButtonHome},
    1285             :     {"actionButtonHelp", mso_sptActionButtonHelp},
    1286             :     {"actionButtonInformation", mso_sptActionButtonInformation},
    1287             :     {"actionButtonForwardNext", mso_sptActionButtonForwardNext},
    1288             :     {"actionButtonBackPrevious", mso_sptActionButtonBackPrevious},
    1289             :     {"actionButtonEnd", mso_sptActionButtonEnd},
    1290             :     {"actionButtonBeginning", mso_sptActionButtonBeginning},
    1291             :     {"actionButtonReturn", mso_sptActionButtonReturn},
    1292             :     {"actionButtonDocument", mso_sptActionButtonDocument},
    1293             :     {"actionButtonSound", mso_sptActionButtonSound},
    1294             :     {"actionButtonMovie", mso_sptActionButtonMovie},
    1295             :     {"hostControl", mso_sptHostControl},
    1296             :     {"textBox", mso_sptTextBox},
    1297             : };
    1298             : 
    1299             : typedef boost::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> CustomShapeTypeTranslationHashMap;
    1300             : static CustomShapeTypeTranslationHashMap* pCustomShapeTypeTranslationHashMap = NULL;
    1301             : 
    1302         324 : const char* GetOOXMLPresetGeometry( const char* sShapeType )
    1303             : {
    1304             :     const char* sPresetGeo;
    1305             : 
    1306         324 :     if( pCustomShapeTypeTranslationHashMap == NULL )
    1307             :     {
    1308           5 :         pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap ();
    1309        1730 :         for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCustomShapeTypeTranslationTable); ++i )
    1310             :         {
    1311        1725 :             (*pCustomShapeTypeTranslationHashMap)[ pCustomShapeTypeTranslationTable[ i ].sOOo ] = pCustomShapeTypeTranslationTable[ i ].sMSO;
    1312             :         }
    1313             :     }
    1314             : 
    1315         324 :     sPresetGeo = (*pCustomShapeTypeTranslationHashMap)[ sShapeType ];
    1316             : 
    1317         324 :     if( sPresetGeo == NULL )
    1318          64 :         sPresetGeo = "rect";
    1319             : 
    1320         324 :     return sPresetGeo;
    1321             : }
    1322             : 
    1323             : typedef boost::unordered_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> DMLToVMLTranslationHashMap;
    1324             : static DMLToVMLTranslationHashMap* pDMLToVMLMap;
    1325             : 
    1326         161 : MSO_SPT GETVMLShapeType(const OString& aType)
    1327             : {
    1328         161 :     const char* pDML = GetOOXMLPresetGeometry(aType.getStr());
    1329             : 
    1330         161 :     if (!pDMLToVMLMap)
    1331             :     {
    1332           4 :         pDMLToVMLMap = new DMLToVMLTranslationHashMap();
    1333         816 :         for (size_t i = 0; i < SAL_N_ELEMENTS(pDMLToVMLTable); ++i)
    1334         812 :             (*pDMLToVMLMap)[pDMLToVMLTable[i].sDML] = pDMLToVMLTable[i].nVML;
    1335             :     }
    1336             : 
    1337         161 :     if (pDMLToVMLMap->find(pDML) == pDMLToVMLMap->end())
    1338          86 :         return mso_sptNil;
    1339             : 
    1340          75 :     return (*pDMLToVMLMap)[pDML];
    1341             : }
    1342             : 
    1343             : }
    1344             : }
    1345             : 
    1346             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10