2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2007-05-22 16:15:43 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 18:21:51 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-05-22 16:15:43 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-05-22 16:15:43 +00:00
|
|
|
*
|
2008-04-10 18:21:51 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-05-22 16:15:43 +00:00
|
|
|
*
|
2008-04-10 18:21:51 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-05-22 16:15:43 +00:00
|
|
|
*
|
2008-04-10 18:21:51 +00: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-05-22 16:15:43 +00:00
|
|
|
*
|
2008-04-10 18:21:51 +00: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-05-22 16:15:43 +00:00
|
|
|
*
|
2008-04-10 18:21:51 +00: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-05-22 16:15:43 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#include "AreaWrapper.hxx"
|
|
|
|
#include "macros.hxx"
|
|
|
|
#include "ContainerHelper.hxx"
|
|
|
|
#include "Chart2ModelContact.hxx"
|
|
|
|
#include "WrappedDirectStateProperty.hxx"
|
|
|
|
#include <comphelper/InlineContainer.hxx>
|
|
|
|
#include <com/sun/star/drawing/FillStyle.hpp>
|
|
|
|
|
|
|
|
#include "LineProperties.hxx"
|
|
|
|
#include "FillProperties.hxx"
|
|
|
|
#include "UserDefinedProperties.hxx"
|
|
|
|
|
|
|
|
#include <algorithm>
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using ::com::sun::star::beans::Property;
|
|
|
|
using ::osl::MutexGuard;
|
|
|
|
using ::com::sun::star::uno::Any;
|
|
|
|
using ::com::sun::star::uno::Reference;
|
|
|
|
using ::com::sun::star::uno::Sequence;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
static const ::rtl::OUString lcl_aServiceName(
|
|
|
|
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Area" ));
|
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
struct StaticAreaWrapperPropertyArray_Initializer
|
2007-05-22 16:15:43 +00:00
|
|
|
{
|
2010-10-05 11:10:54 +02:00
|
|
|
Sequence< Property >* operator()()
|
|
|
|
{
|
|
|
|
static Sequence< Property > aPropSeq( lcl_GetPropertySequence() );
|
|
|
|
return &aPropSeq;
|
|
|
|
}
|
2007-05-22 16:15:43 +00:00
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
private:
|
|
|
|
Sequence< Property > lcl_GetPropertySequence()
|
2007-05-22 16:15:43 +00:00
|
|
|
{
|
|
|
|
::std::vector< ::com::sun::star::beans::Property > aProperties;
|
|
|
|
::chart::LineProperties::AddPropertiesToVector( aProperties );
|
|
|
|
::chart::FillProperties::AddPropertiesToVector( aProperties );
|
|
|
|
::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
|
|
|
|
|
|
|
|
::std::sort( aProperties.begin(), aProperties.end(),
|
|
|
|
::chart::PropertyNameLess() );
|
|
|
|
|
2010-10-05 11:10:54 +02:00
|
|
|
return ::chart::ContainerHelper::ContainerToSequence( aProperties );
|
2007-05-22 16:15:43 +00:00
|
|
|
}
|
2010-10-05 11:10:54 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
struct StaticAreaWrapperPropertyArray : public rtl::StaticAggregate< Sequence< Property >, StaticAreaWrapperPropertyArray_Initializer >
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
2007-05-22 16:15:43 +00:00
|
|
|
|
|
|
|
} // anonymous namespace
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------------
|
|
|
|
// --------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
namespace wrapper
|
|
|
|
{
|
|
|
|
|
|
|
|
AreaWrapper::AreaWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
|
|
|
|
m_spChart2ModelContact( spChart2ModelContact ),
|
|
|
|
m_aEventListenerContainer( m_aMutex )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
AreaWrapper::~AreaWrapper()
|
|
|
|
{}
|
|
|
|
|
|
|
|
// ____ XShape ____
|
|
|
|
awt::Point SAL_CALL AreaWrapper::getPosition()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return awt::Point(0,0);
|
|
|
|
}
|
|
|
|
|
2007-07-25 07:32:40 +00:00
|
|
|
void SAL_CALL AreaWrapper::setPosition( const awt::Point& /*aPosition*/ )
|
2007-05-22 16:15:43 +00:00
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2011-03-12 11:28:41 +01:00
|
|
|
OSL_FAIL( "trying to set position of chart area" );
|
2007-05-22 16:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
awt::Size SAL_CALL AreaWrapper::getSize()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return m_spChart2ModelContact->GetPageSize();
|
|
|
|
}
|
|
|
|
|
2007-07-25 07:32:40 +00:00
|
|
|
void SAL_CALL AreaWrapper::setSize( const awt::Size& /*aSize*/ )
|
2007-05-22 16:15:43 +00:00
|
|
|
throw (beans::PropertyVetoException,
|
|
|
|
uno::RuntimeException)
|
|
|
|
{
|
2011-03-12 11:28:41 +01:00
|
|
|
OSL_FAIL( "trying to set size of chart area" );
|
2007-05-22 16:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XShapeDescriptor (base of XShape) ____
|
|
|
|
::rtl::OUString SAL_CALL AreaWrapper::getShapeType()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
2012-04-08 10:47:56 -04:30
|
|
|
return rtl::OUString( "com.sun.star.chart.ChartArea" );
|
2007-05-22 16:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ____ XComponent ____
|
|
|
|
void SAL_CALL AreaWrapper::dispose()
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
|
|
|
|
m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
|
|
|
|
|
|
|
|
MutexGuard aGuard( GetMutex());
|
|
|
|
clearWrappedPropertySet();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL AreaWrapper::addEventListener(
|
|
|
|
const Reference< lang::XEventListener >& xListener )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
m_aEventListenerContainer.addInterface( xListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL AreaWrapper::removeEventListener(
|
|
|
|
const Reference< lang::XEventListener >& aListener )
|
|
|
|
throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
m_aEventListenerContainer.removeInterface( aListener );
|
|
|
|
}
|
|
|
|
|
|
|
|
// ================================================================================
|
|
|
|
|
|
|
|
// WrappedPropertySet
|
|
|
|
Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet()
|
|
|
|
{
|
|
|
|
Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
|
|
|
|
if( xChartDoc.is() )
|
|
|
|
return xChartDoc->getPageBackground();
|
2011-03-12 11:28:41 +01:00
|
|
|
OSL_FAIL("AreaWrapper::getInnerPropertySet() is NULL");
|
2007-05-22 16:15:43 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
const Sequence< beans::Property >& AreaWrapper::getPropertySequence()
|
|
|
|
{
|
2010-10-05 11:10:54 +02:00
|
|
|
return *StaticAreaWrapperPropertyArray::get();
|
2007-05-22 16:15:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const std::vector< WrappedProperty* > AreaWrapper::createWrappedProperties()
|
|
|
|
{
|
|
|
|
::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
|
|
|
|
|
2012-04-08 10:47:56 -04:30
|
|
|
aWrappedProperties.push_back( new WrappedDirectStateProperty("LineStyle","LineStyle") );
|
2007-05-22 16:15:43 +00:00
|
|
|
|
|
|
|
return aWrappedProperties;
|
|
|
|
}
|
|
|
|
|
|
|
|
// ================================================================================
|
|
|
|
|
|
|
|
Sequence< ::rtl::OUString > AreaWrapper::getSupportedServiceNames_Static()
|
|
|
|
{
|
|
|
|
Sequence< ::rtl::OUString > aServices( 4 );
|
2012-04-08 10:47:56 -04:30
|
|
|
aServices[ 0 ] = "com.sun.star.xml.UserDefinedAttributeSupplier";
|
|
|
|
aServices[ 1 ] = "com.sun.star.beans.PropertySet";
|
|
|
|
aServices[ 2 ] = "com.sun.star.drawing.FillProperties";
|
|
|
|
aServices[ 3 ] = "com.sun.star.drawing.LineProperties";
|
2007-05-22 16:15:43 +00:00
|
|
|
|
|
|
|
return aServices;
|
|
|
|
}
|
|
|
|
|
|
|
|
// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
|
|
|
|
APPHELPER_XSERVICEINFO_IMPL( AreaWrapper, lcl_aServiceName );
|
|
|
|
|
|
|
|
} // namespace wrapper
|
|
|
|
} // namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|