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 .
22 #include <comphelper/propertysethelper.hxx>
23 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <comphelper/propertysetinfo.hxx>
26 #include <vcl/graph.hxx>
28 inline constexpr OUString MIMETYPE_BMP
= u
"image/x-MS-bmp"_ustr
;
29 inline constexpr OUString MIMETYPE_GIF
= u
"image/gif"_ustr
;
30 inline constexpr OUString MIMETYPE_JPG
= u
"image/jpeg"_ustr
;
31 inline constexpr OUString MIMETYPE_PCD
= u
"image/x-photo-cd"_ustr
;
32 inline constexpr OUString MIMETYPE_PCX
= u
"image/x-pcx"_ustr
;
33 inline constexpr OUString MIMETYPE_PNG
= u
"image/png"_ustr
;
34 inline constexpr OUString MIMETYPE_TIF
= u
"image/tiff"_ustr
;
35 inline constexpr OUString MIMETYPE_XBM
= u
"image/x-xbitmap"_ustr
;
36 inline constexpr OUString MIMETYPE_XPM
= u
"image/x-xpixmap"_ustr
;
37 inline constexpr OUString MIMETYPE_PBM
= u
"image/x-portable-bitmap"_ustr
;
38 inline constexpr OUString MIMETYPE_PGM
= u
"image/x-portable-graymap"_ustr
;
39 inline constexpr OUString MIMETYPE_PPM
= u
"image/x-portable-pixmap"_ustr
;
40 inline constexpr OUString MIMETYPE_RAS
= u
"image/x-cmu-raster"_ustr
;
41 inline constexpr OUString MIMETYPE_TGA
= u
"image/x-targa"_ustr
;
42 inline constexpr OUString MIMETYPE_PSD
= u
"image/vnd.adobe.photoshop"_ustr
;
43 inline constexpr OUString MIMETYPE_EPS
= u
"image/x-eps"_ustr
;
44 inline constexpr OUString MIMETYPE_DXF
= u
"image/vnd.dxf"_ustr
;
45 inline constexpr OUString MIMETYPE_MET
= u
"image/x-met"_ustr
;
46 inline constexpr OUString MIMETYPE_PCT
= u
"image/x-pict"_ustr
;
47 inline constexpr OUString MIMETYPE_SVM
= u
"image/x-svm"_ustr
;
48 inline constexpr OUString MIMETYPE_WMF
= u
"image/x-wmf"_ustr
;
49 inline constexpr OUString MIMETYPE_EMF
= u
"image/x-emf"_ustr
;
50 inline constexpr OUString MIMETYPE_SVG
= u
"image/svg+xml"_ustr
;
51 inline constexpr OUString MIMETYPE_PDF
= u
"application/pdf"_ustr
;
52 inline constexpr OUString MIMETYPE_WEBP
= u
"image/webp"_ustr
;
53 inline constexpr OUString MIMETYPE_VCLGRAPHIC
= u
"image/x-vclgraphic"_ustr
;
55 namespace comphelper
{ class PropertySetInfo
; }
56 namespace com::sun::star::io
{ class XInputStream
; }
60 namespace unographic
{
62 class GraphicDescriptor
: public ::cppu::OWeakObject
,
63 public css::lang::XServiceInfo
,
64 public css::lang::XTypeProvider
,
65 public ::comphelper::PropertySetHelper
70 virtual ~GraphicDescriptor() noexcept override
;
72 void init( const ::Graphic
& rGraphic
);
73 void init( const OUString
& rURL
);
74 void init( const css::uno::Reference
< css::io::XInputStream
>& rxIStm
, const OUString
& rURL
);
76 static rtl::Reference
<::comphelper::PropertySetInfo
> createPropertySetInfo();
79 virtual css::uno::Any SAL_CALL
queryInterface( const css::uno::Type
& rType
) override
;
80 virtual void SAL_CALL
acquire() noexcept override
;
81 virtual void SAL_CALL
release() noexcept override
;
85 virtual OUString SAL_CALL
getImplementationName() override
;
86 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
87 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
90 virtual css::uno::Sequence
< css::uno::Type
> SAL_CALL
getTypes( ) override
;
91 virtual css::uno::Sequence
< sal_Int8
> SAL_CALL
getImplementationId( ) override
;
94 virtual void _setPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, const css::uno::Any
* pValues
) override
;
95 virtual void _getPropertyValues( const comphelper::PropertyMapEntry
** ppEntries
, css::uno::Any
* pValue
) override
;
99 const ::Graphic
* mpGraphic
;
104 sal_uInt16 mnBitsPerPixel
;
107 GraphicDescriptor( const GraphicDescriptor
& rDescriptor
) = delete;
109 GraphicDescriptor
& operator=( const GraphicDescriptor
& ) = delete;
111 void implCreate( SvStream
& rIStm
, const OUString
* pPath
);
116 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */