summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Fischer <af@apache.org>2013-05-27 12:55:37 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-28 17:03:22 +0100
commit21747cae6ad12ec6566e6dd9a06f3c268c72404d (patch)
treed63b58f437d38e73e6e48ccee58a8494157fc9f8
parent0143805a565418d2a114c16b7eeba3b784176d9e (diff)
Resolves: #i122387# Use the right tool box for font color in text sidebar
(cherry picked from commit 08159967126946849906827ceadd802053d132c0) Conflicts: sfx2/inc/sfx2/sidebar/EnumContext.hxx Change-Id: If40d3dee7c11e4ea6b01d40d713280e1dc19484d Unname unused argument to prevent compiler warnings. (cherry picked from commit f68dfc2cc8754d9cf72ae1b09f119e683ad44124) Change-Id: I6450c6e46d5971abc871ed378d2ad6307e8f7a3e
-rw-r--r--include/sfx2/sidebar/EnumContext.hxx1
-rw-r--r--sfx2/source/sidebar/EnumContext.cxx8
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.cxx37
-rw-r--r--svx/source/sidebar/text/TextPropertyPanel.hxx9
4 files changed, 52 insertions, 3 deletions
diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx
index f45ecd9b27d8..b24a8b274acb 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/sfx2/sidebar/EnumContext.hxx
@@ -129,6 +129,7 @@ public:
Application GetApplication_DI (void) const;
const ::rtl::OUString& GetContextName (void) const;
+ Context GetContext (void) const;
bool operator == (const EnumContext aOther);
bool operator != (const EnumContext aOther);
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx
index d78d8cfbedda..48a974e206e0 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -136,6 +136,14 @@ const ::rtl::OUString& EnumContext::GetContextName (void) const
+EnumContext::Context EnumContext::GetContext (void) const
+{
+ return meContext;
+}
+
+
+
+
bool EnumContext::operator== (const EnumContext aOther)
{
return meApplication==aOther.meApplication
diff --git a/svx/source/sidebar/text/TextPropertyPanel.cxx b/svx/source/sidebar/text/TextPropertyPanel.cxx
index 6547db69fe23..258a730ac6dc 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.cxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.cxx
@@ -147,9 +147,12 @@ TextPropertyPanel::TextPropertyPanel (
mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxFontColor(ControlFactory::CreateToolBox(
mpToolBoxFontColorBackground.get(),
- rContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants
- ? SVX_RES(TB_FONTCOLOR_SW)
- : SVX_RES(TB_FONTCOLOR),
+ SVX_RES(TB_FONTCOLOR),
+ rxFrame)),
+ mpToolBoxFontColorBackgroundSW(ControlFactory::CreateToolBoxBackground(this)),
+ mpToolBoxFontColorSW(ControlFactory::CreateToolBox(
+ mpToolBoxFontColorBackgroundSW.get(),
+ SVX_RES(TB_FONTCOLOR_SW),
rxFrame)),
mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxHighlight(ControlFactory::CreateToolBox(
@@ -186,6 +189,8 @@ TextPropertyPanel::TextPropertyPanel (
Initialize();
FreeResource();
+
+ UpdateFontColorToolbox(rContext);
}
@@ -200,6 +205,7 @@ TextPropertyPanel::~TextPropertyPanel (void)
mpToolBoxIncDec.reset();
mpToolBoxFont.reset();
mpToolBoxFontColor.reset();
+ mpToolBoxFontColorSW.reset();
mpToolBoxScript.reset();
mpToolBoxScriptSw.reset();
mpToolBoxSpacing.reset();
@@ -209,6 +215,7 @@ TextPropertyPanel::~TextPropertyPanel (void)
mpToolBoxIncDecBackground.reset();
mpToolBoxFontBackground.reset();
mpToolBoxFontColorBackground.reset();
+ mpToolBoxFontColorBackgroundSW.reset();
mpToolBoxScriptBackground.reset();
mpToolBoxScriptSwBackground.reset();
mpToolBoxSpacingBackground.reset();
@@ -284,6 +291,30 @@ void TextPropertyPanel::HandleContextChange (
default:
break;
}
+
+ UpdateFontColorToolbox(aContext);
+}
+
+
+
+
+void TextPropertyPanel::UpdateFontColorToolbox (
+ const ::sfx2::sidebar::EnumContext /* aContext */)
+{
+ bool bIsWriterFontColor (false);
+ if (maContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants)
+ if (maContext.GetContext() != sfx2::sidebar::EnumContext::Context_DrawText)
+ bIsWriterFontColor = true;
+ if (bIsWriterFontColor)
+ {
+ mpToolBoxFontColor->Hide();
+ mpToolBoxFontColorSW->Show();
+ }
+ else
+ {
+ mpToolBoxFontColor->Show();
+ mpToolBoxFontColorSW->Hide();
+ }
}
diff --git a/svx/source/sidebar/text/TextPropertyPanel.hxx b/svx/source/sidebar/text/TextPropertyPanel.hxx
index a7cc0ddb21ce..7f2f641f3ccb 100644
--- a/svx/source/sidebar/text/TextPropertyPanel.hxx
+++ b/svx/source/sidebar/text/TextPropertyPanel.hxx
@@ -97,6 +97,8 @@ private:
::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
+ ::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW;
+ ::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW;
::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
@@ -173,6 +175,13 @@ private:
DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
void UpdateItem (const sal_uInt16 nSlotId);
+
+ /** Depending on the given context make one of the toolboxes
+ mpToolBoxFontColor and mpToolBoxFontColorSW visible. Both
+ occupy the same space.
+ */
+ void UpdateFontColorToolbox (
+ const ::sfx2::sidebar::EnumContext aContext);
};
} } // end of namespace ::svx::sidebar