You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2013/11/18 13:54:10 UTC
svn commit: r1543021 [23/29] - in /openoffice/branches/rejuvenate01: ./
main/ main/accessibility/inc/accessibility/extended/
main/accessibility/inc/accessibility/helper/
main/accessibility/inc/accessibility/standard/
main/accessibility/source/extended/...
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfld.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfld.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfld.cxx Mon Nov 18 12:53:58 2013
@@ -59,6 +59,14 @@
#include "fmtmeta.hxx" // lcl_NewMetaPortion
+//IAccessibility2 Implementation 2009-----
+#ifndef _REFFLD_HXX
+#include "reffld.hxx"
+#endif
+#ifndef _FLDDAT_HXX
+#include "flddat.hxx"
+#endif
+//-----IAccessibility2 Implementation 2009
/*************************************************************************
* SwTxtFormatter::NewFldPortion()
*************************************************************************/
@@ -90,7 +98,9 @@ SwExpandPortion *SwTxtFormatter::NewFldP
SwCharFmt* pChFmt = 0;
sal_Bool bNewFlyPor = sal_False,
bINet = sal_False;
-
+ //IAccessibility2 Implementation 2009-----
+ sal_uInt16 subType;
+ //-----IAccessibility2 Implementation 2009
// set language
((SwTxtFormatter*)this)->SeekAndChg( rInf );
if (pFld->GetLanguage() != GetFnt()->GetLanguage())
@@ -162,7 +172,11 @@ SwExpandPortion *SwTxtFormatter::NewFldP
: pFld->ExpandField(bInClipboard) );
pRet = new SwFldPortion( str );
}
- break;
+ //IAccessibility2 Implementation 2009-----
+ if(pRet)
+ ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGECOOUNTFLD;
+ //-----IAccessibility2 Implementation 2009
+ break;
case RES_PAGENUMBERFLD:
{
@@ -188,7 +202,11 @@ SwExpandPortion *SwTxtFormatter::NewFldP
: pFld->ExpandField(bInClipboard) );
pRet = new SwFldPortion( str );
}
- break;
+ //IAccessibility2 Implementation 2009-----
+ if(pRet)
+ ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGENUMBERFLD;
+ //-----IAccessibility2 Implementation 2009
+ break;
}
case RES_GETEXPFLD:
{
@@ -263,7 +281,40 @@ SwExpandPortion *SwTxtFormatter::NewFldP
bNewFlyPor = sal_True;
bPlaceHolder = sal_True;
break;
-
+ //IAccessibility2 Implementation 2009-----
+ case RES_GETREFFLD:
+ subType = ((SwGetRefField*)pFld)->GetSubType();
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
+ if(pRet)
+ {
+ if( subType == REF_BOOKMARK )
+ ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_BOOKMARKFLD;
+ else if( subType == REF_SETREFATTR )
+ ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_SETREFATTRFLD;
+ break;
+ }
+ case RES_DATETIMEFLD:
+ subType = ((SwDateTimeField*)pFld)->GetSubType();
+ {
+ String const str( (bName)
+ ? pFld->GetFieldName()
+ : pFld->ExpandField(bInClipboard) );
+ pRet = new SwFldPortion(str);
+ }
+ if(pRet)
+ {
+ if( subType & DATEFLD )
+ ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_DATEFLD;
+ else if( subType & TIMEFLD )
+ ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_TIMEFLD;
+ break;
+ }
+ //-----IAccessibility2 Implementation 2009
default:
{
String const str( (bName)
@@ -365,63 +416,57 @@ SwTxtFormatter::TryNewNoLengthPortion(Sw
SwLinePortion *SwTxtFormatter::NewExtraPortion( SwTxtFormatInfo &rInf )
{
- SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
- SwLinePortion *pRet = 0;
- if( !pHint )
- {
-#if OSL_DEBUG_LEVEL > 1
-// aDbstream << "NewExtraPortion: hint not found?" << endl;
-#endif
- pRet = new SwTxtPortion;
- pRet->SetLen( 1 );
- rInf.SetLen( 1 );
- return pRet;
- }
+ SwTxtAttr *pHint = GetAttr( rInf.GetIdx() );
+ SwLinePortion *pRet = 0;
+ if( !pHint )
+ {
+ pRet = new SwTxtPortion;
+ pRet->SetLen( 1 );
+ rInf.SetLen( 1 );
+ return pRet;
+ }
- switch( pHint->Which() )
- {
- case RES_TXTATR_FLYCNT :
- {
- pRet = NewFlyCntPortion( rInf, pHint );
- break;
- }
- case RES_TXTATR_FTN :
- {
- pRet = NewFtnPortion( rInf, pHint );
- break;
- }
- case RES_TXTATR_FIELD :
- {
- pRet = NewFldPortion( rInf, pHint );
- break;
- }
- case RES_TXTATR_REFMARK :
- {
- pRet = new SwIsoRefPortion;
- break;
- }
- case RES_TXTATR_TOXMARK :
- {
- pRet = new SwIsoToxPortion;
- break;
- }
- case RES_TXTATR_METAFIELD:
+ switch( pHint->Which() )
+ {
+ case RES_TXTATR_FLYCNT :
+ {
+ pRet = NewFlyCntPortion( rInf, pHint );
+ break;
+ }
+ case RES_TXTATR_FTN :
+ {
+ pRet = NewFtnPortion( rInf, pHint );
+ break;
+ }
+ case RES_TXTATR_FIELD :
+ {
+ pRet = NewFldPortion( rInf, pHint );
+ break;
+ }
+ case RES_TXTATR_REFMARK :
+ {
+ pRet = new SwIsoRefPortion;
+ break;
+ }
+ case RES_TXTATR_TOXMARK :
+ {
+ pRet = new SwIsoToxPortion;
+ break;
+ }
+ case RES_TXTATR_METAFIELD:
{
pRet = lcl_NewMetaPortion( *pHint, true );
break;
}
- default: ;
- }
- if( !pRet )
- {
-#if OSL_DEBUG_LEVEL > 1
-// aDbstream << "NewExtraPortion: unknown hint" << endl;
-#endif
- const XubString aNothing;
- pRet = new SwFldPortion( aNothing );
- rInf.SetLen( 1 );
- }
- return pRet;
+ default: ;
+ }
+ if( !pRet )
+ {
+ const XubString aNothing;
+ pRet = new SwFldPortion( aNothing );
+ rInf.SetLen( 1 );
+ }
+ return pRet;
}
/*************************************************************************
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfrm.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfrm.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfrm.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/text/txtfrm.cxx Mon Nov 18 12:53:58 2013
@@ -1331,16 +1331,6 @@ void SwTxtFrm::Modify( const SfxPoolItem
}
break;
-/* Seit dem neuen Blocksatz muessen wir immer neu formatieren:
- case RES_PARATR_ADJUST:
- {
- if( GetShell() )
- {
- Prepare( PREP_CLEAR );
- }
- break;
- }
-*/
// 6870: SwDocPosUpdate auswerten.
case RES_DOCPOS_UPDATE:
{
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/tox/tox.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/tox/tox.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/tox/tox.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/tox/tox.cxx Mon Nov 18 12:53:58 2013
@@ -242,7 +242,7 @@ String SwTOXMark::GetText() const
aStr = aAltText;
else if( pTxtAttr && pTxtAttr->GetpTxtNd() )
{
- xub_StrLen* pEndIdx = pTxtAttr->GetEnd();
+ const xub_StrLen* pEndIdx = pTxtAttr->GetEnd();
ASSERT( pEndIdx, "TOXMark ohne Mark!!");
if( pEndIdx )
{
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/tox/txmsrt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/tox/txmsrt.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/tox/txmsrt.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/tox/txmsrt.cxx Mon Nov 18 12:53:58 2013
@@ -232,8 +232,8 @@ sal_Bool SwTOXSortTabBase::operator==( c
{
// beide Pointer vorhanden -> vergleiche Text
// beide Pointer nicht vorhanden -> vergleiche AlternativText
- const xub_StrLen *pEnd = pTxtMark->GetEnd(),
- *pEndCmp = rCmp.pTxtMark->GetEnd();
+ const xub_StrLen* pEnd = pTxtMark->End();
+ const xub_StrLen* pEndCmp = rCmp.pTxtMark->End();
String sMyTxt;
String sMyTxtReading;
@@ -275,8 +275,8 @@ sal_Bool SwTOXSortTabBase::operator<( co
if( *pTxtMark->GetStart() == *rCmp.pTxtMark->GetStart() )
{
- const xub_StrLen *pEnd = pTxtMark->GetEnd(),
- *pEndCmp = rCmp.pTxtMark->GetEnd();
+ const xub_StrLen* pEnd = pTxtMark->End();
+ const xub_StrLen* pEndCmp = rCmp.pTxtMark->End();
String sMyTxt;
String sMyTxtReading;
@@ -432,7 +432,7 @@ void SwTOXIndex::GetText_Impl( String& r
void SwTOXIndex::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
{
- const xub_StrLen* pEnd = pTxtMark->GetEnd();
+ const xub_StrLen* pEnd = pTxtMark->End();
String sTmp;
String sTmpReading;
if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() &&
@@ -549,7 +549,7 @@ SwTOXContent::SwTOXContent( const SwTxtN
void SwTOXContent::GetText_Impl( String& rTxt, String& rTxtReading ) const
{
- const xub_StrLen* pEnd = pTxtMark->GetEnd();
+ const xub_StrLen* pEnd = pTxtMark->End();
if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() )
{
rTxt = ((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt(
@@ -564,7 +564,7 @@ void SwTOXContent::GetText_Impl( String&
void SwTOXContent::FillText( SwTxtNode& rNd, const SwIndex& rInsPos, sal_uInt16 ) const
{
- const xub_StrLen* pEnd = pTxtMark->GetEnd();
+ const xub_StrLen* pEnd = pTxtMark->End();
if( pEnd && !pTxtMark->GetTOXMark().IsAlternativeText() )
((SwTxtNode*)aTOXSources[0].pNd)->GetExpandTxt( rNd, &rInsPos,
*pTxtMark->GetStart(),
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/atrfld.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/atrfld.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/atrfld.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/atrfld.cxx Mon Nov 18 12:53:58 2013
@@ -51,13 +51,13 @@ TYPEINIT1(SwFmtFldHint, SfxHint);
*
****************************************************************************/
- // Konstruktor fuers Default vom Attribut-Pool
-SwFmtFld::SwFmtFld()
- : SfxPoolItem( RES_TXTATR_FIELD )
- , SwClient( 0 )
+// constructor for default item in attribute-pool
+SwFmtFld::SwFmtFld( sal_uInt16 nWhich )
+ : SfxPoolItem( nWhich )
+ , SwClient()
, SfxBroadcaster()
- , pField( 0 )
- , pTxtAttr( 0 )
+ , mpField( NULL )
+ , mpTxtFld( NULL )
{
}
@@ -65,10 +65,15 @@ SwFmtFld::SwFmtFld( const SwField &rFld
: SfxPoolItem( RES_TXTATR_FIELD )
, SwClient( rFld.GetTyp() )
, SfxBroadcaster()
- , pField( 0 )
- , pTxtAttr( 0 )
+ , mpField( rFld.CopyField() )
+ , mpTxtFld( NULL )
{
- pField = rFld.CopyField();
+ // input field in-place editing
+ if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
+ {
+ SetWhich( RES_TXTATR_INPUTFIELD );
+ dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
+ }
}
// #i24434#
@@ -79,25 +84,31 @@ SwFmtFld::SwFmtFld( const SwFmtFld& rAtt
: SfxPoolItem( RES_TXTATR_FIELD )
, SwClient()
, SfxBroadcaster()
- , pField( 0 )
- , pTxtAttr( 0 )
+ , mpField( NULL )
+ , mpTxtFld( NULL )
{
- if(rAttr.GetField())
+ if ( rAttr.GetField() )
{
rAttr.GetField()->GetTyp()->Add(this);
- pField = rAttr.GetField()->CopyField();
+ mpField = rAttr.GetField()->CopyField();
+ // input field in-place editing
+ if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
+ {
+ SetWhich( RES_TXTATR_INPUTFIELD );
+ dynamic_cast<SwInputField*>(GetField())->SetFmtFld( *this );
+ }
}
}
SwFmtFld::~SwFmtFld()
{
- SwFieldType* pType = pField ? pField->GetTyp() : 0;
+ SwFieldType* pType = mpField ? mpField->GetTyp() : 0;
if (pType && pType->Which() == RES_DBFLD)
pType = 0; // DB-Feldtypen zerstoeren sich selbst
Broadcast( SwFmtFldHint( this, SWFMTFLD_REMOVED ) );
- delete pField;
+ delete mpField;
// bei einige FeldTypen muessen wir den FeldTypen noch loeschen
if( pType && pType->IsLastDepend() )
@@ -134,22 +145,36 @@ void SwFmtFld::RegisterToFieldType( SwFi
// #111840#
-void SwFmtFld::SetFld(SwField * _pField)
+void SwFmtFld::SetField(SwField * _pField)
{
- if (NULL != pField)
- delete pField;
+ if (NULL != mpField)
+ delete mpField;
- pField = _pField;
- Broadcast( SwFmtFldHint( this, SWFMTFLD_CHANGED ) );
+ mpField = _pField;
+ if ( GetField()->GetTyp()->Which() == RES_INPUTFLD )
+ {
+ dynamic_cast<SwInputField* >(GetField())->SetFmtFld( *this );
+ }
+ Broadcast( SwFmtFldHint( this, SWFMTFLD_CHANGED ) );
+}
+
+void SwFmtFld::SetTxtFld( SwTxtFld& rTxtFld )
+{
+ mpTxtFld = &rTxtFld;
+}
+
+void SwFmtFld::ClearTxtFld()
+{
+ mpTxtFld = NULL;
}
int SwFmtFld::operator==( const SfxPoolItem& rAttr ) const
{
ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );
- return ( ( pField && ((SwFmtFld&)rAttr).GetField()
- && pField->GetTyp() == ((SwFmtFld&)rAttr).GetField()->GetTyp()
- && pField->GetFormat() == ((SwFmtFld&)rAttr).GetField()->GetFormat() ) )
- || ( !pField && !((SwFmtFld&)rAttr).GetField() );
+ return ( ( mpField && ((SwFmtFld&)rAttr).GetField()
+ && mpField->GetTyp() == ((SwFmtFld&)rAttr).GetField()->GetTyp()
+ && mpField->GetFormat() == ((SwFmtFld&)rAttr).GetField()->GetFormat() ) )
+ || ( !mpField && !((SwFmtFld&)rAttr).GetField() );
}
SfxPoolItem* SwFmtFld::Clone( SfxItemPool* ) const
@@ -159,7 +184,7 @@ SfxPoolItem* SwFmtFld::Clone( SfxItemPoo
void SwFmtFld::SwClientNotify( const SwModify&, const SfxHint& rHint )
{
- if( !pTxtAttr )
+ if( !mpTxtFld )
return;
const SwFieldHint* pHint = dynamic_cast<const SwFieldHint*>( &rHint );
@@ -168,9 +193,9 @@ void SwFmtFld::SwClientNotify( const SwM
// replace field content by text
SwPaM* pPaM = pHint->GetPaM();
SwDoc* pDoc = pPaM->GetDoc();
- const SwTxtNode& rTxtNode = pTxtAttr->GetTxtNode();
+ const SwTxtNode& rTxtNode = mpTxtFld->GetTxtNode();
pPaM->GetPoint()->nNode = rTxtNode;
- pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, *pTxtAttr->GetStart() );
+ pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, *mpTxtFld->GetStart() );
String const aEntry( GetField()->ExpandField( pDoc->IsClipBoard() ) );
pPaM->SetMark();
@@ -182,14 +207,14 @@ void SwFmtFld::SwClientNotify( const SwM
void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
- if( !pTxtAttr )
+ if( !mpTxtFld )
return;
// don't do anything, especially not expand!
if( pNew && pNew->Which() == RES_OBJECTDYING )
return;
- SwTxtNode* pTxtNd = (SwTxtNode*)&pTxtAttr->GetTxtNode();
+ SwTxtNode* pTxtNd = (SwTxtNode*)&mpTxtFld->GetTxtNode();
ASSERT( pTxtNd, "wo ist denn mein Node?" );
if( pNew )
{
@@ -206,7 +231,7 @@ void SwFmtFld::Modify( const SfxPoolItem
{
// --> OD 2007-09-06 #i81002#
// ((SwGetRefField*)GetFld())->UpdateField();
- dynamic_cast<SwGetRefField*>(GetField())->UpdateField( pTxtAttr );
+ dynamic_cast<SwGetRefField*>(GetField())->UpdateField( mpTxtFld );
// <--
}
break;
@@ -246,14 +271,14 @@ void SwFmtFld::Modify( const SfxPoolItem
pType->GetValue( aCalc );
}
}
- pTxtAttr->Expand();
+ mpTxtFld->ExpandTxtFld();
}
sal_Bool SwFmtFld::GetInfo( SfxPoolItem& rInfo ) const
{
const SwTxtNode* pTxtNd;
if( RES_AUTOFMT_DOCNODE != rInfo.Which() ||
- !pTxtAttr || 0 == ( pTxtNd = pTxtAttr->GetpTxtNode() ) ||
+ !mpTxtFld || 0 == ( pTxtNd = mpTxtFld->GetpTxtNode() ) ||
&pTxtNd->GetNodes() != ((SwAutoFmtGetDocNode&)rInfo).pNodes )
return sal_True;
@@ -262,82 +287,68 @@ sal_Bool SwFmtFld::GetInfo( SfxPoolItem&
}
-sal_Bool SwFmtFld::IsFldInDoc() const
+bool SwFmtFld::IsFldInDoc() const
{
- const SwTxtNode* pTxtNd;
- return pTxtAttr && 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
- pTxtNd->GetNodes().IsDocNodes();
+ return mpTxtFld != NULL
+ && mpTxtFld->IsFldInDoc();
}
sal_Bool SwFmtFld::IsProtect() const
{
- const SwTxtNode* pTxtNd;
- return pTxtAttr && 0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
- pTxtNd->IsProtect();
+ return mpTxtFld != NULL
+ && mpTxtFld->GetpTxtNode() != NULL
+ && mpTxtFld->GetpTxtNode()->IsProtect();
}
-/*************************************************************************
-|*
-|* SwTxtFld::SwTxtFld()
-|*
-|* Beschreibung Attribut fuer automatischen Text, Ctor
-|* Ersterstellung BP 30.04.92
-|* Letzte Aenderung JP 15.08.94
-|*
-*************************************************************************/
-SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos)
+
+
+SwTxtFld::SwTxtFld(
+ SwFmtFld & rAttr,
+ xub_StrLen const nStartPos )
: SwTxtAttr( rAttr, nStartPos )
, m_aExpand( rAttr.GetField()->ExpandField(true) )
- , m_pTxtNode( 0 )
+ , m_pTxtNode( NULL )
{
- rAttr.pTxtAttr = this;
+ rAttr.SetTxtFld( *this );
SetHasDummyChar(true);
}
SwTxtFld::~SwTxtFld( )
{
SwFmtFld & rFmtFld( static_cast<SwFmtFld &>(GetAttr()) );
- if (this == rFmtFld.pTxtAttr)
+ if ( this == rFmtFld.GetTxtFld() )
{
- rFmtFld.pTxtAttr = 0; // #i110140# invalidate!
+ rFmtFld.ClearTxtFld();
}
}
-/*************************************************************************
-|*
-|* SwTxtFld::Expand()
-|*
-|* Beschreibung exandiert das Feld und tauscht den Text im Node
-|* Ersterstellung BP 30.04.92
-|* Letzte Aenderung JP 15.08.94
-|*
-*************************************************************************/
-void SwTxtFld::Expand() const
+bool SwTxtFld::IsFldInDoc() const
+{
+ return GetpTxtNode() != NULL
+ && GetpTxtNode()->GetNodes().IsDocNodes();
+}
+
+void SwTxtFld::ExpandTxtFld() const
{
- // Wenn das expandierte Feld sich nicht veraendert hat, wird returnt
ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
const SwField* pFld = GetFmtFld().GetField();
- XubString aNewExpand( pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) );
+ const XubString aNewExpand( pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) );
if( aNewExpand == m_aExpand )
{
// Bei Seitennummernfeldern
const sal_uInt16 nWhich = pFld->GetTyp()->Which();
- if( RES_CHAPTERFLD != nWhich && RES_PAGENUMBERFLD != nWhich &&
- RES_REFPAGEGETFLD != nWhich &&
- // --> FME 2005-05-23 #122919# Page count fields to not use aExpand
- // during formatting, therefore an invalidation of the text frame
- // has to be triggered even if aNewExpand == aExpand:
- ( RES_DOCSTATFLD != nWhich || DS_PAGE != static_cast<const SwDocStatField*>(pFld)->GetSubType() ) &&
- // <--
- ( RES_GETEXPFLD != nWhich || ((SwGetExpField*)pFld)->IsInBodyTxt() ) )
+ if ( RES_CHAPTERFLD != nWhich
+ && RES_PAGENUMBERFLD != nWhich
+ && RES_REFPAGEGETFLD != nWhich
+ // Page count fields to not use aExpand during formatting,
+ // therefore an invalidation of the text frame has to be triggered even if aNewExpand == aExpand:
+ && ( RES_DOCSTATFLD != nWhich || DS_PAGE != static_cast<const SwDocStatField*>(pFld)->GetSubType() )
+ && ( RES_GETEXPFLD != nWhich || ((SwGetExpField*)pFld)->IsInBodyTxt() ) )
{
- // BP: das muesste man noch optimieren!
- //JP 12.06.97: stimmt, man sollte auf jedenfall eine Status-
- // aenderung an die Frames posten
if( m_pTxtNode->CalcHiddenParaField() )
{
m_pTxtNode->ModifyNotification( 0, 0 );
@@ -348,15 +359,11 @@ void SwTxtFld::Expand() const
m_aExpand = aNewExpand;
- // 0, this for formatting
- m_pTxtNode->ModifyNotification( 0, const_cast<SwFmtFld*>( &GetFmtFld() ) );
+ const_cast<SwTxtFld*>(this)->NotifyContentChange( const_cast<SwFmtFld&>(GetFmtFld()) );
}
-/*************************************************************************
- * SwTxtFld::CopyFld()
- *************************************************************************/
-void SwTxtFld::CopyFld( SwTxtFld *pDest ) const
+void SwTxtFld::CopyTxtFld( SwTxtFld *pDest ) const
{
ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
ASSERT( pDest->m_pTxtNode, "SwTxtFld: where is pDest's TxtNode?" );
@@ -364,8 +371,8 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest
IDocumentFieldsAccess* pIDFA = m_pTxtNode->getIDocumentFieldsAccess();
IDocumentFieldsAccess* pDestIDFA = pDest->m_pTxtNode->getIDocumentFieldsAccess();
- SwFmtFld& rFmtFld = (SwFmtFld&)pDest->GetFmtFld();
- const sal_uInt16 nFldWhich = rFmtFld.GetField()->GetTyp()->Which();
+ SwFmtFld& rDestFmtFld = (SwFmtFld&)pDest->GetFmtFld();
+ const sal_uInt16 nFldWhich = rDestFmtFld.GetField()->GetTyp()->Which();
if( pIDFA != pDestIDFA )
{
@@ -373,47 +380,54 @@ void SwTxtFld::CopyFld( SwTxtFld *pDest
// der Feldtyp muss im neuen Dokument angemeldet werden.
// Z.B: Kopieren ins ClipBoard.
SwFieldType* pFldType;
- if( nFldWhich != RES_DBFLD && nFldWhich != RES_USERFLD &&
- nFldWhich != RES_SETEXPFLD && nFldWhich != RES_DDEFLD &&
- RES_AUTHORITY != nFldWhich )
+ if( nFldWhich != RES_DBFLD
+ && nFldWhich != RES_USERFLD
+ && nFldWhich != RES_SETEXPFLD
+ && nFldWhich != RES_DDEFLD
+ && RES_AUTHORITY != nFldWhich )
+ {
pFldType = pDestIDFA->GetSysFldType( nFldWhich );
+ }
else
- pFldType = pDestIDFA->InsertFldType( *rFmtFld.GetField()->GetTyp() );
+ {
+ pFldType = pDestIDFA->InsertFldType( *rDestFmtFld.GetField()->GetTyp() );
+ }
// Sonderbehandlung fuer DDE-Felder
if( RES_DDEFLD == nFldWhich )
{
- if( rFmtFld.GetTxtFld() )
- ((SwDDEFieldType*)rFmtFld.GetField()->GetTyp())->DecRefCnt();
+ if( rDestFmtFld.GetTxtFld() )
+ {
+ ((SwDDEFieldType*)rDestFmtFld.GetField()->GetTyp())->DecRefCnt();
+ }
((SwDDEFieldType*)pFldType)->IncRefCnt();
}
ASSERT( pFldType, "unbekannter FieldType" );
- pFldType->Add( &rFmtFld ); // ummelden
- rFmtFld.GetField()->ChgTyp( pFldType );
+ pFldType->Add( &rDestFmtFld ); // ummelden
+ rDestFmtFld.GetField()->ChgTyp( pFldType );
}
// Expressionfelder Updaten
- if( nFldWhich == RES_SETEXPFLD || nFldWhich == RES_GETEXPFLD ||
- nFldWhich == RES_HIDDENTXTFLD )
+ if( nFldWhich == RES_SETEXPFLD
+ || nFldWhich == RES_GETEXPFLD
+ || nFldWhich == RES_HIDDENTXTFLD )
{
SwTxtFld* pFld = (SwTxtFld*)this;
pDestIDFA->UpdateExpFlds( pFld, true );
}
// Tabellenfelder auf externe Darstellung
- else if( RES_TABLEFLD == nFldWhich &&
- ((SwTblField*)rFmtFld.GetField())->IsIntrnlName() )
+ else if( RES_TABLEFLD == nFldWhich
+ && ((SwTblField*)rDestFmtFld.GetField())->IsIntrnlName() )
{
// erzeuge aus der internen (fuer CORE) die externe (fuer UI) Formel
const SwTableNode* pTblNd = m_pTxtNode->FindTableNode();
if( pTblNd ) // steht in einer Tabelle
- ((SwTblField*)rFmtFld.GetField())->PtrToBoxNm( &pTblNd->GetTable() );
+ ((SwTblField*)rDestFmtFld.GetField())->PtrToBoxNm( &pTblNd->GetTable() );
}
}
-/* -----------------26.06.2003 13:54-----------------
- --------------------------------------------------*/
void SwTxtFld::NotifyContentChange(SwFmtFld& rFmtFld)
{
//if not in undo section notify the change
@@ -424,3 +438,83 @@ void SwTxtFld::NotifyContentChange(SwFmt
}
+// input field in-place editing
+SwTxtInputFld::SwTxtInputFld(
+ SwFmtFld & rAttr,
+ xub_StrLen const nStart,
+ xub_StrLen const nEnd )
+
+ : SwTxtFld( rAttr, nStart )
+ , m_nEnd( nEnd )
+{
+ SetHasDummyChar( false );
+ SetHasContent( true );
+
+ SetDontExpand( true );
+ SetLockExpandFlag( true );
+ SetDontExpandStartAttr( true );
+
+ SetNesting( true );
+}
+
+SwTxtInputFld::~SwTxtInputFld()
+{
+}
+
+xub_StrLen* SwTxtInputFld::GetEnd()
+{
+ return &m_nEnd;
+}
+
+void SwTxtInputFld::NotifyContentChange( SwFmtFld& rFmtFld )
+{
+ SwTxtFld::NotifyContentChange( rFmtFld );
+
+ UpdateTextNodeContent( GetFieldContent() );
+}
+
+const String SwTxtInputFld::GetFieldContent() const
+{
+ return GetFmtFld().GetField()->ExpandField(false);
+}
+
+void SwTxtInputFld::UpdateFieldContent()
+{
+ if ( IsFldInDoc()
+ && (*GetStart()) != (*End()) )
+ {
+ ASSERT( (*End()) - (*GetStart()) >= 2,
+ "<SwTxtInputFld::UpdateFieldContent()> - Are CH_TXT_ATR_INPUTFIELDSTART and/or CH_TXT_ATR_INPUTFIELDEND missing?" );
+ // skip CH_TXT_ATR_INPUTFIELDSTART character
+ const xub_StrLen nIdx = (*GetStart()) + 1;
+ // skip CH_TXT_ATR_INPUTFIELDEND character
+ const xub_StrLen nLen = static_cast<xub_StrLen>(std::max( 0, ( (*End()) - 1 - nIdx ) ));
+ const String aNewFieldContent = GetTxtNode().GetExpandTxt( nIdx, nLen );
+
+ const SwInputField* pInputFld = dynamic_cast<const SwInputField*>(GetFmtFld().GetField());
+ ASSERT( pInputFld != NULL,
+ "<SwTxtInputFld::GetContent()> - Missing <SwInputFld> instance!" );
+ if ( pInputFld != NULL )
+ {
+ const_cast<SwInputField*>(pInputFld)->applyFieldContent( aNewFieldContent );
+ }
+ }
+}
+
+void SwTxtInputFld::UpdateTextNodeContent( const String& rNewContent )
+{
+ if ( !IsFldInDoc() )
+ {
+ ASSERT( false, "<SwTxtInputFld::UpdateTextNodeContent(..)> - misusage as Input Field is not in document content." );
+ return;
+ }
+
+ ASSERT( (*End()) - (*GetStart()) >= 2,
+ "<SwTxtInputFld::UpdateTextNodeContent(..)> - Are CH_TXT_ATR_INPUTFIELDSTART and/or CH_TXT_ATR_INPUTFIELDEND missing?" );
+ // skip CH_TXT_ATR_INPUTFIELDSTART character
+ const xub_StrLen nIdx = (*GetStart()) + 1;
+ // skip CH_TXT_ATR_INPUTFIELDEND character
+ const xub_StrLen nDelLen = static_cast<xub_StrLen>(std::max( 0, ( (*End()) - 1 - nIdx ) ));
+ SwIndex aIdx( &GetTxtNode(), nIdx );
+ GetTxtNode().ReplaceText( aIdx, nDelLen, rNewContent );
+}
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndhints.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndhints.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndhints.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndhints.cxx Mon Nov 18 12:53:58 2013
@@ -52,8 +52,8 @@ void DumpHints( const SwpHtStart &rHtSta
((((aDbstream << '\t').WriteNumber( i )<< " [").WriteNumber( pHt->Which() )
<< ']' << '\t').WriteNumber( long( pHt ) )
<< '\t').WriteNumber( *pHt->GetStart() );
- if( pHt->GetEnd() )
- (aDbstream << " -> " ).WriteNumber( *pHt->GetEnd() );
+ if( pHt->End() )
+ (aDbstream << " -> " ).WriteNumber( *pHt->End() );
aDbstream << endl;
}
(aDbstream << "\tEnds:").WriteNumber( rHtEnd.Count() )<< endl;
@@ -62,8 +62,8 @@ void DumpHints( const SwpHtStart &rHtSta
const SwTxtAttr *pHt = rHtEnd[i];
(((aDbstream << '\t').WriteNumber( i )<< " [").WriteNumber( pHt->Which() )
<< ']' << '\t' ).WriteNumber( long( pHt ) );
- if( pHt->GetEnd() )
- (aDbstream << '\t').WriteNumber( *pHt->GetEnd() )<< " <- ";
+ if( pHt->End() )
+ (aDbstream << '\t').WriteNumber( *pHt->End() )<< " <- ";
aDbstream.WriteNumber( *pHt->GetStart() )<< endl;
}
aDbstream << endl;
@@ -370,11 +370,11 @@ bool SwpHintsArray::Check() const
CHECK_ERR( 0 == i ||
( RES_TXTATR_CHARFMT != pHtLast->Which() && RES_TXTATR_AUTOFMT != pHtLast->Which() ) ||
( RES_TXTATR_CHARFMT != pHtThis->Which() && RES_TXTATR_AUTOFMT != pHtThis->Which() ) ||
- ( *pHtThis->GetStart() >= *pHtLast->GetEnd() ) ||
+ ( *pHtThis->GetStart() >= *pHtLast->End() ) ||
( ( ( (*pHtThis->GetStart() == *pHtLast->GetStart())
- && (*pHtThis->GetEnd() == *pHtLast->GetEnd())
+ && (*pHtThis->End() == *pHtLast->End())
) // same range
- || (*pHtThis->GetStart() == *pHtThis->GetEnd())
+ || (*pHtThis->GetStart() == *pHtThis->End())
)
&& ( (pHtThis->Which() != RES_TXTATR_AUTOFMT)
|| (pHtLast->Which() != RES_TXTATR_AUTOFMT)
@@ -392,8 +392,8 @@ bool SwpHintsArray::Check() const
if ( pOther->IsNesting() && (i != j) )
{
SwComparePosition cmp = ComparePosition(
- *pHtThis->GetStart(), *pHtThis->GetEnd(),
- *pOther->GetStart(), *pOther->GetEnd());
+ *pHtThis->GetStart(), *pHtThis->End(),
+ *pOther->GetStart(), *pOther->End());
CHECK_ERR( (POS_OVERLAP_BEFORE != cmp) &&
(POS_OVERLAP_BEHIND != cmp),
"HintsCheck: overlapping nesting hints!!!" );
Modified: openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndtxt.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndtxt.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndtxt.cxx (original)
+++ openoffice/branches/rejuvenate01/main/sw/source/core/txtnode/ndtxt.cxx Mon Nov 18 12:53:58 2013
@@ -253,39 +253,33 @@ SwTxtNode::SwTxtNode( const SwNodeIndex
SwTxtNode::~SwTxtNode()
{
- // delete loescht nur die Pointer, nicht die Arrayelemente!
+ // delete loescht nur die Pointer, nicht die Arrayelemente!
if ( m_pSwpHints )
- {
- // damit Attribute die ihren Inhalt entfernen nicht doppelt
- // geloescht werden.
+ {
+ // damit Attribute die ihren Inhalt entfernen nicht doppelt
+ // geloescht werden.
SwpHints* pTmpHints = m_pSwpHints;
m_pSwpHints = 0;
- for( sal_uInt16 j = pTmpHints->Count(); j; )
- // erst muss das Attribut aus dem Array entfernt werden,
- // denn sonst wuerde es sich selbst loeschen (Felder) !!!!
+ for( sal_uInt16 j = pTmpHints->Count(); j; )
+ {
+ // erst muss das Attribut aus dem Array entfernt werden,
+ // denn sonst wuerde es sich selbst loeschen (Felder) !!!!
DestroyAttr( pTmpHints->GetTextHint( --j ) );
+ }
- delete pTmpHints;
- }
+ delete pTmpHints;
+ }
- // --> OD 2008-03-13 #refactorlists#
-// if ( mpNodeNum )
-// {
-// mpNodeNum->RemoveMe();
-// delete mpNodeNum;
-// mpNodeNum = 0L;
-// }
RemoveFromList();
- // <--
InitSwParaStatistics( false );
}
SwCntntFrm *SwTxtNode::MakeFrm( SwFrm* pSib )
{
- SwCntntFrm *pFrm = new SwTxtFrm( this, pSib );
- return pFrm;
+ SwCntntFrm *pFrm = new SwTxtFrm( this, pSib );
+ return pFrm;
}
xub_StrLen SwTxtNode::Len() const
@@ -860,10 +854,13 @@ void SwTxtNode::NewAttrSet( SwAttrPool&
// override SwIndexReg::Update => text hints do not need SwIndex for start/end!
-void SwTxtNode::Update( SwIndex const & rPos, const xub_StrLen nChangeLen,
- const bool bNegative, const bool bDelete )
+void SwTxtNode::Update(
+ SwIndex const & rPos,
+ const xub_StrLen nChangeLen,
+ const bool bNegative,
+ const bool bDelete )
{
- SetAutoCompleteWordDirty( sal_True );
+ SetAutoCompleteWordDirty( sal_True );
::std::auto_ptr<TmpHints> pCollector;
const xub_StrLen nChangePos = rPos.GetIndex();
@@ -875,6 +872,8 @@ void SwTxtNode::Update( SwIndex const &
const xub_StrLen nChangeEnd = nChangePos + nChangeLen;
for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n )
{
+ bool bTxtAttrChanged = false;
+ bool bStartOfTxtAttrChanged = false;
SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n);
xub_StrLen * const pStart = pHint->GetStart();
if ( *pStart > nChangePos )
@@ -887,6 +886,7 @@ void SwTxtNode::Update( SwIndex const &
{
*pStart = nChangePos;
}
+ bStartOfTxtAttrChanged = true;
}
xub_StrLen * const pEnd = pHint->GetEnd();
@@ -902,6 +902,17 @@ void SwTxtNode::Update( SwIndex const &
{
*pEnd = nChangePos;
}
+ bTxtAttrChanged = !bStartOfTxtAttrChanged;
+ }
+ }
+
+ if ( bTxtAttrChanged
+ && pHint->Which() == RES_TXTATR_INPUTFIELD )
+ {
+ SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pHint);
+ if ( pTxtInputFld )
+ {
+ pTxtInputFld->UpdateFieldContent();
}
}
}
@@ -912,14 +923,15 @@ void SwTxtNode::Update( SwIndex const &
{
bool bNoExp = false;
bool bResort = false;
- const sal_uInt16 coArrSz = static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) -
- static_cast<sal_uInt16>(RES_CHRATR_BEGIN);
+ const sal_uInt16 coArrSz =
+ static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN);
- sal_Bool aDontExp[ coArrSz ];
- memset( &aDontExp, 0, coArrSz * sizeof(sal_Bool) );
+ sal_Bool aDontExp[ coArrSz ];
+ memset( &aDontExp, 0, coArrSz * sizeof(sal_Bool) );
for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n )
{
+ bool bTxtAttrChanged = false;
SwTxtAttr * const pHint = m_pSwpHints->GetTextHint(n);
xub_StrLen * const pStart = pHint->GetStart();
xub_StrLen * const pEnd = pHint->GetEnd();
@@ -936,6 +948,7 @@ void SwTxtNode::Update( SwIndex const &
if ( (*pEnd > nChangePos) || IsIgnoreDontExpand() )
{
*pEnd = *pEnd + nChangeLen;
+ bTxtAttrChanged = true;
}
else // *pEnd == nChangePos
{
@@ -948,11 +961,11 @@ void SwTxtNode::Update( SwIndex const &
nWhPos = static_cast<sal_uInt16>(nWhich -
RES_CHRATR_BEGIN);
}
- else
- continue;
+ else
+ continue;
- if( aDontExp[ nWhPos ] )
- continue;
+ if( aDontExp[ nWhPos ] )
+ continue;
if ( pHint->DontExpand() )
{
@@ -961,43 +974,52 @@ void SwTxtNode::Update( SwIndex const &
if ( pHint->IsCharFmtAttr() )
{
bNoExp = true;
- aDontExp[ static_cast<sal_uInt16>(RES_TXTATR_CHARFMT) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN) ]
- = sal_True;
- aDontExp[ static_cast<sal_uInt16>(RES_TXTATR_INETFMT) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN) ]
- = sal_True;
- }
- else
- aDontExp[ nWhPos ] = sal_True;
- }
- else if( bNoExp )
- {
+ aDontExp[ static_cast<sal_uInt16>(RES_TXTATR_CHARFMT) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN) ]
+ = sal_True;
+ aDontExp[ static_cast<sal_uInt16>(RES_TXTATR_INETFMT) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN) ]
+ = sal_True;
+ }
+ else
+ aDontExp[ nWhPos ] = sal_True;
+ }
+ else if( bNoExp )
+ {
if ( !pCollector.get() )
{
pCollector.reset( new TmpHints );
}
- sal_uInt16 nCollCnt = pCollector->Count();
- for( sal_uInt16 i = 0; i < nCollCnt; ++i )
- {
- SwTxtAttr *pTmp = (*pCollector)[ i ];
- if( nWhich == pTmp->Which() )
- {
- pCollector->Remove( i );
- SwTxtAttr::Destroy( pTmp,
- GetDoc()->GetAttrPool() );
- break;
- }
- }
- SwTxtAttr * const pTmp = MakeTxtAttr( *GetDoc(),
- pHint->GetAttr(),
- nChangePos, nChangePos + nChangeLen);
- pCollector->C40_INSERT( SwTxtAttr, pTmp, pCollector->Count() );
+ sal_uInt16 nCollCnt = pCollector->Count();
+ for( sal_uInt16 i = 0; i < nCollCnt; ++i )
+ {
+ SwTxtAttr *pTmp = (*pCollector)[ i ];
+ if( nWhich == pTmp->Which() )
+ {
+ pCollector->Remove( i );
+ SwTxtAttr::Destroy( pTmp, GetDoc()->GetAttrPool() );
+ break;
+ }
+ }
+ SwTxtAttr * const pTmp =
+ MakeTxtAttr( *GetDoc(), pHint->GetAttr(), nChangePos, nChangePos + nChangeLen);
+ pCollector->C40_INSERT( SwTxtAttr, pTmp, pCollector->Count() );
}
else
{
*pEnd = *pEnd + nChangeLen;
+ bTxtAttrChanged = true;
}
}
}
+
+ if ( bTxtAttrChanged
+ && pHint->Which() == RES_TXTATR_INPUTFIELD )
+ {
+ SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pHint);
+ if ( pTxtInputFld )
+ {
+ pTxtInputFld->UpdateFieldContent();
+ }
+ }
}
if ( bResort )
{
@@ -1006,10 +1028,10 @@ void SwTxtNode::Update( SwIndex const &
}
}
- SwIndexReg aTmpIdxReg;
+ SwIndexReg aTmpIdxReg;
if ( !bNegative && !bDelete )
{
- const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
+ const SwRedlineTbl& rTbl = GetDoc()->GetRedlineTbl();
for ( sal_uInt16 i = 0; i < rTbl.Count(); ++i )
{
SwRedline *const pRedl = rTbl[ i ];
@@ -1050,10 +1072,9 @@ void SwTxtNode::Update( SwIndex const &
}
const IDocumentMarkAccess* const pMarkAccess = getIDocumentMarkAccess();
- for(IDocumentMarkAccess::const_iterator_t ppMark =
- pMarkAccess->getMarksBegin();
- ppMark != pMarkAccess->getMarksEnd();
- ppMark++)
+ for ( IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getMarksBegin();
+ ppMark != pMarkAccess->getMarksEnd();
+ ppMark++ )
{
// Bookmarks must never grow to either side, when
// editing (directly) to the left or right (#i29942#)!
@@ -1082,7 +1103,7 @@ void SwTxtNode::Update( SwIndex const &
}
}
- aTmpIdxReg.MoveTo( *this );
+ aTmpIdxReg.MoveTo( *this );
}
void SwTxtNode::_ChgTxtCollUpdateNum( const SwTxtFmtColl *pOldColl,
@@ -1187,9 +1208,11 @@ static bool lcl_GetTxtAttrParent(xub_Str
static void
lcl_GetTxtAttrs(
- ::std::vector<SwTxtAttr *> *const pVector, SwTxtAttr **const ppTxtAttr,
+ ::std::vector<SwTxtAttr *> *const pVector,
+ SwTxtAttr **const ppTxtAttr,
SwpHints *const pSwpHints,
- xub_StrLen const nIndex, RES_TXTATR const nWhich,
+ xub_StrLen const nIndex,
+ RES_TXTATR const nWhich,
enum SwTxtNode::GetTxtAttrMode const eMode)
{
sal_uInt16 const nSize = (pSwpHints) ? pSwpHints->Count() : 0;
@@ -1203,7 +1226,7 @@ lcl_GetTxtAttrs(
default: OSL_ASSERT(false);
}
- for( sal_uInt16 i = 0; i < nSize; ++i )
+ for( sal_uInt16 i = 0; i < nSize; ++i )
{
SwTxtAttr *const pHint = pSwpHints->GetTextHint(i);
xub_StrLen const nHintStart( *(pHint->GetStart()) );
@@ -1218,10 +1241,9 @@ lcl_GetTxtAttrs(
}
xub_StrLen const*const pEndIdx = pHint->GetEnd();
- ASSERT(pEndIdx || pHint->HasDummyChar(),
- "hint with no end and no dummy char?");
- // Wenn bExpand gesetzt ist, wird das Verhalten bei Eingabe
- // simuliert, d.h. der Start wuede verschoben, das Ende expandiert,
+ ASSERT(pEndIdx || pHint->HasDummyChar(), "hint with no end and no dummy char?");
+ // Wenn bExpand gesetzt ist, wird das Verhalten bei Eingabe
+ // simuliert, d.h. der Start wuede verschoben, das Ende expandiert,
bool const bContained( (pEndIdx)
? (*pMatchFunc)(nIndex, nHintStart, *pEndIdx)
: (nHintStart == nIndex) );
@@ -1266,7 +1288,8 @@ SwTxtNode::GetTxtAttrAt(xub_StrLen const
|| (nWhich == RES_TXTATR_AUTOFMT)
|| (nWhich == RES_TXTATR_INETFMT)
|| (nWhich == RES_TXTATR_CJK_RUBY)
- || (nWhich == RES_TXTATR_UNKNOWN_CONTAINER),
+ || (nWhich == RES_TXTATR_UNKNOWN_CONTAINER)
+ || (nWhich == RES_TXTATR_INPUTFIELD ),
"GetTxtAttrAt() will give wrong result for this hint!");
SwTxtAttr * pRet(0);
@@ -1274,6 +1297,40 @@ SwTxtNode::GetTxtAttrAt(xub_StrLen const
return pRet;
}
+const SwTxtInputFld* SwTxtNode::GetOverlappingInputFld( const SwTxtAttr& rTxtAttr ) const
+{
+ const SwTxtInputFld* pTxtInputFld = NULL;
+
+ pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtAttrAt( *(rTxtAttr.GetStart()), RES_TXTATR_INPUTFIELD, PARENT ));
+
+ if ( pTxtInputFld == NULL && rTxtAttr.End() != NULL )
+ {
+ pTxtInputFld = dynamic_cast<const SwTxtInputFld*>(GetTxtAttrAt( *(rTxtAttr.End()), RES_TXTATR_INPUTFIELD, PARENT ));
+ }
+
+ return pTxtInputFld;
+}
+
+SwTxtFld* SwTxtNode::GetFldTxtAttrAt(
+ const xub_StrLen nIndex,
+ const bool bIncludeInputFldAtStart ) const
+{
+ SwTxtFld* pTxtFld = NULL;
+
+ pTxtFld = dynamic_cast<SwTxtFld*>(GetTxtAttrForCharAt( nIndex, RES_TXTATR_FIELD ));
+ if ( pTxtFld == NULL )
+ {
+ pTxtFld =
+ dynamic_cast<SwTxtFld*>( GetTxtAttrAt(
+ nIndex,
+ RES_TXTATR_INPUTFIELD,
+ bIncludeInputFldAtStart ? DEFAULT : PARENT ));
+ }
+
+ return pTxtFld;
+}
+
+
/*************************************************************************
* CopyHint()
*************************************************************************/
@@ -1294,118 +1351,121 @@ SwCharFmt* lcl_FindCharFmt( const SwChar
return NULL;
}
-void lcl_CopyHint( const sal_uInt16 nWhich, const SwTxtAttr * const pHt,
- SwTxtAttr *const pNewHt, SwDoc *const pOtherDoc, SwTxtNode *const pDest )
+void lcl_CopyHint(
+ const sal_uInt16 nWhich,
+ const SwTxtAttr * const pHt,
+ SwTxtAttr *const pNewHt,
+ SwDoc *const pOtherDoc,
+ SwTxtNode *const pDest )
{
- ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" );
- switch( nWhich )
- {
- // copy nodesarray section with footnote content
- case RES_TXTATR_FTN :
+ ASSERT( nWhich == pHt->Which(), "Falsche Hint-Id" );
+ switch( nWhich )
+ {
+ // copy nodesarray section with footnote content
+ case RES_TXTATR_FTN :
ASSERT(pDest, "lcl_CopyHint: no destination text node?");
- static_cast<const SwTxtFtn*>(pHt)->CopyFtn(
- *static_cast<SwTxtFtn*>(pNewHt), *pDest);
- break;
+ static_cast<const SwTxtFtn*>(pHt)->CopyFtn( *static_cast<SwTxtFtn*>(pNewHt), *pDest);
+ break;
- // Beim Kopieren von Feldern in andere Dokumente
- // muessen die Felder bei ihren neuen Feldtypen angemeldet werden.
+ // Beim Kopieren von Feldern in andere Dokumente
+ // muessen die Felder bei ihren neuen Feldtypen angemeldet werden.
- // TabellenFormel muessen relativ kopiert werden.
- case RES_TXTATR_FIELD :
- {
- const SwFmtFld& rFld = pHt->GetFmtFld();
- if( pOtherDoc )
- {
- static_cast<const SwTxtFld*>(pHt)->CopyFld(
- static_cast<SwTxtFld*>(pNewHt) );
- }
+ // TabellenFormel muessen relativ kopiert werden.
+ case RES_TXTATR_FIELD :
+ case RES_TXTATR_INPUTFIELD :
+ {
+ if( pOtherDoc )
+ {
+ static_cast<const SwTxtFld*>(pHt)->CopyTxtFld( static_cast<SwTxtFld*>(pNewHt) );
+ }
- // Tabellenformel ??
- if( RES_TABLEFLD == rFld.GetField()->GetTyp()->Which()
- && static_cast<const SwTblField*>(rFld.GetField())->IsIntrnlName())
+ // Tabellenformel ??
+ const SwFmtFld& rFld = pHt->GetFmtFld();
+ if( RES_TABLEFLD == rFld.GetField()->GetTyp()->Which()
+ && static_cast<const SwTblField*>(rFld.GetField())->IsIntrnlName())
+ {
+ // wandel die interne in eine externe Formel um
+ const SwTableNode* const pDstTblNd =
+ static_cast<const SwTxtFld*>(pHt)->GetTxtNode().FindTableNode();
+ if( pDstTblNd )
{
- // wandel die interne in eine externe Formel um
- const SwTableNode* const pDstTblNd =
- static_cast<const SwTxtFld*>(pHt)->GetTxtNode().FindTableNode();
- if( pDstTblNd )
- {
- SwTblField* const pTblFld = const_cast<SwTblField*>(
- static_cast<const SwTblField*>(pNewHt->GetFmtFld().GetField()));
- pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
- }
+ SwTblField* const pTblFld = const_cast<SwTblField*>(
+ static_cast<const SwTblField*>(pNewHt->GetFmtFld().GetField()));
+ pTblFld->PtrToBoxNm( &pDstTblNd->GetTable() );
}
}
- break;
+ }
+ break;
- case RES_TXTATR_TOXMARK :
- if( pOtherDoc && pDest && pDest->GetpSwpHints()
- && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
- {
- // Beim Kopieren von TOXMarks(Client) in andere Dokumente
- // muss der Verzeichnis (Modify) ausgetauscht werden
- static_cast<SwTxtTOXMark*>(pNewHt)->CopyTOXMark( pOtherDoc );
- }
- break;
+ case RES_TXTATR_TOXMARK :
+ if( pOtherDoc && pDest && pDest->GetpSwpHints()
+ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+ {
+ // Beim Kopieren von TOXMarks(Client) in andere Dokumente
+ // muss der Verzeichnis (Modify) ausgetauscht werden
+ static_cast<SwTxtTOXMark*>(pNewHt)->CopyTOXMark( pOtherDoc );
+ }
+ break;
- case RES_TXTATR_CHARFMT :
- // Wenn wir es mit einer Zeichenvorlage zu tun haben,
- // muessen wir natuerlich auch die Formate kopieren.
- if( pDest && pDest->GetpSwpHints()
- && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
- {
- SwCharFmt* pFmt =
- static_cast<SwCharFmt*>(pHt->GetCharFmt().GetCharFmt());
+ case RES_TXTATR_CHARFMT :
+ // Wenn wir es mit einer Zeichenvorlage zu tun haben,
+ // muessen wir natuerlich auch die Formate kopieren.
+ if( pDest && pDest->GetpSwpHints()
+ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+ {
+ SwCharFmt* pFmt =
+ static_cast<SwCharFmt*>(pHt->GetCharFmt().GetCharFmt());
- if( pFmt && pOtherDoc )
- {
- pFmt = pOtherDoc->CopyCharFmt( *pFmt );
- }
- const_cast<SwFmtCharFmt&>( static_cast<const SwFmtCharFmt&>(
- pNewHt->GetCharFmt() ) ).SetCharFmt( pFmt );
- }
- break;
- case RES_TXTATR_INETFMT :
+ if( pFmt && pOtherDoc )
+ {
+ pFmt = pOtherDoc->CopyCharFmt( *pFmt );
+ }
+ const_cast<SwFmtCharFmt&>( static_cast<const SwFmtCharFmt&>(
+ pNewHt->GetCharFmt() ) ).SetCharFmt( pFmt );
+ }
+ break;
+ case RES_TXTATR_INETFMT :
{
- // Wenn wir es mit benutzerdefinierten INet-Zeichenvorlagen
- // zu tun haben, muessen wir natuerlich auch die Formate kopieren.
- if( pOtherDoc && pDest && pDest->GetpSwpHints()
- && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
- {
+ // Wenn wir es mit benutzerdefinierten INet-Zeichenvorlagen
+ // zu tun haben, muessen wir natuerlich auch die Formate kopieren.
+ if( pOtherDoc && pDest && pDest->GetpSwpHints()
+ && USHRT_MAX != pDest->GetpSwpHints()->GetPos( pNewHt ) )
+ {
const SwDoc* const pDoc = static_cast<const SwTxtINetFmt*>(pHt)
- ->GetTxtNode().GetDoc();
+ ->GetTxtNode().GetDoc();
if ( pDoc )
- {
- const SwCharFmts* pCharFmts = pDoc->GetCharFmts();
- const SwFmtINetFmt& rFmt = pHt->GetINetFmt();
- SwCharFmt* pFmt;
- pFmt = lcl_FindCharFmt( pCharFmts, rFmt.GetINetFmt() );
- if( pFmt )
- pOtherDoc->CopyCharFmt( *pFmt );
- pFmt = lcl_FindCharFmt( pCharFmts, rFmt.GetVisitedFmt() );
- if( pFmt )
- pOtherDoc->CopyCharFmt( *pFmt );
- }
- }
- //JP 24.04.98: Bug 49753 - ein TextNode muss am Attribut
- // gesetzt sein, damit die Vorlagen erzeugt
- // werden koenne
+ {
+ const SwCharFmts* pCharFmts = pDoc->GetCharFmts();
+ const SwFmtINetFmt& rFmt = pHt->GetINetFmt();
+ SwCharFmt* pFmt;
+ pFmt = lcl_FindCharFmt( pCharFmts, rFmt.GetINetFmt() );
+ if( pFmt )
+ pOtherDoc->CopyCharFmt( *pFmt );
+ pFmt = lcl_FindCharFmt( pCharFmts, rFmt.GetVisitedFmt() );
+ if( pFmt )
+ pOtherDoc->CopyCharFmt( *pFmt );
+ }
+ }
+ //JP 24.04.98: Bug 49753 - ein TextNode muss am Attribut
+ // gesetzt sein, damit die Vorlagen erzeugt
+ // werden koenne
SwTxtINetFmt* const pINetHt = static_cast<SwTxtINetFmt*>(pNewHt);
if ( !pINetHt->GetpTxtNode() )
{
pINetHt->ChgTxtNode( pDest );
}
- //JP 22.10.97: Bug 44875 - Verbindung zum Format herstellen
+ //JP 22.10.97: Bug 44875 - Verbindung zum Format herstellen
pINetHt->GetCharFmt();
- break;
- }
- case RES_TXTATR_META:
- case RES_TXTATR_METAFIELD:
- OSL_ENSURE(pNewHt, "copying Meta should not fail!");
- OSL_ENSURE(pDest && (CH_TXTATR_INWORD ==
- pDest->GetTxt().GetChar(*pNewHt->GetStart())),
- "missing CH_TXTATR?");
break;
+ }
+ case RES_TXTATR_META:
+ case RES_TXTATR_METAFIELD:
+ OSL_ENSURE( pNewHt, "copying Meta should not fail!" );
+ OSL_ENSURE( pDest
+ && (CH_TXTATR_INWORD == pDest->GetTxt().GetChar(*pNewHt->GetStart())),
+ "missing CH_TXTATR?");
+ break;
}
}
@@ -1419,7 +1479,7 @@ void lcl_CopyHint( const sal_uInt16 nWhi
*************************************************************************/
void SwTxtNode::CopyAttr( SwTxtNode *pDest, const xub_StrLen nTxtStartIdx,
- const xub_StrLen nOldPos )
+ const xub_StrLen nOldPos )
{
if ( HasHints() ) // keine Attribute, keine Kekse
{
@@ -1431,46 +1491,45 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDe
SwTxtAttr *const pHt = m_pSwpHints->GetTextHint(i);
xub_StrLen const nAttrStartIdx = *pHt->GetStart();
if ( nTxtStartIdx < nAttrStartIdx )
- break; // ueber das Textende, da nLen == 0
+ break; // ueber das Textende, da nLen == 0
const xub_StrLen *const pEndIdx = pHt->GetEnd();
if ( pEndIdx && !pHt->HasDummyChar() )
- {
- if( ( *pEndIdx > nTxtStartIdx ||
- ( *pEndIdx == nTxtStartIdx &&
- nAttrStartIdx == nTxtStartIdx ) ) )
- {
+ {
+ if ( ( *pEndIdx > nTxtStartIdx
+ || ( *pEndIdx == nTxtStartIdx
+ && nAttrStartIdx == nTxtStartIdx ) ) )
+ {
sal_uInt16 const nWhich = pHt->Which();
if ( RES_TXTATR_REFMARK != nWhich )
{
// attribute in the area => copy
- SwTxtAttr *const pNewHt = pDest->InsertItem(
- pHt->GetAttr(), nOldPos, nOldPos,
- nsSetAttrMode::SETATTR_IS_COPY);
+ SwTxtAttr *const pNewHt =
+ pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos, nsSetAttrMode::SETATTR_IS_COPY);
if ( pNewHt )
{
lcl_CopyHint( nWhich, pHt, pNewHt,
- pOtherDoc, pDest );
+ pOtherDoc, pDest );
}
}
- else if( !pOtherDoc ? GetDoc()->IsCopyIsMove()
- : 0 == pOtherDoc->GetRefMark(
- pHt->GetRefMark().GetRefName() ) )
+ else if( !pOtherDoc
+ ? GetDoc()->IsCopyIsMove()
+ : 0 == pOtherDoc->GetRefMark( pHt->GetRefMark().GetRefName() ) )
{
- pDest->InsertItem( pHt->GetAttr(), nOldPos, nOldPos,
- nsSetAttrMode::SETATTR_IS_COPY);
+ pDest->InsertItem(
+ pHt->GetAttr(), nOldPos, nOldPos, nsSetAttrMode::SETATTR_IS_COPY);
}
- }
- }
- }
- }
+ }
+ }
+ }
+ }
- if( this != pDest )
- {
- // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern
- SwUpdateAttr aHint( nOldPos, nOldPos, 0 );
- pDest->ModifyNotification( 0, &aHint );
- }
+ if( this != pDest )
+ {
+ // Frames benachrichtigen, sonst verschwinden die Ftn-Nummern
+ SwUpdateAttr aHint( nOldPos, nOldPos, 0 );
+ pDest->ModifyNotification( 0, &aHint );
+ }
}
/*************************************************************************
@@ -1479,7 +1538,6 @@ void SwTxtNode::CopyAttr( SwTxtNode *pDe
|* wird angehaengt
*************************************************************************/
-// --> OD 2008-11-18 #i96213#
// introduction of new optional parameter to control, if all attributes have to be copied.
void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rStart,
@@ -1489,19 +1547,16 @@ void SwTxtNode::CopyText( SwTxtNode *con
SwIndex aIdx( pDest, pDest->m_Text.Len() );
CopyText( pDest, aIdx, rStart, nLen, bForceCopyOfAllAttrs );
}
-// <--
-// --> OD 2008-11-18 #i96213#
// introduction of new optional parameter to control, if all attributes have to be copied.
void SwTxtNode::CopyText( SwTxtNode *const pDest,
const SwIndex &rDestStart,
const SwIndex &rStart,
xub_StrLen nLen,
const bool bForceCopyOfAllAttrs )
-// <--
{
- xub_StrLen nTxtStartIdx = rStart.GetIndex();
- xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken
+ xub_StrLen nTxtStartIdx = rStart.GetIndex();
+ xub_StrLen nDestStart = rDestStart.GetIndex(); // alte Pos merken
if (pDest->GetDoc()->IsClipBoard() && this->GetNum())
{
@@ -1555,141 +1610,154 @@ void SwTxtNode::CopyText( SwTxtNode *con
pDest->InsertText( m_Text.Copy( nTxtStartIdx, nLen ), rDestStart,
IDocumentContentOperations::INS_EMPTYEXPAND );
- // um reale Groesse Updaten !
+ // um reale Groesse Updaten !
nLen = pDest->m_Text.Len() - oldLen;
if ( !nLen ) // string not longer?
return;
- SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ?
- pDest->GetDoc() : 0;
+ SwDoc* const pOtherDoc = (pDest->GetDoc() != GetDoc()) ? pDest->GetDoc() : 0;
- // harte Absatz umspannende Attribute kopieren
+ // harte Absatz umspannende Attribute kopieren
if( HasSwAttrSet() )
- {
- // alle, oder nur die CharAttribute ?
- // --> OD 2008-11-18 #i96213#
- if ( !bForceCopyOfAllAttrs &&
- ( nDestStart ||
- pDest->HasSwAttrSet() ||
- nLen != pDest->GetTxt().Len() ) )
- // <--
- {
- SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(),
- RES_CHRATR_BEGIN, RES_CHRATR_END-1,
- RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
- RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
- RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
- 0 );
- aCharSet.Put( *GetpSwAttrSet() );
- if( aCharSet.Count() )
+ {
+ // alle, oder nur die CharAttribute ?
+ if ( !bForceCopyOfAllAttrs
+ && ( nDestStart
+ || pDest->HasSwAttrSet()
+ || nLen != pDest->GetTxt().Len() ) )
+ {
+ SfxItemSet aCharSet( pDest->GetDoc()->GetAttrPool(),
+ RES_CHRATR_BEGIN, RES_CHRATR_END-1,
+ RES_TXTATR_INETFMT, RES_TXTATR_INETFMT,
+ RES_TXTATR_CHARFMT, RES_TXTATR_CHARFMT,
+ RES_UNKNOWNATR_BEGIN, RES_UNKNOWNATR_END-1,
+ 0 );
+ aCharSet.Put( *GetpSwAttrSet() );
+ if( aCharSet.Count() )
{
pDest->SetAttr( aCharSet, nDestStart, nDestStart + nLen );
}
- }
- else
+ }
+ else
{
- GetpSwAttrSet()->CopyToModify( *pDest );
+ GetpSwAttrSet()->CopyToModify( *pDest );
}
- }
+ }
bool const bUndoNodes = !pOtherDoc
- && GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
+ && GetDoc()->GetIDocumentUndoRedo().IsUndoNodes(GetNodes());
- // Ende erst jetzt holen, weil beim Kopieren in sich selbst der
- // Start-Index und alle Attribute vorher aktualisiert werden.
- nTxtStartIdx = rStart.GetIndex();
+ // Ende erst jetzt holen, weil beim Kopieren in sich selbst der
+ // Start-Index und alle Attribute vorher aktualisiert werden.
+ nTxtStartIdx = rStart.GetIndex();
const xub_StrLen nEnd = nTxtStartIdx + nLen;
- // 2. Attribute kopieren
- // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
- // des Attributs hinter dem zu kopierenden Bereich liegt
+ // 2. Attribute kopieren
+ // durch das Attribute-Array, bis der Anfang des Geltungsbereiches
+ // des Attributs hinter dem zu kopierenden Bereich liegt
const sal_uInt16 nSize = m_pSwpHints ? m_pSwpHints->Count() : 0;
- // wird in sich selbst kopiert, dann kann beim Einfuegen ein
- // Attribut geloescht werden. Darum erst ins Tmp-Array kopieren und
- // dann erst ins eigene uebertragen.
- SwpHts aArr( 5 );
+ // wird in sich selbst kopiert, dann kann beim Einfuegen ein
+ // Attribut geloescht werden. Darum erst ins Tmp-Array kopieren und
+ // dann erst ins eigene uebertragen.
+ SwpHts aArr( 5 );
- // Del-Array fuer alle RefMarks ohne Ausdehnung
- SwpHts aRefMrkArr;
+ // Del-Array fuer alle RefMarks ohne Ausdehnung
+ SwpHts aRefMrkArr;
sal_uInt16 nDeletedDummyChars(0);
- //Achtung: kann ungueltig sein!!
+ //Achtung: kann ungueltig sein!!
for (sal_uInt16 n = 0; ( n < nSize ); ++n)
{
const xub_StrLen nAttrStartIdx = *(*m_pSwpHints)[n]->GetStart();
- if (!( nAttrStartIdx < nEnd))
+ if ( !( nAttrStartIdx < nEnd) )
break;
SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(n);
const xub_StrLen * const pEndIdx = pHt->GetEnd();
const sal_uInt16 nWhich = pHt->Which();
- // JP 26.04.94: REFMARK's werden nie kopiert. Hat das Refmark aber
- // keinen Bereich umspannt, so steht im Text ein 255
- // dieses muss entfernt werden. Trick: erst kopieren,
- // erkennen und sammeln, nach dem kopieren Loeschen.
- // Nimmt sein Zeichen mit ins Grab !!
- // JP 14.08.95: Duerfen RefMarks gemovt werden?
- int bCopyRefMark = RES_TXTATR_REFMARK == nWhich && ( bUndoNodes ||
- (!pOtherDoc ? GetDoc()->IsCopyIsMove()
- : 0 == pOtherDoc->GetRefMark(
- pHt->GetRefMark().GetRefName() )));
+ // JP 26.04.94: REFMARK's werden nie kopiert. Hat das Refmark aber
+ // keinen Bereich umspannt, so steht im Text ein 255
+ // dieses muss entfernt werden. Trick: erst kopieren,
+ // erkennen und sammeln, nach dem kopieren Loeschen.
+ // Nimmt sein Zeichen mit ins Grab !!
+ // JP 14.08.95: Duerfen RefMarks gemovt werden?
+ const bool bCopyRefMark = RES_TXTATR_REFMARK == nWhich
+ && ( bUndoNodes
+ || ( !pOtherDoc
+ ? GetDoc()->IsCopyIsMove()
+ : 0 == pOtherDoc->GetRefMark( pHt->GetRefMark().GetRefName() ) ) );
+
+ if ( pEndIdx
+ && RES_TXTATR_REFMARK == nWhich
+ && !bCopyRefMark )
+ {
+ continue;
+ }
- if( pEndIdx && RES_TXTATR_REFMARK == nWhich && !bCopyRefMark )
- {
- continue;
- }
+ // Input Fields are only copied, if completely covered by copied text
+ if ( nWhich == RES_TXTATR_INPUTFIELD )
+ {
+ ASSERT( pEndIdx != NULL,
+ "<SwTxtNode::CopyText(..)> - RES_TXTATR_INPUTFIELD without EndIndex!" );
+ if ( nAttrStartIdx < nTxtStartIdx
+ || ( pEndIdx != NULL
+ && *(pEndIdx) > nEnd ) )
+ {
+ continue;
+ }
+ }
xub_StrLen nAttrStt;
xub_StrLen nAttrEnd;
- if( nAttrStartIdx < nTxtStartIdx )
- {
+ if( nAttrStartIdx < nTxtStartIdx )
+ {
// start is before selection
// copy hints with end and CH_TXTATR only if dummy char is copied
if ( pEndIdx && (*pEndIdx > nTxtStartIdx) && !pHt->HasDummyChar() )
{
// attribute with extent and the end is in the selection
- nAttrStt = nDestStart;
+ nAttrStt = nDestStart;
nAttrEnd = (*pEndIdx > nEnd)
- ? rDestStart.GetIndex()
- : nDestStart + (*pEndIdx) - nTxtStartIdx;
- }
- else
- {
- continue;
- }
- }
- else
- {
+ ? rDestStart.GetIndex()
+ : nDestStart + (*pEndIdx) - nTxtStartIdx;
+ }
+ else
+ {
+ continue;
+ }
+ }
+ else
+ {
// start is in the selection
- nAttrStt = nDestStart + ( nAttrStartIdx - nTxtStartIdx );
- if( pEndIdx )
+ nAttrStt = nDestStart + ( nAttrStartIdx - nTxtStartIdx );
+ if( pEndIdx )
{
- nAttrEnd = *pEndIdx > nEnd
- ? rDestStart.GetIndex()
- : nDestStart + ( *pEndIdx - nTxtStartIdx );
+ nAttrEnd = *pEndIdx > nEnd
+ ? rDestStart.GetIndex()
+ : nDestStart + ( *pEndIdx - nTxtStartIdx );
}
- else
+ else
{
- nAttrEnd = nAttrStt;
+ nAttrEnd = nAttrStt;
}
- }
+ }
SwTxtAttr * pNewHt = 0;
- if( pDest == this )
+ if( pDest == this )
{
// copy the hint here, but insert it later
pNewHt = MakeTxtAttr( *GetDoc(), pHt->GetAttr(),
nAttrStt, nAttrEnd, COPY, pDest );
lcl_CopyHint(nWhich, pHt, pNewHt, 0, pDest);
- aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() );
- }
- else
- {
+ aArr.C40_INSERT( SwTxtAttr, pNewHt, aArr.Count() );
+ }
+ else
+ {
pNewHt = pDest->InsertItem( pHt->GetAttr(), nAttrStt - nDeletedDummyChars,
nAttrEnd - nDeletedDummyChars,
nsSetAttrMode::SETATTR_NOTXTATRCHR
@@ -1707,38 +1775,38 @@ void SwTxtNode::CopyText( SwTxtNode *con
}
}
- if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark )
- {
- aRefMrkArr.C40_INSERT( SwTxtAttr, pNewHt, aRefMrkArr.Count() );
- }
- }
+ if( RES_TXTATR_REFMARK == nWhich && !pEndIdx && !bCopyRefMark )
+ {
+ aRefMrkArr.C40_INSERT( SwTxtAttr, pNewHt, aRefMrkArr.Count() );
+ }
+ }
- // nur falls im Array Attribute stehen (kann nur beim Kopieren
- // sich selbst passieren!!)
+ // nur falls im Array Attribute stehen (kann nur beim Kopieren
+ // sich selbst passieren!!)
for ( sal_uInt16 i = 0; i < aArr.Count(); ++i )
{
InsertHint( aArr[ i ], nsSetAttrMode::SETATTR_NOTXTATRCHR );
}
- if( pDest->GetpSwpHints() )
+ if( pDest->GetpSwpHints() )
{
for ( sal_uInt16 i = 0; i < aRefMrkArr.Count(); ++i )
- {
+ {
SwTxtAttr * const pNewHt = aRefMrkArr[i];
- if( pNewHt->GetEnd() )
- {
- pDest->GetpSwpHints()->Delete( pNewHt );
- pDest->DestroyAttr( pNewHt );
- }
- else
- {
- const SwIndex aIdx( pDest, *pNewHt->GetStart() );
+ if( pNewHt->GetEnd() )
+ {
+ pDest->GetpSwpHints()->Delete( pNewHt );
+ pDest->DestroyAttr( pNewHt );
+ }
+ else
+ {
+ const SwIndex aIdx( pDest, *pNewHt->GetStart() );
pDest->EraseText( aIdx, 1 );
}
}
}
- CHECK_SWPHINTS(this);
+ CHECK_SWPHINTS(this);
}
@@ -2255,15 +2323,15 @@ void SwTxtNode::EraseText(const SwIndex
const xub_StrLen nHintStart = *pHt->GetStart();
if ( nHintStart < nStartIdx )
- continue;
+ continue;
if ( nHintStart > nEndIdx )
break; // hints are sorted by end, so break here
- const xub_StrLen* pHtEndIdx = pHt->GetEnd();
- const sal_uInt16 nWhich = pHt->Which();
+ const xub_StrLen* pHtEndIdx = pHt->GetEnd();
+ const sal_uInt16 nWhich = pHt->Which();
- if( !pHtEndIdx )
+ if( !pHtEndIdx )
{
ASSERT(pHt->HasDummyChar(),
"attribute with neither end nor CH_TXTATR?");
@@ -2271,11 +2339,11 @@ void SwTxtNode::EraseText(const SwIndex
(nHintStart >= nStartIdx) && (nHintStart < nEndIdx))
{
m_pSwpHints->DeleteAtPos(i);
- DestroyAttr( pHt );
- --i;
- }
- continue;
- }
+ DestroyAttr( pHt );
+ --i;
+ }
+ continue;
+ }
ASSERT (!( (nHintStart < nEndIdx) && (*pHtEndIdx > nEndIdx)
&& pHt->HasDummyChar() )
@@ -2287,7 +2355,7 @@ void SwTxtNode::EraseText(const SwIndex
// 1. The hint ends before the deletion end position or
// 2. The hint ends at the deletion end position and
// we are not in empty expand mode and
- // the hint is a [toxmark|refmark|ruby] text attribute
+ // the hint is a [toxmark|refmark|ruby|inputfield] text attribute
// 3. deleting exactly the dummy char of an hint with end and dummy
// char deletes the hint
if ( (*pHtEndIdx < nEndIdx)
@@ -2295,16 +2363,9 @@ void SwTxtNode::EraseText(const SwIndex
!(IDocumentContentOperations::INS_EMPTYEXPAND & nMode) &&
( (RES_TXTATR_TOXMARK == nWhich) ||
(RES_TXTATR_REFMARK == nWhich) ||
- // --> FME 2006-03-03 #i62668# Ruby text attribute must be
- // treated just like toxmark and refmarks
- (RES_TXTATR_CJK_RUBY == nWhich) ) )
- // <--
-#if 0
- || ( (nHintStart == nStartIdx) &&
- (nHintStart + 1 == nEndIdx)&&
-#else // generalize this to left-overlapped dummy char hints (see ASSERT)
+ (RES_TXTATR_CJK_RUBY == nWhich) ||
+ (RES_TXTATR_INPUTFIELD == nWhich) ) )
|| ( (nHintStart < nEndIdx) &&
-#endif
pHt->HasDummyChar() )
)
{
@@ -2318,18 +2379,18 @@ void SwTxtNode::EraseText(const SwIndex
TryDeleteSwpHints();
- Update( rIdx, nCnt, sal_True );
+ Update( rIdx, nCnt, sal_True );
- if( 1 == nCnt )
- {
+ if( 1 == nCnt )
+ {
SwDelChr aHint( nStartIdx );
- NotifyClients( 0, &aHint );
+ NotifyClients( 0, &aHint );
}
else
{
SwDelTxt aHint( nStartIdx, nCnt );
- NotifyClients( 0, &aHint );
- }
+ NotifyClients( 0, &aHint );
+ }
ASSERT(rIdx.GetIndex() == nStartIdx, "huh? start index has changed?");
@@ -2337,7 +2398,7 @@ void SwTxtNode::EraseText(const SwIndex
// at the TxtNode can become invalid:
SetCalcHiddenCharFlags();
- CHECK_SWPHINTS(this);
+ CHECK_SWPHINTS(this);
}
/***********************************************************************
@@ -2357,25 +2418,24 @@ void SwTxtNode::GCAttr()
return;
bool bChanged = false;
- sal_uInt16 nMin = m_Text.Len(),
- nMax = 0;
- sal_Bool bAll = nMin != 0; // Bei leeren Absaetzen werden nur die
- // INet-Formate entfernt.
+ sal_uInt16 nMin = m_Text.Len();
+ sal_uInt16 nMax = 0;
+ const bool bAll = nMin != 0; // Bei leeren Absaetzen werden nur die INet-Formate entfernt.
for ( sal_uInt16 i = 0; m_pSwpHints && i < m_pSwpHints->Count(); ++i )
{
SwTxtAttr * const pHt = m_pSwpHints->GetTextHint(i);
- // wenn Ende und Start gleich sind --> loeschen
+ // wenn Ende und Start gleich sind --> loeschen
const xub_StrLen * const pEndIdx = pHt->GetEnd();
if (pEndIdx && !pHt->HasDummyChar() && (*pEndIdx == *pHt->GetStart())
- && ( bAll || pHt->Which() == RES_TXTATR_INETFMT ) )
+ && ( bAll || pHt->Which() == RES_TXTATR_INETFMT ) )
{
bChanged = true;
- nMin = Min( nMin, *pHt->GetStart() );
- nMax = Max( nMax, *pHt->GetEnd() );
+ nMin = Min( nMin, *pHt->GetStart() );
+ nMax = Max( nMax, *pHt->GetEnd() );
DestroyAttr( m_pSwpHints->Cut(i) );
- --i;
+ --i;
}
else
{
@@ -2384,14 +2444,14 @@ void SwTxtNode::GCAttr()
}
TryDeleteSwpHints();
- if(bChanged)
- {
- //TxtFrm's reagieren auf aHint, andere auf aNew
- SwUpdateAttr aHint( nMin, nMax, 0 );
- NotifyClients( 0, &aHint );
- SwFmtChg aNew( GetTxtColl() );
- NotifyClients( 0, &aNew );
- }
+ if(bChanged)
+ {
+ //TxtFrm's reagieren auf aHint, andere auf aNew
+ SwUpdateAttr aHint( nMin, nMax, 0 );
+ NotifyClients( 0, &aHint );
+ SwFmtChg aNew( GetTxtColl() );
+ NotifyClients( 0, &aNew );
+ }
}
// #i23726#
@@ -2429,86 +2489,9 @@ SwNumRule* SwTxtNode::_GetNumRule(sal_Bo
}
}
}
-
- // --> OD 2006-11-20 #i71764#
- // Document setting OUTLINE_LEVEL_YIELDS_OUTLINE_RULE has no influence
- // any more.
-// if ( !pRet &&
-// GetDoc()->get(IDocumentSettingAccess::OUTLINE_LEVEL_YIELDS_OUTLINE_RULE) &&
-// GetOutlineLevel() != NO_NUMBERING )
-// {
-// pRet = GetDoc()->GetOutlineNumRule();
-// }
- // <--
}
- // old code before tuning
-// // --> OD 2005-10-25 #126347#
-// // determine of numbering/bullet rule, which is set as a hard attribute
-// // at the text node
-// const SfxPoolItem* pItem( 0L );
-// if ( HasSwAttrSet() ) // does text node has hard attributes ?
-// {
-// if ( SFX_ITEM_SET !=
-// GetpSwAttrSet()->GetItemState( RES_PARATR_NUMRULE, sal_False, &pItem ) )
-// {
-// pItem = 0L;
-// }
-// // else: <pItem> contains the numbering/bullet attribute, which is
-// // hard set at the paragraph.
-// }
-// // <--
-// bool bNoNumRule = false;
-// if (pItem)
-// {
-// String sNumRuleName = static_cast<const SwNumRuleItem *>(pItem)->GetValue();
-// if (sNumRuleName.Len() > 0)
-// {
-// pRet = GetDoc()->FindNumRulePtr(sNumRuleName);
-// }
-// else // numbering is turned off by hard attribute
-// bNoNumRule = true;
-// }
-
-// if (! bNoNumRule)
-// {
-// if (! pRet && bInParent)
-// {
-// SwTxtFmtColl * pColl = GetTxtColl();
-
-// if (pColl)
-// {
-// const SwNumRuleItem & rItem = pColl->GetNumRule(sal_True);
-
-// pRet = const_cast<SwDoc *>(GetDoc())->
-// FindNumRulePtrWithPool(rItem.GetValue());
-// // --> OD 2005-10-13 #125993# - The outline numbering rule
-// // isn't allowed to be derived from a parent paragraph style
-// // to a derived one.
-// // Thus check, if the found outline numbering rule is directly
-// // set at the paragraph style <pColl>. If not, don't return
-// // the outline numbering rule.
-// if ( pRet && pRet == GetDoc()->GetOutlineNumRule() )
-// {
-// const SwNumRuleItem& rDirectItem = pColl->GetNumRule(sal_False);
-// SwNumRule* pNumRuleAtParaStyle = const_cast<SwDoc*>(GetDoc())->
-// FindNumRulePtrWithPool(rDirectItem.GetValue());
-// if ( !pNumRuleAtParaStyle )
-// {
-// pRet = 0L;
-// }
-// }
-// // <--
-// }
-// }
-
-// if (!pRet && GetDoc()->IsOutlineLevelYieldsOutlineRule() &&
-// GetOutlineLevel() != NO_NUMBERING)
-// pRet = GetDoc()->GetOutlineNumRule();
-// }
- // <--
-
- return pRet;
+ return pRet;
}
SwNumRule* SwTxtNode::GetNumRule(sal_Bool bInParent) const
@@ -2711,11 +2694,10 @@ SwTxtNode* SwTxtNode::_MakeNewTxtNode( c
SwCntntNode* SwTxtNode::AppendNode( const SwPosition & rPos )
{
- // Position hinter dem eingefuegt wird
- SwNodeIndex aIdx( rPos.nNode, 1 );
- SwTxtNode* pNew = _MakeNewTxtNode( aIdx, sal_True );
+ // Position hinter dem eingefuegt wird
+ SwNodeIndex aIdx( rPos.nNode, 1 );
+ SwTxtNode* pNew = _MakeNewTxtNode( aIdx, sal_True );
- // --> OD 2008-05-14 #refactorlists#
// reset list attributes at appended text node
pNew->ResetAttr( RES_PARATR_LIST_ISRESTART );
pNew->ResetAttr( RES_PARATR_LIST_RESTARTVALUE );
@@ -2725,25 +2707,23 @@ SwCntntNode* SwTxtNode::AppendNode( cons
pNew->ResetAttr( RES_PARATR_LIST_ID );
pNew->ResetAttr( RES_PARATR_LIST_LEVEL );
}
- // <--
- // --> OD 2008-03-13 #refactorlists#
-// SyncNumberAndNumRule();
+
if ( !IsInList() && GetNumRule() && GetListId().Len() > 0 )
{
AddToList();
}
- // <--
- if( GetDepends() )
- MakeFrms( *pNew );
- return pNew;
+ if( GetDepends() )
+ MakeFrms( *pNew );
+ return pNew;
}
/*************************************************************************
* SwTxtNode::GetTxtAttr
*************************************************************************/
-SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt( const xub_StrLen nIndex,
+SwTxtAttr * SwTxtNode::GetTxtAttrForCharAt(
+ const xub_StrLen nIndex,
const RES_TXTATR nWhich ) const
{
if ( HasHints() )
@@ -2759,7 +2739,7 @@ SwTxtAttr * SwTxtNode::GetTxtAttrForChar
if ( (nIndex == nStartPos) && pHint->HasDummyChar() )
{
return ( RES_TXTATR_END == nWhich || nWhich == pHint->Which() )
- ? pHint : 0;
+ ? pHint : 0;
}
}
}
@@ -3092,10 +3072,15 @@ XubString SwTxtNode::GetExpandTxt( const
const bool bAddSpaceAfterListLabelStr,
const bool bWithSpacesForLevel ) const
{
- XubString aTxt( GetTxt().Copy( nIdx, nLen ) );
- xub_StrLen nTxtStt = nIdx;
- Replace0xFF( aTxt, nTxtStt, aTxt.Len(), sal_True );
- if( bWithNum )
+ XubString aTxt( GetTxt().Copy( nIdx, nLen ) );
+ xub_StrLen nTxtStt = nIdx;
+ Replace0xFF( aTxt, nTxtStt, aTxt.Len(), sal_True );
+
+ // remove dummy characters of Input Fields
+ aTxt.EraseAllChars( CH_TXT_ATR_INPUTFIELDSTART );
+ aTxt.EraseAllChars( CH_TXT_ATR_INPUTFIELDEND );
+
+ if( bWithNum )
{
XubString aListLabelStr = GetNumString();
if ( aListLabelStr.Len() > 0 )
@@ -3148,8 +3133,13 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtN
SwScriptInfo::MaskHiddenRanges( *this, sTmpText, 0, sTmpText.Len(), cChar );
sTmpText = sTmpText.Copy( nIdx, nLen );
+ // remove dummy characters of Input Fields
+ {
+ sTmpText.EraseAllChars( CH_TXT_ATR_INPUTFIELDSTART );
+ sTmpText.EraseAllChars( CH_TXT_ATR_INPUTFIELDEND );
+ }
rDestNd.InsertText( sTmpText, aDestIdx );
- nLen = aDestIdx.GetIndex() - nDestStt;
+ nLen = aDestIdx.GetIndex() - nDestStt;
// alle FontAttribute mit CHARSET Symbol in dem Bereich setzen
if ( HasHints() )
@@ -3163,7 +3153,7 @@ sal_Bool SwTxtNode::GetExpandTxt( SwTxtN
if (nIdx + nLen <= nAttrStartIdx)
break; // ueber das Textende
- const xub_StrLen *pEndIdx = pHt->GetEnd();
+ const xub_StrLen *pEndIdx = pHt->End();
if( pEndIdx && *pEndIdx > nIdx &&
( RES_CHRATR_FONT == nWhich ||
RES_TXTATR_CHARFMT == nWhich ||
@@ -3473,19 +3463,12 @@ namespace {
bParagraphStyleChanged = true;
if( rTxtNode.GetNodes().IsDocNodes() )
{
- // --> OD 2008-12-17 #i70748#
- // The former list style set at the paragraph can not be
- // retrieved from the change set.
-// sOldNumRule =
-// dynamic_cast<const SwFmtChg*>(pOldValue)->pChangedFmt->GetNumRule().GetValue();
const SwNumRule* pFormerNumRuleAtTxtNode =
rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0;
if ( pFormerNumRuleAtTxtNode )
{
sOldNumRule = pFormerNumRuleAtTxtNode->GetName();
}
- // <--
- // --> OD 2008-11-19 #i70748#
if ( rTxtNode.IsEmptyListStyleDueToSetOutlineLevelAttr() )
{
const SwNumRuleItem& rNumRuleItem = rTxtNode.GetTxtColl()->GetNumRule();
@@ -3494,7 +3477,6 @@ namespace {
rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
}
}
- // <--
const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule();
if ( pNumRuleAtTxtNode )
{
@@ -3507,80 +3489,45 @@ namespace {
case RES_ATTRSET_CHG:
{
const SfxPoolItem* pItem = 0;
- // --> OD 2008-12-19 #i70748#
- // The former list style set at the paragraph can not be
- // retrieved from the change set.
-// if ( dynamic_cast<const SwAttrSetChg*>(pOldValue)->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, sal_False, &pItem ) ==
-// SFX_ITEM_SET )
-// {
-// sOldNumRule = dynamic_cast<const SwNumRuleItem*>(pItem)->GetValue();
-// }
const SwNumRule* pFormerNumRuleAtTxtNode =
rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0;
if ( pFormerNumRuleAtTxtNode )
{
sOldNumRule = pFormerNumRuleAtTxtNode->GetName();
}
- // <--
if ( dynamic_cast<const SwAttrSetChg*>(pNewValue)->GetChgSet()->GetItemState( RES_PARATR_NUMRULE, sal_False, &pItem ) ==
SFX_ITEM_SET )
{
- // --> OD 2008-11-19 #i70748#
rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
- // <--
bNumRuleSet = true;
- // The new list style set at the paragraph can not be
- // retrieved from the change set.
-// sNumRule = dynamic_cast<const SwNumRuleItem*>(pItem)->GetValue();
- // <--
}
- // --> OD 2008-12-17 #i70748#
- // The new list style set at the paragraph.
const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule();
if ( pNumRuleAtTxtNode )
{
sNumRule = pNumRuleAtTxtNode->GetName();
}
- // <--
break;
}
case RES_PARATR_NUMRULE:
{
if ( rTxtNode.GetNodes().IsDocNodes() )
{
- // The former list style set at the paragraph can not be
- // retrieved from the change set.
-// if ( pOldValue )
-// {
-// sOldNumRule = dynamic_cast<const SwNumRuleItem*>(pOldValue)->GetValue();
-// }
const SwNumRule* pFormerNumRuleAtTxtNode =
rTxtNode.GetNum() ? rTxtNode.GetNum()->GetNumRule() : 0;
if ( pFormerNumRuleAtTxtNode )
{
sOldNumRule = pFormerNumRuleAtTxtNode->GetName();
}
- // <--
if ( pNewValue )
{
- // --> OD 2008-11-19 #i70748#
rTxtNode.ResetEmptyListStyleDueToResetOutlineLevelAttr();
- // <--
bNumRuleSet = true;
- // --> OD 2008-12-17 #i70748#
- // The new list style set at the paragraph can not be
- // retrieved from the change set.
-// sNumRule = dynamic_cast<const SwNumRuleItem*>(pNewValue)->GetValue();
- // <--
}
- // --> OD 2008-12-17 #i70748#
- // The new list style set at the paragraph.
const SwNumRule* pNumRuleAtTxtNode = rTxtNode.GetNumRule();
if ( pNumRuleAtTxtNode )
{
sNumRule = pNumRuleAtTxtNode->GetName();
}
- // <--
}
break;
}
@@ -3601,12 +3548,10 @@ namespace {
aResetAttrsArray.Insert( RES_PARATR_LIST_RESTARTVALUE );
aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED );
SwPaM aPam( rTxtNode );
- // --> OD 2008-11-28 #i96644#
// suppress side effect "send data changed events"
rTxtNode.GetDoc()->ResetAttrs( aPam, sal_False,
&aResetAttrsArray,
false );
- // <--
}
}
else
@@ -3617,12 +3562,9 @@ namespace {
if ( sNumRule ==
String::CreateFromAscii( SwNumRule::GetOutlineRuleName() ) )
{
- // --> OD 2008-09-10 #i70748#
ASSERT( rTxtNode.GetTxtColl()->IsAssignedToListLevelOfOutlineStyle(),
"<HandleModifyAtTxtNode()> - text node with outline style, but its paragraph style is not assigned to outline style." );
- int nNewListLevel =
- rTxtNode.GetTxtColl()->GetAssignedOutlineStyleLevel();
- // <--
+ const int nNewListLevel = rTxtNode.GetTxtColl()->GetAssignedOutlineStyleLevel();
if ( 0 <= nNewListLevel && nNewListLevel < MAXLEVEL )
{
rTxtNode.SetAttrListLevel( nNewListLevel );
@@ -3643,18 +3585,13 @@ namespace {
aResetAttrsArray.Insert( RES_PARATR_LIST_RESTARTVALUE );
aResetAttrsArray.Insert( RES_PARATR_LIST_ISCOUNTED );
SwPaM aPam( rTxtNode );
- // --> OD 2008-11-28 #i96644#
- // suppress side effect "send data changed events"
rTxtNode.GetDoc()->ResetAttrs( aPam, sal_False,
&aResetAttrsArray,
false );
- // <--
- // --> OD 2008-11-19 #i70748#
if ( dynamic_cast<const SfxUInt16Item &>(rTxtNode.GetAttr( RES_PARATR_OUTLINELEVEL, sal_False )).GetValue() > 0 )
{
rTxtNode.SetEmptyListStyleDueToSetOutlineLevelAttr();
}
- // <--
}
}
}
@@ -3662,7 +3599,6 @@ namespace {
{
rTxtNode.AddToList();
}
- // <--
}
// End of method <HandleModifyAtTxtNode>
}
@@ -5072,16 +5008,19 @@ SwTxtNode::MakeUnoObject()
SwXParagraph::CreateXParagraph(*GetDoc(), *this), uno::UNO_QUERY);
return xMeta;
}
+
//Bug 120881:Modify here for Directly Page Numbering
bool SwTxtNode::HasPageNumberField()
{
- xub_StrLen nEnd = Len();
- for(xub_StrLen nStart=0;nStart<nEnd;nStart++)
+ const xub_StrLen nEnd = Len();
+ for( xub_StrLen nStart = 0; nStart < nEnd; ++nStart )
{
- const SwTxtFld* pFld = GetTxtFld(nStart);
- const SwField* pSwField = pFld
- ? pFld->GetFmtFld().GetField()
- : NULL;
+ const SwTxtAttr* pTxtAttr = GetTxtAttrAt( nStart, RES_TXTATR_FIELD );
+ if ( pTxtAttr == NULL )
+ {
+ continue;
+ }
+ const SwField* pSwField = pTxtAttr->GetFmtFld().GetField();
const SwFieldType* pType = pSwField
? pSwField->GetTyp()
: NULL;