LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/cui/source/tabpages - numpages.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 2045 0.0 %
Date: 2013-07-09 Functions: 0 140 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             :  * 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 <com/sun/star/text/HoriOrientation.hpp>
      21             : #include <com/sun/star/text/VertOrientation.hpp>
      22             : #include <com/sun/star/text/RelOrientation.hpp>
      23             : 
      24             : #include <numpages.hxx>
      25             : #include <numpages.hrc>
      26             : #include <dialmgr.hxx>
      27             : #include <tools/shl.hxx>
      28             : #include <i18nlangtag/mslangid.hxx>
      29             : #include <helpid.hrc>
      30             : #include <editeng/numitem.hxx>
      31             : #include <svl/eitem.hxx>
      32             : #include <vcl/layout.hxx>
      33             : #include <vcl/svapp.hxx>
      34             : #include <svx/gallery.hxx>
      35             : #include <svl/urihelper.hxx>
      36             : #include <editeng/brushitem.hxx>
      37             : #include <svl/intitem.hxx>
      38             : #include <sfx2/objsh.hxx>
      39             : #include <vcl/graph.hxx>
      40             : #include <vcl/msgbox.hxx>
      41             : #include "cuicharmap.hxx"
      42             : #include <editeng/flstitem.hxx>
      43             : #include <svx/dlgutil.hxx>
      44             : #include <svx/xtable.hxx>
      45             : #include <svx/drawitem.hxx>
      46             : #include <svx/numvset.hxx>
      47             : #include <sfx2/htmlmode.hxx>
      48             : #include <unotools/pathoptions.hxx>
      49             : #include <svtools/ctrltool.hxx>
      50             : #include <editeng/unolingu.hxx>
      51             : #include <com/sun/star/style/NumberingType.hpp>
      52             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      53             : #include <com/sun/star/container/XIndexAccess.hpp>
      54             : #include <com/sun/star/text/DefaultNumberingProvider.hpp>
      55             : #include <com/sun/star/text/XDefaultNumberingProvider.hpp>
      56             : #include <com/sun/star/text/XNumberingFormatter.hpp>
      57             : #include <com/sun/star/beans/PropertyValue.hpp>
      58             : #include <comphelper/processfactory.hxx>
      59             : #include <com/sun/star/text/XNumberingTypeInfo.hpp>
      60             : #include <svx/dialmgr.hxx>
      61             : #include <svx/dialogs.hrc>
      62             : 
      63             : #include <algorithm>
      64             : #include <vector>
      65             : #include "sfx2/opengrf.hxx"
      66             : 
      67             : #include <cuires.hrc>
      68             : #include <sfx2/request.hxx>
      69             : #include <svl/aeitem.hxx>
      70             : #include <svl/stritem.hxx>
      71             : #include <svl/slstitm.hxx>
      72             : 
      73             : using namespace com::sun::star;
      74             : using namespace com::sun::star::uno;
      75             : using namespace com::sun::star::beans;
      76             : using namespace com::sun::star::lang;
      77             : using namespace com::sun::star::i18n;
      78             : using namespace com::sun::star::text;
      79             : using namespace com::sun::star::container;
      80             : using namespace com::sun::star::style;
      81             : 
      82             : #define NUM_PAGETYPE_BULLET         0
      83             : #define NUM_PAGETYPE_SINGLENUM      1
      84             : #define NUM_PAGETYPE_NUM            2
      85             : 
      86             : #define SHOW_NUMBERING              0
      87             : #define SHOW_BULLET                 1
      88             : #define SHOW_BITMAP                 2
      89             : 
      90             : #define MAX_BMP_WIDTH               16
      91             : #define MAX_BMP_HEIGHT              16
      92             : 
      93             : static sal_Bool bLastRelative =         sal_False;
      94             : static const sal_Char cNumberingType[] = "NumberingType";
      95             : static const sal_Char cParentNumbering[] = "ParentNumbering";
      96             : static const sal_Char cPrefix[] = "Prefix";
      97             : static const sal_Char cSuffix[] = "Suffix";
      98             : static const sal_Char cBulletChar[] = "BulletChar";
      99             : static const sal_Char cBulletFontName[] = "BulletFontName";
     100             : 
     101           0 : static Reference<XDefaultNumberingProvider> lcl_GetNumberingProvider()
     102             : {
     103           0 :     Reference<XComponentContext>         xContext( ::comphelper::getProcessComponentContext() );
     104           0 :     Reference<XDefaultNumberingProvider> xRet = text::DefaultNumberingProvider::create(xContext);
     105           0 :     return xRet;
     106             : }
     107             : 
     108           0 : static SvxNumSettings_Impl* lcl_CreateNumSettingsPtr(const Sequence<PropertyValue>& rLevelProps)
     109             : {
     110           0 :     const PropertyValue* pValues = rLevelProps.getConstArray();
     111           0 :     SvxNumSettings_Impl* pNew = new SvxNumSettings_Impl;
     112           0 :     for(sal_Int32 j = 0; j < rLevelProps.getLength(); j++)
     113             :     {
     114           0 :         if ( pValues[j].Name == cNumberingType )
     115           0 :             pValues[j].Value >>= pNew->nNumberType;
     116           0 :         else if ( pValues[j].Name == cPrefix )
     117           0 :             pValues[j].Value >>= pNew->sPrefix;
     118           0 :         else if ( pValues[j].Name == cSuffix )
     119           0 :             pValues[j].Value >>= pNew->sSuffix;
     120           0 :         else if ( pValues[j].Name == cParentNumbering )
     121           0 :             pValues[j].Value >>= pNew->nParentNumbering;
     122           0 :         else if ( pValues[j].Name == cBulletChar )
     123           0 :             pValues[j].Value >>= pNew->sBulletChar;
     124           0 :         else if ( pValues[j].Name == cBulletFontName )
     125           0 :             pValues[j].Value >>= pNew->sBulletFont;
     126             :     }
     127           0 :     return pNew;
     128             : }
     129             : 
     130             : // the selection of bullets from the StarSymbol
     131             : static const sal_Unicode aBulletTypes[] =
     132             : {
     133             :     0x2022,
     134             :     0x25cf,
     135             :     0xe00c,
     136             :     0xe00a,
     137             :     0x2794,
     138             :     0x27a2,
     139             :     0x2717,
     140             :     0x2714
     141             : };
     142             : 
     143             : static sal_Char const aNumChar[] =
     144             : {
     145             :     'A', //CHARS_UPPER_LETTER
     146             :     'a', //CHARS_LOWER_LETTER
     147             :     'I', //ROMAN_UPPER
     148             :     'i', //ROMAN_LOWER
     149             :     '1', //ARABIC
     150             :     ' '
     151             : };
     152             : 
     153             : // Is one of the masked formats set?
     154           0 : static sal_Bool lcl_IsNumFmtSet(SvxNumRule* pNum, sal_uInt16 nLevelMask)
     155             : {
     156           0 :     sal_Bool bRet = sal_False;
     157           0 :     sal_uInt16 nMask = 1;
     158           0 :     for( sal_uInt16 i = 0; i < SVX_MAX_NUM && !bRet; i++ )
     159             :     {
     160           0 :         if(nLevelMask & nMask)
     161           0 :             bRet |= 0 != pNum->Get( i );
     162           0 :         nMask <<= 1 ;
     163             :     }
     164           0 :     return bRet;
     165             : }
     166             : 
     167           0 : static Font& lcl_GetDefaultBulletFont()
     168             : {
     169             :     static sal_Bool bInit = 0;
     170             :     static Font aDefBulletFont( OUString("StarSymbol"),
     171           0 :                                 String(), Size( 0, 14 ) );
     172           0 :     if(!bInit)
     173             :     {
     174           0 :         aDefBulletFont.SetCharSet( RTL_TEXTENCODING_SYMBOL );
     175           0 :         aDefBulletFont.SetFamily( FAMILY_DONTKNOW );
     176           0 :         aDefBulletFont.SetPitch( PITCH_DONTKNOW );
     177           0 :         aDefBulletFont.SetWeight( WEIGHT_DONTKNOW );
     178           0 :         aDefBulletFont.SetTransparent( sal_True );
     179           0 :         bInit = sal_True;
     180             :     }
     181           0 :     return aDefBulletFont;
     182             : }
     183             : 
     184           0 : SvxSingleNumPickTabPage::SvxSingleNumPickTabPage(Window* pParent,
     185             :                                const SfxItemSet& rSet)
     186             :     : SfxTabPage(pParent, "PickNumberingPage", "cui/ui/picknumberingpage.ui", rSet)
     187             :     , pActNum(0)
     188             :     , pSaveNum(0)
     189             :     , nActNumLvl(USHRT_MAX)
     190             :     , bModified(false)
     191             :     , bPreset(false)
     192           0 :     , nNumItemId(SID_ATTR_NUMBERING_RULE)
     193             : {
     194           0 :     SetExchangeSupport();
     195           0 :     get(m_pExamplesVS, "valueset");
     196           0 :     m_pExamplesVS->init(NUM_PAGETYPE_SINGLENUM);
     197           0 :     m_pExamplesVS->SetSelectHdl(LINK(this, SvxSingleNumPickTabPage, NumSelectHdl_Impl));
     198           0 :     m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxSingleNumPickTabPage, DoubleClickHdl_Impl));
     199             : 
     200           0 :     Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
     201           0 :     if(xDefNum.is())
     202             :     {
     203           0 :         Sequence< Sequence< PropertyValue > > aNumberings;
     204           0 :         const Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale();
     205             :         try
     206             :         {
     207           0 :             aNumberings =
     208           0 :                 xDefNum->getDefaultContinuousNumberingLevels( rLocale );
     209             : 
     210             : 
     211           0 :             sal_Int32 nLength = aNumberings.getLength() > NUM_VALUSET_COUNT ? NUM_VALUSET_COUNT :aNumberings.getLength();
     212             : 
     213           0 :             const Sequence<PropertyValue>* pValuesArr = aNumberings.getConstArray();
     214           0 :             for(sal_Int32 i = 0; i < nLength; i++)
     215             :             {
     216           0 :                 SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(pValuesArr[i]);
     217           0 :                 aNumSettingsArr.push_back(pNew);
     218             :             }
     219             :         }
     220           0 :         catch(const Exception&)
     221             :         {
     222             :         }
     223           0 :         Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
     224           0 :         m_pExamplesVS->SetNumberingSettings(aNumberings, xFormat, rLocale);
     225           0 :     }
     226           0 : }
     227             : 
     228           0 : SvxSingleNumPickTabPage::~SvxSingleNumPickTabPage()
     229             : {
     230           0 :     delete pActNum;
     231           0 :     delete pSaveNum;
     232           0 : }
     233             : 
     234           0 : SfxTabPage*  SvxSingleNumPickTabPage::Create( Window* pParent,
     235             :                                 const SfxItemSet& rAttrSet)
     236             : {
     237           0 :     return new SvxSingleNumPickTabPage(pParent, rAttrSet);
     238             : }
     239             : 
     240           0 : sal_Bool  SvxSingleNumPickTabPage::FillItemSet( SfxItemSet& rSet )
     241             : {
     242           0 :     if( (bPreset || bModified) && pSaveNum)
     243             :     {
     244           0 :         *pSaveNum = *pActNum;
     245           0 :         rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
     246           0 :         rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
     247             :     }
     248             : 
     249           0 :     return bModified;
     250             : }
     251             : 
     252           0 : void  SvxSingleNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
     253             : {
     254             :     const SfxPoolItem* pItem;
     255           0 :     bPreset = sal_False;
     256           0 :     sal_Bool bIsPreset = sal_False;
     257           0 :     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
     258           0 :     if(pExampleSet)
     259             :     {
     260           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
     261           0 :             bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
     262           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
     263           0 :             nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
     264             :     }
     265           0 :     if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
     266             :     {
     267           0 :         delete pSaveNum;
     268           0 :         pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     269             :     }
     270           0 :     if(*pSaveNum != *pActNum)
     271             :     {
     272           0 :         *pActNum = *pSaveNum;
     273           0 :         m_pExamplesVS->SetNoSelection();
     274             :     }
     275             : 
     276           0 :     if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
     277             :     {
     278           0 :         m_pExamplesVS->SelectItem(1);
     279           0 :         NumSelectHdl_Impl(m_pExamplesVS);
     280           0 :         bPreset = sal_True;
     281             :     }
     282           0 :     bPreset |= bIsPreset;
     283             : 
     284           0 :     bModified = sal_False;
     285           0 : }
     286             : 
     287           0 : int  SvxSingleNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
     288             : {
     289           0 :     if(_pSet)
     290           0 :         FillItemSet(*_pSet);
     291           0 :     return sal_True;
     292             : }
     293             : 
     294           0 : void  SvxSingleNumPickTabPage::Reset( const SfxItemSet& rSet )
     295             : {
     296             :     const SfxPoolItem* pItem;
     297             : 
     298             :     // in Draw the item exists as WhichId, in Writer only as SlotId
     299           0 :     SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
     300           0 :     if(eState != SFX_ITEM_SET)
     301             :     {
     302           0 :         nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
     303           0 :         eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
     304             : 
     305           0 :         if( eState != SFX_ITEM_SET )
     306             :         {
     307           0 :             pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
     308           0 :             eState = SFX_ITEM_SET;
     309             :         }
     310             :     }
     311             :     DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
     312           0 :     delete pSaveNum;
     313           0 :     pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     314             : 
     315           0 :     if(!pActNum)
     316           0 :         pActNum = new  SvxNumRule(*pSaveNum);
     317           0 :     else if(*pSaveNum != *pActNum)
     318           0 :         *pActNum = *pSaveNum;
     319           0 : }
     320             : 
     321           0 : IMPL_LINK_NOARG(SvxSingleNumPickTabPage, NumSelectHdl_Impl)
     322             : {
     323           0 :     if(pActNum)
     324             :     {
     325           0 :         bPreset = sal_False;
     326           0 :         bModified = sal_True;
     327           0 :         sal_uInt16 nIdx = m_pExamplesVS->GetSelectItemId() - 1;
     328             :         DBG_ASSERT(aNumSettingsArr.size() > nIdx, "wrong index");
     329           0 :         if(aNumSettingsArr.size() <= nIdx)
     330           0 :             return 0;
     331           0 :         SvxNumSettings_Impl* _pSet = &aNumSettingsArr[nIdx];
     332           0 :         sal_Int16 eNewType = _pSet->nNumberType;
     333           0 :         const sal_Unicode cLocalPrefix = !_pSet->sPrefix.isEmpty() ? _pSet->sPrefix.getStr()[0] : 0;
     334           0 :         const sal_Unicode cLocalSuffix = !_pSet->sSuffix.isEmpty() ? _pSet->sSuffix.getStr()[0] : 0;
     335             : 
     336           0 :         sal_uInt16 nMask = 1;
     337           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     338             :         {
     339           0 :             if(nActNumLvl & nMask)
     340             :             {
     341           0 :                 SvxNumberFormat aFmt(pActNum->GetLevel(i));
     342           0 :                 aFmt.SetNumberingType(eNewType);
     343           0 :                 String aEmptyStr;
     344           0 :                 if(cLocalPrefix == ' ')
     345           0 :                     aFmt.SetPrefix( aEmptyStr );
     346             :                 else
     347           0 :                     aFmt.SetPrefix(_pSet->sPrefix);
     348           0 :                 if(cLocalSuffix == ' ')
     349           0 :                     aFmt.SetSuffix( aEmptyStr );
     350             :                 else
     351           0 :                     aFmt.SetSuffix(_pSet->sSuffix);
     352           0 :                 aFmt.SetCharFmtName(sNumCharFmtName);
     353             :                 // #62069# // #92724#
     354           0 :                 aFmt.SetBulletRelSize(100);
     355           0 :                 pActNum->SetLevel(i, aFmt);
     356             :             }
     357           0 :             nMask <<= 1 ;
     358             :         }
     359             :     }
     360           0 :     return 0;
     361             : }
     362             : 
     363           0 : IMPL_LINK_NOARG(SvxSingleNumPickTabPage, DoubleClickHdl_Impl)
     364             : {
     365           0 :     NumSelectHdl_Impl(m_pExamplesVS);
     366           0 :     PushButton& rOk = GetTabDialog()->GetOKButton();
     367           0 :     rOk.GetClickHdl().Call(&rOk);
     368           0 :     return 0;
     369             : }
     370             : 
     371             : 
     372           0 : SvxBulletPickTabPage::SvxBulletPickTabPage(Window* pParent,
     373             :                                const SfxItemSet& rSet)
     374             :     : SfxTabPage(pParent, "PickBulletPage", "cui/ui/pickbulletpage.ui", rSet)
     375             :     , pActNum(0)
     376             :     , pSaveNum(0)
     377             :     , nActNumLvl(USHRT_MAX)
     378             :     , bModified(false)
     379             :     , bPreset(false)
     380           0 :     , nNumItemId(SID_ATTR_NUMBERING_RULE)
     381             : {
     382           0 :     SetExchangeSupport();
     383           0 :     get(m_pExamplesVS, "valueset");
     384           0 :     m_pExamplesVS->init(NUM_PAGETYPE_BULLET),
     385           0 :     m_pExamplesVS->SetSelectHdl(LINK(this, SvxBulletPickTabPage, NumSelectHdl_Impl));
     386           0 :     m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBulletPickTabPage, DoubleClickHdl_Impl));
     387           0 : }
     388             : 
     389           0 : SvxBulletPickTabPage::~SvxBulletPickTabPage()
     390             : {
     391           0 :     delete pActNum;
     392           0 :     delete pSaveNum;
     393           0 : }
     394             : 
     395           0 : SfxTabPage*  SvxBulletPickTabPage::Create( Window* pParent,
     396             :                                 const SfxItemSet& rAttrSet)
     397             : {
     398           0 :     return new SvxBulletPickTabPage(pParent, rAttrSet);
     399             : }
     400             : 
     401           0 : sal_Bool  SvxBulletPickTabPage::FillItemSet( SfxItemSet& rSet )
     402             : {
     403           0 :     if( (bPreset || bModified) && pActNum)
     404             :     {
     405           0 :         *pSaveNum = *pActNum;
     406           0 :         rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
     407           0 :         rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
     408             :     }
     409           0 :     return bModified;
     410             : }
     411             : 
     412           0 : void  SvxBulletPickTabPage::ActivatePage(const SfxItemSet& rSet)
     413             : {
     414             :     const SfxPoolItem* pItem;
     415           0 :     bPreset = sal_False;
     416           0 :     sal_Bool bIsPreset = sal_False;
     417           0 :     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
     418           0 :     if(pExampleSet)
     419             :     {
     420           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
     421           0 :             bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
     422           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
     423           0 :             nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
     424             :     }
     425           0 :     if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
     426             :     {
     427           0 :         delete pSaveNum;
     428           0 :         pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     429             :     }
     430           0 :     if(*pSaveNum != *pActNum)
     431             :     {
     432           0 :         *pActNum = *pSaveNum;
     433           0 :         m_pExamplesVS->SetNoSelection();
     434             :     }
     435             : 
     436           0 :     if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
     437             :     {
     438           0 :         m_pExamplesVS->SelectItem(1);
     439           0 :         NumSelectHdl_Impl(m_pExamplesVS);
     440           0 :         bPreset = sal_True;
     441             :     }
     442           0 :     bPreset |= bIsPreset;
     443           0 :     bModified = sal_False;
     444           0 : }
     445             : 
     446           0 : int  SvxBulletPickTabPage::DeactivatePage(SfxItemSet *_pSet)
     447             : {
     448           0 :     if(_pSet)
     449           0 :         FillItemSet(*_pSet);
     450           0 :     return sal_True;
     451             : }
     452             : 
     453           0 : void  SvxBulletPickTabPage::Reset( const SfxItemSet& rSet )
     454             : {
     455             :     const SfxPoolItem* pItem;
     456             :     // in Draw the item exists as WhichId, in Writer only as SlotId
     457           0 :     SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
     458           0 :     if(eState != SFX_ITEM_SET)
     459             :     {
     460           0 :         nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
     461           0 :         eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
     462             : 
     463           0 :         if( eState != SFX_ITEM_SET )
     464             :         {
     465           0 :             pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
     466           0 :             eState = SFX_ITEM_SET;
     467             :         }
     468             : 
     469             :     }
     470             :     DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
     471           0 :     delete pSaveNum;
     472           0 :     pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     473             : 
     474           0 :     if(!pActNum)
     475           0 :         pActNum = new  SvxNumRule(*pSaveNum);
     476           0 :     else if(*pSaveNum != *pActNum)
     477           0 :         *pActNum = *pSaveNum;
     478           0 : }
     479             : 
     480           0 : IMPL_LINK_NOARG(SvxBulletPickTabPage, NumSelectHdl_Impl)
     481             : {
     482           0 :     if(pActNum)
     483             :     {
     484           0 :         bPreset = sal_False;
     485           0 :         bModified = sal_True;
     486           0 :         sal_Unicode cChar = aBulletTypes[m_pExamplesVS->GetSelectItemId() - 1];
     487           0 :         Font& rActBulletFont = lcl_GetDefaultBulletFont();
     488             : 
     489           0 :         sal_uInt16 nMask = 1;
     490           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     491             :         {
     492           0 :             if(nActNumLvl & nMask)
     493             :             {
     494           0 :                 SvxNumberFormat aFmt(pActNum->GetLevel(i));
     495           0 :                 aFmt.SetNumberingType( SVX_NUM_CHAR_SPECIAL );
     496             :                 // #i93908# clear suffix for bullet lists
     497           0 :                 aFmt.SetPrefix( OUString() );
     498           0 :                 aFmt.SetSuffix( OUString() );
     499           0 :                 aFmt.SetBulletFont(&rActBulletFont);
     500           0 :                 aFmt.SetBulletChar(cChar );
     501           0 :                 aFmt.SetCharFmtName(sBulletCharFmtName);
     502             :                 // #62069# // #92724#
     503           0 :                 aFmt.SetBulletRelSize(45);
     504           0 :                 pActNum->SetLevel(i, aFmt);
     505             :             }
     506           0 :             nMask <<= 1;
     507             :         }
     508             :     }
     509             : 
     510           0 :     return 0;
     511             : }
     512             : 
     513             : 
     514           0 : IMPL_LINK_NOARG(SvxBulletPickTabPage, DoubleClickHdl_Impl)
     515             : {
     516           0 :     NumSelectHdl_Impl(m_pExamplesVS);
     517           0 :     PushButton& rOk = GetTabDialog()->GetOKButton();
     518           0 :     rOk.GetClickHdl().Call(&rOk);
     519           0 :     return 0;
     520             : }
     521             : 
     522             : 
     523           0 : void SvxBulletPickTabPage::PageCreated(SfxAllItemSet aSet)
     524             : {
     525             : 
     526           0 :     SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
     527             : 
     528           0 :     if (pBulletCharFmt)
     529           0 :         SetCharFmtName( pBulletCharFmt->GetValue());
     530             : 
     531             : 
     532           0 : }
     533             : 
     534             : 
     535           0 : SvxNumPickTabPage::SvxNumPickTabPage(Window* pParent,
     536             :                                const SfxItemSet& rSet)
     537             :     : SfxTabPage(pParent, "PickOutlinePage", "cui/ui/pickoutlinepage.ui", rSet)
     538             :     , pActNum(0)
     539             :     , pSaveNum(0)
     540             :     , nActNumLvl(USHRT_MAX)
     541             :     , nNumItemId(SID_ATTR_NUMBERING_RULE)
     542             :     , bModified(false)
     543           0 :     , bPreset(false)
     544             : {
     545           0 :     SetExchangeSupport();
     546             : 
     547           0 :     get(m_pExamplesVS, "valueset");
     548           0 :     m_pExamplesVS->init(NUM_PAGETYPE_NUM);
     549           0 :     m_pExamplesVS->SetSelectHdl(LINK(this, SvxNumPickTabPage, NumSelectHdl_Impl));
     550           0 :     m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxNumPickTabPage, DoubleClickHdl_Impl));
     551             : 
     552           0 :     Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
     553           0 :     if(xDefNum.is())
     554             :     {
     555           0 :         Sequence<Reference<XIndexAccess> > aOutlineAccess;
     556           0 :         const Locale& rLocale = Application::GetSettings().GetLanguageTag().getLocale();
     557             :         try
     558             :         {
     559           0 :             aOutlineAccess = xDefNum->getDefaultOutlineNumberings( rLocale );
     560             : 
     561           0 :             for(sal_Int32 nItem = 0;
     562           0 :                 nItem < aOutlineAccess.getLength() && nItem < NUM_VALUSET_COUNT;
     563             :                 nItem++ )
     564             :             {
     565           0 :                 SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[ nItem ];
     566             : 
     567           0 :                 Reference<XIndexAccess> xLevel = aOutlineAccess.getConstArray()[nItem];
     568           0 :                 for(sal_Int32 nLevel = 0; nLevel < xLevel->getCount() && nLevel < 5; nLevel++)
     569             :                 {
     570           0 :                     Any aValueAny = xLevel->getByIndex(nLevel);
     571           0 :                     Sequence<PropertyValue> aLevelProps;
     572           0 :                     aValueAny >>= aLevelProps;
     573           0 :                     SvxNumSettings_Impl* pNew = lcl_CreateNumSettingsPtr(aLevelProps);
     574           0 :                     rItemArr.push_back( pNew );
     575           0 :                 }
     576           0 :             }
     577             :         }
     578           0 :         catch(const Exception&)
     579             :         {
     580             :         }
     581           0 :         Reference<XNumberingFormatter> xFormat(xDefNum, UNO_QUERY);
     582           0 :         m_pExamplesVS->SetOutlineNumberingSettings(aOutlineAccess, xFormat, rLocale);
     583           0 :     }
     584           0 : }
     585             : 
     586           0 : SvxNumPickTabPage::~SvxNumPickTabPage()
     587             : {
     588           0 :     delete pActNum;
     589           0 :     delete pSaveNum;
     590           0 : }
     591             : 
     592           0 : SfxTabPage*  SvxNumPickTabPage::Create( Window* pParent,
     593             :                                 const SfxItemSet& rAttrSet)
     594             : {
     595           0 :     return new SvxNumPickTabPage(pParent, rAttrSet);
     596             : }
     597             : 
     598           0 : sal_Bool  SvxNumPickTabPage::FillItemSet( SfxItemSet& rSet )
     599             : {
     600           0 :     if( (bPreset || bModified) && pActNum)
     601             :     {
     602           0 :         *pSaveNum = *pActNum;
     603           0 :         rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
     604           0 :         rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
     605             :     }
     606           0 :     return bModified;
     607             : }
     608             : 
     609           0 : void  SvxNumPickTabPage::ActivatePage(const SfxItemSet& rSet)
     610             : {
     611             :     const SfxPoolItem* pItem;
     612           0 :     bPreset = sal_False;
     613           0 :     sal_Bool bIsPreset = sal_False;
     614           0 :     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
     615           0 :     if(pExampleSet)
     616             :     {
     617           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
     618           0 :             bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
     619           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
     620           0 :             nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
     621             :     }
     622           0 :     if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
     623             :     {
     624           0 :         delete pSaveNum;
     625           0 :         pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     626             :     }
     627           0 :     if(*pSaveNum != *pActNum)
     628             :     {
     629           0 :         *pActNum = *pSaveNum;
     630           0 :         m_pExamplesVS->SetNoSelection();
     631             :     }
     632             : 
     633           0 :     if(pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset))
     634             :     {
     635           0 :         m_pExamplesVS->SelectItem(1);
     636           0 :         NumSelectHdl_Impl(m_pExamplesVS);
     637           0 :         bPreset = sal_True;
     638             :     }
     639           0 :     bPreset |= bIsPreset;
     640           0 :     bModified = sal_False;
     641           0 : }
     642             : 
     643           0 : int  SvxNumPickTabPage::DeactivatePage(SfxItemSet *_pSet)
     644             : {
     645           0 :     if(_pSet)
     646           0 :         FillItemSet(*_pSet);
     647           0 :     return sal_True;
     648             : }
     649             : 
     650           0 : void  SvxNumPickTabPage::Reset( const SfxItemSet& rSet )
     651             : {
     652             :     const SfxPoolItem* pItem;
     653             :     // in Draw the item exists as WhichId, in Writer only as SlotId
     654           0 :     SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
     655           0 :     if(eState != SFX_ITEM_SET)
     656             :     {
     657           0 :         nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
     658           0 :         eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
     659             : 
     660           0 :         if( eState != SFX_ITEM_SET )
     661             :         {
     662           0 :             pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
     663           0 :             eState = SFX_ITEM_SET;
     664             :         }
     665             : 
     666             :     }
     667             :     DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
     668           0 :     delete pSaveNum;
     669           0 :     pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     670             : 
     671           0 :     if(!pActNum)
     672           0 :         pActNum = new  SvxNumRule(*pSaveNum);
     673           0 :     else if(*pSaveNum != *pActNum)
     674           0 :         *pActNum = *pSaveNum;
     675             : 
     676           0 : }
     677             : 
     678             : // all levels are changed here
     679           0 : IMPL_LINK_NOARG(SvxNumPickTabPage, NumSelectHdl_Impl)
     680             : {
     681           0 :     if(pActNum)
     682             :     {
     683           0 :         bPreset = sal_False;
     684           0 :         bModified = sal_True;
     685             : 
     686           0 :         const FontList*  pList = 0;
     687             : 
     688           0 :         SvxNumSettingsArr_Impl& rItemArr = aNumSettingsArrays[m_pExamplesVS->GetSelectItemId() - 1];
     689             : 
     690           0 :         Font& rActBulletFont = lcl_GetDefaultBulletFont();
     691           0 :         SvxNumSettings_Impl* pLevelSettings = 0;
     692           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     693             :         {
     694           0 :             if(rItemArr.size() > i)
     695           0 :                 pLevelSettings = &rItemArr[i];
     696           0 :             if(!pLevelSettings)
     697           0 :                 break;
     698           0 :             SvxNumberFormat aFmt(pActNum->GetLevel(i));
     699           0 :             aFmt.SetNumberingType( pLevelSettings->nNumberType );
     700           0 :             sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering;
     701           0 :             if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL)
     702             :             {
     703             :                 // #i93908# clear suffix for bullet lists
     704           0 :                 aFmt.SetPrefix(OUString());
     705           0 :                 aFmt.SetSuffix(OUString());
     706           0 :                 if( !pLevelSettings->sBulletFont.isEmpty() &&
     707             :                     pLevelSettings->sBulletFont.compareTo(
     708           0 :                             rActBulletFont.GetName()))
     709             :                 {
     710             :                     //search for the font
     711           0 :                     if(!pList)
     712             :                     {
     713           0 :                         SfxObjectShell* pCurDocShell = SfxObjectShell::Current();
     714             :                         const SvxFontListItem* pFontListItem =
     715             :                                 (const SvxFontListItem* )pCurDocShell
     716           0 :                                                     ->GetItem( SID_ATTR_CHAR_FONTLIST );
     717           0 :                         pList = pFontListItem ? pFontListItem->GetFontList() : 0;
     718             :                     }
     719           0 :                     if(pList && pList->IsAvailable( pLevelSettings->sBulletFont ) )
     720             :                     {
     721             :                         FontInfo aInfo = pList->Get(
     722           0 :                             pLevelSettings->sBulletFont,WEIGHT_NORMAL, ITALIC_NONE);
     723           0 :                         Font aFont(aInfo);
     724           0 :                         aFmt.SetBulletFont(&aFont);
     725             :                     }
     726             :                     else
     727             :                     {
     728             :                         //if it cannot be found then create a new one
     729             :                         Font aCreateFont( pLevelSettings->sBulletFont,
     730           0 :                                                 String(), Size( 0, 14 ) );
     731           0 :                         aCreateFont.SetCharSet( RTL_TEXTENCODING_DONTKNOW );
     732           0 :                         aCreateFont.SetFamily( FAMILY_DONTKNOW );
     733           0 :                         aCreateFont.SetPitch( PITCH_DONTKNOW );
     734           0 :                         aCreateFont.SetWeight( WEIGHT_DONTKNOW );
     735           0 :                         aCreateFont.SetTransparent( sal_True );
     736           0 :                         aFmt.SetBulletFont( &aCreateFont );
     737             :                     }
     738             :                 }
     739             :                 else
     740           0 :                     aFmt.SetBulletFont( &rActBulletFont );
     741             : 
     742           0 :                 aFmt.SetBulletChar( !pLevelSettings->sBulletChar.isEmpty()
     743           0 :                                         ? pLevelSettings->sBulletChar.getStr()[0]
     744           0 :                                         : 0 );
     745           0 :                 aFmt.SetCharFmtName( sBulletCharFmtName );
     746             :                 // #62069# // #92724#
     747           0 :                 aFmt.SetBulletRelSize(45);
     748             :             }
     749             :             else
     750             :             {
     751           0 :                 aFmt.SetIncludeUpperLevels(sal::static_int_cast< sal_uInt8 >(0 != nUpperLevelOrChar ? pActNum->GetLevelCount() : 0));
     752           0 :                 aFmt.SetCharFmtName(sNumCharFmtName);
     753             :                 // #62069# // #92724#
     754           0 :                 aFmt.SetBulletRelSize(100);
     755             :                 // #i93908#
     756           0 :                 aFmt.SetPrefix(pLevelSettings->sPrefix);
     757           0 :                 aFmt.SetSuffix(pLevelSettings->sSuffix);
     758             :             }
     759           0 :             pActNum->SetLevel(i, aFmt);
     760           0 :         }
     761             :     }
     762           0 :     return 0;
     763             : }
     764             : 
     765           0 : IMPL_LINK_NOARG(SvxNumPickTabPage, DoubleClickHdl_Impl)
     766             : {
     767           0 :     NumSelectHdl_Impl(m_pExamplesVS);
     768           0 :     PushButton& rOk = GetTabDialog()->GetOKButton();
     769           0 :     rOk.GetClickHdl().Call(&rOk);
     770           0 :     return 0;
     771             : }
     772             : 
     773           0 : void SvxNumPickTabPage::PageCreated(SfxAllItemSet aSet)
     774             : {
     775           0 :     SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
     776           0 :     SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
     777             : 
     778             : 
     779           0 :     if (pNumCharFmt &&pBulletCharFmt)
     780           0 :         SetCharFmtNames( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
     781           0 : }
     782             : 
     783           0 : SvxBitmapPickTabPage::SvxBitmapPickTabPage(Window* pParent,
     784             :                                const SfxItemSet& rSet)
     785             :     : SfxTabPage(pParent, "PickGraphicPage", "cui/ui/pickgraphicpage.ui", rSet)
     786             :     , pActNum(0)
     787             :     , pSaveNum(0)
     788             :     , nActNumLvl(USHRT_MAX)
     789             :     , nNumItemId(SID_ATTR_NUMBERING_RULE)
     790             :     , bModified(false)
     791           0 :     , bPreset(false)
     792             : {
     793           0 :     SetExchangeSupport();
     794           0 :     get(m_pErrorText, "errorft");
     795           0 :     get(m_pLinkedCB, "linkgraphics");
     796           0 :     get(m_pExamplesVS, "valueset");
     797           0 :     m_pExamplesVS->SetSelectHdl(LINK(this, SvxBitmapPickTabPage, NumSelectHdl_Impl));
     798           0 :     m_pExamplesVS->SetDoubleClickHdl(LINK(this, SvxBitmapPickTabPage, DoubleClickHdl_Impl));
     799           0 :     m_pLinkedCB->SetClickHdl(LINK(this, SvxBitmapPickTabPage, LinkBmpHdl_Impl));
     800             : 
     801           0 :     eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
     802             : 
     803             :     // determine graphic name
     804           0 :     GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames);
     805             : 
     806           0 :     sal_uInt16 i = 0;
     807           0 :     for(std::vector<String>::iterator it = aGrfNames.begin(); it != aGrfNames.end(); ++it, ++i)
     808             :     {
     809           0 :         m_pExamplesVS->InsertItem( i + 1, i);
     810             : 
     811           0 :         INetURLObject aObj(*it);
     812           0 :         if(aObj.GetProtocol() == INET_PROT_FILE)
     813           0 :             *it = aObj.PathToFileName();
     814             : 
     815           0 :         m_pExamplesVS->SetItemText( i + 1, *it );
     816           0 :     }
     817             : 
     818           0 :     if(aGrfNames.empty())
     819             :     {
     820           0 :         m_pErrorText->Show();
     821             :     }
     822             :     else
     823             :     {
     824           0 :         m_pExamplesVS->Show();
     825           0 :         m_pExamplesVS->Format();
     826             :     }
     827           0 : }
     828             : 
     829           0 : SvxBitmapPickTabPage::~SvxBitmapPickTabPage()
     830             : {
     831           0 :     delete pActNum;
     832           0 :     delete pSaveNum;
     833           0 : }
     834             : 
     835           0 : SfxTabPage*  SvxBitmapPickTabPage::Create( Window* pParent,
     836             :                                 const SfxItemSet& rAttrSet)
     837             : {
     838           0 :     return new SvxBitmapPickTabPage(pParent, rAttrSet);
     839             : }
     840             : 
     841           0 : void  SvxBitmapPickTabPage::ActivatePage(const SfxItemSet& rSet)
     842             : {
     843             :     const SfxPoolItem* pItem;
     844           0 :     bPreset = sal_False;
     845           0 :     sal_Bool bIsPreset = sal_False;
     846           0 :     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
     847           0 :     if(pExampleSet)
     848             :     {
     849           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
     850           0 :             bIsPreset = ((const SfxBoolItem*)pItem)->GetValue();
     851           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
     852           0 :             nActNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
     853             :     }
     854           0 :     if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
     855             :     {
     856           0 :         delete pSaveNum;
     857           0 :         pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     858             :     }
     859           0 :     if(*pSaveNum != *pActNum)
     860             :     {
     861           0 :         *pActNum = *pSaveNum;
     862           0 :         m_pExamplesVS->SetNoSelection();
     863             :     }
     864             : 
     865           0 :     if(!aGrfNames.empty() &&
     866           0 :         (pActNum && (!lcl_IsNumFmtSet(pActNum, nActNumLvl) || bIsPreset)))
     867             :     {
     868           0 :         m_pExamplesVS->SelectItem(1);
     869           0 :         NumSelectHdl_Impl(m_pExamplesVS);
     870           0 :         bPreset = sal_True;
     871             :     }
     872           0 :     bPreset |= bIsPreset;
     873           0 :     bModified = sal_False;
     874           0 : }
     875             : 
     876           0 : int  SvxBitmapPickTabPage::DeactivatePage(SfxItemSet *_pSet)
     877             : {
     878           0 :     if(_pSet)
     879           0 :         FillItemSet(*_pSet);
     880           0 :     return sal_True;
     881             : }
     882             : 
     883           0 : sal_Bool  SvxBitmapPickTabPage::FillItemSet( SfxItemSet& rSet )
     884             : {
     885           0 :     if ( aGrfNames.empty() )
     886             :     {
     887           0 :         return sal_False;
     888             :     }
     889           0 :     if( (bPreset || bModified) && pActNum)
     890             :     {
     891           0 :         *pSaveNum = *pActNum;
     892           0 :         rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
     893           0 :         rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, bPreset));
     894             :     }
     895             : 
     896           0 :     return bModified;
     897             : }
     898             : 
     899           0 : void  SvxBitmapPickTabPage::Reset( const SfxItemSet& rSet )
     900             : {
     901             :     const SfxPoolItem* pItem;
     902             :     // in Draw the item exists as WhichId, in Writer only as SlotId
     903           0 :     SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
     904           0 :     if(eState != SFX_ITEM_SET)
     905             :     {
     906           0 :         nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
     907           0 :         eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
     908             : 
     909           0 :         if( eState != SFX_ITEM_SET )
     910             :         {
     911           0 :             pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
     912           0 :             eState = SFX_ITEM_SET;
     913             :         }
     914             : 
     915             :     }
     916             :     DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
     917           0 :     delete pSaveNum;
     918           0 :     pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
     919             : 
     920           0 :     if(!pActNum)
     921           0 :         pActNum = new  SvxNumRule(*pSaveNum);
     922           0 :     else if(*pSaveNum != *pActNum)
     923           0 :         *pActNum = *pSaveNum;
     924           0 :     if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
     925             :     {
     926           0 :         m_pLinkedCB->Check(sal_False);
     927           0 :         m_pLinkedCB->Enable(sal_False);
     928             :     }
     929           0 :     else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
     930             :     {
     931           0 :         m_pLinkedCB->Check(sal_True);
     932           0 :         m_pLinkedCB->Enable(sal_False);
     933             :     }
     934           0 : }
     935             : 
     936           0 : IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl)
     937             : {
     938           0 :     if(pActNum)
     939             :     {
     940           0 :         bPreset = sal_False;
     941           0 :         bModified = sal_True;
     942           0 :         sal_uInt16 nIdx = m_pExamplesVS->GetSelectItemId() - 1;
     943             : 
     944           0 :         sal_uInt16 nMask = 1;
     945           0 :         String aEmptyStr;
     946           0 :         sal_uInt16 nSetNumberingType = SVX_NUM_BITMAP;
     947           0 :         if(m_pLinkedCB->IsChecked())
     948           0 :             nSetNumberingType |= LINK_TOKEN;
     949           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
     950             :         {
     951           0 :             if(nActNumLvl & nMask)
     952             :             {
     953           0 :                 SvxNumberFormat aFmt(pActNum->GetLevel(i));
     954           0 :                 aFmt.SetNumberingType(nSetNumberingType);
     955           0 :                 aFmt.SetPrefix( aEmptyStr );
     956           0 :                 aFmt.SetSuffix( aEmptyStr );
     957           0 :                 aFmt.SetCharFmtName( sNumCharFmtName );
     958             : 
     959           0 :                 Graphic aGraphic;
     960           0 :                 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, nIdx, &aGraphic))
     961             :                 {
     962           0 :                     Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
     963           0 :                     sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
     964           0 :                     aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
     965           0 :                     SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
     966           0 :                     aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
     967             :                 }
     968           0 :                 else if(aGrfNames.size() > nIdx)
     969           0 :                     aFmt.SetGraphic( aGrfNames[nIdx] );
     970           0 :                 pActNum->SetLevel(i, aFmt);
     971             :             }
     972           0 :             nMask <<= 1 ;
     973           0 :         }
     974             :     }
     975             : 
     976           0 :     return 0;
     977             : }
     978             : 
     979           0 : IMPL_LINK_NOARG(SvxBitmapPickTabPage, DoubleClickHdl_Impl)
     980             : {
     981           0 :     NumSelectHdl_Impl(m_pExamplesVS);
     982           0 :     PushButton& rOk = GetTabDialog()->GetOKButton();
     983           0 :     rOk.GetClickHdl().Call(&rOk);
     984           0 :     return 0;
     985             : }
     986             : 
     987           0 : IMPL_LINK_NOARG(SvxBitmapPickTabPage, LinkBmpHdl_Impl)
     988             : {
     989           0 :     if(!m_pExamplesVS->IsNoSelection())
     990             :     {
     991           0 :         NumSelectHdl_Impl(m_pExamplesVS);
     992             :     }
     993           0 :     return 0;
     994             : }
     995             : 
     996             : // static
     997           0 : void SvxNumOptionsTabPage::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 nDoNotRemove )
     998             : {
     999             : 
    1000           0 :     Reference<XDefaultNumberingProvider> xDefNum = lcl_GetNumberingProvider();
    1001           0 :     Reference<XNumberingTypeInfo> xInfo(xDefNum, UNO_QUERY);
    1002             : 
    1003             :     // Extended numbering schemes present in the resource but not offered by
    1004             :     // the i18n framework per configuration must be removed from the listbox.
    1005             :     // Do not remove a special entry matching nDoNotRemove.
    1006           0 :     const sal_uInt16 nDontRemove = 0xffff;
    1007           0 :     ::std::vector< sal_uInt16> aRemove( rFmtLB.GetEntryCount(), nDontRemove);
    1008           0 :     for (size_t i=0; i<aRemove.size(); ++i)
    1009             :     {
    1010             :         sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)rFmtLB.GetEntryData(
    1011           0 :                 sal::static_int_cast< sal_uInt16 >(i));
    1012           0 :         if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && nEntryData != nDoNotRemove)
    1013           0 :             aRemove[i] = nEntryData;
    1014             :     }
    1015           0 :     if(xInfo.is())
    1016             :     {
    1017           0 :         Sequence<sal_Int16> aTypes = xInfo->getSupportedNumberingTypes(  );
    1018           0 :         const sal_Int16* pTypes = aTypes.getConstArray();
    1019           0 :         for(sal_Int32 nType = 0; nType < aTypes.getLength(); nType++)
    1020             :         {
    1021           0 :             sal_Int16 nCurrent = pTypes[nType];
    1022           0 :             if(nCurrent > NumberingType::CHARS_LOWER_LETTER_N)
    1023             :             {
    1024           0 :                 sal_Bool bInsert = sal_True;
    1025           0 :                 for(sal_uInt16 nEntry = 0; nEntry < rFmtLB.GetEntryCount(); nEntry++)
    1026             :                 {
    1027           0 :                     sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)rFmtLB.GetEntryData(nEntry);
    1028           0 :                     if(nEntryData == (sal_uInt16) nCurrent)
    1029             :                     {
    1030           0 :                         bInsert = sal_False;
    1031           0 :                         aRemove[nEntry] = nDontRemove;
    1032           0 :                         break;
    1033             :                     }
    1034             :                 }
    1035           0 :                 if(bInsert)
    1036             :                 {
    1037           0 :                     OUString aIdent = xInfo->getNumberingIdentifier( nCurrent );
    1038           0 :                     sal_uInt16 nPos = rFmtLB.InsertEntry(aIdent);
    1039           0 :                     rFmtLB.SetEntryData(nPos,(void*)(sal_uLong)nCurrent);
    1040             :                 }
    1041             :             }
    1042           0 :         }
    1043             :     }
    1044           0 :     for (size_t i=0; i<aRemove.size(); ++i)
    1045             :     {
    1046           0 :         if (aRemove[i] != nDontRemove)
    1047             :         {
    1048           0 :             sal_uInt16 nPos = rFmtLB.GetEntryPos( (void*)(sal_uLong)aRemove[i]);
    1049           0 :             rFmtLB.RemoveEntry( nPos);
    1050             :         }
    1051           0 :     }
    1052           0 : }
    1053             : 
    1054             : // tabpage numbering options
    1055           0 : SvxNumOptionsTabPage::SvxNumOptionsTabPage(Window* pParent,
    1056             :                                const SfxItemSet& rSet)
    1057             :     : SfxTabPage(pParent, "NumberingOptionsPage", "cui/ui/numberingoptionspage.ui", rSet)
    1058             :     , pActNum(0)
    1059             :     , pSaveNum(0)
    1060             :     , bLastWidthModified(sal_False)
    1061             :     , bModified(sal_False)
    1062             :     , bPreset(sal_False)
    1063             :     , bAutomaticCharStyles(sal_True)
    1064             :     , bHTMLMode(sal_False)
    1065             :     , bMenuButtonInitialized(sal_False)
    1066             :     , nBullet(0xff)
    1067             :     , nActNumLvl(USHRT_MAX)
    1068           0 :     , nNumItemId(SID_ATTR_NUMBERING_RULE)
    1069             : {
    1070           0 :     get(m_pLevelLB, "levellb");
    1071           0 :     get(m_pFmtLB, "numfmtlb");
    1072             : 
    1073           0 :     get(m_pSeparatorFT, "separator");
    1074           0 :     get(m_pPrefixFT, "prefixft");
    1075           0 :     get(m_pPrefixED, "prefix");
    1076           0 :     get(m_pSuffixFT, "suffixft");
    1077           0 :     get(m_pSuffixED, "suffix");
    1078             : 
    1079           0 :     get(m_pCharFmtFT, "charstyleft");
    1080           0 :     get(m_pCharFmtLB, "charstyle");
    1081             : 
    1082           0 :     get(m_pBulColorFT, "colorft");
    1083           0 :     get(m_pBulColLB, "color");
    1084             : 
    1085           0 :     get(m_pBulRelSizeFT, "relsizeft");
    1086           0 :     get(m_pBulRelSizeMF, "relsize");
    1087             : 
    1088           0 :     get(m_pAllLevelFT, "sublevelsft");
    1089           0 :     get(m_pAllLevelNF, "sublevels");
    1090             : 
    1091           0 :     get(m_pStartFT, "startatft");
    1092           0 :     get(m_pStartED, "startat");
    1093             : 
    1094           0 :     get(m_pBulletFT, "bulletft");
    1095           0 :     get(m_pBulletPB, "bullet");
    1096             : 
    1097           0 :     get(m_pAlignFT, "numalignft");
    1098           0 :     get(m_pAlignLB, "numalign");
    1099             : 
    1100           0 :     get(m_pBitmapFT, "bitmapft");
    1101           0 :     get(m_pBitmapMB, "bitmap");
    1102             : 
    1103           0 :     get(m_pWidthFT, "widthft");
    1104           0 :     get(m_pWidthMF, "widthmf");
    1105           0 :     get(m_pHeightFT, "heightft");
    1106           0 :     get(m_pHeightMF, "heightmf");
    1107             : 
    1108           0 :     get(m_pRatioCB, "keepratio");
    1109             : 
    1110           0 :     get(m_pOrientFT, "orientft");
    1111           0 :     get(m_pOrientLB, "orientlb");
    1112             : 
    1113           0 :     get(m_pAllLevelsFrame, "levelsframe");
    1114           0 :     get(m_pSameLevelCB, "allsame");
    1115             : 
    1116           0 :     get(m_pPreviewWIN, "preview");
    1117             : 
    1118           0 :     m_pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
    1119           0 :     SetExchangeSupport();
    1120           0 :     aActBulletFont = lcl_GetDefaultBulletFont();
    1121             : 
    1122           0 :     m_pBulletPB->SetClickHdl(LINK(this, SvxNumOptionsTabPage, BulletHdl_Impl));
    1123           0 :     m_pFmtLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl));
    1124           0 :     m_pBitmapMB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, GraphicHdl_Impl));
    1125           0 :     m_pLevelLB->EnableMultiSelection(true);
    1126           0 :     m_pLevelLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, LevelHdl_Impl));
    1127           0 :     m_pCharFmtLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, CharFmtHdl_Impl));
    1128           0 :     m_pWidthMF->SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
    1129           0 :     m_pHeightMF->SetModifyHdl(LINK(this, SvxNumOptionsTabPage, SizeHdl_Impl));
    1130           0 :     m_pRatioCB->SetClickHdl(LINK(this, SvxNumOptionsTabPage, RatioHdl_Impl));
    1131           0 :     m_pStartED->SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
    1132           0 :     m_pPrefixED->SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
    1133           0 :     m_pSuffixED->SetModifyHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
    1134           0 :     m_pAllLevelNF->SetModifyHdl(LINK(this,SvxNumOptionsTabPage, AllLevelHdl_Impl));
    1135           0 :     m_pOrientLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, OrientHdl_Impl));
    1136           0 :     m_pSameLevelCB->SetClickHdl(LINK(this, SvxNumOptionsTabPage, SameLevelHdl_Impl));
    1137           0 :     m_pBulRelSizeMF->SetModifyHdl(LINK(this,SvxNumOptionsTabPage, BulRelSizeHdl_Impl));
    1138           0 :     m_pBulColLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, BulColorHdl_Impl));
    1139           0 :     aInvalidateTimer.SetTimeoutHdl(LINK(this, SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl));
    1140           0 :     aInvalidateTimer.SetTimeout(50);
    1141             : 
    1142           0 :     Menu *pBitmapMenu = m_pBitmapMB->GetPopupMenu();
    1143             : 
    1144           0 :     pBitmapMenu->SetHighlightHdl(LINK(this, SvxNumOptionsTabPage, PopupActivateHdl_Impl));
    1145           0 :     m_nGalleryId = pBitmapMenu->GetItemId("gallery");
    1146             :     assert(m_nGalleryId != MENU_ITEM_NOTFOUND);
    1147           0 :     PopupMenu* pPopup = new PopupMenu;
    1148           0 :     pBitmapMenu->SetPopupMenu(m_nGalleryId, pPopup);
    1149             : 
    1150           0 :     eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
    1151             : 
    1152             :     // Get advanced numbering types from the component.
    1153             :     // Watch out for the ugly 0x88/*SVX_NUM_BITMAP|0x80*/ to not remove that.
    1154           0 :     GetI18nNumbering( *m_pFmtLB, (SVX_NUM_BITMAP | 0x80));
    1155           0 : }
    1156             : 
    1157           0 : SvxNumOptionsTabPage::~SvxNumOptionsTabPage()
    1158             : {
    1159           0 :     delete m_pBitmapMB->GetPopupMenu()->GetPopupMenu(m_nGalleryId);
    1160           0 :     delete pActNum;
    1161           0 :     delete pSaveNum;
    1162           0 : }
    1163             : 
    1164           0 : void SvxNumOptionsTabPage::SetMetric(FieldUnit eMetric)
    1165             : {
    1166           0 :     if(eMetric == FUNIT_MM)
    1167             :     {
    1168           0 :         m_pWidthMF->SetDecimalDigits(1);
    1169           0 :         m_pHeightMF->SetDecimalDigits(1);
    1170             :     }
    1171           0 :     m_pWidthMF->SetUnit( eMetric );
    1172           0 :     m_pHeightMF->SetUnit( eMetric );
    1173           0 : }
    1174             : 
    1175           0 : SfxTabPage* SvxNumOptionsTabPage::Create( Window* pParent,
    1176             :                                 const SfxItemSet& rAttrSet)
    1177             : {
    1178           0 :     return new SvxNumOptionsTabPage(pParent, rAttrSet);
    1179             : };
    1180             : 
    1181           0 : void    SvxNumOptionsTabPage::ActivatePage(const SfxItemSet& rSet)
    1182             : {
    1183             :     const SfxPoolItem* pItem;
    1184           0 :     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
    1185           0 :     sal_uInt16 nTmpNumLvl = USHRT_MAX;
    1186           0 :     if(pExampleSet)
    1187             :     {
    1188           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
    1189           0 :             bPreset = ((const SfxBoolItem*)pItem)->GetValue();
    1190           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
    1191           0 :             nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
    1192             :     }
    1193           0 :     if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
    1194             :     {
    1195           0 :         delete pSaveNum;
    1196           0 :         pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
    1197             :     }
    1198             :     //
    1199           0 :     bModified = (!pActNum->Get( 0 ) || bPreset);
    1200           0 :     if(*pActNum != *pSaveNum ||
    1201           0 :         nActNumLvl != nTmpNumLvl)
    1202             :     {
    1203           0 :         nActNumLvl = nTmpNumLvl;
    1204           0 :         sal_uInt16 nMask = 1;
    1205           0 :         m_pLevelLB->SetUpdateMode(sal_False);
    1206           0 :         m_pLevelLB->SetNoSelection();
    1207           0 :         m_pLevelLB->SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
    1208           0 :         if(nActNumLvl != USHRT_MAX)
    1209           0 :             for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1210             :             {
    1211           0 :                 if(nActNumLvl & nMask)
    1212           0 :                     m_pLevelLB->SelectEntryPos( i, sal_True);
    1213           0 :                 nMask <<= 1 ;
    1214             :             }
    1215           0 :         m_pLevelLB->SetUpdateMode(sal_True);
    1216           0 :         *pActNum = *pSaveNum;
    1217           0 :         InitControls();
    1218             :     }
    1219             : 
    1220           0 : }
    1221             : 
    1222           0 : int     SvxNumOptionsTabPage::DeactivatePage(SfxItemSet * _pSet)
    1223             : {
    1224           0 :     if(_pSet)
    1225           0 :         FillItemSet(*_pSet);
    1226           0 :     return sal_True;
    1227             : }
    1228             : 
    1229           0 : sal_Bool    SvxNumOptionsTabPage::FillItemSet( SfxItemSet& rSet )
    1230             : {
    1231           0 :     rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
    1232           0 :     if(bModified && pActNum)
    1233             :     {
    1234           0 :         *pSaveNum = *pActNum;
    1235           0 :         rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
    1236           0 :         rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False));
    1237             :     }
    1238           0 :     return bModified;
    1239             : };
    1240             : 
    1241           0 : void    SvxNumOptionsTabPage::Reset( const SfxItemSet& rSet )
    1242             : {
    1243             :     const SfxPoolItem* pItem;
    1244             :     // in Draw the item exists as WhichId, in Writer only as SlotId
    1245           0 :     SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
    1246           0 :     if(eState != SFX_ITEM_SET)
    1247             :     {
    1248           0 :         nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
    1249           0 :         eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
    1250             : 
    1251           0 :         if( eState != SFX_ITEM_SET )
    1252             :         {
    1253           0 :             pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
    1254           0 :             eState = SFX_ITEM_SET;
    1255             :         }
    1256             : 
    1257             :     }
    1258             :     DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
    1259           0 :     delete pSaveNum;
    1260           0 :     pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
    1261             : 
    1262             :     // insert levels
    1263           0 :     if(!m_pLevelLB->GetEntryCount())
    1264             :     {
    1265           0 :         for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
    1266           0 :             m_pLevelLB->InsertEntry( OUString::number(i));
    1267           0 :         if(pSaveNum->GetLevelCount() > 1)
    1268             :         {
    1269           0 :             OUString sEntry( "1 - " );
    1270           0 :             sEntry += OUString::valueOf( static_cast<sal_Int32>(pSaveNum->GetLevelCount()) );
    1271           0 :             m_pLevelLB->InsertEntry(sEntry);
    1272           0 :             m_pLevelLB->SelectEntry(sEntry);
    1273             :         }
    1274             :         else
    1275           0 :             m_pLevelLB->SelectEntryPos(0);
    1276             :     }
    1277             :     else
    1278           0 :         m_pLevelLB->SelectEntryPos(m_pLevelLB->GetEntryCount() - 1);
    1279             : 
    1280           0 :     sal_uInt16 nMask = 1;
    1281           0 :     m_pLevelLB->SetUpdateMode(sal_False);
    1282           0 :     m_pLevelLB->SetNoSelection();
    1283           0 :     if(nActNumLvl == USHRT_MAX)
    1284             :     {
    1285           0 :         m_pLevelLB->SelectEntryPos( pSaveNum->GetLevelCount(), sal_True);
    1286             :     }
    1287             :     else
    1288           0 :         for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
    1289             :         {
    1290           0 :             if(nActNumLvl & nMask)
    1291           0 :                 m_pLevelLB->SelectEntryPos( i, sal_True);
    1292           0 :             nMask <<= 1 ;
    1293             :         }
    1294           0 :     m_pLevelLB->SetUpdateMode(sal_True);
    1295             : 
    1296           0 :     if(!pActNum)
    1297           0 :         pActNum = new  SvxNumRule(*pSaveNum);
    1298           0 :     else if(*pSaveNum != *pActNum)
    1299           0 :         *pActNum = *pSaveNum;
    1300           0 :     m_pPreviewWIN->SetNumRule(pActNum);
    1301           0 :     m_pSameLevelCB->Check(pActNum->IsContinuousNumbering());
    1302             : 
    1303             :     // fill ColorListBox as needed
    1304           0 :     if ( pActNum->IsFeatureSupported( NUM_BULLET_COLOR ) )
    1305             :     {
    1306           0 :         SfxObjectShell* pDocSh = SfxObjectShell::Current();
    1307             :         DBG_ASSERT( pDocSh, "DocShell not found!" );
    1308           0 :         XColorListRef pColorTable;
    1309           0 :         if ( pDocSh )
    1310             :         {
    1311           0 :             pItem = pDocSh->GetItem( SID_COLOR_TABLE );
    1312           0 :             if ( pItem )
    1313           0 :                 pColorTable = ( (SvxColorListItem*)pItem )->GetColorList();
    1314             :         }
    1315             : 
    1316           0 :         if ( !pColorTable.is() )
    1317           0 :             pColorTable = XColorList::CreateStdColorList();
    1318             : 
    1319           0 :         m_pBulColLB->InsertEntry( Color( COL_AUTO ), SVX_RESSTR( RID_SVXSTR_AUTOMATIC ));
    1320             : 
    1321           0 :         for ( long i = 0; i < pColorTable->Count(); i++ )
    1322             :         {
    1323           0 :             XColorEntry* pEntry = pColorTable->GetColor(i);
    1324           0 :             m_pBulColLB->InsertEntry( pEntry->GetColor(), pEntry->GetName() );
    1325           0 :         }
    1326             :     }
    1327             : 
    1328             :     SfxObjectShell* pShell;
    1329           0 :     if ( SFX_ITEM_SET == rSet.GetItemState( SID_HTML_MODE, sal_False, &pItem )
    1330           0 :          || ( 0 != ( pShell = SfxObjectShell::Current()) &&
    1331           0 :               0 != ( pItem = pShell->GetItem( SID_HTML_MODE ) ) ) )
    1332             :     {
    1333           0 :         sal_uInt16 nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
    1334           0 :         bHTMLMode = 0 != (nHtmlMode&HTMLMODE_ON);
    1335             :     }
    1336             : 
    1337           0 :     sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
    1338           0 :     m_pCharFmtFT->Show(bCharFmt);
    1339           0 :     m_pCharFmtLB->Show(bCharFmt);
    1340             : 
    1341           0 :     sal_Bool bContinuous = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
    1342             : 
    1343           0 :     sal_Bool bAllLevel = bContinuous && !bHTMLMode;
    1344           0 :     m_pAllLevelFT->Show(bAllLevel);
    1345           0 :     m_pAllLevelNF->Show(bAllLevel);
    1346             : 
    1347           0 :     m_pAllLevelsFrame->Show(bContinuous);
    1348             : 
    1349             :     // again misusage: in Draw there is numeration only until the bitmap
    1350             :     // without SVX_NUM_NUMBER_NONE
    1351             :     //remove types that are unsupported by Draw/Impress
    1352           0 :     if(!bContinuous)
    1353             :     {
    1354           0 :         sal_uInt16 nFmtCount = m_pFmtLB->GetEntryCount();
    1355           0 :         for(sal_uInt16 i = nFmtCount; i; i--)
    1356             :         {
    1357           0 :             sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)m_pFmtLB->GetEntryData(i - 1);
    1358           0 :             if(/*SVX_NUM_NUMBER_NONE == nEntryData ||*/
    1359             :                 ((SVX_NUM_BITMAP|LINK_TOKEN) ==  nEntryData))
    1360           0 :                 m_pFmtLB->RemoveEntry(i - 1);
    1361             :         }
    1362             :     }
    1363             :     //one must be enabled
    1364           0 :     if(!pActNum->IsFeatureSupported(NUM_ENABLE_LINKED_BMP))
    1365             :     {
    1366           0 :         sal_IntPtr nData = SVX_NUM_BITMAP|LINK_TOKEN;
    1367           0 :         sal_uInt16 nPos = m_pFmtLB->GetEntryPos((void*)nData);
    1368           0 :         if(LISTBOX_ENTRY_NOTFOUND != nPos)
    1369           0 :             m_pFmtLB->RemoveEntry(nPos);
    1370             :     }
    1371           0 :     else if(!pActNum->IsFeatureSupported(NUM_ENABLE_EMBEDDED_BMP))
    1372             :     {
    1373           0 :         sal_IntPtr nData = SVX_NUM_BITMAP;
    1374           0 :         sal_uInt16 nPos = m_pFmtLB->GetEntryPos((void*)nData);
    1375           0 :         if(LISTBOX_ENTRY_NOTFOUND != nPos)
    1376           0 :             m_pFmtLB->RemoveEntry(nPos);
    1377             :     }
    1378           0 :     if(pActNum->IsFeatureSupported(NUM_SYMBOL_ALIGNMENT))
    1379             :     {
    1380           0 :         m_pAlignFT->Show();
    1381           0 :         m_pAlignLB->Show();
    1382           0 :         m_pAlignLB->SetSelectHdl(LINK(this, SvxNumOptionsTabPage, EditModifyHdl_Impl));
    1383             :     }
    1384             :     else
    1385             :     {
    1386           0 :         m_pAlignFT->Hide();
    1387           0 :         m_pAlignLB->Hide();
    1388             :     }
    1389             : 
    1390             :     // MegaHack: because of a not-fixable 'design mistake/error' in Impress
    1391             :     // delete all kinds of numeric enumerations
    1392           0 :     if(pActNum->IsFeatureSupported(NUM_NO_NUMBERS))
    1393             :     {
    1394           0 :         sal_uInt16 nFmtCount = m_pFmtLB->GetEntryCount();
    1395           0 :         for(sal_uInt16 i = nFmtCount; i; i--)
    1396             :         {
    1397           0 :             sal_uInt16 nEntryData = (sal_uInt16)(sal_uLong)m_pFmtLB->GetEntryData(i - 1);
    1398           0 :             if( /*nEntryData >= SVX_NUM_CHARS_UPPER_LETTER &&*/  nEntryData <= SVX_NUM_NUMBER_NONE)
    1399           0 :                 m_pFmtLB->RemoveEntry(i - 1);
    1400             :         }
    1401             :     }
    1402             : 
    1403           0 :     InitControls();
    1404           0 :     bModified = sal_False;
    1405             : 
    1406           0 : }
    1407             : 
    1408           0 : void SvxNumOptionsTabPage::InitControls()
    1409             : {
    1410           0 :     bool bShowBullet    = true;
    1411           0 :     bool bShowBitmap    = true;
    1412           0 :     bool bSameType      = true;
    1413           0 :     bool bSameStart     = true;
    1414           0 :     bool bSamePrefix    = true;
    1415           0 :     bool bSameSuffix    = true;
    1416           0 :     bool bAllLevel      = true;
    1417           0 :     sal_Bool bSameCharFmt   = true;
    1418           0 :     sal_Bool bSameVOrient   = true;
    1419           0 :     bool bSameSize      = true;
    1420           0 :     bool bSameBulColor  = true;
    1421           0 :     bool bSameBulRelSize= true;
    1422           0 :     bool bSameAdjust    = true;
    1423             : 
    1424             :     const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
    1425           0 :     String sFirstCharFmt;
    1426           0 :     sal_Int16 eFirstOrient = text::VertOrientation::NONE;
    1427           0 :     Size aFirstSize(0,0);
    1428           0 :     sal_uInt16 nMask = 1;
    1429           0 :     sal_uInt16 nLvl = USHRT_MAX;
    1430           0 :     sal_uInt16 nHighestLevel = 0;
    1431           0 :     String aEmptyStr;
    1432             : 
    1433           0 :     sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
    1434           0 :     sal_Bool bBullRelSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
    1435           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1436             :     {
    1437           0 :         if(nActNumLvl & nMask)
    1438             :         {
    1439           0 :             aNumFmtArr[i] = &pActNum->GetLevel(i);
    1440           0 :             bShowBullet &= aNumFmtArr[i]->GetNumberingType() == SVX_NUM_CHAR_SPECIAL;
    1441           0 :             bShowBitmap &= (aNumFmtArr[i]->GetNumberingType()&(~LINK_TOKEN)) == SVX_NUM_BITMAP;
    1442           0 :             if(USHRT_MAX == nLvl)
    1443             :             {
    1444           0 :                 nLvl = i;
    1445           0 :                 sFirstCharFmt = aNumFmtArr[i]->GetCharFmtName();
    1446           0 :                 eFirstOrient = aNumFmtArr[i]->GetVertOrient();
    1447           0 :                 if(bShowBitmap)
    1448           0 :                     aFirstSize = aNumFmtArr[i]->GetGraphicSize();
    1449             :             }
    1450           0 :             if( i > nLvl)
    1451             :             {
    1452           0 :                 bSameType &=   aNumFmtArr[i]->GetNumberingType() == aNumFmtArr[nLvl]->GetNumberingType();
    1453           0 :                 bSameStart = aNumFmtArr[i]->GetStart() == aNumFmtArr[nLvl]->GetStart();
    1454             : 
    1455           0 :                 bSamePrefix = aNumFmtArr[i]->GetPrefix() == aNumFmtArr[nLvl]->GetPrefix();
    1456           0 :                 bSameSuffix = aNumFmtArr[i]->GetSuffix() == aNumFmtArr[nLvl]->GetSuffix();
    1457           0 :                 bAllLevel &= aNumFmtArr[i]->GetIncludeUpperLevels() == aNumFmtArr[nLvl]->GetIncludeUpperLevels();
    1458           0 :                 bSameCharFmt    &=  sFirstCharFmt == aNumFmtArr[i]->GetCharFmtName();
    1459           0 :                 bSameVOrient    &= eFirstOrient == aNumFmtArr[i]->GetVertOrient();
    1460           0 :                 if(bShowBitmap && bSameSize)
    1461           0 :                     bSameSize &= aNumFmtArr[i]->GetGraphicSize() == aFirstSize;
    1462           0 :                 bSameBulColor &= aNumFmtArr[i]->GetBulletColor() == aNumFmtArr[nLvl]->GetBulletColor();
    1463           0 :                 bSameBulRelSize &= aNumFmtArr[i]->GetBulletRelSize() == aNumFmtArr[nLvl]->GetBulletRelSize();
    1464           0 :                 bSameAdjust     &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
    1465             :             }
    1466           0 :             nHighestLevel = i;
    1467             :         }
    1468             :         else
    1469           0 :             aNumFmtArr[i] = 0;
    1470             : 
    1471           0 :         nMask <<= 1 ;
    1472             : 
    1473             :     }
    1474           0 :     SwitchNumberType(bShowBullet ? 1 : bShowBitmap ? 2 : 0);
    1475           0 :     CheckForStartValue_Impl(aNumFmtArr[nLvl]->GetNumberingType());
    1476           0 :     if(bShowBitmap)
    1477             :     {
    1478           0 :         if(!bSameVOrient || eFirstOrient == text::VertOrientation::NONE)
    1479           0 :             m_pOrientLB->SetNoSelection();
    1480             :         else
    1481             :             m_pOrientLB->SelectEntryPos(
    1482           0 :                 sal::static_int_cast< sal_uInt16 >(eFirstOrient - 1));
    1483             :                 // no text::VertOrientation::NONE
    1484             : 
    1485           0 :         if(bSameSize)
    1486             :         {
    1487           0 :             SetMetricValue(*m_pHeightMF, aFirstSize.Height(), eCoreUnit);
    1488           0 :             SetMetricValue(*m_pWidthMF, aFirstSize.Width(), eCoreUnit);
    1489             :         }
    1490             :         else
    1491             :         {
    1492           0 :             m_pHeightMF->SetText(aEmptyStr);
    1493           0 :             m_pWidthMF->SetText(aEmptyStr);
    1494             :         }
    1495             :     }
    1496             : 
    1497           0 :     if(bSameType)
    1498             :     {
    1499           0 :         sal_uInt16 nLBData = (sal_uInt16) aNumFmtArr[nLvl]->GetNumberingType();
    1500           0 :         m_pFmtLB->SelectEntryPos(m_pFmtLB->GetEntryPos( (void*)sal::static_int_cast<sal_uIntPtr>( nLBData ) ));
    1501             :     }
    1502             :     else
    1503           0 :         m_pFmtLB->SetNoSelection();
    1504             : 
    1505           0 :     m_pAllLevelNF->Enable(nHighestLevel > 0 && !m_pSameLevelCB->IsChecked());
    1506           0 :     m_pAllLevelNF->SetMax(nHighestLevel + 1);
    1507           0 :     if(bAllLevel)
    1508             :     {
    1509           0 :         m_pAllLevelNF->SetValue(aNumFmtArr[nLvl]->GetIncludeUpperLevels());
    1510             :     }
    1511             :     else
    1512             :     {
    1513           0 :         m_pAllLevelNF->SetText(aEmptyStr);
    1514             :     }
    1515           0 :     if(bSameAdjust)
    1516             :     {
    1517           0 :         sal_uInt16 nPos = 1; // centered
    1518           0 :         if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
    1519           0 :             nPos = 0;
    1520           0 :         else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
    1521           0 :             nPos = 2;
    1522           0 :         m_pAlignLB->SelectEntryPos(nPos);
    1523             :     }
    1524             :     else
    1525             :     {
    1526           0 :         m_pAlignLB->SetNoSelection();
    1527             :     }
    1528             : 
    1529           0 :     if(bBullRelSize)
    1530             :     {
    1531           0 :         if(bSameBulRelSize)
    1532           0 :             m_pBulRelSizeMF->SetValue(aNumFmtArr[nLvl]->GetBulletRelSize());
    1533             :         else
    1534           0 :             m_pBulRelSizeMF->SetText(aEmptyStr);
    1535             :     }
    1536           0 :     if(bBullColor)
    1537             :     {
    1538           0 :         if(bSameBulColor)
    1539           0 :             m_pBulColLB->SelectEntry(aNumFmtArr[nLvl]->GetBulletColor());
    1540             :         else
    1541           0 :             m_pBulColLB->SetNoSelection();
    1542             :     }
    1543           0 :     switch(nBullet)
    1544             :     {
    1545             :         case SHOW_NUMBERING:
    1546           0 :             if(bSameStart)
    1547             :             {
    1548           0 :                 m_pStartED->SetValue(aNumFmtArr[nLvl]->GetStart());
    1549             :             }
    1550             :             else
    1551           0 :                 m_pStartED->SetText(aEmptyStr);
    1552           0 :         break;
    1553             :         case SHOW_BULLET:
    1554           0 :         break;
    1555             :         case SHOW_BITMAP:
    1556           0 :         break;
    1557             :     }
    1558             : 
    1559           0 :     if(bSamePrefix)
    1560           0 :         m_pPrefixED->SetText(aNumFmtArr[nLvl]->GetPrefix());
    1561             :     else
    1562           0 :         m_pPrefixED->SetText(aEmptyStr);
    1563           0 :     if(bSameSuffix)
    1564           0 :         m_pSuffixED->SetText(aNumFmtArr[nLvl]->GetSuffix());
    1565             :     else
    1566           0 :         m_pSuffixED->SetText(aEmptyStr);
    1567             : 
    1568           0 :     if(bSameCharFmt)
    1569             :     {
    1570           0 :         if(sFirstCharFmt.Len())
    1571           0 :                 m_pCharFmtLB->SelectEntry(sFirstCharFmt);
    1572             :         else
    1573           0 :             m_pCharFmtLB->SelectEntryPos( 0 );
    1574             :     }
    1575             :     else
    1576           0 :         m_pCharFmtLB->SetNoSelection();
    1577             : 
    1578           0 :     m_pPreviewWIN->SetLevel(nActNumLvl);
    1579           0 :     m_pPreviewWIN->Invalidate();
    1580           0 : }
    1581             : 
    1582             : // 0 - Number; 1 - Bullet; 2 - Bitmap
    1583           0 : void SvxNumOptionsTabPage::SwitchNumberType( sal_uInt8 nType, sal_Bool )
    1584             : {
    1585           0 :     if(nBullet == nType)
    1586           0 :         return;
    1587           0 :     nBullet = nType;
    1588           0 :     sal_Bool bBullet = (nType == SHOW_BULLET);
    1589           0 :     sal_Bool bBitmap = (nType == SHOW_BITMAP);
    1590           0 :     sal_Bool bEnableBitmap = (nType == SHOW_BITMAP);
    1591           0 :     sal_Bool bNumeric = !(bBitmap||bBullet);
    1592           0 :     m_pSeparatorFT->Show(bNumeric);
    1593           0 :     m_pPrefixFT->Show(bNumeric);
    1594           0 :     m_pPrefixED->Show(bNumeric);
    1595           0 :     m_pSuffixFT->Show(bNumeric);
    1596           0 :     m_pSuffixED->Show(bNumeric);
    1597             : 
    1598           0 :     sal_Bool bCharFmt = pActNum->IsFeatureSupported(NUM_CHAR_STYLE);
    1599           0 :     m_pCharFmtFT->Show(!bBitmap && bCharFmt);
    1600           0 :     m_pCharFmtLB->Show(!bBitmap && bCharFmt);
    1601             : 
    1602             :     // this is rather misusage, as there is no own flag
    1603             :     // for complete numeration
    1604           0 :     sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
    1605           0 :     sal_Bool bAllLevel = bNumeric && bAllLevelFeature && !bHTMLMode;
    1606           0 :     m_pAllLevelFT->Show(bAllLevel);
    1607           0 :     m_pAllLevelNF->Show(bAllLevel);
    1608             : 
    1609           0 :     m_pStartFT->Show(!(bBullet||bBitmap));
    1610           0 :     m_pStartED->Show(!(bBullet||bBitmap));
    1611             : 
    1612           0 :     m_pBulletFT->Show(bBullet);
    1613           0 :     m_pBulletPB->Show(bBullet);
    1614           0 :     sal_Bool bBullColor = pActNum->IsFeatureSupported(NUM_BULLET_COLOR);
    1615           0 :     m_pBulColorFT->Show(!bBitmap && bBullColor);
    1616           0 :     m_pBulColLB->Show(!bBitmap && bBullColor);
    1617           0 :     sal_Bool bBullResSize = pActNum->IsFeatureSupported(NUM_BULLET_REL_SIZE);
    1618           0 :     m_pBulRelSizeFT->Show(!bBitmap && bBullResSize);
    1619           0 :     m_pBulRelSizeMF->Show(!bBitmap && bBullResSize);
    1620             : 
    1621           0 :     m_pBitmapFT->Show(bBitmap);
    1622           0 :     m_pBitmapMB->Show(bBitmap);
    1623             : 
    1624           0 :     m_pWidthFT->Show(bBitmap);
    1625           0 :     m_pWidthMF->Show(bBitmap);
    1626           0 :     m_pHeightFT->Show(bBitmap);
    1627           0 :     m_pHeightMF->Show(bBitmap);
    1628           0 :     m_pRatioCB->Show(bBitmap);
    1629             : 
    1630           0 :     m_pOrientFT->Show(bBitmap &&  bAllLevelFeature);
    1631           0 :     m_pOrientLB->Show(bBitmap &&  bAllLevelFeature);
    1632             : 
    1633           0 :     m_pWidthFT->Enable(bEnableBitmap);
    1634           0 :     m_pWidthMF->Enable(bEnableBitmap);
    1635           0 :     m_pHeightFT->Enable(bEnableBitmap);
    1636           0 :     m_pHeightMF->Enable(bEnableBitmap);
    1637           0 :     m_pRatioCB->Enable(bEnableBitmap);
    1638           0 :     m_pOrientFT->Enable(bEnableBitmap);
    1639           0 :     m_pOrientLB->Enable(bEnableBitmap);
    1640             : }
    1641             : 
    1642           0 : IMPL_LINK( SvxNumOptionsTabPage, LevelHdl_Impl, ListBox *, pBox )
    1643             : {
    1644           0 :     sal_uInt16 nSaveNumLvl = nActNumLvl;
    1645           0 :     nActNumLvl = 0;
    1646           0 :     if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
    1647           0 :         (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
    1648             :     {
    1649           0 :         nActNumLvl = 0xFFFF;
    1650           0 :         pBox->SetUpdateMode(sal_False);
    1651           0 :         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
    1652           0 :             pBox->SelectEntryPos( i, sal_False );
    1653           0 :         pBox->SetUpdateMode(sal_True);
    1654             :     }
    1655           0 :     else if(pBox->GetSelectEntryCount())
    1656             :     {
    1657           0 :         sal_uInt16 nMask = 1;
    1658           0 :         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
    1659             :         {
    1660           0 :             if(pBox->IsEntryPosSelected( i ))
    1661           0 :                 nActNumLvl |= nMask;
    1662           0 :             nMask <<= 1;
    1663             :         }
    1664           0 :         pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False );
    1665             :     }
    1666             :     else
    1667             :     {
    1668           0 :         nActNumLvl = nSaveNumLvl;
    1669           0 :         sal_uInt16 nMask = 1;
    1670           0 :         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
    1671             :         {
    1672           0 :             if(nActNumLvl & nMask)
    1673             :             {
    1674           0 :                 pBox->SelectEntryPos(i);
    1675           0 :                 break;
    1676             :             }
    1677           0 :             nMask <<=1;
    1678             :         }
    1679             :     }
    1680           0 :     InitControls();
    1681           0 :     return 0;
    1682             : }
    1683             : 
    1684           0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, PreviewInvalidateHdl_Impl)
    1685             : {
    1686           0 :     m_pPreviewWIN->Invalidate();
    1687           0 :     return 0;
    1688             : }
    1689             : 
    1690           0 : IMPL_LINK( SvxNumOptionsTabPage, AllLevelHdl_Impl, NumericField*, pBox )
    1691             : {
    1692           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1693             :     {
    1694           0 :         sal_uInt16 nMask = 1;
    1695           0 :         for(sal_uInt16 e = 0; e < pActNum->GetLevelCount(); e++)
    1696             :         {
    1697           0 :             if(nActNumLvl & nMask)
    1698             :             {
    1699           0 :                 SvxNumberFormat aNumFmt(pActNum->GetLevel(e));
    1700           0 :                 aNumFmt.SetIncludeUpperLevels((sal_uInt8) std::min(pBox->GetValue(), sal_Int64(e + 1)) );
    1701           0 :                 pActNum->SetLevel(e, aNumFmt);
    1702             :             }
    1703           0 :             nMask <<= 1;
    1704             :         }
    1705             :     }
    1706           0 :     SetModified();
    1707           0 :     return 0;
    1708             : }
    1709             : 
    1710           0 : IMPL_LINK( SvxNumOptionsTabPage, NumberTypeSelectHdl_Impl, ListBox *, pBox )
    1711             : {
    1712           0 :     String sSelectStyle;
    1713           0 :     sal_Bool bShowOrient = sal_False;
    1714           0 :     sal_Bool bBmp = sal_False;
    1715           0 :     String aEmptyStr;
    1716           0 :     sal_uInt16 nMask = 1;
    1717           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1718             :     {
    1719           0 :         if(nActNumLvl & nMask)
    1720             :         {
    1721           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    1722             :             // PAGEDESC does not exist
    1723           0 :             sal_uInt16 nNumType = (sal_uInt16)(sal_uLong)pBox->GetEntryData(pBox->GetSelectEntryPos());
    1724           0 :             aNumFmt.SetNumberingType((sal_Int16)nNumType);
    1725           0 :             sal_uInt16 nNumberingType = aNumFmt.GetNumberingType();
    1726           0 :             if(SVX_NUM_BITMAP == (nNumberingType&(~LINK_TOKEN)))
    1727             :             {
    1728           0 :                 bBmp |= 0 != aNumFmt.GetBrush();
    1729           0 :                 aNumFmt.SetIncludeUpperLevels( sal_False );
    1730           0 :                 aNumFmt.SetSuffix( aEmptyStr );
    1731           0 :                 aNumFmt.SetPrefix( aEmptyStr );
    1732           0 :                 if(!bBmp)
    1733           0 :                     aNumFmt.SetGraphic(aEmptyStr);
    1734           0 :                 pActNum->SetLevel(i, aNumFmt);
    1735           0 :                 SwitchNumberType(SHOW_BITMAP, bBmp );
    1736           0 :                 bShowOrient = sal_True;
    1737             :             }
    1738           0 :             else if( SVX_NUM_CHAR_SPECIAL == nNumberingType )
    1739             :             {
    1740           0 :                 aNumFmt.SetIncludeUpperLevels( sal_False );
    1741           0 :                 aNumFmt.SetSuffix( aEmptyStr );
    1742           0 :                 aNumFmt.SetPrefix( aEmptyStr );
    1743           0 :                 if( !aNumFmt.GetBulletFont() )
    1744           0 :                     aNumFmt.SetBulletFont(&aActBulletFont);
    1745           0 :                 if( !aNumFmt.GetBulletChar() )
    1746           0 :                     aNumFmt.SetBulletChar( SVX_DEF_BULLET );
    1747           0 :                 pActNum->SetLevel(i, aNumFmt);
    1748           0 :                 SwitchNumberType(SHOW_BULLET);
    1749             :                 // allocation of the drawing pattern is automatic
    1750           0 :                 if(bAutomaticCharStyles)
    1751             :                 {
    1752           0 :                     sSelectStyle = m_sBulletCharFmtName;
    1753             :                 }
    1754             :             }
    1755             :             else
    1756             :             {
    1757           0 :                 aNumFmt.SetPrefix( m_pPrefixED->GetText() );
    1758           0 :                 aNumFmt.SetSuffix( m_pSuffixED->GetText() );
    1759           0 :                 SwitchNumberType(SHOW_NUMBERING);
    1760           0 :                 pActNum->SetLevel(i, aNumFmt);
    1761           0 :                 CheckForStartValue_Impl(nNumberingType);
    1762             : 
    1763             :                 // allocation of the drawing pattern is automatic
    1764           0 :                 if(bAutomaticCharStyles)
    1765             :                 {
    1766           0 :                     sSelectStyle = m_sNumCharFmtName;
    1767             :                 }
    1768           0 :             }
    1769             :         }
    1770           0 :         nMask <<= 1;
    1771             :     }
    1772           0 :     sal_Bool bAllLevelFeature = pActNum->IsFeatureSupported(NUM_CONTINUOUS);
    1773           0 :     if(bShowOrient && bAllLevelFeature)
    1774             :     {
    1775           0 :         m_pOrientFT->Show();
    1776           0 :         m_pOrientLB->Show();
    1777             :     }
    1778             :     else
    1779             :     {
    1780           0 :         m_pOrientFT->Hide();
    1781           0 :         m_pOrientLB->Hide();
    1782             :     }
    1783           0 :     SetModified();
    1784           0 :     if(sSelectStyle.Len())
    1785             :     {
    1786           0 :         m_pCharFmtLB->SelectEntry(sSelectStyle);
    1787           0 :         CharFmtHdl_Impl(m_pCharFmtLB);
    1788           0 :         bAutomaticCharStyles = sal_True;
    1789             :     }
    1790           0 :     return 0;
    1791             : }
    1792             : 
    1793           0 : void SvxNumOptionsTabPage::CheckForStartValue_Impl(sal_uInt16 nNumberingType)
    1794             : {
    1795           0 :     sal_Bool bIsNull = m_pStartED->GetValue() == 0;
    1796           0 :     sal_Bool bNoZeroAllowed = nNumberingType < SVX_NUM_ARABIC ||
    1797           0 :                         SVX_NUM_CHARS_UPPER_LETTER_N == nNumberingType ||
    1798           0 :                         SVX_NUM_CHARS_LOWER_LETTER_N == nNumberingType;
    1799           0 :     m_pStartED->SetMin(bNoZeroAllowed ? 1 : 0);
    1800           0 :     if(bIsNull && bNoZeroAllowed)
    1801           0 :         m_pStartED->GetModifyHdl().Call(m_pStartED);
    1802           0 : }
    1803             : 
    1804           0 : IMPL_LINK( SvxNumOptionsTabPage, OrientHdl_Impl, ListBox *, pBox )
    1805             : {
    1806           0 :     sal_uInt16 nPos = pBox->GetSelectEntryPos();
    1807           0 :     nPos ++; // no VERT_NONE
    1808             : 
    1809           0 :     sal_uInt16 nMask = 1;
    1810           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1811             :     {
    1812           0 :         if(nActNumLvl & nMask)
    1813             :         {
    1814           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    1815           0 :             if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
    1816             :             {
    1817           0 :                 const SvxBrushItem* pBrushItem =  aNumFmt.GetBrush();
    1818           0 :                 const Size& rSize = aNumFmt.GetGraphicSize();
    1819           0 :                 sal_Int16 eOrient = (sal_Int16)nPos;
    1820           0 :                 aNumFmt.SetGraphicBrush( pBrushItem, &rSize, &eOrient );
    1821           0 :                 pActNum->SetLevel(i, aNumFmt);
    1822           0 :             }
    1823             :         }
    1824           0 :         nMask <<= 1;
    1825             :     }
    1826           0 :     SetModified(sal_False);
    1827           0 :     return 0;
    1828             : 
    1829             : }
    1830             : 
    1831           0 : IMPL_LINK( SvxNumOptionsTabPage, SameLevelHdl_Impl, CheckBox *, pBox )
    1832             : {
    1833           0 :     sal_Bool bSet = pBox->IsChecked();
    1834           0 :     pActNum->SetContinuousNumbering(bSet);
    1835           0 :     sal_Bool bRepaint = sal_False;
    1836           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1837             :     {
    1838           0 :         SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    1839           0 :         if(aNumFmt.GetNumberingType() != SVX_NUM_NUMBER_NONE)
    1840             :         {
    1841           0 :             bRepaint = sal_True;
    1842           0 :             break;
    1843             :         }
    1844           0 :     }
    1845           0 :     SetModified(bRepaint);
    1846           0 :     InitControls();
    1847           0 :     return 0;
    1848             : }
    1849             : 
    1850           0 : IMPL_LINK( SvxNumOptionsTabPage, BulColorHdl_Impl, ColorListBox*, pBox )
    1851             : {
    1852           0 :     Color nSetColor = pBox->GetSelectEntryColor();
    1853             : 
    1854           0 :     sal_uInt16 nMask = 1;
    1855           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1856             :     {
    1857           0 :         if(nActNumLvl & nMask)
    1858             :         {
    1859           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    1860           0 :             aNumFmt.SetBulletColor(nSetColor);
    1861           0 :             pActNum->SetLevel(i, aNumFmt);
    1862             :         }
    1863           0 :         nMask <<= 1;
    1864             :     }
    1865           0 :     SetModified();
    1866           0 :     return 0;
    1867             : }
    1868             : 
    1869           0 : IMPL_LINK( SvxNumOptionsTabPage, BulRelSizeHdl_Impl, MetricField *, pField)
    1870             : {
    1871           0 :     sal_uInt16 nRelSize = (sal_uInt16)pField->GetValue();
    1872             : 
    1873           0 :     sal_uInt16 nMask = 1;
    1874           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1875             :     {
    1876           0 :         if(nActNumLvl & nMask)
    1877             :         {
    1878           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    1879           0 :             aNumFmt.SetBulletRelSize(nRelSize);
    1880           0 :             pActNum->SetLevel(i, aNumFmt);
    1881             :         }
    1882           0 :         nMask <<= 1;
    1883             :     }
    1884           0 :     SetModified();
    1885           0 :     return 0;
    1886             : }
    1887             : 
    1888           0 : IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton )
    1889             : {
    1890           0 :     sal_uInt16                  nItemId = pButton->GetCurItemId();
    1891           0 :     String                  aGrfName;
    1892           0 :     Size                    aSize;
    1893           0 :     sal_Bool                bSucc(sal_False);
    1894           0 :     SvxOpenGraphicDialog    aGrfDlg( CUI_RES(RID_SVXSTR_EDIT_GRAPHIC) );
    1895             : 
    1896           0 :     if(MN_GALLERY_ENTRY <= nItemId )
    1897             :     {
    1898           0 :         sal_uInt16 idx = nItemId - MN_GALLERY_ENTRY;
    1899           0 :         if (idx < aGrfNames.size())
    1900             :         {
    1901           0 :             aGrfName = aGrfNames[idx];
    1902           0 :             Graphic aGraphic;
    1903           0 :             if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, idx, &aGraphic))
    1904             :             {
    1905           0 :                 aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
    1906           0 :                 bSucc = sal_True;
    1907           0 :             }
    1908             :         }
    1909             :     }
    1910             :     else
    1911             :     {
    1912           0 :         aGrfDlg.EnableLink( sal_False );
    1913           0 :         aGrfDlg.AsLink( sal_False );
    1914           0 :         if ( !aGrfDlg.Execute() )
    1915             :         {
    1916             :             // memorize selected filter
    1917           0 :             aGrfName = aGrfDlg.GetPath();
    1918             : 
    1919           0 :             Graphic aGraphic;
    1920           0 :             if( !aGrfDlg.GetGraphic(aGraphic) )
    1921             :             {
    1922           0 :                 aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
    1923           0 :                 bSucc = sal_True;
    1924           0 :             }
    1925             :         }
    1926             :     }
    1927           0 :     if(bSucc)
    1928             :     {
    1929           0 :         aSize = OutputDevice::LogicToLogic(aSize, MAP_100TH_MM, (MapUnit)eCoreUnit);
    1930             : 
    1931           0 :         sal_uInt16 nMask = 1;
    1932           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    1933             :         {
    1934           0 :             if(nActNumLvl & nMask)
    1935             :             {
    1936           0 :                 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    1937           0 :                 aNumFmt.SetCharFmtName(m_sNumCharFmtName);
    1938           0 :                 aNumFmt.SetGraphic(aGrfName);
    1939             : 
    1940             :                 // set size for a later comparison
    1941           0 :                 const SvxBrushItem* pBrushItem = aNumFmt.GetBrush();
    1942             :                 // initiate asynchronous loading
    1943           0 :                 sal_Int16 eOrient = aNumFmt.GetVertOrient();
    1944           0 :                 aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
    1945           0 :                 aInitSize[i] = aNumFmt.GetGraphicSize();
    1946             : 
    1947           0 :                 pActNum->SetLevel(i, aNumFmt);
    1948             :             }
    1949           0 :             nMask <<= 1;
    1950             :         }
    1951           0 :         m_pRatioCB->Enable();
    1952           0 :         m_pWidthFT->Enable();
    1953           0 :         m_pHeightFT->Enable();
    1954           0 :         m_pWidthMF->Enable();
    1955           0 :         m_pHeightMF->Enable();
    1956           0 :         SetMetricValue(*m_pWidthMF, aSize.Width(), eCoreUnit);
    1957           0 :         SetMetricValue(*m_pHeightMF, aSize.Height(), eCoreUnit);
    1958           0 :         m_pOrientFT->Enable();
    1959           0 :         m_pOrientLB->Enable();
    1960           0 :         SetModified();
    1961             :         //needed due to asynchronous loading of graphics in the SvxBrushItem
    1962           0 :         aInvalidateTimer.Start();
    1963             :     }
    1964           0 :     return 0;
    1965             : }
    1966             : 
    1967           0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, PopupActivateHdl_Impl)
    1968             : {
    1969           0 :     if(!bMenuButtonInitialized)
    1970             :     {
    1971           0 :         bMenuButtonInitialized = sal_True;
    1972           0 :         EnterWait();
    1973           0 :         PopupMenu* pMenu = m_pBitmapMB->GetPopupMenu();
    1974           0 :         PopupMenu* pPopup = pMenu->GetPopupMenu(m_nGalleryId);
    1975             : 
    1976           0 :         if (GalleryExplorer::FillObjList(GALLERY_THEME_BULLETS, aGrfNames))
    1977             :         {
    1978           0 :             pPopup->Clear();
    1979           0 :             GalleryExplorer::BeginLocking(GALLERY_THEME_BULLETS);
    1980             : 
    1981           0 :             Graphic aGraphic;
    1982           0 :             String sGrfName;
    1983           0 :             std::vector<String>::const_iterator it = aGrfNames.begin();
    1984           0 :             for(sal_uInt16 i = 0; it != aGrfNames.end(); ++it, ++i)
    1985             :             {
    1986           0 :                 sGrfName = *it;
    1987           0 :                 INetURLObject aObj(sGrfName);
    1988           0 :                 if(aObj.GetProtocol() == INET_PROT_FILE)
    1989           0 :                     sGrfName = aObj.PathToFileName();
    1990             : 
    1991           0 :                 if(GalleryExplorer::GetGraphicObj( GALLERY_THEME_BULLETS, i, &aGraphic))
    1992             :                 {
    1993           0 :                     Bitmap aBitmap(aGraphic.GetBitmap());
    1994           0 :                     Size aSize(aBitmap.GetSizePixel());
    1995           0 :                     if(aSize.Width() > MAX_BMP_WIDTH ||
    1996           0 :                         aSize.Height() > MAX_BMP_HEIGHT)
    1997             :                     {
    1998           0 :                         sal_Bool bWidth = aSize.Width() > aSize.Height();
    1999             :                         double nScale = bWidth ?
    2000           0 :                                             (double)MAX_BMP_WIDTH / (double)aSize.Width():
    2001           0 :                                                 (double)MAX_BMP_HEIGHT / (double)aSize.Height();
    2002           0 :                         aBitmap.Scale(nScale, nScale);
    2003             :                     }
    2004           0 :                     Image aImage(aBitmap);
    2005             : 
    2006           0 :                     pPopup->InsertItem(MN_GALLERY_ENTRY + i, sGrfName, aImage );
    2007             :                 }
    2008             :                 else
    2009             :                 {
    2010           0 :                     Image aImage;
    2011             :                     pPopup->InsertItem(
    2012           0 :                         MN_GALLERY_ENTRY + i, sGrfName, aImage );
    2013             :                 }
    2014           0 :             }
    2015           0 :             GalleryExplorer::EndLocking(GALLERY_THEME_BULLETS);
    2016             :         }
    2017           0 :         LeaveWait();
    2018             :     }
    2019           0 :     return 0;
    2020             : }
    2021             : 
    2022           0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, BulletHdl_Impl)
    2023             : {
    2024           0 :     SvxCharacterMap* pMap = new SvxCharacterMap( this, sal_True );
    2025             : 
    2026           0 :     sal_uInt16 nMask = 1;
    2027           0 :     const Font* pFmtFont = 0;
    2028           0 :     sal_Bool bSameBullet = sal_True;
    2029           0 :     sal_Unicode cBullet = 0;
    2030           0 :     sal_Bool bFirst = sal_True;
    2031           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2032             :     {
    2033           0 :         if(nActNumLvl & nMask)
    2034             :         {
    2035           0 :             const SvxNumberFormat&  rCurFmt = pActNum->GetLevel(i);
    2036           0 :             if(bFirst)
    2037             :             {
    2038           0 :                  cBullet = rCurFmt.GetBulletChar();
    2039             :             }
    2040           0 :             else if(rCurFmt.GetBulletChar() != cBullet )
    2041             :             {
    2042           0 :                 bSameBullet = sal_False;
    2043           0 :                 break;
    2044             :             }
    2045           0 :             if(!pFmtFont)
    2046           0 :                 pFmtFont = rCurFmt.GetBulletFont();
    2047           0 :             bFirst = sal_False;
    2048             :         }
    2049           0 :         nMask <<= 1;
    2050             : 
    2051             :     }
    2052             : 
    2053           0 :     if(pFmtFont)
    2054           0 :         pMap->SetCharFont(*pFmtFont);
    2055             :     else
    2056           0 :         pMap->SetCharFont(aActBulletFont);
    2057           0 :     if(bSameBullet)
    2058           0 :         pMap->SetChar( cBullet );
    2059           0 :     if(pMap->Execute() == RET_OK)
    2060             :     {
    2061             :         // change Font Numrules
    2062           0 :         aActBulletFont = pMap->GetCharFont();
    2063             : 
    2064           0 :         sal_uInt16 _nMask = 1;
    2065           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2066             :         {
    2067           0 :             if(nActNumLvl & _nMask)
    2068             :             {
    2069           0 :                 SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    2070           0 :                 aNumFmt.SetBulletFont(&aActBulletFont); ;
    2071           0 :                 aNumFmt.SetBulletChar( (sal_Unicode) pMap->GetChar() );
    2072           0 :                 pActNum->SetLevel(i, aNumFmt);
    2073             :             }
    2074           0 :             _nMask <<= 1;
    2075             :         }
    2076             : 
    2077           0 :         SetModified();
    2078             :     }
    2079           0 :     delete pMap;
    2080           0 :     return 0;
    2081             : }
    2082             : 
    2083           0 : IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, MetricField *, pField)
    2084             : {
    2085           0 :     sal_Bool bWidth = pField == m_pWidthMF;
    2086           0 :     bLastWidthModified = bWidth;
    2087           0 :     sal_Bool bRatio = m_pRatioCB->IsChecked();
    2088           0 :     long nWidthVal = static_cast<long>(m_pWidthMF->Denormalize(m_pWidthMF->GetValue(FUNIT_100TH_MM)));
    2089           0 :     long nHeightVal = static_cast<long>(m_pHeightMF->Denormalize(m_pHeightMF->GetValue(FUNIT_100TH_MM)));
    2090             :     nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
    2091           0 :                                                 MAP_100TH_MM, (MapUnit)eCoreUnit );
    2092             :     nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
    2093           0 :                                                 MAP_100TH_MM, (MapUnit)eCoreUnit);
    2094             :     double  fSizeRatio;
    2095             : 
    2096           0 :     sal_Bool bRepaint = sal_False;
    2097           0 :     sal_uInt16 nMask = 1;
    2098           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2099             :     {
    2100           0 :         if(nActNumLvl & nMask)
    2101             :         {
    2102           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    2103           0 :             if(SVX_NUM_BITMAP == (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
    2104             :             {
    2105           0 :                 Size aSize(aNumFmt.GetGraphicSize() );
    2106           0 :                 Size aSaveSize(aSize);
    2107             : 
    2108           0 :                 if (aInitSize[i].Height())
    2109           0 :                     fSizeRatio = (double)aInitSize[i].Width() / (double)aInitSize[i].Height();
    2110             :                 else
    2111           0 :                     fSizeRatio = (double)1;
    2112             : 
    2113           0 :                 if(bWidth)
    2114             :                 {
    2115           0 :                     long nDelta = nWidthVal - aInitSize[i].Width();
    2116           0 :                     aSize.Width() = nWidthVal;
    2117           0 :                     if (bRatio)
    2118             :                     {
    2119           0 :                         aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio);
    2120             :                         m_pHeightMF->SetUserValue(m_pHeightMF->Normalize(
    2121           0 :                             OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
    2122           0 :                                 FUNIT_100TH_MM);
    2123             :                     }
    2124             :                 }
    2125             :                 else
    2126             :                 {
    2127           0 :                     long nDelta = nHeightVal - aInitSize[i].Height();
    2128           0 :                     aSize.Height() = nHeightVal;
    2129           0 :                     if (bRatio)
    2130             :                     {
    2131           0 :                         aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio);
    2132             :                         m_pWidthMF->SetUserValue(m_pWidthMF->Normalize(
    2133           0 :                             OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MAP_100TH_MM )),
    2134           0 :                                 FUNIT_100TH_MM);
    2135             :                     }
    2136             :                 }
    2137           0 :                 const SvxBrushItem* pBrushItem =  aNumFmt.GetBrush();
    2138           0 :                 sal_Int16 eOrient = aNumFmt.GetVertOrient();
    2139           0 :                 if(aSize != aSaveSize)
    2140           0 :                     bRepaint = sal_True;
    2141           0 :                 aNumFmt.SetGraphicBrush( pBrushItem, &aSize, &eOrient );
    2142           0 :                 pActNum->SetLevel(i, aNumFmt);
    2143           0 :             }
    2144             :         }
    2145           0 :         nMask <<= 1;
    2146             :     }
    2147           0 :     SetModified(bRepaint);
    2148           0 :     return 0;
    2149             : }
    2150             : 
    2151           0 : IMPL_LINK( SvxNumOptionsTabPage, RatioHdl_Impl, CheckBox *, pBox )
    2152             : {
    2153           0 :     if (pBox->IsChecked())
    2154             :     {
    2155           0 :         if (bLastWidthModified)
    2156           0 :             SizeHdl_Impl(m_pWidthMF);
    2157             :         else
    2158           0 :             SizeHdl_Impl(m_pHeightMF);
    2159             :     }
    2160           0 :     return 0;
    2161             : }
    2162             : 
    2163           0 : IMPL_LINK_NOARG(SvxNumOptionsTabPage, CharFmtHdl_Impl)
    2164             : {
    2165           0 :     bAutomaticCharStyles = sal_False;
    2166           0 :     sal_uInt16 nEntryPos = m_pCharFmtLB->GetSelectEntryPos();
    2167           0 :     String sEntry = m_pCharFmtLB->GetSelectEntry();
    2168           0 :     sal_uInt16 nMask = 1;
    2169           0 :     String aEmptyStr;
    2170           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2171             :     {
    2172           0 :         if(nActNumLvl & nMask)
    2173             :         {
    2174           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    2175           0 :             if( 0 == nEntryPos )
    2176           0 :                 aNumFmt.SetCharFmtName(aEmptyStr);
    2177             :             else
    2178             :             {
    2179           0 :                 if(SVX_NUM_BITMAP != (aNumFmt.GetNumberingType()&(~LINK_TOKEN)))
    2180           0 :                     aNumFmt.SetCharFmtName(sEntry);
    2181             :             }
    2182           0 :             pActNum->SetLevel(i, aNumFmt);
    2183             :         }
    2184           0 :         nMask <<= 1;
    2185             :     }
    2186           0 :     SetModified(sal_False);
    2187           0 :     return 0;
    2188             : 
    2189             : };
    2190             : 
    2191           0 : IMPL_LINK( SvxNumOptionsTabPage, EditModifyHdl_Impl, Edit *, pEdit )
    2192             : {
    2193           0 :     sal_Bool bPrefix = pEdit == m_pPrefixED;
    2194           0 :     sal_Bool bSuffix = pEdit == m_pSuffixED;
    2195           0 :     sal_Bool bStart = pEdit == m_pStartED;
    2196           0 :     sal_uInt16 nMask = 1;
    2197           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2198             :     {
    2199           0 :         if(nActNumLvl & nMask)
    2200             :         {
    2201           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    2202           0 :             if(bPrefix)
    2203           0 :                 aNumFmt.SetPrefix( m_pPrefixED->GetText() );
    2204           0 :             else if(bSuffix)
    2205           0 :                 aNumFmt.SetSuffix( m_pSuffixED->GetText() );
    2206           0 :             else if(bStart)
    2207           0 :                 aNumFmt.SetStart( (sal_uInt16)m_pStartED->GetValue() );
    2208             :             else //align
    2209             :             {
    2210           0 :                 sal_uInt16 nPos = m_pAlignLB->GetSelectEntryPos();
    2211           0 :                 SvxAdjust eAdjust = SVX_ADJUST_CENTER;
    2212           0 :                 if(nPos == 0)
    2213           0 :                     eAdjust = SVX_ADJUST_LEFT;
    2214           0 :                 else if(nPos == 2)
    2215           0 :                     eAdjust = SVX_ADJUST_RIGHT;
    2216           0 :                 aNumFmt.SetNumAdjust( eAdjust );
    2217             :             }
    2218           0 :             pActNum->SetLevel(i, aNumFmt);
    2219             :         }
    2220           0 :         nMask <<= 1;
    2221             :     }
    2222           0 :     SetModified();
    2223             : 
    2224           0 :     return 0;
    2225             : }
    2226             : 
    2227           0 : static sal_uInt16 lcl_DrawGraphic(VirtualDevice* pVDev, const SvxNumberFormat &rFmt, sal_uInt16 nXStart,
    2228             :                         sal_uInt16 nYStart, sal_uInt16 nDivision)
    2229             : {
    2230           0 :     const SvxBrushItem* pBrushItem = rFmt.GetBrush();
    2231           0 :     sal_uInt16 nRet = 0;
    2232           0 :     if(pBrushItem)
    2233             :     {
    2234           0 :         const Graphic* pGrf = pBrushItem->GetGraphic();
    2235           0 :         if(pGrf)
    2236             :         {
    2237           0 :             Size aGSize( rFmt.GetGraphicSize() );
    2238           0 :             aGSize.Width() /= nDivision;
    2239           0 :             nRet = (sal_uInt16)aGSize.Width();
    2240           0 :             aGSize.Height() /= nDivision;
    2241             :             pGrf->Draw( pVDev, Point(nXStart,nYStart),
    2242           0 :                     pVDev->PixelToLogic( aGSize ) );
    2243             :         }
    2244             :     }
    2245           0 :     return nRet;
    2246             : 
    2247             : }
    2248             : 
    2249           0 : static sal_uInt16 lcl_DrawBullet(VirtualDevice* pVDev,
    2250             :             const SvxNumberFormat& rFmt, sal_uInt16 nXStart,
    2251             :             sal_uInt16 nYStart, const Size& rSize)
    2252             : {
    2253           0 :     Font aTmpFont(pVDev->GetFont());
    2254             : 
    2255             :     // via Uno it's possible that no font has been set!
    2256           0 :     Font aFont(rFmt.GetBulletFont() ? *rFmt.GetBulletFont() : aTmpFont);
    2257           0 :     Size aTmpSize(rSize);
    2258           0 :     aTmpSize.Width() *= rFmt.GetBulletRelSize();
    2259           0 :     aTmpSize.Width() /= 100 ;
    2260           0 :     aTmpSize.Height() *= rFmt.GetBulletRelSize();
    2261           0 :     aTmpSize.Height() /= 100 ;
    2262             :     // in case of a height of zero it is drawed in original height
    2263           0 :     if(!aTmpSize.Height())
    2264           0 :         aTmpSize.Height() = 1;
    2265           0 :     aFont.SetSize(aTmpSize);
    2266           0 :     aFont.SetTransparent(sal_True);
    2267           0 :     Color aBulletColor = rFmt.GetBulletColor();
    2268           0 :     if(aBulletColor.GetColor() == COL_AUTO)
    2269           0 :         aBulletColor = Color(pVDev->GetFillColor().IsDark() ? COL_WHITE : COL_BLACK);
    2270           0 :     else if(aBulletColor == pVDev->GetFillColor())
    2271           0 :         aBulletColor.Invert();
    2272           0 :     aFont.SetColor(aBulletColor);
    2273           0 :     pVDev->SetFont( aFont );
    2274           0 :     OUString aText(rFmt.GetBulletChar());
    2275           0 :     long nY = nYStart;
    2276           0 :     nY -= ((aTmpSize.Height() - rSize.Height())/ 2);
    2277           0 :     pVDev->DrawText( Point(nXStart, nY), aText );
    2278           0 :     sal_uInt16 nRet = (sal_uInt16)pVDev->GetTextWidth(aText);
    2279             : 
    2280           0 :     pVDev->SetFont(aTmpFont);
    2281           0 :     return nRet;
    2282             : }
    2283             : 
    2284           0 : SvxNumberingPreview::SvxNumberingPreview(Window* pParent, WinBits nWinBits)
    2285             :     : Window(pParent, nWinBits)
    2286             :     , pActNum(0)
    2287             :     , nPageWidth(0)
    2288             :     , pOutlineNames(0)
    2289             :     , bPosition(false)
    2290           0 :     , nActLevel(USHRT_MAX)
    2291             : {
    2292           0 :     SetBorderStyle(WINDOW_BORDER_MONO);
    2293           0 : }
    2294             : 
    2295           0 : extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeSvxNumberingPreview(Window *pParent, VclBuilder::stringmap &)
    2296             : {
    2297           0 :     return new SvxNumberingPreview(pParent, WB_BORDER);
    2298             : }
    2299             : 
    2300             : // paint preview of numeration
    2301           0 : void    SvxNumberingPreview::Paint( const Rectangle& /*rRect*/ )
    2302             : {
    2303           0 :     Size aSize(PixelToLogic(GetOutputSizePixel()));
    2304           0 :     Rectangle aRect(Point(0,0), aSize);
    2305             : 
    2306           0 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
    2307           0 :     const Color aBackColor = rStyleSettings.GetFieldColor();
    2308           0 :     const Color aTextColor = rStyleSettings.GetFieldTextColor();
    2309             : 
    2310           0 :     VirtualDevice* pVDev = new VirtualDevice(*this);
    2311           0 :     pVDev->EnableRTL( IsRTLEnabled() );
    2312           0 :     pVDev->SetMapMode(GetMapMode());
    2313           0 :     pVDev->SetOutputSize( aSize );
    2314             : 
    2315           0 :     Color aLineColor(COL_LIGHTGRAY);
    2316           0 :     if(aLineColor == aBackColor)
    2317           0 :         aLineColor.Invert();
    2318           0 :     pVDev->SetLineColor(aLineColor);
    2319           0 :     pVDev->SetFillColor( aBackColor );
    2320           0 :     pVDev->DrawRect(aRect);
    2321             : 
    2322           0 :     if(pActNum)
    2323             :     {
    2324             :         sal_uInt16 nWidthRelation;
    2325           0 :         if(nPageWidth)
    2326             :         {
    2327           0 :             nWidthRelation = sal_uInt16 (nPageWidth / aSize.Width());
    2328           0 :             if(bPosition)
    2329           0 :                 nWidthRelation = nWidthRelation * 2 / 3;
    2330             :             else
    2331           0 :                 nWidthRelation = nWidthRelation / 4;
    2332             :         }
    2333             :         else
    2334           0 :             nWidthRelation = 30; // chapter dialog
    2335             : 
    2336             :         // height per level
    2337           0 :         sal_uInt16 nXStep = sal::static_int_cast< sal_uInt16 >(aSize.Width() / (3 * pActNum->GetLevelCount()));
    2338           0 :         if(pActNum->GetLevelCount() < 10)
    2339           0 :             nXStep /= 2;
    2340           0 :         sal_uInt16 nYStart = 4;
    2341             :         // the whole height mustn't be used for a single level
    2342           0 :         sal_uInt16 nYStep = sal::static_int_cast< sal_uInt16 >((aSize.Height() - 6)/ (pActNum->GetLevelCount() > 1 ? pActNum->GetLevelCount() : 5));
    2343           0 :         aStdFont = OutputDevice::GetDefaultFont(
    2344           0 :                 DEFAULTFONT_UI_SANS, MsLangId::getSystemLanguage(), DEFAULTFONT_FLAGS_ONLYONE);
    2345           0 :         aStdFont.SetColor(aTextColor);
    2346           0 :         aStdFont.SetFillColor(aBackColor);
    2347             : 
    2348           0 :         sal_uInt16 nFontHeight = nYStep * 6 / 10;
    2349           0 :         if(bPosition)
    2350           0 :             nFontHeight = nYStep * 15 / 10;
    2351           0 :         aStdFont.SetSize(Size( 0, nFontHeight ));
    2352             : 
    2353           0 :         SvxNodeNum aNum( (sal_uInt8)0 );
    2354           0 :         sal_uInt16 nPreNum = pActNum->GetLevel(0).GetStart();
    2355             : 
    2356           0 :         if(bPosition)
    2357             :         {
    2358           0 :             sal_uInt16 nLineHeight = nFontHeight * 8 / 7;
    2359           0 :             sal_uInt8 nStart = 0;
    2360           0 :             while( !(nActLevel & (1<<nStart)) )
    2361             :             {
    2362           0 :                 nStart++;
    2363             :             }
    2364           0 :             if(nStart)
    2365           0 :                 nStart--;
    2366           0 :             sal_uInt8 nEnd = std::min( (sal_uInt8)(nStart + 3), (sal_uInt8)pActNum->GetLevelCount() );
    2367           0 :             for( sal_uInt8 nLevel = nStart; nLevel < nEnd; ++nLevel )
    2368             :             {
    2369           0 :                 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
    2370           0 :                 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
    2371             : 
    2372           0 :                 sal_uInt16 nXStart( 0 );
    2373           0 :                 short nTextOffset( 0 );
    2374           0 :                 sal_uInt16 nNumberXPos( 0 );
    2375           0 :                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
    2376             :                 {
    2377           0 :                     nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
    2378           0 :                     nTextOffset = rFmt.GetCharTextDistance() / nWidthRelation;
    2379           0 :                     nNumberXPos = nXStart;
    2380           0 :                     sal_uInt16 nFirstLineOffset = (-rFmt.GetFirstLineOffset()) / nWidthRelation;
    2381             : 
    2382           0 :                     if(nFirstLineOffset <= nNumberXPos)
    2383           0 :                         nNumberXPos = nNumberXPos - nFirstLineOffset;
    2384             :                     else
    2385           0 :                         nNumberXPos = 0;
    2386             :                     // in draw this is valid
    2387           0 :                     if(nTextOffset < 0)
    2388           0 :                         nNumberXPos = nNumberXPos + nTextOffset;
    2389             :                 }
    2390           0 :                 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    2391             :                 {
    2392           0 :                     const long nTmpNumberXPos( ( rFmt.GetIndentAt() +
    2393           0 :                                                  rFmt.GetFirstLineIndent() ) /
    2394           0 :                                                nWidthRelation );
    2395           0 :                     if ( nTmpNumberXPos < 0 )
    2396             :                     {
    2397           0 :                         nNumberXPos = 0;
    2398             :                     }
    2399             :                     else
    2400             :                     {
    2401           0 :                         nNumberXPos = static_cast<sal_uInt16>( nTmpNumberXPos );
    2402             :                     }
    2403             :                 }
    2404             : 
    2405           0 :                 sal_uInt16 nBulletWidth = 0;
    2406           0 :                 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType() &(~LINK_TOKEN)))
    2407             :                 {
    2408           0 :                     nBulletWidth = rFmt.IsShowSymbol() ? lcl_DrawGraphic(pVDev, rFmt,
    2409             :                                         nNumberXPos,
    2410           0 :                                             nYStart, nWidthRelation) : 0;
    2411             :                 }
    2412           0 :                 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
    2413             :                 {
    2414           0 :                     nBulletWidth =  rFmt.IsShowSymbol() ?
    2415           0 :                      lcl_DrawBullet(pVDev, rFmt, nNumberXPos, nYStart, aStdFont.GetSize()) : 0;
    2416             :                 }
    2417             :                 else
    2418             :                 {
    2419           0 :                     pVDev->SetFont(aStdFont);
    2420           0 :                     aNum.SetLevel( nLevel );
    2421           0 :                     if(pActNum->IsContinuousNumbering())
    2422           0 :                         aNum.GetLevelVal()[nLevel] = nPreNum;
    2423           0 :                     String aText(pActNum->MakeNumString( aNum ));
    2424           0 :                     Font aSaveFont = pVDev->GetFont();
    2425           0 :                     Font aColorFont(aSaveFont);
    2426           0 :                     Color aTmpBulletColor = rFmt.GetBulletColor();
    2427           0 :                     if(aTmpBulletColor.GetColor() == COL_AUTO)
    2428           0 :                         aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
    2429           0 :                     else if(aTmpBulletColor == aBackColor)
    2430           0 :                         aTmpBulletColor.Invert();
    2431           0 :                     aColorFont.SetColor(aTmpBulletColor);
    2432           0 :                     pVDev->SetFont(aColorFont);
    2433           0 :                     pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
    2434           0 :                     pVDev->SetFont(aSaveFont);
    2435           0 :                     nBulletWidth = (sal_uInt16)pVDev->GetTextWidth(aText);
    2436           0 :                     nPreNum++;
    2437             :                 }
    2438           0 :                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT &&
    2439           0 :                      rFmt.GetLabelFollowedBy() == SvxNumberFormat::SPACE )
    2440             :                 {
    2441           0 :                     pVDev->SetFont(aStdFont);
    2442           0 :                     OUString aText(' ');
    2443           0 :                     pVDev->DrawText( Point(nNumberXPos, nYStart), aText );
    2444           0 :                     nBulletWidth = nBulletWidth + (sal_uInt16)pVDev->GetTextWidth(aText);
    2445             :                 }
    2446             : 
    2447           0 :                 sal_uInt16 nTextXPos( 0 );
    2448           0 :                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
    2449             :                 {
    2450           0 :                     nTextXPos = nXStart;
    2451           0 :                     if(nTextOffset < 0)
    2452           0 :                          nTextXPos = nTextXPos + nTextOffset;
    2453           0 :                     if(nNumberXPos + nBulletWidth + nTextOffset > nTextXPos )
    2454           0 :                         nTextXPos = nNumberXPos + nBulletWidth + nTextOffset;
    2455             :                 }
    2456           0 :                 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    2457             :                 {
    2458           0 :                     switch ( rFmt.GetLabelFollowedBy() )
    2459             :                     {
    2460             :                         case SvxNumberFormat::LISTTAB:
    2461             :                         {
    2462             :                             nTextXPos = static_cast<sal_uInt16>(
    2463           0 :                                             rFmt.GetListtabPos() / nWidthRelation );
    2464           0 :                             if ( nTextXPos < nNumberXPos + nBulletWidth )
    2465             :                             {
    2466           0 :                                 nTextXPos = nNumberXPos + nBulletWidth;
    2467             :                             }
    2468             :                         }
    2469           0 :                         break;
    2470             :                         case SvxNumberFormat::SPACE:
    2471             :                         case SvxNumberFormat::NOTHING:
    2472             :                         {
    2473           0 :                             nTextXPos = nNumberXPos + nBulletWidth;
    2474             :                         }
    2475           0 :                         break;
    2476             :                     }
    2477             : 
    2478           0 :                     nXStart = static_cast<sal_uInt16>( rFmt.GetIndentAt() / nWidthRelation );
    2479             :                 }
    2480             : 
    2481           0 :                 Rectangle aRect1(Point(nTextXPos, nYStart + nFontHeight / 2), Size(aSize.Width() / 2, 2));
    2482           0 :                 pVDev->SetFillColor( aBackColor );
    2483           0 :                 pVDev->DrawRect( aRect1 );
    2484             : 
    2485           0 :                 Rectangle aRect2(Point(nXStart, nYStart + nLineHeight + nFontHeight / 2 ), Size(aSize.Width() / 2, 2));
    2486           0 :                 pVDev->DrawRect( aRect2 );
    2487           0 :                 nYStart += 2 * nLineHeight;
    2488             :             }
    2489             :         }
    2490             :         else
    2491             :         {
    2492             :             //#i5153# painting gray or black rectangles as 'normal' numbering text
    2493           0 :             OUString sMsg( "Preview" );
    2494           0 :             long nWidth = pVDev->GetTextWidth(sMsg);
    2495           0 :             long nTextHeight = pVDev->GetTextHeight();
    2496           0 :             long nRectHeight = nTextHeight * 2 / 3;
    2497           0 :             long nTopOffset = nTextHeight - nRectHeight;
    2498           0 :             Color aBlackColor(COL_BLACK);
    2499           0 :             if(aBlackColor == aBackColor)
    2500           0 :                 aBlackColor.Invert();
    2501             : 
    2502           0 :             for( sal_uInt8 nLevel = 0; nLevel < pActNum->GetLevelCount();
    2503             :                             ++nLevel, nYStart = nYStart + nYStep )
    2504             :             {
    2505           0 :                 const SvxNumberFormat &rFmt = pActNum->GetLevel(nLevel);
    2506           0 :                 aNum.GetLevelVal()[ nLevel ] = rFmt.GetStart();
    2507           0 :                 sal_uInt16 nXStart( 0 );
    2508           0 :                 if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
    2509             :                 {
    2510           0 :                     nXStart = rFmt.GetAbsLSpace() / nWidthRelation;
    2511             :                 }
    2512           0 :                 else if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    2513             :                 {
    2514           0 :                     const long nTmpXStart( ( rFmt.GetIndentAt() +
    2515           0 :                                              rFmt.GetFirstLineIndent() ) /
    2516           0 :                                            nWidthRelation );
    2517           0 :                     if ( nTmpXStart < 0 )
    2518             :                     {
    2519           0 :                         nXStart = 0;
    2520             :                     }
    2521             :                     else
    2522             :                     {
    2523           0 :                         nXStart = static_cast<sal_uInt16>(nTmpXStart);
    2524             :                     }
    2525             :                 }
    2526           0 :                 nXStart /= 2;
    2527           0 :                 nXStart += 2;
    2528           0 :                 sal_uInt16 nTextOffset = 2 * nXStep;
    2529           0 :                 if( SVX_NUM_BITMAP == (rFmt.GetNumberingType()&(~LINK_TOKEN)) )
    2530             :                 {
    2531           0 :                     if(rFmt.IsShowSymbol())
    2532             :                     {
    2533           0 :                         nTextOffset = lcl_DrawGraphic(pVDev, rFmt, nXStart, nYStart, nWidthRelation);
    2534           0 :                         nTextOffset = nTextOffset + nXStep;
    2535             :                     }
    2536             :                 }
    2537           0 :                 else if( SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType() )
    2538             :                 {
    2539           0 :                     if(rFmt.IsShowSymbol())
    2540             :                     {
    2541           0 :                         nTextOffset =  lcl_DrawBullet(pVDev, rFmt, nXStart, nYStart, aStdFont.GetSize());
    2542           0 :                         nTextOffset = nTextOffset + nXStep;
    2543             :                     }
    2544             :                 }
    2545             :                 else
    2546             :                 {
    2547           0 :                     Font aColorFont(aStdFont);
    2548           0 :                     Color aTmpBulletColor = rFmt.GetBulletColor();
    2549           0 :                     if(aTmpBulletColor.GetColor() == COL_AUTO)
    2550           0 :                         aTmpBulletColor = Color(aBackColor.IsDark() ? COL_WHITE : COL_BLACK);
    2551           0 :                     else if(aTmpBulletColor == aBackColor)
    2552           0 :                         aTmpBulletColor.Invert();
    2553           0 :                     aColorFont.SetColor(aTmpBulletColor);
    2554           0 :                     pVDev->SetFont(aColorFont);
    2555           0 :                     aNum.SetLevel( nLevel );
    2556           0 :                     if(pActNum->IsContinuousNumbering())
    2557           0 :                         aNum.GetLevelVal()[nLevel] = nPreNum;
    2558           0 :                     String aText(pActNum->MakeNumString( aNum ));
    2559           0 :                     pVDev->DrawText( Point(nXStart, nYStart), aText );
    2560           0 :                     pVDev->SetFont(aStdFont);
    2561           0 :                     nTextOffset = (sal_uInt16)pVDev->GetTextWidth(aText);
    2562           0 :                     nTextOffset = nTextOffset + nXStep;
    2563           0 :                     nPreNum++;
    2564             :                 }
    2565           0 :                 if(pOutlineNames)
    2566             :                 {
    2567             :                     //#i5153# outline numberings still use the style names as text
    2568           0 :                     pVDev->SetFont(aStdFont);
    2569           0 :                     sMsg = pOutlineNames[nLevel];
    2570           0 :                     pVDev->DrawText( Point(nXStart + nTextOffset, nYStart), sMsg );
    2571             :                 }
    2572             :                 else
    2573             :                 {
    2574             :                     //#i5153# the selected rectangle(s) should be black
    2575           0 :                     if( 0 != (nActLevel & (1<<nLevel)))
    2576             :                     {
    2577           0 :                         pVDev->SetFillColor( aBlackColor );
    2578           0 :                         pVDev->SetLineColor( aBlackColor );
    2579             :                     }
    2580             :                     else
    2581             :                     {
    2582             :                         //#i5153# unselected levels are gray
    2583           0 :                         pVDev->SetFillColor( aLineColor );
    2584           0 :                         pVDev->SetLineColor( aLineColor );
    2585             :                     }
    2586           0 :                     Rectangle aRect1(Point(nXStart + nTextOffset, nYStart + nTopOffset), Size(nWidth, nRectHeight));
    2587           0 :                     pVDev->DrawRect(aRect1);
    2588             :                 }
    2589           0 :             }
    2590             :         }
    2591             :     }
    2592             :     DrawOutDev( Point(0,0), aSize,
    2593             :                 Point(0,0), aSize,
    2594           0 :                         *pVDev );
    2595           0 :     delete pVDev;
    2596             : 
    2597           0 : }
    2598             : 
    2599             : //See uiconfig/swriter/ui/outlinepositionpage.ui for effectively a duplicate
    2600             : //dialog to this one, except with a different preview window impl.
    2601             : //TODO, determine if SwNumPositionTabPage and SvxNumPositionTabPage can be
    2602             : //merged
    2603           0 : SvxNumPositionTabPage::SvxNumPositionTabPage(Window* pParent,
    2604             :                                const SfxItemSet& rSet)
    2605             :     : SfxTabPage(pParent, "NumberingPositionPage", "cui/ui/numberingpositionpage.ui", rSet)
    2606             :     , pActNum(0)
    2607             :     , pSaveNum(0)
    2608             :     , nActNumLvl(USHRT_MAX)
    2609             :     , nNumItemId(SID_ATTR_NUMBERING_RULE)
    2610             :     , bModified(false)
    2611             :     , bPreset(false)
    2612             :     , bInInintControl(false)
    2613           0 :     , bLabelAlignmentPosAndSpaceModeActive(false)
    2614             : {
    2615           0 :     SetExchangeSupport();
    2616             : 
    2617           0 :     get(m_pLevelLB, "levellb");
    2618           0 :     get(m_pDistBorderFT, "indent");
    2619           0 :     get(m_pDistBorderMF, "indentmf");
    2620           0 :     get(m_pRelativeCB, "relative");
    2621           0 :     get(m_pIndentFT, "numberingwidth");
    2622           0 :     get(m_pIndentMF, "numberingwidthmf");
    2623           0 :     get(m_pDistNumFT, "numdist");
    2624           0 :     get(m_pDistNumMF, "numdistmf");
    2625           0 :     get(m_pAlignFT, "numalign");
    2626           0 :     get(m_pAlignLB, "numalignlb");
    2627             : 
    2628           0 :     get(m_pLabelFollowedByFT, "numfollowedby");
    2629           0 :     get(m_pLabelFollowedByLB, "numfollowedbylb");
    2630           0 :     get(m_pListtabFT, "at");
    2631           0 :     get(m_pListtabMF, "atmf");
    2632           0 :     get(m_pAlign2FT, "num2align");
    2633           0 :     get(m_pAlign2LB, "num2alignlb");
    2634           0 :     get(m_pAlignedAtFT, "alignedat");
    2635           0 :     get(m_pAlignedAtMF, "alignedatmf");
    2636           0 :     get(m_pIndentAtFT, "indentat");
    2637           0 :     get(m_pIndentAtMF, "indentatmf");
    2638             : 
    2639           0 :     get(m_pStandardPB, "standard");
    2640           0 :     get(m_pPreviewWIN, "preview");
    2641             : 
    2642           0 :     m_pPreviewWIN->SetBackground(Wallpaper(Color(COL_TRANSPARENT)));
    2643             : 
    2644           0 :     m_pRelativeCB->Check();
    2645           0 :     m_pAlignLB->SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
    2646           0 :     m_pAlign2LB->SetSelectHdl(LINK(this, SvxNumPositionTabPage, EditModifyHdl_Impl));
    2647           0 :     for ( sal_uInt16 i = 0; i < m_pAlignLB->GetEntryCount(); ++i )
    2648             :     {
    2649           0 :         m_pAlign2LB->InsertEntry( m_pAlignLB->GetEntry( i ) );
    2650             :     }
    2651           0 :     m_pAlign2LB->SetDropDownLineCount( m_pAlign2LB->GetEntryCount() );
    2652             : 
    2653           0 :     Link aLk = LINK(this, SvxNumPositionTabPage, DistanceHdl_Impl);
    2654             : 
    2655           0 :     m_pDistBorderMF->SetUpHdl(aLk);
    2656           0 :     m_pDistBorderMF->SetDownHdl(aLk);
    2657           0 :     m_pDistBorderMF->SetLoseFocusHdl(aLk);
    2658             : 
    2659           0 :     m_pDistNumMF->SetUpHdl(aLk);
    2660           0 :     m_pDistNumMF->SetDownHdl(aLk);
    2661           0 :     m_pDistNumMF->SetLoseFocusHdl(aLk);
    2662             : 
    2663           0 :     m_pIndentMF->SetUpHdl(aLk);
    2664           0 :     m_pIndentMF->SetDownHdl(aLk);
    2665           0 :     m_pIndentMF->SetLoseFocusHdl(aLk);
    2666             : 
    2667           0 :     m_pLabelFollowedByLB->SetDropDownLineCount( m_pLabelFollowedByLB->GetEntryCount() );
    2668           0 :     m_pLabelFollowedByLB->SetSelectHdl( LINK(this, SvxNumPositionTabPage, LabelFollowedByHdl_Impl) );
    2669             : 
    2670           0 :     aLk = LINK(this, SvxNumPositionTabPage, ListtabPosHdl_Impl);
    2671           0 :     m_pListtabMF->SetUpHdl(aLk);
    2672           0 :     m_pListtabMF->SetDownHdl(aLk);
    2673           0 :     m_pListtabMF->SetLoseFocusHdl(aLk);
    2674             : 
    2675           0 :     aLk = LINK(this, SvxNumPositionTabPage, AlignAtHdl_Impl);
    2676           0 :     m_pAlignedAtMF->SetUpHdl(aLk);
    2677           0 :     m_pAlignedAtMF->SetDownHdl(aLk);
    2678           0 :     m_pAlignedAtMF->SetLoseFocusHdl(aLk);
    2679             : 
    2680           0 :     aLk = LINK(this, SvxNumPositionTabPage, IndentAtHdl_Impl);
    2681           0 :     m_pIndentAtMF->SetUpHdl(aLk);
    2682           0 :     m_pIndentAtMF->SetDownHdl(aLk);
    2683           0 :     m_pIndentAtMF->SetLoseFocusHdl(aLk);
    2684             : 
    2685           0 :     m_pLevelLB->EnableMultiSelection(true);
    2686           0 :     m_pLevelLB->SetSelectHdl(LINK(this, SvxNumPositionTabPage, LevelHdl_Impl));
    2687           0 :     m_pRelativeCB->SetClickHdl(LINK(this, SvxNumPositionTabPage, RelativeHdl_Impl));
    2688           0 :     m_pStandardPB->SetClickHdl(LINK(this, SvxNumPositionTabPage, StandardHdl_Impl));
    2689             : 
    2690             : 
    2691           0 :     m_pRelativeCB->Check(bLastRelative);
    2692           0 :     m_pPreviewWIN->SetPositionMode();
    2693           0 :     eCoreUnit = rSet.GetPool()->GetMetric(rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));
    2694           0 : }
    2695             : 
    2696           0 : SvxNumPositionTabPage::~SvxNumPositionTabPage()
    2697             : {
    2698           0 :     delete pActNum;
    2699           0 :     delete pSaveNum;
    2700           0 : }
    2701             : /*-------------------------------------------------------*/
    2702             : 
    2703             : #if OSL_DEBUG_LEVEL > 1
    2704             : void lcl_PrintDebugOutput(FixedText& rFixed, const SvxNumberFormat& rNumFmt)
    2705             : {
    2706             : #define TWIP_TO_MM100(TWIP)     ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
    2707             : 
    2708             :     OUString const sHash( " # " );
    2709             :     if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
    2710             :     {
    2711             :         OUString sDebugText( OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetAbsLSpace() ) ) );
    2712             :         sDebugText += sHash;
    2713             :         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetCharTextDistance() ) );
    2714             :         sDebugText += sHash;
    2715             :         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetFirstLineOffset() ) );
    2716             :         rFixed.SetText(sDebugText);
    2717             :     }
    2718             :     else if ( rNumFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    2719             :     {
    2720             :         String sDebugText( OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetListtabPos() ) ) );
    2721             :         sDebugText += sHash;
    2722             :         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetFirstLineIndent() ) );
    2723             :         sDebugText += sHash;
    2724             :         sDebugText += OUString::valueOf( TWIP_TO_MM100(rNumFmt.GetIndentAt() ) );
    2725             :         rFixed.SetText(sDebugText);
    2726             :     }
    2727             : 
    2728             : }
    2729             : #endif
    2730             : 
    2731           0 : void SvxNumPositionTabPage::InitControls()
    2732             : {
    2733           0 :     bInInintControl = sal_True;
    2734           0 :     const bool bRelative = !bLabelAlignmentPosAndSpaceModeActive &&
    2735           0 :                      m_pRelativeCB->IsEnabled() && m_pRelativeCB->IsChecked();
    2736           0 :     const bool bSingleSelection = m_pLevelLB->GetSelectEntryCount() == 1 &&
    2737           0 :                             USHRT_MAX != nActNumLvl;
    2738             : 
    2739           0 :     m_pDistBorderMF->Enable( !bLabelAlignmentPosAndSpaceModeActive &&
    2740           0 :                           ( bSingleSelection || bRelative ) );
    2741           0 :     m_pDistBorderFT->Enable( !bLabelAlignmentPosAndSpaceModeActive &&
    2742           0 :                           ( bSingleSelection || bRelative ) );
    2743             : 
    2744           0 :     bool bSetDistEmpty = false;
    2745           0 :     bool bSameDistBorderNum = !bLabelAlignmentPosAndSpaceModeActive;
    2746           0 :     bool bSameDist      = !bLabelAlignmentPosAndSpaceModeActive;
    2747           0 :     bool bSameIndent    = !bLabelAlignmentPosAndSpaceModeActive;
    2748           0 :     bool bSameAdjust    = true;
    2749             : 
    2750           0 :     bool bSameLabelFollowedBy = bLabelAlignmentPosAndSpaceModeActive;
    2751           0 :     bool bSameListtab = bLabelAlignmentPosAndSpaceModeActive;
    2752           0 :     bool bSameAlignAt = bLabelAlignmentPosAndSpaceModeActive;
    2753           0 :     bool bSameIndentAt = bLabelAlignmentPosAndSpaceModeActive;
    2754             : 
    2755             :     const SvxNumberFormat* aNumFmtArr[SVX_MAX_NUM];
    2756           0 :     sal_uInt16 nMask = 1;
    2757           0 :     sal_uInt16 nLvl = USHRT_MAX;
    2758           0 :     long nFirstBorderTextRelative = -1;
    2759           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2760             :     {
    2761           0 :         aNumFmtArr[i] = &pActNum->GetLevel(i);
    2762           0 :         if(nActNumLvl & nMask)
    2763             :         {
    2764           0 :             if(USHRT_MAX == nLvl)
    2765           0 :                 nLvl = i;
    2766             : 
    2767           0 :             if( i > nLvl)
    2768             :             {
    2769           0 :                 bSameAdjust &= aNumFmtArr[i]->GetNumAdjust() == aNumFmtArr[nLvl]->GetNumAdjust();
    2770           0 :                 if ( !bLabelAlignmentPosAndSpaceModeActive )
    2771             :                 {
    2772           0 :                     if(bRelative)
    2773             :                     {
    2774           0 :                         if(nFirstBorderTextRelative == -1)
    2775             :                             nFirstBorderTextRelative =
    2776           0 :                             (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
    2777           0 :                             aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
    2778             :                         else
    2779           0 :                             bSameDistBorderNum &= nFirstBorderTextRelative ==
    2780           0 :                             (aNumFmtArr[i]->GetAbsLSpace() + aNumFmtArr[i]->GetFirstLineOffset() -
    2781           0 :                             aNumFmtArr[i - 1]->GetAbsLSpace() + aNumFmtArr[i - 1]->GetFirstLineOffset());
    2782             :                     }
    2783             :                     else
    2784             :                         bSameDistBorderNum &=
    2785           0 :                         aNumFmtArr[i]->GetAbsLSpace() - aNumFmtArr[i]->GetFirstLineOffset() ==
    2786           0 :                         aNumFmtArr[i - 1]->GetAbsLSpace() - aNumFmtArr[i - 1]->GetFirstLineOffset();
    2787             : 
    2788           0 :                     bSameDist       &= aNumFmtArr[i]->GetCharTextDistance() == aNumFmtArr[nLvl]->GetCharTextDistance();
    2789           0 :                     bSameIndent     &= aNumFmtArr[i]->GetFirstLineOffset() == aNumFmtArr[nLvl]->GetFirstLineOffset();
    2790             :                 }
    2791             :                 else
    2792             :                 {
    2793             :                     bSameLabelFollowedBy &=
    2794           0 :                         aNumFmtArr[i]->GetLabelFollowedBy() == aNumFmtArr[nLvl]->GetLabelFollowedBy();
    2795             :                     bSameListtab &=
    2796           0 :                         aNumFmtArr[i]->GetListtabPos() == aNumFmtArr[nLvl]->GetListtabPos();
    2797             :                     bSameAlignAt &=
    2798           0 :                         ( ( aNumFmtArr[i]->GetIndentAt() + aNumFmtArr[i]->GetFirstLineIndent() )
    2799           0 :                             == ( aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent() ) );
    2800             :                     bSameIndentAt &=
    2801           0 :                         aNumFmtArr[i]->GetIndentAt() == aNumFmtArr[nLvl]->GetIndentAt();
    2802             :                 }
    2803             :             }
    2804             :         }
    2805           0 :         nMask <<= 1;
    2806             : 
    2807             :     }
    2808           0 :     if (SVX_MAX_NUM <= nLvl)
    2809             :     {
    2810             :         OSL_ENSURE(false, "cannot happen.");
    2811           0 :         return;
    2812             :     }
    2813             : 
    2814           0 :     if(bSameDistBorderNum)
    2815             :     {
    2816             :         long nDistBorderNum;
    2817           0 :         if(bRelative)
    2818             :         {
    2819           0 :             nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
    2820           0 :             if(nLvl)
    2821           0 :                 nDistBorderNum -= (long)aNumFmtArr[nLvl - 1]->GetAbsLSpace()+ aNumFmtArr[nLvl - 1]->GetFirstLineOffset();
    2822             :         }
    2823             :         else
    2824             :         {
    2825           0 :             nDistBorderNum = (long)aNumFmtArr[nLvl]->GetAbsLSpace()+ aNumFmtArr[nLvl]->GetFirstLineOffset();
    2826             :         }
    2827           0 :         SetMetricValue(*m_pDistBorderMF, nDistBorderNum, eCoreUnit);
    2828             :     }
    2829             :     else
    2830           0 :         bSetDistEmpty = true;
    2831             : 
    2832           0 :     const String aEmptyStr;
    2833           0 :     if(bSameDist)
    2834           0 :         SetMetricValue(*m_pDistNumMF, aNumFmtArr[nLvl]->GetCharTextDistance(), eCoreUnit);
    2835             :     else
    2836           0 :         m_pDistNumMF->SetText(aEmptyStr);
    2837           0 :     if(bSameIndent)
    2838           0 :         SetMetricValue(*m_pIndentMF, - aNumFmtArr[nLvl]->GetFirstLineOffset(), eCoreUnit);
    2839             :     else
    2840           0 :         m_pIndentMF->SetText(aEmptyStr);
    2841             : 
    2842           0 :     if(bSameAdjust)
    2843             :     {
    2844           0 :         sal_uInt16 nPos = 1; // centered
    2845           0 :         if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_LEFT)
    2846           0 :             nPos = 0;
    2847           0 :         else if(aNumFmtArr[nLvl]->GetNumAdjust() == SVX_ADJUST_RIGHT)
    2848           0 :             nPos = 2;
    2849           0 :         m_pAlignLB->SelectEntryPos(nPos);
    2850           0 :         m_pAlign2LB->SelectEntryPos( nPos );
    2851             :     }
    2852             :     else
    2853             :     {
    2854           0 :         m_pAlignLB->SetNoSelection();
    2855           0 :         m_pAlign2LB->SetNoSelection();
    2856             :     }
    2857             : 
    2858           0 :     if ( bSameLabelFollowedBy )
    2859             :     {
    2860           0 :         sal_uInt16 nPos = 0; // LISTTAB
    2861           0 :         if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::SPACE )
    2862             :         {
    2863           0 :             nPos = 1;
    2864             :         }
    2865           0 :         else if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::NOTHING )
    2866             :         {
    2867           0 :             nPos = 2;
    2868             :         }
    2869           0 :         m_pLabelFollowedByLB->SelectEntryPos( nPos );
    2870             :     }
    2871             :     else
    2872             :     {
    2873           0 :         m_pLabelFollowedByLB->SetNoSelection();
    2874             :     }
    2875             : 
    2876           0 :     if ( aNumFmtArr[nLvl]->GetLabelFollowedBy() == SvxNumberFormat::LISTTAB )
    2877             :     {
    2878           0 :         m_pListtabFT->Enable( true );
    2879           0 :         m_pListtabMF->Enable( true );
    2880           0 :         if ( bSameListtab )
    2881             :         {
    2882           0 :             SetMetricValue(*m_pListtabMF, aNumFmtArr[nLvl]->GetListtabPos(), eCoreUnit);
    2883             :         }
    2884             :         else
    2885             :         {
    2886           0 :             m_pListtabMF->SetText(aEmptyStr);
    2887             :         }
    2888             :     }
    2889             :     else
    2890             :     {
    2891           0 :         m_pListtabFT->Enable( false );
    2892           0 :         m_pListtabMF->Enable( false );
    2893           0 :         m_pListtabMF->SetText(aEmptyStr);
    2894             :     }
    2895             : 
    2896           0 :     if ( bSameAlignAt )
    2897             :     {
    2898             :         SetMetricValue(*m_pAlignedAtMF,
    2899           0 :                         aNumFmtArr[nLvl]->GetIndentAt() + aNumFmtArr[nLvl]->GetFirstLineIndent(),
    2900           0 :                         eCoreUnit);
    2901             :     }
    2902             :     else
    2903             :     {
    2904           0 :         m_pAlignedAtMF->SetText(aEmptyStr);
    2905             :     }
    2906             : 
    2907           0 :     if ( bSameIndentAt )
    2908             :     {
    2909           0 :         SetMetricValue(*m_pIndentAtMF, aNumFmtArr[nLvl]->GetIndentAt(), eCoreUnit);
    2910             :     }
    2911             :     else
    2912             :     {
    2913           0 :         m_pIndentAtMF->SetText(aEmptyStr);
    2914             :     }
    2915             : 
    2916           0 :     if ( bSetDistEmpty )
    2917           0 :         m_pDistBorderMF->SetText(aEmptyStr);
    2918             : 
    2919           0 :     bInInintControl = sal_False;
    2920             : }
    2921             : 
    2922           0 : void SvxNumPositionTabPage::ActivatePage(const SfxItemSet& rSet)
    2923             : {
    2924             :     const SfxPoolItem* pItem;
    2925           0 :     sal_uInt16 nTmpNumLvl = USHRT_MAX;
    2926           0 :     const SfxItemSet* pExampleSet = GetTabDialog()->GetExampleSet();
    2927           0 :     if(pExampleSet)
    2928             :     {
    2929           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_NUM_PRESET, sal_False, &pItem))
    2930           0 :             bPreset = ((const SfxBoolItem*)pItem)->GetValue();
    2931           0 :         if(SFX_ITEM_SET == pExampleSet->GetItemState(SID_PARAM_CUR_NUM_LEVEL, sal_False, &pItem))
    2932           0 :             nTmpNumLvl = ((const SfxUInt16Item*)pItem)->GetValue();
    2933             :     }
    2934           0 :     if(SFX_ITEM_SET == rSet.GetItemState(nNumItemId, sal_False, &pItem))
    2935             :     {
    2936           0 :         delete pSaveNum;
    2937           0 :         pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
    2938             :     }
    2939           0 :     bModified = (!pActNum->Get( 0 ) || bPreset);
    2940           0 :     if(*pSaveNum != *pActNum ||
    2941           0 :         nActNumLvl != nTmpNumLvl )
    2942             :     {
    2943           0 :         *pActNum = *pSaveNum;
    2944           0 :         nActNumLvl = nTmpNumLvl;
    2945           0 :         sal_uInt16 nMask = 1;
    2946           0 :         m_pLevelLB->SetUpdateMode(false);
    2947           0 :         m_pLevelLB->SetNoSelection();
    2948           0 :         m_pLevelLB->SelectEntryPos( pActNum->GetLevelCount(), nActNumLvl == USHRT_MAX);
    2949           0 :         if(nActNumLvl != USHRT_MAX)
    2950           0 :             for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    2951             :             {
    2952           0 :                 if(nActNumLvl & nMask)
    2953           0 :                     m_pLevelLB->SelectEntryPos( i, sal_True);
    2954           0 :                 nMask <<= 1 ;
    2955             :             }
    2956           0 :         m_pRelativeCB->Enable(nActNumLvl != 1);
    2957           0 :         m_pLevelLB->SetUpdateMode(sal_True);
    2958             : 
    2959           0 :         InitPosAndSpaceMode();
    2960           0 :         ShowControlsDependingOnPosAndSpaceMode();
    2961             : 
    2962           0 :         InitControls();
    2963             :     }
    2964           0 :     m_pPreviewWIN->SetLevel(nActNumLvl);
    2965           0 :     m_pPreviewWIN->Invalidate();
    2966           0 : }
    2967             : 
    2968           0 : int  SvxNumPositionTabPage::DeactivatePage(SfxItemSet *_pSet)
    2969             : {
    2970           0 :     if(_pSet)
    2971             :     {
    2972           0 :         if(m_pDistBorderMF->IsEnabled())
    2973           0 :             DistanceHdl_Impl(m_pDistBorderMF);
    2974           0 :         DistanceHdl_Impl(m_pIndentMF);
    2975           0 :         FillItemSet(*_pSet);
    2976             :     }
    2977           0 :     return sal_True;
    2978             : }
    2979             : 
    2980           0 : sal_Bool SvxNumPositionTabPage::FillItemSet( SfxItemSet& rSet )
    2981             : {
    2982           0 :     rSet.Put(SfxUInt16Item(SID_PARAM_CUR_NUM_LEVEL, nActNumLvl));
    2983             : 
    2984           0 :     if(bModified && pActNum)
    2985             :     {
    2986           0 :         *pSaveNum = *pActNum;
    2987           0 :         rSet.Put(SvxNumBulletItem( *pSaveNum ), nNumItemId);
    2988           0 :         rSet.Put(SfxBoolItem(SID_PARAM_NUM_PRESET, sal_False));
    2989             :     }
    2990           0 :     return bModified;
    2991             : }
    2992             : 
    2993           0 : void SvxNumPositionTabPage::Reset( const SfxItemSet& rSet )
    2994             : {
    2995             :     const SfxPoolItem* pItem;
    2996             :     // in Draw the item exists as WhichId, in Writer only as SlotId
    2997           0 :     SfxItemState eState = rSet.GetItemState(SID_ATTR_NUMBERING_RULE, sal_False, &pItem);
    2998           0 :     if(eState != SFX_ITEM_SET)
    2999             :     {
    3000           0 :         nNumItemId = rSet.GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE);
    3001           0 :         eState = rSet.GetItemState(nNumItemId, sal_False, &pItem);
    3002             : 
    3003           0 :         if( eState != SFX_ITEM_SET )
    3004             :         {
    3005           0 :             pItem = &static_cast< const SvxNumBulletItem& >( rSet.Get( nNumItemId, sal_True ) );
    3006           0 :             eState = SFX_ITEM_SET;
    3007             :         }
    3008             : 
    3009             :     }
    3010             :     DBG_ASSERT(eState == SFX_ITEM_SET, "kein Item gefunden!");
    3011           0 :     delete pSaveNum;
    3012           0 :     pSaveNum = new SvxNumRule(*((SvxNumBulletItem*)pItem)->GetNumRule());
    3013             : 
    3014             :     // insert levels
    3015           0 :     if(!m_pLevelLB->GetEntryCount())
    3016             :     {
    3017           0 :         for(sal_uInt16 i = 1; i <= pSaveNum->GetLevelCount(); i++)
    3018           0 :             m_pLevelLB->InsertEntry( OUString::number(i) );
    3019           0 :         if(pSaveNum->GetLevelCount() > 1)
    3020             :         {
    3021           0 :             OUString sEntry( "1 - " );
    3022           0 :             sEntry += OUString::valueOf( static_cast<sal_Int32>(pSaveNum->GetLevelCount()) );
    3023           0 :             m_pLevelLB->InsertEntry(sEntry);
    3024           0 :             m_pLevelLB->SelectEntry(sEntry);
    3025             :         }
    3026             :         else
    3027           0 :             m_pLevelLB->SelectEntryPos(0);
    3028             :     }
    3029             :     else
    3030           0 :         m_pLevelLB->SelectEntryPos(m_pLevelLB->GetEntryCount() - 1);
    3031           0 :     sal_uInt16 nMask = 1;
    3032           0 :     m_pLevelLB->SetUpdateMode(sal_False);
    3033           0 :     m_pLevelLB->SetNoSelection();
    3034           0 :     if(nActNumLvl == USHRT_MAX)
    3035             :     {
    3036           0 :         m_pLevelLB->SelectEntryPos( pSaveNum->GetLevelCount(), sal_True);
    3037             :     }
    3038             :     else
    3039             :     {
    3040           0 :         for(sal_uInt16 i = 0; i < pSaveNum->GetLevelCount(); i++)
    3041             :         {
    3042           0 :             if(nActNumLvl & nMask)
    3043           0 :                 m_pLevelLB->SelectEntryPos( i, sal_True);
    3044           0 :             nMask <<= 1;
    3045             :         }
    3046             :     }
    3047           0 :     m_pLevelLB->SetUpdateMode(sal_True);
    3048             : 
    3049           0 :     if(!pActNum)
    3050           0 :         pActNum = new  SvxNumRule(*pSaveNum);
    3051           0 :     else if(*pSaveNum != *pActNum)
    3052           0 :         *pActNum = *pSaveNum;
    3053           0 :     m_pPreviewWIN->SetNumRule(pActNum);
    3054             : 
    3055           0 :     InitPosAndSpaceMode();
    3056           0 :     ShowControlsDependingOnPosAndSpaceMode();
    3057             : 
    3058           0 :     InitControls();
    3059           0 :     bModified = sal_False;
    3060           0 : }
    3061             : 
    3062           0 : void SvxNumPositionTabPage::InitPosAndSpaceMode()
    3063             : {
    3064           0 :     if ( pActNum == 0 )
    3065             :     {
    3066             :         DBG_ASSERT( false,
    3067             :                 "<SvxNumPositionTabPage::InitPosAndSpaceMode()> - misusage of method -> <pAktNum> has to be already set!" );
    3068           0 :         return;
    3069             :     }
    3070             : 
    3071             :     SvxNumberFormat::SvxNumPositionAndSpaceMode ePosAndSpaceMode =
    3072           0 :                                             SvxNumberFormat::LABEL_ALIGNMENT;
    3073           0 :     sal_uInt16 nMask = 1;
    3074           0 :     for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
    3075             :     {
    3076           0 :         if(nActNumLvl & nMask)
    3077             :         {
    3078           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
    3079           0 :             ePosAndSpaceMode = aNumFmt.GetPositionAndSpaceMode();
    3080           0 :             if ( ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT )
    3081             :             {
    3082           0 :                 break;
    3083           0 :             }
    3084             :         }
    3085           0 :         nMask <<= 1;
    3086             :     }
    3087             : 
    3088             :     bLabelAlignmentPosAndSpaceModeActive =
    3089           0 :                     ePosAndSpaceMode == SvxNumberFormat::LABEL_ALIGNMENT;
    3090             : }
    3091             : 
    3092           0 : void SvxNumPositionTabPage::ShowControlsDependingOnPosAndSpaceMode()
    3093             : {
    3094           0 :     m_pDistBorderFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3095           0 :     m_pDistBorderMF->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3096           0 :     m_pRelativeCB->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3097           0 :     m_pIndentFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3098           0 :     m_pIndentMF->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3099           0 :     m_pDistNumFT->Show( !bLabelAlignmentPosAndSpaceModeActive &&
    3100           0 :                      pActNum->IsFeatureSupported(NUM_CONTINUOUS) );
    3101           0 :     m_pDistNumMF->Show( !bLabelAlignmentPosAndSpaceModeActive &&
    3102           0 :                      pActNum->IsFeatureSupported(NUM_CONTINUOUS));
    3103           0 :     m_pAlignFT->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3104           0 :     m_pAlignLB->Show( !bLabelAlignmentPosAndSpaceModeActive );
    3105             : 
    3106           0 :     m_pLabelFollowedByFT->Show( bLabelAlignmentPosAndSpaceModeActive );
    3107           0 :     m_pLabelFollowedByLB->Show( bLabelAlignmentPosAndSpaceModeActive );
    3108           0 :     m_pListtabFT->Show( bLabelAlignmentPosAndSpaceModeActive );
    3109           0 :     m_pListtabMF->Show( bLabelAlignmentPosAndSpaceModeActive );
    3110           0 :     m_pAlign2FT->Show( bLabelAlignmentPosAndSpaceModeActive );
    3111           0 :     m_pAlign2LB->Show( bLabelAlignmentPosAndSpaceModeActive );
    3112           0 :     m_pAlignedAtFT->Show( bLabelAlignmentPosAndSpaceModeActive );
    3113           0 :     m_pAlignedAtMF->Show( bLabelAlignmentPosAndSpaceModeActive );
    3114           0 :     m_pIndentAtFT->Show( bLabelAlignmentPosAndSpaceModeActive );
    3115           0 :     m_pIndentAtMF->Show( bLabelAlignmentPosAndSpaceModeActive );
    3116           0 : }
    3117             : 
    3118           0 : SfxTabPage* SvxNumPositionTabPage::Create( Window* pParent,
    3119             :                                 const SfxItemSet& rAttrSet)
    3120             : {
    3121           0 :     return new SvxNumPositionTabPage(pParent, rAttrSet);
    3122             : }
    3123             : 
    3124           0 : void    SvxNumPositionTabPage::SetMetric(FieldUnit eMetric)
    3125             : {
    3126           0 :     if(eMetric == FUNIT_MM)
    3127             :     {
    3128           0 :         m_pDistBorderMF->SetDecimalDigits(1);
    3129           0 :         m_pDistNumMF->SetDecimalDigits(1);
    3130           0 :         m_pIndentMF->SetDecimalDigits(1);
    3131           0 :         m_pListtabMF->SetDecimalDigits(1);
    3132           0 :         m_pAlignedAtMF->SetDecimalDigits(1);
    3133           0 :         m_pIndentAtMF->SetDecimalDigits(1);
    3134             :     }
    3135           0 :     m_pDistBorderMF->SetUnit( eMetric );
    3136           0 :     m_pDistNumMF->SetUnit( eMetric );
    3137           0 :     m_pIndentMF->SetUnit( eMetric );
    3138           0 :     m_pListtabMF->SetUnit( eMetric );
    3139           0 :     m_pAlignedAtMF->SetUnit( eMetric );
    3140           0 :     m_pIndentAtMF->SetUnit( eMetric );
    3141           0 : }
    3142             : 
    3143           0 : IMPL_LINK_NOARG(SvxNumPositionTabPage, EditModifyHdl_Impl)
    3144             : {
    3145           0 :     sal_uInt16 nMask = 1;
    3146           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    3147             :     {
    3148           0 :         if(nActNumLvl & nMask)
    3149             :         {
    3150           0 :             SvxNumberFormat aNumFmt(pActNum->GetLevel(i));
    3151             : 
    3152           0 :             const sal_uInt16 nPos = m_pAlignLB->IsVisible()
    3153           0 :                                 ? m_pAlignLB->GetSelectEntryPos()
    3154           0 :                                 : m_pAlign2LB->GetSelectEntryPos();
    3155           0 :             SvxAdjust eAdjust = SVX_ADJUST_CENTER;
    3156           0 :             if(nPos == 0)
    3157           0 :                 eAdjust = SVX_ADJUST_LEFT;
    3158           0 :             else if(nPos == 2)
    3159           0 :                 eAdjust = SVX_ADJUST_RIGHT;
    3160           0 :             aNumFmt.SetNumAdjust( eAdjust );
    3161           0 :             pActNum->SetLevel(i, aNumFmt);
    3162             :         }
    3163           0 :         nMask <<= 1;
    3164             :     }
    3165           0 :     SetModified();
    3166           0 :     return 0;
    3167             : }
    3168             : 
    3169           0 : IMPL_LINK( SvxNumPositionTabPage, LevelHdl_Impl, ListBox *, pBox )
    3170             : {
    3171           0 :     sal_uInt16 nSaveNumLvl = nActNumLvl;
    3172           0 :     nActNumLvl = 0;
    3173           0 :     if(pBox->IsEntryPosSelected( pActNum->GetLevelCount() ) &&
    3174           0 :             (pBox->GetSelectEntryCount() == 1 || nSaveNumLvl != 0xffff))
    3175             :     {
    3176           0 :         nActNumLvl = 0xFFFF;
    3177           0 :         pBox->SetUpdateMode(sal_False);
    3178           0 :         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
    3179           0 :             pBox->SelectEntryPos( i, sal_False );
    3180           0 :         pBox->SetUpdateMode(sal_True);
    3181             :     }
    3182           0 :     else if(pBox->GetSelectEntryCount())
    3183             :     {
    3184           0 :         sal_uInt16 nMask = 1;
    3185           0 :         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
    3186             :         {
    3187           0 :             if(pBox->IsEntryPosSelected( i ))
    3188           0 :                 nActNumLvl |= nMask;
    3189           0 :             nMask <<= 1;
    3190             :         }
    3191           0 :         pBox->SelectEntryPos( pActNum->GetLevelCount(), sal_False );
    3192             :     }
    3193             :     else
    3194             :     {
    3195           0 :         nActNumLvl = nSaveNumLvl;
    3196           0 :         sal_uInt16 nMask = 1;
    3197           0 :         for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++ )
    3198             :         {
    3199           0 :             if(nActNumLvl & nMask)
    3200             :             {
    3201           0 :                 pBox->SelectEntryPos(i);
    3202           0 :                 break;
    3203             :             }
    3204           0 :             nMask <<=1;
    3205             :         }
    3206             :     }
    3207           0 :     m_pRelativeCB->Enable(nActNumLvl != 1);
    3208           0 :     SetModified();
    3209           0 :     InitPosAndSpaceMode();
    3210           0 :     ShowControlsDependingOnPosAndSpaceMode();
    3211           0 :     InitControls();
    3212           0 :     return 0;
    3213             : }
    3214             : 
    3215           0 : IMPL_LINK( SvxNumPositionTabPage, DistanceHdl_Impl, MetricField *, pFld )
    3216             : {
    3217           0 :     if(bInInintControl)
    3218           0 :         return 0;
    3219           0 :     long nValue = GetCoreValue(*pFld, eCoreUnit);
    3220           0 :     sal_uInt16 nMask = 1;
    3221           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    3222             :     {
    3223           0 :         if(nActNumLvl & nMask)
    3224             :         {
    3225           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
    3226           0 :             if (pFld == m_pDistBorderMF)
    3227             :             {
    3228             : 
    3229           0 :                 if(m_pRelativeCB->IsChecked())
    3230             :                 {
    3231           0 :                     if(0 == i)
    3232             :                     {
    3233           0 :                         long nTmp = aNumFmt.GetFirstLineOffset();
    3234           0 :                         aNumFmt.SetAbsLSpace( sal_uInt16(nValue - nTmp));
    3235             :                     }
    3236             :                     else
    3237             :                     {
    3238           0 :                         long nTmp = pActNum->GetLevel( i - 1 ).GetAbsLSpace() +
    3239           0 :                                     pActNum->GetLevel( i - 1 ).GetFirstLineOffset() -
    3240           0 :                                     pActNum->GetLevel( i ).GetFirstLineOffset();
    3241             : 
    3242           0 :                         aNumFmt.SetAbsLSpace( sal_uInt16(nValue + nTmp));
    3243             :                     }
    3244             :                 }
    3245             :                 else
    3246             :                 {
    3247           0 :                     aNumFmt.SetAbsLSpace( (short)nValue - aNumFmt.GetFirstLineOffset());
    3248             :                 }
    3249             :             }
    3250           0 :             else if (pFld == m_pDistNumMF)
    3251             :             {
    3252           0 :                 aNumFmt.SetCharTextDistance( (short)nValue );
    3253             :             }
    3254           0 :             else if (pFld == m_pIndentMF)
    3255             :             {
    3256             :                 // together with the FirstLineOffset the AbsLSpace must be changed, too
    3257           0 :                 long nDiff = nValue + aNumFmt.GetFirstLineOffset();
    3258           0 :                 long nAbsLSpace = aNumFmt.GetAbsLSpace();
    3259           0 :                 aNumFmt.SetAbsLSpace(sal_uInt16(nAbsLSpace + nDiff));
    3260           0 :                 aNumFmt.SetFirstLineOffset( -(short)nValue );
    3261             :             }
    3262             : 
    3263           0 :             pActNum->SetLevel( i, aNumFmt );
    3264             :         }
    3265           0 :         nMask <<= 1;
    3266             :     }
    3267             : 
    3268           0 :     SetModified();
    3269           0 :     if(!m_pDistBorderMF->IsEnabled())
    3270             :     {
    3271           0 :         String aEmptyStr;
    3272           0 :         m_pDistBorderMF->SetText(aEmptyStr);
    3273             :     }
    3274             : 
    3275           0 :     return 0;
    3276             : }
    3277             : 
    3278           0 : IMPL_LINK( SvxNumPositionTabPage, RelativeHdl_Impl, CheckBox *, pBox )
    3279             : {
    3280           0 :     sal_Bool bOn = pBox->IsChecked();
    3281           0 :     sal_Bool bSingleSelection = m_pLevelLB->GetSelectEntryCount() == 1 && USHRT_MAX != nActNumLvl;
    3282           0 :     sal_Bool bSetValue = sal_False;
    3283           0 :     long nValue = 0;
    3284           0 :     if(bOn || bSingleSelection)
    3285             :     {
    3286           0 :         sal_uInt16 nMask = 1;
    3287           0 :         sal_Bool bFirst = sal_True;
    3288           0 :         bSetValue = sal_True;
    3289           0 :         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    3290             :         {
    3291           0 :             if(nActNumLvl & nMask)
    3292             :             {
    3293           0 :                 const SvxNumberFormat &rNumFmt = pActNum->GetLevel(i);
    3294           0 :                 if(bFirst)
    3295             :                 {
    3296           0 :                     nValue = rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset();
    3297           0 :                     if(bOn && i)
    3298           0 :                         nValue -= (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
    3299             :                 }
    3300             :                 else
    3301           0 :                     bSetValue = nValue ==
    3302           0 :                         (rNumFmt.GetAbsLSpace() + rNumFmt.GetFirstLineOffset()) -
    3303           0 :                             (pActNum->GetLevel(i - 1).GetAbsLSpace() + pActNum->GetLevel(i - 1).GetFirstLineOffset());
    3304           0 :                 bFirst = sal_False;
    3305             :             }
    3306           0 :             nMask <<= 1;
    3307             :         }
    3308             : 
    3309             :     }
    3310           0 :     String aEmptyStr;
    3311           0 :     if(bSetValue)
    3312           0 :         SetMetricValue(*m_pDistBorderMF, nValue,   eCoreUnit);
    3313             :     else
    3314           0 :         m_pDistBorderMF->SetText(aEmptyStr);
    3315           0 :     m_pDistBorderMF->Enable(bOn || bSingleSelection);
    3316           0 :     m_pDistBorderFT->Enable(bOn || bSingleSelection);
    3317           0 :     bLastRelative = bOn;
    3318           0 :     return 0;
    3319             : }
    3320             : 
    3321           0 : IMPL_LINK_NOARG(SvxNumPositionTabPage, LabelFollowedByHdl_Impl)
    3322             : {
    3323             :     // determine value to be set at the chosen list levels
    3324           0 :     SvxNumberFormat::LabelFollowedBy eLabelFollowedBy = SvxNumberFormat::LISTTAB;
    3325             :     {
    3326           0 :         const sal_uInt16 nPos = m_pLabelFollowedByLB->GetSelectEntryPos();
    3327           0 :         if ( nPos == 1 )
    3328             :         {
    3329           0 :             eLabelFollowedBy = SvxNumberFormat::SPACE;
    3330             :         }
    3331           0 :         else if ( nPos == 2 )
    3332             :         {
    3333           0 :             eLabelFollowedBy = SvxNumberFormat::NOTHING;
    3334             :         }
    3335             :     }
    3336             : 
    3337             :     // set value at the chosen list levels
    3338           0 :     bool bSameListtabPos = true;
    3339           0 :     sal_uInt16 nFirstLvl = USHRT_MAX;
    3340           0 :     sal_uInt16 nMask = 1;
    3341           0 :     for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
    3342             :     {
    3343           0 :         if ( nActNumLvl & nMask )
    3344             :         {
    3345           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
    3346           0 :             aNumFmt.SetLabelFollowedBy( eLabelFollowedBy );
    3347           0 :             pActNum->SetLevel( i, aNumFmt );
    3348             : 
    3349           0 :             if ( nFirstLvl == USHRT_MAX )
    3350             :             {
    3351           0 :                 nFirstLvl = i;
    3352             :             }
    3353             :             else
    3354             :             {
    3355           0 :                 bSameListtabPos &= aNumFmt.GetListtabPos() ==
    3356           0 :                         pActNum->GetLevel( nFirstLvl ).GetListtabPos();
    3357           0 :             }
    3358             :         }
    3359           0 :         nMask <<= 1;
    3360             :     }
    3361             : 
    3362             :     // enable/disable metric field for list tab stop position depending on
    3363             :     // selected item following the list label.
    3364           0 :     m_pListtabFT->Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
    3365           0 :     m_pListtabMF->Enable( eLabelFollowedBy == SvxNumberFormat::LISTTAB );
    3366           0 :     if ( bSameListtabPos && eLabelFollowedBy == SvxNumberFormat::LISTTAB )
    3367             :     {
    3368           0 :         SetMetricValue(*m_pListtabMF, pActNum->GetLevel( nFirstLvl ).GetListtabPos(), eCoreUnit);
    3369             :     }
    3370             :     else
    3371             :     {
    3372           0 :         m_pListtabMF->SetText( String() );
    3373             :     }
    3374             : 
    3375           0 :     SetModified();
    3376             : 
    3377           0 :     return 0;
    3378             : }
    3379             : 
    3380           0 : IMPL_LINK( SvxNumPositionTabPage, ListtabPosHdl_Impl, MetricField*, pFld )
    3381             : {
    3382             :     // determine value to be set at the chosen list levels
    3383           0 :     const long nValue = GetCoreValue( *pFld, eCoreUnit );
    3384             : 
    3385             :     // set value at the chosen list levels
    3386           0 :     sal_uInt16 nMask = 1;
    3387           0 :     for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
    3388             :     {
    3389           0 :         if ( nActNumLvl & nMask )
    3390             :         {
    3391           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
    3392           0 :             aNumFmt.SetListtabPos( nValue );
    3393           0 :             pActNum->SetLevel( i, aNumFmt );
    3394             :         }
    3395           0 :         nMask <<= 1;
    3396             :     }
    3397             : 
    3398           0 :     SetModified();
    3399             : 
    3400           0 :     return 0;
    3401             : }
    3402             : 
    3403           0 : IMPL_LINK( SvxNumPositionTabPage, AlignAtHdl_Impl, MetricField*, pFld )
    3404             : {
    3405             :     // determine value to be set at the chosen list levels
    3406           0 :     const long nValue = GetCoreValue( *pFld, eCoreUnit );
    3407             : 
    3408             :     // set value at the chosen list levels
    3409           0 :     sal_uInt16 nMask = 1;
    3410           0 :     for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
    3411             :     {
    3412           0 :         if ( nActNumLvl & nMask )
    3413             :         {
    3414           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
    3415           0 :             const long nFirstLineIndent = nValue - aNumFmt.GetIndentAt();
    3416           0 :             aNumFmt.SetFirstLineIndent( nFirstLineIndent );
    3417           0 :             pActNum->SetLevel( i, aNumFmt );
    3418             :         }
    3419           0 :         nMask <<= 1;
    3420             :     }
    3421             : 
    3422           0 :     SetModified();
    3423             : 
    3424           0 :     return 0;
    3425             : }
    3426             : 
    3427           0 : IMPL_LINK( SvxNumPositionTabPage, IndentAtHdl_Impl, MetricField*, pFld )
    3428             : {
    3429             :     // determine value to be set at the chosen list levels
    3430           0 :     const long nValue = GetCoreValue( *pFld, eCoreUnit );
    3431             : 
    3432             :     // set value at the chosen list levels
    3433           0 :     sal_uInt16 nMask = 1;
    3434           0 :     for( sal_uInt16 i = 0; i < pActNum->GetLevelCount(); ++i )
    3435             :     {
    3436           0 :         if ( nActNumLvl & nMask )
    3437             :         {
    3438           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel(i) );
    3439           0 :             const long nAlignedAt = aNumFmt.GetIndentAt() +
    3440           0 :                                     aNumFmt.GetFirstLineIndent();
    3441           0 :             aNumFmt.SetIndentAt( nValue );
    3442           0 :             const long nNewFirstLineIndent = nAlignedAt - nValue;
    3443           0 :             aNumFmt.SetFirstLineIndent( nNewFirstLineIndent );
    3444           0 :             pActNum->SetLevel( i, aNumFmt );
    3445             :         }
    3446           0 :         nMask <<= 1;
    3447             :     }
    3448             : 
    3449           0 :     SetModified();
    3450             : 
    3451           0 :     return 0;
    3452             : }
    3453             : 
    3454           0 : IMPL_LINK_NOARG(SvxNumPositionTabPage, StandardHdl_Impl)
    3455             : {
    3456           0 :     sal_uInt16 nMask = 1;
    3457             :     SvxNumRule aTmpNumRule( pActNum->GetFeatureFlags(),
    3458           0 :                             pActNum->GetLevelCount(),
    3459           0 :                             pActNum->IsContinuousNumbering(),
    3460             :                             SVX_RULETYPE_NUMBERING,
    3461           0 :                             pActNum->GetLevel( 0 ).GetPositionAndSpaceMode() );
    3462           0 :     for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
    3463             :     {
    3464           0 :         if(nActNumLvl & nMask)
    3465             :         {
    3466           0 :             SvxNumberFormat aNumFmt( pActNum->GetLevel( i ) );
    3467           0 :             SvxNumberFormat aTempFmt(aTmpNumRule.GetLevel( i ));
    3468           0 :             aNumFmt.SetPositionAndSpaceMode( aTempFmt.GetPositionAndSpaceMode() );
    3469           0 :             if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION )
    3470             :             {
    3471           0 :                 aNumFmt.SetAbsLSpace( aTempFmt.GetAbsLSpace() );
    3472           0 :                 aNumFmt.SetCharTextDistance( aTempFmt.GetCharTextDistance() );
    3473           0 :                 aNumFmt.SetFirstLineOffset( aTempFmt.GetFirstLineOffset() );
    3474             :             }
    3475           0 :             else if ( aTempFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT )
    3476             :             {
    3477           0 :                 aNumFmt.SetNumAdjust( aTempFmt.GetNumAdjust() );
    3478           0 :                 aNumFmt.SetLabelFollowedBy( aTempFmt.GetLabelFollowedBy() );
    3479           0 :                 aNumFmt.SetListtabPos( aTempFmt.GetListtabPos() );
    3480           0 :                 aNumFmt.SetFirstLineIndent( aTempFmt.GetFirstLineIndent() );
    3481           0 :                 aNumFmt.SetIndentAt( aTempFmt.GetIndentAt() );
    3482             :             }
    3483             : 
    3484           0 :             pActNum->SetLevel( i, aNumFmt );
    3485             :         }
    3486           0 :         nMask <<= 1;
    3487             :     }
    3488             : 
    3489           0 :     InitControls();
    3490           0 :     SetModified();
    3491           0 :     return 0;
    3492             : }
    3493             : 
    3494           0 : void SvxNumPositionTabPage::SetModified(sal_Bool bRepaint)
    3495             : {
    3496           0 :     bModified = sal_True;
    3497           0 :     if(bRepaint)
    3498             :     {
    3499           0 :         m_pPreviewWIN->SetLevel(nActNumLvl);
    3500           0 :         m_pPreviewWIN->Invalidate();
    3501             :     }
    3502           0 : }
    3503             : 
    3504           0 : void SvxNumOptionsTabPage::SetModified(sal_Bool bRepaint)
    3505             : {
    3506           0 :     bModified = sal_True;
    3507           0 :     if(bRepaint)
    3508             :     {
    3509           0 :         m_pPreviewWIN->SetLevel(nActNumLvl);
    3510           0 :         m_pPreviewWIN->Invalidate();
    3511             :     }
    3512           0 : }
    3513             : 
    3514           0 : void SvxNumOptionsTabPage::PageCreated(SfxAllItemSet aSet)
    3515             : {
    3516           0 :     SFX_ITEMSET_ARG (&aSet,pListItem,SfxStringListItem,SID_CHAR_FMT_LIST_BOX,sal_False);
    3517           0 :     SFX_ITEMSET_ARG (&aSet,pNumCharFmt,SfxStringItem,SID_NUM_CHAR_FMT,sal_False);
    3518           0 :     SFX_ITEMSET_ARG (&aSet,pBulletCharFmt,SfxStringItem,SID_BULLET_CHAR_FMT,sal_False);
    3519           0 :     SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
    3520             : 
    3521           0 :     if (pNumCharFmt &&pBulletCharFmt)
    3522           0 :         SetCharFmts( pNumCharFmt->GetValue(),pBulletCharFmt->GetValue());
    3523             : 
    3524           0 :     if (pListItem)
    3525             :     {
    3526           0 :         ListBox& myCharFmtLB = GetCharFmtListBox();
    3527           0 :         const std::vector<OUString> &aList = pListItem->GetList();
    3528           0 :         sal_uInt32 nCount = aList.size();;
    3529           0 :         for(sal_uInt32 i = 0; i < nCount; i++)
    3530           0 :             myCharFmtLB.InsertEntry(aList[i]);
    3531             :     }
    3532           0 :     if (pMetricItem)
    3533           0 :         SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
    3534           0 : }
    3535             : 
    3536           0 : void SvxNumPositionTabPage::PageCreated(SfxAllItemSet aSet)
    3537             : {
    3538           0 :     SFX_ITEMSET_ARG (&aSet,pMetricItem,SfxAllEnumItem,SID_METRIC_ITEM,sal_False);
    3539             : 
    3540           0 :     if (pMetricItem)
    3541           0 :         SetMetric(static_cast<FieldUnit>(pMetricItem->GetValue()));
    3542           0 : }
    3543             : 
    3544             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10