summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-11-28 22:15:03 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2011-11-29 00:04:23 -0500
commit7a16f31752990abd1d0d4afc682259b67f24ea60 (patch)
treed82c52250d305d715904ba55870d43577fa28a81
parentffca779f3765f730cc9f4f416b728ecdf762931c (diff)
New UNO API to return currently selected sheets.
Both from the sheet view and preview modes.
-rw-r--r--offapi/UnoApi_offapi.mk1
-rw-r--r--offapi/com/sun/star/sheet/XSelectedSheetsSupplier.idl44
-rw-r--r--sc/inc/viewuno.hxx25
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx30
4 files changed, 97 insertions, 3 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 66e594439951..5fe45e99feb3 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -3428,6 +3428,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,offapi/com/sun/star/sheet,\
XScenarioEnhanced \
XScenarios \
XScenariosSupplier \
+ XSelectedSheetsSupplier \
XSheetAnnotation \
XSheetAnnotationAnchor \
XSheetAnnotationShapeSupplier \
diff --git a/offapi/com/sun/star/sheet/XSelectedSheetsSupplier.idl b/offapi/com/sun/star/sheet/XSelectedSheetsSupplier.idl
new file mode 100644
index 000000000000..786dba3dba44
--- /dev/null
+++ b/offapi/com/sun/star/sheet/XSelectedSheetsSupplier.idl
@@ -0,0 +1,44 @@
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Kohei Yoshida <kohei.yoshida@suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef __com_sun_star_sheet_XSelectedSheetsSupplier_idl__
+#define __com_sun_star_sheet_XSelectedSheetsSupplier_idl__
+
+module com { module sun { module star { module sheet {
+
+interface XSelectedSheetsSupplier: com::sun::star::uno::XInterface
+{
+ /**
+ returns the indices of currently selected sheets. Sheet indices are
+ 0-based.
+ */
+ sequence<long> getSelectedSheets();
+};
+
+}; }; }; };
+
+#endif
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 2c129f8368fe..b062fd86a89c 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -38,6 +38,7 @@
#include <com/sun/star/sheet/XCellRangeReferrer.hpp>
#include <com/sun/star/sheet/XViewSplitable.hpp>
#include <com/sun/star/sheet/XViewFreezable.hpp>
+#include <com/sun/star/sheet/XSelectedSheetsSupplier.hpp>
#include <com/sun/star/sheet/XSpreadsheetView.hpp>
#include <com/sun/star/sheet/XEnhancedMouseClickBroadcaster.hpp>
#include <com/sun/star/sheet/XActivationBroadcaster.hpp>
@@ -189,7 +190,8 @@ class ScTabViewObj : public ScViewPaneBase,
public com::sun::star::sheet::XViewFreezable,
public com::sun::star::sheet::XRangeSelection,
public com::sun::star::lang::XUnoTunnel,
- public com::sun::star::datatransfer::XTransferableSupplier
+ public com::sun::star::datatransfer::XTransferableSupplier,
+ public com::sun::star::sheet::XSelectedSheetsSupplier
{
private:
SfxItemPropertySet aPropSet;
@@ -395,19 +397,36 @@ public:
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw(::com::sun::star::uno::RuntimeException);
- //XTransferableSupplier
+ // XTransferableSupplier
virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException);
+
+ // XSelectedSheetsSupplier
+ virtual ::com::sun::star::uno::Sequence<sal_Int32> SAL_CALL getSelectedSheets()
+ throw(::com::sun::star::uno::RuntimeException);
};
-class ScPreviewObj : public SfxBaseController, SfxListener
+class ScPreviewObj : public SfxBaseController,
+ public SfxListener,
+ public com::sun::star::sheet::XSelectedSheetsSupplier
{
ScPreviewShell* mpViewShell;
public:
ScPreviewObj(ScPreviewShell* pViewSh);
virtual ~ScPreviewObj();
+ virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+ const ::com::sun::star::uno::Type & rType)
+ throw(::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
virtual void Notify(SfxBroadcaster&, const SfxHint& rHint);
+
+ // XSelectedSheetsSupplier
+ virtual ::com::sun::star::uno::Sequence<sal_Int32> SAL_CALL getSelectedSheets()
+ throw(::com::sun::star::uno::RuntimeException);
};
#endif
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 598b35dd9c54..16955534cc15 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -614,6 +614,7 @@ uno::Any SAL_CALL ScTabViewObj::queryInterface( const uno::Type& rType )
SC_QUERYINTERFACE( sheet::XRangeSelection )
SC_QUERYINTERFACE( lang::XUnoTunnel )
SC_QUERYINTERFACE( datatransfer::XTransferableSupplier )
+ SC_QUERYINTERFACE( sheet::XSelectedSheetsSupplier )
uno::Any aRet(ScViewPaneBase::queryInterface( rType ));
if (!aRet.hasValue())
@@ -2371,6 +2372,12 @@ void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Ref
}
}
+uno::Sequence<sal_Int32> ScTabViewObj::getSelectedSheets()
+ throw (uno::RuntimeException)
+{
+ return uno::Sequence<sal_Int32>();
+}
+
ScPreviewObj::ScPreviewObj(ScPreviewShell* pViewSh) :
SfxBaseController(pViewSh),
mpViewShell(pViewSh)
@@ -2385,6 +2392,23 @@ ScPreviewObj::~ScPreviewObj()
EndListening(*mpViewShell);
}
+uno::Any ScPreviewObj::queryInterface(const uno::Type& rType)
+ throw(uno::RuntimeException)
+{
+ SC_QUERYINTERFACE(sheet::XSelectedSheetsSupplier)
+ return SfxBaseController::queryInterface(rType);
+}
+
+void ScPreviewObj::acquire() throw()
+{
+ SfxBaseController::acquire();
+}
+
+void ScPreviewObj::release() throw()
+{
+ SfxBaseController::release();
+}
+
void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint)
{
const SfxSimpleHint* p = dynamic_cast<const SfxSimpleHint*>(&rHint);
@@ -2392,4 +2416,10 @@ void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint)
mpViewShell = NULL;
}
+uno::Sequence<sal_Int32> ScPreviewObj::getSelectedSheets()
+ throw (uno::RuntimeException)
+{
+ return uno::Sequence<sal_Int32>();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */