summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/unoobj')
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx63
1 files changed, 33 insertions, 30 deletions
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 6db54a3de384..babe45dd3d19 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -859,44 +859,47 @@ sal_Bool SAL_CALL ScTabViewObj::select( const uno::Any& aSelection )
return bRet;
}
-uno::Any SAL_CALL ScTabViewObj::getSelection()
- throw(uno::RuntimeException, std::exception)
+uno::Reference<drawing::XShapes> ScTabViewShell::getSelectedXShapes()
{
- SolarMutexGuard aGuard;
- ScTabViewShell* pViewSh = GetViewShell();
- ScCellRangesBase* pObj = nullptr;
- if (pViewSh)
+ uno::Reference<drawing::XShapes> xShapes;
+ SdrView* pSdrView = GetSdrView();
+ if (pSdrView)
{
- // Ist auf dem Drawing-Layer etwas selektiert?
-
- SdrView* pDrawView = pViewSh->GetSdrView();
- if (pDrawView)
+ const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList();
+ const size_t nMarkCount = rMarkList.GetMarkCount();
+ if (nMarkCount)
{
- const SdrMarkList& rMarkList = pDrawView->GetMarkedObjectList();
- const size_t nMarkCount = rMarkList.GetMarkCount();
- if (nMarkCount)
- {
- // ShapeCollection erzeugen (wie in SdXImpressView::getSelection im Draw)
- // Zurueckgegeben wird XInterfaceRef, das muss das UsrObject-XInterface sein
-
- uno::Reference< drawing::XShapes > xShapes = drawing::ShapeCollection::create(
- comphelper::getProcessComponentContext());
+ // generate ShapeCollection (like in SdXImpressView::getSelection in Draw)
+ // XInterfaceRef will be returned and it has to be UsrObject-XInterface
+ xShapes = drawing::ShapeCollection::create(comphelper::getProcessComponentContext());
- uno::Reference<uno::XInterface> xRet(xShapes);
-
- for (size_t i=0; i<nMarkCount; ++i)
+ for (size_t i = 0; i < nMarkCount; ++i)
+ {
+ SdrObject* pDrawObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
+ if (pDrawObj)
{
- SdrObject* pDrawObj = rMarkList.GetMark(i)->GetMarkedSdrObj();
- if (pDrawObj)
- {
- uno::Reference<drawing::XShape> xShape( pDrawObj->getUnoShape(), uno::UNO_QUERY );
- if (xShape.is())
- xShapes->add(xShape);
- }
+ uno::Reference<drawing::XShape> xShape( pDrawObj->getUnoShape(), uno::UNO_QUERY );
+ if (xShape.is())
+ xShapes->add(xShape);
}
- return uno::makeAny(xRet);
}
}
+ }
+ return xShapes;
+}
+
+uno::Any SAL_CALL ScTabViewObj::getSelection()
+ throw(uno::RuntimeException, std::exception)
+{
+ SolarMutexGuard aGuard;
+ ScTabViewShell* pViewSh = GetViewShell();
+ ScCellRangesBase* pObj = nullptr;
+ if (pViewSh)
+ {
+ // is something selected in drawing layer?
+ uno::Reference<uno::XInterface> xRet(pViewSh->getSelectedXShapes());
+ if (xRet.is())
+ return uno::makeAny(xRet);
// sonst Tabellen-(Zellen-)Selektion