openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From o..@apache.org
Subject svn commit: r1542986 [2/9] - in /openoffice/trunk/main/sw: ./ inc/ sdi/ source/core/access/ source/core/bastyp/ source/core/crsr/ source/core/doc/ source/core/docnode/ source/core/edit/ source/core/fields/ source/core/frmedt/ source/core/inc/ source/co...
Date Mon, 18 Nov 2013 11:29:27 GMT
Modified: openoffice/trunk/main/sw/source/core/crsr/crstrvl.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/crstrvl.cxx?rev=1542986&r1=1542985&r2=1542986&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/crstrvl.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/crstrvl.cxx Mon Nov 18 11:29:24 2013
@@ -40,7 +40,7 @@
 #include <pam.hxx>
 #include <ndtxt.hxx>
 #include <fldbas.hxx>
-#include <swtable.hxx>		// SwTxtFld
+#include <swtable.hxx>
 #include <docary.hxx>
 #include <txtfld.hxx>
 #include <fmtfld.hxx>
@@ -56,7 +56,7 @@
 #include <docfld.hxx>
 #include <expfld.hxx>
 #include <reffld.hxx>
-#include <flddat.hxx>       // SwTxtFld
+#include <flddat.hxx>
 #include <cellatr.hxx>
 #include <swundo.hxx>
 #include <redline.hxx>
@@ -618,74 +618,85 @@ const SwTOXMark& SwCrsrShell::GotoTOXMar
 
 // springe zum naechsten / vorherigen FeldTypen
 
-void lcl_MakeFldLst( _SetGetExpFlds& rLst, const SwFieldType& rFldType,
-						sal_uInt16 nSubType, sal_Bool bInReadOnly,
-						sal_Bool bChkInpFlag = sal_False )
-{
-	// es muss immer der 1. Frame gesucht werden
-	Point aPt;
-	SwTxtFld* pTxtFld;
-	SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
-	bool bSubType = nSubType != USHRT_MAX;
-	for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
-		if( 0 != ( pTxtFld = pFmtFld->GetTxtFld() ) &&
-			( !bChkInpFlag || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField())
-								->GetInputFlag() ) &&
-			(!bSubType || (pFmtFld->GetField()->GetSubType()
-								& 0xff ) == nSubType ))
-		{
-			SwCntntFrm* pCFrm;
-			const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
-			if( 0 != ( pCFrm = rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False )) &&
-				( bInReadOnly || !pCFrm->IsProtected() ))
-			{
-				_SetGetExpFld* pNew = new _SetGetExpFld(
-								SwNodeIndex( rTxtNode ), pTxtFld );
-				pNew->SetBodyPos( *pCFrm );
-				rLst.Insert( pNew );
-			}
-		}
+void lcl_MakeFldLst(
+    _SetGetExpFlds& rLst,
+    const SwFieldType& rFldType,
+    const bool bInReadOnly,
+    const bool bChkInpFlag = false )
+{
+    // es muss immer der 1. Frame gesucht werden
+    Point aPt;
+    SwTxtFld* pTxtFld = NULL;
+    SwIterator<SwFmtFld,SwFieldType> aIter(rFldType);
+    for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() )
+    {
+        pTxtFld = pFmtFld->GetTxtFld();
+        if ( pTxtFld != NULL
+             && ( !bChkInpFlag
+                  || ((SwSetExpField*)pTxtFld->GetFmtFld().GetField())->GetInputFlag() ) )
+        {
+            const SwTxtNode& rTxtNode = pTxtFld->GetTxtNode();
+            const SwCntntFrm* pCFrm =
+                rTxtNode.getLayoutFrm( rTxtNode.GetDoc()->GetCurrentLayout(), &aPt, 0, sal_False );
+            if ( pCFrm != NULL
+                 && ( bInReadOnly || !pCFrm->IsProtected() ) )
+            {
+                _SetGetExpFld* pNew = new _SetGetExpFld( SwNodeIndex( rTxtNode ), pTxtFld );
+                pNew->SetBodyPos( *pCFrm );
+                rLst.Insert( pNew );
+            }
+        }
+    }
 }
 
 
-sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
-											sal_uInt16 nSubType, sal_uInt16 nResType )
+sal_Bool SwCrsrShell::MoveFldType(
+    const SwFieldType* pFldType,
+    const bool bNext,
+    const sal_uInt16 nResType,
+    const bool bAddSetExpressionFldsToInputFlds )
 {
-	// sortierte Liste aller Felder
-	_SetGetExpFlds aSrtLst( 64 );
-
-	if (pFldType)
-	{
-		if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
-			return sal_False;
+    // sortierte Liste aller Felder
+    _SetGetExpFlds aSrtLst( 64 );
 
-		// Modify-Object gefunden, trage alle Felder ins Array ein
-		::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType, IsReadOnlyAvailable() );
+    if ( pFldType )
+    {
+        if( RES_INPUTFLD != pFldType->Which() && !pFldType->GetDepends() )
+        {
+            return sal_False;
+        }
 
-		if( RES_INPUTFLD == pFldType->Which() )
-		{
-			// es gibt noch versteckte InputFelder in den SetExp. Feldern
-			const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
-			const sal_uInt16 nSize = rFldTypes.Count();
-
-			// Alle Typen abklappern
-			for( sal_uInt16 i=0; i < nSize; ++i )
-				if( RES_SETEXPFLD == ( pFldType = rFldTypes[ i ] )->Which() )
-					::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
-								IsReadOnlyAvailable(), sal_True );
-		}
-	}
-	else
-	{
-		const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
-		const sal_uInt16 nSize = rFldTypes.Count();
+        // Modify-Object gefunden, trage alle Felder ins Array ein
+        ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ) );
 
-		// Alle Typen abklappern
-		for( sal_uInt16 i=0; i < nSize; ++i )
-			if( nResType == ( pFldType = rFldTypes[ i ] )->Which() )
-				::lcl_MakeFldLst( aSrtLst, *pFldType, nSubType,
-								IsReadOnlyAvailable() );
-	}
+        if( RES_INPUTFLD == pFldType->Which() && bAddSetExpressionFldsToInputFlds )
+        {
+            // es gibt noch versteckte InputFelder in den SetExp. Feldern
+            const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
+            const sal_uInt16 nSize = rFldTypes.Count();
+            for( sal_uInt16 i=0; i < nSize; ++i )
+            {
+                pFldType = rFldTypes[ i ];
+                if ( RES_SETEXPFLD == pFldType->Which() )
+                {
+                    ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ), true );
+                }
+            }
+        }
+    }
+    else
+    {
+        const SwFldTypes& rFldTypes = *pDoc->GetFldTypes();
+        const sal_uInt16 nSize = rFldTypes.Count();
+        for( sal_uInt16 i=0; i < nSize; ++i )
+        {
+            pFldType = rFldTypes[ i ];
+            if( nResType == pFldType->Which() )
+            {
+                ::lcl_MakeFldLst( aSrtLst, *pFldType, ( IsReadOnlyAvailable() ? true : false ) );
+            }
+        }
+    }
 
 	// keine Felder gefunden?
 	if( !aSrtLst.Count() )
@@ -703,48 +714,54 @@ sal_Bool SwCrsrShell::MoveFldType( const
 		SwTxtNode* pTNd = rPos.nNode.GetNode().GetTxtNode();
 		ASSERT( pTNd, "Wo ist mein CntntNode?" );
 
-        SwTxtFld * pTxtFld = static_cast<SwTxtFld *>(
-            pTNd->GetTxtAttrForCharAt(rPos.nContent.GetIndex(),
-                RES_TXTATR_FIELD));
-		sal_Bool bDelFld = 0 == pTxtFld;
-		if( bDelFld )
-		{
-			SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
-				(SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
+        SwTxtFld * pTxtFld = pTNd->GetFldTxtAttrAt( rPos.nContent.GetIndex(), true );
+        const bool bDelFld = ( pTxtFld == NULL );
+        if( bDelFld )
+        {
+            // create dummy for the search
+            SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
+                (SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) ) );
 
             pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() );
-			pTxtFld->ChgTxtNode( pTNd );
-		}
+            pTxtFld->ChgTxtNode( pTNd );
+        }
 
