2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-07-17 12:30:48 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 11:56:32 +00:00
|
|
|
|
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"
|
|
|
|
#include <comphelper/InlineContainer.hxx>
|
2014-12-09 08:30:11 +02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2003-12-18 12:50:56 +00:00
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
2004-01-26 08:13:31 +00:00
|
|
|
#include <com/sun/star/chart2/XTitled.hpp>
|
2003-12-18 12:50:56 +00:00
|
|
|
#include <com/sun/star/chart/ChartLegendPosition.hpp>
|
2004-01-26 08:13:31 +00:00
|
|
|
#include <com/sun/star/chart2/LegendPosition.hpp>
|
2011-01-24 17:44:18 +01:00
|
|
|
#include <com/sun/star/chart/ChartLegendExpansion.hpp>
|
2007-05-22 16:18:34 +00:00
|
|
|
#include <com/sun/star/chart2/RelativePosition.hpp>
|
|
|
|
#include <com/sun/star/drawing/FillStyle.hpp>
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#include "CharacterProperties.hxx"
|
2013-04-21 02:49:04 +02:00
|
|
|
#include "LinePropertiesHelper.hxx"
|
2003-12-18 12:50:56 +00:00
|
|
|
#include "FillProperties.hxx"
|
|
|
|
#include "UserDefinedProperties.hxx"
|
2007-05-22 16:18:34 +00:00
|
|
|
#include "WrappedCharacterHeightProperty.hxx"
|
|
|
|
#include "PositionAndSizeHelper.hxx"
|
|
|
|
#include "WrappedDirectStateProperty.hxx"
|
2008-10-01 07:35:04 +00:00
|
|
|
#include "WrappedAutomaticPositionProperties.hxx"
|
|
|
|
#include "WrappedScaleTextProperties.hxx"
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
|
|
|
|
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
|
|
|
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
|
2014-03-27 18:12:18 +01:00
|
|
|
throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException) SAL_OVERRIDE;
|
2007-05-22 16:18:34 +00:00
|
|
|
virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
2014-03-27 18:12:18 +01:00
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) SAL_OVERRIDE;
|
2007-05-22 16:18:34 +00:00
|
|
|
|
|
|
|
protected:
|
2014-03-27 18:12:18 +01:00
|
|
|
virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const SAL_OVERRIDE;
|
|
|
|
virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const SAL_OVERRIDE;
|
2003-12-18 12:50:56 +00:00
|
|
|
};
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty()
|
2012-04-08 10:48:08 -04:30
|
|
|
: ::chart::WrappedProperty( "Alignment", "AnchorPosition" )
|
2007-05-22 16:18:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
WrappedLegendAlignmentProperty::~WrappedLegendAlignmentProperty()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Any WrappedLegendAlignmentProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
|
|
|
|
throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
Any aRet;
|
|
|
|
if( xInnerPropertySet.is() )
|
|
|
|
{
|
2014-04-15 15:17:13 +02:00
|
|
|
bool bShowLegend = true;
|
2012-04-08 10:48:08 -04:30
|
|
|
xInnerPropertySet->getPropertyValue( "Show" ) >>= bShowLegend;
|
2007-05-22 16:18:34 +00:00
|
|
|
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())
|
|
|
|
{
|
2014-04-15 15:17:13 +02:00
|
|
|
bool bNewShowLegend = true;
|
|
|
|
bool bOldShowLegend = true;
|
2007-05-22 16:18:34 +00:00
|
|
|
{
|
2007-07-03 12:36:32 +00:00
|
|
|
::com::sun::star::chart::ChartLegendPosition eOuterPos(::com::sun::star::chart::ChartLegendPosition_NONE);
|
2007-05-22 16:18:34 +00:00
|
|
|
if( (rOuterValue >>= eOuterPos) && eOuterPos == ::com::sun::star::chart::ChartLegendPosition_NONE )
|
2014-04-15 15:17:13 +02:00
|
|
|
bNewShowLegend = false;
|
2012-04-08 10:48:08 -04:30
|
|
|
xInnerPropertySet->getPropertyValue( "Show" ) >>= bOldShowLegend;
|
2007-05-22 16:18:34 +00:00
|
|
|
}
|
|
|
|
if(bNewShowLegend!=bOldShowLegend)
|
|
|
|
{
|
2012-04-08 10:48:08 -04:30
|
|
|
xInnerPropertySet->setPropertyValue( "Show", uno::makeAny(bNewShowLegend) );
|
2007-05-22 16:18:34 +00:00
|
|
|
}
|
|
|
|
if(!bNewShowLegend)
|
|
|
|
return;
|
|
|
|
|
|
|
|
//set corresponding LegendPosition
|
|
|
|
Any aInnerValue = this->convertOuterToInnerValue( rOuterValue );
|
|
|
|
xInnerPropertySet->setPropertyValue( m_aInnerName, aInnerValue );
|
|
|
|
|
|
|
|
//correct LegendExpansion
|
2007-07-03 12:36:32 +00:00
|
|
|
chart2::LegendPosition eNewInnerPos(chart2::LegendPosition_LINE_END);
|
2007-05-22 16:18:34 +00:00
|
|
|
if( aInnerValue >>= eNewInnerPos )
|
|
|
|
{
|
2011-01-24 17:44:18 +01:00
|
|
|
::com::sun::star::chart::ChartLegendExpansion eNewExpansion =
|
2007-07-25 07:27:11 +00:00
|
|
|
( eNewInnerPos == chart2::LegendPosition_LINE_END ||
|
|
|
|
eNewInnerPos == chart2::LegendPosition_LINE_START )
|
2011-01-24 17:44:18 +01:00
|
|
|
? ::com::sun::star::chart::ChartLegendExpansion_HIGH
|
|
|
|
: ::com::sun::star::chart::ChartLegendExpansion_WIDE;
|
2007-05-22 16:18:34 +00:00
|
|
|
|
2011-01-24 17:44:18 +01:00
|
|
|
::com::sun::star::chart::ChartLegendExpansion eOldExpansion( ::com::sun::star::chart::ChartLegendExpansion_HIGH );
|
2007-07-25 07:27:11 +00:00
|
|
|
bool bExpansionWasSet(
|
2012-04-08 10:48:08 -04:30
|
|
|
xInnerPropertySet->getPropertyValue( "Expansion" ) >>= eOldExpansion );
|
2007-05-22 16:18:34 +00:00
|
|
|
|
2007-07-25 07:27:11 +00:00
|
|
|
if( !bExpansionWasSet || (eOldExpansion != eNewExpansion))
|
2012-04-08 10:48:08 -04:30
|
|
|
xInnerPropertySet->setPropertyValue( "Expansion", uno::makeAny( eNewExpansion ));
|
2007-05-22 16:18:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//correct RelativePosition
|
2012-04-08 10:48:08 -04:30
|
|
|
Any aRelativePosition( xInnerPropertySet->getPropertyValue("RelativePosition") );
|
2007-05-22 16:18:34 +00:00
|
|
|
if(aRelativePosition.hasValue())
|
|
|
|
{
|
2012-04-08 10:48:08 -04:30
|
|
|
xInnerPropertySet->setPropertyValue( "RelativePosition", Any() );
|
2007-05-22 16:18:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
2014-11-03 14:03:54 +02:00
|
|
|
static const char lcl_aServiceName[] = "com.sun.star.comp.chart.Legend";
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2011-01-24 17:44:18 +01:00
|
|
|
PROP_LEGEND_ALIGNMENT,
|
|
|
|
PROP_LEGEND_EXPANSION
|
2003-12-18 12:50:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void lcl_AddPropertiesToVector(
|
|
|
|
::std::vector< Property > & rOutProperties )
|
|
|
|
{
|
|
|
|
rOutProperties.push_back(
|
2012-04-08 10:48:08 -04:30
|
|
|
Property( "Alignment",
|
2003-12-18 12:50:56 +00:00
|
|
|
PROP_LEGEND_ALIGNMENT,
|
2014-05-18 00:35:50 +02:00
|
|
|
cppu::UnoType<com::sun::star::chart::ChartLegendPosition>::get(),
|
2010-06-01 16:51:03 +02:00
|
|
|
//#i111967# no PropertyChangeEvent is fired on change so far
|
|
|
|
beans::PropertyAttribute::MAYBEDEFAULT ));
|
2011-01-24 17:44:18 +01:00
|
|
|
|
|
|
|
rOutProperties.push_back(
|
2012-04-08 10:48:08 -04:30
|
|
|
Property( "Expansion",
|
2011-01-24 17:44:18 +01:00
|
|
|
PROP_LEGEND_EXPANSION,
|
2014-05-18 00:35:50 +02:00
|
|
|
cppu::UnoType<com::sun::star::chart::ChartLegendExpansion>::get(),
|
2011-01-24 17:44:18 +01:00
|
|
|
//#i111967# no PropertyChangeEvent is fired on change so far
|
|
|
|
beans::PropertyAttribute::MAYBEDEFAULT ));
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
struct StaticLegendWrapperPropertyArray_Initializer
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2010-10-05 11:10:54 +02:00
|
|
|
Sequence< Property >* operator()()
|
|
|
|
{
|
|
|
|
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
|
|
|
|
return &aPropSeq;
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
private:
|
|
|
|
Sequence< Property > lcl_GetPropertySequence()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
|
|
|
::std::vector< ::com::sun::star::beans::Property > aProperties;
|
|
|
|
lcl_AddPropertiesToVector( aProperties );
|
2007-05-22 16:18:34 +00:00
|
|
|
::chart::CharacterProperties::AddPropertiesToVector( aProperties );
|
2013-04-21 02:49:04 +02:00
|
|
|
::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties );
|
2007-05-22 16:18:34 +00:00
|
|
|
::chart::FillProperties::AddPropertiesToVector( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
|
2008-10-01 07:35:04 +00:00
|
|
|
::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
|
|
|
|
::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
::std::sort( aProperties.begin(), aProperties.end(),
|
2007-05-22 16:18:34 +00:00
|
|
|
::chart::PropertyNameLess() );
|
2003-12-18 12:50:56 +00:00
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
return ::chart::ContainerHelper::ContainerToSequence( aProperties );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
2010-10-05 11:10:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StaticLegendWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticLegendWrapperPropertyArray_Initializer >
|
|
|
|
{
|
|
|
|
};
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
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()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
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 )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
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);
|
2012-04-08 10:48:08 -04:30
|
|
|
xProp->setPropertyValue( "RelativePosition", uno::makeAny(aRelativePosition) );
|
2007-05-22 16:18:34 +00:00
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
awt::Size SAL_CALL LegendWrapper::getSize()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
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,
|
2014-02-25 21:31:58 +01:00
|
|
|
uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
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) ____
|
2013-02-28 19:28:03 +01:00
|
|
|
OUString SAL_CALL LegendWrapper::getShapeType()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2013-02-28 19:28:03 +01:00
|
|
|
return OUString( "com.sun.star.chart.ChartLegend" );
|
2003-12-18 12:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XComponent ____
|
|
|
|
void SAL_CALL LegendWrapper::dispose()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
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 )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
|
|
|
m_aEventListenerContainer.addInterface( xListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL LegendWrapper::removeEventListener(
|
2007-05-22 16:18:34 +00:00
|
|
|
const Reference< lang::XEventListener >& aListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
|
|
|
m_aEventListenerContainer.removeInterface( aListener );
|
|
|
|
}
|
|
|
|
|
2007-05-22 16:18:34 +00:00
|
|
|
//ReferenceSizePropertyProvider
|
2008-10-01 07:35:04 +00:00
|
|
|
void LegendWrapper::updateReferenceSize()
|
2007-05-22 16:18:34 +00:00
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
|
|
|
|
if( xProp.is() )
|
2008-10-01 07:35:04 +00:00
|
|
|
{
|
2012-04-08 10:48:08 -04:30
|
|
|
if( xProp->getPropertyValue( "ReferencePageSize" ).hasValue() )
|
|
|
|
xProp->setPropertyValue( "ReferencePageSize", uno::makeAny(
|
2008-10-01 07:35:04 +00:00
|
|
|
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() )
|
2012-04-08 10:48:08 -04:30
|
|
|
aRet = xProp->getPropertyValue( "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
|
|
|
// 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 );
|
2008-06-16 11:45:36 +00:00
|
|
|
OSL_ENSURE(xRet.is(),"LegendWrapper::getInnerPropertySet() is NULL");
|
2007-05-22 16:18:34 +00:00
|
|
|
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
|
|
|
{
|
2010-10-05 11:10:54 +02:00
|
|
|
return *StaticLegendWrapperPropertyArray::get();
|
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() );
|
2012-04-08 10:48:08 -04:30
|
|
|
aWrappedProperties.push_back( new WrappedProperty( "Expansion", "Expansion"));
|
2007-05-22 16:18:34 +00:00
|
|
|
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
|
2012-04-08 10:48:08 -04:30
|
|
|
aWrappedProperties.push_back( new WrappedDirectStateProperty("FillStyle", "FillStyle"));
|
|
|
|
aWrappedProperties.push_back( new WrappedDirectStateProperty("FillColor", "FillColor"));
|
2008-10-01 07:35:04 +00:00
|
|
|
WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
|
|
|
|
WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
|
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
|
|
|
}
|
|
|
|
|
2013-02-28 19:28:03 +01:00
|
|
|
Sequence< OUString > LegendWrapper::getSupportedServiceNames_Static()
|
2003-12-18 12:50:56 +00:00
|
|
|
{
|
2013-02-28 19:28:03 +01:00
|
|
|
Sequence< OUString > aServices( 4 );
|
2012-04-08 10:48:08 -04:30
|
|
|
aServices[ 0 ] = "com.sun.star.chart.ChartLegend";
|
|
|
|
aServices[ 1 ] = "com.sun.star.drawing.Shape";
|
2012-11-29 20:48:11 +01:00
|
|
|
aServices[ 2 ] = "com.sun.star.xml.UserDefinedAttributesSupplier";
|
2012-04-08 10:48:08 -04:30
|
|
|
aServices[ 3 ] = "com.sun.star.style.CharacterProperties";
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
|
2014-12-09 08:30:11 +02:00
|
|
|
OUString SAL_CALL LegendWrapper::getImplementationName()
|
|
|
|
throw( css::uno::RuntimeException, std::exception )
|
|
|
|
{
|
|
|
|
return getImplementationName_Static();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString LegendWrapper::getImplementationName_Static()
|
|
|
|
{
|
|
|
|
return OUString(lcl_aServiceName);
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Bool SAL_CALL LegendWrapper::supportsService( const OUString& rServiceName )
|
|
|
|
throw( css::uno::RuntimeException, std::exception )
|
|
|
|
{
|
|
|
|
return cppu::supportsService(this, rServiceName);
|
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence< OUString > SAL_CALL LegendWrapper::getSupportedServiceNames()
|
|
|
|
throw( css::uno::RuntimeException, std::exception )
|
|
|
|
{
|
|
|
|
return getSupportedServiceNames_Static();
|
|
|
|
}
|
2003-12-18 12:50:56 +00:00
|
|
|
|
|
|
|
} // namespace wrapper
|
|
|
|
} // namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|