diff options
author | Thorsten Behrens <thb@openoffice.org> | 2002-07-26 10:35:10 +0000 |
---|---|---|
committer | Thorsten Behrens <thb@openoffice.org> | 2002-07-26 10:35:10 +0000 |
commit | 2445632bc1b962b5f94ccabb268de0ddfabb77c4 (patch) | |
tree | c5e3cde153557a5afe6e2927a5ce2ef8faa27775 /svx/source/unoedit | |
parent | 2945850eb46833711983ec52c40da2ab27fc689c (diff) |
#101004# Added new Get/SetDepth to SvxTextForwarder
Diffstat (limited to 'svx/source/unoedit')
-rw-r--r-- | svx/source/unoedit/unoedprx.cxx | 18 | ||||
-rw-r--r-- | svx/source/unoedit/unofored.cxx | 16 | ||||
-rw-r--r-- | svx/source/unoedit/unoforou.cxx | 59 | ||||
-rw-r--r-- | svx/source/unoedit/unotext.cxx | 76 |
4 files changed, 105 insertions, 64 deletions
diff --git a/svx/source/unoedit/unoedprx.cxx b/svx/source/unoedit/unoedprx.cxx index 4031f7edcfcd..334b128ce737 100644 --- a/svx/source/unoedit/unoedprx.cxx +++ b/svx/source/unoedit/unoedprx.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoedprx.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: thb $ $Date: 2002-06-04 18:44:27 $ + * last change: $Author: thb $ $Date: 2002-07-26 11:34:14 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1145,6 +1145,20 @@ sal_Bool SvxAccessibleTextAdapter::QuickFormatDoc( BOOL bFull ) return mrTextForwarder->QuickFormatDoc( bFull ); } +USHORT SvxAccessibleTextAdapter::GetDepth( USHORT nPara ) const +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + return mrTextForwarder->GetDepth( nPara ); +} + +sal_Bool SvxAccessibleTextAdapter::SetDepth( USHORT nPara, USHORT nNewDepth ) +{ + DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder"); + + return mrTextForwarder->SetDepth( nPara, nNewDepth ); +} + void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder ) { mrTextForwarder = &rForwarder; diff --git a/svx/source/unoedit/unofored.cxx b/svx/source/unoedit/unofored.cxx index f0402bd19760..d8a05f3fe471 100644 --- a/svx/source/unoedit/unofored.cxx +++ b/svx/source/unoedit/unofored.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unofored.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: thb $ $Date: 2002-05-29 15:49:18 $ + * last change: $Author: thb $ $Date: 2002-07-26 11:34:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -447,4 +447,16 @@ sal_Bool SvxEditEngineForwarder::InsertText( const String& rStr, const ESelectio return sal_True; } +USHORT SvxEditEngineForwarder::GetDepth( USHORT nPara ) const +{ + // EditEngine does not support outline depth + return 0; +} + +sal_Bool SvxEditEngineForwarder::SetDepth( USHORT nPara, USHORT nNewDepth ) +{ + // EditEngine does not support outline depth + return nNewDepth == 0 ? sal_True : sal_False; +} + //------------------------------------------------------------------------ diff --git a/svx/source/unoedit/unoforou.cxx b/svx/source/unoedit/unoforou.cxx index ca3a6fda2ee1..1c912bb097ef 100644 --- a/svx/source/unoedit/unoforou.cxx +++ b/svx/source/unoedit/unoforou.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoforou.cxx,v $ * - * $Revision: 1.17 $ + * $Revision: 1.18 $ * - * last change: $Author: thb $ $Date: 2002-05-29 15:49:18 $ + * last change: $Author: thb $ $Date: 2002-07-26 11:34:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -72,6 +72,7 @@ #include <editeng.hxx> #include <editdata.hxx> #include <outliner.hxx> +#include "svdobj.hxx" #ifndef _SFXPOOLITEM_HXX #include <svtools/poolitem.hxx> @@ -92,8 +93,9 @@ using namespace ::com::sun::star; //------------------------------------------------------------------------ -SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl ) : +SvxOutlinerForwarder::SvxOutlinerForwarder( Outliner& rOutl, SdrObject* pSdrObj ) : rOutliner( rOutl ), + pSdrObject( pSdrObj ), mpAttribsCache( NULL ), mpParaAttribsCache( NULL ), mnParaAttribsCache( 0 ) @@ -419,4 +421,55 @@ sal_Bool SvxOutlinerForwarder::InsertText( const String& rStr, const ESelection& return sal_True; } +USHORT SvxOutlinerForwarder::GetDepth( USHORT nPara ) const +{ + DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::GetDepth: Invalid paragraph index"); + + Paragraph* pPara = rOutliner.GetParagraph( nPara ); + + USHORT nLevel(0); + + if( pPara ) + { + nLevel = rOutliner.GetDepth( nPara ); + + if(pSdrObject != NULL) + { + if((pSdrObject->GetObjInventor() == SdrInventor) && + (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT)) + --nLevel; + } + } + + return nLevel; +} + +sal_Bool SvxOutlinerForwarder::SetDepth( USHORT nPara, USHORT nNewDepth ) +{ + DBG_ASSERT( nPara < GetParagraphCount(), "SvxOutlinerForwarder::SetDepth: Invalid paragraph index"); + + if(pSdrObject == NULL) + return sal_False; + + const sal_Bool bOutlinerText = (pSdrObject->GetObjInventor() == SdrInventor) && (pSdrObject->GetObjIdentifier() == OBJ_OUTLINETEXT); + + if(bOutlinerText) + ++nNewDepth; + + if(nNewDepth >= 0 && nNewDepth <= 9) + { + Paragraph* pPara = rOutliner.GetParagraph( nPara ); + if( pPara ) + { + rOutliner.SetDepth( pPara, nNewDepth ); + if( bOutlinerText ) + rOutliner.SetLevelDependendStyleSheet( nPara ); + + return sal_True; + } + } + + return sal_False; +} + //------------------------------------------------------------------------ diff --git a/svx/source/unoedit/unotext.cxx b/svx/source/unoedit/unotext.cxx index fb230442058c..845bf03125ca 100644 --- a/svx/source/unoedit/unotext.cxx +++ b/svx/source/unoedit/unotext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unotext.cxx,v $ * - * $Revision: 1.39 $ + * $Revision: 1.40 $ * - * last change: $Author: thb $ $Date: 2002-04-26 10:27:21 $ + * last change: $Author: thb $ $Date: 2002-07-26 11:34:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -547,28 +547,8 @@ sal_Bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet& rOldSet, sal_Int16 nLevel; if( aValue >>= nLevel ) { - SdrObject* pObj = pEditSource->GetSdrObject(); - - if(pObj == NULL) - return sal_False; - - const sal_Bool bOutlinerText = (pObj->GetObjInventor() == SdrInventor) && (pObj->GetObjIdentifier() == OBJ_OUTLINETEXT); - if(bOutlinerText) - nLevel++; - - if(nLevel >= 0 && nLevel <= 9) - { - Outliner& rOutliner = ((SvxOutlinerForwarder*)pForwarder)->GetOutliner(); - - Paragraph* pPara = rOutliner.GetParagraph( pSelection->nStartPara ); - if( pPara ) - { - rOutliner.SetDepth( pPara, nLevel ); - if( bOutlinerText ) - rOutliner.SetLevelDependendStyleSheet( pSelection->nStartPara ); - return sal_True; - } - } + // #101004# Call interface method instead of unsafe cast + return pForwarder->SetDepth( pSelection->nStartPara, nLevel ); } } } @@ -709,22 +689,8 @@ sal_Bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const S SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL; if(pForwarder && pSelection) { - - Outliner& rOutliner = ((SvxOutlinerForwarder*)pForwarder)->GetOutliner(); - Paragraph* pPara = rOutliner.GetParagraph( pSelection->nStartPara ); - - sal_Int16 nLevel = 0; - if( pPara ) - nLevel = rOutliner.GetDepth( pSelection->nStartPara ); - - SdrObject* pObj = pEditSource->GetSdrObject(); - - if(pObj != NULL) - { - if((pObj->GetObjInventor() == SdrInventor) && - (pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)) - nLevel--; - } + // #101004# Call interface method instead of unsafe cast + sal_Int16 nLevel( pForwarder->GetDepth( pSelection->nStartPara ) ); aAny <<= nLevel; } } @@ -1235,23 +1201,9 @@ void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sa } else if( pMap->nWID == WID_NUMLEVEL ) { - sal_Int16 nLevel = 0; - - SvxTextEditSource* pEditSource = (SvxTextEditSource*)GetEditSource(); - SdrObject* pObj = pEditSource->GetSdrObject(); - - if(pObj) - { - if((pObj->GetObjInventor() == SdrInventor) && - (pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)) - nLevel++; - - Outliner& rOutliner = ((SvxOutlinerForwarder*)pForwarder)->GetOutliner(); - Paragraph* pPara = rOutliner.GetParagraph( aSelection.nStartPara ); - if( pPara ) - rOutliner.SetDepth( pPara, nLevel ); - return; - } + // #101004# Call interface method instead of unsafe cast + pForwarder->SetDepth( aSelection.nStartPara, 0 ); + return; } else { @@ -2295,6 +2247,16 @@ sal_Bool SvxDummyTextSource::QuickFormatDoc( BOOL bFull ) return sal_False; } +USHORT SvxDummyTextSource::GetDepth( USHORT nPara ) const +{ + return 0; +} + +sal_Bool SvxDummyTextSource::SetDepth( USHORT nPara, USHORT nNewDepth ) +{ + return nNewDepth == 0 ? sal_True : sal_False; +} + sal_Bool SvxDummyTextSource::Delete( const ESelection& ) { return sal_False; |