-		_SetGetExpFld aSrch( rPos.nNode, pTxtFld, &rPos.nContent );
-		if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() )
-		{
-			// auch beim Einsammeln wird nur der erste Frame benutzt!
-			Point aPt;
-			aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
-		}
+        SwIndex aSearchIdx( rPos.nContent );
+        if ( !bDelFld && pTxtFld->HasContent() )
+        {
+            aSearchIdx = *(pTxtFld->GetStart());
+        }
+        _SetGetExpFld aSrch( rPos.nNode, pTxtFld, &aSearchIdx );
+        if( rPos.nNode.GetIndex() < pDoc->GetNodes().GetEndOfExtras().GetIndex() )
+        {
+            // auch beim Einsammeln wird nur der erste Frame benutzt!
+            Point aPt;
+            aSrch.SetBodyPos( *pTNd->getLayoutFrm( GetLayout(), &aPt, &rPos, sal_False ) );
+        }
 
-		sal_Bool bFound = aSrtLst.Seek_Entry( &aSrch, &nPos );
-		if( bDelFld )
-		{
-			delete (SwFmtFld*)&pTxtFld->GetAttr();
-			delete pTxtFld;
-		}
+        sal_Bool bFound = aSrtLst.Seek_Entry( &aSrch, &nPos );
+        if( bDelFld )
+        {
+            delete (SwFmtFld*)&pTxtFld->GetAttr();
+            delete pTxtFld;
+        }
 
-		if( bFound )		// stehe auf einem ?
-		{
-			if( bNext )
-			{
-				if( ++nPos >= aSrtLst.Count() )
-					return sal_False;					// schon am Ende
-			}
-			else if( !nPos-- )
-				return sal_False;	  	// weiter nach vorne geht nicht
-		}
-		else if( bNext ? nPos >= aSrtLst.Count() : !nPos--)
-			return sal_False;
-	}
-	const _SetGetExpFld& rFnd = **( aSrtLst.GetData() + nPos );
+        if( bFound )		// stehe auf einem ?
+        {
+            if( bNext )
+            {
+                if( ++nPos >= aSrtLst.Count() )
+                    return sal_False;					// schon am Ende
+            }
+            else if( !nPos-- )
+                return sal_False;	  	// weiter nach vorne geht nicht
+        }
+        else if( bNext ? nPos >= aSrtLst.Count() : !nPos--)
+        {
+            return sal_False;
+        }
+    }
+    const _SetGetExpFld& rFnd = **( aSrtLst.GetData() + nPos );
 
 
 	SET_CURR_SHELL( this );
@@ -783,6 +800,128 @@ sal_Bool SwCrsrShell::GotoFld( const SwF
 }
 
 
