summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-30 10:13:04 +0000
committerMichael Stahl <mstahl@redhat.com>2015-02-06 15:01:15 +0000
commit772be81db70570801a0b6b5de53319f21e1ff60e (patch)
tree871a2ff149a3642ceb3323104caa17dc39ea4ba7
parent2ce0432345033701200a92f662ce6b989d1319cb (diff)
Resolves: tdf#82942 updating field contents with incorrect attribute positions
Updating a SwTxtInputFld requires expanding the contents of the node. Expanding the contents of the node requires all the positions of fields in the node to be correct in order to expand them to the right place. So on updating a SwTxtNode wait until all the attributes positions are adjusted to be correct before expanding the SwTxtInputFlds in that node Change-Id: I76500239a103e56be412707a708a303a58236070 (cherry picked from commit 95f4b2f4a6dfe47842336116d94edd175a6da960) Reviewed-on: https://gerrit.libreoffice.org/14253 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx26
1 files changed, 20 insertions, 6 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index db941ba62fc4..281c483608f8 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -855,6 +855,8 @@ void SwTxtNode::Update(
{
if ( bNegative )
{
+ std::vector<SwTxtInputFld*> aTxtInputFlds;
+
const sal_Int32 nChangeEnd = nChangePos + nChangeLen;
for ( size_t n = 0; n < m_pSwpHints->Count(); ++n )
{
@@ -897,12 +899,17 @@ void SwTxtNode::Update(
{
SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pHint);
if ( pTxtInputFld )
- {
- pTxtInputFld->UpdateFieldContent();
- }
+ aTxtInputFlds.push_back(pTxtInputFld);
}
}
+ //wait until all the attribute positions are correct
+ //before updating the field contents
+ for (SwTxtInputFld* pTxtInputFld : aTxtInputFlds)
+ {
+ pTxtInputFld->UpdateFieldContent();
+ }
+
m_pSwpHints->MergePortions( *this );
}
else
@@ -911,6 +918,7 @@ void SwTxtNode::Update(
bool bResort = false;
bool bMergePortionsNeeded = false;
const int coArrSz = RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN;
+ std::vector<SwTxtInputFld*> aTxtInputFlds;
bool aDontExp[ coArrSz ];
memset( &aDontExp, 0, coArrSz * sizeof(bool) );
@@ -1002,11 +1010,17 @@ void SwTxtNode::Update(
{
SwTxtInputFld* pTxtInputFld = dynamic_cast<SwTxtInputFld*>(pHint);
if ( pTxtInputFld )
- {
- pTxtInputFld->UpdateFieldContent();
- }
+ aTxtInputFlds.push_back(pTxtInputFld);
}
}
+
+ //wait until all the attribute positions are correct
+ //before updating the field contents
+ for (SwTxtInputFld* pTxtInputFld : aTxtInputFlds)
+ {
+ pTxtInputFld->UpdateFieldContent();
+ }
+
if (bMergePortionsNeeded)
{
m_pSwpHints->MergePortions(*this); // does Resort too