summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-01-30 10:13:04 +0000
committerAndras Timar <andras.timar@collabora.com>2015-02-23 10:31:01 +0100
commit3a4433bb93705969bd17bcf0003c2b37407f7905 (patch)
tree8b23499a5193e634f8317e9162a051a3b7b87e6a /sw/source/core
parentbaa5f52108f6d13d1cace3166c1e785b1a5fcd92 (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 (cherry picked from commit 95f4b2f4a6dfe47842336116d94edd175a6da960) Conflicts: sw/source/core/txtnode/ndtxt.cxx Change-Id: I76500239a103e56be412707a708a303a58236070 Reviewed-on: https://gerrit.libreoffice.org/14254 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> (cherry picked from commit 6aa163f33d48326905f47e1f37ea26f992f4235f)
Diffstat (limited to 'sw/source/core')
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx28
1 files changed, 22 insertions, 6 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 0c1d094304b8..615f2712d2a1 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -839,6 +839,8 @@ void SwTxtNode::Update(
{
if ( bNegative )
{
+ std::vector<SwTxtInputFld*> aTxtInputFlds;
+
const sal_Int32 nChangeEnd = nChangePos + nChangeLen;
for ( sal_uInt16 n = 0; n < m_pSwpHints->Count(); ++n )
{
@@ -881,12 +883,18 @@ 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 (std::vector<SwTxtInputFld*>::iterator aI = aTxtInputFlds.begin(); aI != aTxtInputFlds.end(); ++aI)
+ {
+ SwTxtInputFld* pTxtInputFld = *aI;
+ pTxtInputFld->UpdateFieldContent();
+ }
+
m_pSwpHints->MergePortions( *this );
}
else
@@ -896,6 +904,7 @@ void SwTxtNode::Update(
bool bMergePortionsNeeded = false;
const sal_uInt16 coArrSz =
static_cast<sal_uInt16>(RES_TXTATR_WITHEND_END) - static_cast<sal_uInt16>(RES_CHRATR_BEGIN);
+ std::vector<SwTxtInputFld*> aTxtInputFlds;
bool aDontExp[ coArrSz ];
memset( &aDontExp, 0, coArrSz * sizeof(bool) );
@@ -993,11 +1002,18 @@ 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 (std::vector<SwTxtInputFld*>::iterator aI = aTxtInputFlds.begin(); aI != aTxtInputFlds.end(); ++aI)
+ {
+ SwTxtInputFld* pTxtInputFld = *aI;
+ pTxtInputFld->UpdateFieldContent();
+ }
+
if (bMergePortionsNeeded)
{
m_pSwpHints->MergePortions(*this); // does Resort too