summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-06 17:19:40 +0200
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2015-07-12 18:56:47 +0200
commit04716cb9acfde7e247c01d79afde694f8e4f9f7f (patch)
treea8ae5f41f764d773107ef4309f92cd87ebbc2210 /chart2
parent11304a75043647139f6189c2317fe709edae83dc (diff)
add SidebarChangeHandler to chart2
I still need to wire the correct frame to the correct sidebar for it to work. Change-Id: I0fecc2be674d6b024bc39e707930a4c30f67cb81
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/main/ChartController.cxx19
-rw-r--r--chart2/source/controller/main/ChartController.hxx8
2 files changed, 26 insertions, 1 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index b53ebf66c8d2..4156c9d70042 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -59,6 +59,7 @@
#include <com/sun/star/document/XUndoManagerSupplier.hpp>
#include <com/sun/star/document/XUndoAction.hpp>
+#include <svx/sidebar/SelectionChangeHandler.hxx>
#include <vcl/msgbox.hxx>
#include <toolkit/awt/vclxwindow.hxx>
#include <toolkit/helper/vclunohelper.hxx>
@@ -68,6 +69,8 @@
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
+#include <boost/bind.hpp>
+
// this is needed to properly destroy the unique_ptr to the AcceleratorExecute
// object in the DTOR
#include <svtools/acceleratorexecute.hxx>
@@ -107,7 +110,10 @@ ChartController::ChartController(uno::Reference<uno::XComponentContext> const &
m_bConnectingToView(false),
m_xUndoManager( 0 ),
m_aDispatchContainer( m_xCC, this ),
- m_eDrawMode( CHARTDRAW_SELECT )
+ m_eDrawMode( CHARTDRAW_SELECT ),
+ mpSelectionChangeHandler(new svx::sidebar::SelectionChangeHandler(
+ boost::bind(&ChartController::GetContextName, this), this,
+ sfx2::sidebar::EnumContext::Context_Cell))
{
m_aDoubleClickTimer.SetTimeoutHdl( LINK( this, ChartController, DoubleClickWaitingHdl ) );
}
@@ -286,6 +292,11 @@ bool ChartController::TheModelRef::is() const
return (m_pTheModel != 0);
}
+OUString ChartController::GetContextName()
+{
+ return OUString("Chart");
+}
+
// private methods
bool ChartController::impl_isDisposedOrSuspended() const
@@ -346,6 +357,8 @@ void SAL_CALL ChartController::attachFrame(
if( impl_isDisposedOrSuspended() ) //@todo? allow attaching the frame while suspended?
return; //behave passive if already disposed or suspended
+ mpSelectionChangeHandler->Connect();
+
if(m_xFrame.is()) //what happens, if we do have a Frame already??
{
//@todo? throw exception?
@@ -386,6 +399,7 @@ void SAL_CALL ChartController::attachFrame(
m_apDropTargetHelper.reset();
}
{
+ SAL_DEBUG("attached frame");
// calls to VCL
SolarMutexGuard aSolarGuard;
m_pChartWindow = VclPtr<ChartWindow>::Create(this,pParent,pParent?pParent->GetStyle():0);
@@ -710,6 +724,7 @@ void ChartController::impl_deleteDrawViewController()
void SAL_CALL ChartController::dispose()
throw(uno::RuntimeException, std::exception)
{
+ mpSelectionChangeHandler->Disconnect();
try
{
//This object should release all resources and references in the
@@ -771,6 +786,7 @@ void SAL_CALL ChartController::dispose()
m_xLayoutManagerEventBroadcaster.set( 0 );
}
+ SAL_DEBUG("disposing");
m_xFrame.clear();
m_xUndoManager.clear();
@@ -889,6 +905,7 @@ void SAL_CALL ChartController::notifyClosing(
try
{
xFrameCloseable->close( sal_False /* DeliverOwnership */ );
+ SAL_DEBUG("notifyClosing");
m_xFrame.clear();
}
catch( const util::CloseVetoException & )
diff --git a/chart2/source/controller/main/ChartController.hxx b/chart2/source/controller/main/ChartController.hxx
index 0c7537167309..d3882aac7a49 100644
--- a/chart2/source/controller/main/ChartController.hxx
+++ b/chart2/source/controller/main/ChartController.hxx
@@ -62,6 +62,10 @@ namespace svt
class AcceleratorExecute;
}
+namespace svx { namespace sidebar {
+ class SelectionChangeHandler;
+}}
+
class DropTargetHelper;
namespace com { namespace sun { namespace star {
@@ -149,6 +153,8 @@ public:
::com::sun::star::uno::XComponentContext > const & xContext);
virtual ~ChartController();
+ OUString GetContextName();
+
// ::com::sun::star::lang::XServiceInfo
virtual OUString SAL_CALL getImplementationName()
throw( css::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
@@ -538,6 +544,8 @@ private:
ChartDrawMode m_eDrawMode;
+ boost::scoped_ptr<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler;
+
private:
//private methods