+SwTxtFld * SwCrsrShell::GetTxtFldAtPos(
+    const SwPosition* pPos,
+    const bool bIncludeInputFldAtStart ) const
+{
+    SwTxtFld* pTxtFld = NULL;
+
+    SwTxtNode * const pNode = pPos->nNode.GetNode().GetTxtNode();
+    if ( pNode != NULL )
+    {
+        pTxtFld = pNode->GetFldTxtAttrAt( pPos->nContent.GetIndex(), bIncludeInputFldAtStart );
+    }
+
+    return pTxtFld;
+}
+
+
+SwField* SwCrsrShell::GetFieldAtCrsr(
+    const SwPaM* pCrsr,
+    const bool bIncludeInputFldAtStart ) const
+{
+    SwField* pFieldAtCrsr = NULL;
+
+    SwTxtFld* pTxtFld = GetTxtFldAtPos( pCrsr->Start(), bIncludeInputFldAtStart );
+    if ( pTxtFld != NULL
+        && pCrsr->Start()->nNode == pCrsr->End()->nNode )
+    {
+        const xub_StrLen nTxtFldLength =
+            pTxtFld->End() != NULL
+            ? *(pTxtFld->End()) - *(pTxtFld->GetStart())
+            : 1;
+        if ( ( pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex() ) <= nTxtFldLength )
+        {
+            pFieldAtCrsr = (SwField*)pTxtFld->GetFmtFld().GetField();
+        }
+    }
+
+    return pFieldAtCrsr;
+}
+
+
+SwField* SwCrsrShell::GetCurFld( const bool bIncludeInputFldAtStart ) const
+{
+    SwPaM* pCrsr = GetCrsr();
+    if ( pCrsr->GetNext() != pCrsr )
+    {
+        // multi selection not handled.
+        return NULL;
+    }
+
+    SwField* pCurFld = GetFieldAtCrsr( pCrsr, bIncludeInputFldAtStart );;
+    if ( pCurFld != NULL
+         && RES_TABLEFLD == pCurFld->GetTyp()->Which() )
+    {
+        // TabellenFormel ? wandel internen in externen Namen um
+        const SwTableNode* pTblNd = IsCrsrInTbl();
+        ((SwTblField*)pCurFld)->PtrToBoxNm( pTblNd ? &pTblNd->GetTable() : 0 );
+    }
+
+    return pCurFld;
+}
+
+
+bool SwCrsrShell::CrsrInsideInputFld() const
+{
+    bool bCrsrInsideInputFld = false;
+
+    const SwPaM* pCrsr = GetCrsr();
+    const SwPaM* pFirst = pCrsr;
+    do
+    {
+        bCrsrInsideInputFld = dynamic_cast<const SwInputField*>(GetFieldAtCrsr( pCrsr, false )) != NULL;
+
+        pCrsr = static_cast<SwPaM*>(pCrsr->GetNext());
+    } while ( !bCrsrInsideInputFld
+              && pCrsr != pFirst );
+
+    return bCrsrInsideInputFld;
+}
+
+
+bool SwCrsrShell::PosInsideInputFld( const SwPosition& rPos ) const
+{
+    return dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, false )) != NULL;
+}
+
+
+bool SwCrsrShell::DocPtInsideInputFld( const Point& rDocPt ) const
+{
+    SwPosition aPos( *(GetCrsr()->Start()) );
+    Point aDocPt( rDocPt );
+    if ( GetLayout()->GetCrsrOfst( &aPos, aDocPt ) )
+    {
+        return PosInsideInputFld( aPos );
+    }
+    return false;
+}
+
+
+xub_StrLen SwCrsrShell::StartOfInputFldAtPos( const SwPosition& rPos ) const
+{
+    const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
+    if ( pTxtInputFld == NULL )
+    {
+        ASSERT( false, "<SwEditShell::StartOfInputFldAtPos(..)> - no Input Field at given position" );
+        return 0;
+    }
+    return *(pTxtInputFld->GetStart());
+}
+
+
+xub_StrLen SwCrsrShell::EndOfInputFldAtPos( const SwPosition& rPos ) const
+{
+    const SwTxtInputFld* pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtFldAtPos( &rPos, true ));
+    if ( pTxtInputFld == NULL )
+    {
+        ASSERT( false, "<SwEditShell::EndOfInputFldAtPos(..)> - no Input Field at given position" );
+        return 0;
+    }
+    return *(pTxtInputFld->End());
+}
+
+
 void SwCrsrShell::GotoOutline( sal_uInt16 nIdx )
 {
 	SwCursor* pCrsr = getShellCrsr( true );
@@ -1003,52 +1142,50 @@ sal_Bool SwCrsrShell::GetContentAtPos( c
                                    sal_Bool bSetCrsr,
                                    SwRect* pFldRect )
 {
-	SET_CURR_SHELL( this );
-	sal_Bool bRet = sal_False;
+    SET_CURR_SHELL( this );
+    sal_Bool bRet = sal_False;
 
-	if( !IsTableMode() )
-	{
-		Point aPt( rPt );
-		SwPosition aPos( *pCurCrsr->GetPoint() );
+    if( !IsTableMode() )
+    {
+        Point aPt( rPt );
+        SwPosition aPos( *pCurCrsr->GetPoint() );
 
-		SwTxtNode* pTxtNd;
-		SwCntntFrm *pFrm(0);
-		SwTxtAttr* pTxtAttr;
-		SwCrsrMoveState aTmpState;
-		aTmpState.bFieldInfo = sal_True;
+        SwTxtNode* pTxtNd;
+        SwCntntFrm *pFrm(0);
+        SwTxtAttr* pTxtAttr;
+        SwCrsrMoveState aTmpState;
+        aTmpState.bFieldInfo = sal_True;
         aTmpState.bExactOnly = !( SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos );
         aTmpState.bCntntCheck = (SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos) ?  sal_True : sal_False;
-		aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
+        aTmpState.bSetInReadOnly = IsReadOnlyAvailable();
 
         SwSpecialPos aSpecialPos;
         aTmpState.pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos ) ?
                                 &aSpecialPos : 0;
 
         const sal_Bool bCrsrFoundExact = GetLayout()->GetCrsrOfst( &aPos, aPt, &aTmpState );
-		pTxtNd = aPos.nNode.GetNode().GetTxtNode();
+        pTxtNd = aPos.nNode.GetNode().GetTxtNode();
 
-		const SwNodes& rNds = GetDoc()->GetNodes();
-		if( pTxtNd && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
-			&& rNds.GetOutLineNds().Count() )
-		{
-			const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
-			if( pONd )
-			{
-				rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
+        const SwNodes& rNds = GetDoc()->GetNodes();
+        if( pTxtNd
+            && SwContentAtPos::SW_OUTLINE & rCntntAtPos.eCntntAtPos
+            && rNds.GetOutLineNds().Count() )
+        {
+            const SwTxtNode* pONd = pTxtNd->FindOutlineNodeOfLevel( MAXLEVEL-1);
+            if( pONd )
+            {
+                rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_OUTLINE;
                 rCntntAtPos.sStr = pONd->GetExpandTxt( 0, STRING_LEN, true );
-				bRet = sal_True;
-			}
-		}
-        // --> FME 2005-05-13 #i43742# New function: SW_CONTENT_CHECK
-        else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos &&
-                  bCrsrFoundExact )
+                bRet = sal_True;
+            }
+        }
+        else if ( SwContentAtPos::SW_CONTENT_CHECK & rCntntAtPos.eCntntAtPos
+                  && bCrsrFoundExact )
         {
             bRet = sal_True;
         }
-        // <--
-        // #i23726#
-        else if( pTxtNd &&
-                 SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
+        else if( pTxtNd
+                 && SwContentAtPos::SW_NUMLABEL & rCntntAtPos.eCntntAtPos)
         {
             bRet = aTmpState.bInNumPortion;
             rCntntAtPos.aFnd.pNode = pTxtNd;
@@ -1057,13 +1194,14 @@ sal_Bool SwCrsrShell::GetContentAtPos( c
             Size aSizePixel = GetWin()->LogicToPixel(aSizeLogic);
             rCntntAtPos.nDist = aSizePixel.Width();
         }
-		else if( bCrsrFoundExact && pTxtNd )
-		{
-			if( !aTmpState.bPosCorr )
-			{
-				if( !bRet && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
-					&& !aTmpState.bFtnNoInfo )
-				{
+        else if( bCrsrFoundExact && pTxtNd )
+        {
+            if( !aTmpState.bPosCorr )
+            {
+                if ( !bRet
+                     && SwContentAtPos::SW_SMARTTAG & rCntntAtPos.eCntntAtPos
+                     && !aTmpState.bFtnNoInfo )
+                {
                     const SwWrongList* pSmartTagList = pTxtNd->GetSmartTags();
                     xub_StrLen nCurrent = aPos.nContent.GetIndex();
                     xub_StrLen nBegin = nCurrent;
@@ -1083,159 +1221,153 @@ sal_Bool SwCrsrShell::GetContentAtPos( c
                         else
                             bRet = sal_True;
 
-						if( bRet && bSetCrsr )
-						{
-							SwCrsrSaveState aSaveState( *pCurCrsr );
-							SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt. Link callen
-							pCurCrsr->DeleteMark();
-							*pCurCrsr->GetPoint() = aPos;
-                            if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
-                                                    nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
-								bRet = sal_False;
-							else
-								UpdateCrsr();
-						}
-						if( bRet )
-						{
-//							rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
-//										*pTxtAttr->GetStart(),
-//										*pTxtAttr->GetEnd() - *pTxtAttr->GetStart(),
-//										sal_False );
-
-//							rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
-							rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_SMARTTAG;
-//							rCntntAtPos.pFndTxtAttr = pTxtAttr;
+                        if( bRet && bSetCrsr )
+                        {
+                            SwCrsrSaveState aSaveState( *pCurCrsr );
+                            SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt. Link callen
+                            pCurCrsr->DeleteMark();
+                            *pCurCrsr->GetPoint() = aPos;
+                            if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+                                bRet = sal_False;
+                            else
+                                UpdateCrsr();
+                        }
+                        if( bRet )
+                        {
+                            rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_SMARTTAG;
 
-							if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
-								pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
-						}
+                            if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+                                pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+                        }
                     }
                 }
 
-                if( !bRet && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD )
-					& rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
+                if ( !bRet
+                     && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD ) & rCntntAtPos.eCntntAtPos
+                     && !aTmpState.bFtnNoInfo )
                 {
-                    pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
-                            aPos.nContent.GetIndex(), RES_TXTATR_FIELD );
-					const SwField* pFld = pTxtAttr
-											? pTxtAttr->GetFmtFld().GetField()
-											: 0;
-					if( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos &&
-						pFld && !pFld->HasClickHdl() )
-						pFld = 0;
+                    pTxtAttr = pTxtNd->GetFldTxtAttrAt( aPos.nContent.GetIndex() );
+                    const SwField* pFld = pTxtAttr != NULL
+                                          ? pTxtAttr->GetFmtFld().GetField()
+                                          : 0;
+                    if ( SwContentAtPos::SW_CLICKFIELD & rCntntAtPos.eCntntAtPos
+                         && pFld && !pFld->HasClickHdl() )
+                    {
+                        pFld = 0;
+                    }
 
-					if( pFld )
-					{
-						if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
-							pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+                    if ( pFld )
+                    {
+                        if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+                            pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
 
-						if( bSetCrsr )
-						{
-							SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt. Link callen
-							SwCrsrSaveState aSaveState( *pCurCrsr );
-							pCurCrsr->DeleteMark();
-							*pCurCrsr->GetPoint() = aPos;
-							if( pCurCrsr->IsSelOvr() )
-							{
-								// Click-Felder in geschuetzten Bereichen zulassen
-								// Nur Platzhalter geht nicht!
-								if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
-									 || RES_JUMPEDITFLD == pFld->Which() )
-									pFld = 0;
-							}
-							else
-								UpdateCrsr();
-						}
-						else if( RES_TABLEFLD == pFld->Which() &&
-								((SwTblField*)pFld)->IsIntrnlName() )
-						{
-							// erzeuge aus der internen (fuer CORE)
-							// die externe (fuer UI) Formel
-							const SwTableNode* pTblNd = pTxtNd->FindTableNode();
-							if( pTblNd )		// steht in einer Tabelle
-								((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
-						}
-					}
+                        if( bSetCrsr )
+                        {
+                            SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt. Link callen
+                            SwCrsrSaveState aSaveState( *pCurCrsr );
+                            pCurCrsr->DeleteMark();
+                            *pCurCrsr->GetPoint() = aPos;
+                            if( pCurCrsr->IsSelOvr() )
+                            {
+                                // Click-Felder in geschuetzten Bereichen zulassen
+                                // Nur Platzhalter geht nicht!
+                                if( SwContentAtPos::SW_FIELD & rCntntAtPos.eCntntAtPos
+                                    || RES_JUMPEDITFLD == pFld->Which() )
+                                    pFld = 0;
+                            }
+                            else
+                                UpdateCrsr();
+                        }
+                        else if( RES_TABLEFLD == pFld->Which() &&
+                            ((SwTblField*)pFld)->IsIntrnlName() )
+                        {
+                            // erzeuge aus der internen (fuer CORE)
+                            // die externe (fuer UI) Formel
+                            const SwTableNode* pTblNd = pTxtNd->FindTableNode();
+                            if( pTblNd )		// steht in einer Tabelle
+                                ((SwTblField*)pFld)->PtrToBoxNm( &pTblNd->GetTable() );
+                        }
+                    }
 
-					if( pFld )
-					{
-						rCntntAtPos.aFnd.pFld = pFld;
-						rCntntAtPos.pFndTxtAttr = pTxtAttr;
-						rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
-						bRet = sal_True;
-					}
-				}
+                    if( pFld )
+                    {
+                        rCntntAtPos.aFnd.pFld = pFld;
+                        rCntntAtPos.pFndTxtAttr = pTxtAttr;
+                        rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FIELD;
+                        bRet = sal_True;
+                    }
+                }
 
-		if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
-		{
-            IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
-            sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
-		    if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
-			    rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
-    			rCntntAtPos.aFnd.pFldmark = pFldBookmark;
-	    		bRet=sal_True;
-		    }
-		}
+                if( !bRet && SwContentAtPos::SW_FORMCTRL & rCntntAtPos.eCntntAtPos )
+                {
+                    IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( );
+                    sw::mark::IFieldmark* pFldBookmark = pMarksAccess->getFieldmarkFor( aPos );
+                    if( bCrsrFoundExact && pTxtNd && pFldBookmark) {
+                        rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FORMCTRL;
+                        rCntntAtPos.aFnd.pFldmark = pFldBookmark;
+                        bRet=sal_True;
+                    }
+                }
 
-				if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
-				{
-					if( aTmpState.bFtnNoInfo )
-					{
-						// stehe ueber dem Zeichen der Fussnote (??)
-						bRet = sal_True;
-						if( bSetCrsr )
-						{
-							*pCurCrsr->GetPoint() = aPos;
-							if( !GotoFtnAnchor() )
-								bRet = sal_False;
-						}
-						if( bRet )
-							rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
-					}
+                if( !bRet && SwContentAtPos::SW_FTN & rCntntAtPos.eCntntAtPos )
+                {
+                    if( aTmpState.bFtnNoInfo )
+                    {
+                        // stehe ueber dem Zeichen der Fussnote (??)
+                        bRet = sal_True;
+                        if( bSetCrsr )
+                        {
+                            *pCurCrsr->GetPoint() = aPos;
+                            if( !GotoFtnAnchor() )
+                                bRet = sal_False;
+                        }
+                        if( bRet )
+                            rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
+                    }
                     else if ( 0 != ( pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
-								aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
-					{
-						bRet = sal_True;
-						if( bSetCrsr )
-						{
-							SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
-							SwCrsrSaveState aSaveState( *pCurCrsr );
-							pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
-							SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
-											&pCurCrsr->GetPoint()->nNode,
-											sal_True, !IsReadOnlyAvailable() );
-
-							if( pCNd )
-							{
-								pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
+                        aPos.nContent.GetIndex(), RES_TXTATR_FTN )) )
+                    {
+                        bRet = sal_True;
+                        if( bSetCrsr )
+                        {
+                            SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
+                            SwCrsrSaveState aSaveState( *pCurCrsr );
+                            pCurCrsr->GetPoint()->nNode = *((SwTxtFtn*)pTxtAttr)->GetStartNode();
+                            SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
+                                &pCurCrsr->GetPoint()->nNode,
+                                sal_True, !IsReadOnlyAvailable() );
+
+                            if( pCNd )
+                            {
+                                pCurCrsr->GetPoint()->nContent.Assign( pCNd, 0 );
                                 if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
-                                                        nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
-									bRet = sal_False;
-								else
-									UpdateCrsr();
-							}
-							else
-								bRet = sal_False;
-						}
+                                    nsSwCursorSelOverFlags::SELOVER_TOGGLE ))
+                                    bRet = sal_False;
+                                else
+                                    UpdateCrsr();
+                            }
+                            else
+                                bRet = sal_False;
+                        }
 
-						if( bRet )
-						{
-							rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
-							rCntntAtPos.pFndTxtAttr = pTxtAttr;
-							rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+                        if( bRet )
+                        {
+                            rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_FTN;
+                            rCntntAtPos.pFndTxtAttr = pTxtAttr;
+                            rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
 
-							if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
-								pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
-						}
-					}
-				}
+                            if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+                                pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+                        }
+                    }
+                }
 
-				if( !bRet && ( SwContentAtPos::SW_TOXMARK |
-							   SwContentAtPos::SW_REFMARK ) &
-						rCntntAtPos.eCntntAtPos && !aTmpState.bFtnNoInfo )
-				{
-					pTxtAttr = 0;
-					if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
+                if( !bRet
+                    && ( SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK ) & rCntntAtPos.eCntntAtPos
+                    && !aTmpState.bFtnNoInfo )
+                {
+                    pTxtAttr = 0;
+                    if( SwContentAtPos::SW_TOXMARK & rCntntAtPos.eCntntAtPos )
                     {
                         ::std::vector<SwTxtAttr *> const marks(
                             pTxtNd->GetTxtAttrsAt(
@@ -1246,8 +1378,8 @@ sal_Bool SwCrsrShell::GetContentAtPos( c
                         }
                     }
 
-					if( !pTxtAttr &&
-						SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
+                    if( !pTxtAttr &&
+                        SwContentAtPos::SW_REFMARK & rCntntAtPos.eCntntAtPos )
                     {
                         ::std::vector<SwTxtAttr *> const marks(
                             pTxtNd->GetTxtAttrsAt(
@@ -1258,280 +1390,278 @@ sal_Bool SwCrsrShell::GetContentAtPos( c
                         }
                     }
 
-					if( pTxtAttr )
-					{
-						bRet = sal_True;
-						if( bSetCrsr )
-						{
-							SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
-							SwCrsrSaveState aSaveState( *pCurCrsr );
-							pCurCrsr->DeleteMark();
-							*pCurCrsr->GetPoint() = aPos;
-                            if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
-                                                    nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
-								bRet = sal_False;
-							else
-								UpdateCrsr();
-						}
+                    if( pTxtAttr )
+                    {
+                        bRet = sal_True;
+                        if( bSetCrsr )
+                        {
+                            SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
+                            SwCrsrSaveState aSaveState( *pCurCrsr );
+                            pCurCrsr->DeleteMark();
+                            *pCurCrsr->GetPoint() = aPos;
+                            if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION | nsSwCursorSelOverFlags::SELOVER_TOGGLE ) )
+                                bRet = sal_False;
+                            else
+                                UpdateCrsr();
+                        }
 
-						if( bRet )
-						{
-							const xub_StrLen* pEnd = pTxtAttr->GetEnd();
-							if( pEnd )
-								rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
-											*pTxtAttr->GetStart(),
-                                            *pEnd - *pTxtAttr->GetStart() );
-							else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
-								rCntntAtPos.sStr = pTxtAttr->GetTOXMark().
-													GetAlternativeText();
-
-							rCntntAtPos.eCntntAtPos =
-								RES_TXTATR_TOXMARK == pTxtAttr->Which()
-											? SwContentAtPos::SW_TOXMARK
-											: SwContentAtPos::SW_REFMARK;
-							rCntntAtPos.pFndTxtAttr = pTxtAttr;
-							rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+                        if( bRet )
+                        {
+                            const xub_StrLen* pEnd = pTxtAttr->End();
+                            if( pEnd )
+                                rCntntAtPos.sStr =
+                                    pTxtNd->GetExpandTxt( *pTxtAttr->GetStart(), *pEnd - *pTxtAttr->GetStart() );
+                            else if( RES_TXTATR_TOXMARK == pTxtAttr->Which())
+                                rCntntAtPos.sStr =
+                                    pTxtAttr->GetTOXMark().GetAlternativeText();
+
+                            rCntntAtPos.eCntntAtPos =
+                                RES_TXTATR_TOXMARK == pTxtAttr->Which()
+                                ? SwContentAtPos::SW_TOXMARK
+                                : SwContentAtPos::SW_REFMARK;
+                            rCntntAtPos.pFndTxtAttr = pTxtAttr;
+                            rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
 
-							if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
-								pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
-						}
-					}
-				}
+                            if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+                                pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+                        }
+                    }
+                }
 
-				if( !bRet && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
-					&& !aTmpState.bFtnNoInfo )
+                if ( !bRet
+                     && SwContentAtPos::SW_INETATTR & rCntntAtPos.eCntntAtPos
+                     && !aTmpState.bFtnNoInfo )
                 {
                     pTxtAttr = pTxtNd->GetTxtAttrAt(
                             aPos.nContent.GetIndex(), RES_TXTATR_INETFMT);
-					// nur INetAttrs mit URLs "erkennen"
-					if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
-					{
-						bRet = sal_True;
-						if( bSetCrsr )
-						{
-							SwCrsrSaveState aSaveState( *pCurCrsr );
-							SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt. Link callen
-							pCurCrsr->DeleteMark();
-							*pCurCrsr->GetPoint() = aPos;
+                    // nur INetAttrs mit URLs "erkennen"
+                    if( pTxtAttr && pTxtAttr->GetINetFmt().GetValue().Len() )
+                    {
+                        bRet = sal_True;
+                        if( bSetCrsr )
+                        {
+                            SwCrsrSaveState aSaveState( *pCurCrsr );
+                            SwCallLink aLk( *this );        // Crsr-Moves ueberwachen, evt. Link callen
+                            pCurCrsr->DeleteMark();
+                            *pCurCrsr->GetPoint() = aPos;
                             if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
-                                                    nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
-								bRet = sal_False;
-							else
-								UpdateCrsr();
-						}
-						if( bRet )
-						{
-							rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
-										*pTxtAttr->GetStart(),
-                                        *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
-
-							rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
-							rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
-							rCntntAtPos.pFndTxtAttr = pTxtAttr;
+                                nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+                                bRet = sal_False;
+                            else
+                                UpdateCrsr();
+                        }
+                        if( bRet )
+                        {
+                            rCntntAtPos.sStr = pTxtNd->GetExpandTxt(
+                                *pTxtAttr->GetStart(),
+                                *pTxtAttr->GetEnd() - *pTxtAttr->GetStart() );
+
+                            rCntntAtPos.aFnd.pAttr = &pTxtAttr->GetAttr();
+                            rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_INETATTR;
+                            rCntntAtPos.pFndTxtAttr = pTxtAttr;
 
-							if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
-								pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
-						}
-					}
-				}
+                            if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+                                pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+                        }
+                    }
+                }
 
-				if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
-				{
-					const SwRedline* pRedl = GetDoc()->GetRedline(aPos, NULL);
-					if( pRedl )
-					{
-						rCntntAtPos.aFnd.pRedl = pRedl;
-						rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
-						rCntntAtPos.pFndTxtAttr = 0;
-						bRet = sal_True;
+                if( !bRet && SwContentAtPos::SW_REDLINE & rCntntAtPos.eCntntAtPos )
+                {
+                    const SwRedline* pRedl = GetDoc()->GetRedline(aPos, NULL);
+                    if( pRedl )
+                    {
+                        rCntntAtPos.aFnd.pRedl = pRedl;
+                        rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_REDLINE;
+                        rCntntAtPos.pFndTxtAttr = 0;
+                        bRet = sal_True;
 
-						if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
-							pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
-					}
-				}
-			}
+                        if( pFldRect && 0 != ( pFrm = pTxtNd->getLayoutFrm( GetLayout(), &aPt ) ) )
+                            pFrm->GetCharRect( *pFldRect, aPos, &aTmpState );
+                    }
+                }
+            }
 
