Kaydet (Commit) b5c1f352 authored tarafından Michael Stahl's avatar Michael Stahl

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 329742e6)
üst 884da2ff
......@@ -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
......
......@@ -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())
{
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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment