diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-06-06 11:38:02 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-06-06 11:38:02 +0000 |
commit | 3c105ea744a11aab910c6e139afd4cae5ebfad6e (patch) | |
tree | faa1caeeb4f6232a777579518cc9f8b33261ee3c /svx | |
parent | f70d7692b29354d3ff0e88e9c7344d897c07247f (diff) |
INTEGRATION: CWS impressodf12 (1.63.300); FILE MERGED
2008/05/26 19:43:00 cl 1.63.300.5: #i35937# code cleanup after bullet rework
2008/05/26 15:12:11 cl 1.63.300.4: #i75927# added restart for numbering
2008/04/25 08:58:54 cl 1.63.300.3: RESYNC: (1.63-1.64); FILE MERGED
2008/04/24 15:35:17 cl 1.63.300.2: #i35937# export level -1 as void property over api
2008/04/10 16:50:58 cl 1.63.300.1: #i35937# allow paragraph depth of -1 to switch of numbering
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/unoedit/unotext.cxx | 130 |
1 files changed, 107 insertions, 23 deletions
diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index f998dbe06202..547a19fa2da2 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: unotext.cxx,v $ - * $Revision: 1.64 $ + * $Revision: 1.65 $ * * This file is part of OpenOffice.org. * @@ -50,6 +50,8 @@ #include <svx/svdobj.hxx> #include <svtools/intitem.hxx> +#include <svtools/eitem.hxx> + #include <rtl/uuid.h> #include <rtl/memory.h> @@ -540,12 +542,40 @@ sal_Bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet&, const S } } break; + case WID_NUMBERINGSTARTVALUE: + { + SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL; + if(pForwarder && pSelection) + { + sal_Int16 nStartValue = -1; + if( aValue >>= nStartValue ) + { + pForwarder->SetNumberingStartValue( pSelection->nStartPara, nStartValue ); + return sal_True; + } + } + } + break; + case WID_PARAISNUMBERINGRESTART: + { + SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL; + if(pForwarder && pSelection) + { + sal_Bool bParaIsNumberingRestart = sal_False; + if( aValue >>= bParaIsNumberingRestart ) + { + pForwarder->SetParaIsNumberingRestart( pSelection->nStartPara, bParaIsNumberingRestart ); + return sal_True; + } + } + } + break; case EE_PARA_BULLETSTATE: { - sal_Bool bBullet = sal_Bool(); + sal_Bool bBullet = sal_True; if( aValue >>= bBullet ) { - SfxUInt16Item aItem( EE_PARA_BULLETSTATE, bBullet ); + SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet ); rNewSet.Put(aItem); return sal_True; } @@ -674,22 +704,37 @@ sal_Bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const S SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL; if(pForwarder && pSelection) { - // #101004# Call interface method instead of unsafe cast - sal_Int16 nLevel( pForwarder->GetDepth( pSelection->nStartPara ) ); - aAny <<= nLevel; + sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara ); + if( nLevel >= 0 ) + aAny <<= nLevel; } } break; + case WID_NUMBERINGSTARTVALUE: + { + SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL; + if(pForwarder && pSelection) + aAny <<= pForwarder->GetNumberingStartValue( pSelection->nStartPara ); + } + break; + case WID_PARAISNUMBERINGRESTART: + { + SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL; + if(pForwarder && pSelection) + aAny <<= pForwarder->IsParaIsNumberingRestart( pSelection->nStartPara ); + } + break; + case EE_PARA_BULLETSTATE: { sal_Bool bState = sal_False; if( rSet.GetItemState( EE_PARA_BULLETSTATE, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT)) { - SfxUInt16Item* pItem = (SfxUInt16Item*)rSet.GetItem( EE_PARA_BULLETSTATE, sal_True ); - bState = pItem->GetValue() == TRUE; + SfxBoolItem* pItem = (SfxBoolItem*)rSet.GetItem( EE_PARA_BULLETSTATE, sal_True ); + bState = pItem->GetValue() ? sal_True : sal_False; } - aAny.setValue( &bState, ::getCppuBooleanType() ); + aAny <<= bState; } break; default: @@ -1005,6 +1050,8 @@ beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxIt break; case WID_NUMLEVEL: + case WID_NUMBERINGSTARTVALUE: + case WID_PARAISNUMBERINGRESTART: eItemState = SFX_ITEM_SET; break; @@ -1155,6 +1202,8 @@ sal_Bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, cons break; case WID_NUMLEVEL: + case WID_NUMBERINGSTARTVALUE: + case WID_PARAISNUMBERINGRESTART: eItemState = SFX_ITEM_SET; break; @@ -1220,9 +1269,17 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sa else if( pMap->nWID == WID_NUMLEVEL ) { // #101004# Call interface method instead of unsafe cast - pForwarder->SetDepth( maSelection.nStartPara, 0 ); + pForwarder->SetDepth( maSelection.nStartPara, -1 ); return; } + else if( pMap->nWID == WID_NUMBERINGSTARTVALUE ) + { + pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 ); + } + else if( pMap->nWID == WID_PARAISNUMBERINGRESTART ) + { + pForwarder->SetParaIsNumberingRestart( maSelection.nStartPara, sal_False ); + } else { aSet.InvalidateItem( pMap->nWID ); @@ -1262,10 +1319,16 @@ uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aProp case WID_NUMLEVEL: { - uno::Any aValue; - aValue <<= (sal_Int16)0; - return aValue; + uno::Any aAny; + return aAny; } + + case WID_NUMBERINGSTARTVALUE: + return uno::Any( (sal_Int16)-1 ); + + case WID_PARAISNUMBERINGRESTART: + return uno::Any( (sal_Bool)sal_False ); + default: { // Default aus ItemPool holen @@ -2052,13 +2115,34 @@ void SvxPropertyValuesToItemSet( { if (pForwarder) { - sal_Int16 nLevel = 0; - if (pProps[i].Value >>= nLevel) - { - // #101004# Call interface method instead of unsafe cast - if (!pForwarder->SetDepth( nPara, nLevel )) - throw lang::IllegalArgumentException(); - } + sal_Int16 nLevel = -1; + pProps[i].Value >>= nLevel; + + // #101004# Call interface method instead of unsafe cast + if (!pForwarder->SetDepth( nPara, nLevel )) + throw lang::IllegalArgumentException(); + } + } + else if (pEntry->nWID == WID_NUMBERINGSTARTVALUE ) + { + if( pForwarder ) + { + sal_Int16 nStartValue = -1; + if( !(pProps[i].Value >>= nStartValue) ) + throw lang::IllegalArgumentException(); + + pForwarder->SetNumberingStartValue( nPara, nStartValue ); + } + } + else if (pEntry->nWID == WID_PARAISNUMBERINGRESTART ) + { + if( pForwarder ) + { + sal_Bool bParaIsNumberingRestart = sal_False; + if( !(pProps[i].Value >>= bParaIsNumberingRestart) ) + throw lang::IllegalArgumentException(); + + pForwarder->SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart ); } } else @@ -2500,12 +2584,12 @@ sal_Bool SvxDummyTextSource::QuickFormatDoc( BOOL ) return sal_False; } -USHORT SvxDummyTextSource::GetDepth( USHORT ) const +sal_Int16 SvxDummyTextSource::GetDepth( USHORT ) const { - return 0; + return -1; } -sal_Bool SvxDummyTextSource::SetDepth( USHORT, USHORT nNewDepth ) +sal_Bool SvxDummyTextSource::SetDepth( USHORT, sal_Int16 nNewDepth ) { return nNewDepth == 0 ? sal_True : sal_False; } |