-			if( !bRet && (
-				SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
+            if( !bRet
+                 && ( SwContentAtPos::SW_TABLEBOXFML & rCntntAtPos.eCntntAtPos
 #ifdef DBG_UTIL
-				|| SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
+                      || SwContentAtPos::SW_TABLEBOXVALUE & rCntntAtPos.eCntntAtPos
 #endif
-				))
-			{
-				const SwTableNode* pTblNd;
-				const SwTableBox* pBox;
-				const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
-				const SfxPoolItem* pItem;
-				if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
-					0 != ( pBox = pTblNd->GetTable().GetTblBox(
-									pSttNd->GetIndex() )) &&
+                ) )
+            {
+                const SwTableNode* pTblNd;
+                const SwTableBox* pBox;
+                const SwStartNode* pSttNd = pTxtNd->FindTableBoxStartNode();
+                const SfxPoolItem* pItem;
+                if( pSttNd && 0 != ( pTblNd = pTxtNd->FindTableNode()) &&
+                    0 != ( pBox = pTblNd->GetTable().GetTblBox(
+                    pSttNd->GetIndex() )) &&
 #ifdef DBG_UTIL
-					( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
-						RES_BOXATR_FORMULA, sal_False, &pItem )	||
-					  SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
-						RES_BOXATR_VALUE, sal_False, &pItem ))
+                    ( SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+                    RES_BOXATR_FORMULA, sal_False, &pItem )	||
+                    SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+                    RES_BOXATR_VALUE, sal_False, &pItem ))
 #else
-					SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
-						RES_BOXATR_FORMULA, sal_False, &pItem )
+                    SFX_ITEM_SET == pBox->GetFrmFmt()->GetItemState(
+                    RES_BOXATR_FORMULA, sal_False, &pItem )
 #endif
-					)
-				{
-					SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt );
-					if( pF )
-					{
-						// dann aber den CellFrame
-						pFrm = (SwCntntFrm*)pF;
-						while( pF && !pF->IsCellFrm() )
-							pF = pF->GetUpper();
-					}
+                    )
+                {
+                    SwFrm* pF = pTxtNd->getLayoutFrm( GetLayout(), &aPt );
+                    if( pF )
+                    {
+                        // dann aber den CellFrame
+                        pFrm = (SwCntntFrm*)pF;
+                        while( pF && !pF->IsCellFrm() )
+                            pF = pF->GetUpper();
+                    }
 
-					// es wurde ein
-					if( aTmpState.bPosCorr )
-					{
-						if( pF && !pF->Frm().IsInside( aPt ))
-							pF = 0;
-					}
-					else if( !pF )
-						pF = pFrm;
+                    // es wurde ein
+                    if( aTmpState.bPosCorr )
+                    {
+                        if( pF && !pF->Frm().IsInside( aPt ))
+                            pF = 0;
+                    }
+                    else if( !pF )
+                        pF = pFrm;
 
-					if( pF )			// nur dann ist es gueltig!!
-					{
-						// erzeuge aus der internen (fuer CORE)
-						// die externe (fuer UI) Formel
-						rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
+                    if( pF )			// nur dann ist es gueltig!!
+                    {
+                        // erzeuge aus der internen (fuer CORE)
+                        // die externe (fuer UI) Formel
+                        rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXFML;
 #ifdef DBG_UTIL
-						if( RES_BOXATR_VALUE == pItem->Which() )
-							rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
-						else
+                        if( RES_BOXATR_VALUE == pItem->Which() )
+                            rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_TABLEBOXVALUE;
+                        else
 #endif
-						((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
+                            ((SwTblBoxFormula*)pItem)->PtrToBoxNm( &pTblNd->GetTable() );
 
-						bRet = sal_True;
-						if( bSetCrsr )
-						{
-							SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
-							SwCrsrSaveState aSaveState( *pCurCrsr );
-							*pCurCrsr->GetPoint() = aPos;
+                        bRet = sal_True;
+                        if( bSetCrsr )
+                        {
+                            SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
+                            SwCrsrSaveState aSaveState( *pCurCrsr );
+                            *pCurCrsr->GetPoint() = aPos;
                             if( pCurCrsr->IsSelOvr( nsSwCursorSelOverFlags::SELOVER_CHECKNODESSECTION |
-                                                    nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
-								bRet = sal_False;
-							else
-								UpdateCrsr();
-						}
+                                nsSwCursorSelOverFlags::SELOVER_TOGGLE) )
+                                bRet = sal_False;
+                            else
+                                UpdateCrsr();
+                        }
 
-						if( bRet )
-						{
-							if( pFldRect )
-							{
-								*pFldRect = pF->Prt();
-								*pFldRect += pF->Frm().Pos();
-							}
-							rCntntAtPos.pFndTxtAttr = 0;
-							rCntntAtPos.aFnd.pAttr = pItem;
-						}
-					}
-				}
-			}
+                        if( bRet )
+                        {
+                            if( pFldRect )
+                            {
+                                *pFldRect = pF->Prt();
+                                *pFldRect += pF->Frm().Pos();
+                            }
+                            rCntntAtPos.pFndTxtAttr = 0;
+                            rCntntAtPos.aFnd.pAttr = pItem;
+                        }
+                    }
+                }
+            }
 
 #ifdef DBG_UTIL
-			if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
-			{
-				xub_StrLen n = aPos.nContent.GetIndex();
-				SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
-														  POOLATTR_END - 1 );
-				if( pTxtNd->GetpSwpHints() )
-				{
-					for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
-					{
-						const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
-						xub_StrLen nAttrStart = *pHt->GetStart();
-						if( nAttrStart > n ) 		// ueber den Bereich hinaus
-							break;
-
-						if( 0 != pHt->GetEnd() && (
-							( nAttrStart < n &&
-								( pHt->DontExpand() ? n < *pHt->GetEnd()
-													: n <= *pHt->GetEnd() )) ||
-							( n == nAttrStart &&
-								( nAttrStart == *pHt->GetEnd() || !n ))) )
-						{
-							aSet.Put( pHt->GetAttr() );
-						}
-					}
+            if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rCntntAtPos.eCntntAtPos )
+            {
+                xub_StrLen n = aPos.nContent.GetIndex();
+                SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN,
+                    POOLATTR_END - 1 );
+                if( pTxtNd->GetpSwpHints() )
+                {
+                    for( sal_uInt16 i = 0; i < pTxtNd->GetSwpHints().Count(); ++i )
+                    {
+                        const SwTxtAttr* pHt = pTxtNd->GetSwpHints()[i];
+                        xub_StrLen nAttrStart = *pHt->GetStart();
+                        if( nAttrStart > n ) 		// ueber den Bereich hinaus
+                            break;
+
+                        if( 0 != pHt->End() && (
+                            ( nAttrStart < n &&
+                            ( pHt->DontExpand() ? n < *pHt->End()
+                            : n <= *pHt->End() )) ||
+                            ( n == nAttrStart &&
+                            ( nAttrStart == *pHt->End() || !n ))) )
+                        {
+                            aSet.Put( pHt->GetAttr() );
+                        }
+                    }
                     if( pTxtNd->HasSwAttrSet() &&
                         pTxtNd->GetpSwAttrSet()->Count() )
-					{
-						SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
-						// aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind
-						aFmtSet.Differentiate( aSet );
-						// jetzt alle zusammen "mergen"
-						aSet.Put( aFmtSet );
-					}
-				}
-				else
-					pTxtNd->SwCntntNode::GetAttr( aSet );
+                    {
+                        SfxItemSet aFmtSet( pTxtNd->GetSwAttrSet() );
+                        // aus dem Format-Set alle entfernen, die im TextSet auch gesetzt sind
+                        aFmtSet.Differentiate( aSet );
+                        // jetzt alle zusammen "mergen"
+                        aSet.Put( aFmtSet );
+                    }
+                }
+                else
+                    pTxtNd->SwCntntNode::GetAttr( aSet );
 
-				rCntntAtPos.sStr.AssignAscii(
-									RTL_CONSTASCII_STRINGPARAM( "Pos: (" ));
-				rCntntAtPos.sStr += String::CreateFromInt32( aPos.nNode.GetIndex());
-				rCntntAtPos.sStr += ':';
-				rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex());
-				rCntntAtPos.sStr += ')';
-				rCntntAtPos.sStr.AppendAscii(
-								RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " ));
-				rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
-				if( pTxtNd->GetCondFmtColl() )
-					rCntntAtPos.sStr.AppendAscii(
-								RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " ))
-						+= pTxtNd->GetCondFmtColl()->GetName();
+                rCntntAtPos.sStr.AssignAscii(
+                    RTL_CONSTASCII_STRINGPARAM( "Pos: (" ));
+                rCntntAtPos.sStr += String::CreateFromInt32( aPos.nNode.GetIndex());
+                rCntntAtPos.sStr += ':';
+                rCntntAtPos.sStr += String::CreateFromInt32( aPos.nContent.GetIndex());
+                rCntntAtPos.sStr += ')';
+                rCntntAtPos.sStr.AppendAscii(
+                    RTL_CONSTASCII_STRINGPARAM( "\nAbs.Vorl.: " ));
+                rCntntAtPos.sStr += pTxtNd->GetFmtColl()->GetName();
+                if( pTxtNd->GetCondFmtColl() )
+                    rCntntAtPos.sStr.AppendAscii(
+                    RTL_CONSTASCII_STRINGPARAM( "\nBed.Vorl.: " ))
+                    += pTxtNd->GetCondFmtColl()->GetName();
 
-				if( aSet.Count() )
-				{
-					String sAttrs;
-					SfxItemIter aIter( aSet );
-					const SfxPoolItem* pItem = aIter.FirstItem();
-					while( sal_True )
-					{
-						if( !IsInvalidItem( pItem ))
-						{
-							String aStr;
-							GetDoc()->GetAttrPool().GetPresentation( *pItem,
-											SFX_ITEM_PRESENTATION_COMPLETE,
-											SFX_MAPUNIT_CM, aStr );
-							if( sAttrs.Len() )
-								sAttrs.AppendAscii(
-										RTL_CONSTASCII_STRINGPARAM( ", " ));
-							sAttrs += aStr;
-						}
-						if( aIter.IsAtEnd() )
-							break;
-						pItem = aIter.NextItem();
-					}
-					if( sAttrs.Len() )
-					{
-						if( rCntntAtPos.sStr.Len() )
-							rCntntAtPos.sStr += '\n';
-						rCntntAtPos.sStr.AppendAscii(
-								RTL_CONSTASCII_STRINGPARAM( "Attr: " ) )
-								+= sAttrs;
-					}
-				}
-				bRet = sal_True;
-				rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
-			}
+                if( aSet.Count() )
+                {
+                    String sAttrs;
+                    SfxItemIter aIter( aSet );
+                    const SfxPoolItem* pItem = aIter.FirstItem();
+                    while( sal_True )
+                    {
+                        if( !IsInvalidItem( pItem ))
+                        {
+                            String aStr;
+                            GetDoc()->GetAttrPool().GetPresentation( *pItem,
+                                SFX_ITEM_PRESENTATION_COMPLETE,
+                                SFX_MAPUNIT_CM, aStr );
+                            if( sAttrs.Len() )
+                                sAttrs.AppendAscii(
+                                RTL_CONSTASCII_STRINGPARAM( ", " ));
+                            sAttrs += aStr;
+                        }
+                        if( aIter.IsAtEnd() )
+                            break;
+                        pItem = aIter.NextItem();
+                    }
+                    if( sAttrs.Len() )
+                    {
+                        if( rCntntAtPos.sStr.Len() )
+                            rCntntAtPos.sStr += '\n';
+                        rCntntAtPos.sStr.AppendAscii(
+                            RTL_CONSTASCII_STRINGPARAM( "Attr: " ) )
+                            += sAttrs;
+                    }
+                }
+                bRet = sal_True;
+                rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_CURR_ATTRS;
+            }
 #endif
-		}
-	}
+        }
+    }
 
-	if( !bRet )
-	{
-		rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
-		rCntntAtPos.aFnd.pFld = 0;
-	}
-	return bRet;
+    if( !bRet )
+    {
+        rCntntAtPos.eCntntAtPos = SwContentAtPos::SW_NOTHING;
+        rCntntAtPos.aFnd.pFld = 0;
+    }
+    return bRet;
 }
 
-// --> OD 2008-06-19 #i90516#
 const SwPostItField* SwCrsrShell::GetPostItFieldAtCursor() const
 {
     const SwPostItField* pPostItFld = 0;
@@ -1542,9 +1672,8 @@ const SwPostItField* SwCrsrShell::GetPos
         const SwTxtNode* pTxtNd = pCursorPos->nNode.GetNode().GetTxtNode();
         if ( pTxtNd )
         {
-            SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(
-                    pCursorPos->nContent.GetIndex(), RES_TXTATR_FIELD );
-            const SwField* pFld = pTxtAttr ? pTxtAttr->GetFmtFld().GetField() : 0;
+            SwTxtAttr* pTxtAttr = pTxtNd->GetFldTxtAttrAt( pCursorPos->nContent.GetIndex() );
+            const SwField* pFld = pTxtAttr != NULL ? pTxtAttr->GetFmtFld().GetField() : 0;
             if ( pFld && pFld->Which()== RES_POSTITFLD )
             {
                 pPostItFld = static_cast<const SwPostItField*>(pFld);
@@ -1554,7 +1683,6 @@ const SwPostItField* SwCrsrShell::GetPos
 
     return pPostItFld;
 }
-// <--
 
 // befindet sich der Node in einem geschuetzten Bereich?
 sal_Bool SwContentAtPos::IsInProtectSect() const
@@ -1622,18 +1750,45 @@ bool SwContentAtPos::IsInRTLText()const
     return bRet;
 }
 
-sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich, sal_Bool bExpand,
-									const SwTxtAttr* pTxtAttr )
+
+sal_Bool SwCrsrShell::SelectTxt( const xub_StrLen nStart,
+                                 const xub_StrLen nEnd )
 {
-	SET_CURR_SHELL( this );
-	sal_Bool bRet = sal_False;
+    SET_CURR_SHELL( this );
+    sal_Bool bRet = sal_False;
 
-	if( !IsTableMode() )
-	{
-		SwPosition& rPos = *pCurCrsr->GetPoint();
-		if( !pTxtAttr )
-		{
-			SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
+    SwCallLink aLk( *this );
+    SwCrsrSaveState aSaveState( *pCurCrsr );
+
+    SwPosition& rPos = *pCurCrsr->GetPoint();
+    pCurCrsr->DeleteMark();
+    rPos.nContent = nStart;
+    pCurCrsr->SetMark();
+    rPos.nContent = nEnd;
+
+    if( !pCurCrsr->IsSelOvr() )
+    {
+        UpdateCrsr();
+        bRet = sal_True;
+    }
+
+    return bRet;
+}
+
+
+sal_Bool SwCrsrShell::SelectTxtAttr( sal_uInt16 nWhich,
+                                     sal_Bool bExpand,
+                                     const SwTxtAttr* pTxtAttr )
+{
+    SET_CURR_SHELL( this );
+    sal_Bool bRet = sal_False;
+
+    if( !IsTableMode() )
+    {
+        if( !pTxtAttr )
+        {
+            SwPosition& rPos = *pCurCrsr->GetPoint();
+            SwTxtNode* pTxtNd = rPos.nNode.GetNode().GetTxtNode();
             pTxtAttr = (pTxtNd)
                 ? pTxtNd->GetTxtAttrAt(rPos.nContent.GetIndex(),
                         static_cast<RES_TXTATR>(nWhich),
@@ -1641,25 +1796,13 @@ sal_Bool SwCrsrShell::SelectTxtAttr( sal
                 : 0;
         }
 
-		if( pTxtAttr )
-		{
-			SwCallLink aLk( *this );        // Crsr-Moves ueberwachen,
-			SwCrsrSaveState aSaveState( *pCurCrsr );
-
-			pCurCrsr->DeleteMark();
-			rPos.nContent = *pTxtAttr->GetStart();
-			pCurCrsr->SetMark();
-			const xub_StrLen* pEnd = pTxtAttr->GetEnd();
-			rPos.nContent = pEnd ? *pEnd : *pTxtAttr->GetStart() + 1;
-
-			if( !pCurCrsr->IsSelOvr() )
-			{
-				UpdateCrsr();
-				bRet = sal_True;
-			}
-		}
-	}
-	return bRet;
+        if( pTxtAttr )
+        {
+            const xub_StrLen* pEnd = pTxtAttr->End();
+            bRet = SelectTxt( *pTxtAttr->GetStart(), ( pEnd ? *pEnd : *pTxtAttr->GetStart() + 1 ) );
+        }
+    }
+    return bRet;
 }
 
 
@@ -2175,7 +2318,7 @@ sal_Bool SwCrsrShell::SelectNxtPrvHyperl
 			aCmpPos.GetPosOfContent( *pCurCrsr->GetPoint() );
 			pCurCrsr->DeleteMark();
 			pCurCrsr->SetMark();
-			pCurCrsr->GetPoint()->nContent = *pFndAttr->SwTxtAttr::GetEnd();
+			pCurCrsr->GetPoint()->nContent = *pFndAttr->End();
 
 			if( !pCurCrsr->IsInProtectTable() && !pCurCrsr->IsSelOvr() )
 			{

Modified: openoffice/trunk/main/sw/source/core/crsr/findattr.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/findattr.cxx?rev=1542986&r1=1542985&r2=1542986&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/findattr.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/findattr.cxx Mon Nov 18 11:29:24 2013
@@ -154,7 +154,7 @@ sal_Bool lcl_Search( const SwTxtNode& rT
 		if( pTxtHt->Which() == rCmpItem.Which() &&
 			( !bValue || CmpAttr( pTxtHt->GetAttr(), rCmpItem )))
 		{
-			lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->GetEnd(), bForward );
+			lcl_SetAttrPam( rPam, *pTxtHt->GetStart(), pTxtHt->End(), bForward );
 			return sal_True;
 		}
 	return sal_False;
@@ -902,7 +902,7 @@ sal_Bool SwPaM::Find( const SfxPoolItem&
 					const SwPaM *pRegion, sal_Bool bInReadOnly )
 {
 	// stelle fest welches Attribut gesucht wird:
-	sal_uInt16 nWhich = rAttr.Which();
+	const sal_uInt16 nWhich = rAttr.Which();
     int bCharAttr = isCHRATR(nWhich) || isTXTATR(nWhich);
 
 	SwPaM* pPam = MakeRegion( fnMove, pRegion );

Modified: openoffice/trunk/main/sw/source/core/crsr/findtxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/findtxt.cxx?rev=1542986&r1=1542985&r2=1542986&view=diff
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/findtxt.cxx (original)
+++ openoffice/trunk/main/sw/source/core/crsr/findtxt.cxx Mon Nov 18 11:29:24 2013
@@ -57,19 +57,20 @@ using namespace util;
 
 String *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam );
 
+
 String& lcl_CleanStr(
     const SwTxtNode& rNd,
-    xub_StrLen nStart,
+    const xub_StrLen nStart,
     xub_StrLen& rEnde,
     SvULongs& rArr,
     String& rRet,
     const bool bRemoveSoftHyphen )
 {
-	rRet = rNd.GetTxt();
-	if( rArr.Count() )
-		rArr.Remove( 0, rArr.Count() );
+    rRet = rNd.GetTxt();
+    if( rArr.Count() )
+        rArr.Remove( 0, rArr.Count() );
 
-	const SwpHints *pHts = rNd.GetpSwpHints();
+    const SwpHints *pHts = rNd.GetpSwpHints();
 
     sal_uInt16 n = 0;
     xub_StrLen nSoftHyphen = nStart;
@@ -125,7 +126,6 @@ String& lcl_CleanStr(
             const SwTxtAttr* pHt = (*pHts)[n];
             if ( pHt->HasDummyChar() && (nStt >= nStart) )
             {
-                //JP 17.05.00: Task 75806 ask for ">=" and not for ">"
                 switch( pHt->Which() )
                 {
                 case RES_TXTATR_FLYCNT:
@@ -136,14 +136,6 @@ String& lcl_CleanStr(
                 case RES_TXTATR_META:
                 case RES_TXTATR_METAFIELD:
                     {
-                        // JP 06.05.98: mit Bug 50100 werden sie als Trenner erwuenscht und nicht
-                        //				mehr zum Wort dazu gehoerend.
-                        // MA 23.06.98: mit Bug 51215 sollen sie konsequenterweise auch am
-                        //				Satzanfang und -ende ignoriert werden wenn sie Leer sind.
-                        //				Dazu werden sie schlicht entfernt. Fuer den Anfang entfernen
-                        //				wir sie einfach.
-                        //				Fuer das Ende merken wir uns die Ersetzungen und entferenen
-                        //				hinterher alle am Stringende (koenten ja 'normale' 0x7f drinstehen
                         sal_Bool bEmpty = RES_TXTATR_FIELD != pHt->Which() ||
                             !(static_cast<SwTxtFld const*>(pHt)
                                 ->GetFmtFld().GetField()->ExpandField(true).Len());
@@ -171,58 +163,58 @@ String& lcl_CleanStr(
 
         if ( bNewSoftHyphen )
         {
-  			rArr.Insert( nAkt, rArr.Count() );
-    		--rEnde;
-   	    	rRet.Erase( nAkt, 1 );
+            rArr.Insert( nAkt, rArr.Count() );
+            --rEnde;
+            rRet.Erase( nAkt, 1 );
             ++nSoftHyphen;
         }
     }
     while ( true );
 
     for( sal_uInt16 i = aReplaced.Count(); i; )
-	{
-		const xub_StrLen nTmp = aReplaced[ --i ];
+    {
+        const xub_StrLen nTmp = aReplaced[ --i ];
         if( nTmp == rRet.Len() - 1 )
-		{
-			rRet.Erase( nTmp );
-			rArr.Insert( nTmp, rArr.Count() );
-			--rEnde;
-		}
-	}
+        {
+            rRet.Erase( nTmp );
+            rArr.Insert( nTmp, rArr.Count() );
+            --rEnde;
+        }
+    }
 
-	return rRet;
+    return rRet;
 }
 
 // skip all non SwPostIts inside the array
 xub_StrLen GetPostIt(xub_StrLen aCount,const SwpHints *pHts)
 {
-	xub_StrLen aIndex = 0;
-	while (aCount)
-	{
-		for (xub_StrLen i = 0; i <pHts->Count();i++)
-		{
-			aIndex++;
-			const SwTxtAttr* pTxtAttr = (*pHts)[i];
-			if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
-					(pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
-			{
-				aCount--;
-				if (!aCount)
-					break;
-			}
-		}
-	}
-	// throw away all following non postits
-	for (xub_StrLen i = aIndex; i <pHts->Count();i++)
-	{
-		const SwTxtAttr* pTxtAttr = (*pHts)[i];
-		if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
-				(pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
-			break;
-		else
-			aIndex++;
-	}
-	return aIndex;
+    xub_StrLen aIndex = 0;
+    while (aCount)
+    {
+        for (xub_StrLen i = 0; i <pHts->Count();i++)
+        {
+            aIndex++;
+            const SwTxtAttr* pTxtAttr = (*pHts)[i];
+            if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
+                 && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+            {
+                aCount--;
+                if (!aCount)
+                    break;
+            }
+        }
+    }
+    // throw away all following non postits
+    for (xub_StrLen i = aIndex; i <pHts->Count();i++)
+    {
+        const SwTxtAttr* pTxtAttr = (*pHts)[i];
+        if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
+             && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+            break;
+        else
+            aIndex++;
+    }
+    return aIndex;
 }
 
 sal_uInt8 SwPaM::Find( const SearchOptions& rSearchOpt, sal_Bool bSearchInNotes , utl::TextSearch& rSTxt,
@@ -307,22 +299,22 @@ sal_uInt8 SwPaM::Find( const SearchOptio
 					nStart = swap;
 				}
 
-				for (xub_StrLen i = 0; i <pHts->Count();i++)
-				{
-					xub_StrLen aPos = *(*pHts)[i]->GetStart();
-					const SwTxtAttr* pTxtAttr = (*pHts)[i];
-					if ( (pTxtAttr->Which()==RES_TXTATR_FIELD) &&
-								(pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
-					{
-						if ( (aPos >= nStart) && (aPos <= nEnde) )
-							aNumberPostits++;
-						else
-						{
-							if (bSrchForward)
-								aIgnore++;
-						}
-					}
-				}
+                for (xub_StrLen i = 0; i <pHts->Count();i++)
+                {
+                    const xub_StrLen aPos = *(*pHts)[i]->GetStart();
+                    const SwTxtAttr* pTxtAttr = (*pHts)[i];
+                    if ( (pTxtAttr->Which()==RES_TXTATR_FIELD)
+                         && (pTxtAttr->GetFmtFld().GetField()->Which()==RES_POSTITFLD))
+                    {
+                        if ( (aPos >= nStart) && (aPos <= nEnde) )
+                            aNumberPostits++;
+                        else
+                        {
+                            if (bSrchForward)
+                                aIgnore++;
+                        }
+                    }
+                }
 
 				if (!bSrchForward)
 				{

Added: openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.cxx?rev=1542986&view=auto
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.cxx (added)
+++ openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.cxx Mon Nov 18 11:29:24 2013
@@ -0,0 +1,117 @@
+/**************************************************************
+* 
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+* 
+*   http://www.apache.org/licenses/LICENSE-2.0
+* 
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+* 
+*************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <overlayrangesoutline.hxx>
+#include <svx/sdr/overlay/overlaymanager.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/polygon/b2dpolygontools.hxx>
+#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
+#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace
+{
+    // combine ranges geometrically to a single, ORed polygon
+    basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
+    {
+        const sal_uInt32 nCount(rRanges.size());
+        basegfx::B2DPolyPolygon aRetval;
+
+        for(sal_uInt32 a(0); a < nCount; a++)
+        {
+            const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a]));
+
+            if(0 == a)
+            {
+                aRetval.append(aDiscretePolygon);
+            }
+            else
+            {
+                aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon));
+            }
+        }
+
+        return aRetval;
+    }
+}
+
+namespace sw
+{
+    namespace overlay
+    {
+        drawinglayer::primitive2d::Primitive2DSequence OverlayRangesOutline::createOverlayObjectPrimitive2DSequence()
+        {
+            drawinglayer::primitive2d::Primitive2DSequence aRetval;
+            const sal_uInt32 nCount(getRanges().size());
+
+            if( nCount )
+            {
+                const basegfx::BColor aRGBColor(getBaseColor().getBColor());
+                const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges()));
+                const drawinglayer::primitive2d::Primitive2DReference aOutline(
+                    new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
+                    aPolyPolygon,
+                    aRGBColor));
+
+                aRetval.realloc(1);
+                aRetval[0] = aOutline;
+            }
+
+            return aRetval;
+        }
+
+        OverlayRangesOutline::OverlayRangesOutline(
+            const Color& rColor,
+            const std::vector< basegfx::B2DRange >& rRanges )
+            : sdr::overlay::OverlayObject(rColor)
+            , maRanges(rRanges)
+        {
+            // no AA for highlight overlays
+            allowAntiAliase(false);
+        }
+
+        OverlayRangesOutline::~OverlayRangesOutline()
+        {
+            if( getOverlayManager() )
+            {
+                getOverlayManager()->remove(*this);
+            }
+        }
+
+        void OverlayRangesOutline::setRanges(const std::vector< basegfx::B2DRange >& rNew)
+        {
+            if(rNew != maRanges)
+            {
+                maRanges = rNew;
+                objectChange();
+            }
+        }
+    } // end of namespace overlay
+} // end of namespace sdr
+
+//////////////////////////////////////////////////////////////////////////////
+// eof

Propchange: openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.cxx
------------------------------------------------------------------------------
    svn:executable = *

Added: openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.hxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.hxx?rev=1542986&view=auto
==============================================================================
--- openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.hxx (added)
+++ openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.hxx Mon Nov 18 11:29:24 2013
@@ -0,0 +1,70 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+
+#ifndef _SW_OVERLAY_OVERLAYRANGESOUTLINE_HXX
+#define _SW_OVERLAY_OVERLAYRANGESOUTLINE_HXX
+
+#include <svx/sdr/overlay/overlayobject.hxx>
+#include <basegfx/range/b2drange.hxx>
+
+#include <vector>
+
+//////////////////////////////////////////////////////////////////////////////
+
+namespace sw
+{
+    namespace overlay
+    {
+        class OverlayRangesOutline : public sdr::overlay::OverlayObject
+        {
+        protected:
+            // geometry of overlay
+            std::vector< basegfx::B2DRange > maRanges;
+
+            // geometry creation for OverlayObject
+            virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence();
+
+        public:
+            OverlayRangesOutline(
+                const Color& rColor,
+                const std::vector< basegfx::B2DRange >& rRanges );
+
+            virtual ~OverlayRangesOutline();
+
+            // data read access
+            inline const std::vector< basegfx::B2DRange >& getRanges() const
+            {
+                return maRanges;
+            }
+
+            // data write access
+            void setRanges(const std::vector< basegfx::B2DRange >& rNew);
+        };
+    } // end of namespace overlay
+} // end of namespace sw
+
+//////////////////////////////////////////////////////////////////////////////
+
+#endif //_SW_OVERLAY_OVERLAYRANGESOUTLINE_HXX
+
+// eof

Propchange: openoffice/trunk/main/sw/source/core/crsr/overlayrangesoutline.hxx
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message