Update ooo320-m1
[ooovba.git] / goodies / source / unographic / descriptor.hxx
blob7cf7252316d8b9b3b00df0b1253a479d3fedb3ef
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: descriptor.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _GOODIES_DESCRIPTOR_HXX
32 #define _GOODIES_DESCRIPTOR_HXX
34 #include <comphelper/propertysethelper.hxx>
35 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <comphelper/propertysetinfo.hxx>
38 #include <vcl/graph.hxx>
40 #define MIMETYPE_BMP "image/x-MS-bmp"
41 #define MIMETYPE_GIF "image/gif"
42 #define MIMETYPE_JPG "image/jpeg"
43 #define MIMETYPE_PCD "image/x-photo-cd"
44 #define MIMETYPE_PCX "image/x-pcx"
45 #define MIMETYPE_PNG "image/png"
46 #define MIMETYPE_TIF "image/tiff"
47 #define MIMETYPE_XBM "image/x-xbitmap"
48 #define MIMETYPE_XPM "image/x-xpixmap"
49 #define MIMETYPE_PBM "image/x-portable-bitmap"
50 #define MIMETYPE_PGM "image/x-portable-graymap"
51 #define MIMETYPE_PPM "image/x-portable-pixmap"
52 #define MIMETYPE_RAS "image/x-cmu-raster"
53 #define MIMETYPE_TGA "image/x-targa"
54 #define MIMETYPE_PSD "image/vnd.adobe.photoshop"
55 #define MIMETYPE_EPS "image/x-eps"
56 #define MIMETYPE_DXF "image/vnd.dxf"
57 #define MIMETYPE_MET "image/x-met"
58 #define MIMETYPE_PCT "image/x-pict"
59 #define MIMETYPE_SGF "image/x-sgf"
60 #define MIMETYPE_SVM "image/x-svm"
61 #define MIMETYPE_WMF "image/x-wmf"
62 #define MIMETYPE_SGV "image/x-sgv"
63 #define MIMETYPE_EMF "image/x-emf"
64 #define MIMETYPE_SVG "image/svg+xml"
65 #define MIMETYPE_VCLGRAPHIC "image/x-vclgraphic"
67 using namespace com::sun::star;
69 namespace comphelper { class PropertySetInfo; }
70 namespace com { namespace sun { namespace star { namespace io { class XInputStream; } } } }
72 class Graphic;
74 namespace unographic {
76 // -------------------
77 // - GraphicProvider -
78 // -------------------
80 class GraphicDescriptor : public ::cppu::OWeakAggObject,
81 public ::com::sun::star::lang::XServiceInfo,
82 public ::com::sun::star::lang::XTypeProvider,
83 public ::comphelper::PropertySetHelper
85 public:
87 GraphicDescriptor();
88 ~GraphicDescriptor() throw();
90 void init( const ::Graphic& rGraphic ) throw();
91 void init( const ::rtl::OUString& rURL ) throw();
92 void init( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rxIStm, const ::rtl::OUString& rURL ) throw();
94 bool isValid() const;
96 static ::rtl::OUString getImplementationName_Static() throw();
97 static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static() throw();
99 protected:
101 static ::comphelper::PropertySetInfo* createPropertySetInfo();
103 // XInterface
104 virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
105 virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
106 virtual void SAL_CALL acquire() throw();
107 virtual void SAL_CALL release() throw();
109 // XServiceInfo
110 virtual rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
111 virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName ) throw( ::com::sun::star::uno::RuntimeException );
112 virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException );
114 // XTypeProvider
115 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
116 virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException);
118 // PropertySetHelper
119 virtual void _setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const ::com::sun::star::uno::Any* pValues ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException );
120 virtual void _getPropertyValues( const comphelper::PropertyMapEntry** ppEntries, ::com::sun::star::uno::Any* pValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException );
122 private:
124 const ::Graphic* mpGraphic;
125 GraphicType meType;
126 ::rtl::OUString maMimeType;
127 Size maSizePixel;
128 Size maSize100thMM;
129 USHORT mnBitsPerPixel;
130 bool mbTransparent;
131 bool mbAlpha;
132 bool mbAnimated;
134 GraphicDescriptor( const GraphicDescriptor& rDescriptor );
136 GraphicDescriptor& operator=( const GraphicDescriptor& );
138 void implCreate( SvStream& rIStm, const ::rtl::OUString* pPath );
143 #endif