Kaydet (Commit) d3fdd9f1 authored tarafından Brian Fraser's avatar Brian Fraser Kaydeden (comit) Jim Raykowski

tdf#123534 Impress collapse/expand animation maintains selection

- Expandened a selected bulleted list's animations now
  selects children (maintaining the selection behaviour).
- Collapsing a bulleted list's animation no longer
  clears the current selections
- Deselecting animations now refreshed the UI correctly

Change-Id: I3a3ca0eb0efe841784d96d5dc8e1b760dea4f777
Reviewed-on: https://gerrit.libreoffice.org/67947
Tested-by: Jenkins
Reviewed-by: 's avatarJim Raykowski <raykowj@gmail.com>
üst 50a73ae6
......@@ -1108,6 +1108,7 @@ void CustomAnimationList::onSelectionChanged(const Any& rSelection)
}
}
// Notify controller to refresh UI when we are notified of selection change from base class
void CustomAnimationList::SelectHdl()
{
if( mbIgnorePaint )
......@@ -1116,6 +1117,72 @@ void CustomAnimationList::SelectHdl()
mpController->onSelect();
}
// Notify controller to refresh UI when we are notified of selection change from base class
void CustomAnimationList::DeselectHdl()
{
if( mbIgnorePaint )
return;
SvTreeListBox::DeselectHdl();
mpController->onSelect();
}
bool CustomAnimationList::Expand( SvTreeListEntry* pParent )
{
bool result = SvTreeListBox::Expand( pParent );
// If expanded entry is selected, then select its children too.
if( IsSelected( pParent )) {
for( auto pChild = FirstChild( pParent ); pChild; pChild = pChild->NextSibling() )
{
if( !IsSelected( pChild ) )
{
SelectListEntry( pChild, true );
}
}
}
// Notify controller that selection has changed (it should update the UI)
mpController->onSelect();
return result;
}
bool CustomAnimationList::Collapse( SvTreeListEntry* pParent )
{
// SvTreeListBox::Collapse(..) discards multi-selection state
// of list entries, so first save current selection state
std::vector< SvTreeListEntry* > selectedEntries;
for( auto pEntry = FirstSelected(); pEntry; pEntry = NextSelected( pEntry ))
{
selectedEntries.push_back( pEntry );
}
// Execute collapse on base class
bool result = SvTreeListBox::Collapse( pParent );
// Deselect all entries as SvTreeListBox::Collapse selects the last
// entry to have focus (or its parent), which is not desired
for( auto pEntry = FirstSelected(); pEntry; pEntry = NextSelected( pEntry ))
{
SelectListEntry( pEntry, false );
}
// Restore selection state for entries which are still visible
for( auto &pEntry : selectedEntries )
{
if( IsEntryVisible( pEntry ))
{
SelectListEntry( pEntry, true );
}
}
// Notify controller that selection has changed (it should update the UI)
mpController->onSelect();
return result;
}
bool CustomAnimationList::isExpanded( const CustomAnimationEffectPtr& pEffect ) const
{
CustomAnimationListEntry* pEntry = static_cast<CustomAnimationListEntry*>(First());
......
......@@ -72,6 +72,7 @@ public:
// overrides
virtual void SelectHdl() override;
virtual void DeselectHdl() override;
virtual bool DoubleClickHdl() override;
virtual void Paint( vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect ) override;
......@@ -83,6 +84,8 @@ public:
virtual void notify_change() override;
virtual bool Expand( SvTreeListEntry* pParent ) override;
virtual bool Collapse( SvTreeListEntry* pParent ) override;
bool isExpanded( const CustomAnimationEffectPtr& pEffect ) const;
bool isVisible( const CustomAnimationEffectPtr& pEffect ) const;
......
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