diff options
Diffstat (limited to 'chart2/source/controller/inc/ChartController.hxx')
-rw-r--r-- | chart2/source/controller/inc/ChartController.hxx | 95 |
1 files changed, 47 insertions, 48 deletions
diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx index 09fda2b6fb00..737d0cf3768f 100644 --- a/chart2/source/controller/inc/ChartController.hxx +++ b/chart2/source/controller/inc/ChartController.hxx @@ -19,6 +19,7 @@ #pragma once #include <LifeTime.hxx> +#include <ReferenceSizeProvider.hxx> #include "CommandDispatchContainer.hxx" #include "SelectionHelper.hxx" @@ -34,10 +35,9 @@ #include <com/sun/star/util/XModeChangeListener.hpp> #include <com/sun/star/util/XCloseListener.hpp> #include <com/sun/star/util/XModifyListener.hpp> -#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XController2.hpp> #include <com/sun/star/frame/XLayoutManagerListener.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <memory> #include <string_view> @@ -61,7 +61,6 @@ namespace com::sun::star::uno { class XComponentContext; } namespace com::sun::star::util { class XCloseable; } namespace com::sun::star::view { class XSelectionSupplier; } - class SdrModel; namespace svt @@ -83,25 +82,27 @@ namespace chart { class UndoGuard; +class ChartView; class ChartWindow; class DrawModelWrapper; class DrawViewWrapper; -class ReferenceSizeProvider; class ViewElementListProvider; +class ViewElementListProvider; +class Diagram; +class AccessibleChartView; +class AccessibleTextHelper; enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT }; -class ChartController : public ::cppu::WeakImplHelper < - css::frame::XController //comprehends XComponent (required interface) +class ChartController final : public ::cppu::WeakImplHelper < + css::frame::XController2 //comprehends XComponent (css::frame::XController is required interface) ,css::frame::XDispatchProvider //(required interface) ,css::view::XSelectionSupplier //(optional interface) ,css::ui::XContextMenuInterception //(optional interface) ,css::util::XCloseListener //(needed for communication with XModel) - ,css::lang::XServiceInfo ,css::frame::XDispatch ,css::awt::XWindow //this is the Window Controller part of this Controller, that will be given to a Frame via setComponent - ,css::lang::XMultiServiceFactory ,css::util::XModifyListener ,css::util::XModeChangeListener ,css::frame::XLayoutManagerListener @@ -109,16 +110,11 @@ class ChartController : public ::cppu::WeakImplHelper < { public: ChartController() = delete; - explicit ChartController(css::uno::Reference< css::uno::XComponentContext > const & xContext); + explicit ChartController(css::uno::Reference< css::uno::XComponentContext > xContext); virtual ~ChartController() override; OUString GetContextName(); - // css::lang::XServiceInfo - virtual OUString SAL_CALL getImplementationName() override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; - // css::frame::XController (required interface) virtual void SAL_CALL attachFrame( const css::uno::Reference< css::frame::XFrame > & xFrame ) override; @@ -141,6 +137,12 @@ public: virtual sal_Bool SAL_CALL suspend( sal_Bool bSuspend ) override; + // css::frame::XController2 + virtual css::uno::Reference<css::awt::XWindow> SAL_CALL getComponentWindow() override; + virtual OUString SAL_CALL getViewControllerName() override; + virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getCreationArguments() override; + virtual css::uno::Reference<css::ui::XSidebarProvider> SAL_CALL getSidebar() override; + // css::lang::XComponent (base of XController) virtual void SAL_CALL dispose() override; @@ -261,16 +263,6 @@ public: virtual void SAL_CALL removePaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override; - // css::lang XMultiServiceFactory - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstance( const OUString& aServiceSpecifier ) override; - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL - createInstanceWithArguments( const OUString& ServiceSpecifier, - const css::uno::Sequence< - css::uno::Any >& Arguments ) override; - virtual css::uno::Sequence< OUString > SAL_CALL - getAvailableServiceNames() override; - // css::util::XModifyListener virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; @@ -317,11 +309,21 @@ public: css::uno::Reference< css::accessibility::XAccessible > CreateAccessible(); + /** Creates a helper accessibility class that must be initialized via initialize(). For + parameters see + + The returned object should not be used directly. Instead a proxy object + should use this helper to retrieve its children and add them to its own + children. + */ + rtl::Reference< ::chart::AccessibleTextHelper > createAccessibleTextContext(); + static bool isObjectDeleteable( const css::uno::Any& rSelection ); void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; } bool isShapeContext() const; + bool IsTextEdit() const; ViewElementListProvider getViewElementListProvider(); DrawModelWrapper* GetDrawModelWrapper(); @@ -334,26 +336,27 @@ public: void NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> ); - css::uno::Reference<css::uno::XInterface> const & getChartView() const; + rtl::Reference<::chart::ChartView> const & getChartView() const { return m_xChartView; } + + rtl::Reference<::chart::ChartModel> getChartModel(); + rtl::Reference<::chart::Diagram> getFirstDiagram(); private: class TheModel : public salhelper::SimpleReferenceObject { public: - explicit TheModel( const css::uno::Reference< - css::frame::XModel > & xModel ); + explicit TheModel( rtl::Reference<::chart::ChartModel> xModel ); virtual ~TheModel() override; void addListener( ChartController* pController ); void removeListener( ChartController* pController ); void tryTermination(); - const css::uno::Reference< css::frame::XModel >& + const rtl::Reference<::chart::ChartModel>& getModel() const { return m_xModel;} private: - css::uno::Reference< css::frame::XModel > m_xModel; - css::uno::Reference< css::util::XCloseable > m_xCloseable; + rtl::Reference<::chart::ChartModel> m_xModel; //the ownership between model and controller is not clear at first //each controller might consider himself as owner of the model first @@ -387,7 +390,7 @@ private: //view css::uno::Reference<css::awt::XWindow> m_xViewWindow; - css::uno::Reference<css::uno::XInterface> m_xChartView; + rtl::Reference<::chart::ChartView> m_xChartView; std::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper; std::unique_ptr<DrawViewWrapper> m_pDrawViewWrapper; @@ -418,7 +421,7 @@ private: rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; bool impl_isDisposedOrSuspended() const; - std::unique_ptr<ReferenceSizeProvider> impl_createReferenceSizeProvider(); + ReferenceSizeProvider impl_createReferenceSizeProvider(); void impl_adaptDataSeriesAutoResize(); void impl_createDrawViewController(); @@ -428,7 +431,7 @@ private: void executeDispatch_ObjectProperties(); void executeDispatch_FormatObject( std::u16string_view rDispatchCommand ); void executeDlg_ObjectProperties( const OUString& rObjectCID ); - bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged ); + void executeDlg_ObjectProperties_withUndoGuard( std::shared_ptr<UndoGuard> aUndoGuard, const OUString& rObjectCID, bool bSuccessOnUnchanged ); void executeDispatch_ChartType(); @@ -439,6 +442,10 @@ private: void executeDispatch_InsertAxes(); void executeDispatch_InsertGrid(); + void executeDispatch_InsertDataTable(); + void executeDispatch_DeleteDataTable(); + void executeDispatch_OpenInsertDataTableDialog(); + void executeDispatch_InsertMenu_DataLabels(); void executeDispatch_InsertMenu_Trendlines(); void executeDispatch_InsertMenu_MeanValues(); @@ -478,6 +485,8 @@ private: void executeDispatch_MoveSeries( bool bForward ); bool EndTextEdit(); + css::uno::Sequence< css::uno::Reference<css::chart2::XFormattedString >> GetFormattedTitle( + const EditTextObject& aEdit, const css::uno::Reference< css::drawing::XShape >& xShape ); void executeDispatch_View3D(); void executeDispatch_PositionAndSize( const ::css::uno::Sequence< ::css::beans::PropertyValue >* pArgs = nullptr ); @@ -498,17 +507,17 @@ private: void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY); void executeDispatch_LOKPieSegmentDragging(int nOffset); void executeDispatch_FillColor(sal_uInt32 nColor); - void executeDispatch_FillGradient(OUString sJSONGradient); + void executeDispatch_FillGradient(std::u16string_view sJSONGradient); void executeDispatch_LineColor(sal_uInt32 nColor); void executeDispatch_LineWidth(sal_uInt32 nWidth); - void sendPopupRequest(OUString const & rCID, tools::Rectangle aRectangle); + void sendPopupRequest(std::u16string_view rCID, tools::Rectangle aRectangle); void impl_ShapeControllerDispatch( const css::util::URL& rURL, const css::uno::Sequence< css::beans::PropertyValue >& rArgs ); DECL_LINK( DoubleClickWaitingHdl, Timer*, void ); - void execute_DoubleClick( const Point* pMousePixel ); + void execute_DoubleClick( const Point* pMousePixel, bool &bEditText ); void startDoubleClickWaiting(); void stopDoubleClickWaiting(); @@ -516,7 +525,7 @@ private: void impl_notifySelectionChangeListeners(); void impl_invalidateAccessible(); void impl_initializeAccessible(); - void impl_initializeAccessible( const css::uno::Reference< css::lang::XInitialization >& xInit ); + void impl_initializeAccessible( AccessibleChartView& xInit ); //sets the model member to null if it equals the parameter //returns true if successful @@ -530,20 +539,10 @@ private: /// @return </sal_True>, if resize/move was successful bool impl_moveOrResizeObject( const OUString & rCID, eMoveOrResizeType eType, double fAmountLogicX, double fAmountLogicY ); - bool impl_DragDataPoint( const OUString & rCID, double fOffset ); + bool impl_DragDataPoint( std::u16string_view rCID, double fOffset ); static const o3tl::sorted_vector< OUString >& impl_getAvailableCommands(); - /** Creates a helper accessibility class that must be initialized via XInitialization. For - parameters see - - The returned object should not be used directly. Instead a proxy object - should use this helper to retrieve its children and add them to its own - children. - */ - css::uno::Reference< css::accessibility::XAccessibleContext > - impl_createAccessibleTextContext(); - void impl_PasteGraphic( css::uno::Reference< css::graphic::XGraphic > const & xGraphic, const ::Point & aPosition ); void impl_PasteShapes( SdrModel* pModel ); |