diff options
Diffstat (limited to 'chart2/source/controller/main/SelectionHelper.cxx')
-rw-r--r-- | chart2/source/controller/main/SelectionHelper.cxx | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 29c71c5c1097..de2ad664abe5 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -19,16 +19,16 @@ #include <SelectionHelper.hxx> #include <ObjectIdentifier.hxx> -#include <DiagramHelper.hxx> -#include <ChartModelHelper.hxx> +#include <Diagram.hxx> +#include <ChartModel.hxx> -#include <com/sun/star/frame/XModel.hpp> #include <svx/svdpage.hxx> #include <svx/svditer.hxx> #include <svx/obj3d.hxx> #include <svx/svdopath.hxx> #include <vcl/svapp.hxx> #include <basegfx/point/b2dpoint.hxx> +#include <osl/diagnose.h> namespace chart { @@ -242,7 +242,7 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper if ( !m_aSelectedOID.isAdditionalShape() ) { - OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );//@todo read CID from model + OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );//@todo read CID from model if ( !m_aSelectedOID.isAutoGeneratedObject() ) { @@ -251,7 +251,7 @@ void Selection::adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper //check whether the diagram was hit but not selected (e.g. because it has no filling): OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ); - OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() ) );//@todo read CID from model + OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );//@todo read CID from model bool bBackGroundHit = m_aSelectedOID.getObjectCID() == aPageCID || m_aSelectedOID.getObjectCID() == aWallCID || !m_aSelectedOID.isAutoGeneratedObject(); if( bBackGroundHit ) { @@ -302,7 +302,7 @@ bool Selection::isResizeableObjectSelected() const } } -bool Selection::isRotateableObjectSelected( const uno::Reference< frame::XModel >& xChartModel ) const +bool Selection::isRotateableObjectSelected( const rtl::Reference<::chart::ChartModel>& xChartModel ) const { return SelectionHelper::isRotateableObject( m_aSelectedOID.getObjectCID(), xChartModel ); } @@ -312,6 +312,11 @@ bool Selection::isDragableObjectSelected() const return m_aSelectedOID.isDragableObject(); } +bool Selection::isTitleObjectSelected() const +{ + return m_aSelectedOID.getObjectType() == OBJECTTYPE_TITLE; +} + bool Selection::isAdditionalShapeSelected() const { return m_aSelectedOID.isAdditionalShape(); @@ -401,7 +406,7 @@ OUString SelectionHelper::getHitObjectCID( aRet.clear(); } - OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, OUString() ) );//@todo read CID from model + OUString aPageCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_PAGE, u"" ) );//@todo read CID from model //get page when nothing was hit if( aRet.isEmpty() && !pNewObj ) { @@ -426,12 +431,11 @@ OUString SelectionHelper::getHitObjectCID( } else if( bGetDiagramInsteadOf_Wall ) { - OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, OUString() ) );//@todo read CID from model + OUString aWallCID( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) );//@todo read CID from model if( aRet == aWallCID ) { - OUString aDiagramCID = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ); - aRet = aDiagramCID; + aRet = ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM, OUString::number( 0 ) ); } } } @@ -440,13 +444,13 @@ OUString SelectionHelper::getHitObjectCID( // \\- solar mutex } -bool SelectionHelper::isRotateableObject( const OUString& rCID - , const uno::Reference< frame::XModel >& xChartModel ) +bool SelectionHelper::isRotateableObject( std::u16string_view rCID + , const rtl::Reference<::chart::ChartModel>& xChartModel ) { if( !ObjectIdentifier::isRotateableObject( rCID ) ) return false; - sal_Int32 nDimensionCount = DiagramHelper::getDimension( ChartModelHelper::findDiagram( xChartModel ) ); + sal_Int32 nDimensionCount = xChartModel->getFirstChartDiagram()->getDimension(); return nDimensionCount == 3; } @@ -463,7 +467,7 @@ SelectionHelper::~SelectionHelper() bool SelectionHelper::getFrameDragSingles() { //true == green == surrounding handles - return dynamic_cast<const E3dObject*>( m_pSelectedObj) == nullptr; + return DynCastE3dObject( m_pSelectedObj) == nullptr; } SdrObject* SelectionHelper::getMarkHandlesObject( SdrObject* pObj ) @@ -530,7 +534,7 @@ E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj ) if(pObj) { - pRotateable = dynamic_cast<E3dObject*>(pObj); + pRotateable = DynCastE3dObject(pObj); if( !pRotateable ) { SolarMutexGuard aSolarGuard; @@ -540,8 +544,7 @@ E3dScene* SelectionHelper::getSceneToRotate( SdrObject* pObj ) SdrObjListIter aIterator(pSubList, SdrIterMode::DeepWithGroups); while( aIterator.IsMore() && !pRotateable ) { - SdrObject* pSubObj = aIterator.Next(); - pRotateable = dynamic_cast<E3dObject*>(pSubObj); + pRotateable = DynCastE3dObject(aIterator.Next()); } } } @@ -595,7 +598,7 @@ bool SelectionHelper::getMarkHandles( SdrHdlList& rHdlList ) for( sal_uInt32 nM = 0; nM < aPolygon.count(); nM++) { const ::basegfx::B2DPoint aPoint(aPolygon.getB2DPoint(nM)); - rHdlList.AddHdl(std::make_unique<SdrHdl>(Point(basegfx::fround(aPoint.getX()), basegfx::fround(aPoint.getY())), SdrHdlKind::Poly)); + rHdlList.AddHdl(std::make_unique<SdrHdl>(Point(basegfx::fround<tools::Long>(aPoint.getX()), basegfx::fround<tools::Long>(aPoint.getY())), SdrHdlKind::Poly)); } } return true; |