LCOV - code coverage report
Current view: top level - libreoffice/cui/source/tabpages - paragrph.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 1259 0.1 %
Date: 2012-12-17 Functions: 2 82 2.4 %
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 <svl/style.hxx>
      21             : #include <sfx2/app.hxx>
      22             : #include <sfx2/objsh.hxx>
      23             : #include <sfx2/module.hxx>
      24             : #include <vcl/mnemonic.hxx>
      25             : #include <svx/dialogs.hrc>
      26             : 
      27             : #define _SVX_PARAGRPH_CXX   0
      28             : 
      29             : #include <svl/languageoptions.hxx>
      30             : #include <svl/cjkoptions.hxx>
      31             : #include <editeng/pgrditem.hxx>
      32             : #include <cuires.hrc>
      33             : #include "paragrph.hrc"
      34             : #include "paragrph.hxx"
      35             : #include <editeng/frmdiritem.hxx>
      36             : #include <editeng/lspcitem.hxx>
      37             : #include <editeng/adjitem.hxx>
      38             : #include <editeng/orphitem.hxx>
      39             : #include <editeng/widwitem.hxx>
      40             : #include <editeng/tstpitem.hxx>
      41             : #include <editeng/pmdlitem.hxx>
      42             : #include <editeng/spltitem.hxx>
      43             : #include <editeng/hyznitem.hxx>
      44             : #include <editeng/ulspitem.hxx>
      45             : #include <editeng/lrspitem.hxx>
      46             : #include <editeng/brkitem.hxx>
      47             : #include <editeng/keepitem.hxx>
      48             : #include "svx/dlgutil.hxx"
      49             : #include <dialmgr.hxx>
      50             : #include "svx/htmlmode.hxx"
      51             : #include <editeng/paravertalignitem.hxx>
      52             : #include <svl/eitem.hxx>
      53             : #include <sfx2/request.hxx>
      54             : #include <svl/intitem.hxx>
      55             : 
      56             : // static ----------------------------------------------------------------
      57             : 
      58             : static sal_uInt16 pStdRanges[] =
      59             : {
      60             :     SID_ATTR_PARA_LINESPACE,        // 10033
      61             :     SID_ATTR_PARA_LINESPACE,
      62             :     SID_ATTR_LRSPACE,               // 10048 -
      63             :     SID_ATTR_ULSPACE,               // 10049
      64             :     SID_ATTR_PARA_REGISTER,         // 10413
      65             :     SID_ATTR_PARA_REGISTER,
      66             :     0
      67             : };
      68             : 
      69             : static sal_uInt16 pAlignRanges[] =
      70             : {
      71             :     SID_ATTR_PARA_ADJUST,           // 10027
      72             :     SID_ATTR_PARA_ADJUST,
      73             :     0
      74             : };
      75             : 
      76             : static sal_uInt16 pExtRanges[] =
      77             : {
      78             :     SID_ATTR_PARA_PAGEBREAK,        // 10037 -
      79             :     SID_ATTR_PARA_WIDOWS,           // 10041
      80             :     SID_ATTR_PARA_MODEL,            // 10065 -
      81             :     SID_ATTR_PARA_KEEP,             // 10066
      82             :     0
      83             : };
      84             : 
      85             : // define ----------------------------------------------------------------
      86             : 
      87             : #define MAX_DURCH 5670      // 10 cm makes sense as maximum interline lead
      88             :                             // according to BP
      89             : #define FIX_DIST_DEF 283    // standard fix distance 0,5 cm
      90             : 
      91             : // enum ------------------------------------------------------------------
      92             : 
      93             : enum LineSpaceList
      94             : {
      95             :     LLINESPACE_1    = 0,
      96             :     LLINESPACE_15   = 1,
      97             :     LLINESPACE_2    = 2,
      98             :     LLINESPACE_PROP = 3,
      99             :     LLINESPACE_MIN  = 4,
     100             :     LLINESPACE_DURCH= 5,
     101             :     LLINESPACE_FIX  = 6,
     102             :     LLINESPACE_END
     103             : };
     104             : 
     105             : // C-Function ------------------------------------------------------------
     106             : 
     107             : void SetLineSpace_Impl( SvxLineSpacingItem&, int, long lValue = 0 );
     108             : 
     109           0 : void SetLineSpace_Impl( SvxLineSpacingItem& rLineSpace,
     110             :                         int eSpace, long lValue )
     111             : {
     112           0 :     switch ( eSpace )
     113             :     {
     114             :         case LLINESPACE_1:
     115           0 :             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     116           0 :             rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
     117           0 :             break;
     118             : 
     119             :         case LLINESPACE_15:
     120           0 :             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     121           0 :             rLineSpace.SetPropLineSpace( 150 );
     122           0 :             break;
     123             : 
     124             :         case LLINESPACE_2:
     125           0 :             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     126           0 :             rLineSpace.SetPropLineSpace( 200 );
     127           0 :             break;
     128             : 
     129             :         case LLINESPACE_PROP:
     130           0 :             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     131           0 :             rLineSpace.SetPropLineSpace( (sal_uInt8)lValue );
     132           0 :             break;
     133             : 
     134             :         case LLINESPACE_MIN:
     135           0 :             rLineSpace.SetLineHeight( (sal_uInt16)lValue );
     136           0 :             rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
     137           0 :             break;
     138             : 
     139             :         case LLINESPACE_DURCH:
     140           0 :             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_AUTO;
     141           0 :             rLineSpace.SetInterLineSpace( (sal_uInt16)lValue );
     142           0 :             break;
     143             : 
     144             :         case LLINESPACE_FIX:
     145           0 :             rLineSpace.SetLineHeight((sal_uInt16)lValue);
     146           0 :             rLineSpace.GetLineSpaceRule() = SVX_LINE_SPACE_FIX;
     147           0 :             rLineSpace.GetInterLineSpaceRule() = SVX_INTER_LINE_SPACE_OFF;
     148           0 :         break;
     149             :     }
     150           0 : }
     151             : 
     152             : 
     153           0 : sal_uInt16 GetHtmlMode_Impl(const SfxItemSet& rSet)
     154             : {
     155           0 :     sal_uInt16 nHtmlMode = 0;
     156           0 :     const SfxPoolItem* pItem = 0;
     157             :     SfxObjectShell* pShell;
     158           0 :     if(SFX_ITEM_SET == rSet.GetItemState(SID_HTML_MODE, sal_False, &pItem) ||
     159             :         ( 0 != (pShell = SfxObjectShell::Current()) &&
     160           0 :                     0 != (pItem = pShell->GetItem(SID_HTML_MODE))))
     161             :     {
     162           0 :         nHtmlMode = ((SfxUInt16Item*)pItem)->GetValue();
     163             :     }
     164           0 :     return nHtmlMode;
     165             : 
     166             : }
     167             : 
     168             : // class SvxStdParagraphTabPage ------------------------------------------
     169             : 
     170           0 : IMPL_LINK_NOARG(SvxStdParagraphTabPage, ELRLoseFocusHdl)
     171             : {
     172           0 :     SfxItemPool* pPool = GetItemSet().GetPool();
     173             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     174             :     FieldUnit eUnit =
     175           0 :         MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
     176             : 
     177           0 :     sal_Int64 nL = aLeftIndent.Denormalize( aLeftIndent.GetValue( eUnit ) );
     178           0 :     sal_Int64 nR = aRightIndent.Denormalize( aRightIndent.GetValue( eUnit ) );
     179           0 :     String aTmp = aFLineIndent.GetText();
     180             : 
     181           0 :     if( aLeftIndent.GetMin() < 0 )
     182           0 :         aFLineIndent.SetMin( -99999, FUNIT_MM );
     183             :     else
     184           0 :         aFLineIndent.SetMin( aFLineIndent.Normalize( -nL ), eUnit );
     185             : 
     186             :     // Check only for concrete width (Shell)
     187           0 :     sal_Int64 nTmp = nWidth - nL - nR - MM50;
     188           0 :     aFLineIndent.SetMax( aFLineIndent.Normalize( nTmp ), eUnit );
     189             : 
     190           0 :     if ( !aTmp.Len() )
     191           0 :         aFLineIndent.SetEmptyFieldValue();
     192             :     // maximum left right
     193           0 :     aTmp = aLeftIndent.GetText();
     194           0 :     nTmp = nWidth - nR - MM50;
     195           0 :     aLeftIndent.SetMax( aLeftIndent.Normalize( nTmp ), eUnit );
     196             : 
     197           0 :     if ( !aTmp.Len() )
     198           0 :         aLeftIndent.SetEmptyFieldValue();
     199           0 :     aTmp = aRightIndent.GetText();
     200           0 :     nTmp = nWidth - nL - MM50;
     201           0 :     aRightIndent.SetMax( aRightIndent.Normalize( nTmp ), eUnit );
     202             : 
     203           0 :     if ( !aTmp.Len() )
     204           0 :         aRightIndent.SetEmptyFieldValue();
     205           0 :     return 0;
     206             : }
     207             : 
     208             : // -----------------------------------------------------------------------
     209             : 
     210           0 : SfxTabPage* SvxStdParagraphTabPage::Create( Window* pParent,
     211             :                                             const SfxItemSet& rSet)
     212             : {
     213           0 :     return new SvxStdParagraphTabPage( pParent, rSet );
     214             : }
     215             : 
     216             : // -----------------------------------------------------------------------
     217             : 
     218           0 : sal_Bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
     219             : {
     220           0 :     SfxItemState eState = SFX_ITEM_UNKNOWN;
     221           0 :     const SfxPoolItem* pOld = 0;
     222           0 :     SfxItemPool* pPool = rOutSet.GetPool();
     223             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     224             : 
     225           0 :     sal_Bool bModified = sal_False;
     226             :     sal_uInt16 nWhich;
     227           0 :     sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
     228             : 
     229           0 :     if ( LISTBOX_ENTRY_NOTFOUND != nPos &&
     230           0 :          ( nPos != aLineDist.GetSavedValue() ||
     231           0 :            aLineDistAtPercentBox.IsValueModified() ||
     232           0 :            aLineDistAtMetricBox.IsValueModified() ) )
     233             :     {
     234           0 :         nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
     235           0 :         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
     236             :         SvxLineSpacingItem aSpacing(
     237           0 :             (const SvxLineSpacingItem&)GetItemSet().Get( nWhich ) );
     238             : 
     239           0 :         switch ( nPos )
     240             :         {
     241             :             case LLINESPACE_1:
     242             :             case LLINESPACE_15:
     243             :             case LLINESPACE_2:
     244           0 :                 SetLineSpace_Impl( aSpacing, nPos );
     245           0 :                 break;
     246             : 
     247             :             case LLINESPACE_PROP:
     248             :                 SetLineSpace_Impl( aSpacing, nPos,
     249             :                                    static_cast<long>(aLineDistAtPercentBox.Denormalize(
     250           0 :                                    aLineDistAtPercentBox.GetValue() )) );
     251           0 :                 break;
     252             : 
     253             :             case LLINESPACE_MIN:
     254             :             case LLINESPACE_DURCH:
     255             :             case LLINESPACE_FIX:
     256             :                 SetLineSpace_Impl( aSpacing, nPos,
     257           0 :                     GetCoreValue( aLineDistAtMetricBox, eUnit ) );
     258           0 :             break;
     259             : 
     260             :             default:
     261             :                 OSL_FAIL( "unbekannter Type fuer Zeilenabstand." );
     262           0 :                 break;
     263             :         }
     264           0 :         eState = GetItemSet().GetItemState( nWhich );
     265           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_LINESPACE );
     266             : 
     267           0 :         if ( !pOld || !( *(const SvxLineSpacingItem*)pOld == aSpacing ) ||
     268             :              SFX_ITEM_DONTCARE == eState )
     269             :         {
     270           0 :             rOutSet.Put( aSpacing );
     271           0 :             bModified = sal_True;
     272           0 :         }
     273             :     }
     274             : 
     275           0 :     if ( aTopDist.IsValueModified() || aBottomDist.IsValueModified()
     276           0 :             || aContextualCB.GetSavedValue() != aContextualCB.IsChecked())
     277             :     {
     278           0 :         nWhich = GetWhich( SID_ATTR_ULSPACE );
     279           0 :         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
     280           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_ULSPACE );
     281           0 :         SvxULSpaceItem aMargin( nWhich );
     282             : 
     283           0 :         if ( bRelativeMode )
     284             :         {
     285             :             DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
     286             : 
     287             :             const SvxULSpaceItem& rOldItem =
     288           0 :                 (const SvxULSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
     289             : 
     290           0 :             if ( aTopDist.IsRelative() )
     291           0 :                 aMargin.SetUpper( rOldItem.GetUpper(),
     292           0 :                                   (sal_uInt16)aTopDist.GetValue() );
     293             :             else
     294           0 :                 aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
     295             : 
     296           0 :             if ( aBottomDist.IsRelative() )
     297           0 :                 aMargin.SetLower( rOldItem.GetLower(),
     298           0 :                                   (sal_uInt16)aBottomDist.GetValue() );
     299             :             else
     300           0 :                 aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
     301             : 
     302             :         }
     303             :         else
     304             :         {
     305           0 :             aMargin.SetUpper( (sal_uInt16)GetCoreValue( aTopDist, eUnit ) );
     306           0 :             aMargin.SetLower( (sal_uInt16)GetCoreValue( aBottomDist, eUnit ) );
     307             :         }
     308           0 :         aMargin.SetContextValue(aContextualCB.IsChecked());
     309           0 :         eState = GetItemSet().GetItemState( nWhich );
     310             : 
     311           0 :         if ( !pOld || !( *(const SvxULSpaceItem*)pOld == aMargin ) ||
     312             :              SFX_ITEM_DONTCARE == eState )
     313             :         {
     314           0 :             rOutSet.Put( aMargin );
     315           0 :             bModified = sal_True;
     316           0 :         }
     317             :     }
     318           0 :     bool bNullTab = false;
     319             : 
     320           0 :     if ( aLeftIndent.IsValueModified() ||
     321           0 :          aFLineIndent.IsValueModified() ||
     322           0 :          aRightIndent.IsValueModified()
     323           0 :          ||  aAutoCB.GetSavedValue() != aAutoCB.IsChecked() )
     324             :     {
     325           0 :         nWhich = GetWhich( SID_ATTR_LRSPACE );
     326           0 :         SfxMapUnit eUnit = pPool->GetMetric( nWhich );
     327           0 :         SvxLRSpaceItem aMargin( nWhich );
     328           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_LRSPACE );
     329             : 
     330           0 :         if ( bRelativeMode )
     331             :         {
     332             :             DBG_ASSERT( GetItemSet().GetParent(), "No ParentSet" );
     333             : 
     334             :             const SvxLRSpaceItem& rOldItem =
     335           0 :                 (const SvxLRSpaceItem&)GetItemSet().GetParent()->Get( nWhich );
     336             : 
     337           0 :             if ( aLeftIndent.IsRelative() )
     338             :                 aMargin.SetTxtLeft( rOldItem.GetTxtLeft(),
     339           0 :                                     (sal_uInt16)aLeftIndent.GetValue() );
     340             :             else
     341           0 :                 aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
     342             : 
     343           0 :             if ( aRightIndent.IsRelative() )
     344             :                 aMargin.SetRight( rOldItem.GetRight(),
     345           0 :                                   (sal_uInt16)aRightIndent.GetValue() );
     346             :             else
     347           0 :                 aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
     348             : 
     349           0 :             if ( aFLineIndent.IsRelative() )
     350           0 :                 aMargin.SetTxtFirstLineOfst( rOldItem.GetTxtFirstLineOfst(),
     351           0 :                                              (sal_uInt16)aFLineIndent.GetValue() );
     352             :             else
     353             :                 aMargin.SetTxtFirstLineOfst(
     354           0 :                     (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) );
     355             :         }
     356             :         else
     357             :         {
     358           0 :             aMargin.SetTxtLeft( GetCoreValue( aLeftIndent, eUnit ) );
     359           0 :             aMargin.SetRight( GetCoreValue( aRightIndent, eUnit ) );
     360             :             aMargin.SetTxtFirstLineOfst(
     361           0 :                 (sal_uInt16)GetCoreValue( aFLineIndent, eUnit ) );
     362             :         }
     363           0 :         aMargin.SetAutoFirst(aAutoCB.IsChecked());
     364           0 :         if ( aMargin.GetTxtFirstLineOfst() < 0 )
     365           0 :             bNullTab = true;
     366           0 :         eState = GetItemSet().GetItemState( nWhich );
     367             : 
     368           0 :         if ( !pOld || !( *(const SvxLRSpaceItem*)pOld == aMargin ) ||
     369             :              SFX_ITEM_DONTCARE == eState )
     370             :         {
     371           0 :             rOutSet.Put( aMargin );
     372           0 :             bModified = sal_True;
     373           0 :         }
     374             :     }
     375             : 
     376           0 :     if ( bNullTab )
     377             :     {
     378           0 :         MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
     379           0 :         if ( MAP_100TH_MM != eUnit )
     380             :         {
     381             : 
     382             :             // negative first line indent -> set null default tabstob if applicable
     383           0 :             sal_uInt16 _nWhich = GetWhich( SID_ATTR_TABSTOP );
     384           0 :             const SfxItemSet& rInSet = GetItemSet();
     385             : 
     386           0 :             if ( rInSet.GetItemState( _nWhich ) >= SFX_ITEM_AVAILABLE )
     387             :             {
     388             :                 const SvxTabStopItem& rTabItem =
     389           0 :                     (const SvxTabStopItem&)rInSet.Get( _nWhich );
     390           0 :                 SvxTabStopItem aNullTab( rTabItem );
     391           0 :                 SvxTabStop aNull( 0, SVX_TAB_ADJUST_DEFAULT );
     392           0 :                 aNullTab.Insert( aNull );
     393           0 :                 rOutSet.Put( aNullTab );
     394             :             }
     395             :         }
     396             :     }
     397           0 :     if( aRegisterCB.IsVisible())
     398             :     {
     399             :         const SfxBoolItem* pBoolItem = (SfxBoolItem*)GetOldItem(
     400           0 :                             rOutSet, SID_ATTR_PARA_REGISTER);
     401           0 :         SfxBoolItem* pRegItem = (SfxBoolItem*)pBoolItem->Clone();
     402           0 :         sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
     403           0 :         sal_Bool bSet = pRegItem->GetValue();
     404             : 
     405           0 :         if(aRegisterCB.IsChecked() != bSet )
     406             :         {
     407           0 :             pRegItem->SetValue(!bSet);
     408           0 :             rOutSet.Put(*pRegItem);
     409           0 :             bModified = sal_True;
     410             :         }
     411           0 :         else if ( SFX_ITEM_DEFAULT == GetItemSet().GetItemState( _nWhich, sal_False ) )
     412           0 :             rOutSet.ClearItem(_nWhich);
     413           0 :         delete pRegItem;
     414             :     }
     415             : 
     416           0 :     return bModified;
     417             : }
     418             : 
     419             : // -----------------------------------------------------------------------
     420             : 
     421           0 : void SvxStdParagraphTabPage::Reset( const SfxItemSet& rSet )
     422             : {
     423           0 :     SfxItemPool* pPool = rSet.GetPool();
     424             :     DBG_ASSERT( pPool, "Wo ist der Pool?" );
     425           0 :     String aEmpty;
     426             : 
     427             :     // adjust metric
     428           0 :     FieldUnit eFUnit = GetModuleFieldUnit( rSet );
     429             : 
     430           0 :     bool bApplyCharUnit = GetApplyCharUnit( rSet );
     431             : 
     432           0 :     SvtCJKOptions aCJKOptions;
     433           0 :     if(aCJKOptions.IsAsianTypographyEnabled() && bApplyCharUnit )
     434           0 :         eFUnit = FUNIT_CHAR;
     435             : 
     436           0 :     SetFieldUnit( aLeftIndent, eFUnit );
     437           0 :     SetFieldUnit( aRightIndent, eFUnit );
     438           0 :     SetFieldUnit( aFLineIndent, eFUnit );
     439           0 :     if ( eFUnit == FUNIT_CHAR )
     440             :     {
     441           0 :         SetFieldUnit( aTopDist, FUNIT_LINE );
     442           0 :         SetFieldUnit( aBottomDist, FUNIT_LINE );
     443           0 :         SetFieldUnit( aLineDistAtMetricBox, FUNIT_POINT );
     444             :     }
     445             :     else
     446             :     {
     447           0 :         SetFieldUnit( aTopDist, eFUnit );
     448           0 :         SetFieldUnit( aBottomDist, eFUnit );
     449           0 :         SetFieldUnit( aLineDistAtMetricBox, eFUnit );
     450             :     }
     451             : 
     452           0 :     sal_uInt16 _nWhich = GetWhich( SID_ATTR_LRSPACE );
     453           0 :     SfxItemState eItemState = rSet.GetItemState( _nWhich );
     454             : 
     455           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
     456             :     {
     457           0 :         SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
     458             : 
     459           0 :         if ( bRelativeMode )
     460             :         {
     461             :             const SvxLRSpaceItem& rOldItem =
     462           0 :                 (const SvxLRSpaceItem&)rSet.Get( _nWhich );
     463             : 
     464           0 :             if ( rOldItem.GetPropLeft() != 100 )
     465             :             {
     466           0 :                 aLeftIndent.SetRelative( sal_True );
     467           0 :                 aLeftIndent.SetValue( rOldItem.GetPropLeft() );
     468             :             }
     469             :             else
     470             :             {
     471           0 :                 aLeftIndent.SetRelative();
     472           0 :                 SetFieldUnit( aLeftIndent, eFUnit );
     473           0 :                 SetMetricValue( aLeftIndent, rOldItem.GetTxtLeft(), eUnit );
     474             :             }
     475             : 
     476           0 :             if ( rOldItem.GetPropRight() != 100 )
     477             :             {
     478           0 :                 aRightIndent.SetRelative( sal_True );
     479           0 :                 aRightIndent.SetValue( rOldItem.GetPropRight() );
     480             :             }
     481             :             else
     482             :             {
     483           0 :                 aRightIndent.SetRelative();
     484           0 :                 SetFieldUnit( aRightIndent, eFUnit );
     485           0 :                 SetMetricValue( aRightIndent, rOldItem.GetRight(), eUnit );
     486             :             }
     487             : 
     488           0 :             if ( rOldItem.GetPropTxtFirstLineOfst() != 100 )
     489             :             {
     490           0 :                 aFLineIndent.SetRelative( sal_True );
     491           0 :                 aFLineIndent.SetValue( rOldItem.GetPropTxtFirstLineOfst() );
     492             :             }
     493             :             else
     494             :             {
     495           0 :                 aFLineIndent.SetRelative();
     496           0 :                 aFLineIndent.SetMin(-9999);
     497           0 :                 SetFieldUnit( aFLineIndent, eFUnit );
     498           0 :                 SetMetricValue( aFLineIndent, rOldItem.GetTxtFirstLineOfst(),
     499           0 :                                 eUnit );
     500             :             }
     501           0 :             aAutoCB.Check(rOldItem.IsAutoFirst());
     502             :         }
     503             :         else
     504             :         {
     505             :             const SvxLRSpaceItem& rSpace =
     506           0 :                 (const SvxLRSpaceItem&)rSet.Get( _nWhich );
     507             : 
     508           0 :             SetMetricValue( aLeftIndent, rSpace.GetTxtLeft(), eUnit );
     509           0 :             SetMetricValue( aRightIndent, rSpace.GetRight(), eUnit );
     510           0 :             SetMetricValue( aFLineIndent, rSpace.GetTxtFirstLineOfst(), eUnit );
     511           0 :             aAutoCB.Check(rSpace.IsAutoFirst());
     512             :         }
     513           0 :         AutoHdl_Impl(&aAutoCB);
     514             :     }
     515             :     else
     516             :     {
     517           0 :         aLeftIndent.SetEmptyFieldValue();
     518           0 :         aRightIndent.SetEmptyFieldValue();
     519           0 :         aFLineIndent.SetEmptyFieldValue();
     520             :     }
     521             : 
     522           0 :     _nWhich = GetWhich( SID_ATTR_ULSPACE );
     523           0 :     eItemState = rSet.GetItemState( _nWhich );
     524             : 
     525           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
     526             :     {
     527           0 :         SfxMapUnit eUnit = pPool->GetMetric( _nWhich );
     528             : 
     529             :         const SvxULSpaceItem& rOldItem =
     530           0 :             (const SvxULSpaceItem&)rSet.Get( _nWhich );
     531           0 :         if ( bRelativeMode )
     532             :         {
     533             : 
     534           0 :             if ( rOldItem.GetPropUpper() != 100 )
     535             :             {
     536           0 :                 aTopDist.SetRelative( sal_True );
     537           0 :                 aTopDist.SetValue( rOldItem.GetPropUpper() );
     538             :             }
     539             :             else
     540             :             {
     541           0 :                 aTopDist.SetRelative();
     542           0 :                 if ( eFUnit == FUNIT_CHAR )
     543           0 :                     SetFieldUnit( aTopDist, FUNIT_LINE );
     544             :                 else
     545           0 :                     SetFieldUnit( aTopDist, eFUnit );
     546           0 :                 SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
     547             :             }
     548             : 
     549           0 :             if ( rOldItem.GetPropLower() != 100 )
     550             :             {
     551           0 :                 aBottomDist.SetRelative( sal_True );
     552           0 :                 aBottomDist.SetValue( rOldItem.GetPropLower() );
     553             :             }
     554             :             else
     555             :             {
     556           0 :                 aBottomDist.SetRelative();
     557           0 :                 if ( eFUnit == FUNIT_CHAR )
     558           0 :                     SetFieldUnit( aBottomDist, FUNIT_LINE );
     559             :                 else
     560           0 :                     SetFieldUnit( aBottomDist, eFUnit );
     561           0 :                 SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
     562             :             }
     563             :         }
     564             :         else
     565             :         {
     566           0 :             SetMetricValue( aTopDist, rOldItem.GetUpper(), eUnit );
     567           0 :             SetMetricValue( aBottomDist, rOldItem.GetLower(), eUnit );
     568             :         }
     569           0 :         aContextualCB.Check(rOldItem.GetContext());
     570             :     }
     571             :     else
     572             :     {
     573           0 :         aTopDist.SetEmptyFieldValue();
     574           0 :         aBottomDist.SetEmptyFieldValue();
     575             :     }
     576             : 
     577           0 :     _nWhich = GetWhich( SID_ATTR_PARA_LINESPACE );
     578           0 :     eItemState = rSet.GetItemState( _nWhich );
     579             : 
     580           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
     581           0 :         SetLineSpacing_Impl( (const SvxLineSpacingItem &)rSet.Get( _nWhich ) );
     582             :     else
     583           0 :         aLineDist.SetNoSelection();
     584             : 
     585             : 
     586           0 :     _nWhich = GetWhich( SID_ATTR_PARA_REGISTER );
     587           0 :     eItemState = rSet.GetItemState( _nWhich );
     588             : 
     589           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
     590           0 :         aRegisterCB.Check( ((const SfxBoolItem &)rSet.Get( _nWhich )).GetValue());
     591           0 :     aRegisterCB.SaveValue();
     592           0 :     sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
     593           0 :     if(nHtmlMode & HTMLMODE_ON)
     594             :     {
     595           0 :         aRegisterCB.Hide();
     596           0 :         aRegisterFL.Hide();
     597           0 :         aAutoCB.Hide();
     598           0 :         if(!(nHtmlMode & HTMLMODE_SOME_STYLES)) // IE or SW
     599             :         {
     600           0 :             aRightLabel.Disable();
     601           0 :             aRightIndent.Disable();
     602           0 :             aTopDist.Disable();  //HTML3.2 and NS 3.0
     603           0 :             aBottomDist.Disable();
     604           0 :             aFLineIndent.Disable();
     605           0 :             aFLineLabel.Disable();
     606             :         }
     607             :     }
     608             : 
     609           0 :     ELRLoseFocusHdl( NULL );
     610           0 :     aAutoCB.SaveValue();
     611           0 :     aContextualCB.SaveValue();
     612           0 :     aLineDist.SaveValue();
     613           0 : }
     614             : 
     615             : // -----------------------------------------------------------------------
     616             : 
     617           0 : void SvxStdParagraphTabPage::EnableRelativeMode()
     618             : {
     619             :     DBG_ASSERT( GetItemSet().GetParent(), "RelativeMode, but no parent-set!" );
     620             : 
     621           0 :     aLeftIndent.EnableRelativeMode( 0, 999 );
     622           0 :     aFLineIndent.EnableRelativeMode( 0, 999 );
     623           0 :     aRightIndent.EnableRelativeMode( 0, 999 );
     624           0 :     aTopDist.EnableRelativeMode( 0, 999 );
     625           0 :     aBottomDist.EnableRelativeMode( 0, 999 );
     626           0 :     bRelativeMode = sal_True;
     627           0 : }
     628             : 
     629             : // -----------------------------------------------------------------------
     630             : 
     631           0 : int SvxStdParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
     632             : {
     633           0 :     ELRLoseFocusHdl( NULL );
     634             : 
     635           0 :     if ( _pSet )
     636           0 :         FillItemSet( *_pSet );
     637           0 :     return LEAVE_PAGE;
     638             : }
     639             : 
     640             : // -----------------------------------------------------------------------
     641             : 
     642           0 : SvxStdParagraphTabPage::SvxStdParagraphTabPage( Window* pParent,
     643             :                                                 const SfxItemSet& rAttr ) :
     644             : 
     645           0 :     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_STD_PARAGRAPH ), rAttr ),
     646             : 
     647           0 :     aIndentFrm              ( this, CUI_RES( FL_INDENT ) ),
     648           0 :     aLeftLabel              ( this, CUI_RES( FT_LEFTINDENT ) ),
     649           0 :     aLeftIndent             ( this, CUI_RES( ED_LEFTINDENT ) ),
     650           0 :     aRightLabel             ( this, CUI_RES( FT_RIGHTINDENT ) ),
     651           0 :     aRightIndent            ( this, CUI_RES( ED_RIGHTINDENT ) ),
     652             : 
     653           0 :     aFLineLabel             ( this, CUI_RES( FT_FLINEINDENT ) ),
     654           0 :     aFLineIndent            ( this, CUI_RES( ED_FLINEINDENT ) ),
     655           0 :     aAutoCB                 ( this, CUI_RES( CB_AUTO ) ),
     656           0 :     aDistFrm                ( this, CUI_RES( FL_DIST ) ),
     657           0 :     aTopLabel               ( this, CUI_RES( FT_TOPDIST ) ),
     658           0 :     aTopDist                ( this, CUI_RES( ED_TOPDIST ) ),
     659           0 :     aBottomLabel            ( this, CUI_RES( FT_BOTTOMDIST ) ),
     660           0 :     aBottomDist             ( this, CUI_RES( ED_BOTTOMDIST ) ),
     661           0 :     aContextualCB           ( this, CUI_RES( CB_CONTEXTUALSPACING ) ),
     662             : 
     663           0 :     aLineDistFrm            ( this, CUI_RES( FL_LINEDIST ) ),
     664           0 :     aLineDist               ( this, CUI_RES( LB_LINEDIST ) ),
     665           0 :     aLineDistAtLabel        ( this, CUI_RES( FT_LINEDIST ) ),
     666           0 :     aLineDistAtPercentBox   ( this, CUI_RES( ED_LINEDISTPERCENT ) ),
     667           0 :     aLineDistAtMetricBox    ( this, CUI_RES( ED_LINEDISTMETRIC ) ),
     668           0 :     sAbsDist                ( CUI_RES(ST_LINEDIST_ABS) ),
     669           0 :     aExampleWin             ( this, CUI_RES( WN_EXAMPLE ) ),
     670           0 :     aRegisterFL             ( this, CUI_RES( FL_REGISTER ) ),
     671           0 :     aRegisterCB             ( this, CUI_RES( CB_REGISTER ) ),
     672             :     pActLineDistFld ( &aLineDistAtPercentBox ),
     673             :     nAbst           ( MAX_DURCH ),
     674             :     nWidth          ( 11905 /*567 * 50*/ ),
     675             :     nMinFixDist(0L),
     676             : 
     677             :     bRelativeMode   ( sal_False ),
     678           0 :     bNegativeIndents(sal_False)
     679             : 
     680             : {
     681             :     // this page needs ExchangeSupport
     682           0 :     SetExchangeSupport();
     683             : 
     684           0 :     aLineDistAtMetricBox.Hide();
     685           0 :     FreeResource();
     686           0 :     Init_Impl();
     687           0 :     aFLineIndent.SetMin(-9999);    // is set to 0 on default
     688             : 
     689           0 :     aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
     690             : 
     691           0 : }
     692             : 
     693             : 
     694             : // -----------------------------------------------------------------------
     695             : 
     696           0 : void SvxStdParagraphTabPage::EnableNegativeMode()
     697             : {
     698           0 :     aLeftIndent.SetMin(-9999);
     699           0 :     aRightIndent.SetMin(-9999);
     700           0 :     aRightIndent.EnableNegativeMode();
     701           0 :     aLeftIndent.EnableNegativeMode();
     702           0 :     bNegativeIndents = sal_True;
     703           0 : }
     704             : 
     705             : // -----------------------------------------------------------------------
     706             : 
     707           0 : sal_uInt16* SvxStdParagraphTabPage::GetRanges()
     708             : {
     709           0 :     return pStdRanges;
     710             : }
     711             : 
     712             : // -----------------------------------------------------------------------
     713             : 
     714           0 : void SvxStdParagraphTabPage::SetLineSpacing_Impl
     715             : (
     716             :     const SvxLineSpacingItem &rAttr
     717             : )
     718             : {
     719           0 :     SfxMapUnit eUnit = GetItemSet().GetPool()->GetMetric( rAttr.Which() );
     720             : 
     721           0 :     switch( rAttr.GetLineSpaceRule() )
     722             :     {
     723             :         case SVX_LINE_SPACE_AUTO:
     724             :         {
     725           0 :             SvxInterLineSpace eInter = rAttr.GetInterLineSpaceRule();
     726             : 
     727           0 :             switch( eInter )
     728             :             {
     729             :                 // Default single line spacing
     730             :                 case SVX_INTER_LINE_SPACE_OFF:
     731           0 :                     aLineDist.SelectEntryPos( LLINESPACE_1 );
     732           0 :                     break;
     733             : 
     734             :                 // Default single line spacing
     735             :                 case SVX_INTER_LINE_SPACE_PROP:
     736           0 :                     if ( 100 == rAttr.GetPropLineSpace() )
     737             :                     {
     738           0 :                         aLineDist.SelectEntryPos( LLINESPACE_1 );
     739           0 :                         break;
     740             :                     }
     741             :                     // 1.5 line spacing
     742           0 :                     if ( 150 == rAttr.GetPropLineSpace() )
     743             :                     {
     744           0 :                         aLineDist.SelectEntryPos( LLINESPACE_15 );
     745           0 :                         break;
     746             :                     }
     747             :                     // double line spacing
     748           0 :                     if ( 200 == rAttr.GetPropLineSpace() )
     749             :                     {
     750           0 :                         aLineDist.SelectEntryPos( LLINESPACE_2 );
     751           0 :                         break;
     752             :                     }
     753             :                     // the set per cent value
     754             :                     aLineDistAtPercentBox.
     755             :                         SetValue( aLineDistAtPercentBox.Normalize(
     756           0 :                                         rAttr.GetPropLineSpace() ) );
     757           0 :                     aLineDist.SelectEntryPos( LLINESPACE_PROP );
     758           0 :                     break;
     759             : 
     760             :                 case SVX_INTER_LINE_SPACE_FIX:
     761             :                     SetMetricValue( aLineDistAtMetricBox,
     762           0 :                                     rAttr.GetInterLineSpace(), eUnit );
     763           0 :                     aLineDist.SelectEntryPos( LLINESPACE_DURCH );
     764           0 :                     break;
     765             :                 default: ;//prevent warning
     766             :             }
     767             :         }
     768           0 :         break;
     769             :         case SVX_LINE_SPACE_FIX:
     770           0 :             SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
     771           0 :             aLineDist.SelectEntryPos( LLINESPACE_FIX );
     772           0 :         break;
     773             : 
     774             :         case SVX_LINE_SPACE_MIN:
     775           0 :             SetMetricValue(aLineDistAtMetricBox, rAttr.GetLineHeight(), eUnit);
     776           0 :             aLineDist.SelectEntryPos( LLINESPACE_MIN );
     777           0 :             break;
     778             :         default: ;//prevent warning
     779             :     }
     780           0 :     LineDistHdl_Impl( &aLineDist );
     781           0 : }
     782             : 
     783             : // -----------------------------------------------------------------------
     784             : 
     785           0 : IMPL_LINK( SvxStdParagraphTabPage, LineDistHdl_Impl, ListBox *, pBox )
     786             : {
     787           0 :     switch( pBox->GetSelectEntryPos() )
     788             :     {
     789             :         case LLINESPACE_1:
     790             :         case LLINESPACE_15:
     791             :         case LLINESPACE_2:
     792           0 :             aLineDistAtLabel.Enable(sal_False);
     793           0 :             pActLineDistFld->Enable(sal_False);
     794           0 :             pActLineDistFld->SetText( String() );
     795           0 :             break;
     796             : 
     797             :         case LLINESPACE_DURCH:
     798             :             // setting a sensible default?
     799             :             // limit MS min(10, aPageSize)
     800           0 :             aLineDistAtPercentBox.Hide();
     801           0 :             pActLineDistFld = &aLineDistAtMetricBox;
     802           0 :             aLineDistAtMetricBox.SetMin(0);
     803             : 
     804             : 
     805           0 :             if ( !aLineDistAtMetricBox.GetText().Len() )
     806             :                 aLineDistAtMetricBox.SetValue(
     807           0 :                     aLineDistAtMetricBox.Normalize( 1 ) );
     808           0 :             aLineDistAtPercentBox.Hide();
     809           0 :             pActLineDistFld->Show();
     810           0 :             pActLineDistFld->Enable();
     811           0 :             aLineDistAtLabel.Enable();
     812           0 :             break;
     813             : 
     814             :         case LLINESPACE_MIN:
     815           0 :             aLineDistAtPercentBox.Hide();
     816           0 :             pActLineDistFld = &aLineDistAtMetricBox;
     817           0 :             aLineDistAtMetricBox.SetMin(0);
     818             : 
     819           0 :             if ( !aLineDistAtMetricBox.GetText().Len() )
     820             :                 aLineDistAtMetricBox.SetValue(
     821           0 :                     aLineDistAtMetricBox.Normalize( 10 ), FUNIT_TWIP );
     822           0 :             aLineDistAtPercentBox.Hide();
     823           0 :             pActLineDistFld->Show();
     824           0 :             pActLineDistFld->Enable();
     825           0 :             aLineDistAtLabel.Enable();
     826           0 :             break;
     827             : 
     828             :         case LLINESPACE_PROP:
     829           0 :             aLineDistAtMetricBox.Hide();
     830           0 :             pActLineDistFld = &aLineDistAtPercentBox;
     831             : 
     832           0 :             if ( !aLineDistAtPercentBox.GetText().Len() )
     833             :                 aLineDistAtPercentBox.SetValue(
     834           0 :                     aLineDistAtPercentBox.Normalize( 100 ), FUNIT_TWIP );
     835           0 :             aLineDistAtMetricBox.Hide();
     836           0 :             pActLineDistFld->Show();
     837           0 :             pActLineDistFld->Enable();
     838           0 :             aLineDistAtLabel.Enable();
     839           0 :             break;
     840             :         case LLINESPACE_FIX:
     841             :         {
     842           0 :             aLineDistAtPercentBox.Hide();
     843           0 :             pActLineDistFld = &aLineDistAtMetricBox;
     844           0 :             sal_Int64 nTemp = aLineDistAtMetricBox.GetValue();
     845           0 :             aLineDistAtMetricBox.SetMin(aLineDistAtMetricBox.Normalize(nMinFixDist), FUNIT_TWIP);
     846             : 
     847             :             // if the value has been changed at SetMin,
     848             :             // it is time for the default
     849           0 :             if ( aLineDistAtMetricBox.GetValue() != nTemp )
     850             :                 SetMetricValue( aLineDistAtMetricBox,
     851           0 :                                     FIX_DIST_DEF, SFX_MAPUNIT_TWIP ); // fix is only in Writer
     852           0 :             aLineDistAtPercentBox.Hide();
     853           0 :             pActLineDistFld->Show();
     854           0 :             pActLineDistFld->Enable();
     855           0 :             aLineDistAtLabel.Enable();
     856             :         }
     857           0 :         break;
     858             :     }
     859           0 :     UpdateExample_Impl( sal_True );
     860           0 :     return 0;
     861             : }
     862             : 
     863             : // -----------------------------------------------------------------------
     864             : 
     865           0 : IMPL_LINK_NOARG_INLINE_START(SvxStdParagraphTabPage, ModifyHdl_Impl)
     866             : {
     867           0 :     UpdateExample_Impl();
     868           0 :     return 0;
     869             : }
     870           0 : IMPL_LINK_NOARG_INLINE_END(SvxStdParagraphTabPage, ModifyHdl_Impl)
     871             : 
     872             : // -----------------------------------------------------------------------
     873             : 
     874           0 : void SvxStdParagraphTabPage::Init_Impl()
     875             : {
     876             :     aLineDist.SetSelectHdl(
     877           0 :         LINK( this, SvxStdParagraphTabPage, LineDistHdl_Impl ) );
     878             : 
     879           0 :     Link aLink = LINK( this, SvxStdParagraphTabPage, ELRLoseFocusHdl );
     880           0 :     aFLineIndent.SetLoseFocusHdl( aLink );
     881           0 :     aLeftIndent.SetLoseFocusHdl( aLink );
     882           0 :     aRightIndent.SetLoseFocusHdl( aLink );
     883             : 
     884           0 :     aLink = LINK( this, SvxStdParagraphTabPage, ModifyHdl_Impl );
     885           0 :     aFLineIndent.SetModifyHdl( aLink );
     886           0 :     aLeftIndent.SetModifyHdl( aLink );
     887           0 :     aRightIndent.SetModifyHdl( aLink );
     888           0 :     aTopDist.SetModifyHdl( aLink );
     889           0 :     aBottomDist.SetModifyHdl( aLink );
     890             : 
     891           0 :     aAutoCB.SetClickHdl( LINK( this, SvxStdParagraphTabPage, AutoHdl_Impl ));
     892           0 :     SfxItemPool* pPool = GetItemSet().GetPool();
     893             :     DBG_ASSERT( pPool, "Wo ist der Pool" );
     894             :     FieldUnit eUnit =
     895           0 :         MapToFieldUnit( pPool->GetMetric( GetWhich( SID_ATTR_LRSPACE ) ) );
     896             : 
     897           0 :     aTopDist.SetMax( aTopDist.Normalize( nAbst ), eUnit );
     898           0 :     aBottomDist.SetMax( aBottomDist.Normalize( nAbst ), eUnit );
     899             :     aLineDistAtMetricBox.SetMax(
     900           0 :         aLineDistAtMetricBox.Normalize( nAbst ), eUnit );
     901           0 : }
     902             : 
     903             : // -----------------------------------------------------------------------
     904             : 
     905           0 : void SvxStdParagraphTabPage::UpdateExample_Impl( sal_Bool bAll )
     906             : {
     907             :     aExampleWin.SetFirstLineOfst(
     908           0 :         (short)aFLineIndent.Denormalize( aFLineIndent.GetValue( FUNIT_TWIP ) ) );
     909             :     aExampleWin.SetLeftMargin(
     910           0 :         static_cast<long>(aLeftIndent.Denormalize( aLeftIndent.GetValue( FUNIT_TWIP ) ) ) );
     911             :     aExampleWin.SetRightMargin(
     912           0 :         static_cast<long>(aRightIndent.Denormalize( aRightIndent.GetValue( FUNIT_TWIP ) ) ) );
     913             :     aExampleWin.SetUpper(
     914           0 :         (sal_uInt16)aTopDist.Denormalize( aTopDist.GetValue( FUNIT_TWIP ) ) );
     915             :     aExampleWin.SetLower(
     916           0 :         (sal_uInt16)aBottomDist.Denormalize( aBottomDist.GetValue( FUNIT_TWIP ) ) );
     917             : 
     918             : 
     919             : 
     920           0 :     sal_uInt16 nPos = aLineDist.GetSelectEntryPos();
     921             : 
     922           0 :     switch ( nPos )
     923             :     {
     924             :         case LLINESPACE_1:
     925             :         case LLINESPACE_15:
     926             :         case LLINESPACE_2:
     927           0 :             aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos );
     928           0 :             break;
     929             : 
     930             :         case LLINESPACE_PROP:
     931             :             aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
     932             :                 (sal_uInt16)aLineDistAtPercentBox.Denormalize(
     933           0 :                 aLineDistAtPercentBox.GetValue() ) );
     934           0 :             break;
     935             : 
     936             :         case LLINESPACE_MIN:
     937             :         case LLINESPACE_DURCH:
     938             :         case LLINESPACE_FIX:
     939             :             aExampleWin.SetLineSpace( (SvxPrevLineSpace)nPos,
     940           0 :                 (sal_uInt16)GetCoreValue( aLineDistAtMetricBox, SFX_MAPUNIT_TWIP ) );
     941           0 :             break;
     942             :     }
     943           0 :     aExampleWin.Draw( bAll );
     944           0 : }
     945             : 
     946             : // -----------------------------------------------------------------------
     947             : 
     948           0 : void SvxStdParagraphTabPage::EnableRegisterMode()
     949             : {
     950           0 :     aRegisterCB.Show();
     951           0 :     aRegisterFL.Show();
     952           0 : }
     953             : 
     954           0 : void SvxStdParagraphTabPage::EnableContextualMode()
     955             : {
     956           0 :     aContextualCB.Show();
     957           0 : }
     958             : 
     959           0 : IMPL_LINK( SvxStdParagraphTabPage, AutoHdl_Impl, CheckBox*, pBox )
     960             : {
     961           0 :     sal_Bool bEnable = !pBox->IsChecked();
     962           0 :     aFLineLabel .Enable(bEnable);
     963           0 :     aFLineIndent.Enable(bEnable);
     964           0 :     return 0;
     965             : }
     966             : 
     967           0 : void SvxStdParagraphTabPage::SetPageWidth( sal_uInt16 nPageWidth )
     968             : {
     969           0 :     nWidth = nPageWidth;
     970           0 : }
     971             : 
     972             : 
     973           0 : void SvxStdParagraphTabPage::EnableAutoFirstLine()
     974             : {
     975           0 :     aAutoCB.Show();
     976           0 : }
     977             : 
     978             : 
     979           0 : void    SvxStdParagraphTabPage::EnableAbsLineDist(long nMinTwip)
     980             : {
     981           0 :     aLineDist.InsertEntry(sAbsDist);
     982           0 :     nMinFixDist = nMinTwip;
     983           0 : }
     984             : 
     985             : 
     986           0 : void    SvxStdParagraphTabPage::PageCreated(SfxAllItemSet aSet)
     987             : {
     988             : 
     989             : /* different bit represent call to different method of SvxStdParagraphTabPage
     990             :                         0x0001 --->EnableRelativeMode()
     991             :                         0x0002 --->EnableRegisterMode()
     992             :                         0x0004 --->EnableAutoFirstLine()
     993             :                         0x0008 --->EnableNegativeMode()
     994             :                         0x0010 --->EnableContextualMode()
     995             :             */
     996           0 :     SFX_ITEMSET_ARG (&aSet,pPageWidthItem,SfxUInt16Item,SID_SVXSTDPARAGRAPHTABPAGE_PAGEWIDTH,sal_False);
     997           0 :     SFX_ITEMSET_ARG (&aSet,pFlagSetItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_FLAGSET,sal_False);
     998           0 :     SFX_ITEMSET_ARG (&aSet,pLineDistItem,SfxUInt32Item,SID_SVXSTDPARAGRAPHTABPAGE_ABSLINEDIST,sal_False);
     999             : 
    1000           0 :     if (pPageWidthItem)
    1001           0 :         SetPageWidth(pPageWidthItem->GetValue());
    1002             : 
    1003           0 :     if (pFlagSetItem )
    1004           0 :         if (( 0x0001 & pFlagSetItem->GetValue())== 0x0001 )
    1005           0 :             EnableRelativeMode();
    1006             : 
    1007           0 :     if (pFlagSetItem)
    1008           0 :         if (( 0x0002 & pFlagSetItem->GetValue())== 0x0002 )
    1009           0 :                 EnableRegisterMode();
    1010             : 
    1011           0 :     if (pFlagSetItem)
    1012           0 :         if ( ( 0x0004 & pFlagSetItem->GetValue())== 0x0004 )
    1013           0 :             EnableAutoFirstLine();
    1014             : 
    1015           0 :     if(pLineDistItem)
    1016           0 :         EnableAbsLineDist(pLineDistItem->GetValue());
    1017             : 
    1018           0 :     if (pFlagSetItem)
    1019           0 :         if  (( 0x0008 & pFlagSetItem->GetValue()) == 0x0008 )
    1020           0 :                 EnableNegativeMode();
    1021             : 
    1022           0 :     if (pFlagSetItem)
    1023           0 :         if  (( 0x0010 & pFlagSetItem->GetValue()) == 0x0010 )
    1024           0 :                 EnableContextualMode();
    1025           0 : }
    1026             : 
    1027             : 
    1028             : #define LASTLINEPOS_DEFAULT     0
    1029             : #define LASTLINEPOS_LEFT        1
    1030             : 
    1031             : #define LASTLINECOUNT_OLD       3
    1032             : #define LASTLINECOUNT_NEW       4
    1033             : 
    1034             : // class SvxParaAlignTabPage ------------------------------------------------
    1035             : 
    1036           0 : SvxParaAlignTabPage::SvxParaAlignTabPage( Window* pParent, const SfxItemSet& rSet )
    1037           0 :     : SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_ALIGN_PARAGRAPH ),rSet),
    1038           0 :     aAlignFrm           ( this, CUI_RES( FL_ALIGN ) ),
    1039           0 :     aLeft               ( this, CUI_RES( BTN_LEFTALIGN ) ),
    1040           0 :     aRight              ( this, CUI_RES( BTN_RIGHTALIGN ) ),
    1041           0 :     aCenter             ( this, CUI_RES( BTN_CENTERALIGN ) ),
    1042           0 :     aJustify            ( this, CUI_RES( BTN_JUSTIFYALIGN ) ),
    1043           0 :     aLastLineFT         ( this, CUI_RES( FT_LASTLINE ) ),
    1044           0 :     aLastLineLB         ( this, CUI_RES( LB_LASTLINE ) ),
    1045           0 :     aExpandCB           ( this, CUI_RES( CB_EXPAND ) ),
    1046           0 :     aSnapToGridCB       ( this, CUI_RES( CB_SNAP ) ),
    1047           0 :     aExampleWin         ( this, CUI_RES( WN_EXAMPLE ) ),
    1048             : 
    1049           0 :     aVertAlignFL        ( this, CUI_RES( FL_VERTALIGN ) ),
    1050           0 :     aVertAlignFT        ( this, CUI_RES( FT_VERTALIGN ) ),
    1051           0 :     aVertAlignLB        ( this, CUI_RES( LB_VERTALIGN ) ),
    1052             : 
    1053           0 :     aPropertiesFL       ( this, CUI_RES( FL_PROPERTIES    )),
    1054           0 :     aTextDirectionFT    ( this, CUI_RES( FT_TEXTDIRECTION )),
    1055           0 :     aTextDirectionLB    ( this, CUI_RES( LB_TEXTDIRECTION ))
    1056             : {
    1057           0 :     SvtLanguageOptions aLangOptions;
    1058           0 :     sal_uInt16 nLastLinePos = LASTLINEPOS_DEFAULT;
    1059             : 
    1060           0 :     if ( aLangOptions.IsAsianTypographyEnabled() )
    1061             :     {
    1062           0 :         String sLeft(CUI_RES(ST_LEFTALIGN_ASIAN));
    1063           0 :         aLeft.SetText(sLeft);
    1064           0 :         aRight.SetText(String(CUI_RES(ST_RIGHTALIGN_ASIAN)));
    1065           0 :         sLeft = MnemonicGenerator::EraseAllMnemonicChars( sLeft );
    1066             : 
    1067           0 :         if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_OLD )
    1068             :         {
    1069           0 :             aLastLineLB.RemoveEntry( 0 );
    1070           0 :             aLastLineLB.InsertEntry( sLeft, 0 );
    1071             :         }
    1072             :         else
    1073           0 :             nLastLinePos = LASTLINEPOS_LEFT;
    1074             :     }
    1075             :     // remove "Default" or "Left" entry, depends on CJKOptions
    1076           0 :     if ( aLastLineLB.GetEntryCount() == LASTLINECOUNT_NEW )
    1077           0 :         aLastLineLB.RemoveEntry( nLastLinePos );
    1078             : 
    1079           0 :     FreeResource();
    1080           0 :     Link aLink = LINK( this, SvxParaAlignTabPage, AlignHdl_Impl );
    1081           0 :     aLeft.SetClickHdl( aLink );
    1082           0 :     aRight.SetClickHdl( aLink );
    1083           0 :     aCenter.SetClickHdl( aLink );
    1084           0 :     aJustify.SetClickHdl( aLink );
    1085           0 :     aLastLineLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, LastLineHdl_Impl ) );
    1086           0 :     aTextDirectionLB.SetSelectHdl( LINK( this, SvxParaAlignTabPage, TextDirectionHdl_Impl ) );
    1087             : 
    1088           0 :     sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
    1089           0 :     if(!(nHtmlMode & HTMLMODE_ON) || (0 != (nHtmlMode & HTMLMODE_SOME_STYLES)) )
    1090             :     {
    1091           0 :         if( aLangOptions.IsCTLFontEnabled() )
    1092             :         {
    1093           0 :             aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_LTR ), FRMDIR_HORI_LEFT_TOP );
    1094           0 :             aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_RTL ), FRMDIR_HORI_RIGHT_TOP );
    1095           0 :             aTextDirectionLB.InsertEntryValue( CUI_RESSTR( RID_SVXSTR_FRAMEDIR_SUPER ), FRMDIR_ENVIRONMENT );
    1096             : 
    1097           0 :             aPropertiesFL.Show();
    1098           0 :             aTextDirectionFT.Show();
    1099           0 :             aTextDirectionLB.Show();
    1100             :         }
    1101             :     }
    1102             : 
    1103           0 :     aExampleWin.SetAccessibleName(String(CUI_RES(STR_EXAMPLE)));
    1104             : 
    1105           0 : }
    1106             : 
    1107           0 : SvxParaAlignTabPage::~SvxParaAlignTabPage()
    1108             : {
    1109           0 : }
    1110             : 
    1111           0 : int SvxParaAlignTabPage::DeactivatePage( SfxItemSet* _pSet )
    1112             : {
    1113           0 :     if ( _pSet )
    1114           0 :         FillItemSet( *_pSet );
    1115           0 :     return LEAVE_PAGE;
    1116             : }
    1117             : 
    1118           0 : SfxTabPage* SvxParaAlignTabPage::Create( Window* pParent, const SfxItemSet& rSet )
    1119             : {
    1120           0 :     return new SvxParaAlignTabPage(pParent, rSet);
    1121             : }
    1122             : 
    1123           0 : sal_uInt16* SvxParaAlignTabPage::GetRanges()
    1124             : {
    1125           0 :     return pAlignRanges;
    1126             : 
    1127             : }
    1128             : 
    1129           0 : sal_Bool SvxParaAlignTabPage::FillItemSet( SfxItemSet& rOutSet )
    1130             : {
    1131           0 :     sal_Bool bModified = sal_False;
    1132             : 
    1133           0 :     bool bAdj = false, bChecked = false;
    1134           0 :     SvxAdjust eAdjust = SVX_ADJUST_LEFT;
    1135             : 
    1136           0 :     if ( aLeft.IsChecked() )
    1137             :     {
    1138           0 :         eAdjust = SVX_ADJUST_LEFT;
    1139           0 :         bAdj = !aLeft.GetSavedValue();
    1140           0 :         bChecked = true;
    1141             :     }
    1142           0 :     else if ( aRight.IsChecked() )
    1143             :     {
    1144           0 :         eAdjust = SVX_ADJUST_RIGHT;
    1145           0 :         bAdj = !aRight.GetSavedValue();
    1146           0 :         bChecked = true;
    1147             :     }
    1148           0 :     else if ( aCenter.IsChecked() )
    1149             :     {
    1150           0 :         eAdjust = SVX_ADJUST_CENTER;
    1151           0 :         bAdj = !aCenter.GetSavedValue();
    1152           0 :         bChecked = true;
    1153             :     }
    1154           0 :     else if ( aJustify.IsChecked() )
    1155             :     {
    1156           0 :         eAdjust = SVX_ADJUST_BLOCK;
    1157           0 :         bAdj = !aJustify.GetSavedValue() ||
    1158           0 :             aExpandCB.IsChecked() != aExpandCB.GetSavedValue() ||
    1159           0 :             aLastLineLB.GetSelectEntryPos() != aLastLineLB.GetSavedValue();
    1160           0 :         bChecked = true;
    1161             :     }
    1162           0 :     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
    1163             : 
    1164           0 :     if ( bAdj )
    1165             :     {
    1166             :         const SvxAdjustItem* pOld =
    1167           0 :             (const SvxAdjustItem*)GetOldItem( rOutSet, SID_ATTR_PARA_ADJUST );
    1168           0 :         SvxAdjust eOneWord = aExpandCB.IsChecked() ? SVX_ADJUST_BLOCK
    1169           0 :                                                    : SVX_ADJUST_LEFT;
    1170           0 :         sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos();
    1171           0 :         SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
    1172             : 
    1173           0 :         if ( 1 == nLBPos )
    1174           0 :             eLastBlock = SVX_ADJUST_CENTER;
    1175           0 :         else if ( 2 == nLBPos )
    1176           0 :             eLastBlock = SVX_ADJUST_BLOCK;
    1177             : 
    1178             :         bool bNothingWasChecked =
    1179           0 :             !aLeft.GetSavedValue() && !aRight.GetSavedValue() &&
    1180           0 :             !aCenter.GetSavedValue() && !aJustify.GetSavedValue();
    1181             : 
    1182           0 :         if ( !pOld || pOld->GetAdjust() != eAdjust ||
    1183           0 :              pOld->GetOneWord() != eOneWord ||
    1184           0 :              pOld->GetLastBlock() != eLastBlock ||
    1185             :              ( bChecked && bNothingWasChecked ) )
    1186             :         {
    1187           0 :             bModified = sal_True;
    1188             :             SvxAdjustItem aAdj(
    1189           0 :                 (const SvxAdjustItem&)GetItemSet().Get( _nWhich ) );
    1190           0 :             aAdj.SetAdjust( eAdjust );
    1191           0 :             aAdj.SetOneWord( eOneWord );
    1192           0 :             aAdj.SetLastBlock( eLastBlock );
    1193           0 :             rOutSet.Put( aAdj );
    1194             :         }
    1195             :     }
    1196           0 :     if(aSnapToGridCB.IsChecked() != aSnapToGridCB.GetSavedValue())
    1197             :     {
    1198           0 :         rOutSet.Put(SvxParaGridItem(aSnapToGridCB.IsChecked(), GetWhich( SID_ATTR_PARA_SNAPTOGRID )));
    1199           0 :         bModified = sal_True;
    1200             :     }
    1201           0 :     if(aVertAlignLB.GetSavedValue() != aVertAlignLB.GetSelectEntryPos())
    1202             :     {
    1203           0 :         rOutSet.Put(SvxParaVertAlignItem(aVertAlignLB.GetSelectEntryPos(), GetWhich( SID_PARA_VERTALIGN )));
    1204           0 :         bModified = sal_True;
    1205             :     }
    1206             : 
    1207           0 :     if( aTextDirectionLB.IsVisible() )
    1208             :     {
    1209           0 :         SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
    1210           0 :         if( eDir != aTextDirectionLB.GetSavedValue() )
    1211             :         {
    1212           0 :             rOutSet.Put( SvxFrameDirectionItem( eDir, GetWhich( SID_ATTR_FRAMEDIRECTION ) ) );
    1213           0 :             bModified = sal_True;
    1214             :         }
    1215             :     }
    1216             : 
    1217           0 :     return bModified;
    1218             : }
    1219             : 
    1220           0 : void SvxParaAlignTabPage::Reset( const SfxItemSet& rSet )
    1221             : {
    1222           0 :     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_ADJUST );
    1223           0 :     SfxItemState eItemState = rSet.GetItemState( _nWhich );
    1224             : 
    1225           0 :     sal_uInt16 nLBSelect = 0;
    1226           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
    1227             :     {
    1228           0 :         const SvxAdjustItem& rAdj = (const SvxAdjustItem&)rSet.Get( _nWhich );
    1229             : 
    1230           0 :         switch ( rAdj.GetAdjust() /*!!! ask VB rAdj.GetLastBlock()*/ )
    1231             :         {
    1232           0 :             case SVX_ADJUST_LEFT: aLeft.Check(); break;
    1233             : 
    1234           0 :             case SVX_ADJUST_RIGHT: aRight.Check(); break;
    1235             : 
    1236           0 :             case SVX_ADJUST_CENTER: aCenter.Check(); break;
    1237             : 
    1238           0 :             case SVX_ADJUST_BLOCK: aJustify.Check(); break;
    1239             :             default: ; //prevent warning
    1240             :         }
    1241           0 :         sal_Bool bEnable = aJustify.IsChecked();
    1242           0 :         aLastLineFT.Enable(bEnable);
    1243           0 :         aLastLineLB.Enable(bEnable);
    1244           0 :         aExpandCB  .Enable(bEnable);
    1245             : 
    1246           0 :         aExpandCB.Check(SVX_ADJUST_BLOCK == rAdj.GetOneWord());
    1247           0 :         switch(rAdj.GetLastBlock())
    1248             :         {
    1249           0 :             case SVX_ADJUST_LEFT:  nLBSelect = 0; break;
    1250             : 
    1251           0 :             case SVX_ADJUST_CENTER: nLBSelect = 1;  break;
    1252             : 
    1253           0 :             case SVX_ADJUST_BLOCK: nLBSelect = 2;  break;
    1254             :             default: ; //prevent warning
    1255             :         }
    1256             :     }
    1257             :     else
    1258             :     {
    1259           0 :         aLeft.Check( sal_False );
    1260           0 :         aRight.Check( sal_False );
    1261           0 :         aCenter.Check( sal_False );
    1262           0 :         aJustify.Check( sal_False );
    1263             :     }
    1264           0 :     aLastLineLB.SelectEntryPos(nLBSelect);
    1265             : 
    1266           0 :     sal_uInt16 nHtmlMode = GetHtmlMode_Impl(rSet);
    1267           0 :     if(nHtmlMode & HTMLMODE_ON)
    1268             :     {
    1269           0 :         aLastLineLB.Hide();
    1270           0 :         aLastLineFT.Hide();
    1271           0 :         aExpandCB.Hide();
    1272           0 :         if(!(nHtmlMode & HTMLMODE_FULL_STYLES) )
    1273           0 :             aJustify.Disable();
    1274           0 :         aSnapToGridCB.Show(sal_False);
    1275             :     }
    1276           0 :     _nWhich = GetWhich(SID_ATTR_PARA_SNAPTOGRID);
    1277           0 :     eItemState = rSet.GetItemState( _nWhich );
    1278           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
    1279             :     {
    1280           0 :         const SvxParaGridItem& rSnap = (const SvxParaGridItem&)rSet.Get( _nWhich );
    1281           0 :         aSnapToGridCB.Check(rSnap.GetValue());
    1282             :     }
    1283             : 
    1284           0 :     _nWhich = GetWhich( SID_PARA_VERTALIGN );
    1285           0 :     eItemState = rSet.GetItemState( _nWhich );
    1286             : 
    1287           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
    1288             :     {
    1289           0 :         aVertAlignLB.Show();
    1290           0 :         aVertAlignFL.Show();
    1291           0 :         aVertAlignFT.Show();
    1292             : 
    1293           0 :         const SvxParaVertAlignItem& rAlign = (const SvxParaVertAlignItem&)rSet.Get( _nWhich );
    1294           0 :         aVertAlignLB.SelectEntryPos(rAlign.GetValue());
    1295             :     }
    1296             : 
    1297           0 :     _nWhich = GetWhich( SID_ATTR_FRAMEDIRECTION );
    1298             :     //text direction
    1299           0 :     if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( _nWhich ) )
    1300             :     {
    1301           0 :         const SvxFrameDirectionItem& rFrameDirItem = ( const SvxFrameDirectionItem& ) rSet.Get( _nWhich );
    1302           0 :         aTextDirectionLB.SelectEntryValue( (SvxFrameDirection)rFrameDirItem.GetValue() );
    1303           0 :         aTextDirectionLB.SaveValue();
    1304             :     }
    1305             : 
    1306           0 :     aSnapToGridCB.SaveValue();
    1307           0 :     aVertAlignLB.SaveValue();
    1308           0 :     aLeft.SaveValue();
    1309           0 :     aRight.SaveValue();
    1310           0 :     aCenter.SaveValue();
    1311           0 :     aJustify.SaveValue();
    1312           0 :     aLastLineLB.SaveValue();
    1313           0 :     aExpandCB.SaveValue();
    1314             : 
    1315           0 :     UpdateExample_Impl(sal_True);
    1316           0 : }
    1317             : 
    1318           0 : IMPL_LINK_NOARG(SvxParaAlignTabPage, AlignHdl_Impl)
    1319             : {
    1320           0 :     sal_Bool bJustify = aJustify.IsChecked();
    1321           0 :     aLastLineFT.Enable(bJustify);
    1322           0 :     aLastLineLB.Enable(bJustify);
    1323           0 :     aExpandCB.Enable(bJustify);
    1324           0 :     UpdateExample_Impl(sal_False);
    1325           0 :     return 0;
    1326             : }
    1327             : 
    1328           0 : IMPL_LINK_NOARG(SvxParaAlignTabPage, LastLineHdl_Impl)
    1329             : {
    1330           0 :     UpdateExample_Impl(sal_False);
    1331           0 :     return 0;
    1332             : }
    1333             : 
    1334           0 : IMPL_LINK_NOARG(SvxParaAlignTabPage, TextDirectionHdl_Impl)
    1335             : {
    1336           0 :     SvxFrameDirection eDir = aTextDirectionLB.GetSelectEntryValue();
    1337           0 :     switch ( eDir )
    1338             :     {
    1339             :         // check the default alignment for this text direction
    1340           0 :         case FRMDIR_HORI_LEFT_TOP :     aLeft.Check( sal_True ); break;
    1341           0 :         case FRMDIR_HORI_RIGHT_TOP :    aRight.Check( sal_True ); break;
    1342           0 :         case FRMDIR_ENVIRONMENT :       /* do nothing */ break;
    1343             :         default:
    1344             :         {
    1345             :             SAL_WARN( "cui.tabpages", "SvxParaAlignTabPage::TextDirectionHdl_Impl(): other directions not supported" );
    1346             :         }
    1347             :     }
    1348             : 
    1349           0 :     return 0;
    1350             : }
    1351             : 
    1352           0 : void    SvxParaAlignTabPage::UpdateExample_Impl( sal_Bool bAll )
    1353             : {
    1354           0 :     if ( aLeft.IsChecked() )
    1355           0 :         aExampleWin.SetAdjust( SVX_ADJUST_LEFT );
    1356           0 :     else if ( aRight.IsChecked() )
    1357           0 :         aExampleWin.SetAdjust( SVX_ADJUST_RIGHT );
    1358           0 :     else if ( aCenter.IsChecked() )
    1359           0 :         aExampleWin.SetAdjust( SVX_ADJUST_CENTER );
    1360           0 :     else if ( aJustify.IsChecked() )
    1361             :     {
    1362           0 :         aExampleWin.SetAdjust( SVX_ADJUST_BLOCK );
    1363           0 :         SvxAdjust eLastBlock = SVX_ADJUST_LEFT;
    1364           0 :         sal_uInt16 nLBPos = aLastLineLB.GetSelectEntryPos();
    1365           0 :         if(nLBPos == 1)
    1366           0 :             eLastBlock = SVX_ADJUST_CENTER;
    1367           0 :         else if(nLBPos == 2)
    1368           0 :             eLastBlock = SVX_ADJUST_BLOCK;
    1369           0 :         aExampleWin.SetLastLine( eLastBlock );
    1370             :     }
    1371             : 
    1372           0 :     aExampleWin.Draw( bAll );
    1373           0 : }
    1374             : 
    1375           0 : void SvxParaAlignTabPage::EnableJustifyExt()
    1376             : {
    1377           0 :     aLastLineFT.Show();
    1378           0 :     aLastLineLB.Show();
    1379           0 :     aExpandCB  .Show();
    1380           0 :     SvtLanguageOptions aCJKOptions;
    1381           0 :     if(aCJKOptions.IsAsianTypographyEnabled())
    1382           0 :         aSnapToGridCB.Show();
    1383             : 
    1384           0 : }
    1385             : 
    1386           0 : void SvxParaAlignTabPage::PageCreated (SfxAllItemSet aSet)
    1387             : {
    1388           0 :     SFX_ITEMSET_ARG (&aSet,pBoolItem,SfxBoolItem,SID_SVXPARAALIGNTABPAGE_ENABLEJUSTIFYEXT,sal_False);
    1389           0 :     if (pBoolItem)
    1390           0 :         if(pBoolItem->GetValue())
    1391           0 :             EnableJustifyExt();
    1392           0 : }
    1393             : 
    1394           0 : SfxTabPage* SvxExtParagraphTabPage::Create( Window* pParent,
    1395             :                                             const SfxItemSet& rSet )
    1396             : {
    1397           0 :     return new SvxExtParagraphTabPage( pParent, rSet );
    1398             : }
    1399             : 
    1400             : // -----------------------------------------------------------------------
    1401             : 
    1402           0 : sal_Bool SvxExtParagraphTabPage::FillItemSet( SfxItemSet& rOutSet )
    1403             : {
    1404           0 :     sal_Bool bModified = sal_False;
    1405           0 :     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
    1406           0 :     const TriState eHyphenState = aHyphenBox.GetState();
    1407           0 :     const SfxPoolItem* pOld = GetOldItem( rOutSet, SID_ATTR_PARA_HYPHENZONE );
    1408             : 
    1409           0 :     if ( eHyphenState != aHyphenBox.GetSavedValue()     ||
    1410           0 :          aExtHyphenBeforeBox.IsValueModified()          ||
    1411           0 :          aExtHyphenAfterBox.IsValueModified()           ||
    1412           0 :          aMaxHyphenEdit.IsValueModified() )
    1413             :     {
    1414             :         SvxHyphenZoneItem aHyphen(
    1415           0 :             (const SvxHyphenZoneItem&)GetItemSet().Get( _nWhich ) );
    1416           0 :         aHyphen.SetHyphen( eHyphenState == STATE_CHECK );
    1417             : 
    1418           0 :         if ( eHyphenState == STATE_CHECK )
    1419             :         {
    1420           0 :             aHyphen.GetMinLead() = (sal_uInt8)aExtHyphenBeforeBox.GetValue();
    1421           0 :             aHyphen.GetMinTrail() = (sal_uInt8)aExtHyphenAfterBox.GetValue();
    1422             :         }
    1423           0 :         aHyphen.GetMaxHyphens() = (sal_uInt8)aMaxHyphenEdit.GetValue();
    1424             : 
    1425           0 :         if ( !pOld ||
    1426           0 :             !( *(SvxHyphenZoneItem*)pOld == aHyphen ) ||
    1427           0 :                 eHyphenState != aHyphenBox.GetSavedValue())
    1428             :         {
    1429           0 :             rOutSet.Put( aHyphen );
    1430           0 :             bModified = sal_True;
    1431           0 :         }
    1432             :     }
    1433             : 
    1434           0 :     if (aPagenumEdit.IsEnabled() && aPagenumEdit.IsValueModified())
    1435             :     {
    1436             :         SfxUInt16Item aPageNum( SID_ATTR_PARA_PAGENUM,
    1437           0 :                                 (sal_uInt16)aPagenumEdit.GetValue() );
    1438             : 
    1439           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGENUM );
    1440             : 
    1441           0 :         if ( !pOld || ( (const SfxUInt16Item*)pOld )->GetValue() != aPageNum.GetValue() )
    1442             :         {
    1443           0 :             rOutSet.Put( aPageNum );
    1444           0 :             bModified = sal_True;
    1445           0 :         }
    1446             :     }
    1447             : 
    1448             :     // pagebreak
    1449             : 
    1450           0 :     TriState eState = aApplyCollBtn.GetState();
    1451           0 :     bool bIsPageModel = false;
    1452             : 
    1453           0 :     _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
    1454           0 :     String sPage;
    1455           0 :     if ( eState != aApplyCollBtn.GetSavedValue() ||
    1456             :          ( STATE_CHECK == eState &&
    1457           0 :            aApplyCollBox.GetSelectEntryPos() != aApplyCollBox.GetSavedValue() ) )
    1458             :     {
    1459           0 :         if ( eState == STATE_CHECK )
    1460             :         {
    1461           0 :             sPage = aApplyCollBox.GetSelectEntry();
    1462           0 :             bIsPageModel = 0 != sPage.Len();
    1463             :         }
    1464           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_MODEL );
    1465             : 
    1466           0 :         if ( !pOld || ( (const SvxPageModelItem*)pOld )->GetValue() != sPage )
    1467             :         {
    1468           0 :             rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) );
    1469           0 :             bModified = sal_True;
    1470             :         }
    1471             :         else
    1472           0 :             bIsPageModel = false;
    1473             :     }
    1474           0 :     else if(STATE_CHECK == eState && aApplyCollBtn.IsEnabled())
    1475           0 :         bIsPageModel = true;
    1476             :     else
    1477           0 :         rOutSet.Put( SvxPageModelItem( sPage, sal_False, _nWhich ) );
    1478             : 
    1479           0 :     _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
    1480             : 
    1481           0 :     if ( bIsPageModel )
    1482             :         // if PageModel is turned on, always turn off PageBreak
    1483           0 :         rOutSet.Put( SvxFmtBreakItem( SVX_BREAK_NONE, _nWhich ) );
    1484             :     else
    1485             :     {
    1486           0 :         eState = aPageBreakBox.GetState();
    1487           0 :         SfxItemState eModelState = GetItemSet().GetItemState(SID_ATTR_PARA_MODEL, sal_False);
    1488             : 
    1489           0 :         if ( (eModelState == SFX_ITEM_SET && STATE_CHECK == aPageBreakBox.GetState()) ||
    1490           0 :              eState != aPageBreakBox.GetSavedValue()                ||
    1491           0 :              aBreakTypeLB.GetSelectEntryPos() != aBreakTypeLB.GetSavedValue()   ||
    1492           0 :              aBreakPositionLB.GetSelectEntryPos() != aBreakPositionLB.GetSavedValue() )
    1493             :         {
    1494             :             const SvxFmtBreakItem rOldBreak(
    1495           0 :                     (const SvxFmtBreakItem&)GetItemSet().Get( _nWhich ));
    1496           0 :             SvxFmtBreakItem aBreak(rOldBreak.GetBreak(), rOldBreak.Which());
    1497             : 
    1498           0 :             switch ( eState )
    1499             :             {
    1500             :                 case STATE_CHECK:
    1501             :                 {
    1502           0 :                     sal_Bool bBefore = aBreakPositionLB.GetSelectEntryPos() == 0;
    1503             : 
    1504           0 :                     if ( aBreakTypeLB.GetSelectEntryPos() == 0 )
    1505             :                     {
    1506           0 :                         if ( bBefore )
    1507           0 :                             aBreak.SetValue( SVX_BREAK_PAGE_BEFORE );
    1508             :                         else
    1509           0 :                             aBreak.SetValue( SVX_BREAK_PAGE_AFTER );
    1510             :                     }
    1511             :                     else
    1512             :                     {
    1513           0 :                         if ( bBefore )
    1514           0 :                             aBreak.SetValue( SVX_BREAK_COLUMN_BEFORE );
    1515             :                         else
    1516           0 :                             aBreak.SetValue( SVX_BREAK_COLUMN_AFTER );
    1517             :                     }
    1518           0 :                     break;
    1519             :                 }
    1520             : 
    1521             :                 case STATE_NOCHECK:
    1522           0 :                     aBreak.SetValue( SVX_BREAK_NONE );
    1523           0 :                     break;
    1524             :                 default: ; //prevent warning
    1525             :             }
    1526           0 :             pOld = GetOldItem( rOutSet, SID_ATTR_PARA_PAGEBREAK );
    1527             : 
    1528           0 :             if ( eState != aPageBreakBox.GetSavedValue()                ||
    1529           0 :                     !pOld || !( *(const SvxFmtBreakItem*)pOld == aBreak ) )
    1530             :             {
    1531           0 :                 bModified = sal_True;
    1532           0 :                 rOutSet.Put( aBreak );
    1533           0 :             }
    1534             :         }
    1535             :     }
    1536             : 
    1537             : 
    1538             :     // paragraph split
    1539           0 :     _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
    1540           0 :     eState = aKeepTogetherBox.GetState();
    1541             : 
    1542           0 :     if ( eState != aKeepTogetherBox.GetSavedValue() )
    1543             :     {
    1544           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_SPLIT );
    1545             : 
    1546           0 :         if ( !pOld || ( (const SvxFmtSplitItem*)pOld )->GetValue() !=
    1547             :                       ( eState == STATE_NOCHECK ) )
    1548             :         {
    1549           0 :             rOutSet.Put( SvxFmtSplitItem( eState == STATE_NOCHECK, _nWhich ) );
    1550           0 :             bModified = sal_True;
    1551             :         }
    1552             :     }
    1553             : 
    1554             :     // keep paragraphs
    1555           0 :     _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
    1556           0 :     eState = aKeepParaBox.GetState();
    1557             : 
    1558           0 :     if ( eState != aKeepParaBox.GetSavedValue() )
    1559             :     {
    1560           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_KEEP );
    1561             : 
    1562             :         // if the status has changed, putting is necessary
    1563           0 :         rOutSet.Put( SvxFmtKeepItem( eState == STATE_CHECK, _nWhich ) );
    1564           0 :         bModified = sal_True;
    1565             :     }
    1566             : 
    1567             :     // widows and orphans
    1568           0 :     _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
    1569           0 :     eState = aWidowBox.GetState();
    1570             : 
    1571           0 :     if ( eState != aWidowBox.GetSavedValue() ||
    1572           0 :          aWidowRowNo.IsValueModified() )
    1573             :     {
    1574             :         SvxWidowsItem rItem( eState == STATE_CHECK ?
    1575           0 :                              (sal_uInt8)aWidowRowNo.GetValue() : 0, _nWhich );
    1576           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_WIDOWS );
    1577             : 
    1578           0 :         if ( eState != aWidowBox.GetSavedValue() || !pOld || !( *(const SvxWidowsItem*)pOld == rItem ) )
    1579             :         {
    1580           0 :             rOutSet.Put( rItem );
    1581           0 :             bModified = sal_True;
    1582           0 :         }
    1583             :     }
    1584             : 
    1585           0 :     _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
    1586           0 :     eState = aOrphanBox.GetState();
    1587             : 
    1588           0 :     if ( eState != aOrphanBox.GetSavedValue() ||
    1589           0 :          aOrphanRowNo.IsValueModified() )
    1590             :     {
    1591             :         SvxOrphansItem rItem( eState == STATE_CHECK ?
    1592           0 :                              (sal_uInt8)aOrphanRowNo.GetValue() : 0, _nWhich );
    1593           0 :         pOld = GetOldItem( rOutSet, SID_ATTR_PARA_ORPHANS );
    1594             : 
    1595           0 :         if ( eState != aOrphanBox.GetSavedValue() ||
    1596             :                 !pOld ||
    1597           0 :                     !( *(const SvxOrphansItem*)pOld == rItem ) )
    1598             :         {
    1599           0 :             rOutSet.Put( rItem );
    1600           0 :             bModified = sal_True;
    1601           0 :         }
    1602             :     }
    1603             : 
    1604           0 :     return bModified;
    1605             : }
    1606             : 
    1607             : // -----------------------------------------------------------------------
    1608             : 
    1609           0 : void SvxExtParagraphTabPage::Reset( const SfxItemSet& rSet )
    1610             : {
    1611           0 :     sal_uInt16 _nWhich = GetWhich( SID_ATTR_PARA_HYPHENZONE );
    1612           0 :     SfxItemState eItemState = rSet.GetItemState( _nWhich );
    1613             : 
    1614           0 :     sal_Bool bItemAvailable = eItemState >= SFX_ITEM_AVAILABLE;
    1615           0 :     sal_Bool bIsHyphen = sal_False;
    1616           0 :     if( !bHtmlMode && bItemAvailable )
    1617             :     {
    1618             :         const SvxHyphenZoneItem& rHyphen =
    1619           0 :             (const SvxHyphenZoneItem&)rSet.Get( _nWhich );
    1620           0 :         aHyphenBox.EnableTriState( sal_False );
    1621             : 
    1622           0 :         bIsHyphen = rHyphen.IsHyphen();
    1623           0 :         aHyphenBox.SetState( bIsHyphen ? STATE_CHECK : STATE_NOCHECK );
    1624             : 
    1625           0 :         aExtHyphenBeforeBox.SetValue( rHyphen.GetMinLead() );
    1626           0 :         aExtHyphenAfterBox.SetValue( rHyphen.GetMinTrail() );
    1627           0 :         aMaxHyphenEdit.SetValue( rHyphen.GetMaxHyphens() );
    1628             :     }
    1629             :     else
    1630             :     {
    1631           0 :         aHyphenBox.SetState( STATE_DONTKNOW );
    1632             :     }
    1633           0 :     sal_Bool bEnable = bItemAvailable && bIsHyphen;
    1634           0 :     aExtHyphenBeforeBox.Enable(bEnable);
    1635           0 :     aExtHyphenAfterBox.Enable(bEnable);
    1636           0 :     aBeforeText.Enable(bEnable);
    1637           0 :     aAfterText.Enable(bEnable);
    1638           0 :     aMaxHyphenLabel.Enable(bEnable);
    1639           0 :     aMaxHyphenEdit.Enable(bEnable);
    1640             : 
    1641           0 :     _nWhich = GetWhich( SID_ATTR_PARA_PAGENUM );
    1642             : 
    1643           0 :     if ( rSet.GetItemState(_nWhich) >= SFX_ITEM_AVAILABLE )
    1644             :     {
    1645             :         const sal_uInt16 nPageNum =
    1646           0 :             ( (const SfxUInt16Item&)rSet.Get( _nWhich ) ).GetValue();
    1647           0 :         aPagenumEdit.SetValue( nPageNum );
    1648             :     }
    1649             : 
    1650           0 :     if ( bPageBreak )
    1651             :     {
    1652             :         // first handle PageModel
    1653           0 :         _nWhich = GetWhich( SID_ATTR_PARA_MODEL );
    1654           0 :         sal_Bool bIsPageModel = sal_False;
    1655           0 :         eItemState = rSet.GetItemState( _nWhich );
    1656             : 
    1657           0 :         if ( eItemState >= SFX_ITEM_SET )
    1658             :         {
    1659           0 :             aApplyCollBtn.EnableTriState( sal_False );
    1660             : 
    1661             :             const SvxPageModelItem& rModel =
    1662           0 :                 (const SvxPageModelItem&)rSet.Get( _nWhich );
    1663           0 :             String aStr( rModel.GetValue() );
    1664             : 
    1665           0 :             if ( aStr.Len() &&
    1666           0 :                  aApplyCollBox.GetEntryPos( aStr ) != LISTBOX_ENTRY_NOTFOUND )
    1667             :             {
    1668           0 :                 aApplyCollBox.SelectEntry( aStr );
    1669           0 :                 aApplyCollBtn.SetState( STATE_CHECK );
    1670           0 :                 bIsPageModel = sal_True;
    1671             : 
    1672           0 :                 aPageBreakBox.Enable();
    1673           0 :                 aPageBreakBox.EnableTriState( sal_False );
    1674           0 :                 aBreakTypeFT.Enable();
    1675           0 :                 aBreakTypeLB.Enable();
    1676           0 :                 aBreakPositionFT.Enable();
    1677           0 :                 aBreakPositionLB.Enable();
    1678           0 :                 aApplyCollBtn.Enable();
    1679           0 :                 aPageBreakBox.SetState( STATE_CHECK );
    1680             : 
    1681             :                 //select page break
    1682           0 :                 aBreakTypeLB.SelectEntryPos(0);
    1683             :                 //select break before
    1684           0 :                 aBreakPositionLB.SelectEntryPos(0);
    1685             :             }
    1686             :             else
    1687             :             {
    1688           0 :                 aApplyCollBox.SetNoSelection();
    1689           0 :                 aApplyCollBtn.SetState( STATE_NOCHECK );
    1690           0 :             }
    1691             :         }
    1692           0 :         else if ( SFX_ITEM_DONTCARE == eItemState )
    1693             :         {
    1694           0 :             aApplyCollBtn.EnableTriState( sal_True );
    1695           0 :             aApplyCollBtn.SetState( STATE_DONTKNOW );
    1696           0 :             aApplyCollBox.SetNoSelection();
    1697             :         }
    1698             :         else
    1699             :         {
    1700           0 :             aApplyCollBtn.Enable(sal_False);
    1701           0 :             aApplyCollBox.Enable(sal_False);
    1702           0 :             aPagenumEdit.Enable(sal_False);
    1703           0 :             aPagenumText.Enable(sal_False);
    1704             :         }
    1705             : 
    1706           0 :         if ( !bIsPageModel )
    1707             :         {
    1708           0 :             _nWhich = GetWhich( SID_ATTR_PARA_PAGEBREAK );
    1709           0 :             eItemState = rSet.GetItemState( _nWhich );
    1710             : 
    1711           0 :             if ( eItemState >= SFX_ITEM_AVAILABLE )
    1712             :             {
    1713             :                 const SvxFmtBreakItem& rPageBreak =
    1714           0 :                     (const SvxFmtBreakItem&)rSet.Get( _nWhich );
    1715             : 
    1716           0 :                 SvxBreak eBreak = (SvxBreak)rPageBreak.GetValue();
    1717             : 
    1718             :                 // PageBreak not via CTRL-RETURN,
    1719             :                 // then CheckBox can be freed
    1720           0 :                 aPageBreakBox.Enable();
    1721           0 :                 aPageBreakBox.EnableTriState( sal_False );
    1722           0 :                 aBreakTypeFT.Enable();
    1723           0 :                 aBreakTypeLB.Enable();
    1724           0 :                 aBreakPositionFT.Enable();
    1725           0 :                 aBreakPositionLB.Enable();
    1726             : 
    1727           0 :                 aPageBreakBox.SetState( STATE_CHECK );
    1728             : 
    1729             :                 sal_Bool _bEnable =     eBreak != SVX_BREAK_NONE &&
    1730             :                                 eBreak != SVX_BREAK_COLUMN_BEFORE &&
    1731           0 :                                 eBreak != SVX_BREAK_COLUMN_AFTER;
    1732           0 :                 aApplyCollBtn.Enable(_bEnable);
    1733           0 :                 if(!_bEnable)
    1734             :                 {
    1735           0 :                     aApplyCollBox.Enable(_bEnable);
    1736           0 :                     aPagenumEdit.Enable(_bEnable);
    1737             :                 }
    1738             : 
    1739           0 :                 if ( eBreak == SVX_BREAK_NONE )
    1740           0 :                     aPageBreakBox.SetState( STATE_NOCHECK );
    1741             : 
    1742           0 :                 sal_uInt16 nType = 0; // selection position in break type ListBox : Page
    1743           0 :                 sal_uInt16 nPosition = 0; //  selection position in break position ListBox : Before
    1744           0 :                 switch ( eBreak )
    1745             :                 {
    1746             :                     case SVX_BREAK_PAGE_BEFORE:
    1747           0 :                         break;
    1748             :                     case SVX_BREAK_PAGE_AFTER:
    1749           0 :                         nPosition = 1;
    1750           0 :                         break;
    1751             :                     case SVX_BREAK_COLUMN_BEFORE:
    1752           0 :                         nType = 1;
    1753           0 :                         break;
    1754             :                     case SVX_BREAK_COLUMN_AFTER:
    1755           0 :                         nType = 1;
    1756           0 :                         nPosition = 1;
    1757           0 :                         break;
    1758             :                     default: ;//prevent warning
    1759             :                 }
    1760           0 :                 aBreakTypeLB.SelectEntryPos(nType);
    1761           0 :                 aBreakPositionLB.SelectEntryPos(nPosition);
    1762             :             }
    1763           0 :             else if ( SFX_ITEM_DONTCARE == eItemState )
    1764           0 :                 aPageBreakBox.SetState( STATE_DONTKNOW );
    1765             :             else
    1766             :             {
    1767           0 :                 aPageBreakBox.Enable(sal_False);
    1768           0 :                 aBreakTypeFT.Enable(sal_False);
    1769           0 :                 aBreakTypeLB.Enable(sal_False);
    1770           0 :                 aBreakPositionFT.Enable(sal_False);
    1771           0 :                 aBreakPositionLB.Enable(sal_False);
    1772             :             }
    1773             :         }
    1774             : 
    1775           0 :         PageBreakPosHdl_Impl( &aBreakPositionLB );
    1776           0 :         PageBreakHdl_Impl( &aPageBreakBox );
    1777             :     }
    1778             : 
    1779           0 :     _nWhich = GetWhich( SID_ATTR_PARA_KEEP );
    1780           0 :     eItemState = rSet.GetItemState( _nWhich );
    1781             : 
    1782           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
    1783             :     {
    1784           0 :         aKeepParaBox.EnableTriState( sal_False );
    1785             :         const SvxFmtKeepItem& rKeep =
    1786           0 :             (const SvxFmtKeepItem&)rSet.Get( _nWhich );
    1787             : 
    1788           0 :         if ( rKeep.GetValue() )
    1789           0 :             aKeepParaBox.SetState( STATE_CHECK );
    1790             :         else
    1791           0 :             aKeepParaBox.SetState( STATE_NOCHECK );
    1792             :     }
    1793           0 :     else if ( SFX_ITEM_DONTCARE == eItemState )
    1794           0 :         aKeepParaBox.SetState( STATE_DONTKNOW );
    1795             :     else
    1796           0 :         aKeepParaBox.Enable(sal_False);
    1797             : 
    1798           0 :     _nWhich = GetWhich( SID_ATTR_PARA_SPLIT );
    1799           0 :     eItemState = rSet.GetItemState( _nWhich );
    1800             : 
    1801           0 :     if ( eItemState >= SFX_ITEM_AVAILABLE )
    1802             :     {
    1803             :         const SvxFmtSplitItem& rSplit =
    1804           0 :             (const SvxFmtSplitItem&)rSet.Get( _nWhich );
    1805           0 :         aKeepTogetherBox.EnableTriState( sal_False );
    1806             : 
    1807           0 :         if ( !rSplit.GetValue() )
    1808           0 :             aKeepTogetherBox.SetState( STATE_CHECK );
    1809             :         else
    1810             :         {
    1811           0 :             aKeepTogetherBox.SetState( STATE_NOCHECK );
    1812             : 
    1813             :             // widows and orphans
    1814           0 :             aWidowBox.Enable();
    1815           0 :             _nWhich = GetWhich( SID_ATTR_PARA_WIDOWS );
    1816           0 :             SfxItemState eTmpState = rSet.GetItemState( _nWhich );
    1817             : 
    1818           0 :             if ( eTmpState >= SFX_ITEM_AVAILABLE )
    1819             :             {
    1820             :                 const SvxWidowsItem& rWidow =
    1821           0 :                     (const SvxWidowsItem&)rSet.Get( _nWhich );
    1822           0 :                 aWidowBox.EnableTriState( sal_False );
    1823           0 :                 const sal_uInt16 nLines = rWidow.GetValue();
    1824             : 
    1825           0 :                 sal_Bool _bEnable = nLines > 0;
    1826           0 :                 aWidowRowNo.SetValue( aWidowRowNo.Normalize( nLines ) );
    1827           0 :                 aWidowBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
    1828           0 :                 aWidowRowNo.Enable(_bEnable);
    1829           0 :                 aWidowRowLabel.Enable(_bEnable);
    1830             : 
    1831             :             }
    1832           0 :             else if ( SFX_ITEM_DONTCARE == eTmpState )
    1833           0 :                 aWidowBox.SetState( STATE_DONTKNOW );
    1834             :             else
    1835           0 :                 aWidowBox.Enable(sal_False);
    1836             : 
    1837           0 :             aOrphanBox.Enable();
    1838           0 :             _nWhich = GetWhich( SID_ATTR_PARA_ORPHANS );
    1839           0 :             eTmpState = rSet.GetItemState( _nWhich );
    1840             : 
    1841           0 :             if ( eTmpState >= SFX_ITEM_AVAILABLE )
    1842             :             {
    1843             :                 const SvxOrphansItem& rOrphan =
    1844           0 :                     (const SvxOrphansItem&)rSet.Get( _nWhich );
    1845           0 :                 const sal_uInt16 nLines = rOrphan.GetValue();
    1846           0 :                 aOrphanBox.EnableTriState( sal_False );
    1847             : 
    1848           0 :                 sal_Bool _bEnable = nLines > 0;
    1849           0 :                 aOrphanBox.SetState( _bEnable ? STATE_CHECK : STATE_NOCHECK);
    1850           0 :                 aOrphanRowNo.SetValue( aOrphanRowNo.Normalize( nLines ) );
    1851           0 :                 aOrphanRowNo.Enable(_bEnable);
    1852           0 :                 aOrphanRowLabel.Enable(_bEnable);
    1853             : 
    1854             :             }
    1855           0 :             else if ( SFX_ITEM_DONTCARE == eTmpState )
    1856           0 :                 aOrphanBox.SetState( STATE_DONTKNOW );
    1857             :             else
    1858           0 :                 aOrphanBox.Enable(sal_False);
    1859             :         }
    1860             :     }
    1861           0 :     else if ( SFX_ITEM_DONTCARE == eItemState )
    1862           0 :         aKeepTogetherBox.SetState( STATE_DONTKNOW );
    1863             :     else
    1864           0 :         aKeepTogetherBox.Enable(sal_False);
    1865             : 
    1866             :     // so that everything is enabled correctly
    1867           0 :     KeepTogetherHdl_Impl( 0 );
    1868           0 :     WidowHdl_Impl( 0 );
    1869           0 :     OrphanHdl_Impl( 0 );
    1870             : 
    1871           0 :     aHyphenBox.SaveValue();
    1872           0 :     aExtHyphenBeforeBox.SaveValue();
    1873           0 :     aExtHyphenAfterBox.SaveValue();
    1874           0 :     aMaxHyphenEdit.SaveValue();
    1875           0 :     aPageBreakBox.SaveValue();
    1876           0 :     aBreakPositionLB.SaveValue();
    1877           0 :     aBreakTypeLB.SaveValue();
    1878           0 :     aApplyCollBtn.SaveValue();
    1879           0 :     aApplyCollBox.SaveValue();
    1880           0 :     aPagenumEdit.SaveValue();
    1881           0 :     aKeepTogetherBox.SaveValue();
    1882           0 :     aKeepParaBox.SaveValue();
    1883           0 :     aWidowBox.SaveValue();
    1884           0 :     aOrphanBox.SaveValue();
    1885           0 : }
    1886             : 
    1887             : // -----------------------------------------------------------------------
    1888             : 
    1889           0 : int SvxExtParagraphTabPage::DeactivatePage( SfxItemSet* _pSet )
    1890             : {
    1891           0 :     if ( _pSet )
    1892           0 :         FillItemSet( *_pSet );
    1893           0 :     return LEAVE_PAGE;
    1894             : }
    1895             : 
    1896             : // -----------------------------------------------------------------------
    1897             : 
    1898           0 : void SvxExtParagraphTabPage::DisablePageBreak()
    1899             : {
    1900           0 :     bPageBreak = sal_False;
    1901           0 :     aPageBreakBox.Enable(sal_False);
    1902           0 :     aBreakTypeLB.RemoveEntry(0);
    1903           0 :     aBreakPositionFT.Enable(sal_False);
    1904           0 :     aBreakPositionLB.Enable(sal_False);
    1905           0 :     aApplyCollBtn.Enable(sal_False);
    1906           0 :     aApplyCollBox.Enable(sal_False);
    1907           0 :     aPagenumEdit.Enable(sal_False);
    1908           0 : }
    1909             : 
    1910             : // -----------------------------------------------------------------------
    1911             : 
    1912           0 : SvxExtParagraphTabPage::SvxExtParagraphTabPage( Window* pParent, const SfxItemSet& rAttr ) :
    1913             : 
    1914           0 :     SfxTabPage( pParent, CUI_RES( RID_SVXPAGE_EXT_PARAGRAPH ), rAttr ),
    1915             : 
    1916           0 :     aExtFL              ( this, CUI_RES( FL_HYPHEN ) ),
    1917           0 :     aHyphenBox          ( this, CUI_RES( BTN_HYPHEN ) ),
    1918           0 :     aBeforeText         ( this, CUI_RES( FT_HYPHENBEFORE ) ),
    1919           0 :     aExtHyphenBeforeBox ( this, CUI_RES( ED_HYPHENBEFORE ) ),
    1920           0 :     aAfterText          ( this, CUI_RES( FT_HYPHENAFTER ) ),
    1921           0 :     aExtHyphenAfterBox  ( this, CUI_RES( ED_HYPHENAFTER ) ),
    1922           0 :     aMaxHyphenLabel     ( this, CUI_RES( FT_MAXHYPH ) ),
    1923           0 :     aMaxHyphenEdit      ( this, CUI_RES( ED_MAXHYPH ) ),
    1924           0 :     aBreaksFL           ( this, CUI_RES( FL_BREAKS ) ),
    1925           0 :     aPageBreakBox       ( this, CUI_RES( BTN_PAGEBREAK ) ),
    1926           0 :     aBreakTypeFT        ( this, CUI_RES( FT_BREAKTYPE     )),
    1927           0 :     aBreakTypeLB        ( this, CUI_RES( LB_BREAKTYPE     )),
    1928           0 :     aBreakPositionFT    ( this, CUI_RES( FT_BREAKPOSITION )),
    1929           0 :     aBreakPositionLB    ( this, CUI_RES( LB_BREAKPOSITION )),
    1930           0 :     aApplyCollBtn       ( this, CUI_RES( BTN_PAGECOLL ) ),
    1931           0 :     aApplyCollBox       ( this, CUI_RES( LB_PAGECOLL ) ),
    1932           0 :     aPagenumText        ( this, CUI_RES( FT_PAGENUM ) ),
    1933           0 :     aPagenumEdit        ( this, CUI_RES( ED_PAGENUM ) ),
    1934           0 :     aExtendFL           ( this, CUI_RES( FL_OPTIONS ) ),
    1935           0 :     aKeepTogetherBox    ( this, CUI_RES( BTN_KEEPTOGETHER ) ),
    1936           0 :     aKeepParaBox        ( this, CUI_RES( CB_KEEPTOGETHER ) ),
    1937           0 :     aOrphanBox          ( this, CUI_RES( BTN_ORPHANS ) ),
    1938           0 :     aOrphanRowNo        ( this, CUI_RES( ED_ORPHANS ) ),
    1939           0 :     aOrphanRowLabel     ( this, CUI_RES( FT_ORPHANS ) ),
    1940           0 :     aWidowBox           ( this, CUI_RES( BTN_WIDOWS ) ),
    1941           0 :     aWidowRowNo         ( this, CUI_RES( ED_WIDOWS ) ),
    1942           0 :     aWidowRowLabel      ( this, CUI_RES( FT_WIDOWS ) ),
    1943             :     bPageBreak  ( sal_True ),
    1944             :     bHtmlMode   ( sal_False ),
    1945           0 :     nStdPos     ( 0 )
    1946             : {
    1947           0 :     FreeResource();
    1948             : 
    1949           0 :     aApplyCollBox.SetAccessibleRelationLabeledBy(&aApplyCollBtn);
    1950           0 :     aApplyCollBox.SetAccessibleName(String(CUI_RES(STR_PAGE_STYLE)));
    1951           0 :     aOrphanRowNo.SetAccessibleRelationLabeledBy(&aOrphanBox);
    1952           0 :     aWidowRowNo.SetAccessibleRelationLabeledBy(&aWidowBox);
    1953             : 
    1954             :     // this page needs ExchangeSupport
    1955           0 :     SetExchangeSupport();
    1956             : 
    1957           0 :     aHyphenBox.SetClickHdl(         LINK( this, SvxExtParagraphTabPage, HyphenClickHdl_Impl ) );
    1958           0 :     aPageBreakBox.SetClickHdl(      LINK( this, SvxExtParagraphTabPage, PageBreakHdl_Impl ) );
    1959           0 :     aKeepTogetherBox.SetClickHdl(   LINK( this, SvxExtParagraphTabPage, KeepTogetherHdl_Impl ) );
    1960           0 :     aWidowBox.SetClickHdl(          LINK( this, SvxExtParagraphTabPage, WidowHdl_Impl ) );
    1961           0 :     aOrphanBox.SetClickHdl(         LINK( this, SvxExtParagraphTabPage, OrphanHdl_Impl ) );
    1962           0 :     aApplyCollBtn.SetClickHdl(      LINK( this, SvxExtParagraphTabPage, ApplyCollClickHdl_Impl ) );
    1963           0 :     aBreakTypeLB.SetSelectHdl(      LINK( this, SvxExtParagraphTabPage, PageBreakTypeHdl_Impl ) );
    1964           0 :     aBreakPositionLB.SetSelectHdl(  LINK( this, SvxExtParagraphTabPage, PageBreakPosHdl_Impl ) );
    1965             : 
    1966           0 :     SfxObjectShell* pSh = SfxObjectShell::Current();
    1967           0 :     if ( pSh )
    1968             :     {
    1969           0 :         SfxStyleSheetBasePool* pPool = pSh->GetStyleSheetPool();
    1970           0 :         pPool->SetSearchMask( SFX_STYLE_FAMILY_PAGE );
    1971           0 :         SfxStyleSheetBase* pStyle = pPool->First();
    1972           0 :         String aStdName;
    1973             : 
    1974           0 :         while( pStyle )
    1975             :         {
    1976           0 :             if ( aStdName.Len() == 0 )
    1977             :                 // first style == standard style
    1978           0 :                 aStdName = pStyle->GetName();
    1979           0 :             aApplyCollBox.InsertEntry( pStyle->GetName() );
    1980           0 :             pStyle = pPool->Next();
    1981             :         }
    1982           0 :         nStdPos = aApplyCollBox.GetEntryPos( aStdName );
    1983             :     }
    1984             : 
    1985           0 :     sal_uInt16 nHtmlMode = GetHtmlMode_Impl( rAttr );
    1986           0 :     if ( nHtmlMode & HTMLMODE_ON )
    1987             :     {
    1988           0 :         bHtmlMode = sal_True;
    1989           0 :         aHyphenBox           .Enable(sal_False);
    1990           0 :         aBeforeText          .Enable(sal_False);
    1991           0 :         aExtHyphenBeforeBox  .Enable(sal_False);
    1992           0 :         aAfterText           .Enable(sal_False);
    1993           0 :         aExtHyphenAfterBox   .Enable(sal_False);
    1994           0 :         aMaxHyphenLabel      .Enable(sal_False);
    1995           0 :         aMaxHyphenEdit       .Enable(sal_False);
    1996           0 :         aExtFL               .Enable(sal_False);
    1997           0 :         aPagenumText         .Enable(sal_False);
    1998           0 :         aPagenumEdit         .Enable(sal_False);
    1999             :         // no column break in HTML
    2000           0 :         aBreakTypeLB.RemoveEntry(1);
    2001             :     }
    2002           0 : }
    2003             : 
    2004             : // -----------------------------------------------------------------------
    2005             : 
    2006           0 : SvxExtParagraphTabPage::~SvxExtParagraphTabPage()
    2007             : {
    2008           0 : }
    2009             : 
    2010             : // -----------------------------------------------------------------------
    2011             : 
    2012           0 : sal_uInt16* SvxExtParagraphTabPage::GetRanges()
    2013             : {
    2014           0 :     return pExtRanges;
    2015             : }
    2016             : 
    2017             : // -----------------------------------------------------------------------
    2018             : 
    2019           0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, PageBreakHdl_Impl)
    2020             : {
    2021           0 :     switch ( aPageBreakBox.GetState() )
    2022             :     {
    2023             :         case STATE_CHECK:
    2024           0 :             aBreakTypeFT.Enable();
    2025           0 :             aBreakTypeLB.Enable();
    2026           0 :             aBreakPositionFT.Enable();
    2027           0 :             aBreakPositionLB.Enable();
    2028             : 
    2029           0 :             if ( 0 == aBreakTypeLB.GetSelectEntryPos()&&
    2030           0 :                 0 == aBreakPositionLB.GetSelectEntryPos() )
    2031             :             {
    2032           0 :                 aApplyCollBtn.Enable();
    2033             : 
    2034           0 :                 sal_Bool bEnable = STATE_CHECK == aApplyCollBtn.GetState() &&
    2035           0 :                                             aApplyCollBox.GetEntryCount();
    2036           0 :                 aApplyCollBox.Enable(bEnable);
    2037           0 :                 if(!bHtmlMode)
    2038             :                 {
    2039           0 :                     aPagenumText.Enable(bEnable);
    2040           0 :                     aPagenumEdit.Enable(bEnable);
    2041             :                 }
    2042             :             }
    2043           0 :             break;
    2044             : 
    2045             :         case STATE_NOCHECK:
    2046             :         case STATE_DONTKNOW:
    2047           0 :             aApplyCollBtn.SetState( STATE_NOCHECK );
    2048           0 :             aApplyCollBtn.Enable(sal_False);
    2049           0 :             aApplyCollBox.Enable(sal_False);
    2050           0 :             aPagenumText.Enable(sal_False);
    2051           0 :             aPagenumEdit.Enable(sal_False);
    2052           0 :             aBreakTypeFT.Enable(sal_False);
    2053           0 :             aBreakTypeLB.Enable(sal_False);
    2054           0 :             aBreakPositionFT.Enable(sal_False);
    2055           0 :             aBreakPositionLB.Enable(sal_False);
    2056           0 :             break;
    2057             :     }
    2058           0 :     return 0;
    2059             : }
    2060             : 
    2061             : // -----------------------------------------------------------------------
    2062             : 
    2063           0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, KeepTogetherHdl_Impl)
    2064             : {
    2065           0 :     sal_Bool bEnable = aKeepTogetherBox.GetState() == STATE_NOCHECK;
    2066           0 :     aWidowBox.Enable(bEnable);
    2067           0 :     aOrphanBox.Enable(bEnable);
    2068             : 
    2069           0 :     return 0;
    2070             : }
    2071             : 
    2072             : // -----------------------------------------------------------------------
    2073             : 
    2074           0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, WidowHdl_Impl)
    2075             : {
    2076           0 :     switch ( aWidowBox.GetState() )
    2077             :     {
    2078             :         case STATE_CHECK:
    2079           0 :             aWidowRowNo.Enable();
    2080           0 :             aWidowRowLabel.Enable();
    2081           0 :             aKeepTogetherBox.Enable(sal_False);
    2082           0 :             break;
    2083             : 
    2084             :         case STATE_NOCHECK:
    2085           0 :             if ( aOrphanBox.GetState() == STATE_NOCHECK )
    2086           0 :                 aKeepTogetherBox.Enable();
    2087             : 
    2088             :         // no break
    2089             :         case STATE_DONTKNOW:
    2090           0 :             aWidowRowNo.Enable(sal_False);
    2091           0 :             aWidowRowLabel.Enable(sal_False);
    2092           0 :             break;
    2093             :     }
    2094           0 :     return 0;
    2095             : }
    2096             : 
    2097             : // -----------------------------------------------------------------------
    2098             : 
    2099           0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, OrphanHdl_Impl)
    2100             : {
    2101           0 :     switch( aOrphanBox.GetState() )
    2102             :     {
    2103             :         case STATE_CHECK:
    2104           0 :             aOrphanRowNo.Enable();
    2105           0 :             aOrphanRowLabel.Enable();
    2106           0 :             aKeepTogetherBox.Enable(sal_False);
    2107           0 :             break;
    2108             : 
    2109             :         case STATE_NOCHECK:
    2110           0 :             if ( aWidowBox.GetState() == STATE_NOCHECK )
    2111           0 :                 aKeepTogetherBox.Enable();
    2112             : 
    2113             :         // kein break
    2114             :         case STATE_DONTKNOW:
    2115           0 :             aOrphanRowNo.Enable(sal_False);
    2116           0 :             aOrphanRowLabel.Enable(sal_False);
    2117           0 :             break;
    2118             :     }
    2119           0 :     return 0;
    2120             : }
    2121             : 
    2122             : // -----------------------------------------------------------------------
    2123             : 
    2124           0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, HyphenClickHdl_Impl)
    2125             : {
    2126             : 
    2127           0 :     sal_Bool bEnable = aHyphenBox.GetState() == STATE_CHECK;
    2128           0 :     aBeforeText.Enable(bEnable);
    2129           0 :     aExtHyphenBeforeBox.Enable(bEnable);
    2130           0 :     aAfterText.Enable(bEnable);
    2131           0 :     aExtHyphenAfterBox.Enable(bEnable);
    2132           0 :     aMaxHyphenLabel.Enable(bEnable);
    2133           0 :     aMaxHyphenEdit.Enable(bEnable);
    2134           0 :     aHyphenBox.SetState( bEnable ? STATE_CHECK : STATE_NOCHECK);
    2135             : 
    2136           0 :     return 0;
    2137             : }
    2138             : 
    2139             : // -----------------------------------------------------------------------
    2140             : 
    2141           0 : IMPL_LINK_NOARG(SvxExtParagraphTabPage, ApplyCollClickHdl_Impl)
    2142             : {
    2143           0 :     sal_Bool bEnable = sal_False;
    2144           0 :     if ( aApplyCollBtn.GetState() == STATE_CHECK &&
    2145           0 :          aApplyCollBox.GetEntryCount() )
    2146             :     {
    2147           0 :         bEnable = sal_True;
    2148           0 :         aApplyCollBox.SelectEntryPos( nStdPos );
    2149             :     }
    2150             :     else
    2151             :     {
    2152           0 :         aApplyCollBox.SetNoSelection();
    2153             :     }
    2154           0 :     aApplyCollBox.Enable(bEnable);
    2155           0 :     if(!bHtmlMode)
    2156             :     {
    2157           0 :         aPagenumText.Enable(bEnable);
    2158           0 :         aPagenumEdit.Enable(bEnable);
    2159             :     }
    2160           0 :     return 0;
    2161             : }
    2162             : 
    2163             : // -----------------------------------------------------------------------
    2164             : 
    2165           0 : IMPL_LINK( SvxExtParagraphTabPage, PageBreakPosHdl_Impl, ListBox *, pListBox )
    2166             : {
    2167           0 :     if ( 0 == pListBox->GetSelectEntryPos() )
    2168             :     {
    2169           0 :         aApplyCollBtn.Enable();
    2170             : 
    2171           0 :         sal_Bool bEnable = aApplyCollBtn.GetState() == STATE_CHECK &&
    2172           0 :                                     aApplyCollBox.GetEntryCount();
    2173             : 
    2174           0 :         aApplyCollBox.Enable(bEnable);
    2175           0 :         if(!bHtmlMode)
    2176             :         {
    2177           0 :             aPagenumText.Enable(bEnable);
    2178           0 :             aPagenumEdit.Enable(bEnable);
    2179             :         }
    2180             :     }
    2181           0 :     else if ( 1 == pListBox->GetSelectEntryPos() )
    2182             :     {
    2183           0 :         aApplyCollBtn.SetState( STATE_NOCHECK );
    2184           0 :         aApplyCollBtn.Enable(sal_False);
    2185           0 :         aApplyCollBox.Enable(sal_False);
    2186           0 :         aPagenumText.Enable(sal_False);
    2187           0 :         aPagenumEdit.Enable(sal_False);
    2188             :     }
    2189           0 :     return 0;
    2190             : }
    2191             : 
    2192             : // -----------------------------------------------------------------------
    2193             : 
    2194           0 : IMPL_LINK( SvxExtParagraphTabPage, PageBreakTypeHdl_Impl, ListBox *, pListBox )
    2195             : {
    2196             :     //column break or break break after
    2197           0 :     sal_uInt16 nBreakPos = aBreakPositionLB.GetSelectEntryPos();
    2198           0 :     if ( pListBox->GetSelectEntryPos() == 1 || 1 == nBreakPos)
    2199             :     {
    2200           0 :         aApplyCollBtn.SetState( STATE_NOCHECK );
    2201           0 :         aApplyCollBtn.Enable(sal_False);
    2202           0 :         aApplyCollBox.Enable(sal_False);
    2203           0 :         aPagenumText.Enable(sal_False);
    2204           0 :         aPagenumEdit.Enable(sal_False);
    2205             :     }
    2206             :     else
    2207           0 :         PageBreakPosHdl_Impl( &aBreakPositionLB );
    2208           0 :     return 0;
    2209             : }
    2210             : 
    2211           0 : void SvxExtParagraphTabPage::PageCreated(SfxAllItemSet aSet)
    2212             : {
    2213             : 
    2214             : 
    2215           0 :     SFX_ITEMSET_ARG (&aSet,pDisablePageBreakItem,SfxBoolItem,SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,sal_False);
    2216             : 
    2217           0 :     if (pDisablePageBreakItem)
    2218           0 :         if ( pDisablePageBreakItem->GetValue())
    2219           0 :                     DisablePageBreak();
    2220             : 
    2221             : 
    2222           0 : }
    2223             : 
    2224           0 : SvxAsianTabPage::SvxAsianTabPage( Window* pParent, const SfxItemSet& rSet ) :
    2225           0 :     SfxTabPage(pParent, CUI_RES( RID_SVXPAGE_PARA_ASIAN ), rSet),
    2226           0 :     aOptionsFL(         this, CUI_RES(FL_AS_OPTIONS       )),
    2227           0 :     aForbiddenRulesCB(  this, CUI_RES(CB_AS_FORBIDDEN     )),
    2228           0 :     aHangingPunctCB(    this, CUI_RES(CB_AS_HANG_PUNC     )),
    2229           0 :     aScriptSpaceCB(     this, CUI_RES(CB_AS_SCRIPT_SPACE    ))//,
    2230             : 
    2231             : {
    2232           0 :     FreeResource();
    2233             : 
    2234           0 :     Link aLink = LINK( this, SvxAsianTabPage, ClickHdl_Impl );
    2235           0 :     aHangingPunctCB.SetClickHdl( aLink );
    2236           0 :     aScriptSpaceCB.SetClickHdl( aLink );
    2237           0 :     aForbiddenRulesCB.SetClickHdl( aLink );
    2238             : 
    2239           0 : }
    2240             : 
    2241           0 : SvxAsianTabPage::~SvxAsianTabPage()
    2242             : {
    2243           0 : }
    2244             : 
    2245           0 : SfxTabPage* SvxAsianTabPage::Create(    Window* pParent, const SfxItemSet& rSet )
    2246             : {
    2247           0 :     return new SvxAsianTabPage(pParent, rSet);
    2248             : }
    2249             : 
    2250           0 : sal_uInt16*     SvxAsianTabPage::GetRanges()
    2251             : {
    2252             :     static sal_uInt16 pRanges[] =
    2253             :     {
    2254             :         SID_ATTR_PARA_SCRIPTSPACE, SID_ATTR_PARA_FORBIDDEN_RULES,
    2255             :         0
    2256             :     };
    2257           0 :     return pRanges;
    2258             : }
    2259             : 
    2260           0 : sal_Bool        SvxAsianTabPage::FillItemSet( SfxItemSet& rSet )
    2261             : {
    2262           0 :     sal_Bool bRet = sal_False;
    2263           0 :     SfxItemPool* pPool = rSet.GetPool();
    2264           0 :     if(aScriptSpaceCB.IsChecked() != aScriptSpaceCB.GetSavedValue())
    2265             :     {
    2266             :         SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
    2267           0 :             pPool->GetWhich(SID_ATTR_PARA_SCRIPTSPACE)).Clone();
    2268           0 :         pNewItem->SetValue(aScriptSpaceCB.IsChecked());
    2269           0 :         rSet.Put(*pNewItem);
    2270           0 :         delete pNewItem;
    2271           0 :         bRet = sal_True;
    2272             :     }
    2273           0 :     if(aHangingPunctCB.IsChecked() != aHangingPunctCB.GetSavedValue())
    2274             :     {
    2275             :         SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
    2276           0 :             pPool->GetWhich(SID_ATTR_PARA_HANGPUNCTUATION)).Clone();
    2277           0 :         pNewItem->SetValue(aHangingPunctCB.IsChecked());
    2278           0 :         rSet.Put(*pNewItem);
    2279           0 :         delete pNewItem;
    2280           0 :         bRet = sal_True;
    2281             :     }
    2282           0 :     if(aForbiddenRulesCB.IsChecked() != aForbiddenRulesCB.GetSavedValue())
    2283             :     {
    2284             :         SfxBoolItem* pNewItem = (SfxBoolItem*)rSet.Get(
    2285           0 :             pPool->GetWhich(SID_ATTR_PARA_FORBIDDEN_RULES)).Clone();
    2286           0 :         pNewItem->SetValue(aForbiddenRulesCB.IsChecked());
    2287           0 :         rSet.Put(*pNewItem);
    2288           0 :         delete pNewItem;
    2289           0 :         bRet = sal_True;
    2290             :     }
    2291           0 :     return bRet;
    2292             : }
    2293             : 
    2294           0 : static void lcl_SetBox(const SfxItemSet& rSet, sal_uInt16 nSlotId, TriStateBox& rBox)
    2295             : {
    2296           0 :     sal_uInt16 _nWhich = rSet.GetPool()->GetWhich(nSlotId);
    2297           0 :     SfxItemState eState = rSet.GetItemState(_nWhich, sal_True);
    2298           0 :     if(!eState || eState == SFX_ITEM_DISABLED )
    2299           0 :         rBox.Enable(sal_False);
    2300           0 :     else if(eState >= SFX_ITEM_AVAILABLE)
    2301             :     {
    2302           0 :         rBox.EnableTriState( sal_False );
    2303           0 :         rBox.Check(((const SfxBoolItem&)rSet.Get(_nWhich)).GetValue());
    2304             :     }
    2305             :     else
    2306           0 :         rBox.SetState( STATE_DONTKNOW );
    2307           0 :     rBox.SaveValue();
    2308           0 : }
    2309             : 
    2310             : 
    2311           0 : void SvxAsianTabPage::Reset( const SfxItemSet& rSet )
    2312             : {
    2313           0 :     lcl_SetBox(rSet, SID_ATTR_PARA_FORBIDDEN_RULES, aForbiddenRulesCB );
    2314           0 :     lcl_SetBox(rSet, SID_ATTR_PARA_HANGPUNCTUATION, aHangingPunctCB );
    2315             : 
    2316             :     //character distance not yet available
    2317           0 :     lcl_SetBox(rSet, SID_ATTR_PARA_SCRIPTSPACE, aScriptSpaceCB );
    2318           0 : }
    2319             : 
    2320           0 : IMPL_LINK( SvxAsianTabPage, ClickHdl_Impl, TriStateBox*, pBox )
    2321             : {
    2322           0 :     pBox->EnableTriState( sal_False );
    2323           0 :     return 0;
    2324           6 : }
    2325             : 
    2326             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10