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 #ifndef INCLUDED_FRAMEWORK_INC_XML_IMAGESCONFIGURATION_HXX
21 #define INCLUDED_FRAMEWORK_INC_XML_IMAGESCONFIGURATION_HXX
23 #include <framework/fwedllapi.h>
24 #include <tools/stream.hxx>
25 #include <tools/color.hxx>
27 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
28 #include <com/sun/star/io/XInputStream.hpp>
29 #include <com/sun/star/io/XOutputStream.hpp>
30 #include <com/sun/star/uno/XComponentContext.hpp>
33 #include <boost/ptr_container/ptr_vector.hpp>
44 struct ImageItemDescriptor
46 ImageItemDescriptor() : nIndex( -1 ) {}
48 OUString aCommandURL
; // URL command to dispatch
49 long nIndex
; // index of the bitmap inside the bitmaplist
52 struct ExternalImageItemDescriptor
54 OUString aCommandURL
; // URL command to dispatch
55 OUString aURL
; // a URL to an external bitmap
58 typedef boost::ptr_vector
<ImageItemDescriptor
> ImageItemListDescriptor
;
60 typedef boost::ptr_vector
<ExternalImageItemDescriptor
> ExternalImageItemListDescriptor
;
62 struct ImageListItemDescriptor
64 ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color
),
65 pImageItemList( 0 ) {}
67 ~ImageListItemDescriptor() { delete pImageItemList
; }
69 OUString aURL
; // an URL to a bitmap with several images inside
70 Color aMaskColor
; // a color used as transparent
71 OUString aMaskURL
; // an URL to an optional bitmap used as a mask
72 ImageMaskMode nMaskMode
; // an enum to describe the current mask mode
73 ImageItemListDescriptor
* pImageItemList
; // an array of ImageItemDescriptors that describes every image
74 OUString aHighContrastURL
; // an URL to an optional high contrast bitmap with serveral images inside
75 OUString aHighContrastMaskURL
; // an URL to an optional high contrast bitmap as a mask
78 typedef boost::ptr_vector
<ImageListItemDescriptor
> ImageListDescriptor
;
80 struct ImageListsDescriptor
82 ImageListsDescriptor() : pImageList( 0 ),
83 pExternalImageList( 0 ) {}
84 ~ImageListsDescriptor() { delete pImageList
; delete pExternalImageList
; }
86 ImageListDescriptor
* pImageList
;
87 ExternalImageItemListDescriptor
* pExternalImageList
;
90 class ImagesConfiguration
93 static bool LoadImages(
94 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
95 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XInputStream
>& rInputStream
,
96 ImageListsDescriptor
& rItems
);
98 static bool StoreImages(
99 const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
100 const ::com::sun::star::uno::Reference
< ::com::sun::star::io::XOutputStream
>& rOutputStream
,
101 const ImageListsDescriptor
& rItems
);
104 } // namespace framework
106 #endif // __FRAMEWORK_CLASSES_IMAGES
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */