1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "bitmapcreator.hxx"
22 #include <cppuhelper/supportsservice.hxx>
23 #include <vcl/bitmapex.hxx>
24 #include <toolkit/helper/vclunohelper.hxx>
25 #include <tools/stream.hxx>
27 using namespace ::com::sun::star
;
30 uno::Sequence
< OUString
> SAL_CALL
VCLBitmapCreator::impl_staticGetSupportedServiceNames()
34 "com.sun.star.embed.BitmapCreator",
35 "com.sun.star.comp.embed.BitmapCreator"
40 OUString SAL_CALL
VCLBitmapCreator::impl_staticGetImplementationName()
42 return OUString("com.sun.star.comp.embed.BitmapCreator");
46 uno::Reference
< uno::XInterface
> SAL_CALL
VCLBitmapCreator::impl_staticCreateSelfInstance(
47 const uno::Reference
< lang::XMultiServiceFactory
>& xServiceManager
)
49 return uno::Reference
< uno::XInterface
>( *new VCLBitmapCreator( xServiceManager
) );
53 uno::Reference
< uno::XInterface
> SAL_CALL
VCLBitmapCreator::createInstance()
54 throw ( uno::Exception
,
55 uno::RuntimeException
)
58 uno::Reference
< uno::XInterface
> aResult( VCLUnoHelper::CreateBitmap( aBitmap
), uno::UNO_QUERY
);
64 uno::Reference
< uno::XInterface
> SAL_CALL
VCLBitmapCreator::createInstanceWithArguments(
65 const uno::Sequence
< uno::Any
>& aArguments
)
66 throw ( uno::Exception
,
67 uno::RuntimeException
)
69 if ( aArguments
.getLength() != 1 )
70 throw uno::Exception(); // TODO
72 uno::Sequence
< sal_Int8
> aOrigBitmap
;
73 if ( !( aArguments
[0] >>= aOrigBitmap
) )
74 throw uno::Exception(); // TODO
77 SvMemoryStream
aStream( aOrigBitmap
.getArray(), aOrigBitmap
.getLength(), StreamMode::READ
);
79 if ( aStream
.GetError() )
80 throw uno::Exception(); // TODO
82 uno::Reference
< uno::XInterface
> aResult( VCLUnoHelper::CreateBitmap( aBitmap
), uno::UNO_QUERY
);
88 OUString SAL_CALL
VCLBitmapCreator::getImplementationName()
89 throw ( uno::RuntimeException
)
91 return impl_staticGetImplementationName();
94 sal_Bool SAL_CALL
VCLBitmapCreator::supportsService( const OUString
& ServiceName
)
95 throw ( uno::RuntimeException
)
97 return cppu::supportsService(this, ServiceName
);
101 uno::Sequence
< OUString
> SAL_CALL
VCLBitmapCreator::getSupportedServiceNames()
102 throw ( uno::RuntimeException
)
104 return impl_staticGetSupportedServiceNames();
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */