summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx24
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx1
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx63
3 files changed, 45 insertions, 43 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 664f0cf951aa..611b3337f771 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -347,7 +347,7 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, Sc
{
if (mpAccessibleDocument)
xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument);
- uno::Reference<drawing::XShapes> xShapes (xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
if (xShapes.is())
mnShapesSelected = xShapes->getCount();
}
@@ -364,7 +364,7 @@ ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, Sc
if (!xSelectionSupplier.is())
throw uno::RuntimeException();
- uno::Reference<drawing::XShapes> xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
if (xShapes.is())
FindSelectedShapesChanges(xShapes, false);
}
@@ -660,8 +660,8 @@ bool ScChildrenShapes::IsSelected(sal_Int32 nIndex,
#if OSL_DEBUG_LEVEL > 0 // test whether it is truly selected by a slower method
uno::Reference< drawing::XShape > xReturnShape;
bool bDebugResult(false);
- uno::Reference<container::XIndexAccess> xIndexAccess;
- xSelectionSupplier->getSelection() >>= xIndexAccess;
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
+ uno::Reference<container::XIndexAccess> xIndexAccess(xShapes, uno::UNO_QUERY);
if (xIndexAccess.is())
{
@@ -696,7 +696,7 @@ bool ScChildrenShapes::SelectionChanged()
if (!xSelectionSupplier.is())
throw uno::RuntimeException();
- uno::Reference<drawing::XShapes> xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
bResult = FindSelectedShapesChanges(xShapes, true);
@@ -717,8 +717,7 @@ void ScChildrenShapes::Select(sal_Int32 nIndex)
uno::Reference<drawing::XShape> xShape;
if (!IsSelected(nIndex, xShape) && maZOrderedShapes[nIndex]->bSelectable)
{
- uno::Reference<drawing::XShapes> xShapes;
- xSelectionSupplier->getSelection() >>= xShapes;
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
if (!xShapes.is())
xShapes = drawing::ShapeCollection::create(
@@ -786,9 +785,8 @@ void ScChildrenShapes::SelectAll()
void ScChildrenShapes::FillShapes(std::vector < uno::Reference < drawing::XShape > >& rShapes) const
{
- uno::Reference<container::XIndexAccess> xIndexAccess;
- xSelectionSupplier->getSelection() >>= xIndexAccess;
-
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
+ uno::Reference<container::XIndexAccess> xIndexAccess(xShapes, uno::UNO_QUERY);
if (xIndexAccess.is())
{
sal_uInt32 nCount(xIndexAccess->getCount());
@@ -873,8 +871,7 @@ void ScChildrenShapes::Deselect(sal_Int32 nChildIndex)
{
if (xShape.is())
{
- uno::Reference<drawing::XShapes> xShapes;
- xSelectionSupplier->getSelection() >>= xShapes;
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
if (xShapes.is())
xShapes->remove(xShape);
@@ -1260,7 +1257,8 @@ void ScChildrenShapes::AddShape(const uno::Reference<drawing::XShape>& xShape, b
if (!xSelectionSupplier.is())
throw uno::RuntimeException();
- uno::Reference<container::XEnumerationAccess> xEnumAcc(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ uno::Reference<drawing::XShapes> xShapes(mpViewShell->getSelectedXShapes());
+ uno::Reference<container::XEnumerationAccess> xEnumAcc(xShapes, uno::UNO_QUERY);
if (xEnumAcc.is())
{
uno::Reference<container::XEnumeration> xEnum = xEnumAcc->createEnumeration();
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index cf60eb656d46..9c304ee164b9 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -396,6 +396,7 @@ public:
void afterCallbackRegistered() override;
/// See SfxViewShell::NotifyCursor().
void NotifyCursor(SfxViewShell* pViewShell) const override;
+ css::uno::Reference<css::drawing::XShapes> getSelectedXShapes();
/// Emits a LOK_CALLBACK_INVALIDATE_HEADER for all views whose current tab is equal to nCurrentTabIndex
static void notifyAllViewsHeaderInvalidation(const OString& rPayload, SCTAB nCurrentTabIndex = -1);
};
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