You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/11/27 18:25:54 UTC
svn commit: r1546124 [23/33] - in /openoffice/branches/alg/aw080: ./ main/
main/accessibility/inc/accessibility/extended/
main/accessibility/inc/accessibility/helper/
main/accessibility/inc/accessibility/standard/
main/accessibility/source/extended/ ma...
Modified: openoffice/branches/alg/aw080/main/sw/source/core/crsr/crstrvl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/crsr/crstrvl.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sw/source/core/crsr/crstrvl.cxx (original)
+++ openoffice/branches/alg/aw080/main/sw/source/core/crsr/crstrvl.cxx Wed Nov 27 17:25:40 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>
@@ -619,74 +619,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() )
@@ -704,48 +715,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 );
@@ -784,6 +801,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 );
@@ -1004,52 +1143,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;
@@ -1058,13 +1195,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;
@@ -1084,159 +1222,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(
@@ -1247,8 +1379,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(
@@ -1259,280 +1391,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;
@@ -1543,9 +1673,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);
@@ -1555,7 +1684,6 @@ const SwPostItField* SwCrsrShell::GetPos
return pPostItFld;
}
-// <--
// befindet sich der Node in einem geschuetzten Bereich?
sal_Bool SwContentAtPos::IsInProtectSect() const
@@ -1624,18 +1752,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),
@@ -1643,25 +1798,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;
}
@@ -2177,7 +2320,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/branches/alg/aw080/main/sw/source/core/crsr/findattr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/crsr/findattr.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sw/source/core/crsr/findattr.cxx (original)
+++ openoffice/branches/alg/aw080/main/sw/source/core/crsr/findattr.cxx Wed Nov 27 17:25:40 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/branches/alg/aw080/main/sw/source/core/crsr/findtxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/crsr/findtxt.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sw/source/core/crsr/findtxt.cxx (original)
+++ openoffice/branches/alg/aw080/main/sw/source/core/crsr/findtxt.cxx Wed Nov 27 17:25:40 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)
{
Modified: openoffice/branches/alg/aw080/main/sw/source/core/crsr/swcrsr.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/crsr/swcrsr.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff
==============================================================================
--- openoffice/branches/alg/aw080/main/sw/source/core/crsr/swcrsr.cxx (original)
+++ openoffice/branches/alg/aw080/main/sw/source/core/crsr/swcrsr.cxx Wed Nov 27 17:25:40 2013
@@ -56,6 +56,7 @@
#include <mdiexp.hxx> // ...Percent()
#include <statstr.hrc> // ResId fuer Statusleiste
#include <redline.hxx> // SwRedline
+#include <txatbase.hxx>
using namespace ::com::sun::star::i18n;
@@ -238,124 +239,120 @@ sal_Bool SwCursor::IsSelOvr( int eFlags
return sal_True;
}
-// neu: Bereiche ueberpruefen
-// Anfang
- if( pSavePos->nNode != GetPoint()->nNode.GetIndex() &&
- //JP 28.10.97: Bug 45129 - im UI-ReadOnly ist alles erlaubt
- ( !pDoc->GetDocShell() || !pDoc->GetDocShell()->IsReadOnlyUI() ))
- {
- // teste doch mal die neuen Sections:
- SwNodeIndex& rPtIdx = GetPoint()->nNode;
- const SwSectionNode* pSectNd = rPtIdx.GetNode().FindSectionNode();
- if( pSectNd &&
- ((bSkipOverHiddenSections && pSectNd->GetSection().IsHiddenFlag() ) ||
- (bSkipOverProtectSections && pSectNd->GetSection().IsProtectFlag() )))
- {
+ if( pSavePos->nNode != GetPoint()->nNode.GetIndex()
+ && ( !pDoc->GetDocShell()
+ || !pDoc->GetDocShell()->IsReadOnlyUI() ) )
+ {
+ // teste doch mal die neuen Sections:
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ const SwSectionNode* pSectNd = rPtIdx.GetNode().FindSectionNode();
+ if( pSectNd &&
+ ((bSkipOverHiddenSections && pSectNd->GetSection().IsHiddenFlag() ) ||
+ (bSkipOverProtectSections && pSectNd->GetSection().IsProtectFlag() )))
+ {
if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
- {
- // dann wars das schon
- RestoreSavePos();
- return sal_True;
- }
+ {
+ // dann wars das schon
+ RestoreSavePos();
+ return sal_True;
+ }
- // dann setze den Cursor auf die neue Position:
- SwNodeIndex aIdx( rPtIdx );
- xub_StrLen nCntntPos = pSavePos->nCntnt;
- int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
- SwCntntNode* pCNd = bGoNxt
- ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
- : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
+ // dann setze den Cursor auf die neue Position:
+ SwNodeIndex aIdx( rPtIdx );
+ xub_StrLen nCntntPos = pSavePos->nCntnt;
+ int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
+ SwCntntNode* pCNd = bGoNxt
+ ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
+ : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
if( !pCNd && ( nsSwCursorSelOverFlags::SELOVER_ENABLEREVDIREKTION & eFlags ))
- {
- bGoNxt = !bGoNxt;
- pCNd = bGoNxt ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
- : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
- }
+ {
+ bGoNxt = !bGoNxt;
+ pCNd = bGoNxt ? rNds.GoNextSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections)
+ : rNds.GoPrevSection( &rPtIdx, bSkipOverHiddenSections, bSkipOverProtectSections);
+ }
- int bIsValidPos = 0 != pCNd;
- sal_Bool bValidNodesRange = bIsValidPos &&
- ::CheckNodesRange( rPtIdx, aIdx, sal_True );
- if( !bValidNodesRange )
- {
- rPtIdx = pSavePos->nNode;
- if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
- {
- bIsValidPos = sal_False;
- nCntntPos = 0;
- rPtIdx = aIdx;
- if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
- {
- // dann auf den Anfang vom Doc
- rPtIdx = rNds.GetEndOfExtras();
- pCNd = rNds.GoNext( &rPtIdx );
- }
- }
- }
+ int bIsValidPos = 0 != pCNd;
+ sal_Bool bValidNodesRange = bIsValidPos &&
+ ::CheckNodesRange( rPtIdx, aIdx, sal_True );
+ if( !bValidNodesRange )
+ {
+ rPtIdx = pSavePos->nNode;
+ if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
+ {
+ bIsValidPos = sal_False;
+ nCntntPos = 0;
+ rPtIdx = aIdx;
+ if( 0 == ( pCNd = rPtIdx.GetNode().GetCntntNode() ) )
+ {
+ // dann auf den Anfang vom Doc
+ rPtIdx = rNds.GetEndOfExtras();
+ pCNd = rNds.GoNext( &rPtIdx );
+ }
+ }
+ }
- // ContentIndex noch anmelden:
- xub_StrLen nTmpPos = bIsValidPos ? (bGoNxt ? 0 : pCNd->Len()) : nCntntPos;
- GetPoint()->nContent.Assign( pCNd, nTmpPos );
- if( !bIsValidPos || !bValidNodesRange ||
- // sollten wir in einer Tabelle gelandet sein?
- IsInProtectTable( sal_True ) )
- return sal_True;
- }
+ // ContentIndex noch anmelden:
+ xub_StrLen nTmpPos = bIsValidPos ? (bGoNxt ? 0 : pCNd->Len()) : nCntntPos;
+ GetPoint()->nContent.Assign( pCNd, nTmpPos );
+ if( !bIsValidPos || !bValidNodesRange ||
+ // sollten wir in einer Tabelle gelandet sein?
+ IsInProtectTable( sal_True ) )
+ return sal_True;
+ }
- // oder sollte eine geschuetzte Section innerhalb der Selektion liegen?
- if( HasMark() && bSkipOverProtectSections)
- {
- sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
- nEndIdx = GetPoint()->nNode.GetIndex();
- if( nEndIdx <= nSttIdx )
- {
- sal_uLong nTmp = nSttIdx;
- nSttIdx = nEndIdx;
- nEndIdx = nTmp;
- }
+ // oder sollte eine geschuetzte Section innerhalb der Selektion liegen?
+ if( HasMark() && bSkipOverProtectSections)
+ {
+ sal_uLong nSttIdx = GetMark()->nNode.GetIndex(),
+ nEndIdx = GetPoint()->nNode.GetIndex();
+ if( nEndIdx <= nSttIdx )
+ {
+ sal_uLong nTmp = nSttIdx;
+ nSttIdx = nEndIdx;
+ nEndIdx = nTmp;
+ }
- const SwSectionFmts& rFmts = pDoc->GetSections();
- for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
- {
- const SwSectionFmt* pFmt = rFmts[n];
- const SvxProtectItem& rProtect = pFmt->GetProtect();
- if( rProtect.IsCntntProtected() )
- {
- const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False);
- ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" );
- sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex();
- if( nSttIdx <= nIdx && nEndIdx >= nIdx )
- {
- // ist es keine gelinkte Section, dann kann sie auch
- // nicht mitselektiert werden
- const SwSection& rSect = *pFmt->GetSection();
- if( CONTENT_SECTION == rSect.GetType() )
- {
- RestoreSavePos();
- return sal_True;
- }
- }
- }
- }
- }
+ const SwSectionFmts& rFmts = pDoc->GetSections();
+ for( sal_uInt16 n = 0; n < rFmts.Count(); ++n )
+ {
+ const SwSectionFmt* pFmt = rFmts[n];
+ const SvxProtectItem& rProtect = pFmt->GetProtect();
+ if( rProtect.IsCntntProtected() )
+ {
+ const SwFmtCntnt& rCntnt = pFmt->GetCntnt(sal_False);
+ ASSERT( rCntnt.GetCntntIdx(), "wo ist der SectionNode?" );
+ sal_uLong nIdx = rCntnt.GetCntntIdx()->GetIndex();
+ if( nSttIdx <= nIdx && nEndIdx >= nIdx )
+ {
+ // ist es keine gelinkte Section, dann kann sie auch
+ // nicht mitselektiert werden
+ const SwSection& rSect = *pFmt->GetSection();
+ if( CONTENT_SECTION == rSect.GetType() )
+ {
+ RestoreSavePos();
+ return sal_True;
+ }
+ }
+ }
+ }
+ }
- }
-// Ende
-// neu: Bereiche ueberpruefen
+ }
- const SwNode* pNd = &GetPoint()->nNode.GetNode();
+ const SwNode* pNd = &GetPoint()->nNode.GetNode();
if( pNd->IsCntntNode() && !dynamic_cast<SwUnoCrsr*>(this) )
- {
- const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
- if( pFrm && pFrm->IsValid() && 0 == pFrm->Frm().Height() &&
- 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
- {
+ {
+ const SwCntntFrm* pFrm = ((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() );
+ if( pFrm && pFrm->IsValid()
+ && 0 == pFrm->Frm().Height()
+ && 0 != ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) )
+ {
// skip to the next / prev valid paragraph with a layout
- SwNodeIndex& rPtIdx = GetPoint()->nNode;
- int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
- while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm()
- : pFrm->GetPrevCntntFrm() )) &&
- 0 == pFrm->Frm().Height() )
- ;
+ SwNodeIndex& rPtIdx = GetPoint()->nNode;
+ int bGoNxt = pSavePos->nNode < rPtIdx.GetIndex();
+ while( 0 != ( pFrm = ( bGoNxt ? pFrm->GetNextCntntFrm() : pFrm->GetPrevCntntFrm() ))
+ && 0 == pFrm->Frm().Height() )
+ ;
// --> LIJIAN/FME 2007-11-27 #i72394# skip to prev /next valid paragraph
// with a layout in case the first search did not succeed:
@@ -371,139 +368,189 @@ sal_Bool SwCursor::IsSelOvr( int eFlags
}
// <--
- SwCntntNode* pCNd;
- if( pFrm && 0 != (pCNd = (SwCntntNode*)pFrm->GetNode()) )
- {
- // set this cntntNode as new position
- rPtIdx = *pCNd;
+ SwCntntNode* pCNd;
+ if( pFrm && 0 != (pCNd = (SwCntntNode*)pFrm->GetNode()) )
+ {
+ // set this cntntNode as new position
+ rPtIdx = *pCNd;
pNd = pCNd;
- // ContentIndex noch anmelden:
- xub_StrLen nTmpPos = bGoNxt ? 0 : pCNd->Len();
- GetPoint()->nContent.Assign( pCNd, nTmpPos );
-
- // sollten wir in einer Tabelle gelandet sein?
- if( IsInProtectTable( sal_True ) )
- pFrm = 0;
- }
- }
+ // ContentIndex noch anmelden:
+ xub_StrLen nTmpPos = bGoNxt ? 0 : pCNd->Len();
+ GetPoint()->nContent.Assign( pCNd, nTmpPos );
+
+ // sollten wir in einer Tabelle gelandet sein?
+ if( IsInProtectTable( sal_True ) )
+ pFrm = 0;
+ }
+ }
- if( !pFrm )
- {
- DeleteMark();
- RestoreSavePos();
- return sal_True; // ohne Frames geht gar nichts!
- }
- }
+ if( !pFrm )
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True; // ohne Frames geht gar nichts!
+ }
+ }
- // darf der Cursor in geschuetzen "Nodes" stehen?
+ // darf der Cursor in geschuetzen "Nodes" stehen?
if( 0 == ( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags ) && !IsAtValidPos() )
- {
- DeleteMark();
- RestoreSavePos();
- return sal_True;
- }
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True;
+ }
- if( !HasMark() )
- return sal_False;
+ if( !HasMark() )
+ return sal_False;
- //JP 19.08.98: teste mal auf ungueltige Selektion - sprich ueber
- // GrundSections:
- if( !::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, sal_True ))
- {
- DeleteMark();
- RestoreSavePos();
- return sal_True; // ohne Frames geht gar nichts!
- }
+ //JP 19.08.98: teste mal auf ungueltige Selektion - sprich ueber
+ // GrundSections:
+ if( !::CheckNodesRange( GetMark()->nNode, GetPoint()->nNode, sal_True ))
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True; // ohne Frames geht gar nichts!
+ }
- const SwTableNode* pPtNd = pNd->FindTableNode();
+ if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode()
+ && !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() )
+ && !dynamic_cast<SwUnoCrsr*>(this) )
+ {
+ DeleteMark();
+ RestoreSavePos();
+ return sal_True; // ohne Frames geht gar nichts!
+ }
- if( (pNd = &GetMark()->nNode.GetNode())->IsCntntNode() &&
- !((SwCntntNode*)pNd)->getLayoutFrm( pDoc->GetCurrentLayout() ) && !dynamic_cast<SwUnoCrsr*>(this) )
- {
- DeleteMark();
- RestoreSavePos();
- return sal_True; // ohne Frames geht gar nichts!
- }
+ // assure that selection is only inside an InputField or contains the InputField completely
+ {
+ const SwTxtAttr* pInputFldTxtAttrAtPoint = NULL;
+ SwTxtNode* pTxtNdAtPoint = GetPoint()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNdAtPoint != NULL )
+ {
+ pInputFldTxtAttrAtPoint =
+ pTxtNdAtPoint->GetTxtAttrAt( GetPoint()->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTxtNode::PARENT );
+ }
- const SwTableNode* pMrkNd = pNd->FindTableNode();
+ const SwTxtAttr* pInputFldTxtAttrAtMark = NULL;
+ SwTxtNode* pTxtNdAtMark = GetMark()->nNode.GetNode().GetTxtNode();
+ if ( pTxtNdAtMark != NULL )
+ {
+ pInputFldTxtAttrAtMark =
+ pTxtNdAtMark->GetTxtAttrAt( GetMark()->nContent.GetIndex(), RES_TXTATR_INPUTFIELD, SwTxtNode::PARENT );
+ }
- // beide in keinem oder beide im gleichen TableNode
- if( ( !pMrkNd && !pPtNd ) || pPtNd == pMrkNd )
- return sal_False;
+ if ( pInputFldTxtAttrAtPoint != pInputFldTxtAttrAtMark )
+ {
+ const sal_uLong nRefNodeIdx =
+ ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags )
+ ? pSavePos->nNode
+ : GetMark()->nNode.GetIndex();
+ const xub_StrLen nRefContentIdx =
+ ( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags )
+ ? pSavePos->nCntnt
+ : GetMark()->nContent.GetIndex();
+ const bool bIsForwardSelection =
+ nRefNodeIdx < GetPoint()->nNode.GetIndex()
+ || ( nRefNodeIdx == GetPoint()->nNode.GetIndex()
+ && nRefContentIdx < GetPoint()->nContent.GetIndex() );
- // in unterschiedlichen Tabellen oder nur Mark in der Tabelle
- if( ( pPtNd && pMrkNd ) || pMrkNd )
- { // dann lasse das nicht zu, alte Pos zurueck
- RestoreSavePos();
- // Crsr bleibt an der alten Position
- return sal_True;
- }
+ if ( pInputFldTxtAttrAtPoint != NULL )
+ {
+ const xub_StrLen nNewPointPos =
+ bIsForwardSelection ? *(pInputFldTxtAttrAtPoint->End()) : *(pInputFldTxtAttrAtPoint->GetStart());
+ GetPoint()->nContent.Assign( pTxtNdAtPoint, nNewPointPos );
+ }
- // ACHTUNG: dieses kann nicht im TableMode geschehen !!
- if( pPtNd ) // nur Point in Tabelle, dann gehe hinter/vor diese
- {
+ if ( pInputFldTxtAttrAtMark != NULL )
+ {
+ const xub_StrLen nNewMarkPos =
+ bIsForwardSelection ? *(pInputFldTxtAttrAtMark->GetStart()) : *(pInputFldTxtAttrAtMark->End());
+ GetMark()->nContent.Assign( pTxtNdAtMark, nNewMarkPos );
+ }
+ }
+ }
+
+ const SwTableNode* pPtNd = pNd->FindTableNode();
+ const SwTableNode* pMrkNd = pNd->FindTableNode();
+ // beide in keinem oder beide im gleichen TableNode
+ if( ( !pMrkNd && !pPtNd ) || pPtNd == pMrkNd )
+ return sal_False;
+
+ // in unterschiedlichen Tabellen oder nur Mark in der Tabelle
+ if( ( pPtNd && pMrkNd ) || pMrkNd )
+ {
+ // dann lasse das nicht zu, alte Pos zurueck
+ RestoreSavePos();
+ // Crsr bleibt an der alten Position
+ return sal_True;
+ }
+
+ // ACHTUNG: dieses kann nicht im TableMode geschehen !!
+ if( pPtNd ) // nur Point in Tabelle, dann gehe hinter/vor diese
+ {
if( nsSwCursorSelOverFlags::SELOVER_CHANGEPOS & eFlags )
- {
- sal_Bool bSelTop = GetPoint()->nNode.GetIndex() <
- (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode
- : GetMark()->nNode.GetIndex());
-
- do {
- // in Schleife fuer Tabelle hinter Tabelle
- sal_uLong nSEIdx = pPtNd->EndOfSectionIndex();
- sal_uLong nSttEndTbl = nSEIdx + 1; // dflt. Sel. nach unten
+ {
+ sal_Bool bSelTop = GetPoint()->nNode.GetIndex() <
+ (( nsSwCursorSelOverFlags::SELOVER_TOGGLE & eFlags ) ? pSavePos->nNode
+ : GetMark()->nNode.GetIndex());
+
+ do {
+ // in Schleife fuer Tabelle hinter Tabelle
+ sal_uLong nSEIdx = pPtNd->EndOfSectionIndex();
+ sal_uLong nSttEndTbl = nSEIdx + 1; // dflt. Sel. nach unten
- if( bSelTop ) // Sel. nach oben
- nSttEndTbl = rNds[ nSEIdx ]->StartOfSectionIndex() - 1;
+ if( bSelTop ) // Sel. nach oben
+ nSttEndTbl = rNds[ nSEIdx ]->StartOfSectionIndex() - 1;
- GetPoint()->nNode = nSttEndTbl;
+ GetPoint()->nNode = nSttEndTbl;
const SwNode* pMyNd = GetNode();
if( pMyNd->IsSectionNode() || ( pMyNd->IsEndNode() &&
pMyNd->StartOfSectionNode()->IsSectionNode() ) )
- {
- // die lassen wir zu:
+ {
+ // die lassen wir zu:
pMyNd = bSelTop
- ? rNds.GoPrevSection( &GetPoint()->nNode,sal_True,sal_False )
- : rNds.GoNextSection( &GetPoint()->nNode,sal_True,sal_False );
+ ? rNds.GoPrevSection( &GetPoint()->nNode,sal_True,sal_False )
+ : rNds.GoNextSection( &GetPoint()->nNode,sal_True,sal_False );
/* #i12312# Handle failure of Go{Prev|Next}Section */
if ( 0 == pMyNd)
break;
if( 0 != ( pPtNd = pMyNd->FindTableNode() ))
- continue;
- }
+ continue;
+ }
if( pMyNd->IsCntntNode() && // ist es ein ContentNode ??
- ::CheckNodesRange( GetMark()->nNode,
- GetPoint()->nNode, sal_True ))
- {
+ ::CheckNodesRange( GetMark()->nNode,
+ GetPoint()->nNode, sal_True ))
+ {
// TABLE IN TABLE
const SwTableNode* pOuterTableNd = pMyNd->FindTableNode();
- if ( pOuterTableNd )
+ if ( pOuterTableNd )
pMyNd = pOuterTableNd;
else
{
SwCntntNode* pCNd = (SwCntntNode*)pMyNd;
- xub_StrLen nTmpPos = bSelTop ? pCNd->Len() : 0;
- GetPoint()->nContent.Assign( pCNd, nTmpPos );
- return sal_False;
+ xub_StrLen nTmpPos = bSelTop ? pCNd->Len() : 0;
+ GetPoint()->nContent.Assign( pCNd, nTmpPos );
+ return sal_False;
}
- }
- if( bSelTop
+ }
+ if( bSelTop
? ( !pMyNd->IsEndNode() || 0 == ( pPtNd = pMyNd->FindTableNode() ))
: 0 == ( pPtNd = pMyNd->GetTableNode() ))
- break;
- } while( sal_True );
- }
+ break;
+ } while( sal_True );
+ }
- // dann verbleibe auf der alten Position
- RestoreSavePos();
- return sal_True; // Crsr bleibt an der alten Position
- }
- return sal_False; // was bleibt noch ??
+ // dann verbleibe auf der alten Position
+ RestoreSavePos();
+ return sal_True; // Crsr bleibt an der alten Position
+ }
+
+ return sal_False;
}
#if defined( UNX )
@@ -1849,11 +1896,11 @@ sal_Bool SwCursor::UpDown( sal_Bool bUp,
aPt.X() = pFrm->Frm().Left() + nUpDownX;
}
pFrm->GetCrsrOfst( GetPoint(), aPt, &eTmpState );
- }
- bRet = sal_True;
- }
- else
- *GetPoint() = aOldPos;
+ }
+ bRet = !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
+ }
+ else
+ *GetPoint() = aOldPos;
DoSetBidiLevelUpDown(); // calculate cursor bidi level
}
@@ -1870,8 +1917,10 @@ sal_Bool SwCursor::LeftRightMargin( sal_
if ( pFrm )
SetCrsrBidiLevel( pFrm->IsRightToLeft() ? 1 : 0 );
- return pFrm && (bLeft ? pFrm->LeftMargin( this ) :
- pFrm->RightMargin( this, bAPI ) );
+ SwCrsrSaveState aSave( *this );
+ return pFrm
+ && (bLeft ? pFrm->LeftMargin( this ) : pFrm->RightMargin( this, bAPI ) )
+ && !IsSelOvr( nsSwCursorSelOverFlags::SELOVER_TOGGLE | nsSwCursorSelOverFlags::SELOVER_CHANGEPOS );
}
sal_Bool SwCursor::IsAtLeftRightMargin( sal_Bool bLeft, sal_Bool bAPI ) const