[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - sw/inc sw/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Mar 5 05:49:43 PST 2012


 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 ++-
 sw/source/core/unocore/unofield.cxx |    5 ++---
 5 files changed, 13 insertions(+), 8 deletions(-)

New commits:
commit be999f1bc692a122e36add37f23312edad8f81d2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 2 21:32:27 2012 +0100

    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.
    (cherry picked from commit e3dfae0741aae8581cd3fc713ba1b4459bb22d88)
    
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 6b0ddc7..77134ec 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1911,9 +1911,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();
         }
commit 81828ab68a37715505b19988cdb4508ee0477c68
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Mar 2 19:02:03 2012 +0100

    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)
    (cherry picked from commit 9519deda120b73b72e75d89c3b2ae3d66220ec2d)
    
    Signed-off-by: Miklos Vajna <vmiklos at suse.cz>

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 31c289c..9e4d6f0 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 4789c5f..dbf4d82 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -284,9 +284,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 d17cb7f..b11682b 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:
         {


More information about the Libreoffice-commits mailing list