diff options
author | Oliver Specht <os@openoffice.org> | 2000-12-06 12:57:51 +0000 |
---|---|---|
committer | Oliver Specht <os@openoffice.org> | 2000-12-06 12:57:51 +0000 |
commit | 7fcc6def86be4c533637e7278b70f20811a4ade3 (patch) | |
tree | 166af780ca9ec3bb807f6d46f60eb3e0b75df377 | |
parent | c0cf1f5ab1a8176cc077001337dad94cb6e88ebb (diff) |
#81409# new file: unoportenum.cxx
-rw-r--r-- | sw/source/core/unocore/makefile.mk | 7 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 655 |
2 files changed, 7 insertions, 655 deletions
diff --git a/sw/source/core/unocore/makefile.mk b/sw/source/core/unocore/makefile.mk index 9dd220b97a49..0630258bc4a8 100644 --- a/sw/source/core/unocore/makefile.mk +++ b/sw/source/core/unocore/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: os $ $Date: 2000-12-01 17:36:08 $ +# last change: $Author: os $ $Date: 2000-12-06 13:57:51 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -97,6 +97,7 @@ CXXFILES = \ unoobj.cxx \ unoobj2.cxx \ unoport.cxx \ + unoportenum.cxx \ unoprnms.cxx \ unorefmk.cxx \ unosett.cxx \ @@ -122,6 +123,7 @@ SLOFILES = \ $(SLO)$/unoobj.obj\ $(SLO)$/unoobj2.obj\ $(SLO)$/unoport.obj\ + $(SLO)$/unoportenum.obj\ $(SLO)$/unoprnms.obj\ $(SLO)$/unosrch.obj\ $(SLO)$/unostyle.obj\ @@ -143,6 +145,7 @@ EXCEPTIONSFILES= \ $(SLO)$/unoobj.obj\ $(SLO)$/unoobj2.obj\ $(SLO)$/unoport.obj\ + $(SLO)$/unoportenum.obj\ $(SLO)$/unosrch.obj\ $(SLO)$/unostyle.obj\ $(SLO)$/unocoll.obj\ diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 6e2d1ab77235..c343a15eea6b 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: unoobj2.cxx,v $ * - * $Revision: 1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: os $ $Date: 2000-12-01 17:37:27 $ + * last change: $Author: os $ $Date: 2000-12-06 13:56:41 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2842,657 +2842,6 @@ void SwXParaFrameEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) } } } -/****************************************************************** - * SwXTextPortionEnumeration - ******************************************************************/ -/* -----------------------------13.03.00 12:15-------------------------------- - - ---------------------------------------------------------------------------*/ -const uno::Sequence< sal_Int8 > & SwXTextPortionEnumeration::getUnoTunnelId() -{ - static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId(); - return aSeq; -} -/* -----------------------------10.03.00 18:04-------------------------------- - - ---------------------------------------------------------------------------*/ -sal_Int64 SAL_CALL SwXTextPortionEnumeration::getSomething( const uno::Sequence< sal_Int8 >& rId ) - throw(uno::RuntimeException) -{ - if( rId.getLength() == 16 - && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(), - rId.getConstArray(), 16 ) ) - { - return (sal_Int64)this; - } - return 0; -} -/* -----------------------------06.04.00 16:39-------------------------------- - - ---------------------------------------------------------------------------*/ -OUString SwXTextPortionEnumeration::getImplementationName(void) throw( RuntimeException ) -{ - return C2U("SwXTextPortionEnumeration"); -} -/* -----------------------------06.04.00 16:39-------------------------------- - - ---------------------------------------------------------------------------*/ -BOOL SwXTextPortionEnumeration::supportsService(const OUString& rServiceName) throw( RuntimeException ) -{ - return C2U("com.sun.star.text.TextPortionEnumeration") == rServiceName; -} -/* -----------------------------06.04.00 16:39-------------------------------- - - ---------------------------------------------------------------------------*/ -Sequence< OUString > SwXTextPortionEnumeration::getSupportedServiceNames(void) throw( RuntimeException ) -{ - Sequence< OUString > aRet(1); - OUString* pArray = aRet.getArray(); - pArray[0] = C2U("com.sun.star.text.TextPortionEnumeration"); - return aRet; -} -/*-- 27.01.99 10:44:43--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SwXTextPortionEnumeration::SwXTextPortionEnumeration(SwPaM& rParaCrsr, uno::Reference< XText > xParentText) : - xParent(xParentText), - bAtEnd(sal_False), - bFirstPortion(sal_True) -{ - SwUnoCrsr* pUnoCrsr = rParaCrsr.GetDoc()->CreateUnoCrsr(*rParaCrsr.GetPoint(), sal_False); - pUnoCrsr->Add(this); - - //alle Rahmen, Grafiken und OLEs suchen, die an diesem Absatz AM ZEICHEN gebunden sind - SwDoc* pDoc = pUnoCrsr->GetDoc(); - sal_uInt16 nCount = pDoc->GetFlyCount(); - const SwNodeIndex nOwnNode = pUnoCrsr->GetPoint()->nNode; - for( sal_uInt16 i = 0; i < nCount; i++) - { - SwFrmFmt* pFmt = pDoc->GetFlyNum(i); - //steht der Anker in diesem Node und ist er absatzgebunden? - if( pFmt->GetAnchor().GetAnchorId() == FLY_AUTO_CNTNT ) - { - const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); - const SwPosition* pAnchorPos = rAnchor.GetCntntAnchor(); - if(pAnchorPos->nNode == nOwnNode) - { - //jetzt einen SwDepend anlegen und sortiert in das Array einfuegen - SwDepend* pNewDepend = new SwDepend(this, pFmt); - const SwFmtAnchor& rNewAnchor = pFmt->GetAnchor(); - const SwPosition* pNewAnchorPos = rNewAnchor.GetCntntAnchor(); - xub_StrLen nInsertIndex = pNewAnchorPos->nContent.GetIndex(); - - for(sal_uInt16 nFrame = 0; nFrame < aFrameArr.Count(); nFrame++) - { - SwDepend* pCurDepend = aFrameArr.GetObject(nFrame); - SwFrmFmt* pFormat = (SwFrmFmt*)pCurDepend->GetRegisteredIn(); - const SwFmtAnchor& rAnchor = pFormat->GetAnchor(); - const SwPosition* pAnchorPos = rAnchor.GetCntntAnchor(); - - if(pAnchorPos->nContent.GetIndex() > nInsertIndex) - { - aFrameArr.C40_INSERT(SwDepend, pNewDepend, nFrame); - pNewDepend = 0; - break; - } - } - if(pNewDepend) - aFrameArr.C40_INSERT(SwDepend, pNewDepend, aFrameArr.Count()); - } - } - } - CreatePortions(); -} -/*-- 27.01.99 10:44:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ -SwXTextPortionEnumeration::~SwXTextPortionEnumeration() -{ - for(sal_uInt16 nFrame = aFrameArr.Count(); nFrame; nFrame--) - { - SwDepend* pCurDepend = aFrameArr.GetObject(nFrame - 1); - delete pCurDepend; - aFrameArr.Remove(nFrame - 1); - } - - if( aPortionArr.Count() ) - aPortionArr.DeleteAndDestroy(0, aPortionArr.Count() ); - - SwUnoCrsr* pUnoCrsr = GetCrsr(); - delete pUnoCrsr; -} -/*-- 27.01.99 10:44:44--------------------------------------------------- - - -----------------------------------------------------------------------*/ -sal_Bool SwXTextPortionEnumeration::hasMoreElements(void) throw( uno::RuntimeException ) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - return aPortionArr.Count() > 0; -} -/*-- 27.01.99 10:44:45--------------------------------------------------- - - -----------------------------------------------------------------------*/ -uno::Any SwXTextPortionEnumeration::nextElement(void) - throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) -{ - vos::OGuard aGuard(Application::GetSolarMutex()); - if(!aPortionArr.Count()) - throw container::NoSuchElementException(); - XTextRangeRefPtr pPortion = aPortionArr.GetObject(0); - Any aRet(pPortion, ::getCppuType((uno::Reference<XTextRange>*)0)); - aPortionArr.Remove(0); - delete pPortion; - return aRet; -} -/* -----------------------------31.08.00 14:28-------------------------------- - - ---------------------------------------------------------------------------*/ -void lcl_InsertRefMarkPortion( - XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText> xParent, SwTxtAttr* pAttr, BOOL bEnd) -{ - SwDoc* pDoc = pUnoCrsr->GetDoc(); - SwFmtRefMark& rRefMark = ((SwFmtRefMark&)pAttr->GetAttr()); - Reference<XTextContent> xContent = ((SwUnoCallBack*)pDoc->GetUnoCallBack())->GetRefMark(rRefMark); - if(!xContent.is()) - xContent = new SwXReferenceMark(pDoc, &rRefMark); - - SwXTextPortion* pPortion; - if(!bEnd) - { - rArr.Insert( - new Reference< XTextRange >(pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_REFMARK_START)), - rArr.Count()); - pPortion->SetRefMark(xContent); - pPortion->SetIsCollapsed(pAttr->GetEnd() ? FALSE : TRUE); - } - else - { - rArr.Insert( - new Reference< XTextRange >(pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_REFMARK_END)), - rArr.Count()); - pPortion->SetRefMark(xContent); - } -} -//----------------------------------------------------------------------------- -void lcl_InsertTOXMarkPortion( - XTextRangeArr& rArr, SwUnoCrsr* pUnoCrsr, Reference<XText> xParent, SwTxtAttr* pAttr, BOOL bEnd) -{ - SwDoc* pDoc = pUnoCrsr->GetDoc(); - SwTOXMark& rTOXMark = ((SwTOXMark&)pAttr->GetAttr()); - - Reference<XTextContent> xContent = - ((SwUnoCallBack*)pDoc->GetUnoCallBack())->GetTOXMark(rTOXMark); - if(!xContent.is()) - xContent = new SwXDocumentIndexMark(rTOXMark.GetTOXType(), &rTOXMark, pDoc); - - SwXTextPortion* pPortion; - if(!bEnd) - { - rArr.Insert( - new Reference< XTextRange >(pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_TOXMARK_START)), - rArr.Count()); - pPortion->SetTOXMark(xContent); - pPortion->SetIsCollapsed(pAttr->GetEnd() ? FALSE : TRUE); - } - if(bEnd) - { - rArr.Insert( - new Reference< XTextRange >(pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_TOXMARK_END)), - rArr.Count()); - pPortion->SetTOXMark(xContent); - } -} -//----------------------------------------------------------------------------- -#define BKM_TYPE_START 0 -#define BKM_TYPE_END 1 -#define BKM_TYPE_START_END 2 -struct SwXBookmarkPortion_Impl -{ - SwXBookmark* pBookmark; - Reference<XTextContent> xBookmark; - BYTE nBkmType; - ULONG nIndex; - - SwXBookmarkPortion_Impl( SwXBookmark* pXMark, BYTE nType, ULONG nIdx) : - pBookmark(pXMark), - xBookmark(pXMark), - nBkmType(nType), - nIndex(nIdx){} - - // compare by nIndex - BOOL operator < (const SwXBookmarkPortion_Impl &rCmp) const; - BOOL operator ==(const SwXBookmarkPortion_Impl &rCmp) const; - -}; -BOOL SwXBookmarkPortion_Impl::operator ==(const SwXBookmarkPortion_Impl &rCmp) const -{ - return nIndex == rCmp.nIndex && - pBookmark == rCmp.pBookmark && - nBkmType == rCmp.nBkmType; -} - -BOOL SwXBookmarkPortion_Impl::operator < (const SwXBookmarkPortion_Impl &rCmp) const -{ - return nIndex < rCmp.nIndex; -} - -typedef SwXBookmarkPortion_Impl* SwXBookmarkPortion_ImplPtr; -SV_DECL_PTRARR_SORT(SwXBookmarkPortionArr, SwXBookmarkPortion_ImplPtr, 0, 2) -SV_IMPL_OP_PTRARR_SORT(SwXBookmarkPortionArr, SwXBookmarkPortion_ImplPtr) -//----------------------------------------------------------------------------- -void lcl_ExportBookmark( - SwXBookmarkPortionArr& rBkmArr, ULONG nIndex, - SwUnoCrsr* pUnoCrsr, Reference<XText> xParent, XTextRangeArr& rPortionArr) -{ - SwXBookmarkPortion_ImplPtr pPtr; - while(rBkmArr.Count() && nIndex == (pPtr = rBkmArr.GetObject(0))->nIndex) - { - SwXTextPortion* pPortion; - if(BKM_TYPE_START == pPtr->nBkmType || BKM_TYPE_START_END == pPtr->nBkmType) - { - rPortionArr.Insert( - new Reference< XTextRange >(pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_BOOKMARK_START)), - rPortionArr.Count()); - pPortion->SetBookmark(pPtr->xBookmark); - pPortion->SetIsCollapsed(BKM_TYPE_START_END == pPtr->nBkmType ? TRUE : FALSE); - - } - if(BKM_TYPE_END == pPtr->nBkmType) - { - rPortionArr.Insert( - new Reference< XTextRange >(pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_BOOKMARK_END)), - rPortionArr.Count()); - pPortion->SetBookmark(pPtr->xBookmark); - } - rBkmArr.Remove((USHORT)0); - delete pPtr; - } -} -//----------------------------------------------------------------------------- -Reference<XTextRange> lcl_ExportHints(SwpHints* pHints, - XTextRangeArr& rPortionArr, - SwUnoCrsr* pUnoCrsr, - Reference<XText> xParent, - const xub_StrLen nCurrentIndex, - SwTextPortionType& ePortionType, - const xub_StrLen& nFirstFrameIndex, - SwXBookmarkPortionArr& aBkmArr) -{ - Reference<XTextRange> xRef; - SwDoc* pDoc = pUnoCrsr->GetDoc(); - sal_Bool bAttrFound = sal_False; - //search for special text attributes - first some ends - sal_uInt16 nEndIndex = 0; - sal_uInt16 nNextEnd = 0; - while(nEndIndex < pHints->GetEndCount() && - (!pHints->GetEnd(nEndIndex)->GetEnd() || - nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetEnd())))) - { - if(pHints->GetEnd(nEndIndex)->GetEnd()) - { - SwTxtAttr* pAttr = pHints->GetEnd(nEndIndex); - USHORT nAttrWhich = pAttr->Which(); - if(nNextEnd == nCurrentIndex && - ( RES_TXTATR_TOXMARK == nAttrWhich || - RES_TXTATR_REFMARK == nAttrWhich)) - { - switch( nAttrWhich ) - { - case RES_TXTATR_TOXMARK: - lcl_InsertTOXMarkPortion( - rPortionArr, pUnoCrsr, xParent, pAttr, TRUE); - ePortionType = PORTION_TEXT; - break; - case RES_TXTATR_REFMARK: - lcl_InsertRefMarkPortion( - rPortionArr, pUnoCrsr, xParent, pAttr, TRUE); - ePortionType = PORTION_TEXT; - break; - - } - } - } - nEndIndex++; - } - //then som starts - sal_uInt16 nStartIndex = 0; - sal_uInt16 nNextStart = 0; - while(nStartIndex < pHints->GetStartCount() && - nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart()))) - { - SwTxtAttr* pAttr = pHints->GetStart(nStartIndex); - USHORT nAttrWhich = pAttr->Which(); - if(nNextStart == nCurrentIndex && - (!pAttr->GetEnd() || - RES_TXTATR_TOXMARK == nAttrWhich || - RES_TXTATR_REFMARK == nAttrWhich)) - { - switch( nAttrWhich ) - { - case RES_TXTATR_FIELD: - pUnoCrsr->Right(1); - bAttrFound = sal_True; - ePortionType = PORTION_FIELD; - break; - case RES_TXTATR_FLYCNT : - pUnoCrsr->Right(1); - pUnoCrsr->Exchange(); - bAttrFound = sal_True; - ePortionType = PORTION_FRAME; - break; - case RES_TXTATR_FTN : - { - pUnoCrsr->Right(1); - SwXTextPortion* pPortion; - xRef = pPortion = new SwXTextPortion(*pUnoCrsr, xParent, PORTION_FOOTNOTE); - Reference<XTextContent> xContent = - Reference<XTextContent>( - SwXFootnotes::GetObject(*pDoc, pAttr->SwTxtAttr::GetFtn()), - UNO_QUERY); - pPortion->SetFootnote(xContent); - bAttrFound = sal_True; - ePortionType = PORTION_TEXT; - } - break; - case RES_TXTATR_SOFTHYPH : - { - SwXTextPortion* pPortion; - rPortionArr.Insert( - new Reference< XTextRange >( - pPortion = new SwXTextPortion( - *pUnoCrsr, xParent, PORTION_CONTROL_CHAR)), - rPortionArr.Count()); - pPortion->SetControlChar(3); - ePortionType = PORTION_TEXT; - } - break; - case RES_TXTATR_HARDBLANK: - { - ePortionType = PORTION_CONTROL_CHAR; - SwXTextPortion* pPortion; - rPortionArr.Insert( - new Reference< XTextRange >( - pPortion = new SwXTextPortion( - *pUnoCrsr, xParent, PORTION_CONTROL_CHAR)), - rPortionArr.Count()); - const SwFmtHardBlank& rFmt = pAttr->GetHardBlank(); - if(rFmt.GetChar() == '-') - pPortion->SetControlChar(2);//HARD_HYPHEN - else - pPortion->SetControlChar(4);//HARD_SPACE - ePortionType = PORTION_TEXT; - } - break; - case RES_TXTATR_TOXMARK: - lcl_InsertTOXMarkPortion( - rPortionArr, pUnoCrsr, xParent, pAttr, FALSE); - ePortionType = PORTION_TEXT; - break; - case RES_TXTATR_REFMARK: - pUnoCrsr->Right(1); - bAttrFound = sal_True; - lcl_InsertRefMarkPortion( - rPortionArr, pUnoCrsr, xParent, pAttr, FALSE); - ePortionType = PORTION_TEXT; - if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark()) - pUnoCrsr->Exchange(); - pUnoCrsr->DeleteMark(); - break; - default: - DBG_ERROR("was fuer ein Attribut?"); - } - - } - nStartIndex++; - } - - if(!bAttrFound) - { - // hier wird nach Uebergaengen zwischen Attributen gesucht, die nach der - // aktuellen Cursorposition liegen - // wenn dabei ein Rahmen 'ueberholt' wird, dann muss auch in der TextPortion unterbrochen werden - - nStartIndex = 0; - nNextStart = 0; - while(nStartIndex < pHints->GetStartCount() && - nCurrentIndex >= (nNextStart = (*pHints->GetStart(nStartIndex)->GetStart()))) - nStartIndex++; - - sal_uInt16 nEndIndex = 0; - sal_uInt16 nNextEnd = 0; - while(nEndIndex < pHints->GetEndCount() && - nCurrentIndex >= (nNextEnd = (*pHints->GetEnd(nEndIndex)->GetAnyEnd()))) - nEndIndex++; - //nMovePos legt die neue EndPosition fest - sal_uInt16 nMovePos = nNextStart > nCurrentIndex && nNextStart < nNextEnd ? nNextStart : nNextEnd; - - if(aBkmArr.Count() && aBkmArr.GetObject(0)->nIndex < nMovePos) - { - DBG_ASSERT(aBkmArr.GetObject(0)->nIndex > nCurrentIndex, - "forgotten bookmark(s)") - nMovePos = aBkmArr.GetObject(0)->nIndex; - } - // liegt die Endposition nach dem naechsten Rahmen, dann aufbrechen - if(nFirstFrameIndex != STRING_MAXLEN && nMovePos > nFirstFrameIndex) - nMovePos = nFirstFrameIndex; - - if(nMovePos > nCurrentIndex) - pUnoCrsr->Right(nMovePos - nCurrentIndex); - else - pUnoCrsr->MovePara(fnParaCurr, fnParaEnd); - } - return xRef; -} -//----------------------------------------------------------------------------- -void SwXTextPortionEnumeration::CreatePortions() -{ - uno::Any aRet; - SwUnoCrsr* pUnoCrsr = GetCrsr(); - if(pUnoCrsr /*&& !bAtEnd*/) - { - SwXBookmarkPortionArr aBkmArr; - SwDoc* pDoc = pUnoCrsr->GetDoc(); - const SwNodeIndex nOwnNode = pUnoCrsr->GetPoint()->nNode; - //search for all bookmarks that start or end in this paragraph - const SwBookmarks& rMarks = pDoc->GetBookmarks(); - sal_uInt16 nArrLen = rMarks.Count(); - for( sal_uInt16 n = 0; n < nArrLen; ++n ) - { - SwBookmark* pMark = rMarks.GetObject( n ); - if( !pMark->IsBookMark() ) - continue; - - const SwPosition& rPos1 = pMark->GetPos(); - const SwPosition* pPos2 = pMark->GetOtherPos(); - BOOL bBackward = pPos2 ? rPos1 > *pPos2: FALSE; - if(rPos1.nNode == nOwnNode) - { - BYTE nType = bBackward ? BKM_TYPE_END : BKM_TYPE_START; - if(!pPos2) - { - nType = BKM_TYPE_START_END; - } - SwXBookmarkPortion_ImplPtr pBkmPtr = new SwXBookmarkPortion_Impl( - SwXBookmarks::GetObject( *pMark, pDoc ), nType, rPos1.nContent.GetIndex() ); - - aBkmArr.Insert(pBkmPtr); - - } - if(pPos2 && pPos2->nNode == nOwnNode) - { - BYTE nType = bBackward ? BKM_TYPE_START : BKM_TYPE_END; - SwXBookmarkPortion_ImplPtr pBkmPtr = new SwXBookmarkPortion_Impl( - SwXBookmarks::GetObject( *pMark, pDoc ), nType, pPos2->nContent.GetIndex() ); - aBkmArr.Insert(pBkmPtr); - } - } -#ifdef DEBUG - for(long i_debug = 0; i_debug <aBkmArr.Count(); i_debug++) - { - SwXBookmarkPortion_ImplPtr pPtr = aBkmArr.GetObject(i_debug); - } - -#endif - while(!bAtEnd) - { - if(pUnoCrsr->HasMark()) - { - if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark()) - pUnoCrsr->Exchange(); - pUnoCrsr->DeleteMark(); - } - if(!bFirstPortion && pUnoCrsr->GetCntntNode() && - pUnoCrsr->GetPoint()->nContent == pUnoCrsr->GetCntntNode()->Len()) - { - //hier sollte man nie ankommen! - bAtEnd = sal_True; - } - else - { - SwNode* pNode = pUnoCrsr->GetNode(); - if(ND_TEXTNODE == pNode->GetNodeType()) - { - SwTxtNode* pTxtNode = (SwTxtNode*)pNode; - SwpHints* pHints = pTxtNode->GetpSwpHints(); - SwTextPortionType ePortionType = PORTION_TEXT; - xub_StrLen nCurrentIndex = pUnoCrsr->GetPoint()->nContent.GetIndex(); - xub_StrLen nFirstFrameIndex = STRING_MAXLEN; - uno::Reference< XTextRange > xRef; - if(!pUnoCrsr->GetCntntNode()->Len()) - { - if(pHints) - { - DBG_ERROR("hints not exported") - } - if(aBkmArr.Count()) - { - lcl_ExportBookmark(aBkmArr, 0, pUnoCrsr, xParent, aPortionArr); - } - // der Absatz ist leer, also nur Portion erzeugen und raus - xRef = new SwXTextPortion(*pUnoCrsr, xParent, ePortionType); - } - else - { - //falls schon Rahmen entsorgt wurden, dann raus hier - for(sal_uInt16 nFrame = aFrameArr.Count(); nFrame; nFrame--) - { - SwDepend* pCurDepend = aFrameArr.GetObject(nFrame - 1); - if(!pCurDepend->GetRegisteredIn()) - { - delete pCurDepend; - aFrameArr.Remove(nFrame - 1); - } - } - - //zunaechst den ersten Frame im aFrameArr finden (bezogen auf die Position im Absatz) - SwDepend* pFirstFrameDepend = 0; - //Eintraege im aFrameArr sind sortiert! - if(aFrameArr.Count()) - { - SwDepend* pCurDepend = aFrameArr.GetObject(0); - SwFrmFmt* pFormat = (SwFrmFmt*)pCurDepend->GetRegisteredIn(); - const SwFmtAnchor& rAnchor = pFormat->GetAnchor(); - const SwPosition* pAnchorPos = rAnchor.GetCntntAnchor(); - pFirstFrameDepend = pCurDepend; - nFirstFrameIndex = pAnchorPos->nContent.GetIndex(); - } - - SwXTextCursor::SelectPam(*pUnoCrsr, sal_True); - - //ist hier schon ein Rahmen faellig? - if(nCurrentIndex == nFirstFrameIndex) - { - xRef = new SwXTextPortion(*pUnoCrsr, xParent, - *(SwFrmFmt*)pFirstFrameDepend->GetRegisteredIn()); - SwDepend* pCurDepend = aFrameArr.GetObject(0); - delete pCurDepend; - aFrameArr.Remove(0); - } - } - if(!xRef.is()) - { - lcl_ExportBookmark(aBkmArr, nCurrentIndex, pUnoCrsr, xParent, aPortionArr); - if(pHints) - { - xRef = lcl_ExportHints(pHints, - aPortionArr, - pUnoCrsr, - xParent, - nCurrentIndex, - ePortionType, - nFirstFrameIndex, - aBkmArr); - - } - else if(USHRT_MAX != nFirstFrameIndex) - { - pUnoCrsr->Right(nFirstFrameIndex - nCurrentIndex); - } - else - { - lcl_ExportBookmark(aBkmArr, nCurrentIndex, pUnoCrsr, xParent, aPortionArr); - if(!aBkmArr.Count()) - sal_Bool bMove = pUnoCrsr->MovePara(fnParaCurr, fnParaEnd); - else - { - SwXBookmarkPortion_ImplPtr pPtr = aBkmArr.GetObject(0); - sal_uInt16 nMovePos = pPtr->nIndex; - DBG_ASSERT(nMovePos > nCurrentIndex, "wrong move index") - pUnoCrsr->Right(nMovePos - nCurrentIndex); - } - } - } - if(!xRef.is() && pUnoCrsr->HasMark() ) - xRef = new SwXTextPortion(*pUnoCrsr, xParent, ePortionType); - if(xRef.is()) - aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count()); - } - else - { - DBG_ERROR("kein TextNode - was nun?") - } - } - if(*pUnoCrsr->GetPoint() < *pUnoCrsr->GetMark()) - pUnoCrsr->Exchange(); - - // Absatzende ? - if(pUnoCrsr->GetCntntNode() && - pUnoCrsr->GetPoint()->nContent == pUnoCrsr->GetCntntNode()->Len()) - { - bAtEnd = sal_True; - lcl_ExportBookmark(aBkmArr, pUnoCrsr->GetCntntNode()->Len(), - pUnoCrsr, xParent, aPortionArr); - SwNode* pNode = pUnoCrsr->GetNode(); - if(ND_TEXTNODE == pNode->GetNodeType()) - { - SwTxtNode* pTxtNode = (SwTxtNode*)pNode; - SwpHints* pHints = pTxtNode->GetpSwpHints(); - if(pHints) - { - SwTextPortionType ePortionType = PORTION_TEXT; - Reference<XTextRange> xRef = lcl_ExportHints(pHints, - aPortionArr, - pUnoCrsr, - xParent, - pUnoCrsr->GetCntntNode()->Len(), - ePortionType, - STRING_MAXLEN, - aBkmArr); - if(xRef.is()) - aPortionArr.Insert(new Reference<XTextRange>(xRef), aPortionArr.Count()); - } - } - } - } - } -} -/*-- 27.01.99 10:44:45--------------------------------------------------- - - -----------------------------------------------------------------------*/ -void SwXTextPortionEnumeration::Modify( SfxPoolItem *pOld, SfxPoolItem *pNew) -{ - ClientModify(this, pOld, pNew); -} /* -----------------22.04.99 11:24------------------- * |