[libreoffice/f16] fdo#39694 fdo#42073

Michael Stahl mstahl at fedoraproject.org
Sat Mar 3 19:33:32 UTC 2012


commit acc9a5e5489875cda68003f868542c493b20a5cc
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Mar 3 20:33:04 2012 +0100

    fdo#39694 fdo#42073
    
    - Resolves: fdo#39694 SwTxtFld: expand new fields to fix race condition
    - Resolves: fdo#42073 sw: expand all text fields when setting properties

 ...-SwTxtFld-do-expand-the-field-in-the-ctor.patch |   80 ++++++++++++++++++++
 ...w-expand-all-text-fields-when-setting-pro.patch |   34 ++++++++
 libreoffice.spec                                   |    6 ++
 3 files changed, 120 insertions(+), 0 deletions(-)
---
diff --git a/0001-fdo-39694-SwTxtFld-do-expand-the-field-in-the-ctor.patch b/0001-fdo-39694-SwTxtFld-do-expand-the-field-in-the-ctor.patch
new file mode 100644
index 0000000..6f1814a
--- /dev/null
+++ b/0001-fdo-39694-SwTxtFld-do-expand-the-field-in-the-ctor.patch
@@ -0,0 +1,80 @@
+From 9519deda120b73b72e75d89c3b2ae3d66220ec2d Mon Sep 17 00:00:00 2001
+From: Michael Stahl <mstahl at redhat.com>
+Date: Fri, 2 Mar 2012 19:02:03 +0100
+Subject: [PATCH 1/2] fdo#39694: SwTxtFld: do expand the field in the ctor
+
+While only the text formatting is able to expand all fields correctly,
+this is still good enough for many field types and fixes a race
+condition when the field value is requested before layout is finished.
+(regression from CWS sw34bf01, 8485708f3001fca132c3353c464fe7187ef62bed)
+---
+ sw/inc/txtfld.hxx                 |    3 ++-
+ sw/source/core/crsr/crstrvl.cxx   |    3 ++-
+ sw/source/core/txtnode/atrfld.cxx |    7 +++++--
+ sw/source/core/txtnode/thints.cxx |    3 ++-
+ 4 files changed, 11 insertions(+), 5 deletions(-)
+
+diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
+index 3ecabb8..f574811 100644
+--- a/sw/inc/txtfld.hxx
++++ b/sw/inc/txtfld.hxx
+@@ -42,7 +42,8 @@ class SwTxtFld : public SwTxtAttr
+     SwTxtNode * m_pTxtNode;
+ 
+ public:
+-    SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart);
++    SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStart,
++            bool const bInClipboard);
+     virtual ~SwTxtFld();
+ 
+     void CopyFld( SwTxtFld *pDest ) const;
+diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
+index fad9d8b..12e8e5f 100644
+--- a/sw/source/core/crsr/crstrvl.cxx
++++ b/sw/source/core/crsr/crstrvl.cxx
+@@ -710,7 +710,8 @@ sal_Bool SwCrsrShell::MoveFldType( const SwFieldType* pFldType, sal_Bool bNext,
+             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 );
+         }
+ 
+diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
+index dc285ef..b0b0757 100644
+--- a/sw/source/core/txtnode/atrfld.cxx
++++ b/sw/source/core/txtnode/atrfld.cxx
+@@ -283,9 +283,12 @@ sal_Bool SwFmtFld::IsProtect() const
+ |*
+ *************************************************************************/
+ 
+-SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos)
++SwTxtFld::SwTxtFld(SwFmtFld & rAttr, xub_StrLen const nStartPos,
++        bool const bInClipboard)
+     : SwTxtAttr( rAttr, nStartPos )
+-    , m_aExpand( rAttr.GetFld()->ExpandField(true) )
++// fdo#39694 the ExpandField here may not give the correct result in all cases,
++// but is better than nothing
++    , m_aExpand( rAttr.GetFld()->ExpandField(bInClipboard) )
+     , m_pTxtNode( 0 )
+ {
+     rAttr.pTxtAttr = this;
+diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
+index f6bf2e3..5064935 100644
+--- a/sw/source/core/txtnode/thints.cxx
++++ b/sw/source/core/txtnode/thints.cxx
+@@ -1035,7 +1035,8 @@ SwTxtAttr* MakeTxtAttr( SwDoc & rDoc, SfxPoolItem& rAttr,
+         pNew = new SwTxtINetFmt( (SwFmtINetFmt&)rNew, nStt, nEnd );
+         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_FLYCNT:
+         {
+-- 
+1.7.7.6
+
diff --git a/0002-fdo-42073-sw-expand-all-text-fields-when-setting-pro.patch b/0002-fdo-42073-sw-expand-all-text-fields-when-setting-pro.patch
new file mode 100644
index 0000000..fa2f687
--- /dev/null
+++ b/0002-fdo-42073-sw-expand-all-text-fields-when-setting-pro.patch
@@ -0,0 +1,34 @@
+From e3dfae0741aae8581cd3fc713ba1b4459bb22d88 Mon Sep 17 00:00:00 2001
+From: Michael Stahl <mstahl at redhat.com>
+Date: Fri, 2 Mar 2012 21:32:27 +0100
+Subject: [PATCH 2/2] fdo#42073: sw: expand all text fields when setting
+ properties:
+
+SwXTextField::setPropertyValue: call Expand() for all text fields
+Fixes getPresentation returning stale values.
+(regression from CWS sw34bf01, 8485708f3001fca132c3353c464fe7187ef62bed)
+Also, without this the text formatting does not actually update and the new
+content is not displayed until some other unrelated editing operation.
+---
+ sw/source/core/unocore/unofield.cxx |    5 ++---
+ 1 files changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
+index c12ac14..0cc0223 100644
+--- a/sw/source/core/unocore/unofield.cxx
++++ b/sw/source/core/unocore/unofield.cxx
+@@ -1912,9 +1912,8 @@ void SwXTextField::setPropertyValue(const OUString& rPropertyName, const uno::An
+         const_cast<SwFmtFld*>(pFmtFld)->Broadcast(SwFmtFldHint( 0, SWFMTFLD_CHANGED ));
+     }
+ 
+-        // changes of the expanded string have to be notified
+-        //#to the SwTxtFld
+-        if(RES_DBFLD == nWhich && pFmtFld->GetTxtFld())
++        // fdo#42073 notify SwTxtFld about changes of the expanded string
++        if (pFmtFld->GetTxtFld())
+         {
+             pFmtFld->GetTxtFld()->Expand();
+         }
+-- 
+1.7.7.6
+
diff --git a/libreoffice.spec b/libreoffice.spec
index ec9d81d..c9c3e95 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -229,6 +229,8 @@ Patch110: 0001-default-shortcut-for-.uno-SearchDialog-should-be-Ctr.patch
 Patch111: 0002-fix-crash-using-instances-dialog-of-dataform-navigat.patch
 Patch112: 0001-fix-up-endianness-of-lowhanging-QuickReads.patch
 Patch113: 0001-fix-up-endianness-of-higher-hanging-QuickReads.patch
+Patch114: 0001-fdo-39694-SwTxtFld-do-expand-the-field-in-the-ctor.patch
+Patch115: 0002-fdo-42073-sw-expand-all-text-fields-when-setting-pro.patch
 
 %{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 %define instdir %{_libdir}
@@ -1139,6 +1141,8 @@ mv -f redhat.soc extras/source/palettes/standard.soc
 %patch111 -p1 -b .fix-crash-using-instances-dialog-of-dataform-navigat.patch
 %patch112 -p1 -b .fix-up-endianness-of-lowhanging-QuickReads.patch
 %patch113 -p1 -b .fix-up-endianness-of-higher-hanging-QuickReads.patch
+%patch114 -p1 -b .fdo-39694-SwTxtFld-do-expand-the-field-in-the-ctor.patch
+%patch115 -p1 -b .fdo-42073-sw-expand-all-text-fields-when-setting-pro.patch
 
 # these are horribly incomplete--empty translations and copied english
 # strings with spattering of translated strings
@@ -2455,6 +2459,8 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
 - Resolves: fdo#44816 crash using instances dialog of dataform navigator
 - Resolves: rhbz#798983 Kannada langpack missing
 - Resolves: rhbz#798026 fix endianess assumptions of lotuswordpro filter
+- Resolves: fdo#39694 SwTxtFld: expand new fields to fix race condition
+- Resolves: fdo#42073 sw: expand all text fields when setting properties
 
 * Wed Feb 29 2012 Caolán McNamara <caolanm at redhat.com> - 3.4.5.2-7
 - Resolves: rhbz#788045 swriter --help wouldn't display help


More information about the scm-commits mailing list