diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2018-03-15 22:18:51 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2018-03-18 06:26:21 +0100 |
commit | da9c8289757657bf36963ffaea45ac5a2a821ac8 (patch) | |
tree | 423ebe714abcea45260c9cdb58cf0a648be33286 | |
parent | c671b277275d2173b8235bcda1aa3f17dbe6deb5 (diff) |
cleanup UnoGraphicObject
Change-Id: I7d8982223170b4675b85e350d9515ef99df0f715
Reviewed-on: https://gerrit.libreoffice.org/51390
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
-rw-r--r-- | vcl/source/graphic/UnoGraphicObject.cxx | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/vcl/source/graphic/UnoGraphicObject.cxx b/vcl/source/graphic/UnoGraphicObject.cxx index 668cfce9a78d..bb4debbdae1a 100644 --- a/vcl/source/graphic/UnoGraphicObject.cxx +++ b/vcl/source/graphic/UnoGraphicObject.cxx @@ -27,25 +27,27 @@ #include <vcl/GraphicObject.hxx> #include <rtl/ref.hxx> -using namespace com::sun::star; +using namespace css; namespace { -typedef ::cppu::WeakImplHelper< graphic::XGraphicObject, css::lang::XServiceInfo > GObjectAccess_BASE; +typedef ::cppu::WeakImplHelper<graphic::XGraphicObject, css::lang::XServiceInfo> GraphicObject_BASE; + // Simple uno wrapper around the GraphicObject class to allow basic // access. ( and solves a horrible cyclic link problem between // goodies/toolkit/extensions ) -class GObjectImpl : public GObjectAccess_BASE +class GraphicObjectImpl : public GraphicObject_BASE { - ::osl::Mutex m_aMutex; - std::unique_ptr< GraphicObject > mpGObject; + osl::Mutex m_aMutex; + std::unique_ptr<GraphicObject> mpGraphicObject; + public: /// @throws uno::RuntimeException - explicit GObjectImpl(uno::Sequence< uno::Any > const & args); + explicit GraphicObjectImpl(uno::Sequence<uno::Any> const & rArgs); // XGraphicObject - virtual uno::Reference< graphic::XGraphic > SAL_CALL getGraphic() override; - virtual void SAL_CALL setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) override; + virtual uno::Reference<graphic::XGraphic> SAL_CALL getGraphic() override; + virtual void SAL_CALL setGraphic(uno::Reference<graphic::XGraphic> const & rxGraphic) override; OUString SAL_CALL getUniqueID() override; virtual OUString SAL_CALL getImplementationName() override @@ -60,48 +62,49 @@ public: virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override { - uno::Sequence<OUString> aRet { "com.sun.star.graphic.GraphicObject" }; - return aRet; + return uno::Sequence<OUString> { "com.sun.star.graphic.GraphicObject" }; } }; -GObjectImpl::GObjectImpl(const uno::Sequence< uno::Any >& /*args*/) +GraphicObjectImpl::GraphicObjectImpl(const uno::Sequence<uno::Any>& /*rArgs*/) { - mpGObject.reset(new GraphicObject()); + mpGraphicObject.reset(new GraphicObject()); } -uno::Reference< graphic::XGraphic > SAL_CALL GObjectImpl::getGraphic() +uno::Reference<graphic::XGraphic> SAL_CALL GraphicObjectImpl::getGraphic() { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !mpGObject.get() ) + osl::MutexGuard aGuard(m_aMutex); + + if (!mpGraphicObject.get()) throw uno::RuntimeException(); - return mpGObject->GetGraphic().GetXGraphic(); + return mpGraphicObject->GetGraphic().GetXGraphic(); } -void SAL_CALL GObjectImpl::setGraphic( const uno::Reference< graphic::XGraphic >& _graphic ) +void SAL_CALL GraphicObjectImpl::setGraphic(uno::Reference<graphic::XGraphic> const & rxGraphic) { - ::osl::MutexGuard aGuard( m_aMutex ); - if ( !mpGObject.get() ) + osl::MutexGuard aGuard(m_aMutex); + + if (!mpGraphicObject.get()) throw uno::RuntimeException(); - Graphic aGraphic( _graphic ); - mpGObject->SetGraphic( aGraphic ); + Graphic aGraphic(rxGraphic); + mpGraphicObject->SetGraphic(aGraphic); } -OUString SAL_CALL GObjectImpl::getUniqueID() +OUString SAL_CALL GraphicObjectImpl::getUniqueID() { // not supported anymore so return empty string for now osl::MutexGuard aGuard(m_aMutex); return OUString(); } -} +} // end anonymous namespace -extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * -com_sun_star_graphic_GraphicObject_get_implementation( - SAL_UNUSED_PARAMETER css::uno::XComponentContext *, - css::uno::Sequence<css::uno::Any> const &arguments) +extern "C" SAL_DLLPUBLIC_EXPORT +css::uno::XInterface* com_sun_star_graphic_GraphicObject_get_implementation( + SAL_UNUSED_PARAMETER uno::XComponentContext*, + uno::Sequence<uno::Any> const & rArguments) { - return cppu::acquire(new GObjectImpl(arguments)); + return cppu::acquire(new GraphicObjectImpl(rArguments)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |