diff options
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/inc/unoedprx.hxx | 6 | ||||
-rw-r--r-- | svx/source/unodraw/unoshtxt.cxx | 8 | ||||
-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 |
6 files changed, 113 insertions, 70 deletions
diff --git a/svx/source/inc/unoedprx.hxx b/svx/source/inc/unoedprx.hxx index 8c31ae22ff0e..ce00d7249b2d 100644 --- a/svx/source/inc/unoedprx.hxx +++ b/svx/source/inc/unoedprx.hxx @@ -2,9 +2,9 @@ * * $RCSfile: unoedprx.hxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: thb $ $Date: 2002-05-16 16:11:24 $ + * last change: $Author: thb $ $Date: 2002-07-26 11:29:36 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -117,6 +117,8 @@ public: virtual sal_Bool Delete( const ESelection& ); virtual sal_Bool InsertText( const String&, const ESelection& ); virtual sal_Bool QuickFormatDoc( BOOL bFull=FALSE ); + virtual USHORT GetDepth( USHORT nPara ) const; + virtual sal_Bool SetDepth( USHORT nPara, USHORT nNewDepth ); void SetForwarder( SvxTextForwarder& ); sal_Bool HaveImageBullet( USHORT nPara ) const; diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx index 7856394b106a..d7a56819b8d2 100644 --- a/svx/source/unodraw/unoshtxt.cxx +++ b/svx/source/unodraw/unoshtxt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoshtxt.cxx,v $ * - * $Revision: 1.38 $ + * $Revision: 1.39 $ * - * last change: $Author: thb $ $Date: 2002-07-18 14:59:08 $ + * last change: $Author: thb $ $Date: 2002-07-26 11:33:11 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -505,7 +505,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetBackgroundTextForwarder() // - } - mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner ); + mpTextForwarder = new SvxOutlinerForwarder( *mpOutliner, mpObject ); // delay listener subscription and UAA initialization until Outliner is fully setup bCreated = sal_True; @@ -606,7 +606,7 @@ SvxTextForwarder* SvxTextEditSourceImpl::GetEditModeTextForwarder() if( pEditOutliner ) { - mpTextForwarder = new SvxOutlinerForwarder( *pEditOutliner ); + mpTextForwarder = new SvxOutlinerForwarder( *pEditOutliner, mpObject ); mbForwarderIsEditMode = sal_True; } 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; |