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 @@ ...@@ -19,6 +19,7 @@
#ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CONTTREE_HXX #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_CONTTREE_HXX
#define 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/treelistbox.hxx>
#include <svtools/svlbitm.hxx> #include <svtools/svlbitm.hxx>
#include "swcont.hxx" #include "swcont.hxx"
...@@ -43,7 +44,9 @@ class SdrObject; ...@@ -43,7 +44,9 @@ class SdrObject;
#define EDIT_MODE_DELETE 4 #define EDIT_MODE_DELETE 4
#define EDIT_MODE_RENAME 5 #define EDIT_MODE_RENAME 5
class SwContentTree : public SvTreeListBox class SwContentTree
: public SvTreeListBox
, public SfxListener
{ {
ImageList aEntryImages; ImageList aEntryImages;
OUString sSpace; OUString sSpace;
...@@ -85,6 +88,7 @@ class SwContentTree : public SvTreeListBox ...@@ -85,6 +88,7 @@ class SwContentTree : public SvTreeListBox
bool bIsOutlineMoveable :1; bool bIsOutlineMoveable :1;
bool bViewHasChanged :1; bool bViewHasChanged :1;
bool bIsImageListInitialized : 1; bool bIsImageListInitialized : 1;
bool m_bActiveDocModified :1;
static bool bIsInDrag; static bool bIsInDrag;
...@@ -196,6 +200,10 @@ public: ...@@ -196,6 +200,10 @@ public:
virtual bool Select( SvTreeListEntry* pEntry, bool bSelect=true ) SAL_OVERRIDE; virtual bool Select( SvTreeListEntry* pEntry, bool bSelect=true ) SAL_OVERRIDE;
virtual sal_Int32 GetEntryRealChildrenNum( SvTreeListEntry* pEntry ) const; 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 // TreeListBox for global documents
......
...@@ -1756,6 +1756,7 @@ void SwContentTree::Display( bool bActive ) ...@@ -1756,6 +1756,7 @@ void SwContentTree::Display( bool bActive )
ScrollOutputArea( (short)nDelta ); ScrollOutputArea( (short)nDelta );
} }
m_bActiveDocModified = false;
} }
// In the Clear the content types have to be deleted, also. // In the Clear the content types have to be deleted, also.
...@@ -2208,6 +2209,8 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh) ...@@ -2208,6 +2209,8 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
bool bClear = pActiveShell != pSh; bool bClear = pActiveShell != pSh;
if(bIsActive && bClear) if(bIsActive && bClear)
{ {
if (pActiveShell)
EndListening(*pActiveShell->GetView().GetDocShell());
pActiveShell = pSh; pActiveShell = pSh;
FindActiveTypeAndRemoveUserData(); FindActiveTypeAndRemoveUserData();
Clear(); Clear();
...@@ -2216,6 +2219,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh) ...@@ -2216,6 +2219,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
{ {
if(!lcl_FindShell(pActiveShell)) if(!lcl_FindShell(pActiveShell))
{ {
EndListening(*pActiveShell->GetView().GetDocShell());
pActiveShell = pSh; pActiveShell = pSh;
bIsActive = true; bIsActive = true;
bIsConstant = false; bIsConstant = false;
...@@ -2226,6 +2230,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh) ...@@ -2226,6 +2230,7 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
// the screen filled new. // the screen filled new.
if(bIsActive && bClear) if(bIsActive && bClear)
{ {
StartListening(*pActiveShell->GetView().GetDocShell());
FindActiveTypeAndRemoveUserData(); FindActiveTypeAndRemoveUserData();
for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
{ {
...@@ -2239,9 +2244,12 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh) ...@@ -2239,9 +2244,12 @@ void SwContentTree::SetActiveShell(SwWrtShell* pSh)
void SwContentTree::SetConstantShell(SwWrtShell* pSh) void SwContentTree::SetConstantShell(SwWrtShell* pSh)
{ {
if (pActiveShell)
EndListening(*pActiveShell->GetView().GetDocShell());
pActiveShell = pSh; pActiveShell = pSh;
bIsActive = false; bIsActive = false;
bIsConstant = true; bIsConstant = true;
StartListening(*pActiveShell->GetView().GetDocShell());
FindActiveTypeAndRemoveUserData(); FindActiveTypeAndRemoveUserData();
for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++) for(sal_uInt16 i=0; i < CONTENT_TYPE_MAX; i++)
{ {
...@@ -2250,6 +2258,21 @@ void SwContentTree::SetConstantShell(SwWrtShell* pSh) ...@@ -2250,6 +2258,21 @@ void SwContentTree::SetConstantShell(SwWrtShell* pSh)
Display(true); 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 // Execute commands of the Navigator
void SwContentTree::ExecCommand(sal_uInt16 nCmd, bool bModifier) void SwContentTree::ExecCommand(sal_uInt16 nCmd, bool bModifier)
...@@ -2436,18 +2459,25 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate) ...@@ -2436,18 +2459,25 @@ IMPL_LINK_NOARG(SwContentTree, TimerUpdate)
} }
if(bIsActive && pActShell != GetWrtShell()) if(bIsActive && pActShell != GetWrtShell())
{
SetActiveShell(pActShell); SetActiveShell(pActShell);
}
else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) && else if( (bIsActive || (bIsConstant && pActShell == GetWrtShell())) &&
HasContentChanged()) HasContentChanged())
{ {
FindActiveTypeAndRemoveUserData(); if (!bIsActive || m_bActiveDocModified)
Display(true); { // don't burn cpu and redraw and flicker if not modified
FindActiveTypeAndRemoveUserData();
Display(true);
}
} }
} }
else if(!pView && bIsActive && !bIsIdleClear) else if(!pView && bIsActive && !bIsIdleClear)
{ {
if(pActiveShell) if(pActiveShell)
{
SetActiveShell(0); SetActiveShell(0);
}
Clear(); Clear();
bIsIdleClear = true; 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