diff options
author | Oliver Specht <os@openoffice.org> | 2000-12-20 12:08:05 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2000-12-20 12:08:05 +0000 |
commit | 841a3fdeeb82b8bfd9f863388adb913dda037fd1 (patch) | |
tree | 717d6cece95ecbe767d254880f4bfde97b7c8974 /sw | |
parent | 6b065bc629df65e1869412038deee518f5e976ce (diff) |
getTypes/queryInterface corrected
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unoredline.cxx | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx index 9810f45ceef2..b4b29301b2ee 100644 --- a/sw/source/core/unocore/unoredline.cxx +++ b/sw/source/core/unocore/unoredline.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoredline.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: os $ $Date: 2000-12-19 15:48:57 $ + * last change: $Author: os $ $Date: 2000-12-20 13:08:05 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -136,10 +136,22 @@ Any SwXRedlinePortion::queryInterface( const uno::Type& rType ) throw(RuntimeExc { Any aRet = SwXTextPortion::queryInterface(rType); if(!aRet.hasValue() && - !IsCollapsed() && - rType == ::getCppuType((Reference<XEnumerationAccess>*)0)) + IsCollapsed()) { aRet = SwXText::queryInterface(rType); + if(!aRet.hasValue()) + { + if(rType == ::getCppuType((Reference<XEnumerationAccess>*)0)) + { + Reference<XEnumerationAccess> xTmp = this; + aRet <<= xTmp; + } + else if(rType == ::getCppuType((Reference<XElementAccess>*)0)) + { + Reference<XElementAccess> xTmp = this; + aRet <<= xTmp; + } + } } return aRet; } @@ -148,15 +160,18 @@ Any SwXRedlinePortion::queryInterface( const uno::Type& rType ) throw(RuntimeExc -----------------------------------------------------------------------*/ Sequence< Type > SwXRedlinePortion::getTypes( ) throw(RuntimeException) { - Sequence< uno::Type > aRet = SwXTextPortion::getTypes(); + uno::Sequence< uno::Type > aTypes = SwXTextPortion::getTypes(); if(!IsCollapsed()) - { - sal_Int32 nLength = aRet.getLength(); - aRet.realloc(nLength + 2); - aRet.getArray()[nLength] = ::getCppuType((Reference<XEnumerationAccess>*)0); - aRet.getArray()[nLength + 1] = ::getCppuType((Reference<XText>*)0); - } - return aRet; + return aTypes; + uno::Sequence< uno::Type > aTextTypes = SwXText::getTypes(); + long nIndex = aTypes.getLength(); + aTypes.realloc(aTypes.getLength() + aTextTypes.getLength() + 1); + uno::Type* pTypes = aTypes.getArray(); + const uno::Type* pTextTypes = aTextTypes.getConstArray(); + for(int i = 0; i < aTextTypes.getLength(); i++) + pTypes[nIndex++] = pTextTypes[i]; + pTypes[nIndex++] = ::getCppuType((Reference<XEnumerationAccess>*)0); + return aTypes; } /*-- 19.12.00 11:37:25--------------------------------------------------- @@ -171,8 +186,9 @@ Reference< XEnumeration > SwXRedlinePortion::createEnumeration(void) throw( Run SwNodeIndex* pNodeIndex = pRedline->GetContentIdx(); if(pNodeIndex) { - SwPosition aPos(*pNodeIndex); - xRet = new SwXParagraphEnumeration(this, aPos, CURSOR_REDLINE); + SwPaM aPam(*pNodeIndex); + aPam.Move(fnMoveForward, fnGoNode); + xRet = new SwXParagraphEnumeration(this, *aPam.Start(), CURSOR_REDLINE); } return xRet; } |