2010-10-27 06:30:13 -05:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2007-07-24 04:00:00 -05:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 01:37:25 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
2010-02-12 08:01:35 -06:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
2008-04-11 01:37:25 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
2008-04-11 01:37:25 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
2008-04-11 01:37:25 -05:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
2008-04-11 01:37:25 -05:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
2008-04-11 01:37:25 -05:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-07-24 04:00:00 -05:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
#ifndef _SV_IMAGE_H
|
|
|
|
#define _SV_IMAGE_H
|
|
|
|
|
|
|
|
#include <vcl/bitmapex.hxx>
|
|
|
|
|
2011-02-03 17:55:17 -06:00
|
|
|
#include <boost/unordered_map.hpp>
|
2007-07-24 04:00:00 -05:00
|
|
|
|
|
|
|
// ----------------
|
|
|
|
// - ImplImageBmp -
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
class ImplImageBmp
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ImplImageBmp();
|
|
|
|
~ImplImageBmp();
|
|
|
|
|
2010-09-29 02:46:40 -05:00
|
|
|
void Create( const BitmapEx& rBmpEx, long nItemWidth, long nItemHeight,sal_uInt16 nInitSize );
|
2011-02-01 23:39:29 -06:00
|
|
|
void ColorTransform();
|
2010-09-29 02:46:40 -05:00
|
|
|
void Draw( sal_uInt16 nPos, OutputDevice* pDev, const Point& rPos, sal_uInt16 nStyle, const Size* pSize = NULL );
|
2007-07-24 04:00:00 -05:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
BitmapEx maBmpEx;
|
2008-07-04 11:22:51 -05:00
|
|
|
BitmapEx maDisabledBmpEx;
|
2007-07-24 04:00:00 -05:00
|
|
|
BitmapEx* mpDisplayBmp;
|
|
|
|
Size maSize;
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uInt8* mpInfoAry;
|
|
|
|
sal_uInt16 mnSize;
|
2007-07-24 04:00:00 -05:00
|
|
|
|
|
|
|
void ImplUpdateDisplayBmp( OutputDevice* pOutDev );
|
2008-07-04 11:22:51 -05:00
|
|
|
void ImplUpdateDisabledBmpEx( int nPos );
|
2007-07-24 04:00:00 -05:00
|
|
|
|
|
|
|
private: // prevent assignment and copy construction
|
|
|
|
ImplImageBmp( const ImplImageBmp& );
|
|
|
|
void operator=( const ImplImageBmp& );
|
|
|
|
};
|
|
|
|
|
|
|
|
// --------------
|
|
|
|
// - ImageTypes -
|
|
|
|
// --------------
|
|
|
|
|
|
|
|
enum ImageType { IMAGETYPE_BITMAP, IMAGETYPE_IMAGE };
|
|
|
|
|
|
|
|
// -----------------
|
|
|
|
// - ImplImageList -
|
|
|
|
// -----------------
|
|
|
|
|
|
|
|
struct ImageAryData
|
|
|
|
{
|
|
|
|
::rtl::OUString maName;
|
|
|
|
// Images identified by either name, or by id
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uInt16 mnId;
|
2007-07-24 04:00:00 -05:00
|
|
|
BitmapEx maBitmapEx;
|
|
|
|
|
|
|
|
ImageAryData( const rtl::OUString &aName,
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uInt16 nId, const BitmapEx &aBitmap );
|
2007-07-24 04:00:00 -05:00
|
|
|
ImageAryData( const ImageAryData& rData );
|
|
|
|
~ImageAryData();
|
|
|
|
|
|
|
|
bool IsLoadable() { return maBitmapEx.IsEmpty() && maName.getLength(); }
|
|
|
|
void Load(const rtl::OUString &rPrefix);
|
|
|
|
|
|
|
|
ImageAryData& operator=( const ImageAryData& rData );
|
|
|
|
};
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
struct ImplImageList
|
|
|
|
{
|
|
|
|
typedef std::vector<ImageAryData *> ImageAryDataVec;
|
2011-02-03 17:55:17 -06:00
|
|
|
typedef boost::unordered_map< rtl::OUString, ImageAryData *, rtl::OUStringHash >
|
2007-07-24 04:00:00 -05:00
|
|
|
ImageAryDataNameHash;
|
|
|
|
|
|
|
|
ImageAryDataVec maImages;
|
|
|
|
ImageAryDataNameHash maNameHash;
|
|
|
|
rtl::OUString maPrefix;
|
|
|
|
Size maImageSize;
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uIntPtr mnRefCount;
|
2007-07-24 04:00:00 -05:00
|
|
|
|
|
|
|
ImplImageList();
|
|
|
|
ImplImageList( const ImplImageList &aSrc );
|
|
|
|
~ImplImageList();
|
|
|
|
|
|
|
|
void AddImage( const ::rtl::OUString &aName,
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uInt16 nId, const BitmapEx &aBitmapEx );
|
|
|
|
void RemoveImage( sal_uInt16 nPos );
|
|
|
|
sal_uInt16 GetImageCount() const;
|
2007-07-24 04:00:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// --------------------
|
|
|
|
// - ImplImageRefData -
|
|
|
|
// --------------------
|
|
|
|
|
|
|
|
struct ImplImageRefData
|
|
|
|
{
|
|
|
|
ImplImageList* mpImplData;
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uInt16 mnIndex;
|
2007-07-24 04:00:00 -05:00
|
|
|
|
|
|
|
ImplImageRefData() {} // Um Warning zu umgehen
|
|
|
|
~ImplImageRefData();
|
|
|
|
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_Bool IsEqual( const ImplImageRefData& rData );
|
2007-07-24 04:00:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------
|
|
|
|
// - ImpImageData -
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
struct ImplImageData
|
|
|
|
{
|
|
|
|
ImplImageBmp* mpImageBitmap;
|
|
|
|
BitmapEx maBmpEx;
|
|
|
|
|
|
|
|
ImplImageData( const BitmapEx& rBmpEx );
|
|
|
|
~ImplImageData();
|
|
|
|
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_Bool IsEqual( const ImplImageData& rData );
|
2007-07-24 04:00:00 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
// -------------
|
|
|
|
// - ImplImage -
|
|
|
|
// -------------
|
|
|
|
|
|
|
|
struct ImplImage
|
|
|
|
{
|
2010-09-29 02:46:40 -05:00
|
|
|
sal_uIntPtr mnRefCount;
|
2007-07-24 04:00:00 -05:00
|
|
|
// TODO: use inheritance to get rid of meType+mpData
|
|
|
|
void* mpData;
|
|
|
|
ImageType meType;
|
|
|
|
|
|
|
|
ImplImage();
|
|
|
|
~ImplImage();
|
|
|
|
|
|
|
|
private: // prevent assignment and copy construction
|
|
|
|
ImplImage( const ImplImage&);
|
|
|
|
void operator=( const ImplImage&);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _SV_IMAGE_H
|
2010-10-27 06:30:13 -05:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|