Kaydet (Commit) 7a16f317 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

New UNO API to return currently selected sheets.

Both from the sheet view and preview modes.
üst ffca779f
...@@ -3428,6 +3428,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,offapi/com/sun/star/sheet,\ ...@@ -3428,6 +3428,7 @@ $(eval $(call gb_UnoApiTarget_add_idlfiles,offapi,offapi/com/sun/star/sheet,\
XScenarioEnhanced \ XScenarioEnhanced \
XScenarios \ XScenarios \
XScenariosSupplier \ XScenariosSupplier \
XSelectedSheetsSupplier \
XSheetAnnotation \ XSheetAnnotation \
XSheetAnnotationAnchor \ XSheetAnnotationAnchor \
XSheetAnnotationShapeSupplier \ XSheetAnnotationShapeSupplier \
......
/*
* 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
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <com/sun/star/sheet/XCellRangeReferrer.hpp> #include <com/sun/star/sheet/XCellRangeReferrer.hpp>
#include <com/sun/star/sheet/XViewSplitable.hpp> #include <com/sun/star/sheet/XViewSplitable.hpp>
#include <com/sun/star/sheet/XViewFreezable.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/XSpreadsheetView.hpp>
#include <com/sun/star/sheet/XEnhancedMouseClickBroadcaster.hpp> #include <com/sun/star/sheet/XEnhancedMouseClickBroadcaster.hpp>
#include <com/sun/star/sheet/XActivationBroadcaster.hpp> #include <com/sun/star/sheet/XActivationBroadcaster.hpp>
...@@ -189,7 +190,8 @@ class ScTabViewObj : public ScViewPaneBase, ...@@ -189,7 +190,8 @@ class ScTabViewObj : public ScViewPaneBase,
public com::sun::star::sheet::XViewFreezable, public com::sun::star::sheet::XViewFreezable,
public com::sun::star::sheet::XRangeSelection, public com::sun::star::sheet::XRangeSelection,
public com::sun::star::lang::XUnoTunnel, 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: private:
SfxItemPropertySet aPropSet; SfxItemPropertySet aPropSet;
...@@ -395,19 +397,36 @@ public: ...@@ -395,19 +397,36 @@ public:
virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
throw(::com::sun::star::uno::RuntimeException); 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 ::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); 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; ScPreviewShell* mpViewShell;
public: public:
ScPreviewObj(ScPreviewShell* pViewSh); ScPreviewObj(ScPreviewShell* pViewSh);
virtual ~ScPreviewObj(); 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); 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 #endif
......
...@@ -614,6 +614,7 @@ uno::Any SAL_CALL ScTabViewObj::queryInterface( const uno::Type& rType ) ...@@ -614,6 +614,7 @@ uno::Any SAL_CALL ScTabViewObj::queryInterface( const uno::Type& rType )
SC_QUERYINTERFACE( sheet::XRangeSelection ) SC_QUERYINTERFACE( sheet::XRangeSelection )
SC_QUERYINTERFACE( lang::XUnoTunnel ) SC_QUERYINTERFACE( lang::XUnoTunnel )
SC_QUERYINTERFACE( datatransfer::XTransferableSupplier ) SC_QUERYINTERFACE( datatransfer::XTransferableSupplier )
SC_QUERYINTERFACE( sheet::XSelectedSheetsSupplier )
uno::Any aRet(ScViewPaneBase::queryInterface( rType )); uno::Any aRet(ScViewPaneBase::queryInterface( rType ));
if (!aRet.hasValue()) if (!aRet.hasValue())
...@@ -2371,6 +2372,12 @@ void SAL_CALL ScTabViewObj::insertTransferable( const ::com::sun::star::uno::Ref ...@@ -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) : ScPreviewObj::ScPreviewObj(ScPreviewShell* pViewSh) :
SfxBaseController(pViewSh), SfxBaseController(pViewSh),
mpViewShell(pViewSh) mpViewShell(pViewSh)
...@@ -2385,6 +2392,23 @@ ScPreviewObj::~ScPreviewObj() ...@@ -2385,6 +2392,23 @@ ScPreviewObj::~ScPreviewObj()
EndListening(*mpViewShell); 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) void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint)
{ {
const SfxSimpleHint* p = dynamic_cast<const SfxSimpleHint*>(&rHint); const SfxSimpleHint* p = dynamic_cast<const SfxSimpleHint*>(&rHint);
...@@ -2392,4 +2416,10 @@ void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint) ...@@ -2392,4 +2416,10 @@ void ScPreviewObj::Notify(SfxBroadcaster&, const SfxHint& rHint)
mpViewShell = NULL; mpViewShell = NULL;
} }
uno::Sequence<sal_Int32> ScPreviewObj::getSelectedSheets()
throw (uno::RuntimeException)
{
return uno::Sequence<sal_Int32>();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment