loplugin:unocast (SvxLineStyleToolBoxControl)
(See the upcoming commit introducing that loplugin:unocast on why such dynamic_casts from UNO types are dangerous.) Change-Id: I13f71f717a8661e0889ab7acf6fe7c7ebbe3dbe6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144332 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <com/sun/star/chart2/XDiagram.hpp>
|
||||
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
#include <sfx2/viewsh.hxx>
|
||||
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
|
||||
|
||||
@@ -35,7 +36,7 @@ namespace {
|
||||
SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(const ToolbarUnoDispatcher& rToolBoxColor)
|
||||
{
|
||||
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
|
||||
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
|
||||
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = comphelper::getFromUnoTunnel<SvxLineStyleToolBoxControl>(xController);
|
||||
return pToolBoxLineStyleControl;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef INCLUDED_SVX_LINECTRL_HXX
|
||||
#define INCLUDED_SVX_LINECTRL_HXX
|
||||
|
||||
#include <com/sun/star/lang/XUnoTunnel.hpp>
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
#include <sfx2/tbxctrl.hxx>
|
||||
#include <svtools/popupwindowcontroller.hxx>
|
||||
#include <svx/svxdllapi.h>
|
||||
@@ -35,7 +37,8 @@ typedef std::function<bool(const OUString&, const css::uno::Any&)> LineStyleSele
|
||||
typedef std::function<void(bool)> LineStyleIsNoneFunction;
|
||||
|
||||
// SvxLineStyleController:
|
||||
class SVXCORE_DLLPUBLIC SvxLineStyleToolBoxControl final : public svt::PopupWindowController
|
||||
class SVXCORE_DLLPUBLIC SvxLineStyleToolBoxControl final :
|
||||
public cppu::ImplInheritanceHelper<svt::PopupWindowController, css::lang::XUnoTunnel>
|
||||
{
|
||||
private:
|
||||
std::unique_ptr<svx::ToolboxButtonLineStyleUpdater> m_xBtnUpdater;
|
||||
@@ -53,6 +56,9 @@ public:
|
||||
virtual OUString SAL_CALL getImplementationName() override;
|
||||
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
|
||||
|
||||
sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier) override;
|
||||
static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
|
||||
|
||||
virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override;
|
||||
virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
#include <svx/sidebar/LinePropertyPanelBase.hxx>
|
||||
#include <sfx2/weldutils.hxx>
|
||||
#include <svx/linectrl.hxx>
|
||||
@@ -57,7 +58,7 @@ namespace
|
||||
SvxLineStyleToolBoxControl* getLineStyleToolBoxControl(const ToolbarUnoDispatcher& rToolBoxColor)
|
||||
{
|
||||
css::uno::Reference<css::frame::XToolbarController> xController = rToolBoxColor.GetControllerForCommand(".uno:XLineStyle");
|
||||
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = dynamic_cast<SvxLineStyleToolBoxControl*>(xController.get());
|
||||
SvxLineStyleToolBoxControl* pToolBoxLineStyleControl = comphelper::getFromUnoTunnel<SvxLineStyleToolBoxControl>(xController);
|
||||
return pToolBoxLineStyleControl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
#include <comphelper/lok.hxx>
|
||||
#include <comphelper/propertyvalue.hxx>
|
||||
#include <comphelper/servicehelper.hxx>
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star::beans;
|
||||
@@ -60,7 +61,7 @@ using namespace ::com::sun::star;
|
||||
#define MAX_LINES 12
|
||||
|
||||
SvxLineStyleToolBoxControl::SvxLineStyleToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext )
|
||||
: svt::PopupWindowController( rContext, nullptr, OUString() )
|
||||
: ImplInheritanceHelper( rContext, nullptr, OUString() )
|
||||
{
|
||||
addStatusListener(".uno:LineDash");
|
||||
}
|
||||
@@ -217,6 +218,16 @@ css::uno::Sequence<OUString> SvxLineStyleToolBoxControl::getSupportedServiceName
|
||||
return { "com.sun.star.frame.ToolbarController" };
|
||||
}
|
||||
|
||||
sal_Int64 SvxLineStyleToolBoxControl::getSomething(css::uno::Sequence<sal_Int8> const & aIdentifier)
|
||||
{
|
||||
return comphelper::getSomethingImpl(aIdentifier, this);
|
||||
}
|
||||
|
||||
css::uno::Sequence<sal_Int8> const & SvxLineStyleToolBoxControl::getUnoTunnelId() {
|
||||
static comphelper::UnoIdInit const id;
|
||||
return id.getSeq();
|
||||
}
|
||||
|
||||
extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface *
|
||||
com_sun_star_comp_svx_LineStyleToolBoxControl_get_implementation(
|
||||
css::uno::XComponentContext* rContext,
|
||||
|
||||
Reference in New Issue
Block a user