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

Generated by: LCOV version 1.10