1*ebfcd9afSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ebfcd9afSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ebfcd9afSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ebfcd9afSAndrew Rist * distributed with this work for additional information 6*ebfcd9afSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ebfcd9afSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ebfcd9afSAndrew Rist * "License"); you may not use this file except in compliance 9*ebfcd9afSAndrew Rist * with the License. You may obtain a copy of the License at 10*ebfcd9afSAndrew Rist * 11*ebfcd9afSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*ebfcd9afSAndrew Rist * 13*ebfcd9afSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ebfcd9afSAndrew Rist * software distributed under the License is distributed on an 15*ebfcd9afSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ebfcd9afSAndrew Rist * KIND, either express or implied. See the License for the 17*ebfcd9afSAndrew Rist * specific language governing permissions and limitations 18*ebfcd9afSAndrew Rist * under the License. 19*ebfcd9afSAndrew Rist * 20*ebfcd9afSAndrew Rist *************************************************************/ 21*ebfcd9afSAndrew Rist 22*ebfcd9afSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_ 25cdf0e10cSrcweir #define FRAMEWORK_XML_IMAGESCONFIGURATION_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <framework/fwedllapi.h> 28cdf0e10cSrcweir #include <svl/svarray.hxx> 29cdf0e10cSrcweir #include <tools/string.hxx> 30cdf0e10cSrcweir #include <tools/stream.hxx> 31cdf0e10cSrcweir #include <tools/color.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir // #110897# 34cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 35cdf0e10cSrcweir #include <com/sun/star/io/XInputStream.hpp> 36cdf0e10cSrcweir #include <com/sun/star/io/XOutputStream.hpp> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <vector> 39cdf0e10cSrcweir 40cdf0e10cSrcweir namespace framework 41cdf0e10cSrcweir { 42cdf0e10cSrcweir 43cdf0e10cSrcweir enum ImageMaskMode 44cdf0e10cSrcweir { 45cdf0e10cSrcweir ImageMaskMode_Color, 46cdf0e10cSrcweir ImageMaskMode_Bitmap 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir 49cdf0e10cSrcweir struct ImageItemDescriptor 50cdf0e10cSrcweir { ImageItemDescriptorframework::ImageItemDescriptor51cdf0e10cSrcweir ImageItemDescriptor() : nIndex( -1 ) {} 52cdf0e10cSrcweir 53cdf0e10cSrcweir String aCommandURL; // URL command to dispatch 54cdf0e10cSrcweir long nIndex; // index of the bitmap inside the bitmaplist 55cdf0e10cSrcweir }; 56cdf0e10cSrcweir 57cdf0e10cSrcweir struct ExternalImageItemDescriptor 58cdf0e10cSrcweir { 59cdf0e10cSrcweir String aCommandURL; // URL command to dispatch 60cdf0e10cSrcweir String aURL; // a URL to an external bitmap 61cdf0e10cSrcweir }; 62cdf0e10cSrcweir 63cdf0e10cSrcweir typedef ImageItemDescriptor* ImageItemDescriptorPtr; 64cdf0e10cSrcweir SV_DECL_PTRARR_DEL( ImageItemListDescriptor, ImageItemDescriptorPtr, 10, 2) 65cdf0e10cSrcweir 66cdf0e10cSrcweir typedef ExternalImageItemDescriptor* ExternalImageItemDescriptorPtr; 67cdf0e10cSrcweir SV_DECL_PTRARR_DEL( ExternalImageItemListDescriptor, ExternalImageItemDescriptorPtr, 10, 2) 68cdf0e10cSrcweir 69cdf0e10cSrcweir struct ImageListItemDescriptor 70cdf0e10cSrcweir { ImageListItemDescriptorframework::ImageListItemDescriptor71cdf0e10cSrcweir ImageListItemDescriptor() : nMaskMode( ImageMaskMode_Color ), 72cdf0e10cSrcweir pImageItemList( 0 ) {} 73cdf0e10cSrcweir ~ImageListItemDescriptorframework::ImageListItemDescriptor74cdf0e10cSrcweir ~ImageListItemDescriptor() { delete pImageItemList; } 75cdf0e10cSrcweir 76cdf0e10cSrcweir String aURL; // an URL to a bitmap with several images inside 77cdf0e10cSrcweir Color aMaskColor; // a color used as transparent 78cdf0e10cSrcweir String aMaskURL; // an URL to an optional bitmap used as a mask 79cdf0e10cSrcweir ImageMaskMode nMaskMode; // an enum to describe the current mask mode 80cdf0e10cSrcweir ImageItemListDescriptor* pImageItemList; // an array of ImageItemDescriptors that describes every image 81cdf0e10cSrcweir String aHighContrastURL; // an URL to an optional high contrast bitmap with serveral images inside 82cdf0e10cSrcweir String aHighContrastMaskURL; // an URL to an optional high contrast bitmap as a mask 83cdf0e10cSrcweir }; 84cdf0e10cSrcweir 85cdf0e10cSrcweir typedef ImageListItemDescriptor* ImageListItemDescriptorPtr; 86cdf0e10cSrcweir SV_DECL_PTRARR_DEL( ImageListDescriptor, ImageListItemDescriptorPtr, 10, 2) 87cdf0e10cSrcweir 88cdf0e10cSrcweir struct ImageListsDescriptor 89cdf0e10cSrcweir { ImageListsDescriptorframework::ImageListsDescriptor90cdf0e10cSrcweir ImageListsDescriptor() : pImageList( 0 ), 91cdf0e10cSrcweir pExternalImageList( 0 ) {} ~ImageListsDescriptorframework::ImageListsDescriptor92cdf0e10cSrcweir ~ImageListsDescriptor() { delete pImageList; delete pExternalImageList; } 93cdf0e10cSrcweir 94cdf0e10cSrcweir ImageListDescriptor* pImageList; 95cdf0e10cSrcweir ExternalImageItemListDescriptor* pExternalImageList; 96cdf0e10cSrcweir }; 97cdf0e10cSrcweir 98cdf0e10cSrcweir class ImagesConfiguration 99cdf0e10cSrcweir { 100cdf0e10cSrcweir public: 101cdf0e10cSrcweir // #110897# 102cdf0e10cSrcweir static sal_Bool LoadImages( 103cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, 104cdf0e10cSrcweir SvStream& rInStream, ImageListsDescriptor& aItems ); 105cdf0e10cSrcweir 106cdf0e10cSrcweir // #110897# 107cdf0e10cSrcweir static sal_Bool StoreImages( 108cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, 109cdf0e10cSrcweir SvStream& rOutStream, const ImageListsDescriptor& aItems ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir static sal_Bool LoadImages( 112cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, 113cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& rInputStream, 114cdf0e10cSrcweir ImageListsDescriptor& rItems ); 115cdf0e10cSrcweir 116cdf0e10cSrcweir static sal_Bool StoreImages( 117cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, 118cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& rOutputStream, 119cdf0e10cSrcweir const ImageListsDescriptor& rItems ); 120cdf0e10cSrcweir }; 121cdf0e10cSrcweir 122cdf0e10cSrcweir } // namespace framework 123cdf0e10cSrcweir 124cdf0e10cSrcweir #endif // __FRAMEWORK_CLASSES_IMAGES 125