LCOV - code coverage report
Current view: top level - hwpfilter/source - hbox.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 10 304 3.3 %
Date: 2014-04-11 Functions: 4 42 9.5 %
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             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "precompile.h"
      21             : 
      22             : #include <ctype.h>
      23             : 
      24             : #include <osl/diagnose.h>
      25             : 
      26             : #include "hwpfile.h"
      27             : #include "hbox.h"
      28             : #include "hpara.h"
      29             : #include "hutil.h"
      30             : #include "htags.h"
      31             : #include "drawdef.h"
      32             : #include "hcode.h"
      33             : 
      34             : int HBox::boxCount = 0;
      35             : 
      36          35 : HBox::HBox(hchar hch)
      37             : {
      38          35 :     hh = hch;
      39          35 :     boxCount++;
      40          35 : }
      41             : 
      42             : 
      43          70 : HBox::~HBox()
      44             : {
      45          35 :     boxCount--;
      46          70 : }
      47             : 
      48             : 
      49          66 : int HBox::WSize(void)
      50             : {
      51             :     static const int wsize[32] =
      52             :     {
      53             :         1, 4, 4, 4, 4, 4, 4, 42,                  /* dateform */
      54             :         48, 4, 4, 4, 4, 1, 4, 4,                  /* hidden */
      55             :         4, 4, 4, 4, 4, 4, 12, 5,                  /* chcompose */
      56             :         3, 3, 123, 4, 32, 4, 2, 2
      57             :     };
      58             : 
      59          66 :     if (hh < 32)
      60           0 :         return wsize[hh];
      61             :     else
      62          66 :         return 1;
      63             : }
      64             : 
      65             : 
      66           0 : hchar_string HBox::GetString()
      67             : {
      68           0 :     hchar_string ret;
      69           0 :     ret.push_back(hh);
      70           0 :     return ret;
      71             : }
      72             : 
      73             : 
      74           0 : hunit HBox::Height(CharShape *csty)
      75             : {
      76           0 :     return( csty->size );
      77             : }
      78             : 
      79             : 
      80             : // skip block
      81           0 : SkipData::SkipData(hchar hch)
      82             :     : HBox(hch)
      83             :     , data_block_len(0)
      84           0 :     , data_block(0)
      85             : {
      86           0 : }
      87             : 
      88             : 
      89           0 : SkipData::~SkipData(void)
      90             : {
      91           0 :     delete[]data_block;
      92           0 : }
      93             : 
      94             : 
      95             : // FieldCode [5]
      96           0 : FieldCode::FieldCode()
      97             :     : HBox(CH_FIELD)
      98             :     , location_info(0)
      99             :     , str1(NULL)
     100             :     , str2(NULL)
     101             :     , str3(NULL)
     102             :     , bin(NULL)
     103           0 :     , m_pDate(NULL)
     104             : {
     105           0 :     reserved1 = new char[4];
     106           0 :     reserved2 = new char[22];
     107           0 : }
     108             : 
     109           0 : FieldCode::~FieldCode(void)
     110             : {
     111           0 :     delete[] str1;
     112           0 :     delete[] str2;
     113           0 :     delete[] str3;
     114           0 :     delete[] bin;
     115           0 :     delete[] reserved1;
     116           0 :     delete[] reserved2;
     117           0 :     delete m_pDate;
     118           0 : }
     119             : 
     120             : // book mark(6)
     121           0 : Bookmark::Bookmark()
     122             :     : HBox(CH_BOOKMARK)
     123             :     , dummy(0)
     124           0 :     , type(0)
     125             : {
     126           0 : }
     127             : 
     128           0 : Bookmark::~Bookmark(void)
     129             : {
     130           0 : }
     131             : 
     132             : // date format(7)
     133           0 : DateFormat::DateFormat()
     134             :     : HBox(CH_DATE_FORM)
     135           0 :     , dummy(0)
     136             : {
     137           0 : }
     138             : 
     139             : // date code(8)
     140           0 : DateCode::DateCode()
     141             :     : HBox(CH_DATE_CODE)
     142             :     , dummy(0)
     143           0 :     , key(0)
     144             : {
     145           0 : }
     146             : 
     147             : #define _DATECODE_WEEK_DEFINES_
     148             : #include "datecode.h"
     149             : 
     150           0 : hchar_string DateCode::GetString()
     151             : {
     152           0 :     hchar_string ret;
     153             :     const hchar *fmt;
     154             :     int i, num;
     155             :     const char *form;
     156             :     char cbuf[256];
     157             :     bool is_pm, add_zero;
     158             : 
     159           0 :     add_zero = false;
     160           0 :     format[DATE_SIZE - 1] = 0;
     161           0 :     fmt = format[0] ? format : defaultform;
     162             : 
     163           0 :     for (; *fmt && ((int) ret.size() < DATE_SIZE); fmt++)
     164             :     {
     165           0 :         form = (add_zero) ? "%02d" : "%d";
     166             : 
     167           0 :         add_zero = false;
     168           0 :         is_pm = (date[HOUR] >= 12);
     169           0 :         *cbuf = 0;
     170           0 :         num = -1;
     171             : 
     172           0 :         switch (*fmt)
     173             :         {
     174             :             case '0':
     175           0 :                 add_zero = true;
     176           0 :                 break;
     177             :             case '1':
     178           0 :                 num = date[YEAR];
     179           0 :                 form = "%04d";
     180           0 :                 break;
     181             :             case '!':
     182           0 :                 num = date[YEAR] % 100;
     183           0 :                 break;
     184             :             case '2':
     185           0 :                 num = date[MONTH];
     186           0 :                 break;
     187             :             case '@':
     188           0 :                 memcpy(cbuf, eng_mon + (date[MONTH] - 1) * 3, 3);
     189           0 :                 cbuf[3] = '.';
     190           0 :                 cbuf[4] = 0;
     191           0 :                 break;
     192             :             case '*':
     193           0 :                 strcpy(cbuf, en_mon[date[MONTH] - 1]);
     194           0 :                 break;
     195             :             case '3':                             /* 'D' is day of korean */
     196           0 :                 num = date[DAY];
     197           0 :                 break;
     198             :             case '#':
     199           0 :                 num = date[DAY];
     200           0 :                 switch (date[DAY] % 10)
     201             :                 {
     202             :                     case 1:
     203           0 :                         form = "%dst";
     204           0 :                         break;
     205             :                     case 2:
     206           0 :                         form = "%dnd";
     207           0 :                         break;
     208             :                     case 3:
     209           0 :                         form = "%drd";
     210           0 :                         break;
     211             :                     default:
     212           0 :                         form = "%dth";
     213           0 :                         break;
     214             :                 }
     215           0 :                 break;
     216             :             case '4':
     217           0 :                 num = date[HOUR] - ((date[HOUR] > 12) ? 12 : 0);
     218           0 :                 break;
     219             :             case '$':
     220           0 :                 num = date[HOUR];
     221           0 :                 break;
     222             :             case '5':
     223             :             case '%':
     224           0 :                 num = date[MIN];
     225           0 :                 break;
     226             :             case '6':
     227           0 :                 ret.push_back(kor_week[date[WEEK]]);
     228           0 :                 break;
     229             :             case '^':
     230           0 :                 memcpy(cbuf, eng_week + date[WEEK] * 3, 3);
     231           0 :                 cbuf[3] = '.';
     232           0 :                 cbuf[4] = 0;
     233           0 :                 break;
     234             :             case '_':
     235           0 :                 strcpy(cbuf, en_week[date[WEEK]]);
     236           0 :                 break;
     237             :             case '7':
     238           0 :                 ret.push_back(0xB5A1);
     239           0 :                 ret.push_back((is_pm) ? 0xD281 : 0xB8E5);
     240           0 :                 break;
     241             :             case '&':
     242           0 :                 strcpy(cbuf, (is_pm) ? "p.m." : "a.m.");
     243           0 :                 break;
     244             :             case '+':
     245           0 :                 strcpy(cbuf, (is_pm) ? "P.M." : "A.M.");
     246           0 :                 break;
     247             :             case '8':                             // 2.5 feature
     248             :             case '9':
     249             : #if 0
     250             : // LATER
     251             :                 mkcurfilename(cbuf, *fmt);
     252             :                 for (i = 0; cbuf[i] != 0 && slen > 1; i++)
     253             :                 {                                 //for hangle filename
     254             :                     if (cbuf[i] & 0x80 && cbuf[i + 1] != 0)
     255             :                     {
     256             :                         *d++ = (cbuf[i] << 8) | cbuf[i + 1];
     257             :                         i++;
     258             :                     }
     259             :                     else
     260             :                         *d++ = cbuf[i];
     261             :                     slen--;
     262             :                 }
     263             : #endif
     264           0 :                 cbuf[0] = 0;
     265           0 :                 break;
     266             :             case '~':                             // 3.0b feature
     267           0 :                 if (fmt[1] == 0)
     268           0 :                     break;
     269           0 :                 fmt++;
     270           0 :                 if (*fmt == '6')
     271             :                 {
     272           0 :                     ret.push_back(china_week[date[WEEK]]);
     273           0 :                     break;
     274             :                 }
     275           0 :                 break;
     276             :             default:
     277           0 :                 if (*fmt == '\\' && *++fmt == 0)
     278           0 :                     goto done;
     279           0 :                 ret.push_back(*fmt);
     280             :         }
     281           0 :         if (num != -1)
     282           0 :             sprintf(cbuf, form, num);
     283           0 :         for (i = 0; 0 != cbuf[i]; i++)
     284             :         {
     285           0 :             ret.push_back(*(cbuf + i));
     286             :         }
     287             :     }
     288             :     done:
     289           0 :     return ret;
     290             : }
     291             : 
     292             : 
     293             : // tab(9)
     294             : 
     295           0 : Tab::Tab()
     296             :     : HBox(CH_TAB)
     297             :     , width(0)
     298             :     , leader(0)
     299           0 :     , dummy(0)
     300             : {
     301           0 : }
     302             : 
     303             : 
     304             : // floating box
     305           0 : FBox::FBox(hchar hch):HBox(hch)
     306             : {
     307           0 :     prev = next = 0;
     308           0 :      zorder = 0;
     309           0 : }
     310             : 
     311             : 
     312           0 : FBox::~FBox()
     313             : {
     314           0 : }
     315             : 
     316             : 
     317             : // tbox(10) TABLE BOX MATH BUTTON HYPERTEXT
     318             : 
     319           0 : TxtBox::TxtBox(void):FBox(CH_TEXT_BOX), cell(0), plists(0)
     320             : {
     321           0 : }
     322             : 
     323             : 
     324           0 : TxtBox::~TxtBox(void)
     325             : {
     326           0 :     delete[]cell;
     327             : 
     328           0 :     for (int ii = 0; ii < nCell; ++ii)
     329             :     {
     330           0 :         std::list < HWPPara* >::iterator it = plists[ii].begin();
     331           0 :         for (; it != plists[ii].end(); ++it)
     332             :         {
     333           0 :             HWPPara* pPara = *it;
     334           0 :             delete pPara;
     335             :         }
     336             :     }
     337             : 
     338           0 :     std::list < HWPPara* >::iterator it = caption.begin();
     339           0 :     for (; it != caption.end(); ++it)
     340             :     {
     341           0 :         HWPPara* pPara = *it;
     342           0 :         delete pPara;
     343             :     }
     344             : 
     345           0 :     delete[]plists;
     346           0 : }
     347             : 
     348             : 
     349           0 : hunit TxtBox::Height(CharShape * csty)
     350             : {
     351           0 :     return (style.anchor_type == CHAR_ANCHOR) ? box_ys : csty->size;
     352             : }
     353             : 
     354             : 
     355             : // picture(11)
     356             : 
     357           0 : Picture::Picture()
     358             :     : FBox(CH_PICTURE)
     359             :     , dummy(0)
     360             :     , follow_block_size(0)
     361             :     , dummy1(0)
     362             :     , dummy2(0)
     363             :     , reserved1(0)
     364             :     , cap_pos(0)
     365             :     , num(0)
     366             :     , pictype(0)
     367             :     , follow(0)
     368           0 :     , ishyper(false)
     369             : {
     370           0 : }
     371             : 
     372           0 : Picture::~Picture(void)
     373             : {
     374           0 :     delete[]follow;
     375           0 :     if( pictype == PICTYPE_DRAW && picinfo.picdraw.hdo )
     376           0 :         delete (HWPDrawingObject *) picinfo.picdraw.hdo;
     377             : 
     378           0 :     std::list < HWPPara* >::iterator it = caption.begin();
     379           0 :     for (; it != caption.end(); ++it)
     380             :     {
     381           0 :         HWPPara* pPara = *it;
     382           0 :         delete pPara;
     383             :     }
     384           0 : }
     385             : 
     386             : 
     387           0 : int Picture::Type()
     388             : {
     389           0 :     return pictype;
     390             : }
     391             : 
     392             : 
     393           0 : hunit Picture::Height(CharShape * sty)
     394             : {
     395           0 :     return (style.anchor_type == CHAR_ANCHOR) ? box_ys : sty->size;
     396             : }
     397             : 
     398             : 
     399             : // line(14)
     400             : // hidden(15)
     401           0 : Hidden::~Hidden(void)
     402             : {
     403           0 :     std::list < HWPPara* >::iterator it = plist.begin();
     404           0 :     for (; it != plist.end(); ++it)
     405             :     {
     406           0 :         HWPPara* pPara = *it;
     407           0 :         delete pPara;
     408             :     }
     409           0 : }
     410             : 
     411             : 
     412             : // header/footer(16)
     413           0 : HeaderFooter::~HeaderFooter(void)
     414             : {
     415           0 :     std::list < HWPPara* >::iterator it = plist.begin();
     416           0 :     for (; it != plist.end(); ++it)
     417             :     {
     418           0 :         HWPPara* pPara = *it;
     419           0 :         delete pPara;
     420             :     }
     421           0 : }
     422             : 
     423             : 
     424             : // footnote(17)
     425           0 : Footnote::~Footnote(void)
     426             : {
     427           0 :     std::list < HWPPara* >::iterator it = plist.begin();
     428           0 :     for (; it != plist.end(); ++it)
     429             :     {
     430           0 :         HWPPara* pPara = *it;
     431           0 :         delete pPara;
     432             :     }
     433           0 : }
     434             : 
     435             : 
     436             : // auto number(18)
     437             : // new number(19)
     438             : // show page number (20)
     439             : // Ȧ¼öÂʽÃÀÛ/°¨Ãß±â (21)
     440             : 
     441             : // mail merge(22)
     442           0 : hchar_string MailMerge::GetString()
     443             : {
     444           0 :     return hchar_string();
     445             : }
     446             : 
     447             : 
     448             : // character compositon(23)
     449             : // hyphen(24)
     450             : // toc mark(25)
     451             : // index mark(26)
     452             : // outline(28)
     453             : 
     454             : #define OL_HANGL_JASO   0
     455             : #define OL_HANGL_KANATA 1
     456             : 
     457           0 : static hchar olHanglJaso(int num, int type)
     458             : {
     459             :     static const unsigned char han_init[] =
     460             :         { 0x88, 0x90, 0x94, 0x9c, 0xa0, 0xa4, 0xac, 0xb4, 0xb8, 0xc0, 0xc4, 0xc8, 0xcc, 0xd0 };
     461             :     static const unsigned char jung[] = { 3, 5, 7, 11, 13, 19, 20, 26, 27, 29, 30 };
     462             :     static const unsigned char jung2[] = { 3, 7, 13, 20, 27, 29, 30 };
     463             : 
     464           0 :     hchar hh = 0;
     465             : 
     466           0 :     if (type == OL_HANGL_JASO)
     467             :     {
     468           0 :         num = num % (14 + (sizeof(jung) / sizeof(char)));
     469             : 
     470           0 :         if (num < 14)
     471           0 :             hh = (han_init[num] << 8) | 'A';
     472             :         else
     473           0 :             hh = (jung[num - 14] << 5) | 0x8401;
     474             :     }
     475             :     else
     476             :     {
     477           0 :         if (num < 14)
     478           0 :             hh = (han_init[num] << 8) | 'a';
     479             :         else
     480             :         {
     481           0 :             int j = (num / 14) % (sizeof(jung2) / sizeof(char));
     482             : 
     483           0 :             num = num % 14;
     484           0 :             hh = (han_init[num] << 8) | (jung2[j] << 5) | 1;
     485             :         }
     486             :     }
     487           0 :     return hh;
     488             : }
     489             : 
     490             : 
     491           0 : static const hchar *GetOutlineStyleChars(int style)
     492             : {
     493             :     static const hchar out_bul_style_entry[5][8] =      // extern
     494             :     {
     495             :         {                                         // 0 OLSTY_BULLET1
     496             :             0x2f18, 0x2f12, 0x2f08, 0x2f02, 0x2f06, 0x2f00, 0x2043, 0x0000
     497             :         },
     498             :         {                                         // 1
     499             :             0x2f18, 0x2f12, 0x2f06, 0x2f00, 0x2f36, 0x2f30, 0x2043, 0x0000
     500             :         },
     501             :         {                                         // 2
     502             :             0x2f26, 0x2f20, 0x2f06, 0x2f00, 0x2f16, 0x2f10, 0x2043, 0x0000
     503             :         },
     504             :         {                                         // 3
     505             :             0x2f18, 0x2f16, 0x2f12, 0x2f10, 0x2f06, 0x2f00, 0x2043, 0x0000
     506             :         },
     507             :         {
     508             :             0xAC61, 0xB677, 0xB861, 0xB8F7, 0xB781, 0x0000
     509             :         },
     510             :     };
     511           0 :     if (style >= OLSTY_BULLET1 && style <= OLSTY_BULLET5)
     512           0 :         return out_bul_style_entry[style - OLSTY_BULLET1];
     513           0 :     return NULL;
     514             : }
     515             : 
     516             : 
     517           0 : static void getOutlineNumStr(int style, int level, int num, hchar * hstr)
     518             : {
     519             :     enum
     520             :     {
     521             :         U_ROM = 0x01, L_ROM = 0x02, U_ENG = 0x04, L_ENG = 0x08,
     522             :         HAN = 0x10, NUM = 0x20, L_BR = 0x40, R_BR = 0x80
     523             :     };
     524             :     static const unsigned char type_tbl[][MAX_OUTLINE_LEVEL] =
     525             :     {
     526             :         {
     527             :             U_ROM, HAN, NUM, HAN | R_BR, L_BR | NUM | R_BR,
     528             :             L_BR | HAN | R_BR, L_ROM | R_BR
     529             :         },
     530             :         {
     531             :             U_ROM, U_ENG, NUM, L_ENG | R_BR, L_BR | NUM | R_BR,
     532             :             L_BR | L_ENG | R_BR, L_ROM | R_BR
     533             :         },
     534             :         {
     535             :             NUM, HAN, L_BR | NUM | R_BR, L_BR | HAN | R_BR, NUM |
     536             :             R_BR, HAN | R_BR, L_ENG
     537             :         }
     538             :     };
     539           0 :     char fmt = type_tbl[style - OLSTY_NUMSIG1][level];
     540             :     char buf[80], *ptr;
     541             : 
     542           0 :     if (num < 1)
     543           0 :         num = 1;
     544           0 :     if (fmt & L_BR)
     545           0 :         *hstr++ = '(';
     546           0 :     if (fmt & NUM)
     547             :     {
     548           0 :         sprintf(buf, "%d", num);
     549           0 :         str2hstr(buf, hstr);
     550           0 :         hstr += strlen(buf);
     551             :     }
     552           0 :     else if (fmt & (U_ROM | L_ROM))
     553             :     {
     554           0 :         num2roman(num, buf);
     555           0 :         if (fmt & U_ROM)
     556             :         {
     557           0 :             ptr = buf;
     558           0 :             while (*ptr)
     559             :             {
     560           0 :                 *ptr = sal::static_int_cast<char>(toupper(*ptr));
     561           0 :                 ptr++;
     562             :             }
     563             :         }
     564           0 :         str2hstr(buf, hstr);
     565           0 :         hstr += strlen(buf);
     566             :     }
     567             :     else
     568             :     {
     569           0 :         num = (num - 1) % 26;
     570           0 :         if (fmt & U_ENG)
     571           0 :             *hstr++ = sal::static_int_cast<hchar>('A' + num);
     572           0 :         else if (fmt & L_ENG)
     573           0 :             *hstr++ = sal::static_int_cast<hchar>('a' + num);
     574           0 :         else if (fmt & HAN)
     575           0 :             *hstr++ = olHanglJaso(num, OL_HANGL_KANATA);
     576             :     }
     577           0 :     *hstr++ = (fmt & R_BR) ? ')' : '.';
     578           0 :     *hstr = 0;
     579           0 : }
     580             : 
     581             : 
     582             : enum
     583             : { OUTLINE_ON, OUTLINE_NUM };
     584             : 
     585             : /*  level Àº 0ºÎÅÍ ½ÃÀÛ. Áï 1.1.1. ÀÇ ·¹º§Àº 2ÀÌ´Ù.
     586             :     number´Â °ªÀÌ ±×´ë·Î µé¾î°¡ ÀÖ´Ù. Áï, 1.2.1¿¡´Â 1,2,1ÀÌ µé¾î°¡ ÀÖ´Ù.
     587             :     style Àº 1ºÎÅÍ °ªÀÌ µé¾î°¡ ÀÖ´Ù. hbox.h¿¡ Á¤ÀÇµÈ µ¥·Î..
     588             :  */
     589           0 : hchar_string Outline::GetUnicode() const
     590             : {
     591             :     const hchar *p;
     592             :      hchar buffer[255];
     593             : 
     594           0 :     buffer[0] = 0;
     595           0 :     if (kind == OUTLINE_NUM)
     596             :     {
     597             :         int levelnum;
     598           0 :         switch (shape)
     599             :         {
     600             :             case OLSTY_NUMS1:
     601             :             case OLSTY_NUMS2:
     602             :             {
     603             :                 char cur_num_str[10], buf[80];
     604             :                 int i;
     605             : 
     606           0 :                 buf[0] = 0;
     607           0 :                 for (i = 0; i <= level; i++)
     608             :                 {
     609           0 :                     levelnum = ((number[i] < 1) ? 1 : number[i]);
     610           0 :                     if (shape == OLSTY_NUMS2 && i && i == level)
     611           0 :                         sprintf(cur_num_str, "%d%c", levelnum, 0);
     612             :                     else
     613           0 :                         sprintf(cur_num_str, "%d%c", levelnum, '.');
     614           0 :                     strcat(buf, cur_num_str);
     615             :                 }
     616           0 :                 str2hstr(buf, buffer);
     617           0 :                 return hstr2ucsstr(buffer);
     618             :             }
     619             :             case OLSTY_NUMSIG1:
     620             :             case OLSTY_NUMSIG2:
     621             :             case OLSTY_NUMSIG3:
     622             :                 {
     623           0 :                 getOutlineNumStr(shape, level, number[level], buffer);
     624           0 :                 return hstr2ucsstr(buffer);
     625             :                 }
     626             :             case OLSTY_BULLET1:
     627             :             case OLSTY_BULLET2:
     628             :             case OLSTY_BULLET3:
     629             :             case OLSTY_BULLET4:
     630             :             case OLSTY_BULLET5:
     631             :                 {
     632           0 :                 p = GetOutlineStyleChars(shape);
     633           0 :                 buffer[0] = p[level];
     634           0 :                 buffer[1] = 0;
     635           0 :                      return hstr2ucsstr(buffer);
     636             :                 }
     637             :             case OLSTY_USER:
     638             :             case OLSTY_BULUSER:
     639             :                 {
     640             :                         char dest[80];
     641           0 :                     int l = 0;
     642           0 :                     int i = level;
     643           0 :                     if( deco[i][0] ){
     644           0 :                         buffer[l++] = deco[i][0];
     645             :                     }
     646             : /*  level Àº 0ºÎÅÍ ½ÃÀÛ. Áï 1.1.1. ÀÇ ·¹º§Àº 2ÀÌ´Ù.
     647             :     number´Â °ªÀÌ ±×´ë·Î µé¾î°¡ ÀÖ´Ù. Áï, 1.2.1¿¡´Â 1,2,1ÀÌ µé¾î°¡ ÀÖ´Ù.
     648             :     style Àº 1ºÎÅÍ °ªÀÌ µé¾î°¡ ÀÖ´Ù. hbox.h¿¡ Á¤ÀÇµÈ µ¥·Î..
     649             :  */
     650           0 :                     switch( user_shape[i] )
     651             :                     {
     652             :                         case 0:
     653           0 :                             buffer[l++] = '1' + number[i] - 1;
     654           0 :                             break;
     655             :                         case 1: /* ´ë¹®Àڷθ¶ */
     656             :                         case 2: /* ¼Ò¹®Àڷθ¶ */
     657           0 :                             num2roman(number[i], dest);
     658           0 :                             if( user_shape[i] == 1 ){
     659           0 :                                 char *ptr = dest;
     660           0 :                                 while( *ptr )
     661             :                                 {
     662           0 :                                     *ptr = sal::static_int_cast<char>(toupper(*ptr));
     663           0 :                                     ptr++;
     664             :                                 }
     665             :                             }
     666           0 :                             str2hstr(dest, buffer + l);
     667           0 :                             l += strlen(dest);
     668           0 :                             break;
     669             :                         case 3:
     670           0 :                             buffer[l++] = 'A' + number[i] -1;
     671           0 :                             break;
     672             :                         case 4:
     673           0 :                             buffer[l++] = 'a' + number[i] -1;
     674           0 :                             break;
     675             :                         case 5:
     676           0 :                             buffer[l++] = olHanglJaso(number[i] -1, OL_HANGL_KANATA);
     677           0 :                             break;
     678             :                         case 6:
     679           0 :                             buffer[l++] = olHanglJaso(number[i] -1, OL_HANGL_JASO);
     680           0 :                             break;
     681             :                         case 7: /* ÇÑÀÚ ¼ýÀÚ : ÀÏ¹Ý ¼ýÀڷΠǥÇö */
     682           0 :                             buffer[l++] = '1' + number[i] -1;
     683           0 :                             break;
     684             :                         case 8: /* ¿ø¼ýÀÚ */
     685           0 :                             buffer[l++] = 0x2e00 + number[i];
     686           0 :                             break;
     687             :                         case 9: /* ¿ø ¾ËÆĺª ¼Ò¹®ÀÚ */
     688           0 :                             buffer[l++] = 0x2c20 + number[i];
     689           0 :                             break;
     690             :                         case 10: /* ¿ø °¡³ª´Ù */
     691           0 :                             buffer[l++] = 0x2c50 + number[i] -1;
     692           0 :                             break;
     693             :                         case 11: /* ¿ø ¤¡ ¤¤ */
     694           0 :                             buffer[l++] = 0x2c40 + number[i] -1;
     695           0 :                             break;
     696             :                         case 12: /* À̾îÁø ¼ýÀÚ. */
     697             :                         {
     698             :                              char cur_num_str[10],buf[80];
     699             :                              int j;
     700           0 :                              buf[0] = 0;
     701           0 :                              for (j = 0; j <= level; j++)
     702             :                              {
     703           0 :                                   levelnum = ((number[j] < 1) ? 1 : number[j]);
     704           0 :                                   if ((j && j == level) || (j == level && deco[i][1]))
     705           0 :                                         sprintf(cur_num_str, "%d%c", levelnum, 0);
     706             :                                   else
     707           0 :                                         sprintf(cur_num_str, "%d%c", levelnum, '.');
     708           0 :                                   strcat(buf, cur_num_str);
     709             :                              }
     710           0 :                              str2hstr(buf, buffer + l);
     711           0 :                              l += strlen(buf);
     712           0 :                             break;
     713             :                         }
     714             :                         default:
     715           0 :                             buffer[l++] = user_shape[i];
     716           0 :                             break;
     717             :                     }
     718           0 :                     if( deco[i][1] ){
     719           0 :                         buffer[l++] = deco[i][1];
     720             :                     }
     721           0 :                     buffer[l] = 0;
     722           0 :                     return hstr2ucsstr(buffer);
     723             :                 }
     724             :         }
     725             :     }
     726           0 :     return hstr2ucsstr(buffer);
     727             : }
     728             : 
     729             : 
     730             : /* ¹­À½ ºóÄ­(30) */
     731             : /* °íÁ¤Æø ºóÄ­(31) */
     732             : 
     733             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10