2003-12-18 12:50:56 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2005-09-07 23:02:37 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2003-12-18 12:50:56 +00:00
|
|
|
*
|
2005-09-07 23:02:37 +00:00
|
|
|
* $RCSfile: LegendWrapper.cxx,v $
|
2003-12-18 12:50:56 +00:00
|
|
|
*
|
2007-05-22 16:18:34 +00:00
|
|
|
* $Revision: 1.5 $
|
2003-12-18 12:50:56 +00:00
|
|
|
*
|
2007-05-22 16:18:34 +00:00
|
|
|
* last change: $Author: vg $ $Date: 2007-05-22 17:18:34 $
|
2003-12-18 12:50:56 +00:00
|
|
|
*
|
2005-09-07 23:02:37 +00:00
|
|
|
* The Contents of this file are made available subject to
|
|
|
|
* the terms of GNU Lesser General Public License Version 2.1.
|
2003-12-18 12:50:56 +00:00
|
|
|
*
|
|
|
|
*
|
2005-09-07 23:02:37 +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-12-18 12:50:56 +00:00
|
|
|
*
|
2005-09-07 23:02:37 +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-12-18 12:50:56 +00:00
|
|
|
*
|
2005-09-07 23:02:37 +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-12-18 12:50:56 +00:00
|
|
|
*
|
2005-09-07 23:02:37 +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-12-18 12:50:56 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
2006-09-17 11:56:32 +00:00
|
|
|
|
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_chart2.hxx"
|
2003-12-18 12:50:56 +00:00
|
|
|
#include "LegendWrapper.hxx"
|
|
|
|
#include "macros.hxx"
|
2007-05-22 16:18:34 +00:00
|
|
|
#include "Chart2ModelContact.hxx"
|
|
|
|
#include "LegendHelper.hxx"
|
|
|
|
#include "ContainerHelper.hxx"
|
|
|
|
|
|
|
|
#ifndef INCLUDED_COMPHELPER_INLINE_CONTAINER_HXX
|
|
|
|
#include <comphelper/InlineContainer.hxx>
|
|
|
|
#endif
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#endif
|
2004-01-26 08:13:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CHART2_XTITLED_HPP_
|
|
|
|
#include <com/sun/star/chart2/XTitled.hpp>
|
2003-12-18 12:50:56 +00:00
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_CHART_CHARTLEGENDPOSITION_HPP_
|
|
|
|
#include <com/sun/star/chart/ChartLegendPosition.hpp>
|
|
|
|
#endif
|
2004-01-26 08:13:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CHART2_LEGENDPOSITION_HPP_
|
|
|
|
#include <com/sun/star/chart2/LegendPosition.hpp>
|
2003-12-18 12:50:56 +00:00
|
|
|
#endif
|
2004-01-26 08:13:31 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CHART2_LEGENDEXPANSION_HPP_
|
|
|
|
#include <com/sun/star/chart2/LegendExpansion.hpp>
|
2003-12-18 12:50:56 +00:00
|
|
|
#endif
|
2007-05-22 16:18:34 +00:00
|
|
|
#ifndef _COM_SUN_STAR_CHART2_RELATIVEPOSITION_HPP_
|
|
|
|
#include <com/sun/star/chart2/RelativePosition.hpp>
|
|
|
|
#endif
|
|
|
|
#ifndef _COM_SUN_STAR_DRAWING_FILLSTYLE_HPP_
|
|
|
|
#include <com/sun/star/drawing/FillStyle.hpp>
|
|
|
|
#endif
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#include "CharacterProperties.hxx"
|
|
|
|
#include "LineProperties.hxx"
|
|
|
|
#include "FillProperties.hxx"
|
|
|
|
#include "UserDefinedProperties.hxx"
|
2007-05-22 16:18:34 +00:00
|
|
|
// #include "NamedProperties.hxx"
|
|
|
|
// #include "WrappedNamedProperty.hxx"
|
|
|
|
#include "WrappedCharacterHeightProperty.hxx"
|
|
|
|
#include "PositionAndSizeHelper.hxx"
|
|
|
|
#include "WrappedDirectStateProperty.hxx"
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
#ifndef _RTL_USTRBUF_HXX_
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using ::com::sun::star::beans::Property;
|
|
|
|
using ::osl::MutexGuard;
|
2007-05-22 16:18:34 +00:00
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
namespace chart
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
class WrappedLegendAlignmentProperty : public WrappedProperty
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
WrappedLegendAlignmentProperty();
|
|
|
|
virtual ~WrappedLegendAlignmentProperty();
|
|
|
|
|
|
|
|
virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
|
|
|
|
virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
|
|
|
|
virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
|
2003-12-18 12:50:56 +00:00
|
|
|
};
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty()
|
|
|
|
: ::chart::WrappedProperty( C2U( "Alignment" ), C2U( "AnchorPosition" ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
WrappedLegendAlignmentProperty::~WrappedLegendAlignmentProperty()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Any WrappedLegendAlignmentProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
Any aRet;
|
|
|
|
if( xInnerPropertySet.is() )
|
|
|
|
{
|
|
|
|
sal_Bool bShowLegend = sal_True;
|
|
|
|
xInnerPropertySet->getPropertyValue( C2U( "Show" ) ) >>= bShowLegend;
|
|
|
|
if(!bShowLegend)
|
|
|
|
{
|
|
|
|
aRet = uno::makeAny( ::com::sun::star::chart::ChartLegendPosition_NONE );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
|
|
|
|
aRet = this->convertInnerToOuterValue( aRet );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void WrappedLegendAlignmentProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
if(xInnerPropertySet.is())
|
|
|
|
{
|
|
|
|
sal_Bool bNewShowLegend = sal_True;
|
|
|
|
sal_Bool bOldShowLegend = sal_True;
|
|
|
|
{
|
|
|
|
::com::sun::star::chart::ChartLegendPosition eOuterPos;
|
|
|
|
if( (rOuterValue >>= eOuterPos) && eOuterPos == ::com::sun::star::chart::ChartLegendPosition_NONE )
|
|
|
|
bNewShowLegend = sal_False;
|
|
|
|
xInnerPropertySet->getPropertyValue( C2U( "Show" ) ) >>= bOldShowLegend;
|
|
|
|
}
|
|
|
|
if(bNewShowLegend!=bOldShowLegend)
|
|
|
|
{
|
|
|
|
xInnerPropertySet->setPropertyValue( C2U( "Show" ), uno::makeAny(bNewShowLegend) );
|
|
|
|
}
|
|
|
|
if(!bNewShowLegend)
|
|
|
|
return;
|
|
|
|
|
|
|
|
//set corresponding LegendPosition
|
|
|
|
Any aInnerValue = this->convertOuterToInnerValue( rOuterValue );
|
|
|
|
xInnerPropertySet->setPropertyValue( m_aInnerName, aInnerValue );
|
|
|
|
|
|
|
|
//correct LegendExpansion
|
|
|
|
chart2::LegendPosition eNewInnerPos;
|
|
|
|
if( aInnerValue >>= eNewInnerPos )
|
|
|
|
{
|
|
|
|
chart2::LegendExpansion eNewExpansion = chart2::LegendExpansion_WIDE;
|
|
|
|
if( eNewInnerPos == chart2::LegendPosition_LINE_END || eNewInnerPos == chart2::LegendPosition_LINE_START )
|
|
|
|
eNewExpansion = chart2::LegendExpansion_HIGH;
|
|
|
|
|
|
|
|
chart2::LegendExpansion eOldExpansion;
|
|
|
|
xInnerPropertySet->getPropertyValue( C2U( "Expansion" ) ) >>= eOldExpansion;
|
|
|
|
|
|
|
|
if(eOldExpansion != eNewExpansion)
|
|
|
|
xInnerPropertySet->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eNewExpansion ));
|
|
|
|
}
|
|
|
|
|
|
|
|
//correct RelativePosition
|
|
|
|
Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
|
|
|
|
if(aRelativePosition.hasValue())
|
|
|
|
{
|
|
|
|
xInnerPropertySet->setPropertyValue( C2U( "RelativePosition" ), Any() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Any WrappedLegendAlignmentProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
|
|
|
|
{
|
|
|
|
::com::sun::star::chart::ChartLegendPosition ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
|
|
|
|
|
|
|
|
chart2::LegendPosition eNewPos;
|
|
|
|
if( rInnerValue >>= eNewPos )
|
|
|
|
{
|
|
|
|
switch( eNewPos )
|
|
|
|
{
|
|
|
|
case chart2::LegendPosition_LINE_START:
|
|
|
|
ePos = ::com::sun::star::chart::ChartLegendPosition_LEFT;
|
|
|
|
break;
|
|
|
|
case chart2::LegendPosition_LINE_END:
|
|
|
|
ePos = ::com::sun::star::chart::ChartLegendPosition_RIGHT;
|
|
|
|
break;
|
|
|
|
case chart2::LegendPosition_PAGE_START:
|
|
|
|
ePos = ::com::sun::star::chart::ChartLegendPosition_TOP;
|
|
|
|
break;
|
|
|
|
case chart2::LegendPosition_PAGE_END:
|
|
|
|
ePos = ::com::sun::star::chart::ChartLegendPosition_BOTTOM;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return uno::makeAny( ePos );
|
|
|
|
}
|
|
|
|
Any WrappedLegendAlignmentProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
|
|
|
|
{
|
|
|
|
chart2::LegendPosition eNewPos = chart2::LegendPosition_LINE_END;
|
|
|
|
|
|
|
|
::com::sun::star::chart::ChartLegendPosition ePos;
|
|
|
|
if( rOuterValue >>= ePos )
|
|
|
|
{
|
|
|
|
switch( ePos )
|
|
|
|
{
|
|
|
|
case ::com::sun::star::chart::ChartLegendPosition_LEFT:
|
|
|
|
eNewPos = chart2::LegendPosition_LINE_START;
|
|
|
|
break;
|
|
|
|
case ::com::sun::star::chart::ChartLegendPosition_RIGHT:
|
|
|
|
eNewPos = chart2::LegendPosition_LINE_END;
|
|
|
|
break;
|
|
|
|
case ::com::sun::star::chart::ChartLegendPosition_TOP:
|
|
|
|
eNewPos = chart2::LegendPosition_PAGE_START;
|
|
|
|
break;
|
|
|
|
case ::com::sun::star::chart::ChartLegendPosition_BOTTOM:
|
|
|
|
eNewPos = chart2::LegendPosition_PAGE_END;
|
|
|
|
break;
|
|
|
|
default: // NONE
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return uno::makeAny( eNewPos );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
namespace
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
static const ::rtl::OUString lcl_aServiceName(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Legend" ));
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_LEGEND_ALIGNMENT
|
2003-12-18 12:50:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void lcl_AddPropertiesToVector(
|
|
|
|
::std::vector< Property > & rOutProperties )
|
|
|
|
{
|
|
|
|
rOutProperties.push_back(
|
|
|
|
Property( C2U( "Alignment" ),
|
|
|
|
PROP_LEGEND_ALIGNMENT,
|
|
|
|
::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendPosition * >(0)),
|
|
|
|
beans::PropertyAttribute::BOUND
|
|
|
|
| beans::PropertyAttribute::MAYBEDEFAULT ));
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
const Sequence< Property > & lcl_GetPropertySequence()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
static Sequence< Property > aPropSeq;
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
// /--
|
|
|
|
MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
|
|
|
|
if( 0 == aPropSeq.getLength() )
|
|
|
|
{
|
|
|
|
// get properties
|
|
|
|
::std::vector< ::com::sun::star::beans::Property > aProperties;
|
|
|
|
lcl_AddPropertiesToVector( aProperties );
|
2007-05-22 16:18:34 +00:00
|
|
|
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
|
|
|
|
::chart::LineProperties::AddPropertiesToVector( aProperties );
|
|
|
|
::chart::FillProperties::AddPropertiesToVector( aProperties );
|
|
|
|
// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
|
|
|
|
|
|
|
|
// and sort them for access via bsearch
|
|
|
|
::std::sort( aProperties.begin(), aProperties.end(),
|
2007-05-22 16:18:34 +00:00
|
|
|
::chart::PropertyNameLess() );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
// transfer result to static Sequence
|
2007-05-22 16:18:34 +00:00
|
|
|
aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aPropSeq;
|
|
|
|
}
|
|
|
|
} // anonymous namespace
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
// --------------------------------------------------------------------------------
|
2003-12-18 12:50:56 +00:00
|
|
|
// --------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
namespace wrapper
|
|
|
|
{
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
LegendWrapper::LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
|
|
|
|
m_spChart2ModelContact( spChart2ModelContact ),
|
|
|
|
m_aEventListenerContainer( m_aMutex )
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
LegendWrapper::~LegendWrapper()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XShape ____
|
|
|
|
awt::Point SAL_CALL LegendWrapper::getPosition()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
return m_spChart2ModelContact->GetLegendPosition();
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL LegendWrapper::setPosition( const awt::Point& aPosition )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
|
|
|
|
if( xProp.is() )
|
|
|
|
{
|
|
|
|
awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
|
|
|
|
|
|
|
|
chart2::RelativePosition aRelativePosition;
|
|
|
|
aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
|
|
|
|
aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
|
|
|
|
aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
|
|
|
|
xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
awt::Size SAL_CALL LegendWrapper::getSize()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
return m_spChart2ModelContact->GetLegendSize();
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL LegendWrapper::setSize( const awt::Size& aSize )
|
|
|
|
throw (beans::PropertyVetoException,
|
|
|
|
uno::RuntimeException)
|
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
|
|
|
|
if( xProp.is() )
|
|
|
|
{
|
|
|
|
awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
|
|
|
|
awt::Rectangle aPageRectangle( 0,0,aPageSize.Width,aPageSize.Height);
|
|
|
|
|
|
|
|
awt::Point aPos( this->getPosition() );
|
|
|
|
awt::Rectangle aNewPositionAndSize(aPos.X,aPos.Y,aSize.Width,aSize.Height);
|
|
|
|
|
|
|
|
PositionAndSizeHelper::moveObject( OBJECTTYPE_LEGEND
|
|
|
|
, xProp, aNewPositionAndSize, aPageRectangle );
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XShapeDescriptor (base of XShape) ____
|
|
|
|
::rtl::OUString SAL_CALL LegendWrapper::getShapeType()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return C2U( "com.sun.star.chart.ChartLegend" );
|
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XComponent ____
|
|
|
|
void SAL_CALL LegendWrapper::dispose()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
|
|
|
|
m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
// /--
|
|
|
|
MutexGuard aGuard( GetMutex());
|
2007-05-22 16:18:34 +00:00
|
|
|
clearWrappedPropertySet();
|
2003-12-18 12:50:56 +00:00
|
|
|
// \--
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL LegendWrapper::addEventListener(
|
2007-05-22 16:18:34 +00:00
|
|
|
const Reference< lang::XEventListener >& xListener )
|
2003-12-18 12:50:56 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
m_aEventListenerContainer.addInterface( xListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL LegendWrapper::removeEventListener(
|
2007-05-22 16:18:34 +00:00
|
|
|
const Reference< lang::XEventListener >& aListener )
|
2003-12-18 12:50:56 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
m_aEventListenerContainer.removeInterface( aListener );
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
// ================================================================================
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
//ReferenceSizePropertyProvider
|
|
|
|
void LegendWrapper::setCurrentSizeAsReference()
|
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xProp.is() )
|
|
|
|
xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
|
|
|
|
m_spChart2ModelContact->GetPageSize() ));
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
2007-05-22 16:18:34 +00:00
|
|
|
Any LegendWrapper::getReferenceSize()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
Any aRet;
|
|
|
|
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xProp.is() )
|
|
|
|
aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
return aRet;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
2007-05-22 16:18:34 +00:00
|
|
|
awt::Size LegendWrapper::getCurrentSizeForReference()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
return m_spChart2ModelContact->GetPageSize();
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
// ================================================================================
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
// WrappedPropertySet
|
|
|
|
Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
Reference< beans::XPropertySet > xRet;
|
|
|
|
Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
|
|
|
|
if( xDiagram.is() )
|
|
|
|
xRet.set( xDiagram->getLegend(), uno::UNO_QUERY );
|
|
|
|
return xRet;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
const Sequence< beans::Property >& LegendWrapper::getPropertySequence()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
return lcl_GetPropertySequence();
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
aWrappedProperties.push_back( new WrappedLegendAlignmentProperty() );
|
|
|
|
// WrappedNamedProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
|
|
|
|
WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
|
|
|
|
//same problem as for wall: thje defaults ion the old chart are different for different charttypes, so we need to export explicitly
|
|
|
|
aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ) );
|
|
|
|
aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillColor"), C2U("FillColor") ));
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
return aWrappedProperties;
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
// ================================================================================
|
|
|
|
|
|
|
|
Sequence< ::rtl::OUString > LegendWrapper::getSupportedServiceNames_Static()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2007-05-22 16:18:34 +00:00
|
|
|
Sequence< ::rtl::OUString > aServices( 4 );
|
2003-12-18 12:50:56 +00:00
|
|
|
aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLegend" );
|
|
|
|
aServices[ 1 ] = C2U( "com.sun.star.drawing.Shape" );
|
|
|
|
aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
|
|
|
|
aServices[ 3 ] = C2U( "com.sun.star.style.CharacterProperties" );
|
|
|
|
// aServices[ 4 ] = C2U( "com.sun.star.beans.PropertySet" );
|
|
|
|
// aServices[ 5 ] = C2U( "com.sun.star.drawing.FillProperties" );
|
|
|
|
// aServices[ 6 ] = C2U( "com.sun.star.drawing.LineProperties" );
|
|
|
|
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
|
|
|
|
APPHELPER_XSERVICEINFO_IMPL( LegendWrapper, lcl_aServiceName );
|
|
|
|
|
|
|
|
} // namespace wrapper
|
|
|
|
} // namespace chart
|