Author: orw
Date: Thu Jun 19 06:53:05 2014
New Revision: 1603723
URL: http://svn.apache.org/r1603723
Log:
125044: - use field's content cache on <SwTxtFld> construction only for
clipboard documents
- assure invalidation and updates on code to update fields
cherry-picked from trunk
Modified:
openoffice/branches/AOO410/ (props changed)
openoffice/branches/AOO410/main/ (props changed)
openoffice/branches/AOO410/main/sw/inc/txtannotationfld.hxx
openoffice/branches/AOO410/main/sw/inc/txtfld.hxx
openoffice/branches/AOO410/main/sw/source/core/crsr/crstrvl.cxx
openoffice/branches/AOO410/main/sw/source/core/doc/docfld.cxx
openoffice/branches/AOO410/main/sw/source/core/txtnode/atrfld.cxx
openoffice/branches/AOO410/main/sw/source/core/txtnode/thints.cxx
Propchange: openoffice/branches/AOO410/
------------------------------------------------------------------------------
Merged /openoffice/trunk:r1602434
Propchange: openoffice/branches/AOO410/main/
------------------------------------------------------------------------------
Merged /openoffice/trunk/main:r1602434
Modified: openoffice/branches/AOO410/main/sw/inc/txtannotationfld.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/inc/txtannotationfld.hxx?rev=1603723&r1=1603722&r2=1603723&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/inc/txtannotationfld.hxx (original)
+++ openoffice/branches/AOO410/main/sw/inc/txtannotationfld.hxx Thu Jun 19
06:53:05 2014
@@ -33,7 +33,8 @@ class SwTxtAnnotationFld : public SwTxtF
public:
SwTxtAnnotationFld(
SwFmtFld & rAttr,
- xub_StrLen const nStart );
+ xub_StrLen const nStart,
+ const bool bIsClipboardDoc );
virtual ~SwTxtAnnotationFld();
Modified: openoffice/branches/AOO410/main/sw/inc/txtfld.hxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/inc/txtfld.hxx?rev=1603723&r1=1603722&r2=1603723&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/inc/txtfld.hxx (original)
+++ openoffice/branches/AOO410/main/sw/inc/txtfld.hxx Thu Jun 19 06:53:05 2014
@@ -41,18 +41,14 @@ class SwTxtFld : public SwTxtAttr
public:
SwTxtFld(
SwFmtFld & rAttr,
- xub_StrLen const nStart );
+ xub_StrLen const nStart,
+ const bool bIsClipboardDoc );
virtual ~SwTxtFld();
void CopyTxtFld( SwTxtFld *pDest ) const;
- void ExpandTxtFld() const;
- inline void ExpandAlways()
- {
- m_aExpand += ' '; // changing current value to assure that
<ExpandTxtFld()> changes the value.
- ExpandTxtFld();
- }
+ void ExpandTxtFld( const bool bForceNotify = false ) const;
// get and set TxtNode pointer
inline SwTxtNode* GetpTxtNode() const
@@ -89,7 +85,8 @@ public:
SwTxtInputFld(
SwFmtFld & rAttr,
xub_StrLen const nStart,
- xub_StrLen const nEnd );
+ xub_StrLen const nEnd,
+ const bool bIsClipboardDoc );
virtual ~SwTxtInputFld();
Modified: openoffice/branches/AOO410/main/sw/source/core/crsr/crstrvl.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/source/core/crsr/crstrvl.cxx?rev=1603723&r1=1603722&r2=1603723&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/source/core/crsr/crstrvl.cxx (original)
+++ openoffice/branches/AOO410/main/sw/source/core/crsr/crstrvl.cxx Thu Jun 19
06:53:05 2014
@@ -722,7 +722,7 @@ sal_Bool SwCrsrShell::MoveFldType(
SwFmtFld* pFmtFld = new SwFmtFld( SwDateTimeField(
(SwDateTimeFieldType*)pDoc->GetSysFldType( RES_DATETIMEFLD ) )
);
- pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex() );
+ pTxtFld = new SwTxtFld( *pFmtFld, rPos.nContent.GetIndex(),
pDoc->IsClipBoard() );
pTxtFld->ChgTxtNode( pTNd );
}
Modified: openoffice/branches/AOO410/main/sw/source/core/doc/docfld.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/source/core/doc/docfld.cxx?rev=1603723&r1=1603722&r2=1603723&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/source/core/doc/docfld.cxx (original)
+++ openoffice/branches/AOO410/main/sw/source/core/doc/docfld.cxx Thu Jun 19
06:53:05 2014
@@ -2006,7 +2006,7 @@ void SwDoc::ChangeDBFields( const SvStri
}
if (bExpand)
- pTxtFld->ExpandAlways();
+ pTxtFld->ExpandTxtFld( true );
}
SetModified();
}
Modified: openoffice/branches/AOO410/main/sw/source/core/txtnode/atrfld.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/source/core/txtnode/atrfld.cxx?rev=1603723&r1=1603722&r2=1603723&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/source/core/txtnode/atrfld.cxx (original)
+++ openoffice/branches/AOO410/main/sw/source/core/txtnode/atrfld.cxx Thu Jun
19 06:53:05 2014
@@ -218,71 +218,76 @@ void SwFmtFld::SwClientNotify( const SwM
void SwFmtFld::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
{
- if( !mpTxtFld )
- return;
+ if ( mpTxtFld == NULL )
+ return;
- // don't do anything, especially not expand!
- if( pNew && pNew->Which() == RES_OBJECTDYING )
+ if( pNew != NULL
+ && pNew->Which() == RES_OBJECTDYING )
+ {
+ // don't do anything, especially not expand!
return;
+ }
+
+ SwTxtNode* pTxtNd = (SwTxtNode*) &mpTxtFld->GetTxtNode();
+ ASSERT( pTxtNd, "wo ist denn mein Node?" );
+ if ( pNew )
+ {
+ switch (pNew->Which())
+ {
+ case RES_TXTATR_FLDCHG:
+ // "Farbe hat sich geaendert !"
+ // this, this fuer "nur Painten"
+ pTxtNd->ModifyNotification( this, this );
+ return;
+
+ case RES_REFMARKFLD_UPDATE:
+ // GetReferenz-Felder aktualisieren
+ if ( RES_GETREFFLD == GetField()->GetTyp()->Which() )
+ {
+ dynamic_cast<SwGetRefField*>(GetField())->UpdateField(
mpTxtFld );
+ }
+ break;
+
+ case RES_DOCPOS_UPDATE:
+ // Je nach DocPos aktualisieren (SwTxtFrm::Modify())
+ pTxtNd->ModifyNotification( pNew, this );
+ return;
+
+ case RES_ATTRSET_CHG:
+ case RES_FMT_CHG:
+ pTxtNd->ModifyNotification( pOld, pNew );
+ return;
- SwTxtNode* pTxtNd = (SwTxtNode*)&mpTxtFld->GetTxtNode();
- ASSERT( pTxtNd, "wo ist denn mein Node?" );
- if( pNew )
- {
- switch( pNew->Which() )
- {
- case RES_TXTATR_FLDCHG:
- // "Farbe hat sich geaendert !"
- // this, this fuer "nur Painten"
- pTxtNd->ModifyNotification( this, this );
- return;
- case RES_REFMARKFLD_UPDATE:
- // GetReferenz-Felder aktualisieren
- if( RES_GETREFFLD ==
GetField()->GetTyp()->Which() )
- {
- // --> OD 2007-09-06 #i81002#
-// ((SwGetRefField*)GetFld())->UpdateField();
- dynamic_cast<SwGetRefField*>(GetField())->UpdateField(
mpTxtFld );
- // <--
- }
- break;
- case RES_DOCPOS_UPDATE:
- // Je nach DocPos aktualisieren
(SwTxtFrm::Modify())
- pTxtNd->ModifyNotification( pNew, this );
- return;
-
- case RES_ATTRSET_CHG:
- case RES_FMT_CHG:
- pTxtNd->ModifyNotification( pOld, pNew );
- return;
- default:
- break;
- }
- }
-
- switch (GetField()->GetTyp()->Which())
- {
- case RES_HIDDENPARAFLD:
- if( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() )
- break;
- case RES_DBSETNUMBERFLD:
- case RES_DBNUMSETFLD:
- case RES_DBNEXTSETFLD:
- case RES_DBNAMEFLD:
- pTxtNd->ModifyNotification( 0, pNew);
- return;
- }
-
- if( RES_USERFLD == GetField()->GetTyp()->Which() )
- {
- SwUserFieldType* pType = (SwUserFieldType*)GetField()->GetTyp();
- if(!pType->IsValid())
- {
- SwCalc aCalc( *pTxtNd->GetDoc() );
- pType->GetValue( aCalc );
- }
- }
- mpTxtFld->ExpandTxtFld();
+ default:
+ break;
+ }
+ }
+
+ switch (GetField()->GetTyp()->Which())
+ {
+ case RES_HIDDENPARAFLD:
+ if ( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() )
+ break;
+ case RES_DBSETNUMBERFLD:
+ case RES_DBNUMSETFLD:
+ case RES_DBNEXTSETFLD:
+ case RES_DBNAMEFLD:
+ pTxtNd->ModifyNotification( 0, pNew );
+ return;
+ }
+
+ if ( RES_USERFLD == GetField()->GetTyp()->Which() )
+ {
+ SwUserFieldType* pType = (SwUserFieldType*) GetField()->GetTyp();
+ if ( !pType->IsValid() )
+ {
+ SwCalc aCalc( *pTxtNd->GetDoc() );
+ pType->GetValue( aCalc );
+ }
+ }
+
+ const bool bForceNotify = (pOld == NULL) && (pNew == NULL);
+ mpTxtFld->ExpandTxtFld( bForceNotify );
}
sal_Bool SwFmtFld::GetInfo( SfxPoolItem& rInfo ) const
@@ -316,9 +321,10 @@ sal_Bool SwFmtFld::IsProtect() const
SwTxtFld::SwTxtFld(
SwFmtFld & rAttr,
- xub_StrLen const nStartPos )
+ xub_StrLen const nStartPos,
+ const bool bIsClipboardDoc )
: SwTxtAttr( rAttr, nStartPos )
- , m_aExpand( rAttr.GetField()->ExpandField(true) )
+ , m_aExpand( rAttr.GetField()->ExpandField( bIsClipboardDoc ) )
, m_pTxtNode( NULL )
{
rAttr.SetTxtFld( *this );
@@ -341,14 +347,15 @@ bool SwTxtFld::IsFldInDoc() const
&& GetpTxtNode()->GetNodes().IsDocNodes();
}
-void SwTxtFld::ExpandTxtFld() const
+void SwTxtFld::ExpandTxtFld( const bool bForceNotify ) const
{
ASSERT( m_pTxtNode, "SwTxtFld: where is my TxtNode?" );
const SwField* pFld = GetFmtFld().GetField();
const XubString aNewExpand(
pFld->ExpandField(m_pTxtNode->GetDoc()->IsClipBoard()) );
- if( aNewExpand == m_aExpand )
+ if ( !bForceNotify &&
+ aNewExpand == m_aExpand )
{
// Bei Seitennummernfeldern
const sal_uInt16 nWhich = pFld->GetTyp()->Which();
@@ -490,9 +497,10 @@ void SwTxtFld::DeleteTxtFld( const SwTxt
SwTxtInputFld::SwTxtInputFld(
SwFmtFld & rAttr,
xub_StrLen const nStart,
- xub_StrLen const nEnd )
+ xub_StrLen const nEnd,
+ const bool bIsClipboardDoc )
- : SwTxtFld( rAttr, nStart )
+ : SwTxtFld( rAttr, nStart, bIsClipboardDoc )
, m_nEnd( nEnd )
, m_bLockNotifyContentChange( false )
{
@@ -593,8 +601,9 @@ void SwTxtInputFld::UpdateTextNodeConten
// text annotation field
SwTxtAnnotationFld::SwTxtAnnotationFld(
SwFmtFld & rAttr,
- xub_StrLen const nStart )
- : SwTxtFld( rAttr, nStart )
+ xub_StrLen const nStart,
+ const bool bIsClipboardDoc )
+ : SwTxtFld( rAttr, nStart, bIsClipboardDoc )
{
}
Modified: openoffice/branches/AOO410/main/sw/source/core/txtnode/thints.cxx
URL:
http://svn.apache.org/viewvc/openoffice/branches/AOO410/main/sw/source/core/txtnode/thints.cxx?rev=1603723&r1=1603722&r2=1603723&view=diff
==============================================================================
--- openoffice/branches/AOO410/main/sw/source/core/txtnode/thints.cxx (original)
+++ openoffice/branches/AOO410/main/sw/source/core/txtnode/thints.cxx Thu Jun
19 06:53:05 2014
@@ -1049,12 +1049,14 @@ SwTxtAttr* MakeTxtAttr(
break;
case RES_TXTATR_FIELD:
- pNew = new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt );
+ pNew =
+ new SwTxtFld( static_cast<SwFmtFld &>(rNew), nStt,
rDoc.IsClipBoard() );
break;
case RES_TXTATR_ANNOTATION:
{
- pNew = new SwTxtAnnotationFld( static_cast<SwFmtFld &>(rNew), nStt
);
+ pNew =
+ new SwTxtAnnotationFld( static_cast<SwFmtFld &>(rNew), nStt,
rDoc.IsClipBoard() );
if ( bIsCopy == COPY )
{
// On copy of the annotation field do not keep the annotated
text range by removing
@@ -1067,7 +1069,8 @@ SwTxtAttr* MakeTxtAttr(
break;
case RES_TXTATR_INPUTFIELD:
- pNew = new SwTxtInputFld( static_cast<SwFmtFld &>(rNew), nStt, nEnd );
+ pNew =
+ new SwTxtInputFld( static_cast<SwFmtFld &>(rNew), nStt, nEnd,
rDoc.IsClipBoard() );
break;
case RES_TXTATR_FLYCNT: