Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
30 : : #define FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_
31 : :
32 : : #include <framework/fwedllapi.h>
33 : : #include <tools/string.hxx>
34 : : #include <tools/stream.hxx>
35 : : #include <tools/color.hxx>
36 : :
37 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 : : #include <com/sun/star/io/XInputStream.hpp>
39 : : #include <com/sun/star/io/XOutputStream.hpp>
40 : :
41 : : #include <vector>
42 : : #include <boost/ptr_container/ptr_vector.hpp>
43 : :
44 : : namespace framework
45 : : {
46 : :
47 : : enum ImageMaskMode
48 : : {
49 : : ImageMaskMode_Color,
50 : : ImageMaskMode_Bitmap
51 : : };
52 : :
53 : 0 : struct ImageItemDescriptor
54 : : {
55 : 0 : ImageItemDescriptor() : nIndex( -1 ) {}
56 : :
57 : : String aCommandURL; // URL command to dispatch
58 : : long nIndex; // index of the bitmap inside the bitmaplist
59 : : };
60 : :
61 [ # # ][ # # ]: 0 : struct ExternalImageItemDescriptor
62 : : {
63 : : String aCommandURL; // URL command to dispatch
64 : : String aURL; // a URL to an external bitmap
65 : : };
66 : :
67 : : typedef boost::ptr_vector<ImageItemDescriptor> ImageItemListDescriptor;
68 : :
69 : : typedef boost::ptr_vector<ExternalImageItemDescriptor> ExternalImageItemListDescriptor;
70 : :
71 : : struct ImageListItemDescriptor
72 : : {
73 : 0 : ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ),
74 [ # # ][ # # ]: 0 : pImageItemList( 0 ) {}
[ # # ]
75 : :
76 [ # # ][ # # ]: 0 : ~ImageListItemDescriptor() { delete pImageItemList; }
[ # # ][ # # ]
[ # # ]
77 : :
78 : : String aURL; // an URL to a bitmap with several images inside
79 : : Color aMaskColor; // a color used as transparent
80 : : String aMaskURL; // an URL to an optional bitmap used as a mask
81 : : ImageMaskMode nMaskMode; // an enum to describe the current mask mode
82 : : ImageItemListDescriptor* pImageItemList; // an array of ImageItemDescriptors that describes every image
83 : : String aHighContrastURL; // an URL to an optional high contrast bitmap with serveral images inside
84 : : String aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask
85 : : };
86 : :
87 : : typedef boost::ptr_vector<ImageListItemDescriptor> ImageListDescriptor;
88 : :
89 : : struct ImageListsDescriptor
90 : : {
91 : 0 : ImageListsDescriptor() : pImageList( 0 ),
92 : 0 : pExternalImageList( 0 ) {}
93 [ # # ][ # # ]: 0 : ~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; }
94 : :
95 : : ImageListDescriptor* pImageList;
96 : : ExternalImageItemListDescriptor* pExternalImageList;
97 : : };
98 : :
99 : : class ImagesConfiguration
100 : : {
101 : : public:
102 : : static sal_Bool LoadImages(
103 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
104 : : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream,
105 : : ImageListsDescriptor& rItems );
106 : :
107 : : static sal_Bool StoreImages(
108 : : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
109 : : const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream,
110 : : const ImageListsDescriptor& rItems );
111 : : };
112 : :
113 : : } // namespace framework
114 : :
115 : : #endif // __FRAMEWORK_CLASSES_IMAGES
116 : :
117 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|