Move Theme Colors toolbox ctrl to svx
to make it available in other modules as well Change-Id: I98032532d310afaf5ee9566c8b6a1af21138ee8e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198967 Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> (cherry picked from commit ff10450486e95f6a61bf3a031e09fa39bc57c9dc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199441 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@collabora.com>
This commit is contained in:
@@ -485,6 +485,7 @@ class SvxZoomItem;
|
||||
#define SID_THEME_DIALOG (SID_SFX_START + 815)
|
||||
#define SID_REDACT_IMAGE (SID_SFX_START + 816)
|
||||
#define SID_ADD_THEME (SID_SFX_START + 817)
|
||||
#define SID_APPLY_THEME (SID_SFX_START + 818)
|
||||
|
||||
// default-ids for configuration
|
||||
#define SID_CONFIG TypedWhichId<SfxStringItem>(SID_SFX_START + 904)
|
||||
|
||||
+10
-9
@@ -7,26 +7,27 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <svx/svxdllapi.h>
|
||||
#include <svtools/toolboxcontroller.hxx>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <com/sun/star/frame/XFrame.hpp>
|
||||
#include <vcl/vclptr.hxx>
|
||||
#include <vcl/InterimItemWindow.hxx>
|
||||
#include <svx/dialog/ThemeColorsPaneBase.hxx>
|
||||
|
||||
namespace sd
|
||||
{
|
||||
class ViewShellBase;
|
||||
}
|
||||
|
||||
// Used to put theme colors pane to the notebookbar
|
||||
|
||||
class ThemeColorsPaneWrapper final : public InterimItemWindow, public svx::ThemeColorsPaneBase
|
||||
class SVX_DLLPUBLIC ThemeColorsPaneWrapper final : public InterimItemWindow,
|
||||
public svx::ThemeColorsPaneBase
|
||||
{
|
||||
private:
|
||||
sd::ViewShellBase& mrViewShellBase;
|
||||
css::uno::Reference<css::frame::XFrame> m_xFrame;
|
||||
|
||||
public:
|
||||
ThemeColorsPaneWrapper(vcl::Window* pParent, sd::ViewShellBase& rBase);
|
||||
ThemeColorsPaneWrapper(vcl::Window* pParent,
|
||||
const css::uno::Reference<css::frame::XFrame>& rxFrame);
|
||||
virtual ~ThemeColorsPaneWrapper() override;
|
||||
virtual void dispose() override;
|
||||
void SetOptimalSize();
|
||||
@@ -38,7 +39,7 @@ protected:
|
||||
void onColorSetActivated() override;
|
||||
};
|
||||
|
||||
class ThemeColorsToolBoxControl final
|
||||
class SVX_DLLPUBLIC ThemeColorsToolBoxControl final
|
||||
: public cppu::ImplInheritanceHelper<svt::ToolboxController, css::lang::XServiceInfo>
|
||||
{
|
||||
VclPtr<ThemeColorsPaneWrapper> m_xVclBox;
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include <svx/svxdllapi.h>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/weld/IconView.hxx>
|
||||
#include <vcl/vclptr.hxx>
|
||||
#include <docmodel/theme/ColorSet.hxx>
|
||||
#include <memory>
|
||||
|
||||
@@ -1135,10 +1135,10 @@
|
||||
<value>.uno:ThemeSelectorPanel</value>
|
||||
</prop>
|
||||
<prop oor:name="Module">
|
||||
<value>com.sun.star.presentation.PresentationDocument</value>
|
||||
<value/>
|
||||
</prop>
|
||||
<prop oor:name="Controller">
|
||||
<value>com.sun.star.comp.sd.ThemeColorsToolBoxControl</value>
|
||||
<value>com.sun.star.comp.svx.ThemeColorsToolBoxControl</value>
|
||||
</prop>
|
||||
</node>
|
||||
<node oor:name="BulletsToolBox" oor:op="replace">
|
||||
|
||||
@@ -223,6 +223,7 @@ interface TableEditView
|
||||
|
||||
SID_PRINTPREVIEW [ ExecMethod = Execute; StateMethod = GetState; ]
|
||||
SID_THEME_DIALOG [ ExecMethod = Execute; StateMethod = GetState; ]
|
||||
SID_APPLY_THEME [ ExecMethod = Execute; StateMethod = GetState; ]
|
||||
|
||||
SID_NAVIGATOR_SELECT_COMMENT [ ExecMethod = ExecNavigatorWin; ]
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
|
||||
#include <svx/zoomslideritem.hxx>
|
||||
#include <svx/svxdlg.hxx>
|
||||
#include <svx/ColorSets.hxx>
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <comphelper/string.hxx>
|
||||
#include <com/sun/star/uno/Reference.h>
|
||||
@@ -1586,6 +1587,31 @@ void ScTabViewShell::Execute( SfxRequest& rReq )
|
||||
ExecProtectTable( rReq );
|
||||
break;
|
||||
|
||||
case SID_APPLY_THEME:
|
||||
{
|
||||
const SfxItemSet* pArgs = rReq.GetArgs();
|
||||
if (pArgs)
|
||||
{
|
||||
const SfxPoolItem* pItem;
|
||||
if (pArgs->GetItemState(FN_PARAM_1, true, &pItem) == SfxItemState::SET)
|
||||
{
|
||||
OUString aThemeName = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
||||
auto pColorSet = svx::ColorSets::get().getColorSet(aThemeName);
|
||||
|
||||
if (pColorSet)
|
||||
{
|
||||
// Create shared pointer from raw pointer
|
||||
auto pSharedColorSet = std::shared_ptr<model::ColorSet>(new model::ColorSet(*pColorSet));
|
||||
sc::ThemeColorChanger aChanger(*GetViewData().GetDocShell());
|
||||
aChanger.apply(pSharedColorSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rReq.Done();
|
||||
}
|
||||
break;
|
||||
|
||||
case SID_THEME_DIALOG:
|
||||
{
|
||||
MakeDrawLayer();
|
||||
|
||||
@@ -231,7 +231,6 @@ $(eval $(call gb_Library_add_exception_objects,sd,\
|
||||
sd/source/ui/controller/slidelayoutcontroller \
|
||||
sd/source/ui/controller/displaymodecontroller \
|
||||
sd/source/ui/controller/SlideTransitionsToolBoxControl \
|
||||
sd/source/ui/controller/ThemeColorsToolBoxControl \
|
||||
sd/source/ui/dlg/AnimationChildWindow \
|
||||
sd/source/ui/dlg/LayerTabBar \
|
||||
sd/source/ui/dlg/NavigatorChildWindow \
|
||||
|
||||
@@ -3048,6 +3048,11 @@ interface DrawView
|
||||
ExecMethod = FuTemporary;
|
||||
StateMethod = GetAttrState;
|
||||
]
|
||||
SID_APPLY_THEME
|
||||
[
|
||||
ExecMethod = FuTemporary;
|
||||
StateMethod = GetAttrState;
|
||||
]
|
||||
SID_ALIGN_PAGE
|
||||
[
|
||||
ExecMethod = FuTemporary ;
|
||||
|
||||
@@ -4309,6 +4309,34 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
|
||||
}
|
||||
break;
|
||||
|
||||
case SID_APPLY_THEME:
|
||||
{
|
||||
const SfxItemSet* pArgs = rReq.GetArgs();
|
||||
if (pArgs)
|
||||
{
|
||||
const SfxPoolItem* pItem;
|
||||
if (pArgs->GetItemState(FN_PARAM_1, true, &pItem) == SfxItemState::SET)
|
||||
{
|
||||
OUString aThemeName = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
||||
auto pColorSet = svx::ColorSets::get().getColorSet(aThemeName);
|
||||
|
||||
if (pColorSet)
|
||||
{
|
||||
SdrPage* pMasterPage = &GetActualPage()->TRG_GetMasterPage();
|
||||
auto* pDocShell = GetDocSh();
|
||||
|
||||
auto pSharedColorSet = std::shared_ptr<model::ColorSet>(new model::ColorSet(*pColorSet));
|
||||
sd::ThemeColorChanger aChanger(pMasterPage, pDocShell);
|
||||
aChanger.apply(pSharedColorSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cancel();
|
||||
rReq.Done();
|
||||
}
|
||||
break;
|
||||
|
||||
case SID_ATTR_GLOW_COLOR:
|
||||
case SID_ATTR_GLOW_RADIUS:
|
||||
case SID_ATTR_GLOW_TRANSPARENCY:
|
||||
|
||||
@@ -49,10 +49,6 @@
|
||||
constructor="com_sun_star_comp_sd_SlideTransitionsToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.sd.ThemeColorsToolBoxControl"
|
||||
constructor="com_sun_star_comp_sd_ThemeColorsToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.sd.SlideLayoutController"
|
||||
constructor="com_sun_star_comp_sd_SlideLayoutController_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
|
||||
@@ -284,6 +284,7 @@ $(eval $(call gb_Library_add_exception_objects,svx,\
|
||||
svx/source/tbxctrls/tbunosearchcontrollers \
|
||||
svx/source/tbxctrls/tbxcolor \
|
||||
svx/source/tbxctrls/tbxdrctl \
|
||||
svx/source/tbxctrls/ThemeColorsToolBoxControl \
|
||||
svx/source/tbxctrls/verttexttbxctrl \
|
||||
svx/source/uitest/uiobject \
|
||||
svx/source/unodraw/unoctabl \
|
||||
|
||||
@@ -13342,6 +13342,23 @@ SfxVoidItem AddTheme SID_ADD_THEME
|
||||
GroupId = SfxGroupId::Format;
|
||||
]
|
||||
|
||||
SfxVoidItem ApplyTheme SID_APPLY_THEME
|
||||
(SfxStringItem ThemeName FN_PARAM_1)
|
||||
[
|
||||
AutoUpdate = FALSE,
|
||||
FastCall = FALSE,
|
||||
ReadOnlyDoc = FALSE,
|
||||
Toggle = FALSE,
|
||||
Container = FALSE,
|
||||
RecordAbsolute = FALSE,
|
||||
RecordPerSet;
|
||||
|
||||
AccelConfig = TRUE,
|
||||
MenuConfig = TRUE,
|
||||
ToolBoxConfig = TRUE,
|
||||
GroupId = SfxGroupId::Format;
|
||||
]
|
||||
|
||||
SfxBoolItem AccessibilityCheckOnline SID_ACCESSIBILITY_CHECK_ONLINE
|
||||
(SfxBoolItem Enable FN_PARAM_1)
|
||||
[
|
||||
|
||||
+18
-42
@@ -7,19 +7,18 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "ThemeColorsToolBoxControl.hxx"
|
||||
#include <ViewShellBase.hxx>
|
||||
#include <svx/ThemeColorsToolBoxControl.hxx>
|
||||
#include <vcl/weld/IconView.hxx>
|
||||
#include <cppuhelper/supportsservice.hxx>
|
||||
#include <sfx2/viewsh.hxx>
|
||||
#include <sfx2/objsh.hxx>
|
||||
#include <toolkit/helper/vclunohelper.hxx>
|
||||
#include <vcl/svapp.hxx>
|
||||
#include <vcl/weld/IconView.hxx>
|
||||
#include <svx/dialog/ThemeColorsPaneBase.hxx>
|
||||
#include <theme/ThemeColorChanger.hxx>
|
||||
#include <DrawDocShell.hxx>
|
||||
#include <drawview.hxx>
|
||||
#include <svx/svdpagv.hxx>
|
||||
#include <DrawViewShell.hxx>
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <com/sun/star/lang/XServiceInfo.hpp>
|
||||
#include <comphelper/processfactory.hxx>
|
||||
#include <comphelper/dispatchcommand.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
|
||||
ThemeColorsToolBoxControl::ThemeColorsToolBoxControl() {}
|
||||
|
||||
@@ -61,18 +60,9 @@ ThemeColorsToolBoxControl::createItemWindow(const css::uno::Reference<css::awt::
|
||||
{
|
||||
SolarMutexGuard aSolarMutexGuard;
|
||||
|
||||
sd::ViewShellBase* pViewShellBase = nullptr;
|
||||
if (SfxViewShell* pViewShell = SfxViewShell::Current())
|
||||
{
|
||||
pViewShellBase = dynamic_cast<sd::ViewShellBase*>(pViewShell);
|
||||
}
|
||||
|
||||
if (pViewShellBase)
|
||||
{
|
||||
m_xVclBox = VclPtr<ThemeColorsPaneWrapper>::Create(pParent, *pViewShellBase);
|
||||
m_xVclBox = VclPtr<ThemeColorsPaneWrapper>::Create(pParent, m_xFrame);
|
||||
xItemWindow = VCLUnoHelper::GetInterface(m_xVclBox.get());
|
||||
}
|
||||
}
|
||||
return xItemWindow;
|
||||
}
|
||||
|
||||
@@ -80,7 +70,7 @@ void SAL_CALL ThemeColorsToolBoxControl::update() {}
|
||||
|
||||
OUString SAL_CALL ThemeColorsToolBoxControl::getImplementationName()
|
||||
{
|
||||
return u"com.sun.star.comp.sd.ThemeColorsToolBoxControl"_ustr;
|
||||
return u"com.sun.star.comp.svx.ThemeColorsToolBoxControl"_ustr;
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL ThemeColorsToolBoxControl::supportsService(const OUString& rServiceName)
|
||||
@@ -95,17 +85,18 @@ css::uno::Sequence<OUString> SAL_CALL ThemeColorsToolBoxControl::getSupportedSer
|
||||
|
||||
// Export function for service registration
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
|
||||
com_sun_star_comp_sd_ThemeColorsToolBoxControl_get_implementation(
|
||||
com_sun_star_comp_svx_ThemeColorsToolBoxControl_get_implementation(
|
||||
css::uno::XComponentContext* /*rxContext*/, css::uno::Sequence<css::uno::Any> const&)
|
||||
{
|
||||
return cppu::acquire(new ThemeColorsToolBoxControl());
|
||||
}
|
||||
|
||||
ThemeColorsPaneWrapper::ThemeColorsPaneWrapper(vcl::Window* pParent, sd::ViewShellBase& rBase)
|
||||
ThemeColorsPaneWrapper::ThemeColorsPaneWrapper(
|
||||
vcl::Window* pParent, const css::uno::Reference<css::frame::XFrame>& rxFrame)
|
||||
: InterimItemWindow(pParent, u"svx/ui/themeselectorpanel.ui"_ustr, u"ThemeSelectorPanel"_ustr,
|
||||
true, reinterpret_cast<sal_uInt64>(SfxViewShell::Current()))
|
||||
, svx::ThemeColorsPaneBase(m_xBuilder->weld_icon_view(u"iconview_theme_colors"_ustr))
|
||||
, mrViewShellBase(rBase)
|
||||
, m_xFrame(rxFrame)
|
||||
{
|
||||
// Override selection handler to apply theme on single click
|
||||
if (mxIconViewThemeColors)
|
||||
@@ -132,26 +123,11 @@ void ThemeColorsPaneWrapper::onColorSetActivated()
|
||||
{
|
||||
if (!mpCurrentColorSet)
|
||||
return;
|
||||
sd::DrawViewShell* pViewShell
|
||||
= dynamic_cast<sd::DrawViewShell*>(mrViewShellBase.GetMainViewShell().get());
|
||||
if (!pViewShell)
|
||||
return;
|
||||
SdrPageView* pPageView = pViewShell->GetDrawView()->GetSdrPageView();
|
||||
if (!pPageView)
|
||||
return;
|
||||
SdrPage* pPage = pPageView->GetPage();
|
||||
if (!pPage)
|
||||
return;
|
||||
SdrPage* pMasterPage = &pPage->TRG_GetMasterPage();
|
||||
if (!pMasterPage)
|
||||
return;
|
||||
sd::DrawDocShell* pDocShell = mrViewShellBase.GetDocShell();
|
||||
if (!pDocShell)
|
||||
return;
|
||||
|
||||
// Apply the theme
|
||||
sd::ThemeColorChanger aChanger(pMasterPage, pDocShell);
|
||||
aChanger.apply(mpCurrentColorSet);
|
||||
css::uno::Sequence<css::beans::PropertyValue> aArgs{ comphelper::makePropertyValue(
|
||||
u"ThemeName"_ustr, mpCurrentColorSet->getName()) };
|
||||
|
||||
comphelper::dispatchCommand(u".uno:ApplyTheme"_ustr, m_xFrame, aArgs);
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(ThemeColorsPaneWrapper, SelectionChangedHdl, weld::IconView&, void)
|
||||
@@ -134,4 +134,8 @@
|
||||
constructor="com_sun_star_comp_svx_VertTextToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
<implementation name="com.sun.star.comp.svx.ThemeColorsToolBoxControl"
|
||||
constructor="com_sun_star_comp_svx_ThemeColorsToolBoxControl_get_implementation">
|
||||
<service name="com.sun.star.frame.ToolbarController"/>
|
||||
</implementation>
|
||||
</component>
|
||||
|
||||
@@ -619,6 +619,13 @@ interface BaseTextSelection
|
||||
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
|
||||
]
|
||||
|
||||
SID_APPLY_THEME
|
||||
[
|
||||
ExecMethod = ExecDlg;
|
||||
StateMethod = GetState;
|
||||
DisableFlags="SfxDisableFlags::SwOnProtectedCursor";
|
||||
]
|
||||
|
||||
SID_PROTECTPOS
|
||||
[
|
||||
ExecMethod = Execute ;
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <editeng/langitem.hxx>
|
||||
#include <svx/clipfmtitem.hxx>
|
||||
#include <svx/contdlg.hxx>
|
||||
#include <svx/ColorSets.hxx>
|
||||
#include <vcl/graph.hxx>
|
||||
#include <vcl/inputctx.hxx>
|
||||
#include <svl/slstitm.hxx>
|
||||
@@ -3056,6 +3057,30 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq)
|
||||
}
|
||||
break;
|
||||
|
||||
case SID_APPLY_THEME:
|
||||
{
|
||||
if (pArgs)
|
||||
{
|
||||
if (pArgs->GetItemState(FN_PARAM_1, true, &pItem) == SfxItemState::SET)
|
||||
{
|
||||
OUString aThemeName = static_cast<const SfxStringItem*>(pItem)->GetValue();
|
||||
auto pColorSet = svx::ColorSets::get().getColorSet(aThemeName);
|
||||
auto* pDocument = rSh.GetDoc();
|
||||
auto* pDocumentShell = pDocument->GetDocShell();
|
||||
|
||||
if (pColorSet && pDocumentShell)
|
||||
{
|
||||
auto pSharedColorSet = std::shared_ptr<model::ColorSet>(new model::ColorSet(*pColorSet));
|
||||
std::shared_ptr<svx::IThemeColorChanger> xChanger(new sw::ThemeColorChanger(pDocumentShell));
|
||||
xChanger->apply(pSharedColorSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rReq.Done();
|
||||
}
|
||||
break;
|
||||
|
||||
default:OSL_FAIL("wrong Dispatcher (basesh.cxx)");
|
||||
}
|
||||
if(!bDone)
|
||||
|
||||
@@ -62,7 +62,7 @@ void com_sun_star_comp_sd_InsertSlideController_get_implementation( void );
|
||||
void com_sun_star_comp_sd_SlideLayoutController_get_implementation( void );
|
||||
void com_sun_star_comp_sd_DisplayModeController_get_implementation( void );
|
||||
void com_sun_star_comp_sd_SlideTransitionsToolBoxControl_get_implementation( void );
|
||||
void com_sun_star_comp_sd_ThemeColorsToolBoxControl_get_implementation( void );
|
||||
void com_sun_star_comp_svx_ThemeColorsToolBoxControl_get_implementation( void );
|
||||
void ucb_UcbCommandEnvironment_get_implementation( void );
|
||||
void ucb_UcbContentProviderProxyFactory_get_implementation( void );
|
||||
void ucb_UcbPropertiesManager_get_implementation( void );
|
||||
@@ -131,7 +131,7 @@ lo_get_constructor_map(void)
|
||||
{ "com_sun_star_comp_sd_SlideLayoutController_get_implementation", com_sun_star_comp_sd_SlideLayoutController_get_implementation },
|
||||
{ "com_sun_star_comp_sd_DisplayModeController_get_implementation", com_sun_star_comp_sd_DisplayModeController_get_implementation },
|
||||
{ "com_sun_star_comp_sd_SlideTransitionsToolBoxControl_get_implementation", com_sun_star_comp_sd_SlideTransitionsToolBoxControl_get_implementation },
|
||||
{ "com_sun_star_comp_sd_ThemeColorsToolBoxControl_get_implementation", com_sun_star_comp_sd_ThemeColorsToolBoxControl_get_implementation },
|
||||
{ "com_sun_star_comp_svx_ThemeColorsToolBoxControl_get_implementation", com_sun_star_comp_svx_ThemeColorsToolBoxControl_get_implementation },
|
||||
{ "ucb_UcbCommandEnvironment_get_implementation", ucb_UcbCommandEnvironment_get_implementation, },
|
||||
{ "ucb_UcbContentProviderProxyFactory_get_implementation", ucb_UcbContentProviderProxyFactory_get_implementation },
|
||||
{ "ucb_UcbPropertiesManager_get_implementation", ucb_UcbPropertiesManager_get_implementation },
|
||||
|
||||
Reference in New Issue
Block a user