summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorPhilippe Jung <phil.jung@free.fr>2015-11-18 23:54:29 +0100
committerPhilippe Jung <phil.jung@free.fr>2015-11-18 23:36:25 +0000
commitdb5358764fdb1855ee6b401d6165ed65677bdfbe (patch)
treee81024b26eff3746acab49775ea262f065d01964 /sd
parentf08d0142afbcb45c12604988022bb3da18be1d84 (diff)
Code cleanup for gerrit change 16723
Simple code clean-up taking into account Maxim Monastirsky remarks. Change-Id: If6393851c3eb6fd8a460ef95ef88ccf3aed82e3e Reviewed-on: https://gerrit.libreoffice.org/20047 Reviewed-by: Philippe Jung <phil.jung@free.fr> Tested-by: Philippe Jung <phil.jung@free.fr>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/controller/displaymodecontroller.cxx58
-rw-r--r--sd/source/ui/controller/displaymodecontroller.hxx3
-rw-r--r--sd/source/ui/view/drviewse.cxx1
3 files changed, 25 insertions, 37 deletions
diff --git a/sd/source/ui/controller/displaymodecontroller.cxx b/sd/source/ui/controller/displaymodecontroller.cxx
index 9d37bd9e46b8..df867953159e 100644
--- a/sd/source/ui/controller/displaymodecontroller.cxx
+++ b/sd/source/ui/controller/displaymodecontroller.cxx
@@ -239,22 +239,8 @@ void DisplayModeToolbarMenu::SelectHdl(void * pControl)
mrController.setToolboxItemImage( nImage );
}
-OUString DisplayModeController_getImplementationName() throw (css::uno::RuntimeException)
-{
- return OUString( "com.sun.star.comp.sd.DisplayModeController" );
-}
-
-Sequence< OUString > DisplayModeController_getSupportedServiceNames() throw( RuntimeException )
-{
- Sequence< OUString > aSNS( 1 );
- aSNS.getArray()[0] = "com.sun.star.frame.ToolbarController";
- return aSNS;
-}
-
-// class SlideLayoutController
-
-DisplayModeController::DisplayModeController( const Reference< uno::XComponentContext >& rxContext, const OUString& sCommandURL )
-: svt::PopupWindowController( rxContext, Reference< frame::XFrame >(), sCommandURL )
+DisplayModeController::DisplayModeController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext )
+: svt::PopupWindowController( rxContext, Reference< frame::XFrame >(), OUString() )
{
}
@@ -262,6 +248,10 @@ void SAL_CALL DisplayModeController::initialize( const css::uno::Sequence< css::
throw ( css::uno::Exception, css::uno::RuntimeException, std::exception )
{
svt::PopupWindowController::initialize( aArguments );
+ ToolBox* pToolBox = nullptr;
+ sal_uInt16 nId = 0;
+ if ( getToolboxId( nId, &pToolBox ) )
+ pToolBox->SetItemBits( nId, pToolBox->GetItemBits( nId ) | ToolBoxItemBits::DROPDOWNONLY );
setToolboxItemImage( BMP_DISPLAYMODE_SLIDE );
}
@@ -273,33 +263,33 @@ VclPtr<vcl::Window> DisplayModeController::createPopupWindow( vcl::Window* pPare
void DisplayModeController::setToolboxItemImage( sal_uInt16 nImage )
{
sal_uInt16 nId;
- ToolBox* pToolBox;
- getToolboxId( nId, &pToolBox );
-
- SdResId resId( nImage );
- BitmapEx aBmp( resId );
- int targetSize = (pToolBox->GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE) ? 32 : 16;
- double scale = 1.0f;
- Size size = aBmp.GetSizePixel();
- if (size.Width() > targetSize)
- scale = (double)targetSize / (double)size.Width();
- if (size.Height() > targetSize)
- scale = ::std::min( scale, (double)targetSize / (double)size.Height() );
- aBmp.Scale( scale, scale );
- pToolBox->SetItemImage( nId, Image( aBmp ) );
-
+ ToolBox* pToolBox = nullptr;
+ if (getToolboxId( nId, &pToolBox )) {
+ SdResId resId( nImage );
+ BitmapEx aBmp( resId );
+ int targetSize = (pToolBox->GetToolboxButtonSize() == TOOLBOX_BUTTONSIZE_LARGE) ? 32 : 16;
+ double scale = 1.0f;
+ Size size = aBmp.GetSizePixel();
+ if (size.Width() > targetSize)
+ scale = (double)targetSize / (double)size.Width();
+ if (size.Height() > targetSize)
+ scale = ::std::min( scale, (double)targetSize / (double)size.Height() );
+ aBmp.Scale( scale, scale );
+ pToolBox->SetItemImage( nId, Image( aBmp ) );
+ }
}
// XServiceInfo
OUString SAL_CALL DisplayModeController::getImplementationName() throw( RuntimeException, std::exception )
{
- return DisplayModeController_getImplementationName();
+ return OUString( "com.sun.star.comp.sd.DisplayModeController" );;
}
Sequence< OUString > SAL_CALL DisplayModeController::getSupportedServiceNames( ) throw( RuntimeException, std::exception )
{
- return DisplayModeController_getSupportedServiceNames();
+ css::uno::Sequence<OUString> aRet { "com.sun.star.frame.ToolbarController" };
+ return aRet;
}
}
@@ -309,7 +299,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT ::com::sun::star::uno::XInterface* SAL_CALL
com_sun_star_comp_sd_DisplayModeController_get_implementation(::com::sun::star::uno::XComponentContext* context,
::com::sun::star::uno::Sequence<css::uno::Any> const &)
{
- return cppu::acquire(new sd::DisplayModeController(context, ".uno:DisplayMode"));
+ return cppu::acquire(new sd::DisplayModeController(context));
}
diff --git a/sd/source/ui/controller/displaymodecontroller.hxx b/sd/source/ui/controller/displaymodecontroller.hxx
index ff2f25073b5f..8167890ef4bc 100644
--- a/sd/source/ui/controller/displaymodecontroller.hxx
+++ b/sd/source/ui/controller/displaymodecontroller.hxx
@@ -28,8 +28,7 @@ namespace sd
class DisplayModeController : public svt::PopupWindowController
{
public:
- DisplayModeController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext,
- const OUString& sCommandURL );
+ DisplayModeController( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
virtual VclPtr<vcl::Window> createPopupWindow( vcl::Window* pParent ) SAL_OVERRIDE;
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 80b2bab98a8f..a293696455b6 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -56,7 +56,6 @@
#include <tools/urlobj.hxx>
#include <svl/slstitm.hxx>
#include <sfx2/ipclient.hxx>
-#include <sfx2/sidebar/Sidebar.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <avmedia/mediawindow.hxx>
#include <svl/urihelper.hxx>