summaryrefslogtreecommitdiff
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
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
-rw-r--r--chart2/source/controller/main/ChartController.cxx19
-rw-r--r--chart2/source/controller/main/ChartController.hxx8
-rw-r--r--include/sfx2/sidebar/EnumContext.hxx2
-rw-r--r--sfx2/source/sidebar/EnumContext.cxx2
4 files changed, 30 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
diff --git a/include/sfx2/sidebar/EnumContext.hxx b/include/sfx2/sidebar/EnumContext.hxx
index 3fd2670e4109..b77c977c4009 100644
--- a/include/sfx2/sidebar/EnumContext.hxx
+++ b/include/sfx2/sidebar/EnumContext.hxx
@@ -40,6 +40,7 @@ public:
Application_WriterForm,
Application_WriterReport,
Application_Calc,
+ Application_Chart,
Application_Draw,
Application_Impress,
@@ -65,6 +66,7 @@ public:
Context_3DObject,
Context_Annotation,
Context_Auditing,
+ Context_Axis,
Context_Cell,
Context_Chart,
Context_Draw,
diff --git a/sfx2/source/sidebar/EnumContext.cxx b/sfx2/source/sidebar/EnumContext.cxx
index 4f9b75b50ebb..f7db2edd0e2c 100644
--- a/sfx2/source/sidebar/EnumContext.cxx
+++ b/sfx2/source/sidebar/EnumContext.cxx
@@ -122,6 +122,7 @@ void EnumContext::ProvideApplicationContainers()
AddEntry(OUString("com.sun.star.sdb.FormDesign"), EnumContext::Application_WriterForm);
AddEntry(OUString("com.sun.star.sdb.TextReportDesign"), EnumContext::Application_WriterReport);
AddEntry(OUString("com.sun.star.sheet.SpreadsheetDocument"), EnumContext::Application_Calc);
+ AddEntry(OUString("com.sun.star.chart2.ChartDocument"), EnumContext::Application_Chart);
AddEntry(OUString("com.sun.star.drawing.DrawingDocument"), EnumContext::Application_Draw);
AddEntry(OUString("com.sun.star.presentation.PresentationDocument"), EnumContext::Application_Impress);
@@ -174,6 +175,7 @@ void EnumContext::ProvideContextContainers()
AddContext(3DObject);
AddContext(Annotation);
AddContext(Auditing);
+ AddContext(Axis);
AddContext(Cell);
AddContext(Chart);
AddContext(Chart);