LCOV - code coverage report
Current view: top level - sw/source/ui/vba - vbalisthelper.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 340 0.0 %
Date: 2012-08-25 Functions: 0 15 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 443 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2008 by Sun Microsystems, Inc.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : #include "vbalisthelper.hxx"
      29                 :            : #include <tools/diagnose_ex.h>
      30                 :            : #include <ooo/vba/word/WdListGalleryType.hpp>
      31                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      32                 :            : #include <com/sun/star/style/NumberingType.hpp>
      33                 :            : #include <com/sun/star/container/XIndexReplace.hpp>
      34                 :            : 
      35                 :            : using namespace ::ooo::vba;
      36                 :            : using namespace ::com::sun::star;
      37                 :            : 
      38                 :            : static const sal_Int32 LIST_LEVEL_COUNT = 9;
      39                 :            : 
      40                 :            : static const char WORD_BULLET_GALLERY[] = "WdBullet";
      41                 :            : static const char WORD_NUMBER_GALLERY[] = "WdNumber";
      42                 :            : static const char WORD_OUTLINE_NUMBER_GALLERY[] = "WdOutlineNumber";
      43                 :            : 
      44                 :            : static const char UNO_NAME_PARENT_NUMBERING[] = "ParentNumbering";
      45                 :            : static const char UNO_NAME_PREFIX[] = "Prefix";
      46                 :            : static const char UNO_NAME_SUFFIX[] = "Suffix";
      47                 :            : static const char UNO_NAME_CHAR_STYLE_NAME[] = "CharStyleName";
      48                 :            : static const char UNO_NAME_NUMBERING_TYPE[] = "NumberingType";
      49                 :            : static const char UNO_NAME_BULLET_CHAR[] = "BulletChar";
      50                 :            : 
      51                 :            : static const sal_Int16 CHAR_CLOSED_DOT = 8226;
      52                 :            : static const sal_Int16 CHAR_EMPTY_DOT = 111;
      53                 :            : static const sal_Int16 CHAR_SQUARE = 9632;
      54                 :            : static const sal_Int16 CHAR_STAR_SYMBOL = 10026;
      55                 :            : static const sal_Int16 CHAR_FOUR_DIAMONDS = 10070;
      56                 :            : static const sal_Int16 CHAR_DIAMOND = 10022;
      57                 :            : static const sal_Int16 CHAR_ARROW = 10146;
      58                 :            : static const sal_Int16 CHAR_CHECK_MARK = 10003;
      59                 :            : 
      60                 :          0 : SwVbaListHelper::SwVbaListHelper( const css::uno::Reference< css::text::XTextDocument >& xTextDoc, sal_Int32 nGalleryType, sal_Int32 nTemplateType ) throw( css::uno::RuntimeException ) : mxTextDocument( xTextDoc ), mnGalleryType( nGalleryType ), mnTemplateType( nTemplateType )
      61                 :            : {
      62         [ #  # ]:          0 :     Init();
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : void SwVbaListHelper::Init() throw( css::uno::RuntimeException )
      66                 :            : {
      67                 :            :     // set the numbering style name
      68   [ #  #  #  # ]:          0 :     switch( mnGalleryType )
      69                 :            :     {
      70                 :            :         case word::WdListGalleryType::wdBulletGallery:
      71                 :            :         {
      72                 :          0 :             msStyleName = rtl::OUString(WORD_BULLET_GALLERY );
      73                 :          0 :             break;
      74                 :            :         }
      75                 :            :         case word::WdListGalleryType::wdNumberGallery:
      76                 :            :         {
      77                 :          0 :             msStyleName = rtl::OUString(WORD_NUMBER_GALLERY );
      78                 :          0 :             break;
      79                 :            :         }
      80                 :            :         case word::WdListGalleryType::wdOutlineNumberGallery:
      81                 :            :         {
      82                 :          0 :             msStyleName = rtl::OUString(WORD_OUTLINE_NUMBER_GALLERY );
      83                 :          0 :             break;
      84                 :            :         }
      85                 :            :         default:
      86                 :            :         {
      87         [ #  # ]:          0 :             throw uno::RuntimeException();
      88                 :            :         }
      89                 :            :     }
      90                 :          0 :     msStyleName += rtl::OUString::valueOf( mnTemplateType );
      91                 :            : 
      92                 :            :     // get the numbering style
      93         [ #  # ]:          0 :     uno::Reference< style::XStyleFamiliesSupplier > xStyleSupplier( mxTextDocument, uno::UNO_QUERY_THROW );
      94 [ #  # ][ #  # ]:          0 :     mxStyleFamily.set( xStyleSupplier->getStyleFamilies()->getByName(rtl::OUString( "NumberingStyles" ) ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
                 [ #  # ]
      95                 :            :     OSL_TRACE("SwVbaListHelper::Init: numbering style name: %s", rtl::OUStringToOString( msStyleName, RTL_TEXTENCODING_UTF8 ).getStr() );
      96 [ #  # ][ #  # ]:          0 :     if( mxStyleFamily->hasByName( msStyleName ) )
                 [ #  # ]
      97                 :            :     {
      98 [ #  # ][ #  # ]:          0 :         mxStyleProps.set( mxStyleFamily->getByName( msStyleName ), uno::UNO_QUERY_THROW );
                 [ #  # ]
      99 [ #  # ][ #  # ]:          0 :         mxNumberingRules.set( mxStyleProps->getPropertyValue( rtl::OUString( "NumberingRules" ) ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     100                 :            :     }
     101                 :            :     else
     102                 :            :     {
     103                 :            :         // create new numbering style
     104         [ #  # ]:          0 :         uno::Reference< lang::XMultiServiceFactory > xDocMSF( mxTextDocument, uno::UNO_QUERY_THROW );
     105 [ #  # ][ #  # ]:          0 :         mxStyleProps.set( xDocMSF->createInstance(  rtl::OUString( "com.sun.star.style.NumberingStyle" ) ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     106                 :            :         // insert this style into style family, or the property NumberingRules doesn't exist.
     107 [ #  # ][ #  # ]:          0 :         mxStyleFamily->insertByName( msStyleName, uno::makeAny( mxStyleProps ) );
                 [ #  # ]
     108 [ #  # ][ #  # ]:          0 :         mxStyleProps->getPropertyValue( rtl::OUString( "NumberingRules" ) ) >>= mxNumberingRules;
                 [ #  # ]
     109                 :            : 
     110         [ #  # ]:          0 :         CreateListTemplate();
     111                 :            : 
     112 [ #  # ][ #  # ]:          0 :         mxStyleProps->setPropertyValue( rtl::OUString( "NumberingRules" ) , uno::makeAny( mxNumberingRules ) );
                 [ #  # ]
     113                 :          0 :     }
     114                 :          0 : }
     115                 :            : 
     116                 :          0 : void SwVbaListHelper::CreateListTemplate() throw( css::uno::RuntimeException )
     117                 :            : {
     118   [ #  #  #  # ]:          0 :     switch( mnGalleryType )
     119                 :            :     {
     120                 :            :         case word::WdListGalleryType::wdBulletGallery:
     121                 :            :         {
     122                 :          0 :             CreateBulletListTemplate();
     123                 :          0 :             break;
     124                 :            :         }
     125                 :            :         case word::WdListGalleryType::wdNumberGallery:
     126                 :            :         {
     127                 :          0 :             CreateNumberListTemplate();
     128                 :          0 :             break;
     129                 :            :         }
     130                 :            :         case word::WdListGalleryType::wdOutlineNumberGallery:
     131                 :            :         {
     132                 :          0 :             CreateOutlineNumberListTemplate();
     133                 :          0 :             break;
     134                 :            :         }
     135                 :            :         default:
     136                 :            :         {
     137         [ #  # ]:          0 :             throw uno::RuntimeException();
     138                 :            :         }
     139                 :            :     }
     140                 :          0 : }
     141                 :            : 
     142                 :          0 : void SwVbaListHelper::CreateBulletListTemplate() throw( css::uno::RuntimeException )
     143                 :            : {
     144                 :            :     // there is only 1 level for each bullet list in MSWord
     145                 :          0 :     sal_Int32 nLevel = 0;
     146         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     147 [ #  # ][ #  # ]:          0 :     mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     148                 :          0 :     rtl::OUString sCharStyleName( "Bullet Symbols" );
     149 [ #  # ][ #  # ]:          0 :     setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
     150                 :          0 :     sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
     151 [ #  # ][ #  # ]:          0 :     setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     152                 :            : 
     153                 :          0 :     rtl::OUString aBulletChar;
     154   [ #  #  #  #  :          0 :     switch( mnTemplateType )
             #  #  #  # ]
     155                 :            :     {
     156                 :            :         case 1:
     157                 :            :         {
     158                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
     159                 :          0 :             break;
     160                 :            :         }
     161                 :            :         case 2:
     162                 :            :         {
     163                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_EMPTY_DOT ) );
     164                 :          0 :             break;
     165                 :            :         }
     166                 :            :         case 3:
     167                 :            :         {
     168                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
     169                 :          0 :             break;
     170                 :            :         }
     171                 :            :         case 4:
     172                 :            :         {
     173                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_STAR_SYMBOL ) );
     174                 :          0 :             break;
     175                 :            :         }
     176                 :            :         case 5:
     177                 :            :         {
     178                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
     179                 :          0 :             break;
     180                 :            :         }
     181                 :            :         case 6:
     182                 :            :         {
     183                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
     184                 :          0 :             break;
     185                 :            :         }
     186                 :            :         case 7:
     187                 :            :         {
     188                 :          0 :             aBulletChar = rtl::OUString( sal_Unicode( CHAR_CHECK_MARK ) );
     189                 :          0 :             break;
     190                 :            :         }
     191                 :            :         default:
     192                 :            :         {
     193                 :            :             // we only support 7 types template now
     194         [ #  # ]:          0 :             throw css::uno::RuntimeException();
     195                 :            :         }
     196                 :            :     }
     197 [ #  # ][ #  # ]:          0 :     setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
     198                 :            : 
     199 [ #  # ][ #  # ]:          0 :     mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
         [ #  # ][ #  # ]
     200                 :          0 : }
     201                 :            : 
     202                 :          0 : void SwVbaListHelper::CreateNumberListTemplate() throw( css::uno::RuntimeException )
     203                 :            : {
     204                 :            :     // there is only 1 level for each bullet list in MSWord
     205                 :          0 :     sal_Int32 nLevel = 0;
     206         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     207 [ #  # ][ #  # ]:          0 :     mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     208                 :            : 
     209                 :          0 :     sal_Int16 nNumberingType = 0;
     210                 :          0 :     rtl::OUString sSuffix;
     211   [ #  #  #  #  :          0 :     switch( mnTemplateType )
             #  #  #  # ]
     212                 :            :     {
     213                 :            :         case 1:
     214                 :            :         {
     215                 :          0 :             nNumberingType = style::NumberingType::ARABIC;
     216                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     217                 :          0 :             break;
     218                 :            :         }
     219                 :            :         case 2:
     220                 :            :         {
     221                 :          0 :             nNumberingType = style::NumberingType::ARABIC;
     222                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     223                 :          0 :             break;
     224                 :            :         }
     225                 :            :         case 3:
     226                 :            :         {
     227                 :          0 :             nNumberingType = style::NumberingType::ROMAN_UPPER;
     228                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     229                 :          0 :             break;
     230                 :            :         }
     231                 :            :         case 4:
     232                 :            :         {
     233                 :          0 :             nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
     234                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     235                 :          0 :             break;
     236                 :            :         }
     237                 :            :         case 5:
     238                 :            :         {
     239                 :          0 :             nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     240                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     241                 :          0 :             break;
     242                 :            :         }
     243                 :            :         case 6:
     244                 :            :         {
     245                 :          0 :             nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     246                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     247                 :          0 :             break;
     248                 :            :         }
     249                 :            :         case 7:
     250                 :            :         {
     251                 :          0 :             nNumberingType = style::NumberingType::ROMAN_LOWER;
     252                 :          0 :             sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     253                 :          0 :             break;
     254                 :            :         }
     255                 :            :         default:
     256                 :            :         {
     257                 :            :             // we only support 7 types template now
     258         [ #  # ]:          0 :             throw css::uno::RuntimeException();
     259                 :            :         }
     260                 :            :     }
     261 [ #  # ][ #  # ]:          0 :     setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     262 [ #  # ][ #  # ]:          0 :     setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
     263                 :            : 
     264 [ #  # ][ #  # ]:          0 :     mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
         [ #  # ][ #  # ]
     265                 :          0 : }
     266                 :            : 
     267                 :          0 : void SwVbaListHelper::CreateOutlineNumberListTemplate() throw( css::uno::RuntimeException )
     268                 :            : {
     269   [ #  #  #  #  :          0 :     switch( mnTemplateType )
             #  #  #  # ]
     270                 :            :     {
     271                 :            :         case 1:
     272                 :            :         {
     273                 :          0 :             CreateOutlineNumberForType1();
     274                 :          0 :             break;
     275                 :            :         }
     276                 :            :         case 2:
     277                 :            :         {
     278                 :          0 :             CreateOutlineNumberForType2();
     279                 :          0 :             break;
     280                 :            :         }
     281                 :            :         case 3:
     282                 :            :         {
     283                 :          0 :             CreateOutlineNumberForType3();
     284                 :          0 :             break;
     285                 :            :         }
     286                 :            :         case 4:
     287                 :            :         {
     288                 :          0 :             CreateOutlineNumberForType4();
     289                 :          0 :             break;
     290                 :            :         }
     291                 :            :         case 5:
     292                 :            :         {
     293                 :          0 :             CreateOutlineNumberForType5();
     294                 :          0 :             break;
     295                 :            :         }
     296                 :            :         case 6:
     297                 :            :         {
     298                 :          0 :             CreateOutlineNumberForType6();
     299                 :          0 :             break;
     300                 :            :         }
     301                 :            :         case 7:
     302                 :            :         {
     303                 :          0 :             CreateOutlineNumberForType7();
     304                 :          0 :             break;
     305                 :            :         }
     306                 :            :         default:
     307                 :            :         {
     308                 :            :             // we only support 7 types template now
     309         [ #  # ]:          0 :             throw css::uno::RuntimeException();
     310                 :            :         }
     311                 :            :     }
     312                 :          0 : }
     313                 :            : 
     314                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType1() throw( css::uno::RuntimeException )
     315                 :            : {
     316                 :          0 :     sal_Int16 nNumberingType = 0;
     317                 :          0 :     rtl::OUString sPrefix;
     318                 :          0 :     rtl::OUString sSuffix;
     319         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     320                 :            : 
     321         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     322                 :            :     {
     323 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     324   [ #  #  #  #  :          0 :         switch( nLevel )
             #  #  #  #  
                      # ]
     325                 :            :         {
     326                 :            :             case 0:
     327                 :            :             case 1:
     328                 :            :             {
     329                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     330                 :          0 :                 sPrefix = rtl::OUString();
     331                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     332                 :          0 :                 break;
     333                 :            :             }
     334                 :            :             case 2:
     335                 :            :             {
     336                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     337                 :          0 :                 sPrefix = rtl::OUString();
     338                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     339                 :          0 :                 break;
     340                 :            :             }
     341                 :            :             case 3:
     342                 :            :             {
     343                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     344                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     345                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     346                 :          0 :                 break;
     347                 :            :             }
     348                 :            :             case 4:
     349                 :            :             {
     350                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     351                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     352                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     353                 :          0 :                 break;
     354                 :            :             }
     355                 :            :             case 5:
     356                 :            :             {
     357                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     358                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     359                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     360                 :          0 :                 break;
     361                 :            :             }
     362                 :            :             case 6:
     363                 :            :             {
     364                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     365                 :          0 :                 sPrefix = rtl::OUString();
     366                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     367                 :          0 :                 break;
     368                 :            :             }
     369                 :            :             case 7:
     370                 :            :             {
     371                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     372                 :          0 :                 sPrefix = rtl::OUString();
     373                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     374                 :          0 :                 break;
     375                 :            :             }
     376                 :            :             case 8:
     377                 :            :             {
     378                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     379                 :          0 :                 sPrefix = rtl::OUString();
     380                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     381                 :          0 :                 break;
     382                 :            :             }
     383                 :            :             default:
     384                 :            :             {
     385         [ #  # ]:          0 :                 throw uno::RuntimeException();
     386                 :            :             }
     387                 :            :         }
     388 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     389 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
     390 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
     391 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     392         [ #  # ]:          0 :     }
     393                 :          0 : }
     394                 :            : 
     395                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType2() throw( css::uno::RuntimeException )
     396                 :            : {
     397                 :          0 :     sal_Int16 nNumberingType = style::NumberingType::ARABIC;
     398                 :          0 :     sal_Int16 nParentNumbering = 0;
     399                 :          0 :     rtl::OUString sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     400         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     401                 :            : 
     402         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     403                 :            :     {
     404 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     405 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     406 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
     407         [ #  # ]:          0 :         if( nLevel != 0 )
     408                 :            :         {
     409                 :          0 :             nParentNumbering = sal_Int16( nLevel - 1 );
     410 [ #  # ][ #  # ]:          0 :             setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
     411                 :            :         }
     412 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     413         [ #  # ]:          0 :     }
     414                 :          0 : }
     415                 :            : 
     416                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType3() throw( css::uno::RuntimeException )
     417                 :            : {
     418                 :          0 :     sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL;
     419                 :          0 :     rtl::OUString sCharStyleName( "Bullet Symbols" );
     420                 :          0 :     rtl::OUString aBulletChar;
     421         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     422                 :            : 
     423         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     424                 :            :     {
     425 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     426 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     427 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_CHAR_STYLE_NAME ), uno::makeAny( sCharStyleName ) );
     428   [ #  #  #  #  :          0 :         switch( nLevel )
                   #  # ]
     429                 :            :         {
     430                 :            :             case 0:
     431                 :            :             {
     432                 :          0 :                 aBulletChar = rtl::OUString( sal_Unicode( CHAR_FOUR_DIAMONDS ) );
     433                 :          0 :                 break;
     434                 :            :             }
     435                 :            :             case 1:
     436                 :            :             case 5:
     437                 :            :             {
     438                 :          0 :                 aBulletChar = rtl::OUString( sal_Unicode( CHAR_ARROW ) );
     439                 :          0 :                 break;
     440                 :            :             }
     441                 :            :             case 2:
     442                 :            :             case 6:
     443                 :            :             {
     444                 :          0 :                 aBulletChar = rtl::OUString( sal_Unicode( CHAR_SQUARE ) );
     445                 :          0 :                 break;
     446                 :            :             }
     447                 :            :             case 3:
     448                 :            :             case 7:
     449                 :            :             {
     450                 :          0 :                 aBulletChar = rtl::OUString( sal_Unicode( CHAR_CLOSED_DOT ) );
     451                 :          0 :                 break;
     452                 :            :             }
     453                 :            :             case 4:
     454                 :            :             case 8:
     455                 :            :             {
     456                 :          0 :                 aBulletChar = rtl::OUString( sal_Unicode( CHAR_DIAMOND ) );
     457                 :          0 :                 break;
     458                 :            :             }
     459                 :            :             default:
     460                 :            :             {
     461         [ #  # ]:          0 :                 throw uno::RuntimeException();
     462                 :            :             }
     463                 :            :         }
     464 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_BULLET_CHAR ), uno::makeAny( aBulletChar ) );
     465 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     466         [ #  # ]:          0 :     }
     467                 :          0 : }
     468                 :            : 
     469                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType4() throw( css::uno::RuntimeException )
     470                 :            : {
     471                 :          0 :     sal_Int16 nNumberingType = 0;
     472                 :          0 :     rtl::OUString sPrefix;
     473                 :          0 :     rtl::OUString sSuffix;
     474         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     475                 :            : 
     476         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     477                 :            :     {
     478 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     479   [ #  #  #  #  :          0 :         switch( nLevel )
          #  #  #  #  #  
                      # ]
     480                 :            :         {
     481                 :            :             case 0:
     482                 :            :             {
     483                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_UPPER;
     484                 :          0 :                 sPrefix = rtl::OUString();
     485                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     486                 :          0 :                 break;
     487                 :            :             }
     488                 :            :             case 1:
     489                 :            :             {
     490                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     491                 :          0 :                 sPrefix = rtl::OUString();
     492                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     493                 :          0 :                 sal_Int16 nParentNumbering = 0;
     494 [ #  # ][ #  # ]:          0 :                 setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
     495                 :            :                 break;
     496                 :            :             }
     497                 :            :             case 2:
     498                 :            :             {
     499                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     500                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     501                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     502                 :          0 :                 break;
     503                 :            :             }
     504                 :            :             case 3:
     505                 :            :             {
     506                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     507                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     508                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     509                 :          0 :                 break;
     510                 :            :             }
     511                 :            :             case 4:
     512                 :            :             {
     513                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     514                 :          0 :                 sPrefix = rtl::OUString();
     515                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     516                 :          0 :                 break;
     517                 :            :             }
     518                 :            :             case 5:
     519                 :            :             {
     520                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     521                 :          0 :                 sPrefix = rtl::OUString();
     522                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     523                 :          0 :                 break;
     524                 :            :             }
     525                 :            :             case 6:
     526                 :            :             {
     527                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     528                 :          0 :                 sPrefix = rtl::OUString();
     529                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     530                 :          0 :                 break;
     531                 :            :             }
     532                 :            :             case 7:
     533                 :            :             {
     534                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     535                 :          0 :                 sPrefix = rtl::OUString();
     536                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     537                 :          0 :                 break;
     538                 :            :             }
     539                 :            :             case 8:
     540                 :            :             {
     541                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     542                 :          0 :                 sPrefix = rtl::OUString();
     543                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     544                 :          0 :                 break;
     545                 :            :             }
     546                 :            :             default:
     547                 :            :             {
     548         [ #  # ]:          0 :                 throw uno::RuntimeException();
     549                 :            :             }
     550                 :            :         }
     551 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     552 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
     553 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
     554 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     555         [ #  # ]:          0 :     }
     556                 :          0 : }
     557                 :            : 
     558                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType5() throw( css::uno::RuntimeException )
     559                 :            : {
     560                 :          0 :     sal_Int16 nNumberingType = style::NumberingType::ARABIC;
     561                 :          0 :     sal_Int16 nParentNumbering = 0;
     562         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     563                 :            : 
     564         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     565                 :            :     {
     566 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     567 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     568         [ #  # ]:          0 :         if( nLevel != 0 )
     569                 :            :         {
     570                 :          0 :             nParentNumbering = sal_Int16( nLevel - 1 );
     571 [ #  # ][ #  # ]:          0 :             setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PARENT_NUMBERING ), uno::makeAny( nParentNumbering ) );
     572                 :            :         }
     573 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     574         [ #  # ]:          0 :     }
     575                 :          0 : }
     576                 :            : 
     577                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType6() throw( css::uno::RuntimeException )
     578                 :            : {
     579                 :          0 :     sal_Int16 nNumberingType = 0;
     580                 :          0 :     rtl::OUString sPrefix;
     581                 :          0 :     rtl::OUString sSuffix;
     582         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     583                 :            : 
     584         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     585                 :            :     {
     586 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     587   [ #  #  #  #  :          0 :         switch( nLevel )
          #  #  #  #  #  
                      # ]
     588                 :            :         {
     589                 :            :             case 0:
     590                 :            :             {
     591                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_UPPER;
     592                 :          0 :                 sPrefix = rtl::OUString();
     593                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     594                 :          0 :                 break;
     595                 :            :             }
     596                 :            :             case 1:
     597                 :            :             {
     598                 :          0 :                 nNumberingType = style::NumberingType::CHARS_UPPER_LETTER;
     599                 :          0 :                 sPrefix = rtl::OUString();
     600                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     601                 :          0 :                 break;
     602                 :            :             }
     603                 :            :             case 2:
     604                 :            :             {
     605                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     606                 :          0 :                 sPrefix = rtl::OUString();
     607                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     608                 :          0 :                 break;
     609                 :            :             }
     610                 :            :             case 3:
     611                 :            :             {
     612                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     613                 :          0 :                 sPrefix = rtl::OUString();
     614                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     615                 :          0 :                 break;
     616                 :            :             }
     617                 :            :             case 4:
     618                 :            :             {
     619                 :          0 :                 nNumberingType = style::NumberingType::ARABIC;
     620                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     621                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     622                 :          0 :                 break;
     623                 :            :             }
     624                 :            :             case 5:
     625                 :            :             {
     626                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     627                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     628                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     629                 :          0 :                 break;
     630                 :            :             }
     631                 :            :             case 6:
     632                 :            :             {
     633                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     634                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     635                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode(')') );
     636                 :          0 :                 break;
     637                 :            :             }
     638                 :            :             case 7:
     639                 :            :             {
     640                 :          0 :                 nNumberingType = style::NumberingType::CHARS_LOWER_LETTER;
     641                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     642                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     643                 :          0 :                 break;
     644                 :            :             }
     645                 :            :             case 8:
     646                 :            :             {
     647                 :          0 :                 nNumberingType = style::NumberingType::ROMAN_LOWER;
     648                 :          0 :                 sPrefix = rtl::OUString::valueOf( sal_Unicode('(') );
     649                 :          0 :                 sSuffix = rtl::OUString::valueOf( sal_Unicode('.') );
     650                 :          0 :                 break;
     651                 :            :             }
     652                 :            :             default:
     653                 :            :             {
     654         [ #  # ]:          0 :                 throw uno::RuntimeException();
     655                 :            :             }
     656                 :            :         }
     657 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     658 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
     659 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_SUFFIX ), uno::makeAny( sSuffix ) );
     660 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     661         [ #  # ]:          0 :     }
     662                 :          0 : }
     663                 :            : 
     664                 :          0 : void SwVbaListHelper::CreateOutlineNumberForType7() throw( css::uno::RuntimeException )
     665                 :            : {
     666                 :          0 :     sal_Int16 nNumberingType = style::NumberingType::ARABIC;
     667         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     668                 :          0 :     rtl::OUString sPrefix("Chapter ");
     669                 :            : 
     670         [ #  # ]:          0 :     for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ )
     671                 :            :     {
     672 [ #  # ][ #  # ]:          0 :         mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     673 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_NUMBERING_TYPE ), uno::makeAny( nNumberingType ) );
     674 [ #  # ][ #  # ]:          0 :         setOrAppendPropertyValue( aPropertyValues, rtl::OUString(UNO_NAME_PREFIX ), uno::makeAny( sPrefix ) );
     675 [ #  # ][ #  # ]:          0 :         mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     676         [ #  # ]:          0 :     }
     677                 :          0 : }
     678                 :            : 
     679                 :          0 : uno::Any SwVbaListHelper::getPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName ) throw( css::uno::RuntimeException )
     680                 :            : {
     681         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     682 [ #  # ][ #  # ]:          0 :     mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     683 [ #  # ][ #  # ]:          0 :     return getPropertyValue( aPropertyValues, sName );
     684                 :            : }
     685                 :            : 
     686                 :          0 : void SwVbaListHelper::setPropertyValueWithNameAndLevel( sal_Int32 nLevel, const rtl::OUString& sName, const css::uno::Any& aValue ) throw( css::uno::RuntimeException )
     687                 :            : {
     688         [ #  # ]:          0 :     uno::Sequence< beans::PropertyValue > aPropertyValues;
     689 [ #  # ][ #  # ]:          0 :     mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues;
                 [ #  # ]
     690         [ #  # ]:          0 :     setOrAppendPropertyValue( aPropertyValues, sName, aValue );
     691 [ #  # ][ #  # ]:          0 :     mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) );
                 [ #  # ]
     692 [ #  # ][ #  # ]:          0 :     mxStyleProps->setPropertyValue( rtl::OUString( "NumberingRules" ) , uno::makeAny( mxNumberingRules ) );
         [ #  # ][ #  # ]
     693                 :          0 : }
     694                 :            : 
     695                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10