Files
libreoffice/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx
Vladimir Glazounov a8dfb0f11d INTEGRATION: CWS chart2mst3 (1.6.4); FILE MERGED
2007/03/19 15:09:01 iha 1.6.4.11: #i73605#, #i75389# use correct numberformat for scale tabpage and numbers tabpage
2006/10/18 17:06:36 bm 1.6.4.10: RESYNC: (1.7-1.8); FILE MERGED
2006/09/24 09:12:54 iha 1.6.4.9: #i61970# correct implementation of axis at
2006/04/10 15:03:32 iha 1.6.4.8: api restructure axis, grids, scales and increments
2006/04/10 12:25:06 iha 1.6.4.7: api restructure axis, grids, scales and increments
2006/02/20 14:46:55 iha 1.6.4.6: move SchItemPool from controller to view lib -> ChartItemPool
2005/12/01 18:54:15 iha 1.6.4.5: create axis title with correct rotation default + don't mix x and y in barcharts
2005/10/07 11:32:09 bm 1.6.4.4: RESYNC: (1.6-1.7); FILE MERGED
2005/08/18 15:20:41 bm 1.6.4.3: (gs)etDiagram -> (gs)etFirstDiagram to avoid name clashes with old API
2005/07/12 12:57:03 bm 1.6.4.2: use named properties for gradients etc. in chart model
2004/03/18 16:30:31 iha 1.6.4.1: changed parameters in constructor of DataPointItemConverter
2007-05-22 17:01:18 +00:00

234 lines
9.1 KiB
C++

/*************************************************************************
*
* OpenOffice.org - a multi-platform office productivity suite
*
* $RCSfile: MultipleChartConverters.cxx,v $
*
* $Revision: 1.9 $
*
* last change: $Author: vg $ $Date: 2007-05-22 18:01:18 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
*
*
* GNU Lesser General Public License Version 2.1
* =============================================
* Copyright 2005 by Sun Microsystems, Inc.
* 901 San Antonio Road, Palo Alto, CA 94303, USA
*
* 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.
*
* 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.
*
* 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
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
#include "MultipleChartConverters.hxx"
#include "chartview/ChartSfxItemIds.hxx"
#include "SchWhichPairs.hxx"
#include "AxisItemConverter.hxx"
#include "StatisticsItemConverter.hxx"
#include "GraphicPropertyItemConverter.hxx"
#include "DataPointItemConverter.hxx"
#include "ChartModelHelper.hxx"
#include "TitleHelper.hxx"
#include "TitleItemConverter.hxx"
#include "AxisHelper.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::chart2;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
namespace chart
{
namespace wrapper
{
//-----------------------------------------------------------------------------
AllAxisItemConverter::AllAxisItemConverter(
const uno::Reference< frame::XModel > & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
::std::auto_ptr< awt::Size > pRefSize )
: MultipleItemConverter( rItemPool )
{
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
Sequence< Reference< XAxis > > aElementList( AxisHelper::getAllAxisOfDiagram( xDiagram ) );
for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
{
uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY);
if( pRefSize.get())
m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
xObjectProperties, rItemPool, rDrawModel,
uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), 0, 0,
::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize )) ));
else
m_aConverters.push_back( new ::chart::wrapper::AxisItemConverter(
xObjectProperties, rItemPool, rDrawModel,
uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), 0, 0 ) );
}
}
AllAxisItemConverter::~AllAxisItemConverter()
{
}
const USHORT * AllAxisItemConverter::GetWhichPairs() const
{
// must span all used items!
return nAllAxisWhichPairs;
}
//-----------------------------------------------------------------------------
AllGridItemConverter::AllGridItemConverter(
const uno::Reference< frame::XModel > & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory )
: MultipleItemConverter( rItemPool )
{
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
Sequence< Reference< beans::XPropertySet > > aElementList( AxisHelper::getAllGrids( xDiagram ) );
for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ )
{
Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]);
m_aConverters.push_back( new ::chart::wrapper::GraphicPropertyItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory,
::chart::wrapper::GraphicPropertyItemConverter::LINE_PROPERTIES ) );
}
}
AllGridItemConverter::~AllGridItemConverter()
{
}
const USHORT * AllGridItemConverter::GetWhichPairs() const
{
// must span all used items!
return nGridWhichPairs;
}
//-----------------------------------------------------------------------------
AllDataLabelItemConverter::AllDataLabelItemConverter(
const uno::Reference< frame::XModel > & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
::std::auto_ptr< awt::Size > pRefSize )
: MultipleItemConverter( rItemPool )
{
::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
::chart::ChartModelHelper::getDataSeries( xChartModel ));
::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
{
uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
uno::Reference< uno::XComponentContext> xContext(0);//do not need Context for label properties
if( pRefSize.get())
m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter(
xChartModel, xContext,
xObjectProperties, rItemPool, rDrawModel, NULL,
xNamedPropertyContainerFactory,
GraphicPropertyItemConverter::FILLED_DATA_POINT,
::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize )) ));
else
m_aConverters.push_back( new ::chart::wrapper::DataPointItemConverter(
xChartModel, xContext, xObjectProperties, rItemPool, rDrawModel, NULL,
xNamedPropertyContainerFactory ));
}
}
AllDataLabelItemConverter::~AllDataLabelItemConverter()
{
}
const USHORT * AllDataLabelItemConverter::GetWhichPairs() const
{
// must span all used items!
return nDataLabelWhichPairs;
}
//-----------------------------------------------------------------------------
AllTitleItemConverter::AllTitleItemConverter(
const uno::Reference< frame::XModel > & xChartModel,
SfxItemPool& rItemPool,
SdrModel& rDrawModel,
const uno::Reference< lang::XMultiServiceFactory > & xNamedPropertyContainerFactory,
::std::auto_ptr< awt::Size > pRefSize )
: MultipleItemConverter( rItemPool )
{
for(sal_Int32 nTitle = TitleHelper::TITLE_BEGIN; nTitle < TitleHelper::NORMAL_TITLE_END; nTitle++ )
{
uno::Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( TitleHelper::eTitleType(nTitle), xChartModel ) );
if(!xTitle.is())
return;
uno::Reference< beans::XPropertySet > xObjectProperties( xTitle, uno::UNO_QUERY);
::std::auto_ptr< awt::Size > pSingleRefSize(0);
if( pRefSize.get())
pSingleRefSize = ::std::auto_ptr< awt::Size >( new awt::Size( *pRefSize ));
m_aConverters.push_back( new ::chart::wrapper::TitleItemConverter(
xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, pSingleRefSize ));
}
}
AllTitleItemConverter::~AllTitleItemConverter()
{
}
const USHORT * AllTitleItemConverter::GetWhichPairs() const
{
// must span all used items!
return nTitleWhichPairs;
}
//-----------------------------------------------------------------------------
AllSeriesStatisticsConverter::AllSeriesStatisticsConverter(
const uno::Reference< frame::XModel > & xChartModel,
SfxItemPool& rItemPool )
: MultipleItemConverter( rItemPool )
{
::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
::chart::ChartModelHelper::getDataSeries( xChartModel ));
::std::vector< uno::Reference< chart2::XDataSeries > >::const_iterator aIt;
for( aIt = aSeriesList.begin(); aIt != aSeriesList.end(); ++aIt )
{
uno::Reference< beans::XPropertySet > xObjectProperties( *aIt, uno::UNO_QUERY);
m_aConverters.push_back( new ::chart::wrapper::StatisticsItemConverter(
xChartModel, xObjectProperties, rItemPool ));
}
}
AllSeriesStatisticsConverter::~AllSeriesStatisticsConverter()
{}
const USHORT * AllSeriesStatisticsConverter::GetWhichPairs() const
{
// must span all used items!
return nStatWhichPairs;
}
} // namespace wrapper
} // namespace chart