summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--svtools/source/graphic/graphic.cxx76
-rw-r--r--svtools/source/graphic/graphic.hxx4
2 files changed, 41 insertions, 39 deletions
diff --git a/svtools/source/graphic/graphic.cxx b/svtools/source/graphic/graphic.cxx
index 3739d3b491fe..5c56025388e6 100644
--- a/svtools/source/graphic/graphic.cxx
+++ b/svtools/source/graphic/graphic.cxx
@@ -22,7 +22,6 @@
#include <com/sun/star/graphic/GraphicType.hpp>
#include <com/sun/star/graphic/XGraphicTransformer.hpp>
#include <vcl/dibtools.hxx>
-#include <vcl/graph.hxx>
#include "graphic.hxx"
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -34,24 +33,19 @@ using namespace com::sun::star;
namespace unographic {
Graphic::Graphic() :
- mpGraphic( nullptr )
+ maGraphic()
{
}
-
-Graphic::~Graphic()
- throw()
+Graphic::~Graphic() throw()
{
- delete mpGraphic;
}
-
void Graphic::init( const ::Graphic& rGraphic )
throw()
{
- delete mpGraphic;
- mpGraphic = new ::Graphic( rGraphic );
- ::unographic::GraphicDescriptor::init( *mpGraphic );
+ maGraphic = ::Graphic(rGraphic);
+ unographic::GraphicDescriptor::init(maGraphic);
}
@@ -68,7 +62,7 @@ uno::Any SAL_CALL Graphic::queryAggregation( const uno::Type& rType )
else
aAny <<= ::unographic::GraphicDescriptor::queryAggregation( rType );
- return aAny ;
+ return aAny;
}
@@ -85,17 +79,16 @@ uno::Any SAL_CALL Graphic::queryInterface( const uno::Type & rType )
void SAL_CALL Graphic::acquire()
throw()
{
- ::unographic::GraphicDescriptor::acquire();
+ unographic::GraphicDescriptor::acquire();
}
void SAL_CALL Graphic::release() throw()
{
- ::unographic::GraphicDescriptor::release();
+ unographic::GraphicDescriptor::release();
}
-OUString Graphic::getImplementationName_Static()
- throw()
+OUString Graphic::getImplementationName_Static() throw()
{
return OUString( "com.sun.star.comp.graphic.Graphic" );
}
@@ -156,13 +149,21 @@ uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId()
}
-::sal_Int8 SAL_CALL Graphic::getType()
+sal_Int8 SAL_CALL Graphic::getType()
throw (uno::RuntimeException, std::exception)
{
- ::sal_Int8 cRet = graphic::GraphicType::EMPTY;
+ sal_Int8 cRet = graphic::GraphicType::EMPTY;
- if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) )
- cRet = ( ( mpGraphic->GetType() == GraphicType::Bitmap ) ? graphic::GraphicType::PIXEL : graphic::GraphicType::VECTOR );
+ if (!!maGraphic)
+ {
+ ::GraphicType eType = maGraphic.GetType();
+
+ if (eType != ::GraphicType::NONE)
+ {
+ cRet = (eType == ::GraphicType::Bitmap) ? graphic::GraphicType::PIXEL
+ : graphic::GraphicType::VECTOR;
+ }
+ }
return cRet;
}
@@ -170,29 +171,29 @@ uno::Sequence< sal_Int8 > SAL_CALL Graphic::getImplementationId()
// XBitmap
-
-awt::Size SAL_CALL Graphic::getSize( ) throw (uno::RuntimeException, std::exception)
+awt::Size SAL_CALL Graphic::getSize() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- ::Size aVclSize;
- if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) )
- aVclSize = mpGraphic->GetSizePixel();
-
- return awt::Size( aVclSize.Width(), aVclSize.Height() );
+ Size aVclSize;
+ if (!!maGraphic && maGraphic.GetType() != ::GraphicType::NONE)
+ {
+ aVclSize = maGraphic.GetSizePixel();
+ }
+ return awt::Size(aVclSize.Width(), aVclSize.Height());
}
-uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getDIB( ) throw (uno::RuntimeException, std::exception)
+uno::Sequence<sal_Int8> SAL_CALL Graphic::getDIB() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) )
+ if (!!maGraphic && maGraphic.GetType() != ::GraphicType::NONE)
{
- SvMemoryStream aMem;
+ SvMemoryStream aMemoryStream;
- WriteDIB(mpGraphic->GetBitmapEx().GetBitmap(), aMem, false, true);
- return css::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() );
+ WriteDIB(maGraphic.GetBitmapEx().GetBitmap(), aMemoryStream, false, true);
+ return css::uno::Sequence<sal_Int8>(static_cast<sal_Int8 const *>(aMemoryStream.GetData()), aMemoryStream.Tell());
}
else
{
@@ -201,16 +202,16 @@ uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getDIB( ) throw (uno::RuntimeExce
}
-uno::Sequence< ::sal_Int8 > SAL_CALL Graphic::getMaskDIB( ) throw (uno::RuntimeException, std::exception)
+uno::Sequence<sal_Int8> SAL_CALL Graphic::getMaskDIB() throw (uno::RuntimeException, std::exception)
{
SolarMutexGuard aGuard;
- if( mpGraphic && ( mpGraphic->GetType() != GraphicType::NONE ) )
+ if (!!maGraphic && maGraphic.GetType() != ::GraphicType::NONE)
{
- SvMemoryStream aMem;
+ SvMemoryStream aMemoryStream;
- WriteDIB(mpGraphic->GetBitmapEx().GetMask(), aMem, false, true);
- return css::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMem.GetData()), aMem.Tell() );
+ WriteDIB(maGraphic.GetBitmapEx().GetMask(), aMemoryStream, false, true);
+ return css::uno::Sequence<sal_Int8>( static_cast<sal_Int8 const *>(aMemoryStream.GetData()), aMemoryStream.Tell() );
}
else
{
@@ -231,8 +232,7 @@ sal_Int64 SAL_CALL Graphic::getSomething( const uno::Sequence< sal_Int8 >& rId )
throw( uno::RuntimeException, std::exception )
{
return( ( rId.getLength() == 16 && 0 == memcmp( ::Graphic::getUnoTunnelId().getConstArray(), rId.getConstArray(), 16 ) ) ?
- reinterpret_cast< sal_Int64 >( mpGraphic ) :
- 0 );
+ reinterpret_cast<sal_Int64>(&maGraphic) : 0 );
}
}
diff --git a/svtools/source/graphic/graphic.hxx b/svtools/source/graphic/graphic.hxx
index 475db8170aa1..ee34096bd063 100644
--- a/svtools/source/graphic/graphic.hxx
+++ b/svtools/source/graphic/graphic.hxx
@@ -28,6 +28,8 @@
#include "descriptor.hxx"
#include "transformer.hxx"
+#include <vcl/graph.hxx>
+
namespace unographic {
class Graphic : public css::graphic::XGraphic,
@@ -78,7 +80,7 @@ protected:
private:
- ::Graphic* mpGraphic;
+ ::Graphic maGraphic;
};
}