[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - 7 commits - sfx2/source svx/source sw/source

Michael Stahl mstahl at redhat.com
Mon Nov 24 12:21:45 PST 2014


 sfx2/source/dialog/tabdlg.cxx          |    3 +-
 sfx2/source/sidebar/ControllerItem.cxx |    4 +++
 svx/source/items/customshapeitem.cxx   |   31 ++++++++++++++++++++++++++++-
 sw/source/ui/chrdlg/pardlg.cxx         |    2 +
 sw/source/uibase/app/swdll.cxx         |   11 ++++++++++
 sw/source/uibase/app/swmodule.cxx      |   10 ---------
 sw/source/uibase/inc/conttree.hxx      |   10 ++++++++-
 sw/source/uibase/utlui/content.cxx     |   35 +++++++++++++++++++++++++++++++--
 8 files changed, 91 insertions(+), 15 deletions(-)

New commits:
commit 39d853f29dc6787d74921ee9caaaa111e6afef19
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 24 17:53:08 2014 +0100

    sfx2: add missing locks to FrameActionListener
    
    Change-Id: I67db5c42d1aea39cbf650de7854be853fc78e8a9
    (cherry picked from commit 4950c30e633ac2d1a12a9e4b086478ac7d4f790c)

diff --git a/sfx2/source/sidebar/ControllerItem.cxx b/sfx2/source/sidebar/ControllerItem.cxx
index a0de0e3..b2cdc72 100644
--- a/sfx2/source/sidebar/ControllerItem.cxx
+++ b/sfx2/source/sidebar/ControllerItem.cxx
@@ -62,6 +62,7 @@ namespace
         }
         virtual void SAL_CALL disposing (void) SAL_OVERRIDE
         {
+            SolarMutexGuard g;
             if (mxFrame.is())
                 mxFrame->removeFrameActionListener(this);
         }
@@ -69,12 +70,15 @@ namespace
             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
         {
             (void)rEvent;
+
+            SolarMutexGuard g;
             mrControllerItem.ResetFrame();
             mxFrame = NULL;
         }
         virtual void SAL_CALL frameAction (const css::frame::FrameActionEvent& rEvent)
             throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE
         {
+            SolarMutexGuard g;
             if (rEvent.Action == frame::FrameAction_CONTEXT_CHANGED)
                 mrControllerItem.NotifyFrameContextChange();
         }
commit f509e2ec91b138114c43134dd2df3e0b99adcc31
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Nov 24 17:40:26 2014 +0100

    fdo#86633: sw: remove bad tab pages from SwParaDlg for drawing objects
    
    "Area" and "Transparence" only supported by Writer paragraphs.
    
    (regression from 7d9bb549d498d6beed2c4050c402d09643febdfa)
    
    Change-Id: I732e8d40fdeafaebf219fc7c5ddd53b850d8eca6
    (cherry picked from commit 5c31a1b5474f5284cf694d04de5734921891915c)

diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 1481fbd..d533f35 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -551,7 +551,8 @@ void SfxTabDialog::SetApplyHandler(const Link& _rHdl)
 
 void SfxTabDialog::Start_Impl()
 {
-    DBG_ASSERT( pImpl->aData.size() == m_pTabCtrl->GetPageCount(), "not all pages registered" );
+    assert(pImpl->aData.size() == m_pTabCtrl->GetPageCount()
+            && "not all pages registered");
     sal_uInt16 nActPage = m_pTabCtrl->GetPageId( 0 );
 
     // load old settings, when exists
diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx
index 58b4a43..3b007ca 100644
--- a/sw/source/ui/chrdlg/pardlg.cxx
+++ b/sw/source/ui/chrdlg/pardlg.cxx
@@ -129,6 +129,8 @@ SwParaDlg::SwParaDlg(vcl::Window *pParent,
         RemoveTabPage("labelTP_DROPCAPS");
         RemoveTabPage("labelTP_BACKGROUND");
         RemoveTabPage("labelTP_BORDER");
+        RemoveTabPage("area");
+        RemoveTabPage("transparence");
     }
     else
     {
commit b0f40d0252f94f01965035313f0f91bf2a3775e6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Nov 23 18:10:35 2014 +0100

    loplugin:literaltoboolconversion
    
    Change-Id: Ibecd561c1d27e129ad1f481bdb7f8a7bb4d0f8d8
    (cherry picked from commit 40833b49ebdef2e5ab9ece33fc558fd0929f4e8d)

diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
index cb6e1fa..d543fea 100644
--- a/svx/source/items/customshapeitem.cxx
+++ b/svx/source/items/customshapeitem.cxx
@@ -336,7 +336,7 @@ bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMe
             {
                 if (aPropSeq[i].Name == aPropSeq[j].Name)
                 {
-                    assert(0); // serious bug: duplicate xml attribute exported
+                    assert(false); // serious bug: duplicate xml attribute exported
                     OUString const name(aPropSeq[i].Name);
                     aPropSeq.realloc(0);
                     throw uno::RuntimeException(
commit 6d923577482be0cc629ca5de42b8c14e2af1b195
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Nov 22 00:21:19 2014 +0100

    svx: punish evil-doers who put duplicate properties into custom shapes
    
    LO 4.3.2.2 is evidently able to export an ODF document that violates
    XML Well-formedness constraint: Unique Att Spec.
    
    <draw:enhanced-geometry
     draw:mirror-horizontal="false"
     draw:mirror-vertical="false"
     svg:viewBox="0 0 21679 2134682997"
     draw:text-areas="0 0 ?f3 ?f2"
     draw:mirror-vertical="true"
     draw:type="ooxml-rect"
     draw:enhanced-path="M 0 0 L ?f3 0 ?f3 ?f2 0 ?f2 Z N">
    
    Not sure how to reproduce this, but the attributes there are apparently a
    serialization of SdrCustomShapeGeometryItem's aPropSeq,
    retrieved from a "CustomShapeGeometry" property, so add some input
    validation and assertions there.
    
    Change-Id: I91151365b507779a4bdc9cce2057d34f2376f005
    (cherry picked from commit 7fcbb29db802acd8c0f32e8ff578ef4b2f82c46b)

diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
index eae790d..cb6e1fa 100644
--- a/svx/source/items/customshapeitem.cxx
+++ b/svx/source/items/customshapeitem.cxx
@@ -46,7 +46,14 @@ SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( const uno::Sequence< bea
     for ( i = 0; i < aPropSeq.getLength(); i++ )
     {
         beans::PropertyValue& rPropVal = aPropSeq[ i ];
-        aPropHashMap[ rPropVal.Name ] = i;
+        std::pair<PropertyHashMap::iterator, bool> const ret(
+                aPropHashMap.insert(std::make_pair(rPropVal.Name, i)));
+        assert(ret.second); // serious bug: duplicate xml attribute exported
+        if (!ret.second)
+        {
+            throw uno::RuntimeException(
+                "CustomShapeGeometry has duplicate property " + rPropVal.Name);
+        }
         if ( rPropVal.Value.getValueType() == ::getCppuType((const ::com::sun::star::uno::Sequence < beans::PropertyValue >*)0) )
         {
             uno::Sequence< beans::PropertyValue >& rPropSeq = *( uno::Sequence< beans::PropertyValue >*)rPropVal.Value.getValue();
@@ -148,6 +155,9 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const com::sun::star::beans::
     }
     else
     {   // it's a new property
+        assert(aPropSeq.end() == std::find_if(aPropSeq.begin(), aPropSeq.end(),
+            [&rPropVal](beans::PropertyValue const& rVal)
+                { return rVal.Name == rPropVal.Name; } ));
         sal_uInt32 nIndex = aPropSeq.getLength();
         aPropSeq.realloc( nIndex + 1 );
         aPropSeq[ nIndex ] = rPropVal ;
@@ -171,6 +181,9 @@ void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName
             aValue.Name = rSequenceName;
             aValue.Value = ::com::sun::star::uno::makeAny( aSeq );
 
+            assert(aPropSeq.end() == std::find_if(aPropSeq.begin(), aPropSeq.end(),
+                [&rSequenceName](beans::PropertyValue const& rV)
+                    { return rV.Name == rSequenceName; } ));
             sal_uInt32 nIndex = aPropSeq.getLength();
             aPropSeq.realloc( nIndex + 1 );
             aPropSeq[ nIndex ] = aValue;
@@ -316,7 +329,23 @@ bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMe
     if ( ! ( rVal >>= aPropSeq ) )
         return false;
     else
+    {
+        for (sal_Int32 i = 0; i < aPropSeq.getLength(); ++i)
+        {
+            for (sal_Int32 j = i+1; j < aPropSeq.getLength(); ++j)
+            {
+                if (aPropSeq[i].Name == aPropSeq[j].Name)
+                {
+                    assert(0); // serious bug: duplicate xml attribute exported
+                    OUString const name(aPropSeq[i].Name);
+                    aPropSeq.realloc(0);
+                    throw uno::RuntimeException(
+                        "CustomShapeGeometry has duplicate property " + name);
+                }
+            }
+        }
         return true;
+    }
 }
 
 SdrCustomShapeReplacementURLItem::SdrCustomShapeReplacementURLItem()
commit 0b47dcdce3642e550cdf309b9d46431233cee41b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Nov 21 22:38:02 2014 +0100

    fdo#86494: sw: fix crash on exit from SwAutoCorrect
    
    5bff4b016c4b44f4123e0e6a4fd4c0c4dc0cfa2d was not enough to fix it,
    so move it to SwDLL so it gets deleted earlier, before the global
    pool items.
    
    (regression from 4404b718bdb547cb9b7b17c73a53574724cdeeb7)
    
    Change-Id: I4f88047852ea71f07ffa1f272ea66743f9797327
    (cherry picked from commit d47b674951aedd03815a3f27591b1791f7dfb52d)

diff --git a/sw/source/uibase/app/swdll.cxx b/sw/source/uibase/app/swdll.cxx
index cb6d19e..1e598ef 100644
--- a/sw/source/uibase/app/swdll.cxx
+++ b/sw/source/uibase/app/swdll.cxx
@@ -41,7 +41,9 @@
 #include <svx/fmobjfac.hxx>
 #include <svx/svdfield.hxx>
 #include <svx/objfac3d.hxx>
+#include <editeng/acorrcfg.hxx>
 
+#include <swacorr.hxx>
 #include <unomid.h>
 
 #include "swdllimpl.hxx"
@@ -135,10 +137,19 @@ SwDLL::SwDLL()
     // register your controllers here
     RegisterControls();
 #endif
+
+    // replace SvxAutocorrect with SwAutocorrect
+    SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
+    const SvxAutoCorrect* pOld = rACfg.GetAutoCorrect();
+    rACfg.SetAutoCorrect(new SwAutoCorrect( *pOld ));
 }
 
 SwDLL::~SwDLL()
 {
+    // fdo#86494 SwAutoCorrect must be deleted before _FinitCore
+    SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
+    rACfg.SetAutoCorrect(0); // delete SwAutoCorrect before exit handlers
+
     // Pool has to be deleted before statics are
     SW_MOD()->RemoveAttrPool();
 
diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx
index e3817b1..ce4339a 100644
--- a/sw/source/uibase/app/swmodule.cxx
+++ b/sw/source/uibase/app/swmodule.cxx
@@ -60,7 +60,6 @@
 #include <docsh.hxx>
 #include <swmodule.hxx>
 #include <swevent.hxx>
-#include <swacorr.hxx>
 #include <cmdid.h>
 #include <dobjfac.hxx>
 #include <init.hxx>
@@ -118,7 +117,6 @@
 #include <svx/rubydialog.hxx>
 #include <svtools/colorcfg.hxx>
 
-#include <editeng/acorrcfg.hxx>
 #include <unotools/moduleoptions.hxx>
 
 #include <avmedia/mediaplayer.hxx>
@@ -192,11 +190,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact,
 
     pAuthorNames = new std::vector<OUString>;  // All Redlining-Authors
 
-    // replace SvxAutocorrect with SwAutocorrect
-    SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
-    const SvxAutoCorrect* pOld = rACfg.GetAutoCorrect();
-    rACfg.SetAutoCorrect(new SwAutoCorrect( *pOld ));
-
     StartListening( *SfxGetpApp() );
 
     // OD 14.02.2003 #107424# - init color configuration
@@ -227,9 +220,6 @@ SwModule::~SwModule()
 {
     delete pErrorHdl;
     EndListening( *SfxGetpApp() );
-
-    SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get();
-    rACfg.SetAutoCorrect(0); // delete SwAutCorrect before exit handlers
 }
 
 void SwModule::CreateLngSvcEvtListener()
commit 911b5cf0956bfad320bceee8b2942672a1cbd964
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 24 09:21:42 2014 +0000

    coverity#1255910 Uninitialized scalar field
    
    Change-Id: Ifa4fb557ce4fc5ffc816b963df84e30fe6ef43c8
    (cherry picked from commit 74279d773e28fdf3479502258ac64a1a06c3d3a1)

diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index cac96ed..ef1fd2e 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -822,6 +822,7 @@ SwContentTree::SwContentTree(vcl::Window* pParent, const ResId& rResId) :
         bIsOutlineMoveable(true),
         bViewHasChanged(false),
         bIsImageListInitialized(false),
+        m_bActiveDocModified(false),
         bIsKeySpace(false)
 {
     SetHelpId(HID_NAVIGATOR_TREELIST);
commit b5c1f352522c34a744ad0226e73904ce5af81b11
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Nov 21 15:16:20 2014 +0100

    fdo#85886 don't redraw the Navigator content tree if nothing changed
    
    This fixes the flickering of the scrollbar on re-draw once a second.
    Perhaps it helps for the performance issue too.
    
    Change-Id: I2ec8f0a8a241b128113bfa3d47fb09ba472b4a7e
    (cherry picked from commit 329742e6c9da7cd7848d92a6846e3d1249d8d9b4)

diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index e4aa7d9..43d76b3 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -19,6 +19,7 @@
 #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CONTTREE_HXX
 #define INCLUDED_SW_SOURCE_UIBASE_INC_CONTTREE_HXX
 
+#include <svl/lstner.hxx>
 #include <svtools/treelistbox.hxx>
 #include <svtools/svlbitm.hxx>
 #include "swcont.hxx"
@@ -43,7 +44,9 @@ class SdrObject;
 #define EDIT_MODE_DELETE        4
 #define EDIT_MODE_RENAME        5
 
-class SwContentTree : public SvTreeListBox
+class SwContentTree
+    : public SvTreeListBox
+    , public SfxListener
 {
     ImageList           aEntryImages;
     OUString            sSpace;
@@ -85,6 +88,7 @@ class SwContentTree : public SvTreeListBox
     bool                bIsOutlineMoveable  :1;
     bool                bViewHasChanged     :1;
     bool                bIsImageListInitialized : 1;
+    bool                m_bActiveDocModified :1;
 
     static bool         bIsInDrag;
 
@@ -196,6 +200,10 @@ public:
 
     virtual bool    Select( SvTreeListEntry* pEntry, bool bSelect=true ) SAL_OVERRIDE;
     virtual sal_Int32  GetEntryRealChildrenNum( SvTreeListEntry* pEntry ) const;
+
+    using Control::Notify; // FIXME why do we have 2 of these
+    virtual void Notify(SfxBroadcaster& rBC, SfxHint const& rHint) SAL_OVERRIDE;
+
 };
 
 // TreeListBox for global documents
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx
index bd75cde..cac96ed 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -1756,6 +1756,7 @@ void SwContentTree::Display( bool bActive )
         ScrollOutputArea( (short)nDelta );
     }
 
+    m_bActiveDocModified = false;
 }
 
 // In the Clear the content types have to be deleted, also.
@@ -2208,6 +2209,8 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
     bool bClear = pActiveShell != pSh;
     if(bIsActive && bClear)
     {
+        if (pActiveShell)
+            EndListening(*pActiveShell->GetView().GetDocShell());
         pActiveShell = pSh;
         FindActiveTypeAndRemoveUserData();
         Clear();
@@ -2216,6 +2219,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
     {
         if(!lcl_FindShell(pActiveShell))
         {
+            EndListening(*pActiveShell->GetView().GetDocShell());
             pActiveShell = pSh;
             bIsActive = true;
             bIsConstant = false;
@@ -2226,6 +2230,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
     // the screen filled new.
     if(bIsActive && bClear)
     {
+        StartListening(*pActiveShell->GetView().GetDocShell());
         FindActiveTypeAndRemoveUserData();
         for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
         {
@@ -2239,9 +2244,12 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
 
 void SwContentTree::SetConstantShell(SwWrtShell* pSh)
 {
+    if (pActiveShell)
+        EndListening(*pActiveShell->GetView().GetDocShell());
     pActiveShell = pSh;
     bIsActive       = false;
     bIsConstant     = true;
+    StartListening(*pActiveShell->GetView().GetDocShell());
     FindActiveTypeAndRemoveUserData();
     for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
     {
@@ -2250,6 +2258,21 @@ void SwContentTree::SetConstantShell(SwWrtShell* pSh)
     Display(true);
 }
 
+
+
+void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
+{
+    SfxSimpleHint const*const pHint(dynamic_cast<SfxSimpleHint const*>(&rHint));
+    if (pHint && SFX_HINT_DOCCHANGED == pHint->GetId())
+    {
+        m_bActiveDocModified = true;
+    }
+    else
+    {
+        SfxListener::Notify(rBC, rHint);
+    }
+}
+
 // Execute commands of the Navigator
 
 void SwContentTree::ExecCommand(sal_uInt16 nCmd, bool bModifier)
@@ -2436,18 +2459,25 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate)
         }
 
         if(bIsActive && pActShell != GetWrtShell())
+        {
             SetActiveShell(pActShell);
+        }
         else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) &&
                     HasContentChanged())
         {
-            FindActiveTypeAndRemoveUserData();
-            Display(true);
+            if (!bIsActive || m_bActiveDocModified)
+            {   // don't burn cpu and redraw and flicker if not modified
+                FindActiveTypeAndRemoveUserData();
+                Display(true);
+            }
         }
     }
     else if(!pView && bIsActive && !bIsIdleClear)
     {
         if(pActiveShell)
+        {
             SetActiveShell(0);
+        }
         Clear();
         bIsIdleClear = true;
     }


More information about the Libreoffice-commits mailing list