[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Katarina Behrens
Katarina.Behrens at cib.de
Thu Mar 24 10:56:11 UTC 2016
include/sfx2/sidebar/ContextList.hxx | 1 +
sfx2/source/sidebar/ContextList.cxx | 20 ++++++++++++++++++++
sfx2/source/sidebar/ResourceManager.cxx | 9 ++++-----
sfx2/source/sidebar/TabBar.cxx | 10 ++++++++++
4 files changed, 35 insertions(+), 5 deletions(-)
New commits:
commit 1a045a9df7918adf4c0d8a62db3331f120266c6e
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date: Tue Mar 22 16:32:47 2016 +0100
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 at libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
diff --git a/include/sfx2/sidebar/ContextList.hxx b/include/sfx2/sidebar/ContextList.hxx
index 9c56d15..8e9c1ce 100644
--- a/include/sfx2/sidebar/ContextList.hxx
+++ b/include/sfx2/sidebar/ContextList.hxx
@@ -55,6 +55,7 @@ public:
const bool bIsInitiallyVisible,
const ::rtl::OUString& rsMenuCommand);
+ void ToggleVisibilityForContext( const Context& rContext,const bool bIsInitiallyVisible );
const ::std::vector<Entry>& GetEntries() const {return maEntries;};
private:
diff --git a/sfx2/source/sidebar/ContextList.cxx b/sfx2/source/sidebar/ContextList.cxx
index 6b95196..f515dcf 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 1389c53..b2f9d17 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 0c99317..ef6e185 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();
}
}
More information about the Libreoffice-commits
mailing list