Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
21 : #define FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
22 :
23 : #include <framework/fwedllapi.h>
24 : #include <tools/string.hxx>
25 : #include <tools/stream.hxx>
26 : #include <tools/color.hxx>
27 :
28 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
29 : #include <com/sun/star/io/XInputStream.hpp>
30 : #include <com/sun/star/io/XOutputStream.hpp>
31 : #include <com/sun/star/uno/XComponentContext.hpp>
32 :
33 : #include <vector>
34 : #include <boost/ptr_container/ptr_vector.hpp>
35 :
36 : namespace framework
37 : {
38 :
39 : enum ImageMaskMode
40 : {
41 : ImageMaskMode_Color,
42 : ImageMaskMode_Bitmap
43 : };
44 :
45 0 : struct ImageItemDescriptor
46 : {
47 0 : ImageItemDescriptor() : nIndex( -1 ) {}
48 :
49 : String aCommandURL; // URL command to dispatch
50 : long nIndex; // index of the bitmap inside the bitmaplist
51 : };
52 :
53 0 : struct ExternalImageItemDescriptor
54 : {
55 : String aCommandURL; // URL command to dispatch
56 : String aURL; // a URL to an external bitmap
57 : };
58 :
59 : typedef boost::ptr_vector<ImageItemDescriptor> ImageItemListDescriptor;
60 :
61 : typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;
62 :
63 : struct ImageListItemDescriptor
64 : {
65 0 : ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ),
66 0 : pImageItemList( 0 ) {}
67 :
68 0 : ~ImageListItemDescriptor() { delete pImageItemList; }
69 :
70 : String aURL; // an URL to a bitmap with several images inside
71 : Color aMaskColor; // a color used as transparent
72 : String aMaskURL; // an URL to an optional bitmap used as a mask
73 : ImageMaskMode nMaskMode; // an enum to describe the current mask mode
74 : ImageItemListDescriptor* pImageItemList; // an array of ImageItemDescriptors that describes every image
75 : String aHighContrastURL; // an URL to an optional high contrast bitmap with serveral images inside
76 : String aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask
77 : };
78 :
79 : typedef boost::ptr_vector<ImageListItemDescriptor> ImageListDescriptor;
80 :
81 : struct ImageListsDescriptor
82 : {
83 0 : ImageListsDescriptor() : pImageList( 0 ),
84 0 : pExternalImageList( 0 ) {}
85 0 : ~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; }
86 :
87 : ImageListDescriptor* pImageList;
88 : ExternalImageItemListDescriptor* pExternalImageList;
89 : };
90 :
91 : class ImagesConfiguration
92 : {
93 : public:
94 : static sal_Bool LoadImages(
95 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
96 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
97 : ImageListsDescriptor& rItems );
98 :
99 : static sal_Bool StoreImages(
100 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
101 : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream,
102 : const ImageListsDescriptor& rItems );
103 : };
104 :
105 : } // namespace framework
106 :
107 : #endif // __FRAMEWORK_CLASSES_IMAGES
108 :
109 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|