summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorBrian Fraser <andthebrain@softfrog.ca>2019-02-17 22:55:57 -0800
committerJim Raykowski <raykowj@gmail.com>2019-02-21 19:59:46 +0100
commitd3fdd9f12ba698008515bfdc47c5f96318406d7f (patch)
tree33fc528b1e7a2a446e13726adcad12285ec03776 /sd
parent50a73ae6ea3dca335df98b217982d8fe4d0d7a6c (diff)
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: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/animations/CustomAnimationList.cxx67
-rw-r--r--sd/source/ui/animations/CustomAnimationList.hxx3
2 files changed, 70 insertions, 0 deletions
diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx
index 7e3107b80baa..d3f88d483f1d 100644
--- a/sd/source/ui/animations/CustomAnimationList.cxx
+++ b/sd/source/ui/animations/CustomAnimationList.cxx
@@ -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());
diff --git a/sd/source/ui/animations/CustomAnimationList.hxx b/sd/source/ui/animations/CustomAnimationList.hxx
index 8e322f885db1..25976bc0e437 100644
--- a/sd/source/ui/animations/CustomAnimationList.hxx
+++ b/sd/source/ui/animations/CustomAnimationList.hxx
@@ -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;