diff options
Diffstat (limited to 'chart2/source/controller/inc')
58 files changed, 5185 insertions, 0 deletions
diff --git a/chart2/source/controller/inc/AccessibleBase.hxx b/chart2/source/controller/inc/AccessibleBase.hxx new file mode 100644 index 000000000..ef1eab329 --- /dev/null +++ b/chart2/source/controller/inc/AccessibleBase.hxx @@ -0,0 +1,331 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLEBASE_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLEBASE_HXX + +#include <ObjectIdentifier.hxx> + +#include <com/sun/star/accessibility/XAccessible.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> +#include <com/sun/star/accessibility/XAccessibleComponent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp> +#include <comphelper/accessibleeventnotifier.hxx> +#include <cppuhelper/compbase.hxx> +#include <rtl/ref.hxx> +#include <tools/color.hxx> + +#include <map> +#include <vector> +#include <memory> + +#include <MutexContainer.hxx> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::view { class XSelectionSupplier; } +namespace utl { class AccessibleStateSetHelper; } + + +class SdrView; + +namespace accessibility +{ +class IAccessibleViewForwarder; +} + +namespace chart +{ + +class AccessibleBase; +class ObjectHierarchy; + +typedef ObjectIdentifier AccessibleUniqueId; + +struct AccessibleElementInfo +{ + AccessibleUniqueId m_aOID; + + css::uno::WeakReference< css::chart2::XChartDocument > m_xChartDocument; + css::uno::WeakReference< css::view::XSelectionSupplier > m_xSelectionSupplier; + css::uno::WeakReference< css::uno::XInterface > m_xView; + css::uno::WeakReference< css::awt::XWindow > m_xWindow; + + std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy; + + AccessibleBase * m_pParent; + SdrView* m_pSdrView; + ::accessibility::IAccessibleViewForwarder* m_pViewForwarder; +}; + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper< + css::accessibility::XAccessible, + css::accessibility::XAccessibleContext, + css::accessibility::XAccessibleComponent, + css::accessibility::XAccessibleEventBroadcaster, + css::lang::XServiceInfo, + css::lang::XEventListener + > AccessibleBase_Base; +} + +/** Base class for all Chart Accessibility objects + */ +class AccessibleBase : + public MutexContainer, + public impl::AccessibleBase_Base +{ +public: + enum class EventType + { + GOT_SELECTION, + LOST_SELECTION + }; + + AccessibleBase( const AccessibleElementInfo & rAccInfo, + bool bMayHaveChildren, + bool bAlwaysTransparent ); + virtual ~AccessibleBase() override; + +protected: + // for all calls to protected methods it is assumed that the mutex is locked + // unless calls outside via UNO, e.g. event notification, are done + + /** @param bThrowException if true, a DisposedException is thrown if the + object is already disposed + @return true, if the component is already disposed and bThrowException is false, + false otherwise + @throws css::lang::DisposedException + */ + bool CheckDisposeState( bool bThrowException = true ) const; + + /** Events coming from the core have to be processed in this methods. The + default implementation returns false, which indicates that the object is + not interested in the event. To react on events you have to implement + this method in derived classes. + + The default implementation iterates over all children and forwards the + event until the first child returns true. + + @param nObjId contains the object id of chart objects. If the object is + no chart object, the event is not broadcast. + @return If an object is the addressee of the event it should return + true, false otherwise. + */ + bool NotifyEvent( EventType eType, const AccessibleUniqueId & rId ); + + /** Adds a state to the set. + + @throws css::uno::RuntimeException + */ + void AddState( sal_Int16 aState ); + + /** Removes a state from the set if the set contains the state, otherwise + nothing is done. + + @throws css::uno::RuntimeException + */ + void RemoveState( sal_Int16 aState ); + + /** has to be overridden by derived classes that support child elements. + With this method a rescan is initiated that should result in a correct + list of children. + + This method is called when access to any methods concerning children is + invoked for the first time. + */ + bool UpdateChildren(); + + /** Is called by UpdateChildren. This method is only called if an update is + really necessary. + */ + virtual bool ImplUpdateChildren(); + + /** adds a child to the end of the internal vector of children. As a + result, the child-count increases by one, but all existing children keep + their indices. + + Important: as the implementation is needed, this should remain the only + method for adding children (i.e. there mustn't be an AddChild( Reference< + XAccessible > ) or the like). + */ + void AddChild( AccessibleBase* pChild ); + + /** removes a child from the internal vector. All children with index + greater than the index of the removed element get an index one less than + before. + */ + void RemoveChildByOId( const ObjectIdentifier& rOId ); + + /** Retrieve the pixel coordinates of logical coordinates (0,0) of the + current logic coordinate system. This can be used for + getLocationOnScreen, if the coordinates of an object are not relative to + its direct parent, but a parent higher up in hierarchy. + + @return the (x,y) pixel coordinates of the upper left corner + */ + virtual css::awt::Point GetUpperLeftOnScreen() const; + + /** This method creates an AccessibleEventObject and sends it to all + listeners that are currently listening to this object + + If bSendGlobally is true, the event is also broadcast via + vcl::unohelper::NotifyAccessibleStateEventGlobally() + */ + void BroadcastAccEvent( sal_Int16 nId, + const css::uno::Any & rNew, + const css::uno::Any & rOld, + bool bSendGlobally = false ) const; + + /** Removes all children from the internal lists and broadcasts child remove + events. + + This method cares about mutex locking, and thus should be called without + the mutex locked. + */ + void KillAllChildren(); + + /** Is called from getAccessibleChild(). Before this method is called, an + update of children is done if necessary. + + @throws css::lang::IndexOutOfBoundsException + @throws css::uno::RuntimeException + */ + virtual css::uno::Reference< css::accessibility::XAccessible > + ImplGetAccessibleChildById( sal_Int32 i ) const; + + /** Is called from getAccessibleChildCount(). Before this method is called, + an update of children is done if necessary. + + @throws css::uno::RuntimeException + */ + virtual sal_Int32 ImplGetAccessibleChildCount() const; + + const AccessibleElementInfo& GetInfo() const { return m_aAccInfo;} + void SetInfo( const AccessibleElementInfo & rNewInfo ); + const AccessibleUniqueId& GetId() const { return m_aAccInfo.m_aOID;} + + // ________ WeakComponentImplHelper (XComponent::dispose) ________ + virtual void SAL_CALL disposing() override; + + // ________ XAccessible ________ + virtual css::uno::Reference< css::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext() override; + + // ________ XAccessibleContext ________ + virtual sal_Int32 SAL_CALL getAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleChild( sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleParent() override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override; + /// @return AccessibleRole.SHAPE + virtual sal_Int16 SAL_CALL getAccessibleRole() override; + // has to be implemented by derived classes +// virtual OUString SAL_CALL getAccessibleName() +// throw (css::uno::RuntimeException); + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL + getAccessibleRelationSet() override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL + getAccessibleStateSet() override; + virtual css::lang::Locale SAL_CALL getLocale() override; + // has to be implemented by derived classes +// virtual OUString SAL_CALL getAccessibleDescription() +// throw (css::uno::RuntimeException); + + // ________ XAccessibleComponent ________ + virtual sal_Bool SAL_CALL containsPoint( + const css::awt::Point& aPoint ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL + getAccessibleAtPoint( const css::awt::Point& aPoint ) override; + // has to be defined in derived classes + virtual css::awt::Rectangle SAL_CALL getBounds() override; + virtual css::awt::Point SAL_CALL getLocation() override; + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + virtual css::awt::Size SAL_CALL getSize() override; + virtual void SAL_CALL grabFocus() override; + virtual sal_Int32 SAL_CALL getForeground() override; + virtual sal_Int32 SAL_CALL getBackground() override; + + // ________ 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; + + // ________ XEventListener ________ + virtual void SAL_CALL disposing( + const css::lang::EventObject& Source ) override; + + // ________ XAccessibleEventBroadcaster ________ + virtual void SAL_CALL addAccessibleEventListener( + const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + virtual void SAL_CALL removeAccessibleEventListener( + const css::uno::Reference< css::accessibility::XAccessibleEventListener >& xListener ) override; + +private: + enum eColorType + { + ACC_BASE_FOREGROUND, + ACC_BASE_BACKGROUND + }; + Color getColor( eColorType eColType ); + +private: + /** type of the vector containing the accessible children + */ + typedef std::vector< css::uno::Reference< css::accessibility::XAccessible > > ChildListVectorType; + /** type of the hash containing a vector index for every AccessibleUniqueId + of the object in the child list + */ + typedef std::map< ObjectIdentifier, css::uno::Reference< css::accessibility::XAccessible > > ChildOIDMap; + + bool m_bIsDisposed; + const bool m_bMayHaveChildren; + bool m_bChildrenInitialized; + ChildListVectorType m_aChildList; + + ChildOIDMap m_aChildOIDMap; + + ::comphelper::AccessibleEventNotifier::TClientId m_nEventNotifierId; + + /** Implementation helper for getAccessibleStateSet() + + Note: This member must come before m_aStateSet! + */ + rtl::Reference<::utl::AccessibleStateSetHelper> m_xStateSetHelper; + + AccessibleElementInfo m_aAccInfo; + const bool m_bAlwaysTransparent; + /** denotes if the state-set is initialized. On initialization the selected + state is checked. + + This variable is monitored by the solar mutex! + + Note: declared volatile to enable double-check-locking + */ + volatile bool m_bStateSetInitialized; +}; + +} // namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/AccessibleChartView.hxx b/chart2/source/controller/inc/AccessibleChartView.hxx new file mode 100644 index 000000000..f6e174b53 --- /dev/null +++ b/chart2/source/controller/inc/AccessibleChartView.hxx @@ -0,0 +1,120 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLECHARTVIEW_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLECHARTVIEW_HXX + +#include "AccessibleBase.hxx" +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> + +#include <memory> + +namespace com::sun::star::accessibility { class XAccessible; } +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::view { class XSelectionSupplier; } + +namespace accessibility +{ +class IAccessibleViewForwarder; +} + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::ImplInheritanceHelper< + ::chart::AccessibleBase, + css::lang::XInitialization, + css::view::XSelectionChangeListener > + AccessibleChartView_Base; +} + +class AccessibleChartView : + public impl::AccessibleChartView_Base +{ +public: + AccessibleChartView(SdrView* pView ); + virtual ~AccessibleChartView() override; + + AccessibleChartView() = delete; + + // ____ WeakComponentHelper (called from XComponent::dispose()) ____ + using AccessibleBase::disposing; + + // ____ lang::XInitialization ____ + // 0: view::XSelectionSupplier offers notifications for selection changes and access to the selection itself + // 1: frame::XModel representing the chart model - offers access to object data + // 2: lang::XInterface representing the normal chart view - offers access to some extra object data + // 3: accessibility::XAccessible representing the parent accessible + // 4: awt::XWindow representing the view's window (is a vcl Window) + // all arguments are only valid until next initialization - don't keep them longer + virtual void SAL_CALL initialize( + const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // ____ view::XSelectionChangeListener ____ + virtual void SAL_CALL selectionChanged( const css::lang::EventObject& aEvent ) override; + + // ________ XEventListener ________ + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // ________ XAccessibleContext ________ + virtual OUString SAL_CALL getAccessibleDescription() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override; + virtual sal_Int32 SAL_CALL getAccessibleIndexInParent() override; + virtual OUString SAL_CALL getAccessibleName() override; + virtual sal_Int16 SAL_CALL getAccessibleRole() override; + + // ________ XAccessibleComponent ________ + virtual css::awt::Rectangle SAL_CALL getBounds() override; + virtual css::awt::Point SAL_CALL getLocationOnScreen() override; + +protected: + // ________ AccessibleChartElement ________ + virtual css::awt::Point GetUpperLeftOnScreen() const override; + +private: // methods + /** @return the result that m_xWindow->getPosSize() _should_ return. It + returns (0,0) as upper left corner. When calling + getAccessibleParent, you get the parent's parent, which contains + a decoration. Thus you have an offset of (currently) (2,2) + which isn't taken into account. + */ + css::awt::Rectangle GetWindowPosSize() const; + +private: // members + css::uno::WeakReference< css::view::XSelectionSupplier > m_xSelectionSupplier; + css::uno::WeakReference< css::frame::XModel > m_xChartModel; + css::uno::WeakReference< css::uno::XInterface > m_xChartView; + css::uno::WeakReference< css::awt::XWindow > m_xWindow; + css::uno::WeakReference< css::accessibility::XAccessible > m_xParent; + + std::shared_ptr< ObjectHierarchy > m_spObjectHierarchy; + AccessibleUniqueId m_aCurrentSelectionOID; + SdrView* m_pSdrView; + std::unique_ptr<::accessibility::IAccessibleViewForwarder> m_pViewForwarder; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/AccessibleTextHelper.hxx b/chart2/source/controller/inc/AccessibleTextHelper.hxx new file mode 100644 index 000000000..30b4123b9 --- /dev/null +++ b/chart2/source/controller/inc/AccessibleTextHelper.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLETEXTHELPER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLETEXTHELPER_HXX + +#include <memory> +#include <MutexContainer.hxx> +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/accessibility/XAccessibleContext.hpp> + +// forward declaration of helper class from svx +namespace accessibility +{ +class AccessibleTextHelper; +} + +namespace chart +{ + +class DrawViewWrapper; + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper< + css::lang::XInitialization, + css::accessibility::XAccessibleContext > + AccessibleTextHelper_Base; +} + +class AccessibleTextHelper : + public MutexContainer, + public impl::AccessibleTextHelper_Base +{ +public: + explicit AccessibleTextHelper( DrawViewWrapper * pDrawViewWrapper ); + virtual ~AccessibleTextHelper() override; + + // ____ XInitialization ____ + /** Must be called at least once for this helper class to work. + + mandatory parameter 0: type string. This is the CID that is used to find + the corresponding drawing object that contains the text that should + be handled by this helper class. +1 + mandatory parameter 1: type XAccessible. Is used as EventSource for the + ::accessibility::AccessibleTextHelper (svx) + + mandatory parameter 2: type awt::XWindow. The Window that shows the + text currently. + */ + virtual void SAL_CALL initialize( + const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // ____ XAccessibleContext ____ + virtual ::sal_Int32 SAL_CALL getAccessibleChildCount() override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleChild( + ::sal_Int32 i ) override; + virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override; + virtual ::sal_Int32 SAL_CALL getAccessibleIndexInParent() override; + virtual ::sal_Int16 SAL_CALL getAccessibleRole() override; + virtual OUString SAL_CALL getAccessibleDescription() override; + virtual OUString SAL_CALL getAccessibleName() override; + virtual css::uno::Reference< css::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet() override; + virtual css::uno::Reference< css::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet() override; + virtual css::lang::Locale SAL_CALL getLocale() override; + +private: + std::unique_ptr<::accessibility::AccessibleTextHelper> m_pTextHelper; + DrawViewWrapper * m_pDrawViewWrapper; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ACCESSIBLETEXTHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/AxisItemConverter.hxx b/chart2/source/controller/inc/AxisItemConverter.hxx new file mode 100644 index 000000000..5bd230bd6 --- /dev/null +++ b/chart2/source/controller/inc/AxisItemConverter.hxx @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_AXISITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_AXISITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +#include <vector> + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XAxis; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace chart { struct ExplicitIncrementData; } +namespace chart { struct ExplicitScaleData; } + +class SdrModel; + +namespace chart::wrapper { + +class AxisItemConverter : public ItemConverter +{ +public: + AxisItemConverter( + const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, + SfxItemPool& rItemPool, SdrModel& rDrawModel, + const css::uno::Reference<css::chart2::XChartDocument> & xChartDoc, + ExplicitScaleData const * pScale, + ExplicitIncrementData const * pIncrement, + const css::awt::Size* pRefSize ); + + virtual ~AxisItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; + css::uno::Reference< + css::chart2::XAxis > m_xAxis; + + css::uno::Reference< + css::chart2::XChartDocument > m_xChartDoc; + + std::unique_ptr<ExplicitScaleData> m_pExplicitScale; + std::unique_ptr<ExplicitIncrementData> m_pExplicitIncrement; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx new file mode 100644 index 000000000..0cf947d0e --- /dev/null +++ b/chart2/source/controller/inc/CharacterPropertyItemConverter.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARACTERPROPERTYITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARACTERPROPERTYITEMCONVERTER_HXX + +#include "ItemConverter.hxx" +#include <com/sun/star/awt/Size.hpp> + +#include <optional> + +namespace chart::wrapper { + +class CharacterPropertyItemConverter final : public ItemConverter +{ +public: + CharacterPropertyItemConverter( + const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, + SfxItemPool& rItemPool ); + + CharacterPropertyItemConverter( + const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, + SfxItemPool& rItemPool, + const css::awt::Size* pRefSize, + const OUString & rRefSizePropertyName, + const css::uno::Reference<css::beans::XPropertySet>& rRefSizePropSet = css::uno::Reference<css::beans::XPropertySet>() ); + + virtual ~CharacterPropertyItemConverter() override; + +private: + virtual const sal_uInt16* GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + + const css::uno::Reference<css::beans::XPropertySet>& GetRefSizePropertySet() const; + + OUString m_aRefSizePropertyName; + css::uno::Reference<css::beans::XPropertySet> m_xRefSizePropSet; + std::optional<css::awt::Size> m_pRefSize; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ChartController.hxx b/chart2/source/controller/inc/ChartController.hxx new file mode 100644 index 000000000..1977e8e16 --- /dev/null +++ b/chart2/source/controller/inc/ChartController.hxx @@ -0,0 +1,559 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTCONTROLLER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTCONTROLLER_HXX + +#include <LifeTime.hxx> +#include "CommandDispatchContainer.hxx" +#include "SelectionHelper.hxx" + +#include <svx/svdtypes.hxx> +#include <vcl/timer.hxx> + +#include <cppuhelper/implbase.hxx> +#include <o3tl/sorted_vector.hxx> +#include <salhelper/simplereferenceobject.hxx> + +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/ui/XContextMenuInterception.hpp> +#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/XLayoutManagerListener.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <memory> + +namespace com::sun::star::accessibility { class XAccessible; } +namespace com::sun::star::accessibility { class XAccessibleContext; } +namespace com::sun::star::awt { class XFocusListener; } +namespace com::sun::star::awt { class XKeyListener; } +namespace com::sun::star::awt { class XMouseListener; } +namespace com::sun::star::awt { class XMouseMotionListener; } +namespace com::sun::star::awt { class XPaintListener; } +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::awt { class XWindowListener; } +namespace com::sun::star::awt { struct Point; } +namespace com::sun::star::document { class XUndoManager; } +namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XLayoutManagerEventBroadcaster; } +namespace com::sun::star::lang { class XInitialization; } +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 +{ + class AcceleratorExecute; +} + +namespace svx::sidebar { + class SelectionChangeHandler; +} + +class DropTargetHelper; + +namespace com::sun::star { + namespace graphic { + class XGraphic; + } +} + +namespace chart +{ + +class UndoGuard; +class ChartWindow; +class DrawModelWrapper; +class DrawViewWrapper; +class ReferenceSizeProvider; +class ViewElementListProvider; + +enum ChartDrawMode { CHARTDRAW_INSERT, CHARTDRAW_SELECT }; + + +class ChartController : public ::cppu::WeakImplHelper < + css::frame::XController //comprehends XComponent (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 + > +{ +public: + ChartController() = delete; + explicit ChartController(css::uno::Reference< css::uno::XComponentContext > const & 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; + + virtual sal_Bool SAL_CALL + attachModel( const css::uno::Reference< css::frame::XModel > & xModel ) override; + + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL + getFrame() override; + + virtual css::uno::Reference< css::frame::XModel > SAL_CALL + getModel() override; + + virtual css::uno::Any SAL_CALL + getViewData() override; + + virtual void SAL_CALL + restoreViewData( const css::uno::Any& rValue ) override; + + virtual sal_Bool SAL_CALL + suspend( sal_Bool bSuspend ) override; + + // css::lang::XComponent (base of XController) + virtual void SAL_CALL + dispose() override; + + virtual void SAL_CALL + addEventListener( const css::uno::Reference< css::lang::XEventListener > & xListener ) override; + + virtual void SAL_CALL + removeEventListener( const css::uno::Reference< css::lang::XEventListener > & xListener ) override; + + // css::frame::XDispatchProvider (required interface) + virtual css::uno::Reference< css::frame::XDispatch> SAL_CALL + queryDispatch( const css::util::URL& rURL + , const OUString& rTargetFrameName + , sal_Int32 nSearchFlags) override; + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL + queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor > & xDescripts) override; + + // css::view::XSelectionSupplier (optional interface) + virtual sal_Bool SAL_CALL + select( const css::uno::Any& rSelection ) override; + + virtual css::uno::Any SAL_CALL + getSelection() override; + + virtual void SAL_CALL + addSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener > & xListener ) override; + + virtual void SAL_CALL + removeSelectionChangeListener( const css::uno::Reference< css::view::XSelectionChangeListener > & xListener ) override; + + // css::ui::XContextMenuInterception (optional interface) + virtual void SAL_CALL + registerContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor > & xInterceptor) override; + + virtual void SAL_CALL + releaseContextMenuInterceptor( const css::uno::Reference< css::ui::XContextMenuInterceptor > & xInterceptor) override; + + //additional interfaces + + // css::util::XCloseListener + virtual void SAL_CALL + queryClosing( const css::lang::EventObject& Source + , sal_Bool GetsOwnership ) override; + + virtual void SAL_CALL + notifyClosing( const css::lang::EventObject& Source ) override; + + // css::util::XEventListener (base of XCloseListener and XModifyListener) + virtual void SAL_CALL + disposing( const css::lang::EventObject& Source ) override; + + // css::frame::XDispatch + + virtual void SAL_CALL + dispatch( const css::util::URL& aURL + , const css::uno::Sequence< css::beans::PropertyValue >& aArgs ) override; + + virtual void SAL_CALL + addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl + , const css::util::URL& aURL ) override; + + virtual void SAL_CALL + removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl + , const css::util::URL& aURL ) override; + + // css::awt::XWindow + virtual void SAL_CALL + setPosSize( sal_Int32 X, sal_Int32 Y + , sal_Int32 Width, sal_Int32 Height, sal_Int16 Flags ) override; + + virtual css::awt::Rectangle SAL_CALL + getPosSize() override; + + virtual void SAL_CALL + setVisible( sal_Bool Visible ) override; + + virtual void SAL_CALL + setEnable( sal_Bool Enable ) override; + + virtual void SAL_CALL + setFocus() override; + + virtual void SAL_CALL + addWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override; + + virtual void SAL_CALL + removeWindowListener( const css::uno::Reference< css::awt::XWindowListener >& xListener ) override; + + virtual void SAL_CALL + addFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override; + + virtual void SAL_CALL + removeFocusListener( const css::uno::Reference< css::awt::XFocusListener >& xListener ) override; + + virtual void SAL_CALL + addKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override; + + virtual void SAL_CALL + removeKeyListener( const css::uno::Reference< css::awt::XKeyListener >& xListener ) override; + + virtual void SAL_CALL + addMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override; + + virtual void SAL_CALL + removeMouseListener( const css::uno::Reference< css::awt::XMouseListener >& xListener ) override; + + virtual void SAL_CALL + addMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override; + + virtual void SAL_CALL + removeMouseMotionListener( const css::uno::Reference< css::awt::XMouseMotionListener >& xListener ) override; + + virtual void SAL_CALL + addPaintListener( const css::uno::Reference< css::awt::XPaintListener >& xListener ) override; + + 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; + + // css::util::XModeChangeListener + virtual void SAL_CALL modeChanged( + const css::util::ModeChangeEvent& _rSource ) override; + + // css::frame::XLayoutManagerListener + virtual void SAL_CALL layoutEvent( + const css::lang::EventObject& aSource, + ::sal_Int16 eLayoutEvent, + const css::uno::Any& aInfo ) override; + + // WindowController stuff + void PrePaint(); + void execute_Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect); + void execute_MouseButtonDown( const MouseEvent& rMEvt ); + void execute_MouseMove( const MouseEvent& rMEvt ); + void execute_MouseButtonUp( const MouseEvent& rMEvt ); + void execute_Resize(); + void execute_Command( const CommandEvent& rCEvt ); + bool execute_KeyInput( const KeyEvent& rKEvt ); + + /** get help text to be shown in a quick help + + @param aAtLogicPosition the position in logic coordinates (of the + window) of the mouse cursor to determine for + which object help is requested. + + @param bIsBalloonHelp determines whether to return the long text version + (balloon help) or the shorter one (quick help). + + @param rOutQuickHelpText is filled with the quick help text + + @param rOutEqualRect is filled with a rectangle that denotes the region + in which the quick help does not change. + + @return </sal_True>, if a quick help should be shown. + */ + bool requestQuickHelp( + ::Point aAtLogicPosition, bool bIsBalloonHelp, + OUString & rOutQuickHelpText, css::awt::Rectangle & rOutEqualRect ); + + css::uno::Reference< css::accessibility::XAccessible > CreateAccessible(); + + static bool isObjectDeleteable( const css::uno::Any& rSelection ); + + void setDrawMode( ChartDrawMode eMode ) { m_eDrawMode = eMode; } + + bool isShapeContext() const; + + ViewElementListProvider getViewElementListProvider(); + DrawModelWrapper* GetDrawModelWrapper(); + DrawViewWrapper* GetDrawViewWrapper(); + VclPtr<ChartWindow> GetChartWindow() const; + weld::Window* GetChartFrame(); + bool isAdditionalShapeSelected() const; + void SetAndApplySelection(const css::uno::Reference<css::drawing::XShape>& rxShape); + void StartTextEdit( const Point* pMousePixel = nullptr ); + + void NotifyUndoActionHdl( std::unique_ptr<SdrUndoAction> ); + + css::uno::Reference<css::uno::XInterface> const & getChartView() const; + +private: + class TheModel : public salhelper::SimpleReferenceObject + { + public: + explicit TheModel( const css::uno::Reference< + css::frame::XModel > & xModel ); + + virtual ~TheModel() override; + + void addListener( ChartController* pController ); + void removeListener( ChartController* pController ); + void tryTermination(); + const css::uno::Reference< css::frame::XModel >& + getModel() const { return m_xModel;} + + private: + css::uno::Reference< css::frame::XModel > m_xModel; + css::uno::Reference< css::util::XCloseable > m_xCloseable; + + //the ownership between model and controller is not clear at first + //each controller might consider himself as owner of the model first + bool m_bOwnership; + }; + class TheModelRef final + { + public: + TheModelRef( TheModel* pTheModel, ::osl::Mutex& rMutex ); + TheModelRef( const TheModelRef& rTheModel, ::osl::Mutex& rMutex ); + TheModelRef& operator=(ChartController::TheModel* pTheModel); + TheModelRef& operator=(const TheModelRef& rTheModel); + ~TheModelRef(); + bool is() const; + TheModel* operator->() const { return m_xTheModel.get(); } + private: + rtl::Reference<TheModel> m_xTheModel; + ::osl::Mutex& m_rModelMutex; + }; + + mutable ::apphelper::LifeTimeManager m_aLifeTimeManager; + + bool m_bSuspended; + + css::uno::Reference< css::uno::XComponentContext> m_xCC; + + //model + css::uno::Reference< css::frame::XFrame > m_xFrame; + mutable ::osl::Mutex m_aModelMutex; + TheModelRef m_aModel; + + //view + css::uno::Reference<css::awt::XWindow> m_xViewWindow; + css::uno::Reference<css::uno::XInterface> m_xChartView; + std::shared_ptr< DrawModelWrapper > m_pDrawModelWrapper; + std::unique_ptr<DrawViewWrapper> m_pDrawViewWrapper; + + Selection m_aSelection; + SdrDragMode m_eDragMode; + + Timer m_aDoubleClickTimer; + bool m_bWaitingForDoubleClick; + bool m_bWaitingForMouseUp; + bool m_bFieldButtonDown; + + bool m_bConnectingToView; + bool m_bDisposed; + + css::uno::Reference< css::document::XUndoManager > m_xUndoManager; + std::unique_ptr< UndoGuard > m_pTextActionUndoGuard; + + std::unique_ptr< ::svt::AcceleratorExecute > m_apAccelExecute; + + CommandDispatchContainer m_aDispatchContainer; + + std::unique_ptr< DropTargetHelper > m_apDropTargetHelper; + css::uno::Reference< + css::frame::XLayoutManagerEventBroadcaster > m_xLayoutManagerEventBroadcaster; + + ChartDrawMode m_eDrawMode; + + rtl::Reference<svx::sidebar::SelectionChangeHandler> mpSelectionChangeHandler; + + bool impl_isDisposedOrSuspended() const; + std::unique_ptr<ReferenceSizeProvider> impl_createReferenceSizeProvider(); + void impl_adaptDataSeriesAutoResize(); + + void impl_createDrawViewController(); + void impl_deleteDrawViewController(); + + //executeDispatch methods + void executeDispatch_ObjectProperties(); + void executeDispatch_FormatObject( const OUString& rDispatchCommand ); + void executeDlg_ObjectProperties( const OUString& rObjectCID ); + bool executeDlg_ObjectProperties_withoutUndoGuard( const OUString& rObjectCID, bool bSuccessOnUnchanged ); + + void executeDispatch_ChartType(); + + void executeDispatch_InsertTitles(); + void executeDispatch_InsertLegend(); + void executeDispatch_DeleteLegend(); + void executeDispatch_OpenLegendDialog(); + void executeDispatch_InsertAxes(); + void executeDispatch_InsertGrid(); + + void executeDispatch_InsertMenu_DataLabels(); + void executeDispatch_InsertMenu_Trendlines(); + void executeDispatch_InsertMenu_MeanValues(); + + void executeDispatch_InsertMeanValue(); + void executeDispatch_InsertTrendline(); + void executeDispatch_InsertTrendlineEquation( bool bInsertR2=false ); + void executeDispatch_InsertErrorBars( bool bYError ); + + void executeDispatch_InsertR2Value(); + void executeDispatch_DeleteR2Value(); + + void executeDispatch_DeleteMeanValue(); + void executeDispatch_DeleteTrendline(); + void executeDispatch_DeleteTrendlineEquation(); + void executeDispatch_DeleteErrorBars( bool bYError ); + + void executeDispatch_InsertDataLabels(); + void executeDispatch_InsertDataLabel(); + void executeDispatch_DeleteDataLabels(); + void executeDispatch_DeleteDataLabel(); + + void executeDispatch_ResetAllDataPoints(); + void executeDispatch_ResetDataPoint(); + + void executeDispatch_InsertAxis(); + void executeDispatch_InsertAxisTitle(); + void executeDispatch_InsertMajorGrid(); + void executeDispatch_InsertMinorGrid(); + void executeDispatch_DeleteAxis(); + void executeDispatch_DeleteMajorGrid(); + void executeDispatch_DeleteMinorGrid(); + + void executeDispatch_InsertSpecialCharacter(); + void executeDispatch_EditText( const Point* pMousePixel = nullptr ); + void executeDispatch_SourceData(); + void executeDispatch_MoveSeries( bool bForward ); + + bool EndTextEdit(); + + void executeDispatch_View3D(); + void executeDispatch_PositionAndSize( const ::css::uno::Sequence< ::css::beans::PropertyValue >* pArgs = nullptr ); + + void executeDispatch_EditData(); + + void executeDispatch_NewArrangement(); + void executeDispatch_ScaleText(); + + void executeDispatch_Paste(); + void executeDispatch_Copy(); + void executeDispatch_Cut(); + bool executeDispatch_Delete(); + void executeDispatch_ToggleLegend(); + void executeDispatch_ToggleGridHorizontal(); + void executeDispatch_ToggleGridVertical(); + + void executeDispatch_LOKSetTextSelection(int nType, int nX, int nY); + void executeDispatch_LOKPieSegmentDragging(int nOffset); + + void sendPopupRequest(OUString const & 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 startDoubleClickWaiting(); + void stopDoubleClickWaiting(); + + void impl_selectObjectAndNotiy(); + void impl_notifySelectionChangeListeners(); + void impl_invalidateAccessible(); + void impl_initializeAccessible(); + void impl_initializeAccessible( const css::uno::Reference< css::lang::XInitialization >& xInit ); + + //sets the model member to null if it equals the parameter + //returns true if successful + bool impl_releaseThisModel( const css::uno::Reference< css::uno::XInterface > & xModel ); + + enum eMoveOrResizeType + { + MOVE_OBJECT, + CENTERED_RESIZE_OBJECT + }; + /// @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 ); + + 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 ); + void impl_PasteStringAsTextShape( const OUString& rString, const css::awt::Point& rPosition ); + void impl_SetMousePointer( const MouseEvent & rEvent ); + + void impl_ClearSelection(); + + void impl_switchDiagramPositioningToExcludingPositioning(); +}; + +} // namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ChartDocumentWrapper.hxx b/chart2/source/controller/inc/ChartDocumentWrapper.hxx new file mode 100644 index 000000000..9f36c42b3 --- /dev/null +++ b/chart2/source/controller/inc/ChartDocumentWrapper.hxx @@ -0,0 +1,176 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTDOCUMENTWRAPPER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTDOCUMENTWRAPPER_HXX + +#include <WrappedPropertySet.hxx> +#include <com/sun/star/chart/XChartDocument.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XAggregation.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> +#include <unotools/eventlisteneradapter.hxx> + +#include <memory> + +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::util { class XRefreshable; } + +namespace chart +{ + +namespace wrapper +{ + +class Chart2ModelContact; + +class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper + < WrappedPropertySet + , css::chart::XChartDocument + , css::drawing::XDrawPageSupplier + , css::lang::XMultiServiceFactory + , css::lang::XServiceInfo + , css::uno::XAggregation + > +{ +}; + +class ChartDocumentWrapper : public ChartDocumentWrapper_Base + , public ::utl::OEventListenerAdapter +{ +public: + explicit ChartDocumentWrapper( const css::uno::Reference< css::uno::XComponentContext > & xContext ); + virtual ~ChartDocumentWrapper() override; + + /// XServiceInfo declarations + 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; + + void setAddIn( const css::uno::Reference< css::util::XRefreshable >& xAddIn ); + const css::uno::Reference< css::util::XRefreshable >& getAddIn() const { return m_xAddIn;} + + void setUpdateAddIn( bool bUpdateAddIn ); + bool getUpdateAddIn() const { return m_bUpdateAddIn;} + + void setBaseDiagram( const OUString& rBaseDiagram ); + const OUString& getBaseDiagram() const { return m_aBaseDiagram;} + + css::uno::Reference< css::drawing::XShapes > getAdditionalShapes() const; + + /// @throws css::uno::RuntimeException + css::uno::Reference< css::drawing::XDrawPage > impl_getDrawPage() const; + +protected: + + // ____ chart::XChartDocument ____ + virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getTitle() override; + virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getSubTitle() override; + virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getLegend() override; + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getArea() override; + virtual css::uno::Reference< css::chart::XDiagram > SAL_CALL getDiagram() override; + virtual void SAL_CALL setDiagram( const css::uno::Reference< + css::chart::XDiagram >& xDiagram ) override; + virtual css::uno::Reference< css::chart::XChartData > SAL_CALL getData() override; + virtual void SAL_CALL attachData( const css::uno::Reference< + css::chart::XChartData >& xData ) override; + + // ____ XModel ____ + virtual sal_Bool SAL_CALL attachResource( const OUString& URL, + const css::uno::Sequence< css::beans::PropertyValue >& Arguments ) override; + virtual OUString SAL_CALL getURL() override; + virtual css::uno::Sequence< + css::beans::PropertyValue > SAL_CALL getArgs() override; + virtual void SAL_CALL connectController( const css::uno::Reference< + css::frame::XController >& Controller ) override; + virtual void SAL_CALL disconnectController( const css::uno::Reference< + css::frame::XController >& Controller ) override; + virtual void SAL_CALL lockControllers() override; + virtual void SAL_CALL unlockControllers() override; + virtual sal_Bool SAL_CALL hasControllersLocked() override; + virtual css::uno::Reference< + css::frame::XController > SAL_CALL getCurrentController() override; + virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& Controller ) override; + virtual css::uno::Reference<css::uno::XInterface > SAL_CALL getCurrentSelection() override; + + // ____ XComponent ____ + virtual void SAL_CALL dispose() override; + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; + + // ____ XInterface (for new interfaces) ____ + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + + // ____ ::utl::OEventListenerAdapter ____ + virtual void _disposing( const css::lang::EventObject& rSource ) override; + + // ____ XDrawPageSupplier ____ + virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override; + + // ____ 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; + + // ____ XAggregation ____ + virtual void SAL_CALL setDelegator( + const css::uno::Reference< css::uno::XInterface >& rDelegator ) override; + virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override; + + // ____ WrappedPropertySet ____ + virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence() override; + virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override; + virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override; + +private: //methods + void impl_resetAddIn(); + +private: //member + std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; + + css::uno::Reference< css::uno::XInterface > m_xDelegator; + + css::uno::Reference< css::drawing::XShape > m_xTitle; + css::uno::Reference< css::drawing::XShape > m_xSubTitle; + css::uno::Reference< css::drawing::XShape > m_xLegend; + css::uno::Reference< css::chart::XChartData > m_xChartData; + css::uno::Reference< css::chart::XDiagram > m_xDiagram; + css::uno::Reference< css::beans::XPropertySet > m_xArea; + + css::uno::Reference< css::util::XRefreshable > m_xAddIn; + OUString m_aBaseDiagram; + bool m_bUpdateAddIn; + + css::uno::Reference< css::uno::XInterface > m_xChartView; + css::uno::Reference< css::lang::XMultiServiceFactory> + m_xShapeFactory; + + bool m_bIsDisposed; +}; + +} // namespace wrapper +} // namespace chart + +// CHART_CHARTDOCUMENT_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ChartToolbarController.hxx b/chart2/source/controller/inc/ChartToolbarController.hxx new file mode 100644 index 000000000..140a62b60 --- /dev/null +++ b/chart2/source/controller/inc/ChartToolbarController.hxx @@ -0,0 +1,84 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTTOOLBARCONTROLLER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CHARTTOOLBARCONTROLLER_HXX + +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <com/sun/star/frame/XToolbarController.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XFramesSupplier; } + +namespace chart { + +typedef cppu::WeakComponentImplHelper< + css::frame::XToolbarController, css::frame::XStatusListener, + css::util::XUpdatable, css::lang::XInitialization, + css::lang::XServiceInfo> ChartToolbarControllerBase; + +class ChartToolbarController : private cppu::BaseMutex, + public ChartToolbarControllerBase +{ +public: + ChartToolbarController(const css::uno::Sequence<css::uno::Any>& rProperties); + virtual ~ChartToolbarController() override; + + ChartToolbarController(const ChartToolbarController&) = delete; + const ChartToolbarController& operator=(const ChartToolbarController&) = delete; + + // XToolbarController + virtual void SAL_CALL execute(sal_Int16 nKeyModifier) override; + + virtual void SAL_CALL click() override; + + virtual void SAL_CALL doubleClick() override; + + virtual css::uno::Reference<css::awt::XWindow> SAL_CALL createPopupWindow() override; + + virtual css::uno::Reference<css::awt::XWindow> SAL_CALL + createItemWindow(const css::uno::Reference<css::awt::XWindow>& rParent) override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + + virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override; + + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XStatusListener + virtual void SAL_CALL statusChanged(const css::frame::FeatureStateEvent& rEvent) override; + + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& rSource) override; + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rAny) override; + + // XUpdatable + virtual void SAL_CALL update() override; + + using cppu::WeakComponentImplHelperBase::disposing; + +private: + + css::uno::Reference<css::frame::XFramesSupplier> mxFramesSupplier; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ChartWindow.hxx b/chart2/source/controller/inc/ChartWindow.hxx new file mode 100644 index 000000000..a05db545b --- /dev/null +++ b/chart2/source/controller/inc/ChartWindow.hxx @@ -0,0 +1,94 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTWINDOW_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_CHARTWINDOW_HXX + +#include <vcl/window.hxx> + +namespace chart +{ + +class ChartController; + +/** The ChartWindow collects events from the window and forwards them the to the controller +thus the controller can perform appropriate actions +*/ + +class ChartWindow : public vcl::Window +{ +public: + ChartWindow( ChartController* pController, vcl::Window* pParent, WinBits nStyle ); + virtual ~ChartWindow() override; + virtual void dispose() override; + + //from base class Window: + virtual void PrePaint(vcl::RenderContext& rRenderContext) override; + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void Tracking( const TrackingEvent& rTEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual void Resize() override; + virtual void Activate() override; + virtual void Deactivate() override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + virtual void Command( const CommandEvent& rCEvt ) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual void RequestHelp( const HelpEvent& rHEvt ) override; + + /// For LibreOfficeKit, we need to route these to the mouse events. + virtual void LogicMouseButtonDown(const MouseEvent&) override; + virtual void LogicMouseButtonUp(const MouseEvent&) override; + virtual void LogicMouseMove(const MouseEvent&) override; + + void ForceInvalidate(); + virtual void Invalidate( InvalidateFlags nFlags = InvalidateFlags::NONE ) override; + virtual void Invalidate( const tools::Rectangle& rRect, InvalidateFlags nFlags = InvalidateFlags::NONE ) override; + virtual void Invalidate( const vcl::Region& rRegion, InvalidateFlags nFlags = InvalidateFlags::NONE ) override; + /// Notify the LOK client about an invalidated area. + virtual void LogicInvalidate( const tools::Rectangle* pRectangle ) override; + + virtual css::uno::Reference< css::accessibility::XAccessible > CreateAccessible() override; + + virtual FactoryFunction GetUITestFactory() const override; + + ChartController* GetController(); + + virtual bool IsChart() const override { return true; } + vcl::Window* GetParentEditWin(); + +private: + // returns the chart bounding box in twips + tools::Rectangle GetBoundingBox(); + +private: + ChartController* m_pWindowController; + bool m_bInPaint; + VclPtr<vcl::Window> m_pViewShellWindow; + + void adjustHighContrastMode(); +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/CommandDispatchContainer.hxx b/chart2/source/controller/inc/CommandDispatchContainer.hxx new file mode 100644 index 000000000..8e6aa4c49 --- /dev/null +++ b/chart2/source/controller/inc/CommandDispatchContainer.hxx @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX + +#include <cppuhelper/weakref.hxx> +#include <o3tl/sorted_vector.hxx> + +#include <map> +#include <vector> + +namespace com::sun::star::frame { class XController; } +namespace com::sun::star::frame { class XDispatch; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::frame { struct DispatchDescriptor; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::util { struct URL; } + +namespace chart +{ + +class DrawCommandDispatch; +class ShapeController; + +/** @HTML + + Helper class for implementing the <code>XDispatchProvider</code> interface + of the ChartController. This class handles all commands to queryDispatch and + queryDispatches in the following way: + + <ul> + <li>Check if there is a cached <code>XDispatch</code> for a given command. + If so, use it.</li> + <li>Check if the command is handled by this class, e.g. Undo. If so, + return a corresponding <code>XDispatch</code> implementation, and cache + this implementation for later use</li> + <li>Otherwise send the command to the chart dispatch provider, if it + can handle this dispatch (determined by the list of commands given in + <code>setChartDispatch()</code>).</li> + </ul> + + <p>The <code>XDispatch</code>Provider is designed to return different + <code>XDispatch</code> implementations for each command. This class here + decides which implementation to use for which command.</p> + + <p>As most commands need much information of the controller and are + implemented there, the controller handles most of the commands itself (it + also implements <code>XDispatch</code>). Therefore it is set here as + chart dispatch.</p> + */ +class CommandDispatchContainer +{ +public: + // note: the chart dispatcher should be removed when all commands are + // handled by other dispatchers. (Chart is currently the controller + // itself) + explicit CommandDispatchContainer( + const css::uno::Reference< css::uno::XComponentContext > & xContext ); + + void setModel( + const css::uno::Reference< css::frame::XModel > & xModel ); + + /** Set a chart dispatcher that is used for all commands contained in + rChartCommands + */ + void setChartDispatch( + const css::uno::Reference< css::frame::XDispatch >& rChartDispatch, + const o3tl::sorted_vector< OUString > & rChartCommands ); + + /** Returns the dispatch that is able to do the command given in rURL, if + implemented here. If the URL is not implemented here, it should be + checked whether the command is one of the commands given via + the setChartDispatch() method. If so, call the chart dispatch. + + <p>If all this fails, return an empty dispatch.</p> + */ + css::uno::Reference< css::frame::XDispatch > getDispatchForURL( + const css::util::URL & rURL ); + + css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > getDispatchesForURLs( + const css::uno::Sequence< css::frame::DispatchDescriptor > & aDescriptors ); + + void DisposeAndClear(); + + static css::uno::Reference< css::frame::XDispatch > + getContainerDispatchForURL( + const css::uno::Reference< css::frame::XController > & xChartController, + const css::util::URL & rURL ); + + css::uno::Reference< css::frame::XDispatch > getChartDispatcher() { return m_xChartDispatcher; } + + void setDrawCommandDispatch( DrawCommandDispatch* pDispatch ); + DrawCommandDispatch* getDrawCommandDispatch() { return m_pDrawCommandDispatch; } + void setShapeController( ShapeController* pController ); + ShapeController* getShapeController() { return m_pShapeController; } + +private: + typedef + std::map< OUString, + css::uno::Reference< css::frame::XDispatch > > + tDispatchMap; + + typedef + std::vector< css::uno::Reference< css::frame::XDispatch > > tDisposeVector; + + mutable tDispatchMap m_aCachedDispatches; + mutable tDisposeVector m_aToBeDisposedDispatches; + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::WeakReference< css::frame::XModel > m_xModel; + + css::uno::Reference< css::frame::XDispatch > m_xChartDispatcher; + o3tl::sorted_vector< OUString > m_aChartCommands; + + DrawCommandDispatch* m_pDrawCommandDispatch; + ShapeController* m_pShapeController; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_COMMANDDISPATCHCONTAINER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ConfigurationAccess.hxx b/chart2/source/controller/inc/ConfigurationAccess.hxx new file mode 100644 index 000000000..416ae72fe --- /dev/null +++ b/chart2/source/controller/inc/ConfigurationAccess.hxx @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CONFIGURATIONACCESS_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_CONFIGURATIONACCESS_HXX + +#include <tools/fldunit.hxx> + +namespace chart +{ + +namespace ConfigurationAccess +{ + /** @descr Retrieve the FieldUnit to be used for the UI. This unit is retrieved + from the registry settings of the Calc application. + + If this setting can not be found there is a fallback to cm which is the most + common setting worldwide (or not?) + + @return the FieldUnit enum. See <vcl/fldunit.hxx> for definition + */ + FieldUnit getFieldUnit(); +} + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/DataPointItemConverter.hxx b/chart2/source/controller/inc/DataPointItemConverter.hxx new file mode 100644 index 000000000..88c2b3a27 --- /dev/null +++ b/chart2/source/controller/inc/DataPointItemConverter.hxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DATAPOINTITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DATAPOINTITEMCONVERTER_HXX + +#include "ItemConverter.hxx" +#include "GraphicPropertyItemConverter.hxx" +#include <com/sun/star/uno/Sequence.h> + +#include <tools/color.hxx> + +#include <vector> + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } + +class SdrModel; + +namespace chart::wrapper { + +class DataPointItemConverter : public ItemConverter +{ +public: + DataPointItemConverter( + const css::uno::Reference<css::frame::XModel>& xChartModel, + const css::uno::Reference<css::uno::XComponentContext>& xContext, + const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, + const css::uno::Reference<css::chart2::XDataSeries>& xSeries, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, + GraphicObjectType eMapTo, + const css::awt::Size* pRefSize = nullptr, + bool bDataSeries = false, + bool bUseSpecialFillColor = false, + sal_Int32 nSpecialFillColor = 0, + bool bOverwriteLabelsForAttributedDataPointsAlso = false, + sal_Int32 nNumberFormat = 0, + sal_Int32 nPercentNumberFormat = 0, + sal_Int32 nPointIndex = -1 ); + + virtual ~DataPointItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; + bool m_bDataSeries; + bool m_bOverwriteLabelsForAttributedDataPointsAlso; + bool m_bUseSpecialFillColor; + Color m_nSpecialFillColor; + sal_Int32 m_nNumberFormat; + sal_Int32 m_nPercentNumberFormat; + css::uno::Sequence<sal_Int32> m_aAvailableLabelPlacements; + bool m_bForbidPercentValue; + bool m_bHideLegendEntry; + sal_Int32 m_nPointIndex; + css::uno::Reference<css::chart2::XDataSeries> m_xSeries; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/DrawViewWrapper.hxx b/chart2/source/controller/inc/DrawViewWrapper.hxx new file mode 100644 index 000000000..8bad64410 --- /dev/null +++ b/chart2/source/controller/inc/DrawViewWrapper.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DRAWVIEWWRAPPER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DRAWVIEWWRAPPER_HXX + +#include <memory> +#include <svx/view3d.hxx> + +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::frame { class XModel; } + +class SdrModel; + +namespace chart +{ + +/** The DrawViewWrapper should help us to reduce effort if the underlying DrawingLayer changes. +Another task is to hide functionality we do not need, for example more than one page. +*/ + +class MarkHandleProvider +{ +public: + virtual bool getMarkHandles( SdrHdlList& rHdlList ) =0; + virtual bool getFrameDragSingles() =0; + +protected: + ~MarkHandleProvider() {} +}; + +class DrawViewWrapper : public E3dView +{ +public: + DrawViewWrapper( + SdrModel& rSdrModel, + OutputDevice* pOut); + + virtual ~DrawViewWrapper() override; + + //triggers the use of an updated first page + void ReInit(); + + /// tries to get an OutputDevice from the XParent of the model to use as reference device + void attachParentReferenceDevice( + const css::uno::Reference< css::frame::XModel > & xChartModel ); + + //fill list of selection handles 'aHdl' + virtual void SetMarkHandles(SfxViewShell* pOtherShell) override; + + SdrPageView* GetPageView() const; + + SdrObject* getHitObject( const Point& rPnt ) const; + + void MarkObject( SdrObject* pObj ); + + //pMarkHandleProvider can be NULL; ownership is not taken + void setMarkHandleProvider( MarkHandleProvider* pMarkHandleProvider ); + void CompleteRedraw(OutputDevice* pOut, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr) override; + + SdrObject* getSelectedObject() const; + SdrObject* getTextEditObject() const; + SdrOutliner* getOutliner() const; + + SfxItemSet getPositionAndSizeItemSetFromMarkedObject() const; + + SdrObject* getNamedSdrObject( const OUString& rName ) const; + static bool IsObjectHit( SdrObject const * pObj, const Point& rPnt ); + + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + + static SdrObject* getSdrObject( const css::uno::Reference< css::drawing::XShape >& xShape ); + +private: + mutable MarkHandleProvider* m_pMarkHandleProvider; + + std::unique_ptr< SdrOutliner > m_apOutliner; + + // #i79965# scroll back view when ending text edit + bool m_bRestoreMapMode; + MapMode m_aMapModeToRestore; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ErrorBarItemConverter.hxx b/chart2/source/controller/inc/ErrorBarItemConverter.hxx new file mode 100644 index 000000000..691ca508a --- /dev/null +++ b/chart2/source/controller/inc/ErrorBarItemConverter.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ERRORBARITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ERRORBARITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart +{ +namespace wrapper +{ + +class ErrorBarItemConverter : public ItemConverter +{ +public: + ErrorBarItemConverter( + const css::uno::Reference< css::frame::XModel > & xChartModel, + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory ); + virtual ~ErrorBarItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::shared_ptr< ItemConverter > m_spGraphicConverter; + css::uno::Reference< css::frame::XModel > m_xModel; +}; + +} // namespace wrapper +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ERRORBARITEMCONVERTER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx new file mode 100644 index 000000000..1fcc4f224 --- /dev/null +++ b/chart2/source/controller/inc/GraphicPropertyItemConverter.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_GRAPHICPROPERTYITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_GRAPHICPROPERTYITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart +{ +namespace wrapper +{ + +enum class GraphicObjectType +{ + FilledDataPoint, + LineDataPoint, + LineProperties, + LineAndFillProperties +}; + +class GraphicPropertyItemConverter : public ItemConverter +{ +public: + GraphicPropertyItemConverter( + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, + GraphicObjectType eObjectType ); + virtual ~GraphicPropertyItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + GraphicObjectType m_GraphicObjectType; + SdrModel & m_rDrawModel; + css::uno::Reference< css::lang::XMultiServiceFactory > m_xNamedPropertyTableFactory; +}; + +} // namespace wrapper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_GRAPHICPROPERTYITEMCONVERTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ItemConverter.hxx b/chart2/source/controller/inc/ItemConverter.hxx new file mode 100644 index 000000000..8d00d9042 --- /dev/null +++ b/chart2/source/controller/inc/ItemConverter.hxx @@ -0,0 +1,198 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMCONVERTER_HXX + +#include <unotools/eventlisteneradapter.hxx> +#include <svl/itemset.hxx> + +#include <utility> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { class XPropertySetInfo; } + +namespace chart::wrapper { + + +/** This class serves for conversion between properties of an XPropertySet and + SfxItems in SfxItemSets. + + With this helper classes, you can feed dialogs with XPropertySets and let + those modify by the dialogs. + + You must implement GetWhichPairs() such that an SfxItemSet created with + CreateEmptyItemSet() is able to hold all items that may be mapped. + + You also have to implement GetItemProperty(), in order to return the + property name for a given which-id together with the corresponding member-id + that has to be used for conversion in QueryValue/PutValue. + + FillSpecialItem and ApplySpecialItem may be used for special handling of + individual item, e.g. if you need member-ids in QueryValue/PutValue + + A typical use could be the following: + + ::comphelper::ChartTypeItemConverter aItemConverter( xPropertySet, GetItemPool() ); + SfxItemSet aItemSet = aItemConverter.CreateEmptyItemSet(); + aItemConverter.FillItemSet( aItemSet ); + bool bChanged = false; + + MyDialog aDlg( aItemSet ); + if( aDlg.Execute() == RET_OK ) + { + const SfxItemSet* pOutItemSet = aDlg.GetOutputItemSet(); + if( pOutItemSet ) + bChanged = aItemConverter.ApplyItemSet( *pOutItemSet ); + } + + if( bChanged ) + { + [ apply model changes to view ] + } + */ +class ItemConverter : + public ::utl::OEventListenerAdapter +{ +public: + /** Construct an item converter that uses the given property set for + reading/writing converted items + */ + ItemConverter( + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet , + SfxItemPool& rItemPool ); + virtual ~ItemConverter() override; + + typedef sal_uInt16 tWhichIdType; + typedef OUString tPropertyNameType; + typedef sal_uInt8 tMemberIdType; + + typedef std::pair< tPropertyNameType, tMemberIdType > tPropertyNameWithMemberId; + + /** applies all properties that can be mapped to items into the given item + set. + + Call this method before opening a dialog. + + @param rOutItemSet + the SfxItemSet is filled with all items that are a result of a + conversion from a property of the internal XPropertySet. + */ + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const; + + /** applies all properties that are results of a conversion from all items + in rItemSet to the internal XPropertySet. + + Call this method after a dialog was closed with OK + + @return true, if any properties have been changed, false otherwise. + */ + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ); + + /** creates an empty item set using the given pool or a common pool if empty + (see GetItemPool) and allowing all items given in the ranges returned by + GetWhichPairs. + */ + SfxItemSet CreateEmptyItemSet() const; + + /** Invalidates all items in rDestSet, that are set (state SfxItemState::SET) in + both item sets (rDestSet and rSourceSet) and have differing content. + */ + static void InvalidateUnequalItems( SfxItemSet &rDestSet, const SfxItemSet &rSourceSet ); + +protected: + + /** implement this method to provide an array of which-ranges of the form: + + const sal_uInt16 aMyPairs[] = + { + from_1, to_1, + from_2, to_2, + ... + from_n, to_n, + 0 + }; + */ + virtual const sal_uInt16 * GetWhichPairs() const = 0; + + /** implement this method to return a Property object for a given which id. + + @param rOutProperty + If true is returned, this contains the property name and the + corresponding Member-Id. + + @return true, if the item can be mapped to a property. + */ + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const = 0; + + /** for items that can not be mapped directly to a property. + + This method is called from FillItemSet(), if GetItemProperty() returns + false. + + The default implementation does nothing except showing an assertion + + @throws css::uno::Exception + */ + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const; + + /** for items that can not be mapped directly to a property. + + This method is called from ApplyItemSet(), if GetItemProperty() returns + false. + + The default implementation returns just false and shows an assertion + + @return true if the item changed a property, false otherwise. + + @throws css::uno::Exception + */ + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ); + + /// Returns the pool + SfxItemPool & GetItemPool() const { return m_rItemPool;} + + /** Returns the XPropertySet that was given in the CTOR and is used to apply + items in ApplyItemSet(). + */ + const css::uno::Reference< css::beans::XPropertySet >& GetPropertySet() const { return m_xPropertySet;} + + // ____ ::utl::OEventListenerAdapter ____ + virtual void _disposing( const css::lang::EventObject& rSource ) override; + +protected: + /** sets a new property set, that you get with GetPropertySet(). It should + not be necessary to use this method. It is introduced to allow changing + the regression type of a regression curve which changes the object + identity. + */ + void resetPropertySet( const css::uno::Reference< css::beans::XPropertySet > & xPropSet ); + +private: + css::uno::Reference< css::beans::XPropertySet > m_xPropertySet; + css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo; + + SfxItemPool& m_rItemPool; +}; + +} + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMCONVERTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ItemPropertyMap.hxx b/chart2/source/controller/inc/ItemPropertyMap.hxx new file mode 100644 index 000000000..26cd4e88c --- /dev/null +++ b/chart2/source/controller/inc/ItemPropertyMap.hxx @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMPROPERTYMAP_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_ITEMPROPERTYMAP_HXX + +#include <sal/config.h> + +#include "ItemConverter.hxx" + +#include <map> + +namespace chart::wrapper { + +typedef std::map< ItemConverter::tWhichIdType, std::pair< ItemConverter::tPropertyNameType, ItemConverter::tMemberIdType > > + ItemPropertyMapType; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/LegendItemConverter.hxx b/chart2/source/controller/inc/LegendItemConverter.hxx new file mode 100644 index 000000000..74de6cd62 --- /dev/null +++ b/chart2/source/controller/inc/LegendItemConverter.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_LEGENDITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_LEGENDITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +#include <vector> + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart +{ +namespace wrapper +{ + +class LegendItemConverter : public ItemConverter +{ +public: + LegendItemConverter( + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, + const css::awt::Size* pRefSize ); + + virtual ~LegendItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; +}; + +} // namespace wrapper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_LEGENDITEMCONVERTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/MultipleChartConverters.hxx b/chart2/source/controller/inc/MultipleChartConverters.hxx new file mode 100644 index 000000000..9f5fd399d --- /dev/null +++ b/chart2/source/controller/inc/MultipleChartConverters.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_MULTIPLECHARTCONVERTERS_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_MULTIPLECHARTCONVERTERS_HXX + +#include "MultipleItemConverter.hxx" + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart::wrapper { + +class AllAxisItemConverter : public MultipleItemConverter +{ +public: + AllAxisItemConverter( + const css::uno::Reference<css::frame::XModel> & xChartModel, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::awt::Size* pRefSize ); + + virtual ~AllAxisItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; +}; + +class AllGridItemConverter : public MultipleItemConverter +{ +public: + AllGridItemConverter( + const css::uno::Reference<css::frame::XModel>& xChartModel, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference<css::lang::XMultiServiceFactory> & xNamedPropertyContainerFactory ); + virtual ~AllGridItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; +}; + +class AllDataLabelItemConverter : public MultipleItemConverter +{ +public: + AllDataLabelItemConverter( + const css::uno::Reference<css::frame::XModel>& xChartModel, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory ); + + virtual ~AllDataLabelItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; +}; + +class AllTitleItemConverter : public MultipleItemConverter +{ +public: + AllTitleItemConverter( + const css::uno::Reference<css::frame::XModel>& xChartModel, + SfxItemPool& rItemPool, SdrModel& rDrawModel, + const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory ); + + virtual ~AllTitleItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; +}; + +class AllSeriesStatisticsConverter : public MultipleItemConverter +{ +public: + AllSeriesStatisticsConverter( + const css::uno::Reference<css::frame::XModel>& xChartModel, SfxItemPool& rItemPool ); + virtual ~AllSeriesStatisticsConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; +}; + +} // namespace chart::wrapper + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_MULTIPLECHARTCONVERTERS_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/MultipleItemConverter.hxx b/chart2/source/controller/inc/MultipleItemConverter.hxx new file mode 100644 index 000000000..e2e8f0775 --- /dev/null +++ b/chart2/source/controller/inc/MultipleItemConverter.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include "ItemConverter.hxx" + +#include <vector> + +namespace chart::wrapper { + +/** Note: virtual const sal_uInt16 * GetWhichPairs() const; is still pure virtual + */ +class MultipleItemConverter : public ItemConverter +{ +public: + virtual ~MultipleItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + + /// implemented empty (returns always false) + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + +protected: + MultipleItemConverter( SfxItemPool& rItemPool ); + + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; +}; + +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ObjectHierarchy.hxx b/chart2/source/controller/inc/ObjectHierarchy.hxx new file mode 100644 index 000000000..a765275c4 --- /dev/null +++ b/chart2/source/controller/inc/ObjectHierarchy.hxx @@ -0,0 +1,108 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX + +#include <ObjectIdentifier.hxx> + +namespace com::sun::star::awt { struct KeyEvent; } +namespace com::sun::star::chart2 { class XChartDocument; } + +#include <memory> +#include <vector> + +namespace chart +{ + +class ExplicitValueProvider; + +namespace impl +{ +class ImplObjectHierarchy; +} + +class ObjectHierarchy +{ +public: + typedef std::vector< ObjectIdentifier > tChildContainer; + + /** @param bFlattenDiagram + If <TRUE/>, the content of the diagram (data series, wall, floor, + etc.) is treated as being at the same level as the diagram. (This is + used for keyboard navigation). + */ + explicit ObjectHierarchy( + const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, + ExplicitValueProvider * pExplicitValueProvider, + bool bFlattenDiagram = false, + bool bOrderingForElementSelector = false ); + ~ObjectHierarchy(); + + static ObjectIdentifier getRootNodeOID(); + static bool isRootNode( const ObjectIdentifier& rOID ); + + /// equal to getChildren( getRootNodeOID()) + tChildContainer getTopLevelChildren() const; + bool hasChildren( const ObjectIdentifier& rParent ) const; + tChildContainer getChildren( const ObjectIdentifier& rParent ) const; + + tChildContainer getSiblings( const ObjectIdentifier& rNode ) const; + + /// The result is empty, if the node cannot be found in the tree + ObjectIdentifier getParent( const ObjectIdentifier& rNode ) const; + /// @returns -1, if no parent can be determined + sal_Int32 getIndexInParent( const ObjectIdentifier& rNode ) const; + +private: + + std::unique_ptr< impl::ImplObjectHierarchy > m_apImpl; +}; + +class ObjectKeyNavigation +{ +public: + explicit ObjectKeyNavigation( const ObjectIdentifier & rCurrentOID, + const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, + ExplicitValueProvider * pExplicitValueProvider ); + + bool handleKeyEvent( const css::awt::KeyEvent & rEvent ); + const ObjectIdentifier& getCurrentSelection() const { return m_aCurrentOID;} + +private: + void setCurrentSelection( const ObjectIdentifier& rOID ); + bool first(); + bool last(); + bool next(); + bool previous(); + bool up(); + bool down(); + bool veryFirst(); + bool veryLast(); + + ObjectIdentifier m_aCurrentOID; + css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument; + ExplicitValueProvider * m_pExplicitValueProvider; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTHIERARCHY_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ObjectNameProvider.hxx b/chart2/source/controller/inc/ObjectNameProvider.hxx new file mode 100644 index 000000000..ea0f7c4a7 --- /dev/null +++ b/chart2/source/controller/inc/ObjectNameProvider.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTNAMEPROVIDER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_OBJECTNAMEPROVIDER_HXX + +#include <ObjectIdentifier.hxx> +#include <TitleHelper.hxx> + +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +/** Provides localized ui strings for the userinterface. +*/ + +class ObjectNameProvider +{ +public: + static OUString getName( ObjectType eObjectType, bool bPlural=false ); + static OUString getAxisName( const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + static OUString getGridName( const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + static OUString getTitleName( const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + static OUString getTitleNameByType( TitleHelper::eTitleType eType ); + + static OUString getNameForCID( + const OUString& rObjectCID, + const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + + static OUString getName_ObjectForSeries( + ObjectType eObjectType, + const OUString& rSeriesCID, + const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + static OUString getName_ObjectForAllSeries( ObjectType eObjectType ); + + /** Provides help texts for the various chart elements. + The parameter rObjectCID has to be a ClassifiedIdentifier - see class ObjectIdentifier. + */ + static OUString getHelpText( const OUString& rObjectCID, const css::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, bool bVerbose=false ); + static OUString getHelpText( const OUString& rObjectCID, const css::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument ); + + /** This is used for showing the currently selected object in the status bar + (command "Context") + */ + static OUString getSelectedObjectText( const OUString & rObjectCID, const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/PositionAndSizeHelper.hxx b/chart2/source/controller/inc/PositionAndSizeHelper.hxx new file mode 100644 index 000000000..efe94648a --- /dev/null +++ b/chart2/source/controller/inc/PositionAndSizeHelper.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_POSITIONANDSIZEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_POSITIONANDSIZEHELPER_HXX + +#include <ObjectIdentifier.hxx> + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::awt { struct Rectangle; } + +namespace chart +{ + +class PositionAndSizeHelper +{ +public: + static bool moveObject( ObjectType eObjectType + , const css::uno::Reference< css::beans::XPropertySet >& xObjectProp + , const css::awt::Rectangle& rNewPositionAndSize + , const css::awt::Rectangle& rOldPositionAndSize + , const css::awt::Rectangle& rPageRectangle ); + + static bool moveObject( const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel + , const css::awt::Rectangle& rNewPositionAndSize + , const css::awt::Rectangle& rOldPositionAndSize + , const css::awt::Rectangle& rPageRectangle ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/RangeSelectionHelper.hxx b/chart2/source/controller/inc/RangeSelectionHelper.hxx new file mode 100644 index 000000000..e4669a044 --- /dev/null +++ b/chart2/source/controller/inc/RangeSelectionHelper.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONHELPER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONHELPER_HXX + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <rtl/ustring.hxx> + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::chart2 { class XChartDocument; } + +namespace com::sun::star { + namespace sheet{ + class XRangeSelection; + class XRangeSelectionListener; + } +} + +namespace chart +{ + +class RangeSelectionListenerParent; + +class RangeSelectionHelper +{ +public: + explicit RangeSelectionHelper( + const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument ); + ~RangeSelectionHelper(); + + bool hasRangeSelection(); + css::uno::Reference< css::sheet::XRangeSelection > const & getRangeSelection(); + void raiseRangeSelectionDocument(); + bool chooseRange( + const OUString & aCurrentRange, + const OUString & aUIString, + RangeSelectionListenerParent & rListenerParent ); + void stopRangeListening( bool bRemoveListener = true ); + bool verifyCellRange( const OUString & rRangeStr ); + bool verifyArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments ); + +private: + css::uno::Reference< css::sheet::XRangeSelection > + m_xRangeSelection; + + css::uno::Reference< css::chart2::XChartDocument > + m_xChartDocument; + + css::uno::Reference< css::sheet::XRangeSelectionListener > + m_xRangeSelectionListener; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/RangeSelectionListener.hxx b/chart2/source/controller/inc/RangeSelectionListener.hxx new file mode 100644 index 000000000..6f6239a0e --- /dev/null +++ b/chart2/source/controller/inc/RangeSelectionListener.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONLISTENER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONLISTENER_HXX + +#include <ControllerLockGuard.hxx> +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/sheet/XRangeSelectionListener.hpp> + +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +class RangeSelectionListenerParent +{ +public: + virtual void listeningFinished( const OUString & rNewRange ) = 0; + virtual void disposingRangeSelection() = 0; + +protected: + ~RangeSelectionListenerParent() {} +}; + +class RangeSelectionListener : public + ::cppu::WeakImplHelper< + css::sheet::XRangeSelectionListener > +{ +public: + explicit RangeSelectionListener( + RangeSelectionListenerParent & rParent, + const OUString & rInitialRange, + const css::uno::Reference< css::frame::XModel >& xModelToLockController ); + virtual ~RangeSelectionListener() override; + +protected: + // ____ XRangeSelectionListener ____ + virtual void SAL_CALL done( const css::sheet::RangeSelectionEvent& aEvent ) override; + virtual void SAL_CALL aborted( const css::sheet::RangeSelectionEvent& aEvent ) override; + + // ____ XEventListener ____ + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + +private: + RangeSelectionListenerParent & m_rParent; + OUString m_aRange; + ControllerLockGuardUNO m_aControllerLockGuard; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RANGESELECTIONLISTENER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx new file mode 100644 index 000000000..73e67900e --- /dev/null +++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONCURVEITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONCURVEITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +namespace com::sun::star::chart2 { class XRegressionCurveContainer; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart +{ +namespace wrapper +{ + +class RegressionCurveItemConverter : public ItemConverter +{ +public: + RegressionCurveItemConverter( + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + const css::uno::Reference< css::chart2::XRegressionCurveContainer > & xRegCurveCnt, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory ); + virtual ~RegressionCurveItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::shared_ptr< ItemConverter > m_spGraphicConverter; + css::uno::Reference< css::chart2::XRegressionCurveContainer > m_xCurveContainer; +}; + +} // namespace wrapper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONCURVEITEMCONVERTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/RegressionEquationItemConverter.hxx b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx new file mode 100644 index 000000000..237452f6f --- /dev/null +++ b/chart2/source/controller/inc/RegressionEquationItemConverter.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONEQUATIONITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_REGRESSIONEQUATIONITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +#include <vector> + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart::wrapper { + +class RegressionEquationItemConverter : public ItemConverter +{ +public: + RegressionEquationItemConverter( + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + SfxItemPool& rItemPool, + SdrModel& rDrawModel, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xNamedPropertyContainerFactory, + const css::awt::Size* pRefSize ); + + virtual ~RegressionEquationItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/SelectionHelper.hxx b/chart2/source/controller/inc/SelectionHelper.hxx new file mode 100644 index 000000000..570fc60a5 --- /dev/null +++ b/chart2/source/controller/inc/SelectionHelper.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_MAIN_SELECTIONHELPER_HXX + +#include "DrawViewWrapper.hxx" +#include <ObjectIdentifier.hxx> + +class SdrObject; + +namespace com::sun::star::drawing { class XShape; } + +namespace chart +{ + +class Selection +{ +public: //methods + bool hasSelection() const; + + OUString const & getSelectedCID() const; + css::uno::Reference< css::drawing::XShape > const & getSelectedAdditionalShape() const; + const ObjectIdentifier& getSelectedOID() const { return m_aSelectedOID;} + + bool isResizeableObjectSelected() const; + bool isRotateableObjectSelected( const css::uno::Reference< css::frame::XModel >& xChartModel ) const; + bool isDragableObjectSelected() const; + + bool isAdditionalShapeSelected() const; + + //returns true if selection has changed + bool setSelection( const OUString& rCID ); + bool setSelection( const css::uno::Reference< css::drawing::XShape >& xShape ); + + void clearSelection(); + + //returns true if the selection has changed + bool maybeSwitchSelectionAfterSingleClickWasEnsured(); + void resetPossibleSelectionAfterSingleClickWasEnsured(); + + void remindSelectionBeforeMouseDown(); + bool isSelectionDifferentFromBeforeMouseDown() const; + + void adaptSelectionToNewPos( const Point& rMousePos, DrawViewWrapper const * pDrawViewWrapper + , bool bIsRightMouse, bool bWaitingForDoubleClick ); + + void applySelection( DrawViewWrapper* pDrawViewWrapper ); + +private: //member + //the selection could be given by a CID or by a shape + //if m_aSelectedObjectCID is not empty this indicates the selection + //the content of m_xSelectedShape is ignored in that case + //the strings are used for autogenerated chart specific objects + //the shape reference is used for additional shapes + ObjectIdentifier m_aSelectedOID; //only single object selection so far + ObjectIdentifier m_aSelectedOID_beforeMouseDown; + ObjectIdentifier m_aSelectedOID_selectOnlyIfNoDoubleClickIsFollowing; +}; + +class SelectionHelper : public MarkHandleProvider +{ +public: + static bool findNamedParent( SdrObject*& pInOutObject + , OUString& rOutName + , bool bGivenObjectMayBeResult ); + static bool findNamedParent( SdrObject*& pInOutObject + , ObjectIdentifier& rOutObject + , bool bGivenObjectMayBeResult ); + static SdrObject* getMarkHandlesObject( SdrObject* pObj ); + static E3dScene* getSceneToRotate( SdrObject* pObj ); + static bool isDragableObjectHitTwice( const Point& rMPos + , const OUString& rNameOfSelectedObject + , const DrawViewWrapper& rDrawViewWrapper ); + + static OUString getHitObjectCID( + const Point& rMPos, + DrawViewWrapper const & rDrawViewWrapper, + bool bGetDiagramInsteadOf_Wall=false ); + + static bool isRotateableObject( const OUString& rCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + explicit SelectionHelper( SdrObject* pSelectedObj ); + virtual ~SelectionHelper(); + + //MarkHandleProvider: + virtual bool getMarkHandles( SdrHdlList& rHdlList ) override; + virtual bool getFrameDragSingles() override; + + SdrObject* getObjectToMark();//sets also internally the mark object + //-> getMarkHandles will behave different if this method has found a Mark Object different from m_pSelectedObj + +private: + SdrObject* m_pSelectedObj;//hit and logically selected object + SdrObject* m_pMarkObj;//object that is marked instead to have more pretty handles +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx new file mode 100644 index 000000000..2be1490ee --- /dev/null +++ b/chart2/source/controller/inc/SeriesOptionsItemConverter.hxx @@ -0,0 +1,87 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_SERIESOPTIONSITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_SERIESOPTIONSITEMCONVERTER_HXX + +#include "ItemConverter.hxx" +#include <com/sun/star/uno/Sequence.h> + +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ +namespace wrapper +{ + +class SeriesOptionsItemConverter : public ItemConverter +{ +public: + SeriesOptionsItemConverter( + const css::uno::Reference< css::frame::XModel > & xChartModel, + const css::uno::Reference< css::uno::XComponentContext > & xContext, + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + SfxItemPool& rItemPool ); + virtual ~SeriesOptionsItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + css::uno::Reference< css::frame::XModel > m_xChartModel; + css::uno::Reference< css::uno::XComponentContext> m_xCC; + + bool m_bAttachToMainAxis; + bool m_bSupportingOverlapAndGapWidthProperties; + bool m_bSupportingBarConnectors; + + sal_Int32 m_nBarOverlap; + sal_Int32 m_nGapWidth; + bool m_bConnectBars; + + bool m_bSupportingAxisSideBySide; + bool m_bGroupBarsPerAxis; + + bool m_bSupportingStartingAngle; + sal_Int32 m_nStartingAngle; + + bool m_bClockwise; + css::uno::Reference< css::chart2::XCoordinateSystem > m_xCooSys; + + css::uno::Sequence< sal_Int32 > m_aSupportedMissingValueTreatments; + sal_Int32 m_nMissingValueTreatment; + + bool m_bSupportingPlottingOfHiddenCells; + bool m_bIncludeHiddenCells; + + bool m_bHideLegendEntry; +}; + +} // namespace wrapper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_SERIESOPTIONSITEMCONVERTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ShapeController.h b/chart2/source/controller/inc/ShapeController.h new file mode 100644 index 000000000..392c28d2f --- /dev/null +++ b/chart2/source/controller/inc/ShapeController.h @@ -0,0 +1,38 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef CHART_SHAPECONTROLLER_H +#define CHART_SHAPECONTROLLER_H + +//Command Ids: +#define COMMAND_ID_FORMAT_LINE 1 +#define COMMAND_ID_FORMAT_AREA 2 +#define COMMAND_ID_TEXT_ATTRIBUTES 3 +#define COMMAND_ID_TRANSFORM_DIALOG 4 +#define COMMAND_ID_OBJECT_TITLE_DESCRIPTION 5 +#define COMMAND_ID_RENAME_OBJECT 6 +#define COMMAND_ID_BRING_TO_FRONT 8 +#define COMMAND_ID_FORWARD 9 +#define COMMAND_ID_BACKWARD 10 +#define COMMAND_ID_SEND_TO_BACK 11 +#define COMMAND_ID_FONT_DIALOG 15 +#define COMMAND_ID_PARAGRAPH_DIALOG 16 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/StatisticsItemConverter.hxx b/chart2/source/controller/inc/StatisticsItemConverter.hxx new file mode 100644 index 000000000..00760488f --- /dev/null +++ b/chart2/source/controller/inc/StatisticsItemConverter.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_STATISTICSITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_STATISTICSITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ +namespace wrapper +{ + +class StatisticsItemConverter : public ItemConverter +{ +public: + StatisticsItemConverter( + const css::uno::Reference< css::frame::XModel > & xChartModel, + const css::uno::Reference< css::beans::XPropertySet > & rPropertySet, + SfxItemPool& rItemPool ); + virtual ~StatisticsItemConverter() override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + css::uno::Reference< css::frame::XModel > m_xModel; +}; + +} // namespace wrapper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_STATISTICSITEMCONVERTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/TabPageNotifiable.hxx b/chart2/source/controller/inc/TabPageNotifiable.hxx new file mode 100644 index 000000000..d9ba55588 --- /dev/null +++ b/chart2/source/controller/inc/TabPageNotifiable.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TABPAGENOTIFIABLE_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TABPAGENOTIFIABLE_HXX + +// color to use as foreground for an invalid range +#define RANGE_SELECTION_INVALID_RANGE_FOREGROUND_COLOR COL_WHITE +// color to use as background for an invalid range +#define RANGE_SELECTION_INVALID_RANGE_BACKGROUND_COLOR Color(0xff6563) + +class BuilderPage; + +namespace chart +{ + +class TabPageNotifiable +{ +public: + virtual void setInvalidPage( BuilderPage * pTabPage ) = 0; + virtual void setValidPage( BuilderPage * pTabPage ) = 0; + +protected: + ~TabPageNotifiable() {} +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TABPAGENOTIFIABLE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx b/chart2/source/controller/inc/TextDirectionListBox.hxx new file mode 100644 index 000000000..7db7d674e --- /dev/null +++ b/chart2/source/controller/inc/TextDirectionListBox.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTDIRECTIONLISTBOX_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTDIRECTIONLISTBOX_HXX + +#include <svx/frmdirlbox.hxx> + +namespace chart +{ + +class TextDirectionListBox : public svx::FrameDirectionListBox +{ +public: + explicit TextDirectionListBox(std::unique_ptr<weld::ComboBox> pControl); +}; + + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/TextLabelItemConverter.hxx b/chart2/source/controller/inc/TextLabelItemConverter.hxx new file mode 100644 index 000000000..9647793a8 --- /dev/null +++ b/chart2/source/controller/inc/TextLabelItemConverter.hxx @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTLABELITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TEXTLABELITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +#include <com/sun/star/uno/Sequence.h> + +#include <vector> + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::frame { class XModel; } + +namespace chart::wrapper { + +class TextLabelItemConverter : public ItemConverter +{ +public: + TextLabelItemConverter( + const css::uno::Reference<css::frame::XModel>& xChartModel, + const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, + const css::uno::Reference<css::chart2::XDataSeries>& xSeries, + SfxItemPool& rItemPool, + const css::awt::Size* pRefSize, + bool bDataSeries, + sal_Int32 nNumberFormat, + sal_Int32 nPercentNumberFormat ); + + virtual ~TextLabelItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16* GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::vector<std::unique_ptr<ItemConverter>> maConverters; + sal_Int32 mnNumberFormat; + sal_Int32 mnPercentNumberFormat; + css::uno::Sequence<sal_Int32> maAvailableLabelPlacements; + + bool mbDataSeries:1; + bool mbForbidPercentValue:1; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx new file mode 100644 index 000000000..e8018ae43 --- /dev/null +++ b/chart2/source/controller/inc/TimerTriggeredControllerLock.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <com/sun/star/uno/Reference.h> +#include <vcl/timer.hxx> + +#include <memory> + +namespace com::sun::star::frame { class XModel; } +namespace chart { class ControllerLockGuardUNO; } + +namespace chart +{ + +class TimerTriggeredControllerLock final +{ +public: + TimerTriggeredControllerLock( const css::uno::Reference< css::frame::XModel >& xModel ); + ~TimerTriggeredControllerLock(); + + void startTimer(); + +private: + css::uno::Reference< css::frame::XModel > m_xModel; + std::unique_ptr< ControllerLockGuardUNO > m_apControllerLockGuard; + AutoTimer m_aTimer; + + DECL_LINK( TimerTimeout, Timer*, void ); +}; + +} //namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/TitleDialogData.hxx b/chart2/source/controller/inc/TitleDialogData.hxx new file mode 100644 index 000000000..d589dc65d --- /dev/null +++ b/chart2/source/controller/inc/TitleDialogData.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEDIALOGDATA_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEDIALOGDATA_HXX + +#include <ReferenceSizeProvider.hxx> +#include <memory> +#include <com/sun/star/uno/Sequence.hxx> + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ + +struct TitleDialogData +{ + css::uno::Sequence< sal_Bool > aPossibilityList; + css::uno::Sequence< sal_Bool > aExistenceList; + css::uno::Sequence< OUString > aTextList; + std::unique_ptr< ReferenceSizeProvider > apReferenceSizeProvider; + + TitleDialogData(std::unique_ptr<ReferenceSizeProvider> pReferenzeSizeProvider = nullptr); + + void readFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel ); + /* return true if anything has changed; + when pOldState is NULL then all data are written to the model + */ + bool writeDifferenceToModel( const css::uno::Reference< css::frame::XModel >& xChartModel + , const css::uno::Reference< css::uno::XComponentContext >& xContext + , TitleDialogData* pOldState=nullptr ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/TitleItemConverter.hxx b/chart2/source/controller/inc/TitleItemConverter.hxx new file mode 100644 index 000000000..59078b5e9 --- /dev/null +++ b/chart2/source/controller/inc/TitleItemConverter.hxx @@ -0,0 +1,62 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEITEMCONVERTER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_TITLEITEMCONVERTER_HXX + +#include "ItemConverter.hxx" + +#include <vector> + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +class SdrModel; + +namespace chart::wrapper { + +class TitleItemConverter : public ItemConverter +{ +public: + TitleItemConverter( + const css::uno::Reference<css::beans::XPropertySet>& rPropertySet, + SfxItemPool& rItemPool, SdrModel& rDrawModel, + const css::uno::Reference<css::lang::XMultiServiceFactory>& xNamedPropertyContainerFactory, + const css::awt::Size* pRefSize ); + + virtual ~TitleItemConverter() override; + + virtual void FillItemSet( SfxItemSet & rOutItemSet ) const override; + virtual bool ApplyItemSet( const SfxItemSet & rItemSet ) override; + +protected: + virtual const sal_uInt16 * GetWhichPairs() const override; + virtual bool GetItemProperty( tWhichIdType nWhichId, tPropertyNameWithMemberId & rOutProperty ) const override; + + virtual void FillSpecialItem( sal_uInt16 nWhichId, SfxItemSet & rOutItemSet ) const override; + virtual bool ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet & rItemSet ) override; + +private: + std::vector< std::unique_ptr<ItemConverter> > m_aConverters; +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/ViewElementListProvider.hxx b/chart2/source/controller/inc/ViewElementListProvider.hxx new file mode 100644 index 000000000..d8b8ffc42 --- /dev/null +++ b/chart2/source/controller/inc/ViewElementListProvider.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#pragma once + +#include <memory> +#include <svx/xtable.hxx> + +class FontList; +class SdrObjList; +class SfxItemSet; + +namespace chart +{ + +class DrawModelWrapper; + +class ViewElementListProvider final +{ +public: + ViewElementListProvider( DrawModelWrapper* pDrawModelWrapper ); + ViewElementListProvider(ViewElementListProvider&&) noexcept; + ~ViewElementListProvider(); + + XColorListRef GetColorTable() const; + XDashListRef GetDashList() const; + XLineEndListRef GetLineEndList() const; + XGradientListRef GetGradientList() const; + XHatchListRef GetHatchList() const; + XBitmapListRef GetBitmapList() const; + XPatternListRef GetPatternList() const; + + //create chartspecific symbols for linecharts + SdrObjList* GetSymbolList() const; + Graphic GetSymbolGraphic( sal_Int32 nStandardSymbol, const SfxItemSet* pSymbolShapeProperties ) const; + + FontList* getFontList() const; + //SfxPrinter* getPrinter(); + +private: + DrawModelWrapper* m_pDrawModelWrapper; + mutable std::unique_ptr<FontList> m_pFontList; +}; + +} //namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_ChartType.hxx b/chart2/source/controller/inc/dlg_ChartType.hxx new file mode 100644 index 000000000..64cab54b8 --- /dev/null +++ b/chart2/source/controller/inc/dlg_ChartType.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_HXX + +#include <vcl/weld.hxx> + +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +class ChartTypeTabPage; +class ChartTypeDialog : public weld::GenericDialogController +{ +public: + ChartTypeDialog(weld::Window* pWindow, + const css::uno::Reference< css::frame::XModel >& xChartModel); + virtual ~ChartTypeDialog() override; + +private: + css::uno::Reference<css::frame::XModel> m_xChartModel; + std::unique_ptr<weld::Container> m_xContentArea; + std::unique_ptr<ChartTypeTabPage> m_xChartTypeTabPage; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_ChartType_UNO.hxx b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx new file mode 100644 index 000000000..bfa1ce433 --- /dev/null +++ b/chart2/source/controller/inc/dlg_ChartType_UNO.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_UNO_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CHARTTYPE_UNO_HXX + +#include <comphelper/proparrhlp.hxx> +#include <svtools/genericunodialog.hxx> + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::beans { class XPropertySetInfo; } + +namespace chart +{ +typedef ::svt::OGenericUnoDialog ChartTypeUnoDlg_BASE; +class ChartTypeUnoDlg : public ChartTypeUnoDlg_BASE + ,public ::comphelper::OPropertyArrayUsageHelper< ChartTypeUnoDlg > +{ +public: + ChartTypeUnoDlg( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + +private: + virtual ~ChartTypeUnoDlg() override; + + // OGenericUnoDialog overridables + virtual void implInitialize(const css::uno::Any& _rValue) override; + virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override; + + // XTypeProvider + virtual css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) override; + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() override; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + + ChartTypeUnoDlg(const ChartTypeUnoDlg&) = delete; + void operator =(const ChartTypeUnoDlg&) = delete; + + css::uno::Reference< css::frame::XModel > m_xChartModel; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_CreationWizard.hxx b/chart2/source/controller/inc/dlg_CreationWizard.hxx new file mode 100644 index 000000000..b44050eef --- /dev/null +++ b/chart2/source/controller/inc/dlg_CreationWizard.hxx @@ -0,0 +1,80 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_HXX + +#include "TimerTriggeredControllerLock.hxx" +#include "TabPageNotifiable.hxx" + +#include <vcl/roadmapwizard.hxx> + +#include <memory> + +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::uno { class XComponentContext; } + +using vcl::WizardTypes::WizardState; +using vcl::WizardTypes::CommitPageReason; + +namespace chart +{ + +class DialogModel; +class ChartTypeTemplateProvider; + +class CreationWizard : public vcl::RoadmapWizardMachine, public TabPageNotifiable +{ +public: + CreationWizard(weld::Window* pParent, + const css::uno::Reference<css::frame::XModel>& xChartModel, + const css::uno::Reference<css::uno::XComponentContext>& xContext); + + CreationWizard() = delete; + virtual ~CreationWizard() override; + + // TabPageNotifiable + virtual void setInvalidPage(BuilderPage * pTabPage) override; + virtual void setValidPage(BuilderPage * pTabPage) override; + +protected: + virtual bool leaveState( WizardState _nState ) override; + virtual WizardState determineNextState(WizardState nCurrentState) const override; + virtual void enterState(WizardState nState) override; + + virtual OUString getStateDisplayName(WizardState nState) const override; + +private: + virtual std::unique_ptr<BuilderPage> createPage(WizardState nState) override; + + css::uno::Reference<css::chart2::XChartDocument> m_xChartModel; + css::uno::Reference<css::uno::XComponentContext> m_xComponentContext; + ChartTypeTemplateProvider* m_pTemplateProvider; + std::unique_ptr<DialogModel> m_pDialogModel; + + TimerTriggeredControllerLock m_aTimerTriggeredControllerLock; + + bool m_bCanTravel; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx new file mode 100644 index 000000000..2e27418de --- /dev/null +++ b/chart2/source/controller/inc/dlg_CreationWizard_UNO.hxx @@ -0,0 +1,118 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_UNO_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_CREATIONWIZARD_UNO_HXX + +#include <MutexContainer.hxx> +#include <cppuhelper/component.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/ui/dialogs/XAsynchronousExecutableDialog.hpp> + +#include "dlg_CreationWizard.hxx" +#include <tools/link.hxx> +#include <vcl/vclptr.hxx> +#include <vcl/vclevent.hxx> + +namespace com::sun::star::awt { class XWindow; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } + +class VclWindowEvent; + +namespace chart +{ + +class CreationWizardUnoDlg : public MutexContainer + , public ::cppu::OComponentHelper + , public css::ui::dialogs::XAsynchronousExecutableDialog + , public css::lang::XServiceInfo + , public css::lang::XInitialization + , public css::frame::XTerminateListener + , public css::beans::XPropertySet +{ +public: + CreationWizardUnoDlg() = delete; + + CreationWizardUnoDlg( const css::uno::Reference< css::uno::XComponentContext >& xContext ); + virtual ~CreationWizardUnoDlg() override; + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + virtual css::uno::Any SAL_CALL queryAggregation( css::uno::Type const & rType ) override; + virtual void SAL_CALL acquire() throw () override; + virtual void SAL_CALL release() throw () override; + + // XTypeProvider + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes( ) override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId( ) override; + + // 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; + + // XAsynchronousExecutableDialog + virtual void SAL_CALL setDialogTitle( const OUString& aTitle ) override; + virtual void SAL_CALL startExecuteModal( const css::uno::Reference<css::ui::dialogs::XDialogClosedListener>& xListener ) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XTerminateListener + virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override; + virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override; + + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + +protected: + // ____ OComponentHelper ____ + /// Called in dispose method after the listeners were notified. + virtual void SAL_CALL disposing() override; + +private: + void createDialogOnDemand(); + DECL_STATIC_LINK(CreationWizardUnoDlg, InstallLOKNotifierHdl, void*, vcl::ILibreOfficeKitNotifier*); + +private: + css::uno::Reference< css::frame::XModel > m_xChartModel; + css::uno::Reference< css::uno::XComponentContext> m_xCC; + css::uno::Reference< css::awt::XWindow > m_xParentWindow; + + std::shared_ptr<CreationWizard> m_xDialog; + bool m_bUnlockControllersOnExecute; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_DataEditor.hxx b/chart2/source/controller/inc/dlg_DataEditor.hxx new file mode 100644 index 000000000..878dc9d9c --- /dev/null +++ b/chart2/source/controller/inc/dlg_DataEditor.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATAEDITOR_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATAEDITOR_HXX + +#include <vcl/weld.hxx> + +namespace com::sun::star::uno { class XComponentContext; } +namespace comphelper { template <class Tp, class Arg> class mem_fun1_t; } + +namespace com::sun::star { + namespace chart2 { + class XChartDocument; + } +} + +namespace chart +{ + +class DataBrowser; + +class DataEditor : public weld::GenericDialogController +{ +public: + DataEditor(weld::Window* pParent, + const css::uno::Reference<css::chart2::XChartDocument> & xChartDoc, + const css::uno::Reference<css::uno::XComponentContext> & xContext); + virtual ~DataEditor() override; + + DECL_LINK(CloseHdl, weld::Button&, void); + + void SetReadOnly( bool bReadOnly ); + +private: + bool m_bReadOnly; + + css::uno::Reference<css::chart2::XChartDocument> m_xChartDoc; + css::uno::Reference<css::uno::XComponentContext> m_xContext; + + std::unique_ptr<weld::Toolbar> m_xTbxData; + std::unique_ptr<weld::Button> m_xCloseBtn; + std::unique_ptr<weld::Container> m_xTable; + std::unique_ptr<weld::Container> m_xColumns; + std::unique_ptr<weld::Container> m_xColors; + css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent; + VclPtr<DataBrowser> m_xBrwData; + + /// handles actions of the toolbox + DECL_LINK( ToolboxHdl, const OString&, void ); + /// is called, if the cursor of the table has moved + DECL_LINK( BrowserCursorMovedHdl, DataBrowser*, void); +}; + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATAEDITOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_DataSource.hxx b/chart2/source/controller/inc/dlg_DataSource.hxx new file mode 100644 index 000000000..272fe1a81 --- /dev/null +++ b/chart2/source/controller/inc/dlg_DataSource.hxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATASOURCE_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATASOURCE_HXX + +#include <vcl/weld.hxx> + +#include "TabPageNotifiable.hxx" + +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::uno { class XComponentContext; } + +#include <memory> + +class BuilderPage; + +namespace chart +{ + +class RangeChooserTabPage; +class DataSourceTabPage; +class ChartTypeTemplateProvider; +class DialogModel; + +class DataSourceDialog final : + public weld::GenericDialogController, + public TabPageNotifiable +{ +public: + explicit DataSourceDialog( + weld::Window * pParent, + const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, + const css::uno::Reference< css::uno::XComponentContext > & xContext ); + virtual ~DataSourceDialog() override; + + // from GenericDialogController base + virtual short run() override; + + // TabPageNotifiable + virtual void setInvalidPage( BuilderPage * pTabPage ) override; + virtual void setValidPage( BuilderPage * pTabPage ) override; + +private: + DECL_LINK(ActivatePageHdl, const OString&, void); + DECL_LINK(DeactivatePageHdl, const OString&, bool); + + std::unique_ptr< ChartTypeTemplateProvider > m_apDocTemplateProvider; + std::unique_ptr< DialogModel > m_apDialogModel; + + std::unique_ptr<RangeChooserTabPage> m_xRangeChooserTabPage; + std::unique_ptr<DataSourceTabPage> m_xDataSourceTabPage; + bool m_bRangeChooserTabIsValid; + bool m_bDataSourceTabIsValid; + bool m_bTogglingEnabled; + + std::unique_ptr<weld::Notebook> m_xTabControl; + std::unique_ptr<weld::Button> m_xBtnOK; + + static sal_uInt16 m_nLastPageId; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_DATASOURCE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx new file mode 100644 index 000000000..14e3c6669 --- /dev/null +++ b/chart2/source/controller/inc/dlg_InsertAxis_Grid.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTAXIS_GRID_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTAXIS_GRID_HXX + +#include <vcl/weld.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +namespace chart +{ + +struct InsertAxisOrGridDialogData +{ + css::uno::Sequence< sal_Bool > aPossibilityList; + css::uno::Sequence< sal_Bool > aExistenceList; + + InsertAxisOrGridDialogData(); +}; + +/************************************************************************* +|* +|* insert Axis dialog (also base for grid dialog) +|* +\************************************************************************/ +class SchAxisDlg : public weld::GenericDialogController +{ +protected: + std::unique_ptr<weld::CheckButton> m_xCbPrimaryX; + std::unique_ptr<weld::CheckButton> m_xCbPrimaryY; + std::unique_ptr<weld::CheckButton> m_xCbPrimaryZ; + std::unique_ptr<weld::CheckButton> m_xCbSecondaryX; + std::unique_ptr<weld::CheckButton> m_xCbSecondaryY; + std::unique_ptr<weld::CheckButton> m_xCbSecondaryZ; + +public: + SchAxisDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput, bool bAxisDlg = true); + void getResult( InsertAxisOrGridDialogData& rOutput ); +}; + +/************************************************************************* +|* +|* Grid dialog +|* +\************************************************************************/ +class SchGridDlg : public SchAxisDlg +{ +public: + SchGridDlg(weld::Window* pParent, const InsertAxisOrGridDialogData& rInput); +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_InsertDataLabel.hxx b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx new file mode 100644 index 000000000..c39d608d1 --- /dev/null +++ b/chart2/source/controller/inc/dlg_InsertDataLabel.hxx @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTDATALABEL_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTDATALABEL_HXX + +#include <vcl/weld.hxx> +#include <svl/itemset.hxx> +#include <memory> + +class SvNumberFormatter; + +namespace chart +{ +class DataLabelResources; + +class DataLabelsDialog : public weld::GenericDialogController +{ +private: + std::unique_ptr<DataLabelResources> m_apDataLabelResources; + +public: + DataLabelsDialog(weld::Window* pParent, const SfxItemSet& rInAttrs, + SvNumberFormatter* pFormatter); + virtual ~DataLabelsDialog() override; + + void FillItemSet(SfxItemSet& rOutAttrs); +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_InsertErrorBars.hxx b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx new file mode 100644 index 000000000..60cbaac65 --- /dev/null +++ b/chart2/source/controller/inc/dlg_InsertErrorBars.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTERRORBARS_HXX + +#include <memory> +#include <vcl/weld.hxx> +#include <svl/itemset.hxx> + +#include "res_ErrorBar.hxx" + +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +class InsertErrorBarsDialog : public weld::GenericDialogController +{ +public: + InsertErrorBarsDialog(weld::Window* pParent, const SfxItemSet& rMyAttrs, + const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument, + ErrorBarResources::tErrorBarType eType); + + void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); + + static double getAxisMinorStepWidthForErrorBarDecimals( + const css::uno::Reference< css::frame::XModel >& xChartModel, + const css::uno::Reference< css::uno::XInterface >& xChartView, + const OUString& rSelectedObjectCID ); + + void FillItemSet( SfxItemSet& rOutAttrs ); + +private: + std::unique_ptr< ErrorBarResources > m_apErrorBarResources; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_InsertLegend.hxx b/chart2/source/controller/inc/dlg_InsertLegend.hxx new file mode 100644 index 000000000..41605db73 --- /dev/null +++ b/chart2/source/controller/inc/dlg_InsertLegend.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTLEGEND_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTLEGEND_HXX + +#include <vcl/weld.hxx> + +#include <memory> + +#include "res_LegendPosition.hxx" + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ + +class SchLegendDlg : public weld::GenericDialogController +{ +private: + std::unique_ptr<LegendPositionResources> m_xLegendPositionResources; + +public: + SchLegendDlg(weld::Window* pParent, const css::uno::Reference< css::uno::XComponentContext>& xCC); + + void init( const css::uno::Reference< css::frame::XModel >& xChartModel ); + void writeToModel( const css::uno::Reference< css::frame::XModel >& xChartModel ) const; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_InsertTitle.hxx b/chart2/source/controller/inc/dlg_InsertTitle.hxx new file mode 100644 index 000000000..7eea6f2bb --- /dev/null +++ b/chart2/source/controller/inc/dlg_InsertTitle.hxx @@ -0,0 +1,43 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTTITLE_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_INSERTTITLE_HXX + +#include "res_Titles.hxx" +#include <vcl/weld.hxx> +#include <memory> + +namespace chart +{ +class SchTitleDlg : public weld::GenericDialogController +{ +private: + std::unique_ptr<TitleResources> m_xTitleResources; + +public: + SchTitleDlg(weld::Window* pParent, const TitleDialogData& rInput); + + void getResult(TitleDialogData& rOutput); +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_ObjectProperties.hxx b/chart2/source/controller/inc/dlg_ObjectProperties.hxx new file mode 100644 index 000000000..78a13838b --- /dev/null +++ b/chart2/source/controller/inc/dlg_ObjectProperties.hxx @@ -0,0 +1,148 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_OBJECTPROPERTIES_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_OBJECTPROPERTIES_HXX + +#include <ObjectIdentifier.hxx> +#include <sfx2/tabdlg.hxx> + +namespace com::sun::star::util { class XNumberFormatsSupplier; } +class Graphic; + +namespace chart +{ + +class ObjectPropertiesDialogParameter final +{ +public: + ObjectPropertiesDialogParameter( const OUString& rObjectCID ); + ~ObjectPropertiesDialogParameter(); + + void init( const css::uno::Reference< css::frame::XModel >& xModel ); + ObjectType getObjectType() const { return m_eObjectType;} + const OUString& getLocalizedName() const { return m_aLocalizedName;} + + bool HasGeometryProperties() const { return m_bHasGeometryProperties;} + bool HasStatisticProperties() const { return m_bHasStatisticProperties;} + bool ProvidesSecondaryYAxis() const { return m_bProvidesSecondaryYAxis;} + bool ProvidesOverlapAndGapWidth() const { return m_bProvidesOverlapAndGapWidth;} + bool ProvidesBarConnectors() const { return m_bProvidesBarConnectors;} + bool HasAreaProperties() const { return m_bHasAreaProperties;} + bool HasSymbolProperties() const { return m_bHasSymbolProperties;} + bool HasNumberProperties() const { return m_bHasNumberProperties;} + bool ProvidesStartingAngle() const { return m_bProvidesStartingAngle;} + bool ProvidesMissingValueTreatments() const { return m_bProvidesMissingValueTreatments;} + bool IsPieChartDataPoint() const { return m_bIsPieChartDataPoint;} + + bool HasScaleProperties() const { return m_bHasScaleProperties;} + bool CanAxisLabelsBeStaggered() const { return m_bCanAxisLabelsBeStaggered;} + bool IsSupportingAxisPositioning() const { return m_bSupportingAxisPositioning;} + bool ShowAxisOrigin() const { return m_bShowAxisOrigin;} + bool IsCrossingAxisIsCategoryAxis() const { return m_bIsCrossingAxisIsCategoryAxis;} + bool IsSupportingCategoryPositioning() const { return m_bSupportingCategoryPositioning;} + const css::uno::Sequence< OUString >& GetCategories() const { return m_aCategories;} + + const css::uno::Reference< css::chart2::XChartDocument >& + getDocument() const { return m_xChartDocument;} + + bool IsComplexCategoriesAxis() const { return m_bComplexCategoriesAxis;} + + sal_Int32 getNbPoints() const { return m_nNbPoints;} + +private: + OUString m_aObjectCID; + ObjectType m_eObjectType; + bool m_bAffectsMultipleObjects;//is true if more than one object of the given type will be changed (e.g. all axes or all titles) + + OUString m_aLocalizedName; + + bool m_bHasGeometryProperties; + bool m_bHasStatisticProperties; + bool m_bProvidesSecondaryYAxis; + bool m_bProvidesOverlapAndGapWidth; + bool m_bProvidesBarConnectors; + bool m_bHasAreaProperties; + bool m_bHasSymbolProperties; + bool m_bHasNumberProperties; + bool m_bProvidesStartingAngle; + bool m_bProvidesMissingValueTreatments; + bool m_bIsPieChartDataPoint; + + bool m_bHasScaleProperties; + bool m_bCanAxisLabelsBeStaggered; + + bool m_bSupportingAxisPositioning; + bool m_bShowAxisOrigin; + bool m_bIsCrossingAxisIsCategoryAxis; + bool m_bSupportingCategoryPositioning; + css::uno::Sequence< OUString > m_aCategories; + + css::uno::Reference< css::chart2::XChartDocument > m_xChartDocument; + + bool m_bComplexCategoriesAxis; + + sal_Int32 m_nNbPoints; +}; + +/************************************************************************* +|* +|* dialog for properties of different chart object +|* +\************************************************************************/ + +class ViewElementListProvider; + +class SchAttribTabDlg : public SfxTabDialogController +{ +private: + const ObjectPropertiesDialogParameter * const m_pParameter; + const ViewElementListProvider* const m_pViewElementListProvider; + SvNumberFormatter* m_pNumberFormatter; + + std::unique_ptr<SfxItemSet> m_pSymbolShapeProperties; + std::unique_ptr<Graphic> m_pAutoSymbolGraphic; + + double m_fAxisMinorStepWidthForErrorBarDecimals; + bool m_bOKPressed; + + DECL_LINK(OKPressed, weld::Button&, void); + + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + +public: + SchAttribTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, + const ObjectPropertiesDialogParameter* pDialogParameter, + const ViewElementListProvider* pViewElementListProvider, + const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + virtual ~SchAttribTabDlg() override; + + //pSymbolShapeProperties: Properties to be set on the symbollist shapes + //pAutoSymbolGraphic: Graphic to be shown if AutoSymbol gets selected + void setSymbolInformation( std::unique_ptr<SfxItemSet> pSymbolShapeProperties, std::unique_ptr<Graphic> pAutoSymbolGraphic ); + + void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); + + bool DialogWasClosedWithOK() const { return m_bOKPressed;} +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_ShapeFont.hxx b/chart2/source/controller/inc/dlg_ShapeFont.hxx new file mode 100644 index 000000000..5429b8449 --- /dev/null +++ b/chart2/source/controller/inc/dlg_ShapeFont.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEFONT_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEFONT_HXX + +#include <sfx2/tabdlg.hxx> + +namespace chart +{ +class ViewElementListProvider; + +/** dialog for font properties of shapes + */ +class ShapeFontDialog : public SfxTabDialogController +{ +public: + ShapeFontDialog(weld::Window* pParent, const SfxItemSet* pAttr, + const ViewElementListProvider* pViewElementListProvider); + +private: + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; + + const ViewElementListProvider* m_pViewElementListProvider; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEFONT_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_ShapeParagraph.hxx b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx new file mode 100644 index 000000000..6e214dfbc --- /dev/null +++ b/chart2/source/controller/inc/dlg_ShapeParagraph.hxx @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEPARAGRAPH_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEPARAGRAPH_HXX + +#include <sfx2/tabdlg.hxx> + +namespace chart +{ +/** dialog for paragraph properties of shapes + */ +class ShapeParagraphDialog : public SfxTabDialogController +{ +public: + ShapeParagraphDialog(weld::Window* pParent, const SfxItemSet* pAttr); + +private: + virtual void PageCreated(const OString& rId, SfxTabPage& rPage) override; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_SHAPEPARAGRAPH_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/dlg_View3D.hxx b/chart2/source/controller/inc/dlg_View3D.hxx new file mode 100644 index 000000000..ad5466e49 --- /dev/null +++ b/chart2/source/controller/inc/dlg_View3D.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_VIEW3D_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_DLG_VIEW3D_HXX + +#include <vcl/weld.hxx> +#include <ControllerLockGuard.hxx> + +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ +class ThreeD_SceneGeometry_TabPage; +class ThreeD_SceneAppearance_TabPage; +class ThreeD_SceneIllumination_TabPage; + +class View3DDialog : public weld::GenericDialogController +{ +public: + View3DDialog(weld::Window* pWindow, const css::uno::Reference<css::frame::XModel> & xChartModel); + virtual ~View3DDialog() override; + + virtual short run() override; + +private: + DECL_LINK(ActivatePageHdl, const OString&, void); + + ControllerLockHelper m_aControllerLocker; + + static sal_uInt16 m_nLastPageId; + + std::unique_ptr<weld::Notebook> m_xTabControl; + std::unique_ptr<ThreeD_SceneGeometry_TabPage> m_xGeometry; + std::unique_ptr<ThreeD_SceneAppearance_TabPage> m_xAppearance; + std::unique_ptr<ThreeD_SceneIllumination_TabPage> m_xIllumination; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/helpids.h b/chart2/source/controller/inc/helpids.h new file mode 100644 index 000000000..2867867d6 --- /dev/null +++ b/chart2/source/controller/inc/helpids.h @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef CHART_HELPIDS_H +#define CHART_HELPIDS_H + +#define HID_SCH_WIN_DOCUMENT "CHART2_HID_SCH_WIN_DOCUMENT" +#define HID_SCH_ERROR_BARS_FROM_DATA "CHART2_SCH_ERROR_BARS_FROM_DATA" + + + +#define HID_SCH_WIZARD_ROADMAP "CHART2_HID_SCH_WIZARD_ROADMAP" +#define HID_SCH_DATA_SERIES_LABEL "CHART2_HID_SCH_DATA_SERIES_LABEL" + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx new file mode 100644 index 000000000..0514855a2 --- /dev/null +++ b/chart2/source/controller/inc/res_ErrorBar.hxx @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_ERRORBAR_HXX + +#include <memory> +#include <tools/link.hxx> +#include <svl/itemset.hxx> +#include <svx/chrtitem.hxx> +#include "RangeSelectionListener.hxx" + +namespace com::sun::star::chart2 { class XChartDocument; } +namespace weld { class Builder; } +namespace weld { class Button; } +namespace weld { class CheckButton; } +namespace weld { class ComboBox; } +namespace weld { class DialogController; } +namespace weld { class Entry; } +namespace weld { class Frame; } +namespace weld { class Image; } +namespace weld { class Label; } +namespace weld { class MetricSpinButton; } +namespace weld { class RadioButton; } +namespace weld { class ToggleButton; } +namespace weld { class Widget; } + +namespace chart +{ + +class RangeSelectionHelper; + +class ErrorBarResources : public RangeSelectionListenerParent +{ +public: + enum tErrorBarType + { + ERROR_BAR_X, + ERROR_BAR_Y + }; + + ErrorBarResources( + weld::Builder* pParent, weld::DialogController* pControllerDialog, const SfxItemSet& rInAttrs, bool bNoneAvailable, chart::ErrorBarResources::tErrorBarType eType = ERROR_BAR_Y); + virtual ~ErrorBarResources(); + + void SetAxisMinorStepWidthForErrorBarDecimals( double fMinorStepWidth ); + void SetErrorBarType( tErrorBarType eNewType ); + void SetChartDocumentForRangeChoosing( + const css::uno::Reference< css::chart2::XChartDocument > & xChartDocument ); + void Reset(const SfxItemSet& rInAttrs); + void FillItemSet(SfxItemSet& rOutAttrs) const; + + void FillValueSets(); + + // ____ RangeSelectionListenerParent ____ + virtual void listeningFinished( const OUString & rNewRange ) override; + virtual void disposingRangeSelection() override; + +private: + SvxChartKindError m_eErrorKind; + SvxChartIndicate m_eIndicate; + + bool m_bErrorKindUnique; + bool m_bIndicatorUnique; + bool m_bRangePosUnique; + bool m_bRangeNegUnique; + + tErrorBarType m_eErrorBarType; + sal_uInt16 m_nConstDecimalDigits; + sal_Int64 m_nConstSpinSize; + double m_fPlusValue; + double m_fMinusValue; + + weld::DialogController* m_pController; + std::unique_ptr< RangeSelectionHelper > m_apRangeSelectionHelper; + weld::Entry* m_pCurrentRangeChoosingField; + bool m_bHasInternalDataProvider; + bool m_bEnableDataTableDialog; + + + // category + std::unique_ptr<weld::RadioButton> m_xRbNone; + std::unique_ptr<weld::RadioButton> m_xRbConst; + std::unique_ptr<weld::RadioButton> m_xRbPercent; + std::unique_ptr<weld::RadioButton> m_xRbFunction; + std::unique_ptr<weld::RadioButton> m_xRbRange; + std::unique_ptr<weld::ComboBox> m_xLbFunction; + + // parameters + std::unique_ptr<weld::Frame> m_xFlParameters; + std::unique_ptr<weld::Widget> m_xBxPositive; + std::unique_ptr<weld::MetricSpinButton> m_xMfPositive; + std::unique_ptr<weld::Entry> m_xEdRangePositive; + std::unique_ptr<weld::Button> m_xIbRangePositive; + std::unique_ptr<weld::Widget> m_xBxNegative; + std::unique_ptr<weld::MetricSpinButton> m_xMfNegative; + std::unique_ptr<weld::Entry> m_xEdRangeNegative; + std::unique_ptr<weld::Button> m_xIbRangeNegative; + std::unique_ptr<weld::CheckButton> m_xCbSyncPosNeg; + + // indicator + std::unique_ptr<weld::RadioButton> m_xRbBoth; + std::unique_ptr<weld::RadioButton> m_xRbPositive; + std::unique_ptr<weld::RadioButton> m_xRbNegative; + std::unique_ptr<weld::Image> m_xFiBoth; + std::unique_ptr<weld::Image> m_xFiPositive; + std::unique_ptr<weld::Image> m_xFiNegative; + + std::unique_ptr<weld::Label> m_xUIStringPos; + std::unique_ptr<weld::Label> m_xUIStringNeg; + std::unique_ptr<weld::Label> m_xUIStringRbRange; + + DECL_LINK( CategoryChosen, weld::ToggleButton&, void ); + DECL_LINK( CategoryChosen2, weld::ComboBox&, void ); + DECL_LINK( SynchronizePosAndNeg, weld::ToggleButton&, void ); + DECL_LINK( PosValueChanged, weld::MetricSpinButton&, void ); + DECL_LINK( IndicatorChanged, weld::ToggleButton&, void ); + DECL_LINK( ChooseRange, weld::Button&, void ); + DECL_LINK( RangeChanged, weld::Entry&, void ); + + void UpdateControlStates(); + void isRangeFieldContentValid(weld::Entry& rEdit); +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx b/chart2/source/controller/inc/res_LegendPosition.hxx new file mode 100644 index 000000000..3701225b6 --- /dev/null +++ b/chart2/source/controller/inc/res_LegendPosition.hxx @@ -0,0 +1,75 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_LEGENDPOSITION_HXX + +#include <svl/itemset.hxx> +#include <tools/link.hxx> + +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } +namespace weld { class Builder; } +namespace weld { class CheckButton; } +namespace weld { class RadioButton; } +namespace weld { class ToggleButton; } + +namespace chart +{ + +class LegendPositionResources final +{ + +public: + //constructor without Display checkbox + LegendPositionResources(weld::Builder& rBuilder); + //constructor inclusive Display checkbox + LegendPositionResources(weld::Builder& rBuilder, const css::uno::Reference< + css::uno::XComponentContext>& xCC ); + ~LegendPositionResources(); + + void writeToResources( const css::uno::Reference< css::frame::XModel >& xChartModel ); + void writeToModel( const css::uno::Reference< css::frame::XModel >& xChartModel ) const; + + void initFromItemSet( const SfxItemSet& rInAttrs ); + void writeToItemSet( SfxItemSet& rOutAttrs ) const; + + void SetChangeHdl( const Link<LinkParamNone*,void>& rLink ); + + DECL_LINK( PositionEnableHdl, weld::ToggleButton&, void ); + DECL_LINK( PositionChangeHdl, weld::ToggleButton&, void ); + +private: + void impl_setRadioButtonToggleHdl(); + +private: + css::uno::Reference< css::uno::XComponentContext> m_xCC; + Link<LinkParamNone*,void> m_aChangeLink; + + std::unique_ptr<weld::CheckButton> m_xCbxShow; + std::unique_ptr<weld::RadioButton> m_xRbtLeft; + std::unique_ptr<weld::RadioButton> m_xRbtRight; + std::unique_ptr<weld::RadioButton> m_xRbtTop; + std::unique_ptr<weld::RadioButton> m_xRbtBottom; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/res_Titles.hxx b/chart2/source/controller/inc/res_Titles.hxx new file mode 100644 index 000000000..f18c99b5b --- /dev/null +++ b/chart2/source/controller/inc/res_Titles.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_TITLES_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_INC_RES_TITLES_HXX + +#include "TitleDialogData.hxx" + +template <typename Arg, typename Ret> class Link; +namespace weld { class Builder; } +namespace weld { class Entry; } +namespace weld { class Label; } + +namespace chart +{ + +class TitleResources final +{ +public: + TitleResources(weld::Builder& rParent, bool bShowSecondaryAxesTitle); + ~TitleResources(); + + void writeToResources( const TitleDialogData& rInput ); + void readFromResources( TitleDialogData& rOutput ); + + void connect_changed( const Link<weld::Entry&,void>& rLink ); + bool get_value_changed_from_saved() const; + void save_value(); + +private: + std::unique_ptr<weld::Label> m_xFT_Main; + std::unique_ptr<weld::Label> m_xFT_Sub; + std::unique_ptr<weld::Entry> m_xEd_Main; + std::unique_ptr<weld::Entry> m_xEd_Sub; + + std::unique_ptr<weld::Label> m_xFT_XAxis; + std::unique_ptr<weld::Label> m_xFT_YAxis; + std::unique_ptr<weld::Label> m_xFT_ZAxis; + std::unique_ptr<weld::Entry> m_xEd_XAxis; + std::unique_ptr<weld::Entry> m_xEd_YAxis; + std::unique_ptr<weld::Entry> m_xEd_ZAxis; + + std::unique_ptr<weld::Label> m_xFT_SecondaryXAxis; + std::unique_ptr<weld::Label> m_xFT_SecondaryYAxis; + std::unique_ptr<weld::Entry> m_xEd_SecondaryXAxis; + std::unique_ptr<weld::Entry> m_xEd_SecondaryYAxis; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/inc/uiobject.hxx b/chart2/source/controller/inc/uiobject.hxx new file mode 100644 index 000000000..01dc8b500 --- /dev/null +++ b/chart2/source/controller/inc/uiobject.hxx @@ -0,0 +1,68 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include <memory> +#include <vcl/uitest/uiobject.hxx> + +#include "ChartWindow.hxx" + +class ChartUIObject : public UIObject +{ +public: + + ChartUIObject(const VclPtr<chart::ChartWindow>& xChartWindow, + const OUString& rCID); + + StringMap get_state() override; + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override; + + virtual std::set<OUString> get_children() const override; + + virtual OUString get_type() const override; + +private: + + OUString maCID; + VclPtr<chart::ChartWindow> mxChartWindow; + std::vector<std::unique_ptr<OUString>> maCommands; + + DECL_LINK(PostCommand, void*, void); +}; + +class ChartWindowUIObject : public WindowUIObject +{ + VclPtr<chart::ChartWindow> mxChartWindow; + +public: + + ChartWindowUIObject(const VclPtr<chart::ChartWindow>& xChartWindow); + + virtual StringMap get_state() override; + + virtual void execute(const OUString& rAction, + const StringMap& rParameters) override; + + virtual std::unique_ptr<UIObject> get_child(const OUString& rID) override; + + virtual std::set<OUString> get_children() const override; + + static std::unique_ptr<UIObject> create(vcl::Window* pWindow); + +protected: + + virtual OUString get_name() const override; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |