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 .
|
|
|
|
*/
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
#include "ObjectIdentifier.hxx"
|
|
|
|
#include "macros.hxx"
|
|
|
|
#include "TitleHelper.hxx"
|
|
|
|
#include "ChartModelHelper.hxx"
|
|
|
|
#include "AxisHelper.hxx"
|
|
|
|
#include "servicenames_charttypes.hxx"
|
|
|
|
#include "DiagramHelper.hxx"
|
|
|
|
#include "AxisIndexDefines.hxx"
|
2014-06-26 19:35:48 -04:00
|
|
|
#include <unonames.hxx>
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
|
|
|
|
#include <com/sun/star/chart2/XChartDocument.hpp>
|
|
|
|
#include <com/sun/star/chart2/XChartTypeContainer.hpp>
|
|
|
|
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
|
|
|
|
#include <com/sun/star/chart2/XAxis.hpp>
|
|
|
|
#include <com/sun/star/chart2/XRegressionCurveContainer.hpp>
|
|
|
|
|
|
|
|
#include <comphelper/InlineContainer.hxx>
|
|
|
|
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
|
|
|
|
namespace chart
|
|
|
|
{
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::chart2;
|
|
|
|
|
|
|
|
using ::com::sun::star::uno::Reference;
|
2009-07-21 14:09:00 +00:00
|
|
|
using ::com::sun::star::uno::Any;
|
2007-05-22 18:03:13 +00:00
|
|
|
|
2014-11-03 14:03:54 +02:00
|
|
|
static const char m_aMultiClick[] = "MultiClick";
|
|
|
|
static const char m_aDragMethodEquals[] = "DragMethod=";
|
|
|
|
static const char m_aDragParameterEquals[] = "DragParameter=";
|
|
|
|
static const char m_aProtocol[] = "CID/";
|
|
|
|
static const OUString m_aPieSegmentDragMethodServiceName("PieSegmentDraging");
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
OUString lcl_createClassificationStringForType( ObjectType eObjectType
|
|
|
|
, const OUString& rDragMethodServiceName
|
|
|
|
, const OUString& rDragParameterString
|
|
|
|
)
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
switch( eObjectType )
|
|
|
|
{
|
|
|
|
//these object types are all selected only after their parents was selected before
|
|
|
|
case OBJECTTYPE_LEGEND_ENTRY: //parent is intended to be OBJECTTYPE_LEGEND
|
|
|
|
case OBJECTTYPE_DATA_POINT: //parent is intended to be OBJECTTYPE_DATA_SERIES
|
|
|
|
case OBJECTTYPE_DATA_LABEL: //parent is intended to be OBJECTTYPE_DATA_LABELS
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_X: //parent is intended to be OBJECTTYPE_DATA_ERRORS
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_Y: //parent is intended to be OBJECTTYPE_DATA_ERRORS
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_Z: //parent is intended to be OBJECTTYPE_DATA_ERRORS
|
|
|
|
aRet=m_aMultiClick;
|
|
|
|
default:
|
|
|
|
;//empty string
|
|
|
|
}
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !rDragMethodServiceName.isEmpty() )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
2013-03-09 21:47:17 +01:00
|
|
|
if( !aRet.isEmpty() )
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append( m_aDragMethodEquals );
|
|
|
|
aRet.append( rDragMethodServiceName );
|
|
|
|
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !rDragParameterString.isEmpty() )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
2013-03-09 21:47:17 +01:00
|
|
|
if( !aRet.isEmpty() )
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append( m_aDragParameterEquals );
|
|
|
|
aRet.append( rDragParameterString );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef ::comphelper::MakeMap< TitleHelper::eTitleType, OUString > tTitleMap;
|
|
|
|
const tTitleMap& lcl_getTitleMap()
|
|
|
|
{
|
|
|
|
//maps the title type to the ParentParticle for that title
|
2016-04-20 10:34:01 +02:00
|
|
|
static tTitleMap s_aTitleMap = tTitleMap
|
2013-01-30 11:44:23 +01:00
|
|
|
( TitleHelper::MAIN_TITLE, "" )
|
|
|
|
( TitleHelper::SUB_TITLE, "D=0" )
|
|
|
|
( TitleHelper::X_AXIS_TITLE, "D=0:CS=0:Axis=0,0" )
|
|
|
|
( TitleHelper::Y_AXIS_TITLE, "D=0:CS=0:Axis=1,0" )
|
|
|
|
( TitleHelper::Z_AXIS_TITLE, "D=0:CS=0:Axis=2,0" )
|
|
|
|
( TitleHelper::SECONDARY_X_AXIS_TITLE, "D=0:CS=0:Axis=0,1" )
|
|
|
|
( TitleHelper::SECONDARY_Y_AXIS_TITLE, "D=0:CS=0:Axis=1,1" )
|
2007-05-22 18:03:13 +00:00
|
|
|
;
|
2016-04-20 10:34:01 +02:00
|
|
|
return s_aTitleMap;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString lcl_getTitleParentParticle( TitleHelper::eTitleType aTitleType )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
const tTitleMap& rMap = lcl_getTitleMap();
|
|
|
|
tTitleMap::const_iterator aIt( rMap.find( aTitleType ) );
|
|
|
|
if( aIt != rMap.end())
|
|
|
|
aRet = (*aIt).second;
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference<XChartType> lcl_getFirstStockChartType( const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
|
|
|
|
if(!xDiagram.is())
|
2015-11-10 10:11:17 +01:00
|
|
|
return nullptr;
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
//iterate through all coordinate systems
|
|
|
|
Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
|
|
|
|
if( !xCooSysContainer.is())
|
2015-11-10 10:11:17 +01:00
|
|
|
return nullptr;
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
|
|
|
|
for( sal_Int32 nCS = 0; nCS < aCooSysList.getLength(); ++nCS )
|
|
|
|
{
|
|
|
|
//iterate through all chart types in the current coordinate system
|
|
|
|
Reference< XChartTypeContainer > xChartTypeContainer( aCooSysList[nCS], uno::UNO_QUERY );
|
|
|
|
if( !xChartTypeContainer.is() )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
uno::Sequence< Reference< XChartType > > aChartTypeList( xChartTypeContainer->getChartTypes() );
|
|
|
|
for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT )
|
|
|
|
{
|
|
|
|
Reference< XChartType > xChartType( aChartTypeList[nT] );
|
|
|
|
if(!xChartType.is())
|
|
|
|
continue;
|
|
|
|
OUString aChartType = xChartType->getChartType();
|
|
|
|
if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
|
|
|
|
return xChartType;
|
|
|
|
}
|
|
|
|
}
|
2015-11-10 10:11:17 +01:00
|
|
|
return nullptr;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString lcl_getIndexStringAfterString( const OUString& rString, const OUString& rSearchString )
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
|
|
|
|
sal_Int32 nIndexStart = rString.lastIndexOf( rSearchString );
|
|
|
|
if( nIndexStart != -1 )
|
|
|
|
{
|
|
|
|
nIndexStart += rSearchString.getLength();
|
|
|
|
sal_Int32 nIndexEnd = rString.getLength();
|
|
|
|
sal_Int32 nNextColon = rString.indexOf( ':', nIndexStart );
|
|
|
|
if( nNextColon != -1 )
|
|
|
|
nIndexEnd = nNextColon;
|
|
|
|
aRet = rString.copy(nIndexStart,nIndexEnd-nIndexStart);
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
sal_Int32 lcl_StringToIndex( const OUString& rIndexString )
|
|
|
|
{
|
|
|
|
sal_Int32 nRet = -1;
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !rIndexString.isEmpty() )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
nRet = rIndexString.toInt32();
|
|
|
|
if( nRet < -1 )
|
|
|
|
nRet = -1;
|
|
|
|
}
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_parseCooSysIndices( sal_Int32& rnDiagram, sal_Int32& rnCooSys, const OUString& rString )
|
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
rnDiagram = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "D=" ) );
|
|
|
|
rnCooSys = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "CS=" ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_parseAxisIndices( sal_Int32& rnDimensionIndex, sal_Int32& rnAxisIndex, const OUString& rString )
|
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
OUString aAxisIndexString = lcl_getIndexStringAfterString( rString, ":Axis=" );
|
2007-05-22 18:03:13 +00:00
|
|
|
sal_Int32 nCharacterIndex=0;
|
|
|
|
rnDimensionIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
|
|
|
|
rnAxisIndex = lcl_StringToIndex( aAxisIndexString.getToken( 0, ',', nCharacterIndex ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_parseGridIndices( sal_Int32& rnSubGridIndex, const OUString& rString )
|
|
|
|
{
|
|
|
|
rnSubGridIndex = -1;
|
2013-01-30 11:44:23 +01:00
|
|
|
rnSubGridIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, ":SubGrid=" ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_parseSeriesIndices( sal_Int32& rnChartTypeIndex, sal_Int32& rnSeriesIndex, sal_Int32& rnPointIndex, const OUString& rString )
|
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
rnChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "CT=" ) );
|
|
|
|
rnSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "Series=" ) );
|
|
|
|
rnPointIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rString, "Point=" ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void lcl_getDiagramAndCooSys( const OUString& rObjectCID
|
|
|
|
, const Reference< frame::XModel >& xChartModel
|
|
|
|
, Reference< XDiagram >& xDiagram
|
|
|
|
, Reference< XCoordinateSystem >& xCooSys )
|
|
|
|
{
|
|
|
|
sal_Int32 nDiagramIndex = -1;
|
|
|
|
sal_Int32 nCooSysIndex = -1;
|
|
|
|
lcl_parseCooSysIndices( nDiagramIndex, nCooSysIndex, rObjectCID );
|
|
|
|
xDiagram = ChartModelHelper::findDiagram( xChartModel );//todo use nDiagramIndex when more than one diagram is possible in future
|
|
|
|
if( !xDiagram.is() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( nCooSysIndex > -1 )
|
|
|
|
{
|
|
|
|
Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
|
|
|
|
if( xCooSysContainer.is() )
|
|
|
|
{
|
|
|
|
uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
|
|
|
|
if( nCooSysIndex < aCooSysList.getLength() )
|
|
|
|
xCooSys = aCooSysList[nCooSysIndex];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} //anonymous namespace
|
|
|
|
|
2009-07-21 14:09:00 +00:00
|
|
|
ObjectIdentifier::ObjectIdentifier()
|
|
|
|
:m_aObjectCID( OUString() )
|
2015-11-10 10:11:17 +01:00
|
|
|
,m_xAdditionalShape( nullptr )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectIdentifier::ObjectIdentifier( const OUString& rObjectCID )
|
|
|
|
:m_aObjectCID( rObjectCID )
|
2015-11-10 10:11:17 +01:00
|
|
|
,m_xAdditionalShape( nullptr )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectIdentifier::ObjectIdentifier( const Reference< drawing::XShape >& rxShape )
|
|
|
|
:m_aObjectCID( OUString() )
|
|
|
|
,m_xAdditionalShape( rxShape )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectIdentifier::ObjectIdentifier( const Any& rAny )
|
|
|
|
:m_aObjectCID( OUString() )
|
2015-11-10 10:11:17 +01:00
|
|
|
,m_xAdditionalShape( nullptr )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
const uno::Type& rType = rAny.getValueType();
|
2014-05-05 23:24:25 +02:00
|
|
|
if ( rType == cppu::UnoType<OUString>::get() )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
rAny >>= m_aObjectCID;
|
|
|
|
}
|
2014-05-07 23:32:15 +02:00
|
|
|
else if ( rType == cppu::UnoType< drawing::XShape >::get() )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
rAny >>= m_xAdditionalShape;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectIdentifier::~ObjectIdentifier()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectIdentifier::ObjectIdentifier( const ObjectIdentifier& rOID )
|
|
|
|
:m_aObjectCID( rOID.m_aObjectCID )
|
|
|
|
,m_xAdditionalShape( rOID.m_xAdditionalShape )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectIdentifier& ObjectIdentifier::operator=( const ObjectIdentifier& rOID )
|
|
|
|
{
|
|
|
|
m_aObjectCID = rOID.m_aObjectCID;
|
|
|
|
m_xAdditionalShape = rOID.m_xAdditionalShape;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::operator==( const ObjectIdentifier& rOID ) const
|
|
|
|
{
|
2009-07-28 18:08:14 +00:00
|
|
|
if ( areIdenticalObjects( m_aObjectCID, rOID.m_aObjectCID ) &&
|
2009-07-21 14:09:00 +00:00
|
|
|
( m_xAdditionalShape == rOID.m_xAdditionalShape ) )
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-07-28 18:08:14 +00:00
|
|
|
bool ObjectIdentifier::operator!=( const ObjectIdentifier& rOID ) const
|
|
|
|
{
|
|
|
|
return !operator==( rOID );
|
|
|
|
}
|
|
|
|
|
2009-07-21 14:09:00 +00:00
|
|
|
bool ObjectIdentifier::operator<( const ObjectIdentifier& rOID ) const
|
|
|
|
{
|
|
|
|
bool bReturn = false;
|
2011-12-10 22:03:11 -02:00
|
|
|
if ( !(m_aObjectCID.isEmpty() || rOID.m_aObjectCID.isEmpty()) )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
bReturn = ( m_aObjectCID.compareTo( rOID.m_aObjectCID ) < 0 );
|
|
|
|
}
|
2011-12-10 22:03:11 -02:00
|
|
|
else if ( !m_aObjectCID.isEmpty() )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
bReturn = true;
|
|
|
|
}
|
2011-12-10 22:03:11 -02:00
|
|
|
else if ( !rOID.m_aObjectCID.isEmpty() )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
|
|
|
bReturn = false;
|
|
|
|
}
|
|
|
|
else if ( m_xAdditionalShape.is() && rOID.m_xAdditionalShape.is() )
|
|
|
|
{
|
|
|
|
bReturn = ( m_xAdditionalShape < rOID.m_xAdditionalShape );
|
|
|
|
}
|
|
|
|
return bReturn;
|
|
|
|
}
|
|
|
|
|
2013-10-15 07:55:26 +02:00
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
|
|
|
|
const Reference< uno::XInterface >& xObject
|
|
|
|
, ChartModel& rModel)
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
|
|
|
|
OUString aObjectID;
|
|
|
|
OUString aParentParticle;
|
|
|
|
OUString aDragMethodServiceName;
|
|
|
|
OUString aDragParameterString;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//title
|
|
|
|
Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
|
|
|
|
if( xTitle.is() )
|
|
|
|
{
|
|
|
|
TitleHelper::eTitleType aTitleType;
|
|
|
|
if( TitleHelper::getTitleType( aTitleType, xTitle, rModel ) )
|
|
|
|
{
|
|
|
|
eObjectType = OBJECTTYPE_TITLE;
|
|
|
|
aParentParticle = lcl_getTitleParentParticle( aTitleType );
|
|
|
|
aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
|
|
|
|
eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//axis
|
|
|
|
Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
|
|
|
|
if( xAxis.is() )
|
|
|
|
{
|
|
|
|
Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, rModel.getFirstDiagram() ) );
|
|
|
|
OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, rModel ) );
|
|
|
|
sal_Int32 nDimensionIndex=-1;
|
|
|
|
sal_Int32 nAxisIndex=-1;
|
|
|
|
AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
|
|
|
|
OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
|
|
|
|
return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
|
|
|
|
}
|
|
|
|
|
|
|
|
//legend
|
|
|
|
Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
|
|
|
|
if( xLegend.is() )
|
|
|
|
{
|
|
|
|
return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend, rModel ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//diagram
|
|
|
|
Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
|
|
|
|
if( xDiagram.is() )
|
|
|
|
{
|
|
|
|
return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, rModel ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//todo
|
|
|
|
//XDataSeries
|
|
|
|
//CooSys
|
|
|
|
//charttype
|
|
|
|
//datapoint?
|
|
|
|
//Gridproperties
|
|
|
|
}
|
|
|
|
catch(const uno::Exception& ex)
|
|
|
|
{
|
|
|
|
ASSERT_EXCEPTION( ex );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( eObjectType != OBJECTTYPE_UNKNOWN )
|
|
|
|
{
|
|
|
|
aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
|
|
|
|
eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OSL_FAIL("give object could not be identifed in createClassifiedIdentifierForObject");
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifierForObject(
|
|
|
|
const Reference< uno::XInterface >& xObject
|
|
|
|
, const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
enum ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
|
|
|
|
OUString aObjectID;
|
|
|
|
OUString aParentParticle;
|
|
|
|
OUString aDragMethodServiceName;
|
|
|
|
OUString aDragParameterString;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
//title
|
Revert "fdo#46808, Convert chart2::Title service to new style"
This reverts commit d256dbede60533369d1aac64cca34721183f6a8a:
For one, the new css.chart2.XTitle2 looked unfinished, in that it transfered the
direct properties of the old-style css.chart2.Title service into attributes, but
left out all the properties inherited by the old-style service from
css.style.ParagraphProperties, css.drawing.FillProperties,
css.drawing.LineProperties (and that missing FIXME css.layout.LayoutElement,
whatever that is supposed to be). This needs more thought, to either make
available all propertiers as attributes, or none.
For another, this broke JunitTest_chart2_unoapi (sch.ChXChartDocument,
sch.ChartTitle), for hard-to-debug reasons.
Conflicts:
chart2/source/model/main/Title.cxx
chart2/source/model/main/Title.hxx
offapi/com/sun/star/chart2/XTitle2.idl
sc/source/filter/inc/xlchart.hxx
Change-Id: I4747208a13984904d0e409ea49a73b0f667c86c7
2013-05-23 10:11:49 +02:00
|
|
|
Reference< XTitle > xTitle( xObject, uno::UNO_QUERY );
|
2007-05-22 18:03:13 +00:00
|
|
|
if( xTitle.is() )
|
|
|
|
{
|
|
|
|
TitleHelper::eTitleType aTitleType;
|
|
|
|
if( TitleHelper::getTitleType( aTitleType, xTitle, xChartModel ) )
|
|
|
|
{
|
|
|
|
eObjectType = OBJECTTYPE_TITLE;
|
|
|
|
aParentParticle = lcl_getTitleParentParticle( aTitleType );
|
|
|
|
aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
|
|
|
|
eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//axis
|
|
|
|
Reference< XAxis > xAxis( xObject, uno::UNO_QUERY );
|
|
|
|
if( xAxis.is() )
|
|
|
|
{
|
|
|
|
Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemOfAxis( xAxis, ChartModelHelper::findDiagram( xChartModel ) ) );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aCooSysParticle( createParticleForCoordinateSystem( xCooSys, xChartModel ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
sal_Int32 nDimensionIndex=-1;
|
|
|
|
sal_Int32 nAxisIndex=-1;
|
|
|
|
AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex );
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aAxisParticle( createParticleForAxis( nDimensionIndex, nAxisIndex ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
return createClassifiedIdentifierForParticles( aCooSysParticle, aAxisParticle );
|
|
|
|
}
|
|
|
|
|
|
|
|
//legend
|
|
|
|
Reference< XLegend > xLegend( xObject, uno::UNO_QUERY );
|
|
|
|
if( xLegend.is() )
|
|
|
|
{
|
|
|
|
return createClassifiedIdentifierForParticle( createParticleForLegend( xLegend, xChartModel ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//diagram
|
|
|
|
Reference< XDiagram > xDiagram( xObject, uno::UNO_QUERY );
|
|
|
|
if( xDiagram.is() )
|
|
|
|
{
|
|
|
|
return createClassifiedIdentifierForParticle( createParticleForDiagram( xDiagram, xChartModel ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
//todo
|
|
|
|
//XDataSeries
|
|
|
|
//CooSys
|
|
|
|
//charttype
|
|
|
|
//datapoint?
|
|
|
|
//Gridproperties
|
|
|
|
}
|
2011-11-29 02:06:57 +09:00
|
|
|
catch(const uno::Exception& ex)
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
ASSERT_EXCEPTION( ex );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( eObjectType != OBJECTTYPE_UNKNOWN )
|
|
|
|
{
|
|
|
|
aRet = ObjectIdentifier::createClassifiedIdentifierWithParent(
|
|
|
|
eObjectType, aObjectID, aParentParticle, aDragMethodServiceName, aDragParameterString );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2011-05-21 10:11:48 +02:00
|
|
|
OSL_FAIL("give object could not be identifed in createClassifiedIdentifierForObject");
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifierForParticle(
|
|
|
|
const OUString& rParticle )
|
|
|
|
{
|
|
|
|
return ObjectIdentifier::createClassifiedIdentifierForParticles( rParticle, OUString() );
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifierForParticles(
|
|
|
|
const OUString& rParentParticle
|
|
|
|
, const OUString& rChildParticle
|
|
|
|
, const OUString& rDragMethodServiceName
|
|
|
|
, const OUString& rDragParameterString )
|
|
|
|
{
|
|
|
|
ObjectType eObjectType( ObjectIdentifier::getObjectType( rChildParticle ) );
|
|
|
|
if( eObjectType == OBJECTTYPE_UNKNOWN )
|
|
|
|
eObjectType = ObjectIdentifier::getObjectType( rParentParticle );
|
|
|
|
|
|
|
|
OUStringBuffer aRet( m_aProtocol );
|
|
|
|
aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
|
2014-11-03 14:03:54 +02:00
|
|
|
if(aRet.getLength() > (sal_Int32)strlen(m_aProtocol))
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("/");
|
2007-05-22 18:03:13 +00:00
|
|
|
|
2011-12-10 22:03:11 -02:00
|
|
|
if(!rParentParticle.isEmpty())
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
aRet.append(rParentParticle);
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !rChildParticle.isEmpty() )
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
aRet.append(rChildParticle);
|
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2013-10-15 07:55:26 +02:00
|
|
|
OUString ObjectIdentifier::createParticleForDiagram(
|
|
|
|
const Reference< XDiagram >& /*xDiagram*/
|
|
|
|
, ChartModel& /*xChartModel*/ )
|
|
|
|
{
|
|
|
|
//todo: if more than one diagram is implemeted, add the correct diagram index here
|
2014-11-03 14:03:54 +02:00
|
|
|
return OUString("D=0");
|
2013-10-15 07:55:26 +02:00
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
OUString ObjectIdentifier::createParticleForDiagram(
|
2007-07-25 08:00:27 +00:00
|
|
|
const Reference< XDiagram >& /*xDiagram*/
|
|
|
|
, const Reference< frame::XModel >& /*xChartModel*/ )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
//todo: if more than one diagram is implemeted, add the correct diagram index here
|
2014-11-03 14:03:54 +02:00
|
|
|
return OUString("D=0");
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
2013-10-15 07:55:26 +02:00
|
|
|
OUString ObjectIdentifier::createParticleForCoordinateSystem(
|
|
|
|
const Reference< XCoordinateSystem >& xCooSys
|
|
|
|
, ChartModel& rModel )
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
|
|
|
|
Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
|
|
|
|
Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
|
|
|
|
if( xCooSysContainer.is() )
|
|
|
|
{
|
|
|
|
sal_Int32 nCooSysIndex = 0;
|
|
|
|
uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
|
|
|
|
for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
|
|
|
|
{
|
|
|
|
Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
|
|
|
|
if( xCooSys == xCurrentCooSys )
|
|
|
|
{
|
|
|
|
aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, rModel );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":CS=");
|
2013-10-15 07:55:26 +02:00
|
|
|
aRet.append( OUString::number( nCooSysIndex ) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
OUString ObjectIdentifier::createParticleForCoordinateSystem(
|
|
|
|
const Reference< XCoordinateSystem >& xCooSys
|
|
|
|
, const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
|
|
|
|
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
|
|
|
|
Reference< XCoordinateSystemContainer > xCooSysContainer( xDiagram, uno::UNO_QUERY );
|
|
|
|
if( xCooSysContainer.is() )
|
|
|
|
{
|
|
|
|
sal_Int32 nCooSysIndex = 0;
|
|
|
|
uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( xCooSysContainer->getCoordinateSystems() );
|
|
|
|
for( ; nCooSysIndex < aCooSysList.getLength(); ++nCooSysIndex )
|
|
|
|
{
|
|
|
|
Reference< XCoordinateSystem > xCurrentCooSys( aCooSysList[nCooSysIndex] );
|
|
|
|
if( xCooSys == xCurrentCooSys )
|
|
|
|
{
|
|
|
|
aRet = ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":CS=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nCooSysIndex ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createParticleForAxis(
|
|
|
|
sal_Int32 nDimensionIndex
|
|
|
|
, sal_Int32 nAxisIndex )
|
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
OUStringBuffer aRet("Axis=");
|
2007-05-22 18:03:13 +00:00
|
|
|
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nDimensionIndex ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(",");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nAxisIndex ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createParticleForGrid(
|
|
|
|
sal_Int32 nDimensionIndex
|
|
|
|
, sal_Int32 nAxisIndex )
|
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
OUStringBuffer aRet("Axis=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nDimensionIndex ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(",");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nAxisIndex ) );
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet.append( ":Grid=0" );
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifierForGrid(
|
|
|
|
const Reference< XAxis >& xAxis
|
|
|
|
, const Reference< frame::XModel >& xChartModel
|
|
|
|
, sal_Int32 nSubGridIndex )
|
|
|
|
{
|
|
|
|
//-1: main grid, 0: first subgrid etc
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aAxisCID( createClassifiedIdentifierForObject( xAxis, xChartModel ) );
|
|
|
|
OUString aGridCID( addChildParticle( aAxisCID
|
2007-05-22 18:03:13 +00:00
|
|
|
, createChildParticleWithIndex( OBJECTTYPE_GRID, 0 ) ) );
|
|
|
|
if( nSubGridIndex >= 0 )
|
|
|
|
{
|
|
|
|
aGridCID = addChildParticle( aGridCID
|
|
|
|
, createChildParticleWithIndex( OBJECTTYPE_SUBGRID, 0 ) );
|
|
|
|
}
|
|
|
|
return aGridCID;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createParticleForSeries(
|
|
|
|
sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex
|
|
|
|
, sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex )
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("D=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nDiagramIndex ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":CS=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nCooSysIndex ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":CT=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nChartTypeIndex ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append(getStringForType( OBJECTTYPE_DATA_SERIES ));
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( nSeriesIndex ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2013-10-15 07:55:26 +02:00
|
|
|
OUString ObjectIdentifier::createParticleForLegend(
|
|
|
|
const Reference< XLegend >& /*xLegend*/
|
|
|
|
, ChartModel& rModel )
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
|
|
|
|
Reference< XDiagram > xDiagram( rModel.getFirstDiagram() );
|
|
|
|
//todo: if more than one diagram is implemeted, find the correct diagram which is owner of the given legend
|
|
|
|
|
|
|
|
aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, rModel ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2013-10-15 07:55:26 +02:00
|
|
|
aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("=");
|
2013-10-15 07:55:26 +02:00
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
OUString ObjectIdentifier::createParticleForLegend(
|
2007-07-25 08:00:27 +00:00
|
|
|
const Reference< XLegend >& /*xLegend*/
|
2007-05-22 18:03:13 +00:00
|
|
|
, const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
OUStringBuffer aRet;
|
|
|
|
|
|
|
|
Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
|
2013-05-06 20:07:23 +02:00
|
|
|
//todo: if more than one diagram is implemeted, find the correct diagram which is owner of the given legend
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
aRet.append( ObjectIdentifier::createParticleForDiagram( xDiagram, xChartModel ) );
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append(getStringForType( OBJECTTYPE_LEGEND ));
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("=");
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifier(
|
|
|
|
enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES
|
|
|
|
, const OUString& rParticleID )//e.g. SeriesID
|
|
|
|
{
|
|
|
|
return createClassifiedIdentifierWithParent(
|
2014-11-03 14:03:54 +02:00
|
|
|
eObjectType, rParticleID, OUString() );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createClassifiedIdentifierWithParent(
|
|
|
|
enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID
|
|
|
|
, const OUString& rParticleID //e.g. Point Index or SubGrid Index
|
|
|
|
, const OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId"
|
|
|
|
, const OUString& rDragMethodServiceName
|
|
|
|
, const OUString& rDragParameterString
|
|
|
|
)
|
|
|
|
//, bool bIsMultiClickObject ) //e.g. true
|
|
|
|
{
|
|
|
|
//e.g. "MultiClick/Series=2:Point=34"
|
|
|
|
|
|
|
|
OUStringBuffer aRet( m_aProtocol );
|
|
|
|
aRet.append( lcl_createClassificationStringForType( eObjectType, rDragMethodServiceName, rDragParameterString ));
|
2014-11-03 14:03:54 +02:00
|
|
|
if(aRet.getLength() > (sal_Int32)strlen(m_aProtocol))
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("/");
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append(rParentPartical);
|
2011-12-10 22:03:11 -02:00
|
|
|
if(!rParentPartical.isEmpty())
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
aRet.append(getStringForType( eObjectType ));
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("=");
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append(rParticleID);
|
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
const OUString& ObjectIdentifier::getPieSegmentDragMethodServiceName()
|
|
|
|
{
|
|
|
|
return m_aPieSegmentDragMethodServiceName;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createPieSegmentDragParameterString(
|
|
|
|
sal_Int32 nOffsetPercent
|
|
|
|
, const awt::Point& rMinimumPosition
|
|
|
|
, const awt::Point& rMaximumPosition )
|
|
|
|
{
|
2013-08-21 15:07:31 +02:00
|
|
|
OUStringBuffer aRet( OUString::number( nOffsetPercent ) );
|
2013-11-14 08:16:35 +02:00
|
|
|
aRet.append( ',');
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( rMinimumPosition.X ) );
|
2013-11-14 08:16:35 +02:00
|
|
|
aRet.append( ',');
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( rMinimumPosition.Y ) );
|
2013-11-14 08:16:35 +02:00
|
|
|
aRet.append( ',');
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( rMaximumPosition.X ) );
|
2013-11-14 08:16:35 +02:00
|
|
|
aRet.append( ',');
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append( OUString::number( rMaximumPosition.Y ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::parsePieSegmentDragParameterString(
|
|
|
|
const OUString& rDragParameterString
|
|
|
|
, sal_Int32& rOffsetPercent
|
|
|
|
, awt::Point& rMinimumPosition
|
|
|
|
, awt::Point& rMaximumPosition )
|
|
|
|
{
|
|
|
|
sal_Int32 nCharacterIndex = 0;
|
|
|
|
|
|
|
|
OUString aValueString( rDragParameterString.getToken( 0, ',', nCharacterIndex ) );
|
|
|
|
rOffsetPercent = aValueString.toInt32();
|
|
|
|
if( nCharacterIndex < 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
|
|
|
|
rMinimumPosition.X = aValueString.toInt32();
|
|
|
|
if( nCharacterIndex < 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
|
|
|
|
rMinimumPosition.Y = aValueString.toInt32();
|
|
|
|
if( nCharacterIndex < 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
|
|
|
|
rMaximumPosition.X = aValueString.toInt32();
|
|
|
|
if( nCharacterIndex < 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
aValueString = rDragParameterString.getToken( 0, ',', nCharacterIndex );
|
|
|
|
rMaximumPosition.Y = aValueString.toInt32();
|
|
|
|
if( nCharacterIndex < 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::getDragMethodServiceName( const OUString& rCID )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
sal_Int32 nIndexStart = rCID.indexOf( m_aDragMethodEquals );
|
|
|
|
if( nIndexStart != -1 )
|
|
|
|
{
|
|
|
|
nIndexStart = rCID.indexOf( '=', nIndexStart );
|
|
|
|
if( nIndexStart != -1 )
|
|
|
|
{
|
|
|
|
nIndexStart++;
|
|
|
|
sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
|
|
|
|
if( nNextSlash != -1 )
|
|
|
|
{
|
|
|
|
sal_Int32 nIndexEnd = nNextSlash;
|
|
|
|
sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
|
|
|
|
if( nNextColon < nNextSlash )
|
|
|
|
nIndexEnd = nNextColon;
|
|
|
|
aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::getDragParameterString( const OUString& rCID )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
sal_Int32 nIndexStart = rCID.indexOf( m_aDragParameterEquals );
|
|
|
|
if( nIndexStart != -1 )
|
|
|
|
{
|
|
|
|
nIndexStart = rCID.indexOf( '=', nIndexStart );
|
|
|
|
if( nIndexStart != -1 )
|
|
|
|
{
|
|
|
|
nIndexStart++;
|
|
|
|
sal_Int32 nNextSlash = rCID.indexOf( '/', nIndexStart );
|
|
|
|
if( nNextSlash != -1 )
|
|
|
|
{
|
|
|
|
sal_Int32 nIndexEnd = nNextSlash;
|
|
|
|
sal_Int32 nNextColon = rCID.indexOf( ':', nIndexStart );
|
|
|
|
if( nNextColon < nNextSlash )
|
|
|
|
nIndexEnd = nNextColon;
|
|
|
|
aRet = rCID.copy(nIndexStart,nIndexEnd-nIndexStart);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::isDragableObject( const OUString& rClassifiedIdentifier )
|
|
|
|
{
|
2012-05-02 10:23:02 +01:00
|
|
|
bool bReturn = false;
|
2007-05-22 18:03:13 +00:00
|
|
|
ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
|
|
|
|
switch( eObjectType )
|
|
|
|
{
|
|
|
|
case OBJECTTYPE_TITLE:
|
|
|
|
case OBJECTTYPE_LEGEND:
|
|
|
|
case OBJECTTYPE_DIAGRAM:
|
2007-11-23 11:06:27 +00:00
|
|
|
case OBJECTTYPE_DATA_CURVE_EQUATION:
|
2007-05-22 18:03:13 +00:00
|
|
|
//case OBJECTTYPE_DIAGRAM_WALL:
|
2012-05-02 10:23:02 +01:00
|
|
|
bReturn = true;
|
|
|
|
break;
|
2007-05-22 18:03:13 +00:00
|
|
|
default:
|
|
|
|
OUString aDragMethodServiceName( ObjectIdentifier::getDragMethodServiceName( rClassifiedIdentifier ) );
|
2012-05-02 10:23:02 +01:00
|
|
|
bReturn = !aDragMethodServiceName.isEmpty();
|
|
|
|
break;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
2012-05-02 10:23:02 +01:00
|
|
|
return bReturn;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
2009-08-10 17:14:29 +00:00
|
|
|
bool ObjectIdentifier::isDragableObject()
|
|
|
|
{
|
|
|
|
bool bReturn = false;
|
|
|
|
if ( isAutoGeneratedObject() )
|
|
|
|
{
|
|
|
|
bReturn = isDragableObject( m_aObjectCID );
|
|
|
|
}
|
|
|
|
else if ( isAdditionalShape() )
|
|
|
|
{
|
|
|
|
bReturn = true;
|
|
|
|
}
|
|
|
|
return bReturn;
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
bool ObjectIdentifier::isRotateableObject( const OUString& rClassifiedIdentifier )
|
|
|
|
{
|
2012-05-02 10:23:02 +01:00
|
|
|
bool bReturn = false;
|
2007-05-22 18:03:13 +00:00
|
|
|
ObjectType eObjectType = ObjectIdentifier::getObjectType( rClassifiedIdentifier );
|
|
|
|
switch( eObjectType )
|
|
|
|
{
|
|
|
|
case OBJECTTYPE_DIAGRAM:
|
|
|
|
//case OBJECTTYPE_DIAGRAM_WALL:
|
2012-05-02 10:23:02 +01:00
|
|
|
bReturn = true;
|
|
|
|
break;
|
2007-05-22 18:03:13 +00:00
|
|
|
default:
|
2012-05-02 10:23:02 +01:00
|
|
|
bReturn = false;
|
|
|
|
break;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
2012-05-02 10:23:02 +01:00
|
|
|
return bReturn;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::isMultiClickObject( const OUString& rClassifiedIdentifier )
|
|
|
|
{
|
|
|
|
//the name of a shape is it's ClassifiedIdentifier
|
|
|
|
|
|
|
|
//a MultiClickObject is an object that is selectable by more than one click only ;
|
|
|
|
//before a MultiClickObject can be selected it is necessary that a named parent group object
|
|
|
|
//was selected before;
|
|
|
|
|
|
|
|
//!!!!! by definition the name of a MultiClickObject starts with "CID/MultiClick:"
|
2014-11-03 14:03:54 +02:00
|
|
|
bool bRet = rClassifiedIdentifier.match( m_aMultiClick, strlen(m_aProtocol) );
|
2007-05-22 18:03:13 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::areSiblings( const OUString& rCID1, const OUString& rCID2 )
|
|
|
|
{
|
|
|
|
bool bRet=false;
|
|
|
|
sal_Int32 nLastSign1 = rCID1.lastIndexOf( '=' );
|
|
|
|
sal_Int32 nLastSign2 = rCID2.lastIndexOf( '=' );
|
|
|
|
if( nLastSign1 == rCID1.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
|
|
|
|
bRet=false;
|
|
|
|
else if( nLastSign2 == rCID2.indexOf( '=' ) )//CID cannot be sibling if only one "=" occurs
|
|
|
|
bRet=false;
|
|
|
|
else if( ObjectIdentifier::areIdenticalObjects( rCID1, rCID2 ) )
|
|
|
|
bRet=false;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
OUString aParent1( ObjectIdentifier::getFullParentParticle( rCID1 ) );
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !aParent1.isEmpty() )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
OUString aParent2( ObjectIdentifier::getFullParentParticle( rCID2 ) );
|
|
|
|
bRet=aParent1.equals(aParent2);
|
|
|
|
}
|
|
|
|
//legend entries are special:
|
|
|
|
if(!bRet)
|
|
|
|
{
|
|
|
|
if( OBJECTTYPE_LEGEND_ENTRY == getObjectType(rCID1)
|
|
|
|
&& OBJECTTYPE_LEGEND_ENTRY == getObjectType(rCID2) )
|
|
|
|
bRet = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return bRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 )
|
|
|
|
{
|
|
|
|
if( rCID1.equals( rCID2 ) )
|
|
|
|
return true;
|
|
|
|
//draggable pie or donut segments need special treatment, as their CIDs do change with offset
|
|
|
|
{
|
|
|
|
if( rCID1.indexOf( m_aPieSegmentDragMethodServiceName ) < 0
|
|
|
|
|| rCID2.indexOf( m_aPieSegmentDragMethodServiceName ) < 0 )
|
|
|
|
return false;
|
|
|
|
|
|
|
|
OUString aID1( ObjectIdentifier::getObjectID( rCID1 ) );
|
|
|
|
OUString aID2( ObjectIdentifier::getObjectID( rCID2 ) );
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !aID1.isEmpty() && aID1.equals( aID2 ) )
|
2007-05-22 18:03:13 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::getStringForType( ObjectType eObjectType )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
switch( eObjectType )
|
|
|
|
{
|
|
|
|
case OBJECTTYPE_PAGE:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Page";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_TITLE:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Title";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_LEGEND:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Legend";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_LEGEND_ENTRY:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="LegendEntry";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DIAGRAM:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="D";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DIAGRAM_WALL:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="DiagramWall";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DIAGRAM_FLOOR:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="DiagramFloor";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_AXIS:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Axis";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_AXIS_UNITLABEL:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="AxisUnitLabel";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_GRID:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Grid";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_SUBGRID:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="SubGrid";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_SERIES:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Series";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_POINT:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Point";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_LABELS:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="DataLabels";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_LABEL:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="DataLabel";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_X:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="ErrorsX";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_Y:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="ErrorsY";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_Z:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="ErrorsZ";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_CURVE:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Curve";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
2007-11-23 11:06:27 +00:00
|
|
|
case OBJECTTYPE_DATA_CURVE_EQUATION:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Equation";
|
2007-11-23 11:06:27 +00:00
|
|
|
break;
|
2007-05-22 18:03:13 +00:00
|
|
|
case OBJECTTYPE_DATA_AVERAGE_LINE:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="Average";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_STOCK_RANGE:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="StockRange";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_STOCK_LOSS:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="StockLoss";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_STOCK_GAIN:
|
2013-01-30 11:44:23 +01:00
|
|
|
aRet="StockGain";
|
2007-05-22 18:03:13 +00:00
|
|
|
break;
|
|
|
|
default: //OBJECTTYPE_UNKNOWN
|
|
|
|
;
|
|
|
|
}
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
ObjectType ObjectIdentifier::getObjectType( const OUString& rCID )
|
|
|
|
{
|
|
|
|
ObjectType eRet;
|
|
|
|
sal_Int32 nLastSign = rCID.lastIndexOf( ':' );//last sign before the type string
|
|
|
|
if(nLastSign==-1)
|
|
|
|
nLastSign = rCID.lastIndexOf( '/' );
|
|
|
|
if(nLastSign==-1)
|
|
|
|
{
|
|
|
|
sal_Int32 nEndIndex = rCID.lastIndexOf( '=' );
|
|
|
|
if(nEndIndex==-1)
|
|
|
|
return OBJECTTYPE_UNKNOWN;
|
|
|
|
nLastSign = 0;
|
|
|
|
}
|
|
|
|
if( nLastSign>0 )
|
|
|
|
nLastSign++;
|
|
|
|
|
2013-01-30 11:44:23 +01:00
|
|
|
if( rCID.match("Page",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_PAGE;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Title",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_TITLE;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("LegendEntry",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_LEGEND_ENTRY;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Legend",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_LEGEND;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("DiagramWall",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DIAGRAM_WALL;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("DiagramFloor",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DIAGRAM_FLOOR;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("D=",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DIAGRAM;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("AxisUnitLabel",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_AXIS_UNITLABEL;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Axis",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_AXIS;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Grid",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_GRID;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("SubGrid",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_SUBGRID;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Series",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_SERIES;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Point",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_POINT;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("DataLabels",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_LABELS;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("DataLabel",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_LABEL;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("ErrorsX",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_ERRORS_X;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("ErrorsY",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_ERRORS_Y;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("ErrorsZ",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_ERRORS_Z;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Curve",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_CURVE;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Equation",nLastSign) )
|
2007-11-23 11:06:27 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_CURVE_EQUATION;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("Average",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_AVERAGE_LINE;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("StockRange",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_STOCK_RANGE;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("StockLoss",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_STOCK_LOSS;
|
2013-01-30 11:44:23 +01:00
|
|
|
else if( rCID.match("StockGain",nLastSign) )
|
2007-05-22 18:03:13 +00:00
|
|
|
eRet = OBJECTTYPE_DATA_STOCK_GAIN;
|
|
|
|
else
|
|
|
|
eRet = OBJECTTYPE_UNKNOWN;
|
|
|
|
|
|
|
|
return eRet;
|
|
|
|
}
|
|
|
|
|
2009-07-21 14:09:00 +00:00
|
|
|
ObjectType ObjectIdentifier::getObjectType()
|
|
|
|
{
|
|
|
|
ObjectType eObjectType( OBJECTTYPE_UNKNOWN );
|
2009-08-10 17:14:29 +00:00
|
|
|
if ( isAutoGeneratedObject() )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
2009-08-10 17:14:29 +00:00
|
|
|
eObjectType = getObjectType( m_aObjectCID );
|
2009-07-21 14:09:00 +00:00
|
|
|
}
|
2009-08-10 17:14:29 +00:00
|
|
|
else if ( isAdditionalShape() )
|
2009-07-21 14:09:00 +00:00
|
|
|
{
|
2009-08-10 17:14:29 +00:00
|
|
|
eObjectType = OBJECTTYPE_SHAPE;
|
2009-07-21 14:09:00 +00:00
|
|
|
}
|
|
|
|
return eObjectType;
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
OUString ObjectIdentifier::createDataCurveCID(
|
|
|
|
const OUString& rSeriesParticle
|
|
|
|
, sal_Int32 nCurveIndex
|
|
|
|
, bool bAverageLine )
|
|
|
|
{
|
2013-08-21 15:07:31 +02:00
|
|
|
OUString aParticleID( OUString::number( nCurveIndex ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
ObjectType eType = bAverageLine ? OBJECTTYPE_DATA_AVERAGE_LINE : OBJECTTYPE_DATA_CURVE;
|
|
|
|
return createClassifiedIdentifierWithParent( eType, aParticleID, rSeriesParticle );
|
|
|
|
}
|
|
|
|
|
2007-11-23 11:06:27 +00:00
|
|
|
OUString ObjectIdentifier::createDataCurveEquationCID(
|
|
|
|
const OUString& rSeriesParticle
|
|
|
|
, sal_Int32 nCurveIndex )
|
|
|
|
{
|
2013-08-21 15:07:31 +02:00
|
|
|
OUString aParticleID( OUString::number( nCurveIndex ) );
|
2007-11-23 11:06:27 +00:00
|
|
|
return createClassifiedIdentifierWithParent( OBJECTTYPE_DATA_CURVE_EQUATION, aParticleID, rSeriesParticle );
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString ObjectIdentifier::addChildParticle( const OUString& rParticle, const OUString& rChildParticle )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
OUStringBuffer aRet(rParticle);
|
|
|
|
|
2013-06-17 16:32:16 +02:00
|
|
|
if( !aRet.isEmpty() && !rChildParticle.isEmpty() )
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append(":");
|
2011-12-10 22:03:11 -02:00
|
|
|
if( !rChildParticle.isEmpty() )
|
2007-05-22 18:03:13 +00:00
|
|
|
aRet.append(rChildParticle);
|
|
|
|
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString ObjectIdentifier::createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
OUStringBuffer aRet( getStringForType( eObjectType ) );
|
2013-06-17 16:32:16 +02:00
|
|
|
if( !aRet.isEmpty() )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
2015-08-31 08:04:33 +02:00
|
|
|
aRet.append("=");
|
2013-08-21 15:07:31 +02:00
|
|
|
aRet.append(OUString::number(nIndex));
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
return aRet.makeStringAndClear();
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
sal_Int32 ObjectIdentifier::getIndexFromParticleOrCID( const OUString& rParticleOrCID )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
OUString aIndexString = lcl_getIndexStringAfterString( rParticleOrCID, "=" );
|
2007-05-22 18:03:13 +00:00
|
|
|
sal_Int32 nCharacterIndex=0;
|
2013-04-07 22:18:57 +02:00
|
|
|
sal_Int32 nRet = lcl_StringToIndex( aIndexString.getToken( 0, ',', nCharacterIndex ) );
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
return nRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createSeriesSubObjectStub( ObjectType eSubObjectType
|
2013-04-07 12:06:47 +02:00
|
|
|
, const OUString& rSeriesParticle
|
|
|
|
, const OUString& rDragMethodServiceName
|
|
|
|
, const OUString& rDragParameterString )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
OUString aChildParticle( getStringForType( eSubObjectType ) );
|
2013-01-30 11:44:23 +01:00
|
|
|
aChildParticle+=("=");
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
return createClassifiedIdentifierForParticles(
|
|
|
|
rSeriesParticle, aChildParticle
|
|
|
|
, rDragMethodServiceName, rDragParameterString );
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex )
|
|
|
|
{
|
|
|
|
OUString aRet(rPointCID_Stub);
|
2013-08-21 15:07:31 +02:00
|
|
|
return aRet+=OUString::number( nIndex );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::getParticleID( const OUString& rCID )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
sal_Int32 nLast = rCID.lastIndexOf('=');
|
|
|
|
if(nLast>=0)
|
|
|
|
aRet = rCID.copy(++nLast);
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
OUString ObjectIdentifier::getFullParentParticle( const OUString& rCID )
|
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
sal_Int32 nStartPos = rCID.lastIndexOf('/');
|
|
|
|
if( nStartPos>=0 )
|
|
|
|
{
|
|
|
|
nStartPos++;
|
|
|
|
sal_Int32 nEndPos = rCID.lastIndexOf(':');
|
|
|
|
if( nEndPos>=0 && nStartPos < nEndPos )
|
|
|
|
{
|
|
|
|
aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString ObjectIdentifier::getObjectID( const OUString& rCID )
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
OUString aRet;
|
|
|
|
|
|
|
|
sal_Int32 nStartPos = rCID.lastIndexOf('/');
|
|
|
|
if( nStartPos>=0 )
|
|
|
|
{
|
|
|
|
nStartPos++;
|
|
|
|
sal_Int32 nEndPos = rCID.getLength();
|
|
|
|
aRet = rCID.copy(nStartPos,nEndPos-nStartPos);
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRet;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::isCID( const OUString& rName )
|
|
|
|
{
|
2011-12-10 22:03:11 -02:00
|
|
|
return !rName.isEmpty() && rName.match( m_aProtocol );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
|
|
|
|
const OUString& rObjectCID,
|
|
|
|
const Reference< chart2::XChartDocument >& xChartDocument )
|
|
|
|
{
|
|
|
|
return ObjectIdentifier::getObjectPropertySet(
|
|
|
|
rObjectCID, Reference< frame::XModel >( xChartDocument, uno::UNO_QUERY ));
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< beans::XPropertySet > ObjectIdentifier::getObjectPropertySet(
|
|
|
|
const OUString& rObjectCID
|
|
|
|
, const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
//return the model object that is indicated by rObjectCID
|
2011-12-10 22:03:11 -02:00
|
|
|
if(rObjectCID.isEmpty())
|
2015-11-10 10:11:17 +01:00
|
|
|
return nullptr;
|
2007-05-22 18:03:13 +00:00
|
|
|
if(!xChartModel.is())
|
2015-11-10 10:11:17 +01:00
|
|
|
return nullptr;
|
2007-05-22 18:03:13 +00:00
|
|
|
|
2015-11-10 10:11:17 +01:00
|
|
|
Reference< beans::XPropertySet > xObjectProperties = nullptr;
|
2007-05-22 18:03:13 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
ObjectType eObjectType = ObjectIdentifier::getObjectType( rObjectCID );
|
|
|
|
OUString aParticleID = ObjectIdentifier::getParticleID( rObjectCID );
|
|
|
|
|
|
|
|
Reference< XDiagram > xDiagram;
|
|
|
|
Reference< XCoordinateSystem > xCooSys;
|
|
|
|
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
|
|
|
|
|
|
|
|
switch(eObjectType)
|
|
|
|
{
|
|
|
|
case OBJECTTYPE_PAGE:
|
|
|
|
{
|
|
|
|
Reference< XChartDocument > xChartDocument( xChartModel, uno::UNO_QUERY );
|
|
|
|
if( xChartDocument.is())
|
|
|
|
xObjectProperties.set( xChartDocument->getPageBackground() );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_TITLE:
|
|
|
|
{
|
|
|
|
TitleHelper::eTitleType aTitleType = getTitleTypeForCID( rObjectCID );
|
|
|
|
Reference< XTitle > xTitle( TitleHelper::getTitle( aTitleType, xChartModel ) );
|
|
|
|
xObjectProperties.set( xTitle, uno::UNO_QUERY );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_LEGEND:
|
|
|
|
{
|
|
|
|
if( xDiagram.is() )
|
|
|
|
xObjectProperties.set( xDiagram->getLegend(), uno::UNO_QUERY );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_LEGEND_ENTRY:
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DIAGRAM:
|
|
|
|
{
|
|
|
|
xObjectProperties.set( xDiagram, uno::UNO_QUERY );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DIAGRAM_WALL:
|
|
|
|
{
|
|
|
|
if( xDiagram.is() )
|
|
|
|
xObjectProperties.set( xDiagram->getWall() );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DIAGRAM_FLOOR:
|
|
|
|
{
|
|
|
|
if( xDiagram.is() )
|
|
|
|
xObjectProperties.set( xDiagram->getFloor() );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_AXIS:
|
|
|
|
{
|
|
|
|
sal_Int32 nDimensionIndex = -1;
|
|
|
|
sal_Int32 nAxisIndex = -1;
|
|
|
|
lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
|
|
|
|
|
|
|
|
Reference< chart2::XAxis > xAxis(
|
|
|
|
AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys ) );
|
|
|
|
if( xAxis.is() )
|
|
|
|
xObjectProperties.set( xAxis, uno::UNO_QUERY );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_AXIS_UNITLABEL:
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_GRID:
|
|
|
|
case OBJECTTYPE_SUBGRID:
|
|
|
|
{
|
|
|
|
sal_Int32 nDimensionIndex = -1;
|
|
|
|
sal_Int32 nAxisIndex = -1;
|
|
|
|
lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
|
|
|
|
|
|
|
|
sal_Int32 nSubGridIndex = -1;
|
|
|
|
lcl_parseGridIndices( nSubGridIndex, rObjectCID );
|
|
|
|
|
|
|
|
xObjectProperties.set( AxisHelper::getGridProperties( xCooSys , nDimensionIndex, nAxisIndex, nSubGridIndex ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_LABELS:
|
|
|
|
case OBJECTTYPE_DATA_SERIES:
|
|
|
|
{
|
|
|
|
Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
|
|
|
|
rObjectCID, xChartModel ) );
|
|
|
|
if( xSeries.is() )
|
2015-10-29 15:48:45 +02:00
|
|
|
xObjectProperties.set( xSeries, uno::UNO_QUERY );
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OBJECTTYPE_DATA_LABEL:
|
|
|
|
case OBJECTTYPE_DATA_POINT:
|
|
|
|
{
|
|
|
|
Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
|
|
|
|
rObjectCID, xChartModel ) );
|
|
|
|
if(xSeries.is())
|
|
|
|
{
|
|
|
|
sal_Int32 nIndex = aParticleID.toInt32();
|
|
|
|
xObjectProperties = xSeries->getDataPointByIndex( nIndex );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2012-03-16 19:29:07 +00:00
|
|
|
case OBJECTTYPE_DATA_ERRORS_X:
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_Y:
|
|
|
|
case OBJECTTYPE_DATA_ERRORS_Z:
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
Reference< XDataSeries > xSeries( ObjectIdentifier::getDataSeriesForCID(
|
|
|
|
rObjectCID, xChartModel ) );
|
|
|
|
if(xSeries.is())
|
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > xSeriesProp( xSeries, uno::UNO_QUERY );
|
|
|
|
Reference< beans::XPropertySet > xErrorBarProp;
|
|
|
|
if( xSeriesProp.is() )
|
|
|
|
{
|
2012-03-16 19:29:07 +00:00
|
|
|
OUString errorBar;
|
|
|
|
|
|
|
|
if ( eObjectType == OBJECTTYPE_DATA_ERRORS_X)
|
2014-06-26 19:35:48 -04:00
|
|
|
errorBar = CHART_UNONAME_ERRORBAR_X;
|
2012-03-18 00:14:48 +00:00
|
|
|
else if (eObjectType == OBJECTTYPE_DATA_ERRORS_Y)
|
2014-06-26 19:35:48 -04:00
|
|
|
errorBar = CHART_UNONAME_ERRORBAR_Y;
|
2012-03-16 19:29:07 +00:00
|
|
|
else
|
2013-01-30 11:44:23 +01:00
|
|
|
errorBar = "ErrorBarZ";
|
2012-03-16 19:29:07 +00:00
|
|
|
|
|
|
|
xSeriesProp->getPropertyValue( errorBar ) >>= xErrorBarProp;
|
2015-10-29 15:48:45 +02:00
|
|
|
xObjectProperties.set( xErrorBarProp, uno::UNO_QUERY );
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OBJECTTYPE_DATA_AVERAGE_LINE:
|
|
|
|
case OBJECTTYPE_DATA_CURVE:
|
2007-11-23 11:06:27 +00:00
|
|
|
case OBJECTTYPE_DATA_CURVE_EQUATION:
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
Reference< XRegressionCurveContainer > xRegressionContainer( ObjectIdentifier::getDataSeriesForCID(
|
|
|
|
rObjectCID, xChartModel ), uno::UNO_QUERY );
|
|
|
|
if(xRegressionContainer.is())
|
|
|
|
{
|
|
|
|
sal_Int32 nIndex = aParticleID.toInt32();
|
|
|
|
uno::Sequence< Reference< XRegressionCurve > > aCurveList =
|
|
|
|
xRegressionContainer->getRegressionCurves();
|
|
|
|
if( nIndex >= 0 && nIndex <aCurveList.getLength() )
|
2007-11-23 11:06:27 +00:00
|
|
|
{
|
|
|
|
if( eObjectType == OBJECTTYPE_DATA_CURVE_EQUATION )
|
|
|
|
xObjectProperties.set( aCurveList[nIndex]->getEquationProperties());
|
|
|
|
else
|
|
|
|
xObjectProperties.set( aCurveList[nIndex], uno::UNO_QUERY );
|
|
|
|
}
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case OBJECTTYPE_DATA_STOCK_RANGE:
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_STOCK_LOSS:
|
|
|
|
{
|
|
|
|
Reference<XChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
|
|
|
|
Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
|
|
|
|
if(xChartTypeProps.is())
|
2013-01-30 11:44:23 +01:00
|
|
|
xChartTypeProps->getPropertyValue( "BlackDay" ) >>= xObjectProperties;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case OBJECTTYPE_DATA_STOCK_GAIN:
|
|
|
|
{
|
|
|
|
Reference<XChartType> xChartType( lcl_getFirstStockChartType( xChartModel ) );
|
|
|
|
Reference< beans::XPropertySet > xChartTypeProps( xChartType, uno::UNO_QUERY );
|
|
|
|
if(xChartTypeProps.is())
|
2013-01-30 11:44:23 +01:00
|
|
|
xChartTypeProps->getPropertyValue( "WhiteDay" ) >>= xObjectProperties;
|
2007-05-22 18:03:13 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: //OBJECTTYPE_UNKNOWN
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-11-29 02:06:57 +09:00
|
|
|
catch(const uno::Exception& ex)
|
2007-05-22 18:03:13 +00:00
|
|
|
{
|
|
|
|
ASSERT_EXCEPTION( ex );
|
|
|
|
}
|
|
|
|
return xObjectProperties;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XAxis > ObjectIdentifier::getAxisForCID(
|
|
|
|
const OUString& rObjectCID
|
|
|
|
, const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
Reference< XDiagram > xDiagram;
|
|
|
|
Reference< XCoordinateSystem > xCooSys;
|
|
|
|
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
|
|
|
|
|
|
|
|
sal_Int32 nDimensionIndex = -1;
|
|
|
|
sal_Int32 nAxisIndex = -1;
|
|
|
|
lcl_parseAxisIndices( nDimensionIndex, nAxisIndex, rObjectCID );
|
|
|
|
|
|
|
|
return AxisHelper::getAxis( nDimensionIndex, nAxisIndex, xCooSys );
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XDataSeries > ObjectIdentifier::getDataSeriesForCID(
|
|
|
|
const OUString& rObjectCID
|
|
|
|
, const Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
2015-11-10 10:11:17 +01:00
|
|
|
Reference< XDataSeries > xSeries(nullptr);
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
Reference< XDiagram > xDiagram;
|
|
|
|
Reference< XCoordinateSystem > xCooSys;
|
|
|
|
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
|
|
|
|
|
|
|
|
sal_Int32 nChartTypeIndex = -1;
|
|
|
|
sal_Int32 nSeriesIndex = -1;
|
|
|
|
sal_Int32 nPointIndex = -1;
|
|
|
|
lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rObjectCID );
|
|
|
|
|
|
|
|
Reference< XDataSeriesContainer > xDataSeriesContainer( DiagramHelper::getChartTypeByIndex( xDiagram, nChartTypeIndex ), uno::UNO_QUERY );
|
|
|
|
if( xDataSeriesContainer.is() )
|
|
|
|
{
|
|
|
|
uno::Sequence< uno::Reference< XDataSeries > > aDataSeriesSeq( xDataSeriesContainer->getDataSeries() );
|
|
|
|
if( nSeriesIndex >= 0 && nSeriesIndex < aDataSeriesSeq.getLength() )
|
|
|
|
xSeries.set( aDataSeriesSeq[nSeriesIndex] );
|
|
|
|
}
|
|
|
|
|
|
|
|
return xSeries;
|
|
|
|
}
|
|
|
|
|
|
|
|
Reference< XDiagram > ObjectIdentifier::getDiagramForCID(
|
2013-04-07 12:06:47 +02:00
|
|
|
const OUString& rObjectCID
|
2007-05-22 18:03:13 +00:00
|
|
|
, const uno::Reference< frame::XModel >& xChartModel )
|
|
|
|
{
|
|
|
|
Reference< XDiagram > xDiagram;
|
|
|
|
|
|
|
|
Reference< XCoordinateSystem > xCooSys;
|
|
|
|
lcl_getDiagramAndCooSys( rObjectCID, xChartModel, xDiagram, xCooSys );
|
|
|
|
|
|
|
|
return xDiagram;
|
|
|
|
}
|
|
|
|
|
|
|
|
TitleHelper::eTitleType ObjectIdentifier::getTitleTypeForCID( const OUString& rCID )
|
|
|
|
{
|
2007-07-25 08:00:27 +00:00
|
|
|
TitleHelper::eTitleType eRet( TitleHelper::MAIN_TITLE );
|
2007-05-22 18:03:13 +00:00
|
|
|
|
|
|
|
OUString aParentParticle = ObjectIdentifier::getFullParentParticle( rCID );
|
|
|
|
const tTitleMap& rMap = lcl_getTitleMap();
|
|
|
|
tTitleMap::const_iterator aIt( rMap.begin() );
|
|
|
|
for( ;aIt != rMap.end(); ++aIt )
|
|
|
|
{
|
|
|
|
if( aParentParticle.equals( (*aIt).second ) )
|
|
|
|
{
|
|
|
|
eRet = (*aIt).first;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return eRet;
|
|
|
|
}
|
2008-02-18 15:01:37 +00:00
|
|
|
|
|
|
|
OUString ObjectIdentifier::getSeriesParticleFromCID( const OUString& rCID )
|
|
|
|
{
|
|
|
|
sal_Int32 nDiagramIndex = -1;
|
|
|
|
sal_Int32 nCooSysIndex = -1;
|
|
|
|
lcl_parseCooSysIndices( nDiagramIndex, nCooSysIndex, rCID );
|
|
|
|
|
|
|
|
sal_Int32 nChartTypeIndex = -1;
|
|
|
|
sal_Int32 nSeriesIndex = -1;
|
|
|
|
sal_Int32 nPointIndex = -1;
|
|
|
|
lcl_parseSeriesIndices( nChartTypeIndex, nSeriesIndex, nPointIndex, rCID );
|
|
|
|
|
|
|
|
return ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
|
|
|
|
}
|
2007-05-22 18:03:13 +00:00
|
|
|
|
2014-04-15 15:17:13 +02:00
|
|
|
OUString ObjectIdentifier::getMovedSeriesCID( const OUString& rObjectCID, bool bForward )
|
2007-09-18 14:09:26 +00:00
|
|
|
{
|
2013-01-30 11:44:23 +01:00
|
|
|
sal_Int32 nDiagramIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "CID/D=" ) );
|
|
|
|
sal_Int32 nCooSysIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "CS=" ) );
|
|
|
|
sal_Int32 nChartTypeIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "CT=" ) );
|
|
|
|
sal_Int32 nSeriesIndex = lcl_StringToIndex( lcl_getIndexStringAfterString( rObjectCID, "Series=" ) );
|
2007-09-18 14:09:26 +00:00
|
|
|
|
|
|
|
if( bForward )
|
|
|
|
nSeriesIndex--;
|
|
|
|
else
|
|
|
|
nSeriesIndex++;
|
|
|
|
|
|
|
|
OUString aRet = ObjectIdentifier::createParticleForSeries( nDiagramIndex, nCooSysIndex, nChartTypeIndex, nSeriesIndex );
|
|
|
|
return ObjectIdentifier::createClassifiedIdentifierForParticle( aRet );
|
|
|
|
}
|
2009-07-21 14:09:00 +00:00
|
|
|
|
|
|
|
bool ObjectIdentifier::isValid() const
|
|
|
|
{
|
|
|
|
return ( isAutoGeneratedObject() || isAdditionalShape() );
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::isAutoGeneratedObject() const
|
|
|
|
{
|
2011-12-10 22:03:11 -02:00
|
|
|
return ( !m_aObjectCID.isEmpty() );
|
2009-07-21 14:09:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ObjectIdentifier::isAdditionalShape() const
|
|
|
|
{
|
|
|
|
return m_xAdditionalShape.is();
|
|
|
|
}
|
|
|
|
|
2009-11-18 17:01:34 +00:00
|
|
|
Any ObjectIdentifier::getAny() const
|
|
|
|
{
|
|
|
|
Any aAny;
|
|
|
|
if ( isAutoGeneratedObject() )
|
|
|
|
{
|
|
|
|
aAny = uno::makeAny( getObjectCID() );
|
|
|
|
}
|
|
|
|
else if ( isAdditionalShape() )
|
|
|
|
{
|
|
|
|
aAny = uno::makeAny( getAdditionalShape() );
|
|
|
|
}
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
2007-05-22 18:03:13 +00:00
|
|
|
} //namespace chart
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|