diff options
Diffstat (limited to 'reportdesign/source/ui/inc')
40 files changed, 4903 insertions, 0 deletions
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx new file mode 100644 index 000000000..db255fd4f --- /dev/null +++ b/reportdesign/source/ui/inc/AddField.hxx @@ -0,0 +1,116 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <comphelper/propmultiplex.hxx> +#include <comphelper/containermultiplexer.hxx> + +#include <svx/dataaccessdescriptor.hxx> +#include <svx/dbaexchange.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <vcl/weld.hxx> + +#include <rtl/ref.hxx> + +#include "ColumnInfo.hxx" + +namespace rptui +{ + +class OAddFieldWindow; + +class OAddFieldWindow : public weld::GenericDialogController + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + , public ::comphelper::OContainerListener +{ + css::uno::Reference< css::lang::XComponent> m_xHoldAlive; + css::uno::Reference< css::container::XNameAccess> m_xColumns; + css::uno::Reference< css::beans::XPropertySet > m_xRowSet; + + std::unique_ptr<weld::Toolbar> m_xActions; + std::unique_ptr<weld::TreeView> m_xListBox; + std::unique_ptr<weld::Label> m_xHelpText; + + Link<OAddFieldWindow&,void> m_aCreateLink; + OUString m_aCommandName; + OUString m_sFilter; + sal_Int32 m_nCommandType; + bool m_bEscapeProcessing; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener; + ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener; + ::rtl::Reference< svx::OMultiColumnTransferable > m_xHelper; + + std::vector<std::unique_ptr<ColumnInfo>> m_aListBoxData; + + DECL_LINK( OnDoubleClickHdl, weld::TreeView&, bool ); + DECL_LINK( OnSelectHdl, weld::TreeView&, void ); + DECL_LINK( DragBeginHdl, bool&, bool ); + DECL_LINK( OnSortAction, const OString&, void ); + DECL_LINK( FocusChangeHdl, weld::Widget&, void ); + + void addToList(const css::uno::Sequence<OUString>& rEntries); + void addToList(const css::uno::Reference<css::container::XNameAccess>& i_xColumns); + + OAddFieldWindow(const OAddFieldWindow&) = delete; + void operator =(const OAddFieldWindow&) = delete; +public: + OAddFieldWindow(weld::Window* pParent, + const css::uno::Reference< css::beans::XPropertySet >& xRowSet); + + virtual ~OAddFieldWindow() override; + + const OUString& GetCommand() const { return m_aCommandName; } + sal_Int32 GetCommandType() const { return m_nCommandType; } + void SetCreateHdl(const Link<OAddFieldWindow&,void>& _aCreateLink) { m_aCreateLink = _aCreateLink; } + + css::uno::Reference< css::sdbc::XConnection> getConnection() const; + + css::uno::Sequence< css::beans::PropertyValue > getSelectedFieldDescriptors(); + + /// Updates the current field list + void Update(); + + /** fills the descriptor with the column name, column object, command and command type + * + * \param rSelected the currently selected + * \param rDescriptor the descriptor will be filled + */ + void fillDescriptor(const weld::TreeIter& rSelected, svx::ODataAccessDescriptor& rDescriptor); + +private: + // FmXChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& evt) override; + // OContainerListener + virtual void _elementInserted( const css::container::ContainerEvent& _rEvent ) override; + virtual void _elementRemoved( const css::container::ContainerEvent& _rEvent ) override; + virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override; +}; + +} // rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ADDFIELD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ColorChanger.hxx b/reportdesign/source/ui/inc/ColorChanger.hxx new file mode 100644 index 000000000..bbed0a0c1 --- /dev/null +++ b/reportdesign/source/ui/inc/ColorChanger.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_REPORTDESIGN_SOURCE_UI_INC_COLORCHANGER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_COLORCHANGER_HXX + +#include <vcl/outdev.hxx> + +namespace rptui +{ + + //= ColorChanger + + class ColorChanger final + { + VclPtr<OutputDevice> m_pDev; + + public: + ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor ) + :m_pDev( _pDev ) + { + m_pDev->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR ); + m_pDev->SetLineColor( _rNewLineColor ); + m_pDev->SetFillColor( _rNewFillColor ); + } + + ~ColorChanger() + { + m_pDev->Pop(); + } + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_COLORCHANGER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ColorListener.hxx b/reportdesign/source/ui/inc/ColorListener.hxx new file mode 100644 index 000000000..0f8a89aca --- /dev/null +++ b/reportdesign/source/ui/inc/ColorListener.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_REPORTDESIGN_SOURCE_UI_INC_COLORLISTENER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_COLORLISTENER_HXX + +#include <vcl/window.hxx> +#include <svtools/colorcfg.hxx> +#include <svtools/extcolorcfg.hxx> +#include <tools/link.hxx> + +namespace rptui +{ + class OColorListener : public vcl::Window, public SfxListener + { + OColorListener(const OColorListener&) = delete; + void operator =(const OColorListener&) = delete; + protected: + Link<OColorListener&,void> m_aCollapsedLink; + svtools::ColorConfig m_aColorConfig; + svtools::ExtendedColorConfig m_aExtendedColorConfig; + OUString m_sColorEntry; + Color m_nColor; + Color m_nTextBoundaries; + bool m_bCollapsed; + bool m_bMarked; + + virtual void ImplInitSettings() = 0; + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + public: + OColorListener(vcl::Window* _pParent,const OUString& _sColorEntry); + virtual ~OColorListener() override; + virtual void dispose() override; + + // SfxListener + virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) override; + + /** set the marker as marked or not marked + @param _bMark set the new state of the marker + */ + void setMarked(bool _bMark); + + /** returns if the section is marked + */ + bool isMarked() const { return m_bMarked; } + + void setCollapsedHdl(const Link<OColorListener&,void>& _aLink ){ m_aCollapsedLink = _aLink; } + bool isCollapsed() const { return m_bCollapsed; } + + /** collapse or expand + * + * \param _bCollapsed + */ + virtual void setCollapsed(bool _bCollapsed); + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_COLORLISTENER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ColumnInfo.hxx b/reportdesign/source/ui/inc/ColumnInfo.hxx new file mode 100644 index 000000000..65062f9dc --- /dev/null +++ b/reportdesign/source/ui/inc/ColumnInfo.hxx @@ -0,0 +1,45 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_COLUMNINFO_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_COLUMNINFO_HXX + +#include <rtl/ustring.hxx> + +namespace rptui +{ + struct ColumnInfo + { + OUString sColumnName; + OUString sLabel; + ColumnInfo(const OUString& i_sColumnName,const OUString& i_sLabel) + : sColumnName(i_sColumnName) + , sLabel(i_sLabel) + { + } + ColumnInfo(const OUString& i_sColumnName) + : sColumnName(i_sColumnName) + { + } + }; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_COLUMNINFO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx new file mode 100644 index 000000000..9b648be10 --- /dev/null +++ b/reportdesign/source/ui/inc/CondFormat.hxx @@ -0,0 +1,152 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX + +#include <com/sun/star/report/XReportControlModel.hpp> +#include <vcl/weld.hxx> +#include <vector> + +namespace rptui +{ + + + constexpr size_t MAX_CONDITIONS = 3; + + class OReportController; + class Condition; + + + //= IConditionalFormatAction + + class SAL_NO_VTABLE IConditionalFormatAction + { + public: + virtual void addCondition( size_t _nAddAfterIndex ) = 0; + virtual void deleteCondition( size_t _nCondIndex ) = 0; + virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color& rColor ) = 0; + virtual void moveConditionUp( size_t _nCondIndex ) = 0; + virtual void moveConditionDown( size_t _nCondIndex ) = 0; + virtual OUString getDataField() const = 0; + + protected: + ~IConditionalFormatAction() {} + }; + + /************************************************************************* + |* + |* Conditional formatting dialog + |* + \************************************************************************/ + class ConditionalFormattingDialog : public weld::GenericDialogController + , public IConditionalFormatAction + { + typedef ::std::vector< std::unique_ptr<Condition> > Conditions; + + ::rptui::OReportController& m_rController; + css::uno::Reference< css::report::XReportControlModel > + m_xFormatConditions; + css::uno::Reference< css::report::XReportControlModel > + m_xCopy; + + bool m_bConstructed; + + std::unique_ptr<weld::ScrolledWindow> m_xScrollWindow; + std::unique_ptr<weld::Box> m_xConditionPlayground; + Conditions m_aConditions; + + public: + ConditionalFormattingDialog( + weld::Window* pParent, + const css::uno::Reference< css::report::XReportControlModel>& _xHoldAlive, + ::rptui::OReportController& _rController + ); + virtual ~ConditionalFormattingDialog() override; + // Dialog overridables + virtual short run() override; + + // IConditionalFormatAction overridables + virtual void addCondition( size_t _nAddAfterIndex ) override; + virtual void deleteCondition( size_t _nCondIndex ) override; + virtual void applyCommand( size_t _nCondIndex, sal_uInt16 _nCommandId, const ::Color& rColor ) override; + virtual void moveConditionUp( size_t _nCondIndex ) override; + virtual void moveConditionDown( size_t _nCondIndex ) override; + virtual OUString getDataField() const override; + + private: + DECL_LINK(OnScroll, weld::ScrolledWindow&, void); + + private: + /// returns the current number of conditions + size_t impl_getConditionCount() const { return m_aConditions.size(); } + + /** adds a condition + @param _nNewCondIndex + the index of the to-be-inserted condition + */ + void impl_addCondition_nothrow( size_t _nNewCondIndex ); + + /// deletes the condition with the given index + void impl_deleteCondition_nothrow( size_t _nCondIndex ); + + /// moves the condition with the given index one position + void impl_moveCondition_nothrow( size_t _nCondIndex, bool _bMoveUp ); + + /// does the dialog layouting + void impl_layoutAll(); + + /// called when the number of conditions has changed in any way + void impl_conditionCountChanged(); + + /// initializes the conditions from m_xCopy + void impl_initializeConditions(); + + /// tells all our Condition instances their new index + void impl_updateConditionIndicies(); + + /// returns the number of the condition which has the (child path) focus + size_t impl_getFocusedConditionIndex( sal_Int32 _nFallBackIfNone ) const; + + /// returns the index of the first visible condition + size_t impl_getFirstVisibleConditionIndex() const; + + /// returns the index of the last visible condition + size_t impl_getLastVisibleConditionIndex() const; + + /// focuses the condition with the given index, making it visible if necessary + void impl_focusCondition( size_t _nCondIndex ); + + /// scrolls the condition with the given index to the top position + void impl_scrollTo( size_t _nTopCondIndex ); + + /// ensures the condition with the given index is visible + void impl_ensureConditionVisible( size_t _nCondIndex ); + + /// set the preferred height of the action_area + void impl_setPrefHeight(bool bFirst); + }; + + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_CONDFORMAT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/DataProviderHandler.hxx b/reportdesign/source/ui/inc/DataProviderHandler.hxx new file mode 100644 index 000000000..657f900b7 --- /dev/null +++ b/reportdesign/source/ui/inc/DataProviderHandler.hxx @@ -0,0 +1,122 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_DATAPROVIDERHANDLER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DATAPROVIDERHANDLER_HXX + +#include <sal/config.h> + +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/data/XDatabaseDataProvider.hpp> +#include <com/sun/star/report/XReportComponent.hpp> +#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + + +namespace rptui +{ + + + class OPropertyInfoService; + + typedef ::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler + , css::lang::XServiceInfo> DataProviderHandler_Base; + + class DataProviderHandler: + private ::cppu::BaseMutex, + public DataProviderHandler_Base + { + public: + // XServiceInfo - static versions + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static( ); + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); + static css::uno::Reference< css::uno::XInterface > + create(const css::uno::Reference< css::uno::XComponentContext >&); + + explicit DataProviderHandler(css::uno::Reference< css::uno::XComponentContext > const & context); + private: + + // 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::lang::XComponent: + 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; + + // css::inspection::XPropertyHandler: + virtual void SAL_CALL inspect(const css::uno::Reference< css::uno::XInterface > & Component) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString & PropertyName) override; + virtual void SAL_CALL setPropertyValue(const OUString & PropertyName, const css::uno::Any & Value) override; + virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString & PropertyName) override; + virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString& PropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory >& ControlFactory ) override; + virtual css::uno::Any SAL_CALL convertToPropertyValue(const OUString & PropertyName, const css::uno::Any & ControlValue) override; + virtual css::uno::Any SAL_CALL convertToControlValue(const OUString & PropertyName, const css::uno::Any & PropertyValue, const css::uno::Type & ControlValueType) override; + virtual void SAL_CALL addPropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > & Listener) override; + virtual void SAL_CALL removePropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > & _rxListener) override; + virtual css::uno::Sequence< css::beans::Property > SAL_CALL getSupportedProperties() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override; + virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override; + virtual sal_Bool SAL_CALL isComposable(const OUString & PropertyName) override; + virtual css::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, css::uno::Any & out_Data, const css::uno::Reference< css::inspection::XObjectInspectorUI > & InspectorUI) override; + virtual void SAL_CALL actuatingPropertyChanged(const OUString & ActuatingPropertyName, const css::uno::Any & NewValue, const css::uno::Any & OldValue, const css::uno::Reference< css::inspection::XObjectInspectorUI > & InspectorUI, sal_Bool FirstTimeInit) override; + virtual sal_Bool SAL_CALL suspend(sal_Bool Suspend) override; + + protected: + virtual ~DataProviderHandler() override {} + private: + DataProviderHandler(DataProviderHandler const &) = delete; + void operator =(DataProviderHandler const &) = delete; + + + bool impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; + bool impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; + void impl_updateChartTitle_throw(const css::uno::Any& _aValue); + + // override WeakComponentImplHelperBase::disposing() + // This function is called upon disposing the component, + // if your component needs special work when it becomes + // disposed, do it here. + virtual void SAL_CALL disposing() override; + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee + css::uno::Reference< css::chart2::data::XDatabaseDataProvider> m_xDataProvider; /// inspectee + css::uno::Reference< css::uno::XInterface > m_xFormComponent; /// inspectee + css::uno::Reference< css::report::XReportComponent > m_xReportComponent; /// inspectee + css::uno::Reference< css::chart2::XChartDocument> m_xChartModel; + css::uno::Reference< css::beans::XPropertyChangeListener > m_xMasterDetails; + /// type converter, needed on various occasions + css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter; + }; + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DATAPROVIDERHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/DateTime.hxx b/reportdesign/source/ui/inc/DateTime.hxx new file mode 100644 index 000000000..0906c7906 --- /dev/null +++ b/reportdesign/source/ui/inc/DateTime.hxx @@ -0,0 +1,81 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_DATETIME_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DATETIME_HXX + +#include <vcl/weld.hxx> +#include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/util/XNumberFormats.hpp> +#include <com/sun/star/lang/Locale.hpp> + +namespace rptui +{ +class OReportController; +/************************************************************************* +|* +|* Groups and Sorting dialog +|* +\************************************************************************/ +class ODateTimeDialog : public weld::GenericDialogController +{ + ::rptui::OReportController* m_pController; + css::uno::Reference< css::report::XSection> + m_xHoldAlive; + css::lang::Locale m_nLocale; + + std::unique_ptr<weld::CheckButton> m_xDate; + std::unique_ptr<weld::Label> m_xFTDateFormat; + std::unique_ptr<weld::ComboBox> m_xDateListBox; + std::unique_ptr<weld::CheckButton> m_xTime; + std::unique_ptr<weld::Label> m_xFTTimeFormat; + std::unique_ptr<weld::ComboBox> m_xTimeListBox; + std::unique_ptr<weld::Button> m_xPB_OK; + + /** returns the format string + * + * \param _nNumberFormatKey the number format key + * \param _xFormats + * \param _bTime + * \return + */ + OUString getFormatStringByKey(::sal_Int32 _nNumberFormatKey,const css::uno::Reference< css::util::XNumberFormats>& _xFormats,bool _bTime); + + /** returns the number format key + @param _nNumberFormatIndex the number format index @see css::i18n::NumberFormatIndex + */ + sal_Int32 getFormatKey(bool _bDate) const; + + DECL_LINK(CBClickHdl, weld::ToggleButton&, void); + ODateTimeDialog(const ODateTimeDialog&) = delete; + void operator =(const ODateTimeDialog&) = delete; + + // fill methods + void InsertEntry(sal_Int16 _nNumberFormatId); +public: + ODateTimeDialog(weld::Window* pParent, + const css::uno::Reference< css::report::XSection>& _xHoldAlive, + ::rptui::OReportController* _pController); + virtual short run() override; +}; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DATETIME_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/DefaultInspection.hxx b/reportdesign/source/ui/inc/DefaultInspection.hxx new file mode 100644 index 000000000..e740112e5 --- /dev/null +++ b/reportdesign/source/ui/inc/DefaultInspection.hxx @@ -0,0 +1,97 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_DEFAULTINSPECTION_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DEFAULTINSPECTION_HXX + +#include <com/sun/star/inspection/XObjectInspectorModel.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <cppuhelper/implbase3.hxx> + + +namespace rptui +{ + + class OPropertyInfoService; + + //= DefaultComponentInspectorModel + + typedef ::cppu::WeakAggImplHelper3 < css::inspection::XObjectInspectorModel + , css::lang::XServiceInfo + , css::lang::XInitialization + > DefaultComponentInspectorModel_Base; + class DefaultComponentInspectorModel final : public DefaultComponentInspectorModel_Base + { + private: + ::osl::Mutex m_aMutex; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::inspection::XObjectInspectorModel > m_xComponent; /// delegatee + bool m_bConstructed; + bool m_bHasHelpSection; + bool m_bIsReadOnly; + sal_Int32 m_nMinHelpTextLines; + sal_Int32 m_nMaxHelpTextLines; + + DefaultComponentInspectorModel(const DefaultComponentInspectorModel&) = delete; + DefaultComponentInspectorModel& operator=(const DefaultComponentInspectorModel&) = delete; + + virtual ~DefaultComponentInspectorModel() 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; + + // XObjectInspectorModel + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getHandlerFactories() override; + virtual sal_Bool SAL_CALL getHasHelpSection() override; + virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() override; + virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() override; + virtual sal_Bool SAL_CALL getIsReadOnly() override; + virtual void SAL_CALL setIsReadOnly( sal_Bool _isreadonly ) override; + + virtual css::uno::Sequence< css::inspection::PropertyCategoryDescriptor > SAL_CALL describeCategories( ) override; + virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex( const OUString& PropertyName ) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // Service constructors + void createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ); + + public: + // XServiceInfo - static versions + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static( ); + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); + static css::uno::Reference< css::uno::XInterface > + create(const css::uno::Reference< css::uno::XComponentContext >&); + + DefaultComponentInspectorModel( const css::uno::Reference< css::uno::XComponentContext >& _rxContext); + }; + + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DEFAULTINSPECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx new file mode 100644 index 000000000..60ee506da --- /dev/null +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -0,0 +1,257 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX + +#include <dbaccess/dataview.hxx> +#include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/report/XReportComponent.hpp> +#include <tools/link.hxx> +#include <tools/gen.hxx> +#include <vcl/timer.hxx> +#include <vcl/idle.hxx> +#include <svl/SfxBroadcaster.hxx> +#include "ReportDefines.hxx" +#include <vcl/splitwin.hxx> +#include "MarkedSection.hxx" +#include "ScrollHelper.hxx" + +class KeyEvent; +class MouseEvent; +class Timer; +namespace vcl { class Window; } + +namespace rptui +{ + class OSectionView; + class OReportController; + class PropBrw; + class OAddFieldWindow; + class ONavigator; + + + class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection + { + private: + VclPtr<SplitWindow> m_aSplitWin; + + css::uno::Reference< css::uno::XInterface> m_xReportComponent; + OReportController& m_rReportController; + VclPtr<OScrollWindowHelper> m_aScrollWindow; + VclPtr<vcl::Window> m_pTaskPane; + VclPtr<PropBrw> m_pPropWin; + std::shared_ptr<OAddFieldWindow> m_xAddField; + OSectionView* m_pCurrentView; + std::shared_ptr<ONavigator> m_xReportExplorer; + Idle m_aMarkIdle; + DlgEdMode m_eMode; + sal_uInt16 m_eActObj; + Size m_aGridSizeCoarse; + Size m_aGridSizeFine; + bool m_bDeleted; + + + DECL_LINK(MarkTimeout, Timer *, void); + DECL_LINK( SplitHdl, SplitWindow*, void ); + + void ImplInitSettings(); + + ODesignView(ODesignView const &) = delete; + void operator =(ODesignView const &) = delete; + protected: + // return the Rectangle where I can paint myself + virtual void resizeDocumentView(tools::Rectangle& rRect) override; + // return the Rectangle where I can paint myself + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + + public: + ODesignView(vcl::Window* pParent, + const css::uno::Reference< css::uno::XComponentContext >&, + OReportController& _rController); + virtual ~ODesignView() override; + virtual void dispose() override; + + // Window overrides + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + virtual void GetFocus() override; + + virtual void initialize() override; + + OReportController& getController() const { return m_rReportController; } + + void SetMode( DlgEdMode m_eMode ); + void SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType = OUString()); + sal_uInt16 GetInsertObj() const { return m_eActObj;} + OUString const & GetInsertObjString() const; + DlgEdMode GetMode() const { return m_eMode; } + + /** cuts the current selection in this section + */ + void Cut(); + + /** copies the current selection in this section + */ + void Copy(); + + /** returns if paste is allowed + * + * \return <TRUE/> if paste is allowed + */ + bool IsPasteAllowed() const; + + /** paste a new control in this section + */ + void Paste(); + + /** Deletes the current selection in this section + * + */ + void Delete(); + + /** align all marked objects in all sections + */ + void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection); + + /** All objects will be marked. + */ + void SelectAll(const sal_uInt16 _nObjectType); + + /// checks if a selection exists + bool HasSelection() const; + + void UpdatePropertyBrowserDelayed(OSectionView& _rView); + + sal_uInt16 getSectionCount() const; + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(sal_uInt16 _nPosition); + + /** adds a new section at position _nPosition. + If the section is <NULL/> nothing happens. + If the position is grater than the current elements, the section will be appended. + */ + void addSection(const css::uno::Reference< css::report::XSection >& _xSection + ,const OUString& _sColorEntry + ,sal_uInt16 _nPosition = USHRT_MAX); + + const Size& getGridSizeCoarse() const { return m_aGridSizeCoarse; } + const Size& getGridSizeFine() const { return m_aGridSizeFine; } + void setGridSnap(bool bOn); + void setDragStripes(bool bOn); + /** turns the grid on or off + * + * \param _bGridVisible + */ + void toggleGrid(bool _bGridVisible); + + void togglePropertyBrowser(bool _bToggleOn); + + bool isAddFieldVisible() const; + void toggleAddField(); + + bool isReportExplorerVisible() const; + void toggleReportExplorer(); + + /** shows or hides the ruler. + */ + void showRuler(bool _bShow); + + /** unmark all objects on the views. + */ + void unmarkAllObjects(); + + /** triggers the property browser with the section + @param _xReportComponent the report component + */ + void showProperties( const css::uno::Reference< css::uno::XInterface>& _xReportComponent); + css::uno::Any getCurrentlyShownProperty() const; + + /** returns the current section or the detail section if no section was selected previously + */ + css::uno::Reference< css::report::XSection > getCurrentSection() const; + + /** returns the current control report model or <NULL/> + */ + css::uno::Reference< css::report::XReportComponent > getCurrentControlModel() const; + + // IMarkedSection + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const override; + OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const; + virtual void markSection(const sal_uInt16 _nPos) override; + + /** fills the positions of all collapsed sections. + * + * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections. + */ + void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const; + + /** collapse all sections given by their position + * + * \param _aCollapsedSections The position of the sections which should be collapsed. + */ + void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections); + + OUString getCurrentPage() const; + void setCurrentPage(const OUString& _sLastActivePage); + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + bool handleKeyEvent(const KeyEvent& _rEvent); + + /** set the section as marked or not marked + @param _pSectionView the section where to set the marked flag + @param _bMark the marked flag + */ + void setMarked(const css::uno::Reference< css::report::XSection>& _xSection,bool _bMark); + void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape,bool _bMark); + + /** returns if the view handles the event by itself + * + * \return <FALSE/> is the event is not handled by the view otherwise <TRUE/> + */ + bool isHandleEvent() const; + + sal_uInt32 getMarkedObjectCount() const; + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + + /** fills the vector with all selected control models + /param _rSelection The vector will be filled and will not be cleared before. + */ + void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const; + + /** calculates the zoom factor. + @param _eType which kind of zoom is needed + */ + sal_uInt16 getZoomFactor(SvxZoomType _eType) const; + }; + +} //rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/EndMarker.hxx b/reportdesign/source/ui/inc/EndMarker.hxx new file mode 100644 index 000000000..a48eb8106 --- /dev/null +++ b/reportdesign/source/ui/inc/EndMarker.hxx @@ -0,0 +1,46 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_ENDMARKER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ENDMARKER_HXX + +#include "ColorListener.hxx" + +namespace rptui +{ + /** \class OEndMarker + * \brief Defines the right side of a graphical section. + */ + class OEndMarker : public OColorListener + { + OEndMarker(OEndMarker const &) = delete; + void operator =(OEndMarker const &) = delete; + protected: + virtual void ImplInitSettings() override; + public: + OEndMarker(vcl::Window* _pParent,const OUString& _sColorEntry); + virtual ~OEndMarker() override; + + // windows + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_ENDMARKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/FixedTextColor.hxx b/reportdesign/source/ui/inc/FixedTextColor.hxx new file mode 100644 index 000000000..fa76a52df --- /dev/null +++ b/reportdesign/source/ui/inc/FixedTextColor.hxx @@ -0,0 +1,61 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_FIXEDTEXTCOLOR_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FIXEDTEXTCOLOR_HXX + +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/report/XFixedText.hpp> +#include <tools/color.hxx> + +#include "IReportControllerObserver.hxx" + +namespace rptui +{ + class OReportController; + + class FixedTextColor : public IReportControllerObserver + { + const OReportController& m_rReportController; + + /// @throws css::uno::RuntimeException + css::uno::Reference< css::awt::XVclWindowPeer > getVclWindowPeer(const css::uno::Reference< css::report::XFixedText >& _xComponent); + /// @throws css::uno::RuntimeException + css::uno::Reference< css::awt::XControl > getXControl(const css::uno::Reference< css::report::XFixedText >& _xFixedText); + + static void setPropertyTextColor(const css::uno::Reference< css::awt::XVclWindowPeer >& _xVclWindowPeer, Color _nFormatKey); + + public: + FixedTextColor(const OReportController & _aObserver); + virtual ~FixedTextColor() override; + + void notifyPropertyChange( const css::beans::PropertyChangeEvent& _rEvent ) override; + void notifyElementInserted( const css::uno::Reference< css::uno::XInterface >& _rxElement ) override; + void handle( const css::uno::Reference< css::uno::XInterface >& _rxElement ) override; + + }; + +} // namespace rptui + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx new file mode 100644 index 000000000..455dfd396 --- /dev/null +++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx @@ -0,0 +1,61 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_FORMATTEDFIELDBEAUTIFIER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMATTEDFIELDBEAUTIFIER_HXX + +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/report/XReportComponent.hpp> +#include <tools/color.hxx> + +#include "IReportControllerObserver.hxx" + +namespace rptui +{ + class OReportController; + + class FormattedFieldBeautifier : public IReportControllerObserver + { + const OReportController& m_rReportController; + Color m_nTextColor; + + /// @throws css::uno::RuntimeException + css::uno::Reference< css::awt::XVclWindowPeer > getVclWindowPeer(const css::uno::Reference< css::report::XReportComponent >& _xComponent); + + void setPlaceholderText( const css::uno::Reference< css::uno::XInterface >& _rxComponent ); + void setPlaceholderText( const css::uno::Reference< css::awt::XVclWindowPeer >& _xVclWindowPeer, const OUString& _rText ); + + Color getTextColor(); + + public: + FormattedFieldBeautifier(const OReportController & _aObserver); + virtual ~FormattedFieldBeautifier() override; + + void notifyPropertyChange( const css::beans::PropertyChangeEvent& _rEvent ) override; + void notifyElementInserted( const css::uno::Reference< css::uno::XInterface >& _rxElement ) override; + void handle( const css::uno::Reference< css::uno::XInterface >& _rxElement ) override; + }; + +} // namespace rptui + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx new file mode 100644 index 000000000..8ec93075b --- /dev/null +++ b/reportdesign/source/ui/inc/Formula.hxx @@ -0,0 +1,112 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX + +#include <formula/formula.hxx> +#include <formula/IControlReferenceHandler.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/report/meta/XFormulaParser.hpp> +#include <memory> + +namespace com::sun::star::lang { + class XMultiServiceFactory; +} + +namespace svl { + +class SharedStringPool; + +} + +namespace rptui +{ + +class OAddFieldWindow; + + +class FormulaDialog : public formula::FormulaModalDialog, + public formula::IControlReferenceHandler +{ + std::shared_ptr<formula::IFunctionManager> m_aFunctionManager; + std::unique_ptr<formula::FormEditData> m_xFormulaData; + std::shared_ptr<OAddFieldWindow> m_xAddField; + css::uno::Reference < css::beans::XPropertySet > m_xRowSet; + css::uno::Reference< css::report::meta::XFormulaParser> m_xParser; + css::uno::Reference< css::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper; + formula::RefEdit* m_pEdit; + OUString m_sFormula; + sal_Int32 m_nStart; + sal_Int32 m_nEnd; + + svl::SharedStringPool& mrStringPool; + + DECL_LINK( OnClickHdl, OAddFieldWindow&, void ); +public: + FormulaDialog( weld::Window* pParent + , const css::uno::Reference< css::lang::XMultiServiceFactory>& _xServiceFactory + , const std::shared_ptr< formula::IFunctionManager >& _pFunctionMgr + , const OUString& _sFormula + , const css::uno::Reference < css::beans::XPropertySet >& _xRowSet + , svl::SharedStringPool& rStrPool ); + + virtual ~FormulaDialog() override; + + // IFormulaEditorHelper + virtual void notifyChange() override; + virtual void fill() override; + virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) override; + virtual std::shared_ptr<formula::FormulaCompiler> getCompiler() const override; + virtual std::unique_ptr<formula::FormulaCompiler> createCompiler( formula::FormulaTokenArray& rArray ) const override; + virtual void doClose(bool _bOk) override; + virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc) override; + virtual void showReference(const OUString& _sFormula) override; + virtual void dispatch(bool _bOK, bool _bMatrixChecked) override; + virtual void setDispatcherLock( bool bLock ) override; + virtual void deleteFormData() override; + virtual void clear() override; + virtual void switchBack() override; + virtual formula::FormEditData* getFormEditData() const override; + virtual void setCurrentFormula(const OUString& _sReplacement) override; + virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) override; + virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const override; + virtual OUString getCurrentFormula() const override; + + virtual formula::IFunctionManager* getFunctionManager() override; + virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const override; + virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const override; + virtual css::table::CellAddress getReferencePosition() const override; + + virtual ::std::unique_ptr<formula::FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) override; + + // IControlReferenceHandler + virtual void ShowReference(const OUString& _sRef) override; + virtual void HideReference( bool bDoneRefMode = true ) override; + virtual void ReleaseFocus( formula::RefEdit* pEdit ) override; + virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton ) override; +}; + + +} // rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FORMULA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/FunctionHelper.hxx b/reportdesign/source/ui/inc/FunctionHelper.hxx new file mode 100644 index 000000000..8eea9632b --- /dev/null +++ b/reportdesign/source/ui/inc/FunctionHelper.hxx @@ -0,0 +1,105 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_FUNCTIONHELPER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FUNCTIONHELPER_HXX + +#include <formula/IFunctionDescription.hxx> +#include <com/sun/star/report/meta/XFunctionManager.hpp> +#include <com/sun/star/report/meta/XFunctionCategory.hpp> +#include <com/sun/star/report/meta/XFunctionDescription.hpp> +#include <map> +#include <memory> +#include <vector> + +namespace rptui +{ + +class FunctionCategory; +class FunctionDescription; + +class FunctionManager : public formula::IFunctionManager +{ + typedef std::map< OUString, std::shared_ptr< FunctionDescription > > TFunctionsMap; + typedef std::map< OUString, std::shared_ptr< FunctionCategory > > TCategoriesMap; + css::uno::Reference< css::report::meta::XFunctionManager> m_xMgr; + mutable TCategoriesMap m_aCategories; + mutable ::std::vector< TCategoriesMap::iterator > m_aCategoryIndex; + mutable TFunctionsMap m_aFunctions; +public: + FunctionManager(const css::uno::Reference< css::report::meta::XFunctionManager>& _xMgr); + virtual ~FunctionManager(); + virtual sal_uInt32 getCount() const override; + virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const override; + virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const override; + virtual sal_Unicode getSingleToken(const EToken _eToken) const override; + + std::shared_ptr< FunctionDescription > get(const css::uno::Reference< css::report::meta::XFunctionDescription>& _xFunctionDescription) const; +}; + +class FunctionDescription : public formula::IFunctionDescription +{ + css::uno::Sequence< css::sheet::FunctionArgument > m_aParameter; + css::uno::Reference< css::report::meta::XFunctionDescription> m_xFunctionDescription; + const formula::IFunctionCategory* m_pFunctionCategory; +public: + FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const css::uno::Reference< css::report::meta::XFunctionDescription>& _xFunctionDescription); + virtual ~FunctionDescription(){} + + virtual OUString getFunctionName() const override ; + virtual const formula::IFunctionCategory* getCategory() const override ; + virtual OUString getDescription() const override ; + virtual sal_Int32 getSuppressedArgumentCount() const override ; + virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const override ; + virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const override ; + virtual void initArgumentInfo() const override; + virtual OUString getSignature() const override ; + virtual OString getHelpId() const override ; + virtual bool isHidden() const override; + virtual sal_uInt32 getParameterCount() const override ; + virtual sal_uInt32 getVarArgsStart() const override; + virtual sal_uInt32 getVarArgsLimit() const override; + virtual OUString getParameterName(sal_uInt32 _nPos) const override ; + virtual OUString getParameterDescription(sal_uInt32 _nPos) const override ; + virtual bool isParameterOptional(sal_uInt32 _nPos) const override ; +}; + +class FunctionCategory : public formula::IFunctionCategory +{ + mutable ::std::vector< std::shared_ptr< FunctionDescription > > m_aFunctions; + css::uno::Reference< css::report::meta::XFunctionCategory> m_xCategory; + sal_uInt32 m_nFunctionCount; + sal_uInt32 m_nNumber; + const FunctionManager* m_pFunctionManager; +public: + FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const css::uno::Reference< css::report::meta::XFunctionCategory>& _xCategory); + virtual ~FunctionCategory() {} + + virtual sal_uInt32 getCount() const override; + virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const override; + virtual sal_uInt32 getNumber() const override; + virtual OUString getName() const override; +}; + +} // rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FUNCTIONHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/GeometryHandler.hxx b/reportdesign/source/ui/inc/GeometryHandler.hxx new file mode 100644 index 000000000..d4520e210 --- /dev/null +++ b/reportdesign/source/ui/inc/GeometryHandler.hxx @@ -0,0 +1,315 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_GEOMETRYHANDLER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GEOMETRYHANDLER_HXX + +#include <sal/config.h> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <com/sun/star/script/XTypeConverter.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/report/XFunctionsSupplier.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <map> +#include <memory> +#include <comphelper/stl_types.hxx> +#include <comphelper/listenernotification.hxx> + + +namespace rptui +{ + + + struct DefaultFunction + { + css::beans::Optional< OUString> m_sInitialFormula; + OUString m_sName; + OUString m_sSearchString; + OUString m_sFormula; + bool m_bPreEvaluated; + + const OUString& getName() const { return m_sName; } + } ; + + class OPropertyInfoService; + typedef ::std::pair< css::uno::Reference< css::report::XFunction>, css::uno::Reference< css::report::XFunctionsSupplier> > TFunctionPair; + typedef ::std::multimap< OUString,TFunctionPair, ::comphelper::UStringMixLess > TFunctions; + typedef ::comphelper::OSimpleListenerContainer < css::beans::XPropertyChangeListener + , css::beans::PropertyChangeEvent + > PropertyChangeListeners; + typedef ::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler + , css::beans::XPropertyChangeListener + , css::lang::XServiceInfo> GeometryHandler_Base; + + class GeometryHandler: + private ::cppu::BaseMutex, + public GeometryHandler_Base + { + /** sets the counter function at the data field. + * If the counter function doesn't exist it will be created. + */ + void impl_setCounterFunction_throw(); + + /** executes a dialog for choosing a filter criterion for a database report + @param _out_rSelectedClause + the filter or order clause as chosen by the user + @precond + we're really inspecting a database form (well, a RowSet at least) + @return + <TRUE/> if and only if the user successfully chose a clause + */ + bool impl_dialogFilter_nothrow( OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; + + /** returns the data field type depending on the data field of the report control + * + * \param _sDataField if the data field is not empty it will be used as data field, otherwise the data field will be used. + * \return the data field type + */ + sal_uInt32 impl_getDataFieldType_throw(const OUString& _sDataField = OUString()) const; + + css::uno::Any getConstantValue(bool bToControlValue,const char** pResId,const css::uno::Any& _aValue,const OUString& _sConstantName,const OUString & PropertyName ); + css::beans::Property getProperty(const OUString & PropertyName); + static void implCreateListLikeControl( + const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory + ,css::inspection::LineDescriptor & out_Descriptor + ,const char** pResId + ,bool _bReadOnlyControl + ,bool _bTrueIfListBoxFalseIfComboBox + ); + static void implCreateListLikeControl( + const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory + ,css::inspection::LineDescriptor & out_Descriptor + ,const ::std::vector< OUString>& _aEntries + ,bool _bReadOnlyControl + ,bool _bTrueIfListBoxFalseIfComboBox + ); + void checkPosAndSize( const css::awt::Point& _aNewPos, + const css::awt::Size& _aSize); + + OUString impl_convertToFormula( const css::uno::Any& _rControlValue ); + + void impl_initFieldList_nothrow( css::uno::Sequence< OUString >& _rFieldNames ) const; + + /** Creates the function defined by the function template + * + * \param _sFunctionName the function name + * \param _sDataField the data field + * \param _aFunction the function template + */ + void impl_createFunction(const OUString& _sFunctionName,const OUString& _sDataField,const DefaultFunction& _aFunction); + + /** check whether the given function name is a counter function. + * + * \param _sQuotedFunctionName the quoted function name to check + * \param Out_sScope the scope of the function + * \return When true it is a counter functions otherwise false. + */ + bool impl_isCounterFunction_throw(const OUString& _sQuotedFunctionName,OUString& Out_sScope) const; + + /** clear the own properties like function and scope and send a notification + * + * \param _aGuard + * \param _sOldFunctionName + * \param _sOldScope + * \param _nOldDataFieldType + */ + void resetOwnProperties(::osl::ResettableMutexGuard& _aGuard,const OUString& _sOldFunctionName,const OUString& _sOldScope,const sal_uInt32 _nOldDataFieldType); + + /** checks whether the name is a field or a parameter + * + * \param _sName the name to check + * \return true when it is a field or parameter otherwise false + */ + bool impl_isDataField(const OUString& _sName) const; + + /**return all formula in a semicolon separated list + * + * \param _rList the localized function names + */ + void impl_fillFormulaList_nothrow(::std::vector< OUString >& _out_rList) const; + + /** return all group names in a semicolon separated list starting with the group where this control is contained in. + * + * \param _rList fills the list with all scope names. + */ + void impl_fillScopeList_nothrow(::std::vector< OUString >& _out_rList) const; + + /** return all supported output formats of the report definition + * + * \param _rList fills the list with all mime types + */ + void impl_fillMimeTypes_nothrow(::std::vector< OUString >& _out_rList) const; + + /** return the one supported output formats of the report definition + * + * \param _sMimetype the mimetype + */ + OUString impl_ConvertMimeTypeToUI_nothrow(const OUString& _sMimetype) const; + + /** return the MimeType for the given UI Name + * + * \param _sUIName the doc ui name + */ + OUString impl_ConvertUIToMimeType_nothrow(const OUString& _sUIName) const; + + /** get the functions supplier for the set scope, default is the surrounding group. + * + * \param _rsNamePostfix the name postfix which can be used when the scope as name part is needed + * \return the function supplier + */ + css::uno::Reference< css::report::XFunctionsSupplier> fillScope_throw(OUString& _rsNamePostfix); + + /** checks if the given function is a default function we know. + * + * \param _sQuotedFunction the quoted function name + * \param Out_rDataField the data field which is used in the function + * \param _xFunctionsSupplier the function supplier to search or empty if not used + * \param _bSet If set to sal_True than the m_sDefaultFunction and m_sScope vars will be set if successful. + * \return sal_True with known otherwise sal_False + */ + bool isDefaultFunction(const OUString& _sQuotedFunction + ,OUString& Out_rDataField + ,const css::uno::Reference< css::report::XFunctionsSupplier>& _xFunctionsSupplier = css::uno::Reference< css::report::XFunctionsSupplier>() + ,bool _bSet = false) const; + + /** checks if the given function is a default function we know. + * + * \param _xFunction + * \param _rDataField + * \param _rsDefaultFunctionName + * \return + */ + bool impl_isDefaultFunction_nothrow( const css::uno::Reference< css::report::XFunction>& _xFunction + ,OUString& _rDataField + ,OUString& _rsDefaultFunctionName) const; + + /** fills the member m_aDefaultFunctions + * + */ + void loadDefaultFunctions(); + + /** creates a default function of the _sFunction for the data field _sDataField + * The new function will only be created if it didn't exist. + * + * \param _aGuard Will be cleared, when a new function was created. + * \param _sFunction The name of the function. + * \param _sDataField The name of the data field. + */ + void createDefaultFunction(::osl::ResettableMutexGuard& _aGuard ,const OUString& _sFunction,const OUString& _sDataField); + + void removeFunction(); + + class OBlocker + { + bool& m_bIn; + public: + OBlocker(bool& _bIn) : m_bIn(_bIn){ m_bIn = true; } + ~OBlocker() { m_bIn = false; } + }; + + + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override; + + public: + // XServiceInfo - static versions + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static( ); + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); + static css::uno::Reference< css::uno::XInterface > + create(const css::uno::Reference< css::uno::XComponentContext >&); + + public: + explicit GeometryHandler(css::uno::Reference< css::uno::XComponentContext > const & context); + + // 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::lang::XComponent: + 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; + + // css::inspection::XPropertyHandler: + virtual void SAL_CALL inspect(const css::uno::Reference< css::uno::XInterface > & Component) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString & PropertyName) override; + virtual void SAL_CALL setPropertyValue(const OUString & PropertyName, const css::uno::Any & Value) override; + virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString & PropertyName) override; + virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString& PropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory >& ControlFactory ) override; + virtual css::uno::Any SAL_CALL convertToPropertyValue(const OUString & PropertyName, const css::uno::Any & ControlValue) override; + virtual css::uno::Any SAL_CALL convertToControlValue(const OUString & PropertyName, const css::uno::Any & PropertyValue, const css::uno::Type & ControlValueType) override; + virtual void SAL_CALL addPropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > & Listener) override; + virtual void SAL_CALL removePropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > & _rxListener) override; + virtual css::uno::Sequence< css::beans::Property > SAL_CALL getSupportedProperties() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override; + virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override; + virtual sal_Bool SAL_CALL isComposable(const OUString & PropertyName) override; + virtual css::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, css::uno::Any & out_Data, const css::uno::Reference< css::inspection::XObjectInspectorUI > & InspectorUI) override; + virtual void SAL_CALL actuatingPropertyChanged(const OUString & ActuatingPropertyName, const css::uno::Any & NewValue, const css::uno::Any & OldValue, const css::uno::Reference< css::inspection::XObjectInspectorUI > & InspectorUI, sal_Bool FirstTimeInit) override; + virtual sal_Bool SAL_CALL suspend(sal_Bool Suspend) override; + + protected: + virtual ~GeometryHandler() override; + private: + GeometryHandler(GeometryHandler const &) = delete; + void operator =(GeometryHandler const &) = delete; + + // override WeakComponentImplHelperBase::disposing() + // This function is called upon disposing the component, + // if your component needs special work when it becomes + // disposed, do it here. + virtual void SAL_CALL disposing() override; + + PropertyChangeListeners m_aPropertyListeners; + css::uno::Sequence< OUString > m_aFieldNames; + css::uno::Sequence< OUString > m_aParamNames; + TFunctions m_aFunctionNames; + ::std::vector< DefaultFunction > m_aDefaultFunctions; + DefaultFunction m_aCounterFunction; + css::uno::Reference< css::uno::XComponentContext > m_xContext; + mutable css::uno::Reference< css::report::XFunction> m_xFunction; + css::uno::Reference< css::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee + css::uno::Reference< css::beans::XPropertySet > m_xReportComponent; /// inspectee + mutable css::uno::Reference< css::sdbc::XRowSet > m_xRowSet; + /// type converter, needed on various occasions + css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter; + mutable OUString m_sDefaultFunction; + mutable OUString m_sScope; + sal_uInt32 m_nDataFieldType; + mutable bool m_bNewFunction; + bool m_bIn; + }; + +} // namespace rptui + + +#endif // RPT_GeometryHandler_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx new file mode 100644 index 000000000..cd038e616 --- /dev/null +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -0,0 +1,146 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX + +#include <com/sun/star/report/XGroups.hpp> +#include <com/sun/star/report/XGroup.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <comphelper/propmultiplex.hxx> +#include <cppuhelper/basemutex.hxx> +#include <rtl/ref.hxx> +#include <vcl/weld.hxx> +#include <osl/diagnose.h> + +class Control; + +namespace comphelper +{ + class OPropertyChangeMultiplexer; +} +namespace rptui +{ +class OFieldExpressionControl; +class OReportController; +/************************************************************************* +|* +|* Groups and Sorting dialog +|* +\************************************************************************/ + +class OGroupsSortingDialog : public weld::GenericDialogController + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener +{ + friend class OFieldExpressionControl; + + ::rptui::OReportController* m_pController; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; + css::uno::Reference< css::report::XGroups> m_xGroups; + css::uno::Reference< css::container::XNameAccess > m_xColumns; + bool m_bReadOnly; + + std::unique_ptr<weld::Toolbar> m_xToolBox; + std::unique_ptr<weld::Widget> m_xProperties; + std::unique_ptr<weld::ComboBox> m_xOrderLst; + std::unique_ptr<weld::ComboBox> m_xHeaderLst; + std::unique_ptr<weld::ComboBox> m_xFooterLst; + std::unique_ptr<weld::ComboBox> m_xGroupOnLst; + std::unique_ptr<weld::SpinButton> m_xGroupIntervalEd; + std::unique_ptr<weld::ComboBox> m_xKeepTogetherLst; + std::unique_ptr<weld::Label> m_xHelpWindow; + std::unique_ptr<weld::Container> m_xBox; + css::uno::Reference<css::awt::XWindow> m_xTableCtrlParent; + VclPtr<OFieldExpressionControl> m_xFieldExpression; + +private: + DECL_LINK( OnWidgetFocusLost, weld::Widget&, void ); + DECL_LINK( OnWidgetFocusGot, weld::Widget&, void ); + + DECL_LINK( OnControlFocusGot, weld::Widget&, void ); + + DECL_LINK( LBChangeHdl, weld::ComboBox&, void ); + DECL_LINK( OnFormatAction, const OString&, void ); + + /** returns the groups + @return the groups which now have to check which one changes + */ + css::uno::Reference< css::report::XGroups>& getGroups() { return m_xGroups; } + + css::uno::Reference< css::report::XGroup> getGroup(sal_Int32 _nPos) + { + OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!"); + return css::uno::Reference< css::report::XGroup>(m_xGroups->getByIndex(_nPos),css::uno::UNO_QUERY); + } + + /** updates the listboxes with the new group properties + @param _nRow the new group pos + */ + void DisplayData( sal_Int32 _nRow ); + + /** saves the values from the listboxes into the group at position _nRow + @param _nRow the group pos to store in + */ + void SaveData( sal_Int32 _nRow ); + + /** returns <TRUE/> when the dialog should be read only + */ + bool isReadOnly( ) const { return m_bReadOnly;} + + /** returns the data type for the given column name + @param _sColumnName + */ + sal_Int32 getColumnDataType(const OUString& _sColumnName); + + /** display the group props + @param _xGroup the group to display + */ + void displayGroup(const css::uno::Reference< css::report::XGroup>& _xGroup); + + /** enables or disables the up and down button + @param _nRow the row which will be active + */ + void checkButtons(sal_Int32 _nRow); + + /** clears the m_xColumns member and reset the fields + * + */ + void fillColumns(); + OGroupsSortingDialog(OGroupsSortingDialog const &) = delete; + void operator =(OGroupsSortingDialog const &) = delete; +protected: + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override; +public: + OGroupsSortingDialog(weld::Window* pParent, + bool _bReadOnly, + ::rptui::OReportController* _pController); + virtual ~OGroupsSortingDialog() override; + + /* updates the current view + */ + void UpdateData( ); +}; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_GROUPSSORTING_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/IReportControllerObserver.hxx b/reportdesign/source/ui/inc/IReportControllerObserver.hxx new file mode 100644 index 000000000..3d9f7e75c --- /dev/null +++ b/reportdesign/source/ui/inc/IReportControllerObserver.hxx @@ -0,0 +1,45 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_IREPORTCONTROLLEROBSERVER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_IREPORTCONTROLLEROBSERVER_HXX + +#include <com/sun/star/beans/PropertyChangeEvent.hpp> + +namespace rptui +{ + /* abstract */ class IReportControllerObserver + { + protected: + // IReportControllerObserver(){} + virtual ~IReportControllerObserver() {} + + public: + + virtual void notifyPropertyChange( const css::beans::PropertyChangeEvent& _rEvent ) = 0; + virtual void notifyElementInserted( const css::uno::Reference< css::uno::XInterface >& _rxElement ) = 0; + virtual void handle( const css::uno::Reference< css::uno::XInterface >& _rxElement ) = 0; + }; + +} // namespace rptui + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/MarkedSection.hxx b/reportdesign/source/ui/inc/MarkedSection.hxx new file mode 100644 index 000000000..2d97645c4 --- /dev/null +++ b/reportdesign/source/ui/inc/MarkedSection.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_REPORTDESIGN_SOURCE_UI_INC_MARKEDSECTION_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_MARKEDSECTION_HXX + +#include <sal/types.h> + +namespace rptui +{ + class OSectionWindow; + + enum NearSectionAccess + { + CURRENT = 0, + PREVIOUS = -1, + POST = 1 + }; + + class IMarkedSection + { + public: + /** returns the section which is currently marked. + */ + virtual OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const =0; + + /** mark the section on the given position . + * + * \param _nPos the position is zero based. + */ + virtual void markSection(const sal_uInt16 _nPos) = 0; + + protected: + ~IMarkedSection() {} + }; + +} // rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_MARKEDSECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/Navigator.hxx b/reportdesign/source/ui/inc/Navigator.hxx new file mode 100644 index 000000000..5c28d2401 --- /dev/null +++ b/reportdesign/source/ui/inc/Navigator.hxx @@ -0,0 +1,45 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_NAVIGATOR_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_NAVIGATOR_HXX + +#include <vcl/weld.hxx> +#include <memory> +namespace rptui +{ + class OReportController; + class ONavigatorImpl; + class ONavigator : public weld::GenericDialogController + { + ::std::unique_ptr<ONavigatorImpl> m_pImpl; + ONavigator(const ONavigator&) = delete; + void operator =(const ONavigator&) = delete; + + DECL_LINK(FocusChangeHdl, weld::Widget&, void); + + public: + ONavigator(weld::Window* pParent, OReportController& rController); + ~ONavigator(); + }; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_NAVIGATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/PageNumber.hxx b/reportdesign/source/ui/inc/PageNumber.hxx new file mode 100644 index 000000000..eefa10c8b --- /dev/null +++ b/reportdesign/source/ui/inc/PageNumber.hxx @@ -0,0 +1,59 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_PAGENUMBER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_PAGENUMBER_HXX + +#include <vcl/weld.hxx> +#include <com/sun/star/report/XReportDefinition.hpp> + +namespace rptui +{ +class OReportController; +/************************************************************************* +|* +|* Groups and Sorting dialog +|* +\************************************************************************/ +class OPageNumberDialog : public weld::GenericDialogController +{ + ::rptui::OReportController* m_pController; + css::uno::Reference< css::report::XReportDefinition> + m_xHoldAlive; + std::unique_ptr<weld::RadioButton> m_xPageN; + std::unique_ptr<weld::RadioButton> m_xPageNofM; + std::unique_ptr<weld::RadioButton> m_xTopPage; + std::unique_ptr<weld::RadioButton> m_xBottomPage; + std::unique_ptr<weld::ComboBox> m_xAlignmentLst; + std::unique_ptr<weld::CheckButton> m_xShowNumberOnFirstPage; + + OPageNumberDialog(const OPageNumberDialog&) = delete; + void operator =(const OPageNumberDialog&) = delete; +public: + OPageNumberDialog(weld::Window* pParent, + const css::uno::Reference< css::report::XReportDefinition>& _xHoldAlive, + ::rptui::OReportController* _pController); + virtual ~OPageNumberDialog() override; + virtual short run() override; +}; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_PAGENUMBER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ReportComponentHandler.hxx b/reportdesign/source/ui/inc/ReportComponentHandler.hxx new file mode 100644 index 000000000..3a329c58d --- /dev/null +++ b/reportdesign/source/ui/inc/ReportComponentHandler.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_REPORTDESIGN_SOURCE_UI_INC_REPORTCOMPONENTHANDLER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCOMPONENTHANDLER_HXX + +#include <sal/config.h> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/compbase.hxx> +#include <cppuhelper/basemutex.hxx> +#include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + + +namespace rptui +{ + + + class OPropertyInfoService; + + typedef ::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler + , css::lang::XServiceInfo> ReportComponentHandler_Base; + + class ReportComponentHandler: + private ::cppu::BaseMutex, + public ReportComponentHandler_Base + { + public: + // XServiceInfo - static versions + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static( ); + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_static( ); + static css::uno::Reference< css::uno::XInterface > + create(const css::uno::Reference< css::uno::XComponentContext >&); + + public: + explicit ReportComponentHandler(css::uno::Reference< css::uno::XComponentContext > const & context); + + // 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::lang::XComponent: + 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; + + // css::inspection::XPropertyHandler: + virtual void SAL_CALL inspect(const css::uno::Reference< css::uno::XInterface > & Component) override; + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString & PropertyName) override; + virtual void SAL_CALL setPropertyValue(const OUString & PropertyName, const css::uno::Any & Value) override; + virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString & PropertyName) override; + virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString& PropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory >& ControlFactory ) override; + virtual css::uno::Any SAL_CALL convertToPropertyValue(const OUString & PropertyName, const css::uno::Any & ControlValue) override; + virtual css::uno::Any SAL_CALL convertToControlValue(const OUString & PropertyName, const css::uno::Any & PropertyValue, const css::uno::Type & ControlValueType) override; + virtual void SAL_CALL addPropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > & Listener) override; + virtual void SAL_CALL removePropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > & _rxListener) override; + virtual css::uno::Sequence< css::beans::Property > SAL_CALL getSupportedProperties() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override; + virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override; + virtual sal_Bool SAL_CALL isComposable(const OUString & PropertyName) override; + virtual css::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const OUString & PropertyName, sal_Bool Primary, css::uno::Any & out_Data, const css::uno::Reference< css::inspection::XObjectInspectorUI > & InspectorUI) override; + virtual void SAL_CALL actuatingPropertyChanged(const OUString & ActuatingPropertyName, const css::uno::Any & NewValue, const css::uno::Any & OldValue, const css::uno::Reference< css::inspection::XObjectInspectorUI > & InspectorUI, sal_Bool FirstTimeInit) override; + virtual sal_Bool SAL_CALL suspend(sal_Bool Suspend) override; + + protected: + virtual ~ReportComponentHandler() override {} + private: + ReportComponentHandler(ReportComponentHandler const &) = delete; + void operator =(ReportComponentHandler const &) = delete; + + + // override WeakComponentImplHelperBase::disposing() + // This function is called upon disposing the component, + // if your component needs special work when it becomes + // disposed, do it here. + virtual void SAL_CALL disposing() override; + + css::uno::Reference< css::uno::XComponentContext > m_xContext; + css::uno::Reference< css::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee + css::uno::Reference< css::uno::XInterface > m_xFormComponent; /// inspectee + }; + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCOMPONENTHANDLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx new file mode 100644 index 000000000..a6fc9f155 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -0,0 +1,457 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLER_HXX + +#include "DesignView.hxx" +#include "ReportControllerObserver.hxx" +#include <RptDef.hxx> + +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/embed/XVisualObject.hpp> +#include <com/sun/star/frame/XDesktop2.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/report/XReportDefinition.hpp> +#include <com/sun/star/report/XReportEngine.hpp> +#include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XModeSelector.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> + +#include <comphelper/proparrhlp.hxx> +#include <comphelper/propertystatecontainer.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase5.hxx> +#include <comphelper/interfacecontainer2.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> +#include <svl/lstner.hxx> +#include <vcl/transfer.hxx> +#include <sfx2/zoomitem.hxx> + +#include <functional> +#include <memory> + +class TransferableClipboardListener; +class VclWindowEvent; +class SfxUndoManager; +namespace rptui +{ + class OGroupsSortingDialog; + class OReportModel; + class OSectionView; + class OAddFieldWindow; + class OSectionWindow; + + typedef ::dbaui::DBSubComponentController OReportController_BASE; + typedef ::cppu::ImplHelper5 < css::container::XContainerListener + , css::beans::XPropertyChangeListener + , css::view::XSelectionSupplier + , css::util::XModeSelector + , css::embed::XVisualObject + > OReportController_Listener; + + class OReportController : public OReportController_BASE + ,public OReportController_Listener + ,public SfxListener + ,public ::comphelper::OPropertyStateContainer + ,public ::comphelper::OPropertyArrayUsageHelper < OReportController_BASE > + { + private: + ::comphelper::OInterfaceContainerHelper2 + m_aSelectionListeners; + css::uno::Sequence< css::beans::PropertyValue> + m_aCollapsedSections; + TransferableDataHelper m_aSystemClipboard; // content of the clipboard + rtl::Reference<TransferableClipboardListener> + m_pClipboardNotifier; /// notifier for changes in the clipboard + std::shared_ptr<OGroupsSortingDialog> m_xGroupsFloater; + + rtl::Reference<OXReportControllerObserver> m_pReportControllerObserver; + + ODesignView* getDesignView() const { return static_cast< ODesignView* >( getView() ); } + + css::uno::Reference< css::report::XReportDefinition > m_xReportDefinition; + css::uno::Reference< css::report::XReportEngine > m_xReportEngine; + css::uno::Reference< css::frame::XDesktop2 > m_xFrameLoader; + css::uno::Reference< css::sdbc::XRowSet > m_xRowSet; + css::uno::Reference< css::beans::XPropertyChangeListener > m_xRowSetMediator; + css::uno::Reference< css::util::XNumberFormatter > m_xFormatter; // a number formatter working with the report's NumberFormatsSupplier + mutable css::uno::Reference< css::lang::XComponent > m_xHoldAlive; + mutable css::uno::Reference< css::container::XNameAccess > m_xColumns; + css::awt::Size m_aVisualAreaSize; + + std::shared_ptr<rptui::OReportModel> + m_aReportModel; + OUString m_sName; /// name for the report definition + OUString m_sLastActivePage; /// last active property browser page + OUString m_sMode; /// the current mode of the controller + sal_Int32 m_nSplitPos; /// the position of the splitter + sal_Int32 m_nPageNum; /// the page number from the restoreView call + sal_Int32 m_nSelectionCount; + ::sal_Int64 m_nAspect; + sal_Int16 m_nZoomValue; + SvxZoomType m_eZoomType; + bool m_bShowRuler; + bool m_bGridVisible; + bool m_bGridUse; + bool m_bShowProperties; + bool m_bHelplinesMove; + bool m_bChartEnabled; + bool m_bChartEnabledAsked; + bool m_bInGeneratePreview; + + /** creates a formatted field in the given section with the given formula as data field + * + * \param _aArgs + * \param _xSection the section where to create the formatted field + * \param _sFunction the function which will be set at the data field. + */ + void createControl(const css::uno::Sequence< css::beans::PropertyValue >& _aArgs,const css::uno::Reference< css::report::XSection>& _xSection,const OUString& _sFunction ,sal_uInt16 _nObjectId = OBJ_DLG_FORMATTEDFIELD); + /** switch the report header/footer sectionon off with undo or without depending on the given id. + * + * \param _nId Can either be SID_REPORTHEADER_WITHOUT_UNDO or SID_REPORTFOOTER_WITHOUT_UNDO or SID_REPORTHEADERFOOTER. + */ + void switchReportSection(const sal_Int16 _nId); + + /** switch the report header/footer sectionon off with undo or without depending on the given id. + * + * \param _nId Can either be SID_PAGEHEADER_WITHOUT_UNDO or SID_PAGEFOOTER_WITHOUT_UNDO or SID_PAGEHEADERFOOTER. + */ + void switchPageSection(const sal_Int16 _nId); + + /** append a new group or remove it with undo. + * + * \param _bAppend + * \param _aArgs The args which contains an element named PROPERTY_GROUP of type report::XGroup. + */ + void modifyGroup(const bool _bAppend, const css::uno::Sequence< css::beans::PropertyValue >& _aArgs); + + /** creates a group section. + * + * \param _bUndo true when undo action should be created + * \param _bHeader true when it is a header otherwise it is a footer + * \param _aArgs The args which contains an element named PROPERTY_GROUP of type report::XGroup. + */ + void createGroupSection(const bool _bUndo,const bool _bHeader,const css::uno::Sequence< css::beans::PropertyValue >&_aArgs); + + /** add or remove me as listener at the report definition + * + * \param _bAdd + */ + void listen(const bool _bAdd); + + /** opens the common page dialog + */ + void openPageDialog(const css::uno::Reference< css::report::XSection>& _xSection); + + /** opens or hides the sorting and grouping dialog + */ + void openSortingAndGroupingDialog(); + + /** opens the zoom dialog + */ + void openZoomDialog(); + + /** returns the position of the group inside the groups collection + */ + sal_Int32 getGroupPosition(const css::uno::Reference< css::report::XGroup >& _xGroup); + + /** calls propertyChanged when the header or footer is really turned on. + @param _rEvent the group + @param _bShow when <TRUE/> the header and footer will be shown otherwise not + */ + void notifyGroupSections(const css::container::ContainerEvent& _rEvent + ,bool _bShow); + + /** change the sections for a group + @param _sPropName the header or footer + @param _xGroup the group + @param _nGroupPos the position of the group inside the groups collection or the previous index when it was removed + @param _bShow when <TRUE/> the header and footer will be shown otherwise not + */ + void groupChange( const css::uno::Reference< css::report::XGroup>& _xGroup + ,const OUString& _sPropName + ,sal_Int32 _nGroupPos + ,bool _bShow); + + void executeMethodWithUndo(const char* pUndoStrId,const ::std::function<void(ODesignView *)>& _pMemfun); + void alignControlsWithUndo(const char* pUndoStrId, ControlModification _nControlModification, bool _bAlignAtSection = false); + + css::uno::Reference< css::frame::XFrame > getXFrame(); + + /** shrink a section + @param pUndoStrId the string id of the string which is shown in undo menu + @param _nShrinkId ID of what you would like to shrink. + */ + static void shrinkSectionBottom(const css::uno::Reference< css::report::XSection >& _xSection); + static void shrinkSectionTop(const css::uno::Reference< css::report::XSection >& _xSection); + + public: + void shrinkSection(const char* pUndoStrId, const css::uno::Reference< css::report::XSection >& _xSection, sal_Int32 _nShrinkId); + + /** opens the file open dialog to allow the user to select an image which will be + * bound to a newly created image button. + */ + void insertGraphic(); + + /** creates a new function in the given value context + * + * \param _aValue contains a XNameContainer + */ + void createNewFunction(const css::uno::Any& _aValue); + + /** inserts a label - field pair into the current selected section + * + * \param aArgs + */ + void addPairControls(const css::uno::Sequence< css::beans::PropertyValue >& aArgs); + + /** inserts a label - field combination to show the page number and/or page count + * + * \param _aArgs + */ + void createPageNumber(const css::uno::Sequence< css::beans::PropertyValue >& _aArgs); + + /** creates a formatted field with TODAY() function and if set also a NOW() function + * + * \param _aArgs + */ + void createDateTime(const css::uno::Sequence< css::beans::PropertyValue >& _aArgs); + + /** gets the current section (SdrView) + * + * \return the currently selected section or <NULL/> if no one is selected + */ + OSectionView* getCurrentSectionView() const; + + /**change the ZOrder of a current select object. + * + * \param _nId The command ID about what to do. + */ + void changeZOrder(sal_Int32 _nId); + + /** marks the next or previous section, when the first/last section was already selected then the report will be selected. + * + * \param _bNext + */ + void markSection(const bool _bNext); + + /** collapse or expand the currently selected section. + * + * \param _bCollapse collapse if sal_True otherwise expand + */ + void collapseSection(const bool _bCollapse); + + /** fills the member that chart is enabled or not + * + */ + void checkChartEnabled(); + + /** set the zoom factor at the design view + */ + void impl_zoom_nothrow(); + + virtual void impl_onModifyChanged() override; + + virtual void onLoadedMenu( const css::uno::Reference< css::frame::XLayoutManager >& _xLayoutManager ) override; + virtual void impl_initialize( ) override; + bool isUiVisible() const; + + /** creates a new default control for the currently set type when the modifier KEY_MOD1 was pressed + * \param _aArgs must contain a propertyvalue with name "KeyModifier" and value KEY_MOD1 when control should be created. + */ + void createDefaultControl(const css::uno::Sequence< css::beans::PropertyValue>& _aArgs); + + /** fills the state for the feature request. + @param _sProperty the property which should be filled in the value + @param _rState the state to fill + */ + void impl_fillState_nothrow(const OUString& _sProperty,dbaui::FeatureState& _rState) const; + void impl_fillCustomShapeState_nothrow(const char* _pCustomShapeType,dbaui::FeatureState& _rState) const; + + /** set the property at all selected controls. + @return <TRUE/> when the selection is not empty + */ + bool impl_setPropertyAtControls_throw(const char* pUndoResId + ,const OUString& _sProperty + ,const css::uno::Any& _aValue + ,const css::uno::Sequence< css::beans::PropertyValue >& _aArgs); + + void OnInvalidateClipboard(); + DECL_LINK( OnClipboardChanged, TransferableDataHelper*, void ); + DECL_LINK( OnExecuteReport, void*, void ); + // all the features which should be handled by this class + virtual void describeSupportedFeatures() override; + // state of a feature. 'feature' may be the handle of a css::util::URL somebody requested a dispatch interface for OR a toolbar slot. + virtual dbaui::FeatureState GetState(sal_uInt16 nId) const override; + // execute a feature + virtual void Execute(sal_uInt16 nId, const css::uno::Sequence< css::beans::PropertyValue>& aArgs) override; + + virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, css::uno::Any& _rDefault ) const override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const css::uno::Any& rValue) override; + + private: + virtual ~OReportController() override; + + public: + explicit OReportController(css::uno::Reference< css::uno::XComponentContext > const & the_context); + OReportController(const OReportController&) = delete; + OReportController& operator=(const OReportController&) = delete; + + DECL_LINK( OnCreateHdl, OAddFieldWindow&, void); + + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + // SfxListener + virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) override; + + /** returns <TRUE/> when the command is enabled + @param _nCommand the command id + @param _xControlFormat the report control format + */ + static bool isFormatCommandEnabled(sal_uInt16 _nCommand + ,const css::uno::Reference< css::report::XReportControlFormat>& _xControlFormat); + + virtual bool Construct(vcl::Window* pParent) override; + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; + + // css::frame::XController + virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) override; + + // css::lang::XComponent + virtual void SAL_CALL disposing() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override; + // need by registration + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + + // css::container::XContainerListener + virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& Event) override; + virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& Event) override; + virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& Event) override; + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override; + + // XSelectionSupplier + virtual sal_Bool SAL_CALL select( const css::uno::Any& xSelection ) 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::frame::XController + virtual sal_Bool SAL_CALL attachModel(const css::uno::Reference< css::frame::XModel > & xModel) override; + virtual css::uno::Any SAL_CALL getViewData() override; + virtual void SAL_CALL restoreViewData(const css::uno::Any& Data) override; + + /** gives access to the report definition + * \return the report definition object, may be <NULL/> + */ + const css::uno::Reference< css::report::XReportDefinition>& getReportDefinition() const { return m_xReportDefinition; } + + // css::frame::XController + virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel() override; + + // XTitle + virtual OUString SAL_CALL getTitle( ) override; + + // XModeSelector + virtual void SAL_CALL setMode( const OUString& aMode ) override ; + virtual OUString SAL_CALL getMode( ) override ; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedModes( ) override ; + virtual sal_Bool SAL_CALL supportsMode( const OUString& aMode ) override ; + + // XVisualObject + virtual void SAL_CALL setVisualAreaSize( ::sal_Int64 nAspect, const css::awt::Size& aSize ) override; + virtual css::awt::Size SAL_CALL getVisualAreaSize( ::sal_Int64 nAspect ) override; + virtual css::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) override; + virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) override; + + + /** returns the current position of the splitter + * + * \return + */ + sal_Int32 getSplitPos() const { return m_nSplitPos;} + void setSplitPos(sal_Int32 _nSplitPos) { m_nSplitPos = _nSplitPos;} + + /** creates a new report from the report definition. + * + * \return The model or <NULL/> if the model could not be created. + */ + css::uno::Reference< css::frame::XModel> executeReport(); + + /** returns the RowSet which reflects the current settings of the report definition + + The caller is allowed to hold a reference to the RowSet - it is kept alive as long + as the controller lives, and it's settings will follow the report definition's settings. + */ + css::uno::Reference< css::sdbc::XRowSet > const & getRowSet(); + + /** returns the number formatter + */ + const css::uno::Reference< css::util::XNumberFormatter >& getReportNumberFormatter() const { return m_xFormatter;} + + /** return the SdrModel of the real model + * + * \return + */ + const std::shared_ptr<rptui::OReportModel>& getSdrModel() const { return m_aReportModel;} + + const css::uno::Reference< css::uno::XComponentContext >& getContext() const { return m_xContext; } + sal_Int16 getZoomValue() const { return m_nZoomValue; } + void resetZoomType() { m_eZoomType = SvxZoomType::PERCENT; } + + // css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override; + + // cppu::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + + OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const; + + css::uno::Reference< css::container::XNameAccess > const & getColumns() const; + OUString getColumnLabel_throw(const OUString& i_sColumnName) const; + + SfxUndoManager& getUndoManager() const; + void clearUndoManager() const; + void addUndoAction( std::unique_ptr<SfxUndoAction> i_pAction ); + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx new file mode 100644 index 000000000..ec6be058b --- /dev/null +++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx @@ -0,0 +1,109 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX + +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <cppuhelper/implbase.hxx> + +#include <memory> + +#include <vcl/vclevent.hxx> +#include <tools/link.hxx> + +#include "FormattedFieldBeautifier.hxx" +#include "FixedTextColor.hxx" + +namespace rptui +{ + class OReportController; + class OXReportControllerObserverImpl; + + + class OXReportControllerObserver + : public ::cppu::WeakImplHelper< css::beans::XPropertyChangeListener + , css::container::XContainerListener + , css::util::XModifyListener + > + { + + const ::std::unique_ptr<OXReportControllerObserverImpl> m_pImpl; + + FormattedFieldBeautifier m_aFormattedFieldBeautifier; + FixedTextColor m_aFixedTextColor; + + // do not allow copy + OXReportControllerObserver(const OXReportControllerObserver&) = delete; + OXReportControllerObserver& operator=(const OXReportControllerObserver&) = delete; + virtual ~OXReportControllerObserver() override; // UNO Object must have private destructor! + public: + OXReportControllerObserver(const OReportController& _rController); + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent& evt) override; + + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + + // XContainerListener + virtual void SAL_CALL elementInserted(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent& rEvent) override; + virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; + + // XModifyListener + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; + + + void AddElement(const css::uno::Reference< css::uno::XInterface>& Element); + void RemoveElement(const css::uno::Reference< css::uno::XInterface>& Element); + + void AddSection( const css::uno::Reference< css::report::XSection>& _xSection); + void RemoveSection( const css::uno::Reference< css::report::XSection>& _xSection ); + + /** + Create an object ob OUndoEnvLock locks the undo possibility + As long as in the OUndoEnvLock scope, no undo is possible for manipulated object. + */ + class OEnvLock + { + OXReportControllerObserver& m_rObserver; + public: + OEnvLock(OXReportControllerObserver& _rObserver): m_rObserver(_rObserver){m_rObserver.Lock();} + ~OEnvLock(){ m_rObserver.UnLock(); } + }; + + void Lock(); + void UnLock(); + + void Clear(); + private: + + void switchListening( const css::uno::Reference< css::container::XIndexAccess >& _rxContainer, bool _bStartListening ); + void switchListening( const css::uno::Reference< css::uno::XInterface >& _rxObject, bool _bStartListening ); + + DECL_LINK(SettingsChanged, VclSimpleEvent&, void ); + }; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTCONTROLLEROBSERVER_HXX + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ReportDefines.hxx b/reportdesign/source/ui/inc/ReportDefines.hxx new file mode 100644 index 000000000..c56e20841 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportDefines.hxx @@ -0,0 +1,33 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_REPORTDEFINES_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTDEFINES_HXX + +namespace rptui +{ + enum class DlgEdMode { Insert, Select }; + +#define REPORT_STARTMARKER_WIDTH 120 +#define REPORT_ENDMARKER_WIDTH 10 +#define REPORT_EXTRA_SPACE 10 + +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTDEFINES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx new file mode 100644 index 000000000..ad334f194 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportSection.hxx @@ -0,0 +1,164 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX + +#include <vcl/window.hxx> +#include <RptPage.hxx> +#include <com/sun/star/beans/NamedValue.hpp> +#include <comphelper/propmultiplex.hxx> +#include <cppuhelper/basemutex.hxx> +#include "ReportDefines.hxx" +#include "dlgedfunc.hxx" +#include <vcl/transfer.hxx> +#include <rtl/ref.hxx> +#include <memory> + +namespace rptui +{ + class OReportModel; + class OReportPage; + class OSectionView; + class OSectionWindow; + + class OReportSection : public vcl::Window + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + , public DropTargetHelper + { + OReportPage* m_pPage; + OSectionView* m_pView; + VclPtr<OSectionWindow> m_pParent; + ::std::unique_ptr<DlgEdFunc> m_pFunc; + std::shared_ptr<OReportModel> m_pModel; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; + css::uno::Reference< css::report::XSection > m_xSection; + sal_Int32 m_nPaintEntranceCount; + + DlgEdMode m_eMode; + + /** fills the section with all control from the report section + */ + void fill(); + /** checks all objects if they fit in the new paper width. + */ + void impl_adjustObjectSizePosition(sal_Int32 i_nPaperWidth,sal_Int32 i_nLeftMargin,sal_Int32 i_nRightMargin); + + OReportSection(OReportSection const &) = delete; + void operator =(OReportSection const &) = delete; + protected: + // DropTargetHelper overridables + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ) override; + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ) override; + + // window overrides + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void MouseMove( const MouseEvent& rMEvt ) override; + virtual void Command( const CommandEvent& rCEvt ) override; + + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override; + public: + OReportSection(OSectionWindow* _pParent,const css::uno::Reference< css::report::XSection >& _xSection); + virtual ~OReportSection() override; + virtual void dispose() override; + + // window overrides + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + + /** copies the current selection in this section + @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects. + */ + void Copy(css::uno::Sequence< css::beans::NamedValue >& _rAllreadyCopiedObjects); + + void Copy(css::uno::Sequence< css::beans::NamedValue >& _rAllreadyCopiedObjects,bool _bEraseAnddNoClone); + + /** paste a new control in this section + @param _aAllreadyCopiedObjects objects to paste into the section. Only objects are pasted where the name is equal to the section name. + @param _bForce If set to <TRUE/> than the objects will be copied into this section. The name is not compared in this case. + */ + void Paste(const css::uno::Sequence< css::beans::NamedValue >& _aAllreadyCopiedObjects,bool _bForce = false); + + /** Deletes the current selection in this section + * + */ + void Delete(); + + /** All objects will be marked. + */ + void SelectAll(const sal_uInt16 _nObjectType); + + /** makes the grid visible + * + * \param _bVisible when <TRUE/> the grid is made visible + */ + void SetGridVisible(bool _bVisible); + + OSectionWindow* getSectionWindow() const { return m_pParent; } + OSectionView& getSectionView() const { return *m_pView; } + OReportPage* getPage() const { return m_pPage; } + const css::uno::Reference< css::report::XSection >& getSection() const { return m_xSection; } + + void SetMode( DlgEdMode m_eMode ); + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + bool handleKeyEvent(const KeyEvent& _rEvent); + + /** returns the current control report model or <NULL/> + */ + css::uno::Reference< css::report::XReportComponent > getCurrentControlModel() const; + + /** fills the vector with all selected control models + /param _rSelection The vector will be filled and will not be cleared before. + */ + void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const; + + /** creates a default object (custom shape) + * + * @param _sType + */ + void createDefault(const OUString& _sType); + + /** creates a new default custom shape + * + * \param _sType + * \param _pObj + */ + static void createDefault(const OUString& _sType,SdrObject* _pObj); + void stopScrollTimer(); + + /** deactivate the current active ole object if any + */ + void deactivateOle(); + + /** returns true when an ole object is currently active + */ + bool isUiActive() const; + }; + +} //rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTSECTION_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx new file mode 100644 index 000000000..d794a33f1 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportWindow.hxx @@ -0,0 +1,221 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX + +#include <com/sun/star/report/XSection.hpp> +#include "ReportDefines.hxx" +#include <o3tl/deleter.hxx> +#include <svtools/ruler.hxx> +#include <sfx2/zoomitem.hxx> + +#include <memory> +#include <vector> +#include <comphelper/propmultiplex.hxx> + +#include "MarkedSection.hxx" +#include "ViewsWindow.hxx" + +namespace rptui +{ + class ODesignView; + class OScrollWindowHelper; + class OSectionView; + class DlgEdFactory; + + class OReportWindow : public vcl::Window + , public IMarkedSection + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + { + VclPtr<Ruler> m_aHRuler; + VclPtr<ODesignView> m_pView; + VclPtr<OScrollWindowHelper> m_pParent; + VclPtr<OViewsWindow> m_aViewsWindow; + rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; + std::unique_ptr<DlgEdFactory, o3tl::default_delete<DlgEdFactory>> m_pObjFac; + + void ImplInitSettings(); + + sal_Int32 GetTotalHeight() const; + sal_Int32 impl_getRealPixelWidth() const; + + OReportWindow(OReportWindow const &) = delete; + void operator =(OReportWindow const &) = delete; + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override; + public: + OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView); + virtual ~OReportWindow() override; + virtual void dispose() override; + + // Window overrides + virtual void Resize() override; + + ODesignView* getReportView() const { return m_pView; } + OScrollWindowHelper* getScrollWindow() const { return m_pParent; } + + void SetMode( DlgEdMode m_eMode ); + void SetInsertObj( sal_uInt16 eObj, const OUString& _sShapeType); + OUString const & GetInsertObjString() const; + void setGridSnap(bool bOn); + void setDragStripes(bool bOn); + + /** copies the current selection in this section + */ + void Copy(); + + /** returns if paste is allowed + * + * \return <TRUE/> if paste is allowed + */ + bool IsPasteAllowed() const; + + /** paste a new control in this section + */ + void Paste(); + + /** Deletes the current selection in this section + * + */ + void Delete(); + + /** All objects will be marked. + */ + void SelectAll(const sal_uInt16 _nObjectType); + + /** returns <TRUE/> when an object is marked + */ + bool HasSelection() const; + + Point getThumbPos() const; + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(sal_uInt16 _nPosition); + + /** adds a new section at position _nPosition. + If the section is <NULL/> nothing happens. + If the position is grater than the current elements, the section will be appended. + */ + void addSection(const css::uno::Reference< css::report::XSection >& _xSection + ,const OUString& _sColorEntry + ,sal_uInt16 _nPosition); + + sal_uInt16 getSectionCount() const; + + /** turns the grid on or off + * + * \param _bVisible + */ + void toggleGrid(bool _bVisible); + + + /** shows the ruler + */ + void showRuler(bool _bShow); + + sal_Int32 getRulerHeight() const { return m_aHRuler->GetSizePixel().Height(); } + + /** returns the total width of the first section + */ + sal_Int32 GetTotalWidth() const; + + /** calculate the max width of the markers + * The end marker will not be used for calculation. + * + * \return the max width + */ + sal_Int32 getMaxMarkerWidth() const; + + void ScrollChildren(const Point& _aThumbPos); + + void notifySizeChanged(); + + /** unmark all objects on the views without the given one. + */ + void unmarkAllObjects(); + + /** triggers the property browser with the report component or section + @param _xReportComponent + */ + void showProperties( const css::uno::Reference< css::report::XSection>& _xReportComponent); + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + bool handleKeyEvent(const KeyEvent& _rEvent); + + /** the section as marked or not marked + @param _pSectionView the section where to set the marked flag + @param _bMark the marked flag + */ + void setMarked(OSectionView const * _pSectionView, bool _bMark); + void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark); + void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark); + + // IMarkedSection + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const override; + OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const; + virtual void markSection(const sal_uInt16 _nPos) override; + + + /** fills the positions of all collapsed sections. + * + * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections. + */ + void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const; + + /** collapse all sections given by their position + * + * \param _aCollapsedSections The position of the sections which should be collapsed. + */ + void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections); + + /** align all marked objects in all sections + */ + void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection); + + sal_uInt32 getMarkedObjectCount() const; + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + + /** fills the vector with all selected control models + /param _rSelection The vector will be filled and will not be cleared before. + */ + void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const; + + /** calculates the zoom factor. + @param _eType which kind of zoom is needed + */ + sal_uInt16 getZoomFactor(SvxZoomType _eType) const; + }; + +} //rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/RptUndo.hxx b/reportdesign/source/ui/inc/RptUndo.hxx new file mode 100644 index 000000000..9f0b6c1aa --- /dev/null +++ b/reportdesign/source/ui/inc/RptUndo.hxx @@ -0,0 +1,135 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_RPTUNDO_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_RPTUNDO_HXX + +#include <RptModel.hxx> +#include <UndoActions.hxx> +#include <functional> + +namespace com::sun::star { + namespace drawing { + class XShape; + } +} + +namespace rptui +{ + /** \class OSectionUndo + * Undo class for section add and remove. + */ + class OSectionUndo : public OCommentUndoAction + { + OSectionUndo(const OSectionUndo&) = delete; + void operator =(const OSectionUndo&) = delete; + protected: + ::std::vector< css::uno::Reference< css::drawing::XShape> > + m_aControls; + ::std::vector< ::std::pair< OUString ,css::uno::Any> > + m_aValues; + Action m_eAction; + sal_uInt16 m_nSlot; + bool m_bInserted; + + virtual void implReInsert( ) = 0; + virtual void implReRemove( ) = 0; + + void collectControls(const css::uno::Reference< css::report::XSection >& _xSection); + public: + OSectionUndo( OReportModel& rMod + ,sal_uInt16 _nSlot + ,Action _eAction + ,const char* pCommentID); + virtual ~OSectionUndo() override; + + virtual void Undo() override; + virtual void Redo() override; + }; + + /** Undo action for the group header, footer, page header, footer + */ + class OReportSectionUndo : public OSectionUndo + { + OReportHelper m_aReportHelper; + ::std::function<css::uno::Reference< css::report::XSection >(OReportHelper *)> m_pMemberFunction; + + void implReInsert( ) override; + void implReRemove( ) override; + OReportSectionUndo(const OReportSectionUndo&) = delete; + void operator =(const OReportSectionUndo&) = delete; + public: + //OReportSectionUndo( const css::uno::Reference< css::report::XSection >& _xSection + OReportSectionUndo( OReportModel& rMod + ,sal_uInt16 _nSlot + ,::std::function<css::uno::Reference< css::report::XSection >(OReportHelper *)> _pMemberFunction + ,const css::uno::Reference< css::report::XReportDefinition >& _xReport + ,Action _eAction); + virtual ~OReportSectionUndo() override; + }; + + /** Undo action for the group header, footer + */ + class OGroupSectionUndo : public OSectionUndo + { + OGroupHelper m_aGroupHelper; + ::std::function<css::uno::Reference< css::report::XSection >(OGroupHelper *)> m_pMemberFunction; + + mutable OUString m_sName; + + void implReInsert( ) override; + void implReRemove( ) override; + OGroupSectionUndo(const OGroupSectionUndo&) = delete; + void operator =(const OGroupSectionUndo&) = delete; + public: + //OGroupSectionUndo( const css::uno::Reference< css::report::XSection >& _xSection + OGroupSectionUndo( OReportModel& rMod + ,sal_uInt16 _nSlot + ,::std::function<css::uno::Reference< css::report::XSection >(OGroupHelper *)> _pMemberFunction + ,const css::uno::Reference< css::report::XGroup >& _xGroup + ,Action _eAction + ,const char* pCommentID); + + virtual OUString GetComment() const override; + }; + + /** /class OGroupUndo + * \brief Undo action for removing a group object. + */ + class OGroupUndo : public OCommentUndoAction + { + css::uno::Reference< css::report::XGroup> m_xGroup; ///<! the group for the undo redo action + css::uno::Reference< css::report::XReportDefinition > m_xReportDefinition; ///<! the parent report definition + Action m_eAction; ///<! the current action + sal_Int32 m_nLastPosition; ///<! the last position of the group + + void implReInsert( ); + void implReRemove( ); + public: + OGroupUndo(OReportModel& rMod + ,const char* pCommentID + ,Action _eAction + ,const css::uno::Reference< css::report::XGroup>& _xGroup + ,const css::uno::Reference< css::report::XReportDefinition >& _xReportDefinition); + virtual void Undo() override; + virtual void Redo() override; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_RPTUNDO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx new file mode 100644 index 000000000..c166e1f75 --- /dev/null +++ b/reportdesign/source/ui/inc/ScrollHelper.hxx @@ -0,0 +1,210 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_SCROLLHELPER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SCROLLHELPER_HXX + +#include <vcl/scrbar.hxx> +#include <com/sun/star/report/XSection.hpp> +#include <comphelper/propmultiplex.hxx> +#include "ReportDefines.hxx" +#include <cppuhelper/basemutex.hxx> +#include <rtl/ref.hxx> +#include "MarkedSection.hxx" +#include "ReportWindow.hxx" + +namespace rptui +{ + class ODesignView; + class OReportWindow; + class OSectionView; + + /** This class defines the scrollable area of the report design. It includes + the h-ruler and the sections, and end marker. Not the start marker. + */ + typedef vcl::Window OScrollWindowHelper_BASE; + class OScrollWindowHelper : public ::cppu::BaseMutex + , public OScrollWindowHelper_BASE/*TabPage*/ + , public ::comphelper::OPropertyChangeListener + , public IMarkedSection + { + private: + VclPtr<ScrollBar> m_aHScroll; + VclPtr<ScrollBar> m_aVScroll; + VclPtr<ScrollBarBox> m_aCornerWin; // window in the bottom right corner + Size m_aTotalPixelSize; + VclPtr<ODesignView> m_pParent; + VclPtr<OReportWindow> m_aReportWindow; + ::rtl::Reference<comphelper::OPropertyChangeMultiplexer > + m_pReportDefinitionMultiPlexer; // listener for property changes + + DECL_LINK( ScrollHdl, ScrollBar*, void); + Size ResizeScrollBars(); + void ImplInitSettings(); + void impl_initScrollBar( ScrollBar& _rScrollBar ) const; + + OScrollWindowHelper(OScrollWindowHelper const &) = delete; + void operator =(OScrollWindowHelper const &) = delete; + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + // window + virtual void Resize() override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; + // OPropertyChangeListener + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override; + public: + OScrollWindowHelper( ODesignView* _pReportDesignView); + virtual ~OScrollWindowHelper() override; + virtual void dispose() override; + + /** late ctor + */ + void initialize(); + + Point getThumbPos() const { return Point(m_aHScroll->GetThumbPos(),m_aVScroll->GetThumbPos())/*m_aScrollOffset*/; } + void setTotalSize(sal_Int32 _nWidth, sal_Int32 _nHeight); + const Size& getTotalSize() const { return m_aTotalPixelSize; } + ScrollBar& GetHScroll() { return *m_aHScroll; } + ScrollBar& GetVScroll() { return *m_aVScroll; } + + // forwards + void SetMode( DlgEdMode _eMode ); + void SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType); + OUString const & GetInsertObjString() const; + void setGridSnap(bool bOn); + void setDragStripes(bool bOn); + /** copies the current selection in this section + */ + void Copy(); + + /** returns if paste is allowed + * + * \return <TRUE/> if paste is allowed + */ + bool IsPasteAllowed() const; + + /** paste a new control in this section + */ + void Paste(); + + /** Deletes the current selection in this section + * + */ + void Delete(); + + /** All objects will be marked. + */ + void SelectAll(const sal_uInt16 _nObjectType); + + /** returns <TRUE/> when an object is marked + */ + bool HasSelection() const; + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(sal_uInt16 _nPosition); + + /** adds a new section at position _nPosition. + If the section is <NULL/> nothing happens. + If the position is grater than the current elements, the section will be appended. + */ + void addSection(const css::uno::Reference< css::report::XSection >& _xSection + ,const OUString& _sColorEntry + ,sal_uInt16 _nPosition); + + sal_uInt16 getSectionCount() const; + + /** turns the grid on or off + * + * \param _bVisible + */ + void toggleGrid(bool _bVisible); + + /** unmark all objects on the views. + */ + void unmarkAllObjects(); + + /** shows or hides the ruler. + */ + void showRuler(bool _bShow); + + /** calculate the max width of the markers + * + * The end marker will not be used for calculation. + * \return the max width + */ + sal_Int32 getMaxMarkerWidth() const; + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + bool handleKeyEvent(const KeyEvent& _rEvent); + + /** the section as marked or not marked + @param _pSectionView the section where to set the marked flag + @param _bMark the marked flag + */ + void setMarked(OSectionView const * _pSectionView, bool _bMark); + void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark); + void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark); + + // IMarkedSection + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const override; + OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const; + virtual void markSection(const sal_uInt16 _nPos) override; + + + /** fills the positions of all collapsed sections. + * + * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections. + */ + void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const; + + /** collapse all sections given by their position + * + * \param _aCollapsedSections The position of the sections which should be collapsed. + */ + void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections); + + /** align all marked objects in all sections + */ + void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection); + + sal_uInt32 getMarkedObjectCount() const; + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + + /** fills the vector with all selected control models + /param _rSelection The vector will be filled and will not be cleared before. + */ + void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const; + + /** calculates the zoom factor. + @param _eType which kind of zoom is needed + */ + sal_uInt16 getZoomFactor(SvxZoomType _eType) const; + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SCROLLHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx new file mode 100644 index 000000000..df3cbc7b0 --- /dev/null +++ b/reportdesign/source/ui/inc/SectionView.hxx @@ -0,0 +1,74 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_SECTIONVIEW_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SECTIONVIEW_HXX + + +#include <svx/svdview.hxx> +namespace rptui +{ +class OReportWindow; +class OReportSection; + + +// OSectionView + + +class OSectionView : public SdrView +{ +private: + VclPtr<OReportWindow> m_pReportWindow; + VclPtr<OReportSection> m_pSectionWindow; + + void ObjectRemovedInAliveMode( const SdrObject* pObject ); + OSectionView(const OSectionView&) = delete; + void operator =(const OSectionView&) = delete; +public: + + OSectionView( + SdrModel& rSdrModel, + OReportSection* _pSectionWindow, + OReportWindow* pEditor); + + virtual ~OSectionView() override; + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; + virtual void MarkListHasChanged() override; + virtual void MakeVisible( const tools::Rectangle& rRect, vcl::Window& rWin ) override; + + OReportSection* getReportSection() const { return m_pSectionWindow; } + + // switch the marked objects to the given layer. + void SetMarkedToLayer( SdrLayerID nLayerNo ); + + // return true when only shapes are marked, otherwise false. + bool OnlyShapesMarked() const; + + /* returns the common layer id of the marked objects, otherwise -1 will be returned. + */ + SdrLayerID GetLayerIdOfMarkedObjects() const; + + // returns true if objects at Drag & Drop is resize not move + bool IsDragResize() const; +}; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SECTIONVIEW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx new file mode 100644 index 000000000..2ef3e8b17 --- /dev/null +++ b/reportdesign/source/ui/inc/SectionWindow.hxx @@ -0,0 +1,132 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_SECTIONWINDOW_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SECTIONWINDOW_HXX + +#include <com/sun/star/report/XSection.hpp> +#include <vcl/window.hxx> +#include <vcl/split.hxx> +#include <comphelper/propmultiplex.hxx> +#include <cppuhelper/basemutex.hxx> + +#include <UndoActions.hxx> +#include "StartMarker.hxx" +#include "EndMarker.hxx" +#include "ReportSection.hxx" + +namespace comphelper +{ + class OPropertyChangeMultiplexer; +} +namespace rptui +{ + class OViewsWindow; + class OSectionWindow : public vcl::Window + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + { + VclPtr<OViewsWindow> m_pParent; + VclPtr<OStartMarker> m_aStartMarker; + VclPtr<OReportSection> m_aReportSection; + VclPtr<Splitter> m_aSplitter; + VclPtr<OEndMarker> m_aEndMarker; + + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti; + + OSectionWindow(OSectionWindow const &) = delete; + void operator =(OSectionWindow const &) = delete; + + /** set the title of the group header or footer + * + * \param _xGroup + * \param _nResId + * \param _pGetSection + * \param _pIsSectionOn + * @return sal_True when title was set otherwise FALSE + */ + bool setGroupSectionTitle( + const css::uno::Reference<css::report::XGroup>& _xGroup, const char* pResId, + const ::std::function<css::uno::Reference<css::report::XSection>(OGroupHelper*)>& + _pGetSection, + const ::std::function<bool(OGroupHelper*)>& _pIsSectionOn); + + /** set the title of the (report/page) header or footer + * + * \param _xGroup + * \param _nResId + * \param _pGetSection + * \param _pIsSectionOn + * @return sal_True when title was set otherwise FALSE + */ + bool setReportSectionTitle( + const css::uno::Reference<css::report::XReportDefinition>& _xReport, const char* pResId, + const ::std::function<css::uno::Reference<css::report::XSection>(OReportHelper*)>& + _pGetSection, + const ::std::function<bool(OReportHelper*)>& _pIsSectionOn); + void ImplInitSettings(); + + DECL_LINK(Collapsed, OColorListener&, void); + DECL_LINK(StartSplitHdl, Splitter*, void); + DECL_LINK(SplitHdl, Splitter*, void); + DECL_LINK(EndSplitHdl, Splitter*, void); + + + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + // Window overrides + virtual void Resize() override; + + protected: + virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override; + public: + OSectionWindow( OViewsWindow* _pParent + ,const css::uno::Reference< css::report::XSection >& _xSection + ,const OUString& _sColorEntry); + virtual ~OSectionWindow() override; + virtual void dispose() override; + + OStartMarker& getStartMarker() { return *m_aStartMarker; } + OReportSection& getReportSection() { return *m_aReportSection; } + OEndMarker& getEndMarker() { return *m_aEndMarker; } + OViewsWindow* getViewsWindow() { return m_pParent; } + + void setCollapsed(bool _bCollapsed); + + /** triggers the property browser with the section + @param _pStartMarker + */ + void showProperties(); + + /** set the marker as marked or not marked + @param _bMark set the new state of the marker + */ + void setMarked(bool _bMark); + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + + void scrollChildren(long _nThumbPosX); + }; + +} // rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SECTIONWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx new file mode 100644 index 000000000..296255303 --- /dev/null +++ b/reportdesign/source/ui/inc/StartMarker.hxx @@ -0,0 +1,82 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_STARTMARKER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_STARTMARKER_HXX + +#include <osl/interlck.h> +#include <svtools/ruler.hxx> +#include "ColorListener.hxx" +#include <vcl/fixed.hxx> + + +namespace rptui +{ + class OSectionWindow; + class OStartMarker : public OColorListener + { + + VclPtr<Ruler> m_aVRuler; + VclPtr<FixedText> m_aText; + VclPtr<FixedImage> m_aImage; + VclPtr<OSectionWindow> m_pParent; + static Image* s_pDefCollapsed; + static Image* s_pDefExpanded; + static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed + + bool m_bShowRuler; + + void changeImage(); + void initDefaultNodeImages(); + void setColor(); + + virtual void ImplInitSettings() override; + virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; + + OStartMarker(OStartMarker const &) = delete; + void operator =(OStartMarker const &) = delete; + public: + OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry); + virtual ~OStartMarker() override; + virtual void dispose() override; + + // SfxListener + virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) override; + // Window overrides + virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; + virtual void MouseButtonUp(const MouseEvent& rMEvt) override; + virtual void Resize() override; + virtual void RequestHelp(const HelpEvent& rHEvt) override; + + void setTitle(const OUString& _sTitle); + sal_Int32 getMinHeight() const; + + /** shows or hides the ruler. + */ + void showRuler(bool _bShow); + + virtual void setCollapsed(bool _bCollapsed) override; + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + }; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_STARTMARKER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx new file mode 100644 index 000000000..13aafb14f --- /dev/null +++ b/reportdesign/source/ui/inc/UITools.hxx @@ -0,0 +1,181 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX + +#include <com/sun/star/report/XGroup.hpp> +#include <com/sun/star/report/XReportControlFormat.hpp> +#include <com/sun/star/report/XShape.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/NamedValue.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include "ReportSection.hxx" +#include <rtl/ref.hxx> +#include <vcl/taskpanelist.hxx> +#include <comphelper/stl_types.hxx> + +class SdrPage; +class SdrObject; +class SdrUnoObj; +class SdrView; +namespace tools { class Rectangle; } +namespace comphelper +{ + class OPropertyChangeMultiplexer; + class OPropertyChangeListener; +} +namespace rptui +{ + /** returns the position of the object inside the index container + @param _xReportDefinition the report definition to get the groups + @param _xGroup the group to search + @return returns the position of the group in the list, otherwise -1 + */ + template<typename T> sal_Int32 getPositionInIndexAccess( + const css::uno::Reference< css::container::XIndexAccess >& _xCollection + ,const css::uno::Reference< T >& _xSearch) + { + sal_Int32 nCount = _xCollection->getCount(); + sal_Int32 i = (nCount == 0) ? -1 : 0; + for (;i<nCount ; ++i) + { + css::uno::Reference< T > xObject(_xCollection->getByIndex(i),css::uno::UNO_QUERY); + if ( xObject == _xSearch ) + break; + } + return i; + } + + /** set the name of the header and footer of the group by the expression appended by the localized name of the section + @param _xGroup the group where the header/footer name is set by the expression of the group + */ + void adjustSectionName(const css::uno::Reference< css::report::XGroup >& _xGroup,sal_Int32 _nPos); + + /** add a listener for the properties size, left margin, right margin to the page style + * + * \param _xReportDefinition + * \param _pListener + * \return + */ + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> addStyleListener( const css::uno::Reference< css::report::XReportDefinition >& _xReportDefinition + ,::comphelper::OPropertyChangeListener* _pListener); + + /** opens the common character font dialog + */ + bool openCharDialog( + const css::uno::Reference< css::report::XReportControlFormat>& _xReportControlFormat, + const css::uno::Reference< css::awt::XWindow>& _xWindow, + css::uno::Sequence< css::beans::NamedValue >& _out_rNewValues + ); + + /** opens the area dialog for shapes + */ + bool openAreaDialog( + const css::uno::Reference< css::report::XShape >& _xShape + ,const css::uno::Reference< css::awt::XWindow>& _xWindow + ); + + /** opens the formula dialog + @param _out_rFormula + the formula chosen by the user + @precond + we're really inspecting a database report (well, a RowSet at least) + @return + <TRUE/> if and only if the user successfully chose a clause + */ + bool openDialogFormula_nothrow( OUString& _in_out_rFormula + , const css::uno::Reference< css::uno::XComponentContext >& _xContext + , const css::uno::Reference< css::awt::XWindow>& _xWindow + , const css::uno::Reference < css::beans::XPropertySet >& _xRowSet + ); + + /** applies the character settings previously obtained via openCharDialog + */ + void applyCharacterSettings( + const css::uno::Reference< css::report::XReportControlFormat >& _rxReportControlFormat, + const css::uno::Sequence< css::beans::NamedValue >& _rSettings + ); + + /** notifySystemWindow adds or remove the given window _pToRegister at the Systemwindow found when search _pWindow. + @param pWindow + The window which is used to search for the SystemWindow. + @param pToRegister + The window which should be added or removed on the TaskPaneList. + @param rMemFunc + The member function which should be called at the SystemWindow when found. + Possible values are: + ::comphelper::mem_fun(&TaskPaneList::AddWindow) + ::comphelper::mem_fun(&TaskPaneList::RemoveWindow) + */ + void notifySystemWindow(vcl::Window const * pWindow, vcl::Window* pToRegister, const ::comphelper::mem_fun1_t<TaskPaneList, vcl::Window*>& rMemFunc); + + + const sal_Int16 ISOVER_IGNORE_CUSTOMSHAPES = 1; + + /** checks whether the given rectangle overlapps another OUnoObject object in that view. + * + * \param _rRect + * \param _rPage + * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones + * \return the object which is overlapped, otherwise <NULL/> + */ + SdrObject* isOver(const tools::Rectangle& _rRect,SdrPage const & _rPage,SdrView const & _rView,bool _bAllObjects = false,SdrObject const * _pIgnore = nullptr, sal_Int16 _nIgnoreType=0); + + SdrObject* isOver(const tools::Rectangle& _rRect,SdrPage const & _rPage,SdrView const & _rView,bool _bAllObjects, std::unique_ptr<SdrUnoObj, SdrObjectFreeOp> _pIgnoreList[], int _nIgnoreListLength); + + /** checks whether the given OUnoObject object rectangle overlapps another object in that view. + * + * \param _pObj + * \param _rPage + * \param _rView + * \return the object which is overlapped, otherwise <NULL/>. If the given object is not of type OUnoObject <NULL/> will be returned. + */ + SdrObject* isOver(SdrObject const * _pObj,SdrPage const & _rPage,SdrView const & _rView); + + /** retrieves the names of the parameters of the command which the given RowSet is bound to + */ + css::uno::Sequence< OUString > + getParameterNames( const css::uno::Reference< css::sdbc::XRowSet >& _rxRowSet ); + + /** ensures that no control overlaps the given one. + * + * \param pControl the control which should place in the section without overlapping + * \param _pReportSection the section + * \param _bInsert sal_True when the control should be inserted, otherwise not. + */ + void correctOverlapping(SdrObject* pControl,OReportSection const & _aReportSection,bool _bInsert = true); + + /** returns a Rectangle of a given SdrObject + * + * \param pControl the SdrObject + */ + + tools::Rectangle getRectangleFromControl(SdrObject* pControl); + + /** sets the map mode at the window + @param _aZoom the zoom scale + @param _rWindow where to set the map mode + */ + void setZoomFactor(const Fraction& _aZoom, vcl::Window& _rWindow); +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_UITOOLS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx new file mode 100644 index 000000000..e03ff6364 --- /dev/null +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -0,0 +1,294 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_VIEWSWINDOW_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_VIEWSWINDOW_HXX + +#include <com/sun/star/report/XSection.hpp> +#include <vcl/window.hxx> +#include <svtools/colorcfg.hxx> +#include "ReportDefines.hxx" +#include "SectionView.hxx" +#include <unotools/options.hxx> +#include <vector> + +#include "MarkedSection.hxx" +#include "SectionWindow.hxx" + +class SdrHdl; + +namespace rptui +{ + class OReportWindow; + class OReportSection; + class OSectionView; + enum class ControlModification; + + struct RectangleLess + { + enum CompareMode { POS_LEFT,POS_RIGHT,POS_UPPER,POS_DOWN,POS_CENTER_HORIZONTAL,POS_CENTER_VERTICAL }; + CompareMode m_eCompareMode; + Point m_aRefPoint; + RectangleLess(CompareMode _eCompareMode,const Point& _rRefPoint ) : m_eCompareMode(_eCompareMode),m_aRefPoint(_rRefPoint){} + bool operator() (const tools::Rectangle& lhs, const tools::Rectangle& rhs) const + { + switch(m_eCompareMode) + { + case POS_LEFT: + return lhs.Left() < rhs.Left(); + case POS_RIGHT: + return lhs.Right() >= rhs.Right(); + case POS_UPPER: + return lhs.Top() < rhs.Top(); + case POS_DOWN: + return lhs.Bottom() >= rhs.Bottom(); + case POS_CENTER_HORIZONTAL: + return std::abs(m_aRefPoint.X() - lhs.Center().X()) < std::abs(m_aRefPoint.X() - rhs.Center().X()); + case POS_CENTER_VERTICAL: + return std::abs(lhs.Center().Y() - m_aRefPoint.Y()) < std::abs(rhs.Center().Y() - m_aRefPoint.Y()); + } + return false; + } + }; + + class OViewsWindow : public vcl::Window + , public utl::ConfigurationListener + , public IMarkedSection + { + typedef ::std::multimap<tools::Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess> TRectangleMap; + public: + typedef ::std::vector< VclPtr<OSectionWindow> > TSectionsMap; + + private: + TSectionsMap m_aSections; + svtools::ColorConfig m_aColorConfig; + VclPtr<OReportWindow> m_pParent; + OUString m_sShapeType; + bool m_bInUnmark; + + void ImplInitSettings(); + /** returns the iterator at pos _nPos or the end() + */ + TSectionsMap::iterator getIteratorAtPos(sal_uInt16 _nPos); + void collectRectangles(TRectangleMap& _rMap); + static void collectBoundResizeRect(const TRectangleMap& _rSortRectangles, ControlModification _nControlModification,bool _bAlignAtSection,tools::Rectangle& _rBound,tools::Rectangle& _rResize); + void impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet); + + OViewsWindow(OViewsWindow const &) = delete; + void operator =(OViewsWindow const &) = delete; + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + // Window overrides + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; + + virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override; + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, ConfigurationHints ) override; + public: + OViewsWindow( + OReportWindow* _pReportWindow); + virtual ~OViewsWindow() override; + virtual void dispose() override; + + // Window overrides + virtual void Resize() override; + + void resize(const OSectionWindow& _rSectionWindow); + + OReportWindow* getView() const { return m_pParent; } + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(sal_uInt16 _nPosition); + + /** adds a new section at position _nPosition. + If the section is <NULL/> nothing happens. + If the position is grater than the current elements, the section will be appended. + */ + void addSection(const css::uno::Reference< css::report::XSection >& _xSection + ,const OUString& _sColorEntry + ,sal_uInt16 _nPosition); + + sal_uInt16 getSectionCount() const; + /** return the section at the given position + * + * \param _nPos + * \return the section at this pos or an empty section + */ + OSectionWindow* getSectionWindow(const sal_uInt16 _nPos) const; + + /** turns the grid on or off + * + * \param _bVisible + */ + void toggleGrid(bool _bVisible); + void setGridSnap(bool bOn); + void setDragStripes(bool bOn); + + /** returns the total accumulated height of all sections until _pSection is reached + */ + sal_Int32 getTotalHeight() const; + + bool empty() const { return m_aSections.empty(); } + void SetMode( DlgEdMode m_eMode ); + void SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType); + const OUString& GetInsertObjString() const { return m_sShapeType;} + /** copies the current selection in this section + */ + void Copy(); + + /** returns if paste is allowed + * + * \return <TRUE/> if paste is allowed + */ + bool IsPasteAllowed() const; + + /** paste a new control in this section + */ + void Paste(); + + /** Deletes the current selection in this section + * + */ + void Delete(); + + /** All objects will be marked. + */ + void SelectAll(const sal_uInt16 _nObjectType); + + /** returns <TRUE/> when an object is marked + */ + bool HasSelection() const; + + /** unmark all objects on the views without the given one. + * + * @param _pSectionView The view where the objects should not be unmarked. + */ + void unmarkAllObjects(OSectionView const * _pSectionView); + + /** returns the report section window for the given xsection + @param _xSection the section + */ + OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const; + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + bool handleKeyEvent(const KeyEvent& _rEvent); + + /** the section as marked or not marked + @param _pSectionView the section where to set the marked flag + @param _bMark the marked flag + */ + void setMarked(OSectionView const * _pSectionView, bool _bMark); + void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark); + void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark); + + // IMarkedSection + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const override; + virtual void markSection(const sal_uInt16 _nPos) override; + + /** align all marked objects in all sections + */ + void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection); + + /** creates a default object + * + */ + void createDefault(); + + /** shows or hides the ruler. + */ + void showRuler(bool _bShow); + + /** returns the currently set shape type. + * + * \return \member m_sShapeType + */ + const OUString& getShapeType() const { return m_sShapeType; } + + /** returns the current position in the list + */ + sal_uInt16 getPosition(const OSectionWindow* _pSectionWindow) const; + + /** calls on every section BrkAction + * + */ + void BrkAction(); + void BegMarkObj(const Point& _aPnt,const OSectionView* _pSection); + + private: + void BegDragObj_createInvisibleObjectAtPosition(const tools::Rectangle& _aRect, const OSectionView& _rSection); + void EndDragObj_removeInvisibleObjects(); + Point m_aDragDelta; + ::std::vector<SdrObject*> m_aBegDragTempList; + public: + void BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionView* _pSection); + void EndDragObj(bool _bDragIntoNewSection,const OSectionView* _pSection,const Point& _aPnt); + + void EndAction(); + void ForceMarkedToAnotherPage(); + bool IsAction() const; + bool IsDragObj() const; + void handleKey(const vcl::KeyCode& _rCode); + void stopScrollTimer(); + + /** return the section at the given point which is relative to the given section + * + * \param _pSection the section which is used as reference point + * \param _rPnt the point, it will be changed that it is inside the section which will be returned + * \return the section + */ + OSectionView* getSectionRelativeToPosition(const OSectionView* _pSection,Point& _rPnt); + + void MovAction(const Point& rPnt,const OSectionView* _pSection, bool _bControlKeySet); + + sal_uInt32 getMarkedObjectCount() const; + + /** fills the positions of all collapsed sections. + * + * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections. + */ + void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const; + + /** collapse all sections given by their position + * + * \param _aCollapsedSections The position of the sections which should be collapsed. + */ + void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections); + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + + void scrollChildren(const Point& _aThumbPos); + + /** fills the vector with all selected control models + /param _rSelection The vector will be filled and will not be cleared before. + */ + void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const; + }; + +} // rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_VIEWSWINDOW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx new file mode 100644 index 000000000..54a0baab3 --- /dev/null +++ b/reportdesign/source/ui/inc/dlgedclip.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_REPORTDESIGN_SOURCE_UI_INC_DLGEDCLIP_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDCLIP_HXX + +#include <vcl/transfer.hxx> +#include <com/sun/star/beans/NamedValue.hpp> + +namespace rptui +{ + +// OReportExchange + +/** \class OReportExchange + * \brief defines a clipboard format for copying selection elements. + * \ingroup reportdesign_source_ui_report + * + * + */ +class OReportExchange : public TransferableHelper +{ +public: + typedef css::uno::Sequence< css::beans::NamedValue > TSectionElements; + + /** Constructs a new exchange object with section elements + * + * \param _rCopyElements the elements to copy. Each section is one entry. The value must be a sequence of elements. + * \return + */ + OReportExchange( const TSectionElements& _rCopyElements); + + /** checks whether or not a descriptor can be extracted from the data flavor vector given + * + * \param _rFlavors + available flavors + * \return + */ + static bool canExtract(const DataFlavorExVector& _rFlavors); + + /** extract the section elements + * + * \param _rData the clipboard data + * \return the copied elements + */ + static TSectionElements extractCopies(const TransferableDataHelper& _rData); + + /** returns the format id. + * + * \return the registered format id + */ + static SotClipboardFormatId getDescriptorFormatId(); + +protected: + // TransferableHelper overridables + virtual void AddSupportedFormats() override; + virtual bool GetData( const css::datatransfer::DataFlavor& rFlavor, const OUString& rDestDoc ) override; +private: + TSectionElements m_aCopyElements; +}; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDCLIP_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/dlgedfac.hxx b/reportdesign/source/ui/inc/dlgedfac.hxx new file mode 100644 index 000000000..f35d65757 --- /dev/null +++ b/reportdesign/source/ui/inc/dlgedfac.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_REPORTDESIGN_SOURCE_UI_INC_DLGEDFAC_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDFAC_HXX + + +#include <svx/svdobj.hxx> +#include <tools/link.hxx> + +namespace rptui +{ + +// DlgEdFactory + +class DlgEdFactory +{ +public: + DlgEdFactory(); + ~DlgEdFactory() COVERITY_NOEXCEPT_FALSE; + + DECL_STATIC_LINK( DlgEdFactory, MakeObject, SdrObjCreatorParams, SdrObject* ); +}; +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDFAC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/dlgedfunc.hxx b/reportdesign/source/ui/inc/dlgedfunc.hxx new file mode 100644 index 000000000..804b814ee --- /dev/null +++ b/reportdesign/source/ui/inc/dlgedfunc.hxx @@ -0,0 +1,155 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_DLGEDFUNC_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDFUNC_HXX + +#include <tools/gen.hxx> +#include <vcl/event.hxx> +#include <vcl/timer.hxx> +#include <com/sun/star/uno/XInterface.hpp> + +class Timer; +class MouseEvent; +class Point; +class SdrTextObj; +class SdrObject; +namespace rptui +{ + +class OReportSection; +class OSectionView; + + +// DlgEdFunc + + +class DlgEdFunc /* : public LinkHdl */ +{ + DlgEdFunc(const DlgEdFunc&) = delete; + void operator =(const DlgEdFunc&) = delete; +protected: + VclPtr<OReportSection> m_pParent; + OSectionView& m_rView; + Timer aScrollTimer; + Point m_aMDPos; + css::uno::Reference<css::uno::XInterface> m_xOverlappingObj; + SdrObject * m_pOverlappingObj; + Color m_nOverlappedControlColor; + Color m_nOldColor; + bool m_bSelectionMode; + bool m_bUiActive; + bool m_bShowPropertyBrowser; + + DECL_LINK( ScrollTimeout, Timer *, void ); + void ForceScroll( const Point& rPos ); + /** checks that no other object is overlapped. + * + * \param rMEvt + */ + void checkMovementAllowed(const MouseEvent& rMEvt); + + /** sets the correct mouse pointer when moving an object + * + * \param rMEvt + * \return <TRUE/> when the pointer was already set. + */ + bool setMovementPointer(const MouseEvent& rMEvt); + + bool isRectangleHit(const MouseEvent& rMEvt); + /** + returns true, as long as only customshapes in the marked list, + custom shapes can drop every where + */ + bool isOnlyCustomShapeMarked() const; + + /** activate object if it is of type OBJ_OLE2 + */ + void activateOle(SdrObject* _pObj); + + void checkTwoCklicks(const MouseEvent& rMEvt); + +public: + DlgEdFunc( OReportSection* pParent ); + virtual ~DlgEdFunc(); + + virtual bool MouseButtonDown( const MouseEvent& rMEvt ); + virtual bool MouseButtonUp( const MouseEvent& rMEvt ); + virtual bool MouseMove( const MouseEvent& rMEvt ); + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + bool handleKeyEvent(const KeyEvent& _rEvent); + + /** returns <TRUE/> if the mouse event is over an existing object + * + * \param rMEvt + * \return <TRUE/> if overlapping, otherwise <FALSE/> + */ + bool isOverlapping(const MouseEvent& rMEvt); + void setOverlappedControlColor(Color _nColor); + void stopScrollTimer(); + + /** deactivate all ole object + */ + void deactivateOle(bool _bSelect = false); + + bool isUiActive() const { return m_bUiActive; } +protected: + void colorizeOverlappedObject(SdrObject* _pOverlappedObj); + void unColorizeOverlappedObj(); + + +}; + + +// DlgEdFuncInsert + + +class DlgEdFuncInsert : public DlgEdFunc +{ +public: + DlgEdFuncInsert( OReportSection* pParent ); + virtual ~DlgEdFuncInsert() override; + + virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual bool MouseMove( const MouseEvent& rMEvt ) override; +}; + + +// DlgEdFuncSelect + + +class DlgEdFuncSelect : public DlgEdFunc +{ +public: + DlgEdFuncSelect( OReportSection* pParent ); + virtual ~DlgEdFuncSelect() override; + + virtual bool MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual bool MouseButtonUp( const MouseEvent& rMEvt ) override; + virtual bool MouseMove( const MouseEvent& rMEvt ) override; +}; + +} +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGEDFUNC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/dlgpage.hxx b/reportdesign/source/ui/inc/dlgpage.hxx new file mode 100644 index 000000000..5bebf0958 --- /dev/null +++ b/reportdesign/source/ui/inc/dlgpage.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_REPORTDESIGN_SOURCE_UI_INC_DLGPAGE_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGPAGE_HXX + +#include <sfx2/tabdlg.hxx> + +namespace rptui +{ +/************************************************************************* +|* +|* Page setup tab dialog +|* +\************************************************************************/ +class ORptPageDialog : public SfxTabDialogController +{ +private: + ORptPageDialog(const ORptPageDialog&) = delete; + void operator =(const ORptPageDialog&) = delete; + +public: + + ORptPageDialog(weld::Window* pParent, const SfxItemSet* pAttr, const OUString &rDialog); + virtual void PageCreated(const OString& rId, SfxTabPage &rPage) override; +}; + +} // namespace rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DLGPAGE_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx new file mode 100644 index 000000000..63281076d --- /dev/null +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -0,0 +1,146 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_METADATA_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_METADATA_HXX + +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/inspection/XPropertyHandler.hpp> +#include <o3tl/typed_flags_set.hxx> +#include <vector> + + //= UI flags (for all browsable properties) +enum class PropUIFlags { + NONE = 0x0001, // no special flag + Composeable = 0x0002, // the property is "composeable", i.e. an intersection of property + // sets should expose it, if all elements do + DataProperty = 0x0004 // the property is to appear on the "Data" page +}; +namespace o3tl { + template<> struct typed_flags<PropUIFlags> : is_typed_flags<PropUIFlags, 0x0007> {}; +} + + +namespace rptui +{ + + + struct OPropertyInfoImpl; + + + //= OPropertyInfoService + + class OPropertyInfoService final + { + public: + // IPropertyInfoService + static sal_Int32 getPropertyId(const OUString& _rName); + static OUString getPropertyTranslation(sal_Int32 _nId); + static OString getPropertyHelpId(sal_Int32 _nId); + static PropUIFlags getPropertyUIFlags(sal_Int32 _nId); + static void getExcludeProperties(::std::vector< css::beans::Property >& _rExcludeProperties,const css::uno::Reference< css::inspection::XPropertyHandler >& _xFormComponentHandler); + + static bool isComposable( + const OUString& _rPropertyName, + const css::uno::Reference< css::inspection::XPropertyHandler >& _xFormComponentHandler + ); + + private: + static const OPropertyInfoImpl* getPropertyInfo(); + + static const OPropertyInfoImpl* getPropertyInfo(const OUString& _rName); + static const OPropertyInfoImpl* getPropertyInfo(sal_Int32 _nId); + + OPropertyInfoService(const OPropertyInfoService&) = delete; + void operator =(const OPropertyInfoService&) = delete; + OPropertyInfoService() = delete; + + static sal_uInt16 s_nCount; + static OPropertyInfoImpl* s_pPropertyInfos; + // TODO: a real structure which allows quick access by name as well as by id + }; + + + //= HelpIdUrl + + /// small helper to translate help ids into help urls + class HelpIdUrl + { + public: + static OUString getHelpURL( const OString& _sHelpId ); + }; + + + //= property ids (for all browsable properties) + //= The ID is used for the view order in the property browser. + + + #define PROPERTY_ID_FORCENEWPAGE 1 + #define PROPERTY_ID_NEWROWORCOL 2 + #define PROPERTY_ID_KEEPTOGETHER 3 + #define PROPERTY_ID_CANGROW 4 + #define PROPERTY_ID_CANSHRINK 5 + #define PROPERTY_ID_REPEATSECTION 6 + #define PROPERTY_ID_PRESERVEIRI 7 + #define PROPERTY_ID_VISIBLE 8 + #define PROPERTY_ID_GROUPKEEPTOGETHER 9 + #define PROPERTY_ID_PAGEHEADEROPTION 10 + #define PROPERTY_ID_PAGEFOOTEROPTION 11 + #define PROPERTY_ID_POSITIONX 12 + #define PROPERTY_ID_POSITIONY 13 + #define PROPERTY_ID_WIDTH 14 + #define PROPERTY_ID_HEIGHT 15 + #define PROPERTY_ID_AUTOGROW 16 + #define PROPERTY_ID_FORMULA 17 + #define PROPERTY_ID_CONDITIONALPRINTEXPRESSION 18 + #define PROPERTY_ID_PRINTREPEATEDVALUES 19 + #define PROPERTY_ID_PRINTWHENGROUPCHANGE 20 + #define PROPERTY_ID_INITIALFORMULA 21 + #define PROPERTY_ID_STARTNEWCOLUMN 22 + #define PROPERTY_ID_TYPE 23 + #define PROPERTY_ID_DATAFIELD 24 + #define PROPERTY_ID_CHARFONTNAME 25 + #define PROPERTY_ID_DEEPTRAVERSING 26 + #define PROPERTY_ID_PREEVALUATED 27 + + #define PROPERTY_ID_BACKTRANSPARENT 28 + #define PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT 29 + #define PROPERTY_ID_BACKCOLOR 30 + #define PROPERTY_ID_CONTROLBACKGROUND 31 + + #define PROPERTY_ID_FORMULALIST 32 + #define PROPERTY_ID_SCOPE 33 + #define PROPERTY_ID_RESETPAGENUMBER 34 + #define PROPERTY_ID_CHARTTYPE 35 + #define PROPERTY_ID_MASTERFIELDS 36 + #define PROPERTY_ID_DETAILFIELDS 37 + #define PROPERTY_ID_PREVIEW_COUNT 38 + #define PROPERTY_ID_AREA 39 + #define PROPERTY_ID_MIMETYPE 40 + + #define PROPERTY_ID_FONT 41 + #define PROPERTY_ID_PARAADJUST 42 + #define PROPERTY_ID_VERTICALALIGN 43 + + +} // namespace rptui + + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_METADATA_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/propbrw.hxx b/reportdesign/source/ui/inc/propbrw.hxx new file mode 100644 index 000000000..5b697df05 --- /dev/null +++ b/reportdesign/source/ui/inc/propbrw.hxx @@ -0,0 +1,103 @@ +/* -*- 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_REPORTDESIGN_SOURCE_UI_INC_PROPBRW_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_PROPBRW_HXX + +#include <com/sun/star/frame/XFrame2.hpp> +#include <com/sun/star/inspection/XObjectInspector.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <svl/SfxBroadcaster.hxx> +#include <svl/lstner.hxx> +#include <vcl/dockwin.hxx> +#include <vcl/layout.hxx> +#include <svx/svdmark.hxx> + +namespace rptui +{ + +class OSectionView; +class ODesignView; +class OObjectBase; + +// PropBrw + + +class PropBrw final : public DockingWindow , public SfxListener, public SfxBroadcaster +{ + VclPtr<VclVBox> m_xContentArea; + + css::uno::Reference< css::uno::XComponentContext > + m_xInspectorContext; + css::uno::Reference< css::uno::XComponentContext > + m_xORB; + css::uno::Reference< css::frame::XFrame2 > + m_xMeAsFrame; + css::uno::Reference< css::inspection::XObjectInspector > + m_xBrowserController; + css::uno::Reference< css::uno::XInterface> + m_xLastSection; /// is the previously displayed section + OUString m_sLastActivePage; + VclPtr<ODesignView> m_pDesignView; + OSectionView* m_pView; + bool m_bInitialStateChange; + + PropBrw(PropBrw const &) = delete; + void operator =(PropBrw const &) = delete; + + virtual bool Close() override; + + css::uno::Sequence< css::uno::Reference< css::uno::XInterface> > + CreateCompPropSet(const SdrMarkList& rMarkList); + + void implSetNewObject( + const css::uno::Sequence< css::uno::Reference< css::uno::XInterface> >& _aObjects = css::uno::Sequence< css::uno::Reference< css::uno::XInterface> >()); + + static OUString GetHeadlineName( + const css::uno::Sequence< css::uno::Reference< css::uno::XInterface> >& _aObjects); + + void implDetachController(); + css::uno::Reference< css::uno::XInterface> CreateComponentPair(OObjectBase* _pObj); + css::uno::Reference< css::uno::XInterface> CreateComponentPair( + const css::uno::Reference< css::uno::XInterface>& _xFormComponent + ,const css::uno::Reference< css::uno::XInterface>& _xReportComponent); + DECL_LINK( OnAsyncGetFocus, void*, void ); + +public: + PropBrw(const css::uno::Reference< css::uno::XComponentContext >& _xORB + ,Window* pParent + ,ODesignView* _pDesignView); + virtual ~PropBrw() override; + virtual void dispose() override; + + virtual void LoseFocus() override; + + void Update( OSectionView* m_pView ); + void Update( const css::uno::Reference< css::uno::XInterface>& _xReportComponent); + OUString getCurrentPage() const; + void setCurrentPage(const OUString& _sLastActivePage); + + ::Size getMinimumSize() const; +}; + +} // rptui + +#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_PROPBRW_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/reportdesign/source/ui/inc/statusbarcontroller.hxx b/reportdesign/source/ui/inc/statusbarcontroller.hxx new file mode 100644 index 000000000..be539ec25 --- /dev/null +++ b/reportdesign/source/ui/inc/statusbarcontroller.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/. + * + * 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_REPORTDESIGN_SOURCE_UI_INC_STATUSBARCONTROLLER_HXX +#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_STATUSBARCONTROLLER_HXX + +#include <svtools/statusbarcontroller.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase1.hxx> + +class SfxStatusBarControl; +namespace rptui +{ + typedef ::cppu::ImplHelper1 < css::lang::XServiceInfo> OStatusbarController_BASE; + class OStatusbarController : public ::svt::StatusbarController, + public OStatusbarController_BASE + { + css::uno::Reference< css::frame::XStatusbarController > m_rController; + sal_uInt16 m_nSlotId; + sal_uInt16 m_nId; + public: + OStatusbarController(const css::uno::Reference< css::uno::XComponentContext >& _rxORB); + + /// @throws css::uno::RuntimeException + static OUString getImplementationName_Static(); + /// @throws css::uno::RuntimeException + static css::uno::Sequence< OUString > getSupportedServiceNames_Static(); + static css::uno::Reference< css::uno::XInterface > + create(css::uno::Reference< css::uno::XComponentContext > const & xContext); + + private: + void SAL_CALL dispose() override; + // XInterface + DECLARE_XINTERFACE( ) + // XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual css::uno::Sequence< OUString> SAL_CALL getSupportedServiceNames() override; + // need by registration + + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override; + + // XUpdatable + virtual void SAL_CALL update() override; + + // XStatusListener + virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) override; + + // XStatusbarController + virtual sal_Bool SAL_CALL mouseButtonDown( const css::awt::MouseEvent& aMouseEvent ) override; + virtual sal_Bool SAL_CALL mouseMove( const css::awt::MouseEvent& aMouseEvent ) override; + virtual sal_Bool SAL_CALL mouseButtonUp( const css::awt::MouseEvent& aMouseEvent ) override; + virtual void SAL_CALL command( const css::awt::Point& aPos, + ::sal_Int32 nCommand, + sal_Bool bMouseEvent, + const css::uno::Any& aData ) override; + virtual void SAL_CALL paint( const css::uno::Reference< css::awt::XGraphics >& xGraphics, + const css::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nStyle ) override; + virtual void SAL_CALL click( const css::awt::Point& aPos ) override; + virtual void SAL_CALL doubleClick( const css::awt::Point& aPos ) override; + }; +} +#endif // DBAUI_STATUSBARCONTROLLER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |