summaryrefslogtreecommitdiff
path: root/chart2/source/controller/main/ElementSelector.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/main/ElementSelector.cxx')
-rw-r--r--chart2/source/controller/main/ElementSelector.cxx67
1 files changed, 43 insertions, 24 deletions
diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx
index 49a8736bb11b..3b41fd1b6b66 100644
--- a/chart2/source/controller/main/ElementSelector.cxx
+++ b/chart2/source/controller/main/ElementSelector.cxx
@@ -34,6 +34,9 @@
#include "ObjectHierarchy.hxx"
#include "servicenames.hxx"
#include <chartview/ExplicitValueProvider.hxx>
+#include "DrawViewWrapper.hxx"
+#include "ResId.hxx"
+#include "Strings.hrc"
#include <toolkit/helper/vclunohelper.hxx>
#include <vos/mutex.hxx>
@@ -71,20 +74,21 @@ SelectorListBox::~SelectorListBox()
{
}
-void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tCID & rParent, std::vector< ListBoxEntryData >& rEntries
+void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierarchy::tOID & rParent, std::vector< ListBoxEntryData >& rEntries
, const sal_Int32 nHierarchyDepth, const Reference< chart2::XChartDocument >& xChartDoc )
{
ObjectHierarchy::tChildContainer aChildren( rHierarchy.getChildren(rParent) );
ObjectHierarchy::tChildContainer::const_iterator aIt( aChildren.begin());
while( aIt != aChildren.end() )
{
- ::rtl::OUString aCID = *aIt;
+ ObjectHierarchy::tOID aOID = *aIt;
+ ::rtl::OUString aCID = aOID.getObjectCID();
ListBoxEntryData aEntry;
- aEntry.CID = aCID;
+ aEntry.OID = aOID;
aEntry.UIName += ObjectNameProvider::getNameForCID( aCID, xChartDoc );
aEntry.nHierarchyDepth = nHierarchyDepth;
rEntries.push_back(aEntry);
- lcl_addObjectsToList( rHierarchy, aCID, rEntries, nHierarchyDepth+1, xChartDoc );
+ lcl_addObjectsToList( rHierarchy, aOID, rEntries, nHierarchyDepth+1, xChartDoc );
++aIt;
}
}
@@ -103,14 +107,18 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
if( xChartController.is() )
{
Reference< view::XSelectionSupplier > xSelectionSupplier( xChartController, uno::UNO_QUERY);
+ ObjectHierarchy::tOID aSelectedOID;
rtl::OUString aSelectedCID;
if( xSelectionSupplier.is() )
- xSelectionSupplier->getSelection() >>= aSelectedCID;
+ {
+ aSelectedOID = ObjectIdentifier( xSelectionSupplier->getSelection() );
+ aSelectedCID = aSelectedOID.getObjectCID();
+ }
Reference< chart2::XChartDocument > xChartDoc( xChartController->getModel(), uno::UNO_QUERY );
- ObjectType eType( ObjectIdentifier::getObjectType( aSelectedCID ));
+ ObjectType eType( aSelectedOID.getObjectType() );
bool bAddSelectionToList = false;
- if( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL )
+ if ( eType == OBJECTTYPE_DATA_POINT || eType == OBJECTTYPE_DATA_LABEL || eType == OBJECTTYPE_SHAPE )
bAddSelectionToList = true;
Reference< uno::XInterface > xChartView;
@@ -119,27 +127,39 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
xChartView = xFact->createInstance( CHART_VIEW_SERVICE_NAME );
ExplicitValueProvider* pExplicitValueProvider = 0;//ExplicitValueProvider::getExplicitValueProvider(xChartView); dies erzeugt alle sichtbaren datenpinkte, das ist zu viel
ObjectHierarchy aHierarchy( xChartDoc, pExplicitValueProvider, true /*bFlattenDiagram*/, true /*bOrderingForElementSelector*/ );
- lcl_addObjectsToList( aHierarchy, aHierarchy.getRootNodeCID(), m_aEntries, 0, xChartDoc );
+ lcl_addObjectsToList( aHierarchy, aHierarchy.getRootNodeOID(), m_aEntries, 0, xChartDoc );
std::vector< ListBoxEntryData >::iterator aIt( m_aEntries.begin() );
if( bAddSelectionToList )
{
- rtl::OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) );
- for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt )
+ if ( aSelectedOID.isAutoGeneratedObject() )
{
- if( aIt->CID.match( aSeriesCID ) )
+ rtl::OUString aSeriesCID = ObjectIdentifier::createClassifiedIdentifierForParticle( ObjectIdentifier::getSeriesParticleFromCID( aSelectedCID ) );
+ for( aIt = m_aEntries.begin(); aIt != m_aEntries.end(); ++aIt )
{
- ListBoxEntryData aEntry;
- aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
- aEntry.CID = aSelectedCID;
- ++aIt;
- if( aIt != m_aEntries.end() )
- m_aEntries.insert(aIt, aEntry);
- else
- m_aEntries.push_back( aEntry );
- break;
+ if( aIt->OID.getObjectCID().match( aSeriesCID ) )
+ {
+ ListBoxEntryData aEntry;
+ aEntry.UIName = ObjectNameProvider::getNameForCID( aSelectedCID, xChartDoc );
+ aEntry.OID = aSelectedOID;
+ ++aIt;
+ if( aIt != m_aEntries.end() )
+ m_aEntries.insert(aIt, aEntry);
+ else
+ m_aEntries.push_back( aEntry );
+ break;
+ }
}
}
+ else if ( aSelectedOID.isAdditionalShape() )
+ {
+ ListBoxEntryData aEntry;
+ SdrObject* pSelectedObj = DrawViewWrapper::getSdrObject( aSelectedOID.getAdditionalShape() );
+ ::rtl::OUString aName( pSelectedObj ? pSelectedObj->GetName() : String() );
+ aEntry.UIName = ( aName.getLength() > 0 ? aName : ::rtl::OUString( String( SchResId( STR_OBJECT_SHAPE ) ) ) );
+ aEntry.OID = aSelectedOID;
+ m_aEntries.push_back( aEntry );
+ }
}
USHORT nEntryPosToSelect = 0; bool bSelectionFound = false;
@@ -147,7 +167,7 @@ void SelectorListBox::UpdateChartElementsListAndSelection()
for( USHORT nN=0; aIt != m_aEntries.end(); ++aIt, ++nN )
{
InsertEntry( aIt->UIName );
- if( !bSelectionFound && aSelectedCID.equals( aIt->CID ) )
+ if ( !bSelectionFound && aSelectedOID == aIt->OID )
{
nEntryPosToSelect = nN;
bSelectionFound = true;
@@ -188,11 +208,10 @@ void SelectorListBox::Select()
USHORT nPos = GetSelectEntryPos();
if( nPos < m_aEntries.size() )
{
- rtl::OUString aCID = m_aEntries[nPos].CID;
- uno::Any aASelection( uno::makeAny(aCID) );
+ ObjectHierarchy::tOID aOID = m_aEntries[nPos].OID;
Reference< view::XSelectionSupplier > xSelectionSupplier( m_xChartController.get(), uno::UNO_QUERY );
if( xSelectionSupplier.is() )
- xSelectionSupplier->select(aASelection);
+ xSelectionSupplier->select( aOID.getAny() );
}
ReleaseFocus_Impl();
}