2003-11-11 11:18:54 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* $RCSfile: PropertyHelper.hxx,v $
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2007-05-22 17:21:03 +00:00
|
|
|
* $Revision: 1.4 $
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2007-05-22 17:21:03 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2007-05-22 18:21:03 $
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2005 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* This library 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 for more details.
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
2005-09-07 23:45:16 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
2003-11-11 11:18:54 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2003-12-11 08:36:26 +00:00
|
|
|
#ifndef CHART_PROPERTYHELPER_HXX
|
|
|
|
#define CHART_PROPERTYHELPER_HXX
|
2003-11-11 11:18:54 +00:00
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#endif
|
2003-12-11 08:36:26 +00:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTY_HPP_
|
|
|
|
#include <com/sun/star/beans/Property.hpp>
|
|
|
|
#endif
|
2007-05-22 17:21:03 +00:00
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyValue.hpp>
|
|
|
|
#endif
|
2003-12-11 08:36:26 +00:00
|
|
|
#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
|
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
#endif
|
2007-05-22 17:21:03 +00:00
|
|
|
#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
|
|
|
|
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
|
|
|
#endif
|
2003-12-11 08:36:26 +00:00
|
|
|
|
|
|
|
#include <map>
|
2003-11-11 11:18:54 +00:00
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
|
|
|
|
class PropertyHelper
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void copyProperties(
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::beans::XPropertySet > & xSource,
|
2007-05-22 17:21:03 +00:00
|
|
|
const ::com::sun::star::uno::Reference<
|
2003-11-11 11:18:54 +00:00
|
|
|
::com::sun::star::beans::XPropertySet > & xDestination
|
|
|
|
);
|
|
|
|
|
2007-05-22 17:21:03 +00:00
|
|
|
/** adds a line dash with a unique name to the gradient obtained by the given
|
|
|
|
factory.
|
|
|
|
|
|
|
|
@return The name used for storing this element in the table
|
|
|
|
*/
|
|
|
|
static ::rtl::OUString addLineDashUniqueNameToTable(
|
|
|
|
const ::com::sun::star::uno::Any & rValue,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::lang::XMultiServiceFactory > & xFact,
|
|
|
|
const ::rtl::OUString & rPreferredName );
|
|
|
|
|
|
|
|
/** adds a gradient with a unique name to the gradient obtained by the given
|
|
|
|
factory.
|
|
|
|
|
|
|
|
@return The name used for storing this element in the table
|
|
|
|
*/
|
|
|
|
static ::rtl::OUString addGradientUniqueNameToTable(
|
|
|
|
const ::com::sun::star::uno::Any & rValue,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::lang::XMultiServiceFactory > & xFact,
|
|
|
|
const ::rtl::OUString & rPreferredName );
|
|
|
|
|
|
|
|
/** adds a transparency gradient with a unique name to the gradient obtained
|
|
|
|
by the given factory.
|
|
|
|
|
|
|
|
@return The name used for storing this element in the table
|
|
|
|
*/
|
|
|
|
static ::rtl::OUString addTransparencyGradientUniqueNameToTable(
|
|
|
|
const ::com::sun::star::uno::Any & rValue,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::lang::XMultiServiceFactory > & xFact,
|
|
|
|
const ::rtl::OUString & rPreferredName );
|
|
|
|
|
|
|
|
/** adds a hatch with a unique name to the gradient obtained by the given
|
|
|
|
factory.
|
|
|
|
|
|
|
|
@return The name used for storing this element in the table
|
|
|
|
*/
|
|
|
|
static ::rtl::OUString addHatchUniqueNameToTable(
|
|
|
|
const ::com::sun::star::uno::Any & rValue,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::lang::XMultiServiceFactory > & xFact,
|
|
|
|
const ::rtl::OUString & rPreferredName );
|
|
|
|
|
|
|
|
/** adds a bitmap with a unique name to the gradient obtained by the given
|
|
|
|
factory.
|
|
|
|
|
|
|
|
@return The name used for storing this element in the table
|
|
|
|
*/
|
|
|
|
static ::rtl::OUString addBitmapUniqueNameToTable(
|
|
|
|
const ::com::sun::star::uno::Any & rValue,
|
|
|
|
const ::com::sun::star::uno::Reference<
|
|
|
|
::com::sun::star::lang::XMultiServiceFactory > & xFact,
|
|
|
|
const ::rtl::OUString & rPreferredName );
|
|
|
|
|
2003-11-11 11:18:54 +00:00
|
|
|
private:
|
|
|
|
// not implemented
|
|
|
|
PropertyHelper();
|
|
|
|
};
|
|
|
|
|
2003-12-11 08:36:26 +00:00
|
|
|
struct PropertyNameLess
|
|
|
|
{
|
|
|
|
inline bool operator() ( const ::com::sun::star::beans::Property & first,
|
|
|
|
const ::com::sun::star::beans::Property & second )
|
|
|
|
{
|
|
|
|
return ( first.Name.compareTo( second.Name ) < 0 );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2007-05-22 17:21:03 +00:00
|
|
|
struct PropertyLess : public ::std::binary_function<
|
|
|
|
::com::sun::star::beans::Property,
|
|
|
|
::com::sun::star::beans::Property,
|
|
|
|
bool >
|
|
|
|
{
|
|
|
|
bool operator() ( const ::com::sun::star::beans::Property & rFirst,
|
|
|
|
const ::com::sun::star::beans::Property & rSecond )
|
|
|
|
{
|
|
|
|
return ( rFirst.Name.compareTo( rSecond.Name ) < 0 );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PropertyValueNameEquals : public ::std::unary_function< ::com::sun::star::beans::PropertyValue, bool >
|
|
|
|
{
|
|
|
|
explicit PropertyValueNameEquals( const ::rtl::OUString & rName ) :
|
|
|
|
m_aName( rName )
|
|
|
|
{}
|
|
|
|
|
|
|
|
bool operator() ( const ::com::sun::star::beans::PropertyValue & rPropValue )
|
|
|
|
{
|
|
|
|
return rPropValue.Name.equals( m_aName );
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
::rtl::OUString m_aName;
|
|
|
|
};
|
|
|
|
|
2003-12-11 08:36:26 +00:00
|
|
|
typedef ::std::map< sal_Int32, ::com::sun::star::uno::Any >
|
|
|
|
tPropertyValueMap;
|
|
|
|
|
2003-11-11 11:18:54 +00:00
|
|
|
} // namespace chart
|
|
|
|
|
2003-12-11 08:36:26 +00:00
|
|
|
// CHART_PROPERTYHELPER_HXX
|
2003-11-11 11:18:54 +00:00
|
|
|
#endif
|