diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-03-22 16:32:47 +0100 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-03-24 10:55:40 +0000 |
commit | 1a045a9df7918adf4c0d8a62db3331f120266c6e (patch) | |
tree | 9baa8ef4c2558aa354cea99dc6bd95a17c2b78a5 /sfx2 | |
parent | 682b9b33c71066bbf703c22e9689367e7bd569b6 (diff) |
tdf#97398: Toggle deck/panel visibility individually for each app
Change in visibility of a shared deck ('any, any, ...') or panel
made in 1 app must not affect its visibility in the remaining apps
Change-Id: I78472ce078409edec796ef649349df4bda62a709
Reviewed-on: https://gerrit.libreoffice.org/23432
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/ContextList.cxx | 20 | ||||
-rw-r--r-- | sfx2/source/sidebar/ResourceManager.cxx | 9 | ||||
-rw-r--r-- | sfx2/source/sidebar/TabBar.cxx | 10 |
3 files changed, 34 insertions, 5 deletions
diff --git a/sfx2/source/sidebar/ContextList.cxx b/sfx2/source/sidebar/ContextList.cxx index 6b9519639f37..f515dcfcb7ab 100644 --- a/sfx2/source/sidebar/ContextList.cxx +++ b/sfx2/source/sidebar/ContextList.cxx @@ -85,6 +85,26 @@ void ContextList::AddContextDescription ( maEntries.back().msMenuCommand = rsMenuCommand; } +void ContextList::ToggleVisibilityForContext( const Context &rContext, const bool bVisible) +{ + ContextList::Entry *pEntry = GetMatch( rContext ); + + if ( pEntry ) + { + const sal_Int32 nMatch( rContext.EvaluateMatch( pEntry->maContext ) ); + + if ( nMatch & Context::ApplicationWildcardMatch ) + { + // Create a separate context list entry for this app if 'any' + // is the only context that matches. Toggling the visibility + // for 'any' would change it for all apps, not just this one + AddContextDescription( rContext, bVisible, OUString() ); + } + else if ( nMatch == Context::OptimalMatch || nMatch == Context::ContextWildcardMatch ) + pEntry->mbIsInitiallyVisible = bVisible; + } +} + } } // end of namespace sfx2::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx index 1389c53a6d80..b2f9d1763f9a 100644 --- a/sfx2/source/sidebar/ResourceManager.cxx +++ b/sfx2/source/sidebar/ResourceManager.cxx @@ -54,7 +54,7 @@ bool getBool(utl::OConfigurationNode const & aNode, const char* pNodeName) return comphelper::getBOOL(aNode.getNodeValue(pNodeName)); } -css::uno::Sequence<OUString> BuildContextList (ContextList rContextList, bool isEnabled) +css::uno::Sequence<OUString> BuildContextList (ContextList rContextList) { const ::std::vector<ContextList::Entry>& entries = rContextList.GetEntries(); @@ -69,7 +69,7 @@ css::uno::Sequence<OUString> BuildContextList (ContextList rContextList, bool is OUString menuCommand = iEntry->msMenuCommand; OUString visibility; - if (isEnabled) + if (iEntry->mbIsInitiallyVisible) visibility = "visible"; else visibility = "hidden"; @@ -323,7 +323,7 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc) // save deck settings - ::uno::Sequence< OUString > sContextList = BuildContextList(pDeckDesc->maContextList, pDeckDesc->mbIsEnabled); + ::uno::Sequence< OUString > sContextList = BuildContextList(pDeckDesc->maContextList); utl::OConfigurationNode aDeckNode (aDeckRootNode.openNode(pDeckDesc->msNodeName)); @@ -353,10 +353,9 @@ void ResourceManager::SaveDeckSettings(const DeckDescriptor* pDeckDesc) { Panel* aPanel = *iPanel; OUString panelId = aPanel->GetId(); - bool isExpanded = aPanel->IsExpanded(); const PanelDescriptor* pPanelDesc = GetPanelDescriptor(panelId); - ::uno::Sequence< OUString > sPanelContextList = BuildContextList(pPanelDesc->maContextList, isExpanded); + ::uno::Sequence< OUString > sPanelContextList = BuildContextList(pPanelDesc->maContextList); utl::OConfigurationNode aPanelNode (aPanelRootNode.openNode(pPanelDesc->msNodeName)); diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx index 0c993175f55d..ef6e18557b29 100644 --- a/sfx2/source/sidebar/TabBar.cxx +++ b/sfx2/source/sidebar/TabBar.cxx @@ -337,8 +337,18 @@ void TabBar::ToggleHideFlag (const sal_Int32 nIndex) DeckDescriptor* pDeckDescriptor = pParentSidebarController->GetResourceManager()->GetDeckDescriptor(maItems[nIndex].msDeckId); if (pDeckDescriptor) + { pDeckDescriptor->mbIsEnabled = ! maItems[nIndex].mbIsHidden; + Context aContext; + aContext.msApplication = pParentSidebarController->GetCurrentContext().msApplication; + // leave aContext.msContext on default 'any' ... this func is used only for decks + // and we don't have context-sensitive decks anyway + + pDeckDescriptor->maContextList.ToggleVisibilityForContext( + aContext, pDeckDescriptor->mbIsEnabled ); + } + Layout(); } } |