summaryrefslogtreecommitdiff
path: root/sfx2/source/sidebar/ResourceManager.cxx
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-04-23 11:33:28 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-05-20 11:33:18 +0100
commit799e382d025e9176624bdfb92e72a9aa783a973c (patch)
treef3b3b1ee82670ff2688b0243b5b212594785e9df /sfx2/source/sidebar/ResourceManager.cxx
parentb99b51a7a36132224cfc50a35d369247255e59c2 (diff)
Related: #i122051# Sidebar handles more Writer variants.
(cherry picked from commit dc36f82362dc1fb159668937cde7cedbc3fad503) Conflicts: sfx2/inc/sfx2/sidebar/EnumContext.hxx Change-Id: I230b6dd3a68d2a17d0433f7919e74f1fcfae8d01
Diffstat (limited to 'sfx2/source/sidebar/ResourceManager.cxx')
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx65
1 files changed, 40 insertions, 25 deletions
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index efb1fa134820..c29ef9ad2f4b 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -401,35 +401,41 @@ void ResourceManager::ReadContextList (
: sMenuCommandOverride)
: rsDefaultMenuCommand);
+ // Setup a list of application enums. Note that the
+ // application name may result in more than one value (eg
+ // DrawImpress will result in two enums, one for Draw and one
+ // for Impress).
+ ::std::vector<EnumContext::Application> aApplications;
EnumContext::Application eApplication (EnumContext::GetApplicationEnum(sApplicationName));
- EnumContext::Application eApplication2 (EnumContext::Application_None);
if (eApplication == EnumContext::Application_None
&& !sApplicationName.equals(EnumContext::GetApplicationName(EnumContext::Application_None)))
{
// Handle some special names: abbreviations that make
// context descriptions more readable.
if (sApplicationName.equalsAscii("Writer"))
- eApplication = EnumContext::Application_Writer;
+ aApplications.push_back(EnumContext::Application_Writer);
else if (sApplicationName.equalsAscii("Calc"))
- eApplication = EnumContext::Application_Calc;
+ aApplications.push_back(EnumContext::Application_Calc);
else if (sApplicationName.equalsAscii("Draw"))
- eApplication = EnumContext::Application_Draw;
+ aApplications.push_back(EnumContext::Application_Draw);
else if (sApplicationName.equalsAscii("Impress"))
- eApplication = EnumContext::Application_Impress;
+ aApplications.push_back(EnumContext::Application_Impress);
else if (sApplicationName.equalsAscii("DrawImpress"))
{
// A special case among the special names: it is
// common to use the same context descriptions for
// both Draw and Impress. This special case helps to
// avoid duplication in the .xcu file.
- eApplication = EnumContext::Application_Draw;
- eApplication2 = EnumContext::Application_Impress;
+ aApplications.push_back(EnumContext::Application_Draw);
+ aApplications.push_back(EnumContext::Application_Impress);
}
- else if (sApplicationName.equalsAscii("WriterAndWeb"))
+ else if (sApplicationName.equalsAscii("WriterVariants"))
{
- // Another special case for Writer and WriterWeb.
- eApplication = EnumContext::Application_Writer;
- eApplication2 = EnumContext::Application_WriterWeb;
+ // Another special case for all Writer variants.
+ aApplications.push_back(EnumContext::Application_Writer);
+ aApplications.push_back(EnumContext::Application_WriterGlobal);
+ aApplications.push_back(EnumContext::Application_WriterWeb);
+ aApplications.push_back(EnumContext::Application_WriterXML);
}
else
{
@@ -437,7 +443,13 @@ void ResourceManager::ReadContextList (
continue;
}
}
+ else
+ {
+ // No conversion of the application name necessary.
+ aApplications.push_back(eApplication);
+ }
+ // Setup the actual context enum.
const EnumContext::Context eContext (EnumContext::GetContextEnum(sContextName));
if (eContext == EnumContext::Context_Unknown)
{
@@ -445,6 +457,8 @@ void ResourceManager::ReadContextList (
continue;
}
+ // Setup the flag that controls whether a deck/pane is
+ // initially visible/expanded.
bool bIsInitiallyVisible;
if (sInitialState.equalsAscii("visible"))
bIsInitiallyVisible = true;
@@ -456,20 +470,21 @@ void ResourceManager::ReadContextList (
continue;
}
- if (eApplication != EnumContext::Application_None)
- rContextList.AddContextDescription(
- Context(
- EnumContext::GetApplicationName(eApplication),
- EnumContext::GetContextName(eContext)),
- bIsInitiallyVisible,
- sMenuCommand);
- if (eApplication2 != EnumContext::Application_None)
- rContextList.AddContextDescription(
- Context(
- EnumContext::GetApplicationName(eApplication2),
- EnumContext::GetContextName(eContext)),
- bIsInitiallyVisible,
- sMenuCommand);
+ // Add context descriptors.
+ for (::std::vector<EnumContext::Application>::const_iterator
+ iApplication(aApplications.begin()),
+ iEnd(aApplications.end());
+ iApplication!=iEnd;
+ ++iApplication)
+ {
+ if (*iApplication != EnumContext::Application_None)
+ rContextList.AddContextDescription(
+ Context(
+ EnumContext::GetApplicationName(*iApplication),
+ EnumContext::GetContextName(eContext)),
+ bIsInitiallyVisible,
+ sMenuCommand);
+ }
}
}