diff options
-rw-r--r-- | chart2/source/controller/accessibility/AccessibleBase.cxx | 12 | ||||
-rw-r--r-- | chart2/source/controller/dialogs/Strings.src | 5 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 9 | ||||
-rw-r--r-- | chart2/source/controller/main/ElementSelector.cxx | 52 | ||||
-rw-r--r-- | chart2/source/controller/main/ElementSelector.hxx | 3 | ||||
-rw-r--r-- | chart2/source/inc/ObjectIdentifier.hxx | 1 | ||||
-rw-r--r-- | chart2/source/inc/Strings.hrc | 4 | ||||
-rw-r--r-- | chart2/source/tools/ObjectIdentifier.cxx | 14 |
8 files changed, 60 insertions, 40 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index f5f30b15377e..a6dadc374610 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -840,17 +840,7 @@ void SAL_CALL AccessibleBase::grabFocus() Reference< view::XSelectionSupplier > xSelSupp( GetInfo().m_xSelectionSupplier ); if ( xSelSupp.is() ) { - uno::Any aSelection; - AccessibleUniqueId aId = GetId(); - if ( aId.isAutoGeneratedObject() ) - { - aSelection = uno::makeAny( aId.getObjectCID() ); - } - else if ( aId.isAdditionalShape() ) - { - aSelection = uno::makeAny( aId.getAdditionalShape() ); - } - xSelSupp->select( aSelection ); + xSelSupp->select( GetId().getAny() ); } } diff --git a/chart2/source/controller/dialogs/Strings.src b/chart2/source/controller/dialogs/Strings.src index b7ef643e3ff3..728a294d75fe 100644 --- a/chart2/source/controller/dialogs/Strings.src +++ b/chart2/source/controller/dialogs/Strings.src @@ -351,6 +351,11 @@ String STR_OBJECT_DIAGRAM_FLOOR Text [ en-US ] = "Chart Floor" ; }; +String STR_OBJECT_SHAPE +{ + Text [ en-US ] = "Drawing Object" ; +}; + //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 8dc4a6148346..582fb0f8dba9 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1362,14 +1362,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) uno::Any aNewSelection; if ( aNewOID.isValid() && !ObjectHierarchy::isRootNode( aNewOID ) ) { - if ( aNewOID.isAutoGeneratedObject() ) - { - aNewSelection <<= aNewOID.getObjectCID(); - } - else if ( aNewOID.isAdditionalShape() ) - { - aNewSelection <<= aNewOID.getAdditionalShape(); - } + aNewSelection = aNewOID.getAny(); } if ( m_eDragMode == SDRDRAG_ROTATE && !SelectionHelper::isRotateableObject( aNewOID.getObjectCID(), m_aModel->getModel() ) ) { diff --git a/chart2/source/controller/main/ElementSelector.cxx b/chart2/source/controller/main/ElementSelector.cxx index 331825e4af2e..32f69728d0c3 100644 --- a/chart2/source/controller/main/ElementSelector.cxx +++ b/chart2/source/controller/main/ElementSelector.cxx @@ -37,6 +37,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> @@ -84,7 +87,7 @@ void lcl_addObjectsToList( const ObjectHierarchy& rHierarchy, const ObjectHierar 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); @@ -116,9 +119,9 @@ void SelectorListBox::UpdateChartElementsListAndSelection() } 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; @@ -132,22 +135,34 @@ void SelectorListBox::UpdateChartElementsListAndSelection() 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() : ::rtl::OUString() ); + 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; @@ -155,7 +170,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; @@ -196,11 +211,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(); } diff --git a/chart2/source/controller/main/ElementSelector.hxx b/chart2/source/controller/main/ElementSelector.hxx index 3992745c9f02..5171d6071d04 100644 --- a/chart2/source/controller/main/ElementSelector.hxx +++ b/chart2/source/controller/main/ElementSelector.hxx @@ -31,6 +31,7 @@ #define _CHART_ELEMENTSELECTOR_HXX #include "ServiceMacros.hxx" +#include "ObjectHierarchy.hxx" #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase1.hxx> #include <svtools/toolboxcontroller.hxx> @@ -48,7 +49,7 @@ namespace chart struct ListBoxEntryData { rtl::OUString UIName; - rtl::OUString CID; + ObjectHierarchy::tOID OID; sal_Int32 nHierarchyDepth; ListBoxEntryData() : nHierarchyDepth(0) diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx index 5045199b22cd..7f5d2b1eef29 100644 --- a/chart2/source/inc/ObjectIdentifier.hxx +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -263,6 +263,7 @@ public: bool isAdditionalShape() const; ::rtl::OUString getObjectCID() const; ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getAdditionalShape() const; + ::com::sun::star::uno::Any getAny() const; private: // #i12587# support for shapes in chart diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc index fea8bb867057..3485a792072e 100644 --- a/chart2/source/inc/Strings.hrc +++ b/chart2/source/inc/Strings.hrc @@ -33,7 +33,7 @@ // this includes no link dependency #include <svtools/solar.hrc> -//next free is 290 +//next free is 291 //single free is: 134 //#define RID_APP_START 30000 @@ -267,6 +267,8 @@ #define STR_OBJECT_CURVE_EQUATION (RID_APP_START + 268) #define STR_STATISTICS_IN_LEGEND (RID_APP_START + 180) +#define STR_OBJECT_SHAPE (RID_APP_START + 290) + //----------------------------------------------------------------------------- //Titles for tabpages and dialogs diff --git a/chart2/source/tools/ObjectIdentifier.cxx b/chart2/source/tools/ObjectIdentifier.cxx index e41d37c43af6..7ae1d9304586 100644 --- a/chart2/source/tools/ObjectIdentifier.cxx +++ b/chart2/source/tools/ObjectIdentifier.cxx @@ -1475,6 +1475,20 @@ Reference< drawing::XShape > ObjectIdentifier::getAdditionalShape() const return m_xAdditionalShape; } +Any ObjectIdentifier::getAny() const +{ + Any aAny; + if ( isAutoGeneratedObject() ) + { + aAny = uno::makeAny( getObjectCID() ); + } + else if ( isAdditionalShape() ) + { + aAny = uno::makeAny( getAdditionalShape() ); + } + return aAny; +} + //............................................................................. } //namespace chart //............................................................................. |