Kaydet (Commit) 21747cae authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Caolán McNamara

Resolves: #i122387# Use the right tool box for font color in text sidebar

(cherry picked from commit 08159967)

Conflicts:
	sfx2/inc/sfx2/sidebar/EnumContext.hxx

Change-Id: If40d3dee7c11e4ea6b01d40d713280e1dc19484d

Unname unused argument to prevent compiler warnings.

(cherry picked from commit f68dfc2c)

Change-Id: I6450c6e46d5971abc871ed378d2ad6307e8f7a3e
üst 0143805a
...@@ -129,6 +129,7 @@ public: ...@@ -129,6 +129,7 @@ public:
Application GetApplication_DI (void) const; Application GetApplication_DI (void) const;
const ::rtl::OUString& GetContextName (void) const; const ::rtl::OUString& GetContextName (void) const;
Context GetContext (void) const;
bool operator == (const EnumContext aOther); bool operator == (const EnumContext aOther);
bool operator != (const EnumContext aOther); bool operator != (const EnumContext aOther);
......
...@@ -136,6 +136,14 @@ const ::rtl::OUString& EnumContext::GetContextName (void) const ...@@ -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) bool EnumContext::operator== (const EnumContext aOther)
{ {
return meApplication==aOther.meApplication return meApplication==aOther.meApplication
......
...@@ -147,9 +147,12 @@ TextPropertyPanel::TextPropertyPanel ( ...@@ -147,9 +147,12 @@ TextPropertyPanel::TextPropertyPanel (
mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)), mpToolBoxFontColorBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxFontColor(ControlFactory::CreateToolBox( mpToolBoxFontColor(ControlFactory::CreateToolBox(
mpToolBoxFontColorBackground.get(), mpToolBoxFontColorBackground.get(),
rContext.GetApplication_DI() == sfx2::sidebar::EnumContext::Application_WriterVariants SVX_RES(TB_FONTCOLOR),
? SVX_RES(TB_FONTCOLOR_SW) rxFrame)),
: SVX_RES(TB_FONTCOLOR), mpToolBoxFontColorBackgroundSW(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxFontColorSW(ControlFactory::CreateToolBox(
mpToolBoxFontColorBackgroundSW.get(),
SVX_RES(TB_FONTCOLOR_SW),
rxFrame)), rxFrame)),
mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)), mpToolBoxHighlightBackground(ControlFactory::CreateToolBoxBackground(this)),
mpToolBoxHighlight(ControlFactory::CreateToolBox( mpToolBoxHighlight(ControlFactory::CreateToolBox(
...@@ -186,6 +189,8 @@ TextPropertyPanel::TextPropertyPanel ( ...@@ -186,6 +189,8 @@ TextPropertyPanel::TextPropertyPanel (
Initialize(); Initialize();
FreeResource(); FreeResource();
UpdateFontColorToolbox(rContext);
} }
...@@ -200,6 +205,7 @@ TextPropertyPanel::~TextPropertyPanel (void) ...@@ -200,6 +205,7 @@ TextPropertyPanel::~TextPropertyPanel (void)
mpToolBoxIncDec.reset(); mpToolBoxIncDec.reset();
mpToolBoxFont.reset(); mpToolBoxFont.reset();
mpToolBoxFontColor.reset(); mpToolBoxFontColor.reset();
mpToolBoxFontColorSW.reset();
mpToolBoxScript.reset(); mpToolBoxScript.reset();
mpToolBoxScriptSw.reset(); mpToolBoxScriptSw.reset();
mpToolBoxSpacing.reset(); mpToolBoxSpacing.reset();
...@@ -209,6 +215,7 @@ TextPropertyPanel::~TextPropertyPanel (void) ...@@ -209,6 +215,7 @@ TextPropertyPanel::~TextPropertyPanel (void)
mpToolBoxIncDecBackground.reset(); mpToolBoxIncDecBackground.reset();
mpToolBoxFontBackground.reset(); mpToolBoxFontBackground.reset();
mpToolBoxFontColorBackground.reset(); mpToolBoxFontColorBackground.reset();
mpToolBoxFontColorBackgroundSW.reset();
mpToolBoxScriptBackground.reset(); mpToolBoxScriptBackground.reset();
mpToolBoxScriptSwBackground.reset(); mpToolBoxScriptSwBackground.reset();
mpToolBoxSpacingBackground.reset(); mpToolBoxSpacingBackground.reset();
...@@ -284,6 +291,30 @@ void TextPropertyPanel::HandleContextChange ( ...@@ -284,6 +291,30 @@ void TextPropertyPanel::HandleContextChange (
default: default:
break; 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();
}
} }
......
...@@ -97,6 +97,8 @@ private: ...@@ -97,6 +97,8 @@ private:
::boost::scoped_ptr<ToolBox> mpToolBoxSpacing; ::boost::scoped_ptr<ToolBox> mpToolBoxSpacing;
::boost::scoped_ptr<Window> mpToolBoxFontColorBackground; ::boost::scoped_ptr<Window> mpToolBoxFontColorBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxFontColor; ::boost::scoped_ptr<ToolBox> mpToolBoxFontColor;
::boost::scoped_ptr<Window> mpToolBoxFontColorBackgroundSW;
::boost::scoped_ptr<ToolBox> mpToolBoxFontColorSW;
::boost::scoped_ptr<Window> mpToolBoxHighlightBackground; ::boost::scoped_ptr<Window> mpToolBoxHighlightBackground;
::boost::scoped_ptr<ToolBox> mpToolBoxHighlight; ::boost::scoped_ptr<ToolBox> mpToolBoxHighlight;
::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater; ::boost::scoped_ptr<ToolboxButtonColorUpdater> mpFontColorUpdater;
...@@ -173,6 +175,13 @@ private: ...@@ -173,6 +175,13 @@ private:
DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *); DECL_LINK(ToolBoxScriptSelectHdl, ToolBox *);
void UpdateItem (const sal_uInt16 nSlotId); 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 } } // end of namespace ::svx::sidebar
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment