diff options
Diffstat (limited to 'reportdesign/source/ui/inc')
43 files changed, 5732 insertions, 0 deletions
diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx new file mode 100644 index 000000000000..fe9cbff6aa6c --- /dev/null +++ b/reportdesign/source/ui/inc/AddField.hxx @@ -0,0 +1,143 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPTUI_ADDFIELDWINDOW_HXX +#define RPTUI_ADDFIELDWINDOW_HXX + +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <svtools/transfer.hxx> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <svtools/svtreebx.hxx> +#include <svtools/transfer.hxx> +#include <vcl/floatwin.hxx> +#include <comphelper/propmultiplex.hxx> +#include <comphelper/containermultiplexer.hxx> +#include <vcl/button.hxx> + +#include <svx/dataaccessdescriptor.hxx> +#include "cppuhelper/basemutex.hxx" +#include <dbaccess/ToolBoxHelper.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/fixed.hxx> + +#include <rtl/ref.hxx> + +namespace rptui +{ +//================================================================== +class OAddFieldWindow; +class OAddFieldWindowListBox; +//======================================================================== +class OAddFieldWindow :public FloatingWindow + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + , public ::comphelper::OContainerListener + , public dbaui::OToolBoxHelper +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent> m_xHoldAlive; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet; + + ToolBox m_aActions; + + ::std::auto_ptr<OAddFieldWindowListBox> m_pListBox; + FixedLine m_aFixedLine; + FixedText m_aHelpText; + + PushButton m_aInsertButton; + Link m_aCreateLink; + ::rtl::OUString m_aCommandName; + ::rtl::OUString m_sFilter; + sal_Int32 m_nCommandType; + sal_Bool m_bEscapeProcessing; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener; + ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener; + + DECL_LINK( OnDoubleClickHdl, void* ); + DECL_LINK( OnSelectHdl, void* ); + DECL_LINK( OnSortAction, ToolBox* ); + + OAddFieldWindow(const OAddFieldWindow&); + void operator =(const OAddFieldWindow&); +public: + OAddFieldWindow(Window* pParent + , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet); + + virtual ~OAddFieldWindow(); + virtual void Resize(); + virtual void GetFocus(); + virtual long PreNotify( NotifyEvent& _rNEvt ); + + inline const ::rtl::OUString& GetCommand() const { return m_aCommandName; } + inline sal_Int32 GetCommandType() const { return m_nCommandType; } + inline sal_Bool GetEscapeProcessing() const { return m_bEscapeProcessing; } + inline void SetCreateHdl(const Link& _aCreateLink) { m_aCreateLink = _aCreateLink; } + + inline ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> getColumns() const { return m_xColumns; } + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const; + + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors(); + + /** will be called when the id of the image list is needed. + @param _eBitmapSet + <svtools/imgdef.hxx> + @param _bHiContast + <TRUE/> when in high contrast mode. + */ + virtual ImageList getImageList(sal_Int16 _eBitmapSet,sal_Bool _bHiContast) const; + + /** will be called when the controls need to be resized. + */ + virtual void resizeControls(const Size& _rDiff); + + /// Updates the current field list + void Update(); + + /** fills the descriptor with the column name, column object, command and command type + * + * \param _pSelected the currently selected + * \param _rDescriptor the descriptor will be filled + */ + void fillDescriptor(SvLBoxEntry* _pSelected,::svx::ODataAccessDescriptor& _rDescriptor); + +private: + // FmXChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException ); + // OContainerListener + virtual void _elementInserted( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException); + virtual void _elementRemoved( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException); + virtual void _elementReplaced( const ::com::sun::star::container::ContainerEvent& _rEvent ) throw(::com::sun::star::uno::RuntimeException); +}; +//============================================================================== +} // rptui +//============================================================================== +#endif // RPTUI_ADDFIELDWINDOW_HXX + diff --git a/reportdesign/source/ui/inc/ColorChanger.hxx b/reportdesign/source/ui/inc/ColorChanger.hxx new file mode 100644 index 000000000000..a2e01c135007 --- /dev/null +++ b/reportdesign/source/ui/inc/ColorChanger.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_COLORCHANGER_HXX +#define RPTUI_COLORCHANGER_HXX + +namespace rptui +{ + //===================================================================== + //= ColorChanger + //===================================================================== + class ColorChanger + { + protected: + OutputDevice* m_pDev; + + public: + ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor) + :m_pDev( _pDev ) + { + m_pDev->Push( PUSH_LINECOLOR ); + m_pDev->SetLineColor( _rNewLineColor ); + } + ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor ) + :m_pDev( _pDev ) + { + m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR ); + m_pDev->SetLineColor( _rNewLineColor ); + m_pDev->SetFillColor( _rNewFillColor ); + } + ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor, const Color& _rNewFillColor, const Color& _rNewTextColor ) + :m_pDev( _pDev ) + { + m_pDev->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR | PUSH_TEXTCOLOR); + m_pDev->SetLineColor( _rNewLineColor ); + m_pDev->SetFillColor( _rNewFillColor ); + m_pDev->SetTextColor( _rNewTextColor ); + } + + ~ColorChanger() + { + m_pDev->Pop(); + } + }; +} +#endif //RPTUI_COLORCHANGER_HXX + diff --git a/reportdesign/source/ui/inc/ColorListener.hxx b/reportdesign/source/ui/inc/ColorListener.hxx new file mode 100644 index 000000000000..4216e39a3652 --- /dev/null +++ b/reportdesign/source/ui/inc/ColorListener.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_COLORLISTENER_HXX +#define RPTUI_COLORLISTENER_HXX + +#include <vcl/window.hxx> +#include <svtools/colorcfg.hxx> +#include <svtools/extcolorcfg.hxx> +#include "ModuleHelper.hxx" +#include <tools/link.hxx> + +namespace rptui +{ + class OColorListener : public Window, public SfxListener + { + OColorListener(const OColorListener&); + void operator =(const OColorListener&); + protected: + OModuleClient m_aModuleClient; + Link m_aCollapsedLink; + svtools::ColorConfig m_aColorConfig; + svtools::ExtendedColorConfig m_aExtendedColorConfig; + ::rtl::OUString m_sColorEntry; + sal_Int32 m_nColor; + sal_Int32 m_nTextBoundaries; + sal_Bool m_bCollapsed; + sal_Bool m_bMarked; + + virtual void ImplInitSettings() = 0; + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + public: + OColorListener(Window* _pParent,const ::rtl::OUString& _sColorEntry); + virtual ~OColorListener(); + + using Window::Notify; + // SfxListener + virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint); + + /** set the marker as marked or not marked + @param _bMark set the new state of the marker + */ + void setMarked(sal_Bool _bMark); + + /** returns if the section is marked + */ + inline sal_Bool isMarked() const { return m_bMarked; } + + inline void setCollapsedHdl(const Link& _aLink ){ m_aCollapsedLink = _aLink; } + inline sal_Bool isCollapsed() const { return m_bCollapsed; } + + /** collapse or expand + * + * \param _bCollapsed + */ + virtual void setCollapsed(sal_Bool _bCollapsed); + }; +} +#endif // RPTUI_COLORLISTENER_HXX + diff --git a/reportdesign/source/ui/inc/ColumnInfo.hxx b/reportdesign/source/ui/inc/ColumnInfo.hxx new file mode 100644 index 000000000000..392a141e6382 --- /dev/null +++ b/reportdesign/source/ui/inc/ColumnInfo.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: AddField.cxx,v $ + * $Revision: 1.5 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_COLUMNINFO_HXX +#define RPTUI_COLUMNINFO_HXX + +#include <rtl/ustring.hxx> + +namespace rptui +{ + struct ColumnInfo + { + ::rtl::OUString sColumnName; + ::rtl::OUString sLabel; + bool bColumn; + ColumnInfo(const ::rtl::OUString& i_sColumnName,const ::rtl::OUString& i_sLabel) + : sColumnName(i_sColumnName) + , sLabel(i_sLabel) + , bColumn(true) + { + } + ColumnInfo(const ::rtl::OUString& i_sColumnName) + : sColumnName(i_sColumnName) + , bColumn(false) + { + } + }; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // RPTUI_COLUMNINFO_HXX diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx new file mode 100644 index 000000000000..79907f4e5e87 --- /dev/null +++ b/reportdesign/source/ui/inc/CondFormat.hxx @@ -0,0 +1,186 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPTUI_CONDFORMAT_HXX +#define RPTUI_CONDFORMAT_HXX + +#include "ModuleHelper.hxx" + +#include <com/sun/star/report/XReportControlModel.hpp> + +#include <vcl/dialog.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/scrbar.hxx> + +#include <boost/shared_ptr.hpp> +#include <boost/noncopyable.hpp> + +#include <vector> + +// ............................................................................. +namespace rptui +{ +// ............................................................................. + + #define MAX_CONDITIONS (size_t)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, USHORT _nCommandId, const ::Color _aColor ) = 0; + virtual void moveConditionUp( size_t _nCondIndex ) = 0; + virtual void moveConditionDown( size_t _nCondIndex ) = 0; + virtual ::rtl::OUString getDataField() const = 0; + }; + + /************************************************************************* + |* + |* Conditional formatting dialog + |* + \************************************************************************/ + class ConditionalFormattingDialog :public ModalDialog + ,public IConditionalFormatAction + ,private ::boost::noncopyable + { + typedef ::boost::shared_ptr< Condition > ConditionPtr; + typedef ::std::vector< ConditionPtr > Conditions; + + OModuleClient m_aModuleClient; + Window m_aConditionPlayground; + Conditions m_aConditions; + FixedLine m_aSeparator; + OKButton m_aPB_OK; + CancelButton m_aPB_CANCEL; + HelpButton m_aPB_Help; + ScrollBar m_aCondScroll; + + ::rptui::OReportController& m_rController; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel > + m_xFormatConditions; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel > + m_xCopy; + + bool m_bDeletingCondition; + + public: + ConditionalFormattingDialog( + Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel>& _xHoldAlive, + ::rptui::OReportController& _rController + ); + virtual ~ConditionalFormattingDialog(); + + // Dialog overridables + virtual short Execute(); + + // IConditionalFormatAction overridables + virtual void addCondition( size_t _nAddAfterIndex ); + virtual void deleteCondition( size_t _nCondIndex ); + virtual void applyCommand( size_t _nCondIndex, USHORT _nCommandId, const ::Color _aColor ); + virtual void moveConditionUp( size_t _nCondIndex ); + virtual void moveConditionDown( size_t _nCondIndex ); + virtual ::rtl::OUString getDataField() const; + + protected: + virtual long PreNotify( NotifyEvent& rNEvt ); + + private: + DECL_LINK( OnScroll, ScrollBar* ); + + 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(); + + /// does the layout for the condition windows + void impl_layoutConditions( Point& _out_rBelowLastVisible ); + + /// 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; + + /// determines the width of a Condition + long impl_getConditionWidth() const; + + /// focuses the condition with the given index, making it visible if necessary + void impl_focusCondition( size_t _nCondIndex ); + + /// updates the scrollbar range. (does not update the scrollbar visibility) + void impl_updateScrollBarRange(); + + /// determines whether we need a scrollbar for the conditions + bool impl_needScrollBar() const { return m_aConditions.size() > MAX_CONDITIONS; } + + /// 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 ); + }; + +// ............................................................................. +} // namespace rptui +// ............................................................................. + +#endif // RPTUI_CONDFORMAT_HXX diff --git a/reportdesign/source/ui/inc/DataProviderHandler.hxx b/reportdesign/source/ui/inc/DataProviderHandler.hxx new file mode 100644 index 000000000000..d5b3221f7745 --- /dev/null +++ b/reportdesign/source/ui/inc/DataProviderHandler.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPT_DATAPROVIDERHANDLER_HXX +#define RPT_DATAPROVIDERHANDLER_HXX + +#include "sal/config.h" + +#include "cppuhelper/compbase2.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" + +#include <memory> + +//........................................................................ +namespace rptui +{ +//........................................................................ + + class OPropertyInfoService; + + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::inspection::XPropertyHandler + , ::com::sun::star::lang::XServiceInfo> DataProviderHandler_Base; + + class DataProviderHandler: + private ::cppu::BaseMutex, + public DataProviderHandler_Base + { + public: + // XServiceInfo - static versions + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); + + explicit DataProviderHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + private: + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent: + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::inspection::XPropertyHandler: + virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & PropertyValue, const ::com::sun::star::uno::Type & ControlValueType) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual void SAL_CALL addPropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & Listener) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual void SAL_CALL removePropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & _rxListener) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isComposable(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, ::com::sun::star::uno::Any & out_Data, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException); + virtual void SAL_CALL actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const ::com::sun::star::uno::Any & NewValue, const ::com::sun::star::uno::Any & OldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual ::sal_Bool SAL_CALL suspend(::sal_Bool Suspend) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual ~DataProviderHandler() {} + private: + DataProviderHandler(DataProviderHandler &); // not defined + void operator =(DataProviderHandler &); // not defined + + + bool impl_dialogLinkedFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; + bool impl_dialogChartType_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const; + void impl_updateChartTitle_throw(const ::com::sun::star::uno::Any& _aValue); + + // overload 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(); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDatabaseDataProvider> m_xDataProvider; /// inspectee + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xFormComponent; /// inspectee + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > m_xReportComponent; /// inspectee + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument> m_xChartModel; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xMasterDetails; + /// type converter, needed on various occasions + ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter; + ::std::auto_ptr< OPropertyInfoService > m_pInfoService; + }; +//........................................................................ +} // namespace rptui +//........................................................................ + +#endif // RPT_DATAPROVIDERHANDLER_HXX diff --git a/reportdesign/source/ui/inc/DateTime.hxx b/reportdesign/source/ui/inc/DateTime.hxx new file mode 100644 index 000000000000..1526e5978331 --- /dev/null +++ b/reportdesign/source/ui/inc/DateTime.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_DATETIME_HXX +#define RPTUI_DATETIME_HXX + +#ifndef _DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <com/sun/star/report/XReportDefinition.hpp> +#include <com/sun/star/util/XNumberFormats.hpp> +#include <com/sun/star/lang/Locale.hpp> + +#include <svtools/dialogcontrolling.hxx> + +namespace rptui +{ +class OReportController; +/************************************************************************* +|* +|* Groups and Sorting dialog +|* +\************************************************************************/ +class ODateTimeDialog : public ModalDialog +{ + // FixedLine m_aFLDate; + CheckBox m_aDate; + FixedText m_aFTDateFormat; + ListBox m_aDateListBox; + FixedLine m_aFL0; + CheckBox m_aTime; + FixedText m_aFTTimeFormat; + ListBox m_aTimeListBox; + FixedLine m_aFL1; + OKButton m_aPB_OK; + CancelButton m_aPB_CANCEL; + HelpButton m_aPB_Help; + + + svt::ControlDependencyManager m_aDateControlling; + svt::ControlDependencyManager m_aTimeControlling; + + ::rptui::OReportController* m_pController; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> + m_xHoldAlive; + ::com::sun::star::lang::Locale m_nLocale; + + /** returns the frmat string + * + * \param _nNumberFormatKey the number format key + * \param _xFormats + * \param _bTime + * \return + */ + ::rtl::OUString getFormatStringByKey(::sal_Int32 _nNumberFormatKey,const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormats>& _xFormats,bool _bTime); + + /** returns the number format key + @param _nNumberFormatIndex the number format index @see com::sun::star::i18n::NumberFormatIndex + */ + sal_Int32 getFormatKey(sal_Bool _bDate) const; + + DECL_LINK( CBClickHdl, CheckBox* ); + ODateTimeDialog(const ODateTimeDialog&); + void operator =(const ODateTimeDialog&); + + // fill methods + void InsertEntry(sal_Int16 _nNumberFormatId); +public: + ODateTimeDialog( Window* pParent + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xHoldAlive + ,::rptui::OReportController* _pController); + virtual ~ODateTimeDialog(); + virtual short Execute(); +}; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // RPTUI_DATETIME_HXX diff --git a/reportdesign/source/ui/inc/DefaultInspection.hxx b/reportdesign/source/ui/inc/DefaultInspection.hxx new file mode 100644 index 000000000000..a0382ab0e7f8 --- /dev/null +++ b/reportdesign/source/ui/inc/DefaultInspection.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPT_DEFAULTINSPECTION_HXX +#define RPT_DEFAULTINSPECTION_HXX + +/** === begin UNO includes === **/ +#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> +/** === end UNO includes === **/ +#include <cppuhelper/implbase3.hxx> + +#include <memory> + +//........................................................................ +namespace rptui +{ +//........................................................................ + class OPropertyInfoService; + //==================================================================== + //= DefaultComponentInspectorModel + //==================================================================== + typedef ::cppu::WeakAggImplHelper3 < ::com::sun::star::inspection::XObjectInspectorModel + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::lang::XInitialization + > DefaultComponentInspectorModel_Base; + class DefaultComponentInspectorModel : public DefaultComponentInspectorModel_Base + { + private: + ::osl::Mutex m_aMutex; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorModel > m_xComponent; /// delegatee + bool m_bConstructed; + bool m_bHasHelpSection; + sal_Bool m_bIsReadOnly; + sal_Int32 m_nMinHelpTextLines; + sal_Int32 m_nMaxHelpTextLines; + /// access to property meta data + ::std::auto_ptr< OPropertyInfoService > m_pInfoService; + + DefaultComponentInspectorModel(const DefaultComponentInspectorModel&); + DefaultComponentInspectorModel& operator=(const DefaultComponentInspectorModel&); + protected: + virtual ~DefaultComponentInspectorModel(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XObjectInspectorModel + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getHandlerFactories() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getHasHelpSection() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMinHelpTextLines() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMaxHelpTextLines() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL getIsReadOnly() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIsReadOnly( ::sal_Bool _isreadonly ) throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::inspection::PropertyCategoryDescriptor > SAL_CALL describeCategories( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getPropertyOrderIndex( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + public: + // XServiceInfo - static versions + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); + + public: + DefaultComponentInspectorModel( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext); + + protected: + // Service constructors + void createDefault(); + void createWithHelpSection( sal_Int32 _nMinHelpTextLines, sal_Int32 _nMaxHelpTextLines ); + }; + +//........................................................................ +} // namespace rptui +//........................................................................ + +#endif // RPT_DEFAULTINSPECTION_HXX + diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx new file mode 100644 index 000000000000..4da25a831607 --- /dev/null +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_DESIGNVIEW_HXX +#define RPTUI_DESIGNVIEW_HXX + +#include <dbaccess/dataview.hxx> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/report/XReportComponent.hpp> +#include <vcl/split.hxx> +#include <vcl/scrbar.hxx> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/datatransfer/DataFlavor.hpp> +#include <tools/link.hxx> +#include <tools/gen.hxx> +#include <vcl/timer.hxx> +#include <svl/hint.hxx> +#include <svl/brdcst.hxx> +#include <comphelper/stl_types.hxx> +#include "ReportDefines.hxx" +#include <svtools/colorcfg.hxx> +#include <boost/shared_ptr.hpp> +#include <svx/svdedtv.hxx> +#include <vcl/tabpage.hxx> +#include <vcl/splitwin.hxx> +#include <MarkedSection.hxx> +#include "ScrollHelper.hxx" + +class KeyEvent; +class MouseEvent; +class Timer; +class Window; + +namespace rptui +{ + class OReportSection; + class OUnoObject; + class OSectionView; + class OReportController; + class PropBrw; + class OAddFieldWindow; + class OReportModel; + class ONavigator; + //================================================================== + //================================================================== + class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection + { + private: + SplitWindow m_aSplitWin; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent; + OReportController& m_rReportController; + OScrollWindowHelper m_aScrollWindow; + Window* m_pTaskPane; + PropBrw* m_pPropWin; + OAddFieldWindow* m_pAddField; + OSectionView* m_pCurrentView; + ONavigator* m_pReportExplorer; + Timer m_aMarkTimer; + Point m_aScrollOffset; + DlgEdMode m_eMode; + USHORT m_nCurrentPosition; + USHORT m_eActObj; + BOOL m_bFirstDraw; + Size m_aGridSizeCoarse; + Size m_aGridSizeFine; + BOOL m_bGridVisible; + BOOL m_bGridSnap; + BOOL m_bDeleted; + + + DECL_LINK( MarkTimeout, Timer * ); + DECL_LINK( SplitHdl, void* ); + + void ImplInitSettings(); + + ODesignView(ODesignView&); + void operator =(ODesignView&); + protected: + // return the Rectangle where I can paint myself + virtual void resizeDocumentView(Rectangle& rRect); + // return the Rectangle where I can paint myself + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + + public: + ODesignView(Window* pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&, + OReportController& _rController); + virtual ~ODesignView(); + + // window overloads + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual long PreNotify( NotifyEvent& rNEvt ); + virtual void GetFocus(); + + // set the view readonly or not + virtual void setReadOnly(sal_Bool _bReadOnly); + + virtual void initialize(); + + inline OReportController& getController() const { return m_rReportController; } + + void SetMode( DlgEdMode m_eMode ); + void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString()); + USHORT GetInsertObj() const; + rtl::OUString 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(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false); + +#if 0 + /** checks if alignment is possible in the current section + */ + sal_Bool isAlignPossible() const; +#endif + + /** All objects will be marked. + */ + void SelectAll(const sal_uInt16 _nObjectType); + + /// checks if a selection exists + BOOL HasSelection() const; + + void UpdatePropertyBrowserDelayed(OSectionView& _rView); + + USHORT getSectionCount() const; + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(USHORT _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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + ,const ::rtl::OUString& _sColorEntry + ,USHORT _nPosition = USHRT_MAX); + + inline Size getGridSizeCoarse() const { return m_aGridSizeCoarse; } + inline Size getGridSizeFine() const { return m_aGridSizeFine; } + inline BOOL isGridSnap() const { return m_bGridSnap; } + void setGridSnap(BOOL bOn); + void setDragStripes(BOOL bOn); + /** turns the grid on or off + * + * \param _bGridVisible + */ + void toggleGrid(sal_Bool _bGridVisible); + + void togglePropertyBrowser(sal_Bool _bToogleOn); + + BOOL isAddFieldVisible() const; + void toggleAddField(); + + BOOL isReportExplorerVisible() const; + void toggleReportExplorer(); + + /** shows or hides the ruler. + */ + void showRuler(sal_Bool _bShow); + + /** unmark all objects on the views without the given one. + * + * @param _pSectionView The view where the objects should not be unmarked. + */ + void unmarkAllObjects(OSectionView* _pSectionView); + + /** triggers the property browser with the section + @param _xReportComponent the report component + */ + void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent); + ::com::sun::star::uno::Any getCurrentlyShownProperty() const; + + /** returns the current section or the detail section if no section was selected previously + */ + ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getCurrentSection() const; + + /** returns the current control report model or <NULL/> + */ + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const; + + // IMarkedSection + ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + virtual void markSection(const sal_uInt16 _nPos); + + /** 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; + + /** collpase all sections given by their position + * + * \param _aCollpasedSections The position of the sections which should be collapsed. + */ + void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections); + + ::rtl::OUString getCurrentPage() const; + void setCurrentPage(const ::rtl::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/> + */ + sal_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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark); + + /** returns if the view handles the event by itself + * + * \param _nId the command id + * \return <FALSE/> is the event is not handled by the view otherwise <TRUE/> + */ + sal_Bool isHandleEvent(sal_uInt16 _nId) 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< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; + + /** returns the selected field from the add field dialog + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors(); + + /** calculates the zoom factor. + @param _eType which kind of zoom is needed + */ + sal_uInt16 getZoomFactor(SvxZoomType _eType) const; + }; +//================================================================== +} //rptui +//================================================================== +#endif // RPTUI_DESIGNVIEW_HXX + diff --git a/reportdesign/source/ui/inc/EndMarker.hxx b/reportdesign/source/ui/inc/EndMarker.hxx new file mode 100644 index 000000000000..90655077a167 --- /dev/null +++ b/reportdesign/source/ui/inc/EndMarker.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_ENDMARKER_HXX +#define RPTUI_ENDMARKER_HXX + +#include "ColorListener.hxx" + +namespace rptui +{ + /** \class OEndMarker + * \brief Defines the right side of a graphical section. + */ + class OEndMarker : public OColorListener + { + OEndMarker(OEndMarker&); + void operator =(OEndMarker&); + protected: + virtual void ImplInitSettings(); + public: + OEndMarker(Window* _pParent,const ::rtl::OUString& _sColorEntry); + virtual ~OEndMarker(); + + // windows + virtual void Paint( const Rectangle& rRect ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + }; +} +#endif // RPTUI_ENDMARKER_HXX + diff --git a/reportdesign/source/ui/inc/FixedTextColor.hxx b/reportdesign/source/ui/inc/FixedTextColor.hxx new file mode 100644 index 000000000000..cbec4e46a0c9 --- /dev/null +++ b/reportdesign/source/ui/inc/FixedTextColor.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_FIXEDTEXTCOLOR_HXX +#define INCLUDED_FIXEDTEXTCOLOR_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/report/XFixedText.hpp> +/** === end UNO includes === **/ + +#include <IReportControllerObserver.hxx> + +//#include <boost/noncopyable.hpp> +#include <vector> + +namespace rptui +{ + class OReportController; + + class FixedTextColor : public IReportControllerObserver + { + const OReportController& m_rReportController; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > getVclWindowPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFixedText >& _xComponent) throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > getXControl(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFixedText >& _xFixedText) throw(::com::sun::star::uno::RuntimeException); + + void setPropertyTextColor(const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _xVclWindowPeer, sal_Int32 _nFormatKey); + + // sal_Int32 getTextColor(); + + public: + FixedTextColor(const OReportController & _aObserver); + virtual ~FixedTextColor(); + + void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ); + void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + + }; + +} // namespace rptui + + +#endif diff --git a/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx new file mode 100644 index 000000000000..84119777a160 --- /dev/null +++ b/reportdesign/source/ui/inc/FormattedFieldBeautifier.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX +#define INCLUDED_FORMATTEDFIELDBEAUTIFIER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/awt/XVclWindowPeer.hpp> +#include <com/sun/star/report/XReportComponent.hpp> +/** === end UNO includes === **/ + +//#include <boost/noncopyable.hpp> +#include <vector> +#include <IReportControllerObserver.hxx> + +namespace rptui +{ + class OReportController; + + class FormattedFieldBeautifier : public IReportControllerObserver + { + const OReportController& m_rReportController; + sal_Int32 m_nTextColor; + + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer > getVclWindowPeer(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent >& _xComponent) throw(::com::sun::star::uno::RuntimeException); + + void setPlaceholderText( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent ); + void setPlaceholderText( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XVclWindowPeer >& _xVclWindowPeer, const ::rtl::OUString& _rText ); + + sal_Int32 getTextColor(); + + public: + FormattedFieldBeautifier(const OReportController & _aObserver); + virtual ~FormattedFieldBeautifier(); + + void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ); + void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ); + }; + +} // namespace rptui + + +#endif diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx new file mode 100644 index 000000000000..da9825adf349 --- /dev/null +++ b/reportdesign/source/ui/inc/Formula.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPTUI_FORMULA_HXX +#define RPTUI_FORMULA_HXX + +#include <formula/formula.hxx> +#include <formula/IFunctionDescription.hxx> +#include <formula/IControlReferenceHandler.hxx> +#include <boost/shared_ptr.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/report/meta/XFormulaParser.hpp> + +class SvLBoxEntry; +//============================================================================ +namespace rptui +{ +//============================================================================ +class FunctionManager; +class OAddFieldWindow; + +//============================================================================ +class FormulaDialog : public formula::FormulaModalDialog, + public formula::IFormulaEditorHelper, + public formula::IControlReferenceHandler +{ + ::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager; + formula::FormEditData* m_pFormulaData; + OAddFieldWindow* m_pAddField; + ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > m_xRowSet; + ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFormulaParser> m_xParser; + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper; + formula::RefEdit* m_pEdit; + String m_sFormula; + xub_StrLen m_nStart; + xub_StrLen m_nEnd; + + DECL_LINK( OnClickHdl, OAddFieldWindow*); +public: + FormulaDialog( Window* pParent + , const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _xServiceFactory + , const ::boost::shared_ptr< formula::IFunctionManager >& _pFunctionMgr + , const ::rtl::OUString& _sFormula + , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet); + virtual ~FormulaDialog(); + + // IFormulaEditorHelper + virtual void notifyChange(); + virtual void fill(); + virtual bool calculateValue(const String& _sExpression,String& _rResult); + virtual void doClose(BOOL _bOk); + virtual void insertEntryToLRUList(const formula::IFunctionDescription* pDesc); + virtual void showReference(const String& _sFormula); + virtual void dispatch(BOOL _bOK,BOOL _bMartixChecked); + virtual void setDispatcherLock( BOOL bLock ); + virtual void setReferenceInput(const formula::FormEditData* _pData); + virtual void deleteFormData(); + virtual void clear(); + virtual void switchBack(); + virtual formula::FormEditData* getFormEditData() const; + virtual void setCurrentFormula(const String& _sReplacement); + virtual void setSelection(xub_StrLen _nStart,xub_StrLen _nEnd); + virtual void getSelection(xub_StrLen& _nStart,xub_StrLen& _nEnd) const; + virtual String getCurrentFormula() const; + + virtual formula::IFunctionManager* getFunctionManager(); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const; + virtual ::com::sun::star::table::CellAddress getReferencePosition() const; + + virtual ::std::auto_ptr<formula::FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList); + + // IControlReferenceHandler + virtual void ShowReference(const String& _sRef); + virtual void HideReference( BOOL bDoneRefMode = TRUE ); + virtual void ReleaseFocus( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL ); + virtual void ToggleCollapsed( formula::RefEdit* pEdit, formula::RefButton* pButton = NULL ); + +protected: + void HighlightFunctionParas(const String& aFormula); +}; + +// ============================================================================= +} // rptui +// ============================================================================= + +#endif // RPTUI_FORMULA_HXX + diff --git a/reportdesign/source/ui/inc/FunctionHelper.hxx b/reportdesign/source/ui/inc/FunctionHelper.hxx new file mode 100644 index 000000000000..48da4e0eb180 --- /dev/null +++ b/reportdesign/source/ui/inc/FunctionHelper.hxx @@ -0,0 +1,112 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPTUI_FUNCTIONHELPER_HXX +#define RPTUI_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 <vector> +#include <boost/shared_ptr.hpp> +#include <tools/string.hxx> +#include <comphelper/stl_types.hxx> + + +namespace rptui +{ +//============================================================================ +class FunctionCategory; +class FunctionDescription; +//============================================================================ +class FunctionManager : public formula::IFunctionManager +{ + DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionDescription >, TFunctionsMap); + DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionCategory > , TCategoriesMap); + ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager> m_xMgr; + mutable TCategoriesMap m_aCategories; + mutable ::std::vector< TCategoriesMap::iterator > m_aCategoryIndex; + mutable TFunctionsMap m_aFunctions; +public: + FunctionManager(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager>& _xMgr); + virtual ~FunctionManager(); + virtual sal_uInt32 getCount() const; + virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const; + virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const; + virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const; + virtual sal_Unicode getSingleToken(const EToken _eToken) const; + + ::boost::shared_ptr< FunctionDescription > get(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription) const; +}; +//============================================================================ +class FunctionDescription : public formula::IFunctionDescription +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FunctionArgument > m_aParameter; + ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription> m_xFunctionDescription; + const formula::IFunctionCategory* m_pFunctionCategory; +public: + FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription); + virtual ~FunctionDescription(){} + + virtual ::rtl::OUString getFunctionName() const ; + virtual const formula::IFunctionCategory* getCategory() const ; + virtual ::rtl::OUString getDescription() const ; + virtual xub_StrLen getSuppressedArgumentCount() const ; + virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ; + virtual void fillVisibleArgumentMapping(::std::vector<USHORT>& _rArguments) const ; + virtual void initArgumentInfo() const; + virtual ::rtl::OUString getSignature() const ; + virtual long getHelpId() const ; + virtual sal_uInt32 getParameterCount() const ; + virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ; + virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ; + virtual bool isParameterOptional(sal_uInt32 _nPos) const ; +}; +//============================================================================ +class FunctionCategory : public formula::IFunctionCategory +{ + mutable ::std::vector< ::boost::shared_ptr< FunctionDescription > > m_aFunctions; + ::com::sun::star::uno::Reference< ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory>& _xCategory); + virtual ~FunctionCategory() {} + + virtual sal_uInt32 getCount() const; + virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const; + virtual sal_uInt32 getNumber() const; + virtual const formula::IFunctionManager* getFunctionManager() const; + virtual ::rtl::OUString getName() const; +}; +// ============================================================================= +} // rptui +// ============================================================================= + +#endif //RPTUI_FUNCTIONHELPER_HXX diff --git a/reportdesign/source/ui/inc/GeometryHandler.hxx b/reportdesign/source/ui/inc/GeometryHandler.hxx new file mode 100644 index 000000000000..a03c9d447316 --- /dev/null +++ b/reportdesign/source/ui/inc/GeometryHandler.hxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPT_GEOMETRYHANDLER_HXX +#define RPT_GEOMETRYHANDLER_HXX + +#include "sal/config.h" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "cppuhelper/compbase3.hxx" +#include "cppuhelper/basemutex.hxx" +#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/XReportComponent.hpp" +#include "com/sun/star/report/XFunction.hpp" +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <memory> +#include <comphelper/stl_types.hxx> +#include <comphelper/listenernotification.hxx> +#include "metadata.hxx" + +//........................................................................ +namespace rptui +{ +//........................................................................ + + struct DefaultFunction + { + com::sun::star::beans::Optional< ::rtl::OUString> m_sInitialFormula; + ::rtl::OUString m_sName; + ::rtl::OUString m_sSearchString; + ::rtl::OUString m_sFormula; + ::sal_Bool m_bPreEvaluated; + ::sal_Bool m_bDeepTraversing; + + inline ::rtl::OUString getName() const { return m_sName; } + } ; + + class OPropertyInfoService; + typedef ::std::pair< ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction>, ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier> > TFunctionPair; + typedef ::std::multimap< ::rtl::OUString,TFunctionPair, ::comphelper::UStringMixLess > TFunctions; + typedef ::comphelper::OSimpleListenerContainer < ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::beans::PropertyChangeEvent + > PropertyChangeListeners; + typedef ::cppu::WeakComponentImplHelper3< ::com::sun::star::inspection::XPropertyHandler + , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::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 chosing 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( ::rtl::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 ::rtl::OUString& _sDataField = ::rtl::OUString()) const; + + ::com::sun::star::uno::Any getConstantValue(sal_Bool bToControlValue,sal_uInt16 nResId,const ::com::sun::star::uno::Any& _aValue,const ::rtl::OUString& _sConstantName,const ::rtl::OUString & PropertyName ); + ::com::sun::star::beans::Property getProperty(const ::rtl::OUString & PropertyName); + void implCreateListLikeControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory + ,::com::sun::star::inspection::LineDescriptor & out_Descriptor + ,sal_uInt16 _nResId + ,sal_Bool _bReadOnlyControl + ,sal_Bool _bTrueIfListBoxFalseIfComboBox + ); + void implCreateListLikeControl( + const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory + ,::com::sun::star::inspection::LineDescriptor & out_Descriptor + ,const ::std::vector< ::rtl::OUString>& _aEntries + ,sal_Bool _bReadOnlyControl + ,sal_Bool _bTrueIfListBoxFalseIfComboBox + ); + void checkPosAndSize( const ::com::sun::star::awt::Point& _aNewPos, + const ::com::sun::star::awt::Size& _aSize); + + ::rtl::OUString impl_convertToFormula( const ::com::sun::star::uno::Any& _rControlValue ); + + void impl_initFieldList_nothrow( ::com::sun::star::uno::Sequence< ::rtl::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 ::rtl::OUString& _sFunctionName,const ::rtl::OUString& _sDataField,const DefaultFunction& _aFunction); + + /** check whether the given function name is a countr 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 ::rtl::OUString& _sQuotedFunctionName,::rtl::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 ::rtl::OUString& _sOldFunctionName,const ::rtl::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 ::rtl::OUString& _sName) const; + + /**return all formula in a semicolon seperated list + * + * \param _rList the localized function names + */ + void impl_fillFormulaList_nothrow(::std::vector< ::rtl::OUString >& _out_rList) const; + + /** return all group names in a semicolon seperated 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< ::rtl::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< ::rtl::OUString >& _out_rList) const; + + /** return the one supported output formats of the report definition + * + * \param _sMimetype the mimetype + */ + ::rtl::OUString impl_ConvertMimeTypeToUI_nothrow(const ::rtl::OUString& _sMimetype) const; + + /** return the MimeType for the given UI Name + * + * \param _sUIName the doc ui name + */ + ::rtl::OUString impl_ConvertUIToMimeType_nothrow(const ::rtl::OUString& _sUIName) const; + + /** get the functions supplier for the set scope, default is the surrounding group. + * + * \param _rsNamePostFix the name post fix which canbe used when the scope as name part is needed + * \return the function supplier + */ + ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier> fillScope_throw(::rtl::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 teh function supplier to search or empty if not used + * \param _bSet If set to TRUE than the m_sDefaultFunction and m_sScope vars will be set if successful. + * \return sal_True with known otherwise sal_False + */ + sal_Bool isDefaultFunction(const ::rtl::OUString& _sQuotedFunction + ,::rtl::OUString& _Out_rDataField + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier>& _xFunctionsSupplier = ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunctionsSupplier>() + ,bool _bSet = false) const; + + /** checks if the given function is a default function we know. + * + * \param _xFunction + * \param _rDataField + * \param _rsDefaultFunctionName + * \return + */ + sal_Bool impl_isDefaultFunction_nothrow( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction>& _xFunction + ,::rtl::OUString& _rDataField + ,::rtl::OUString& _rsDefaultFunctionName) const; + + /** fills the memeber m_aDefaultFunctions + * + */ + void loadDefaultFunctions(); + + /** creates a default functionof 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 ::rtl::OUString& _sFunction,const ::rtl::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 ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + public: + // XServiceInfo - static versions + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); + + public: + explicit GeometryHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent: + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::inspection::XPropertyHandler: + virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & PropertyValue, const ::com::sun::star::uno::Type & ControlValueType) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual void SAL_CALL addPropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & Listener) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual void SAL_CALL removePropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & _rxListener) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isComposable(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, ::com::sun::star::uno::Any & out_Data, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException); + virtual void SAL_CALL actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const ::com::sun::star::uno::Any & NewValue, const ::com::sun::star::uno::Any & OldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual ::sal_Bool SAL_CALL suspend(::sal_Bool Suspend) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual ~GeometryHandler(); + private: + GeometryHandler(GeometryHandler &); // not defined + void operator =(GeometryHandler &); // not defined + + // overload 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(); + + PropertyChangeListeners m_aPropertyListeners; + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aFieldNames; + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aParamNames; + TFunctions m_aFunctionNames; + ::std::vector< DefaultFunction > m_aDefaultFunctions; + DefaultFunction m_aCounterFunction; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + mutable ::com::sun::star::uno::Reference< ::com::sun::star::report::XFunction> m_xFunction; + ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xReportComponent; /// inspectee + mutable ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; + /// type converter, needed on various occasions + ::com::sun::star::uno::Reference< ::com::sun::star::script::XTypeConverter > m_xTypeConverter; + /// access to property meta data + ::std::auto_ptr< OPropertyInfoService > m_pInfoService; + mutable ::rtl::OUString m_sDefaultFunction; + mutable ::rtl::OUString m_sScope; + sal_uInt32 m_nDataFieldType; + mutable bool m_bNewFunction; + bool m_bIn; + }; +//........................................................................ +} // namespace rptui +//........................................................................ + +#endif // RPT_GeometryHandler_HXX diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx new file mode 100644 index 000000000000..6c2838b4ac08 --- /dev/null +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_GROUPS_SORTING_HXX +#define RPTUI_GROUPS_SORTING_HXX + +#include <vcl/floatwin.hxx> +#ifndef _FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#include <vcl/lstbox.hxx> +#include <vcl/edit.hxx> +#include <vcl/field.hxx> +#include <vcl/imagebtn.hxx> +#include <vcl/toolbox.hxx> +#include <com/sun/star/report/XGroups.hpp> +#include <com/sun/star/report/XGroup.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include "GroupProperties.hxx" +#include <comphelper/propmultiplex.hxx> +#include "cppuhelper/basemutex.hxx" +#include <svtools/svmedit.hxx> +#include <rtl/ref.hxx> + +#include <vector> + +#include <dbaccess/ToolBoxHelper.hxx> + +#include <vcl/ImageListProvider.hxx> + +namespace comphelper +{ + class OPropertyChangeMultiplexer; +} +namespace rptui +{ +class OFieldExpressionControl; +class OReportController; +/************************************************************************* +|* +|* Groups and Sorting dialog +|* +\************************************************************************/ + +class OGroupsSortingDialog : public FloatingWindow + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + ,public dbaui::OToolBoxHelper + ,public vcl::IImageListProvider +{ + friend class OFieldExpressionControl; + + FixedLine m_aFL2; + FixedText m_aMove; +//BTN ImageButton m_aPB_Up; +//BTN ImageButton m_aPB_Down; +//BTN ImageButton m_aPB_Delete; + ToolBox m_aToolBox; + + FixedLine m_aFL3; + FixedText m_aOrder; + ListBox m_aOrderLst; + FixedText m_aHeader; + ListBox m_aHeaderLst; + FixedText m_aFooter; + ListBox m_aFooterLst; + FixedText m_aGroupOn; + ListBox m_aGroupOnLst; + FixedText m_aGroupInterval; + NumericField m_aGroupIntervalEd; + FixedText m_aKeepTogether; + ListBox m_aKeepTogetherLst; + FixedLine m_aFL; + FixedText m_aHelpWindow; + + OFieldExpressionControl* m_pFieldExpression; + ::rptui::OReportController* m_pController; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups> m_xGroups; + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns; + sal_Bool m_bReadOnly; +private: + DECL_LINK( OnControlFocusLost, Control* ); + DECL_LINK( OnControlFocusGot, Control* ); + DECL_LINK( LBChangeHdl, ListBox* ); +//BTN DECL_LINK( ClickHdl, ImageButton* ); + DECL_LINK( OnFormatAction, ToolBox* ); + + /** returns the groups + @return the groups which now have to check which one changes + */ + ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroups>& getGroups() { return m_xGroups; } + + ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> getGroup(sal_Int32 _nPos) + { + OSL_ENSURE(_nPos >= 0 && _nPos < m_xGroups->getCount(),"Invalid count!"); + return ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>(m_xGroups->getByIndex(_nPos),::com::sun::star::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 + */ + sal_Bool isReadOnly( ) const; + + /** returns the data type for the given column name + @param _sColumnName + */ + sal_Int32 getColumnDataType(const ::rtl::OUString& _sColumnName); + + /** shows the text given by the id in the multiline edit + @param _nResId the string id + */ + void showHelpText(USHORT _nResId); + /** display the group props + @param _xGroup the group to display + */ + void displayGroup(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup); + + /** enables or diables 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&); + void operator =(OGroupsSortingDialog&); +protected: + // window + virtual void Resize(); + // OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); +public: + OGroupsSortingDialog( Window* pParent + ,sal_Bool _bReadOnly + ,::rptui::OReportController* _pController); + virtual ~OGroupsSortingDialog(); + + /** sets the newe columns at the groups dialog. + @param _xColumns the new columns + */ + void setColumns(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xColumns); + + /* updates the current view + */ + void UpdateData( ); + + /** will be called when the controls need to be resized. + @param _rDiff + Contains the difference of the old and new toolbox size. + */ + virtual void resizeControls(const Size& _rDiff); + + /** will be called when the image list is needed. + @param _eSymbolsSize + <svtools/imgdef.hxx> + @param _bHiContast + <TRUE/> when in high contrast mode. + */ + virtual ImageList getImageList(sal_Int16 _eSymbolsSize,sal_Bool _bHiContast) const; + + // ImageListProvider interface + virtual ImageList getImageList(vcl::ImageListType) SAL_THROW ((com::sun::star::lang::IllegalArgumentException )); + +}; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // RPTUI_GROUPS_SORTING_HXX diff --git a/reportdesign/source/ui/inc/IReportControllerObserver.hxx b/reportdesign/source/ui/inc/IReportControllerObserver.hxx new file mode 100644 index 000000000000..497fe874b3ef --- /dev/null +++ b/reportdesign/source/ui/inc/IReportControllerObserver.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef INCLUDED_BEAUTIFIER_HXX +#define INCLUDED_BEAUTIFIER_HXX + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +/** === end UNO includes === **/ + +namespace rptui +{ + /* abstract */ class IReportControllerObserver + { + protected: + // IReportControllerObserver(){} + virtual ~IReportControllerObserver() {} + + public: + + virtual void notifyPropertyChange( const ::com::sun::star::beans::PropertyChangeEvent& _rEvent ) = 0; + virtual void notifyElementInserted( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ) = 0; + virtual void handle( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxElement ) = 0; + }; + +} // namespace rptui + +#endif + + diff --git a/reportdesign/source/ui/inc/InsertFunctions.hxx b/reportdesign/source/ui/inc/InsertFunctions.hxx new file mode 100644 index 000000000000..b177377fd5fd --- /dev/null +++ b/reportdesign/source/ui/inc/InsertFunctions.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPT_INSERTFUNCTIONS_HXX_INCLUDED +#define RPT_INSERTFUNCTIONS_HXX_INCLUDED + +#ifndef _EVENT_HXX //autogen +#include <vcl/event.hxx> +#endif +#include <vcl/timer.hxx> + +class SdrView; +class Window; +class SdrModel; +class SdrObject; +namespace rptui +{ +/************************************************************************/ +// --------- +} // namespace rptui +// --------- +#endif // RPT_INSERTFUNCTIONS_HXX_INCLUDED + diff --git a/reportdesign/source/ui/inc/MarkedSection.hxx b/reportdesign/source/ui/inc/MarkedSection.hxx new file mode 100644 index 000000000000..eb892aee92eb --- /dev/null +++ b/reportdesign/source/ui/inc/MarkedSection.hxx @@ -0,0 +1,60 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPTUI_MARKEDSECTION_HXX +#define RPTUI_MARKEDSECTION_HXX + +#include <boost/shared_ptr.hpp> + +namespace rptui +{ + class OSectionWindow; // forward declaration + + enum NearSectionAccess + { + CURRENT = 0, + PREVIOUS = -1, + POST = 1 + }; + + class IMarkedSection + { + public: + /** returns the section which is currently marked. + */ + virtual ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa) const =0; + + /** mark the section on the given position . + * + * \param _nPos the position is zero based. + */ + virtual void markSection(const sal_uInt16 _nPos) = 0; + }; + +} // rptui + +#endif /* RPTUI_MARKEDSECTION_HXX */ diff --git a/reportdesign/source/ui/inc/Navigator.hxx b/reportdesign/source/ui/inc/Navigator.hxx new file mode 100644 index 000000000000..a9cf2fd9222e --- /dev/null +++ b/reportdesign/source/ui/inc/Navigator.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_RPTUI_NAVIGATOR_HXX +#define INCLUDED_RPTUI_NAVIGATOR_HXX + +#include <vcl/floatwin.hxx> +#include "ModuleHelper.hxx" +#include <memory> +namespace rptui +{ + class OReportController; + class ONavigatorImpl; + class ONavigator : public FloatingWindow + { + OModuleClient m_aModuleClient; + ::std::auto_ptr<ONavigatorImpl> m_pImpl; + ONavigator(const ONavigator&); + void operator =(const ONavigator&); + public: + ONavigator( Window* pParent + ,OReportController& _rController); + virtual ~ONavigator(); + + // window + virtual void Resize(); + virtual void GetFocus(); + }; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // INCLUDED_RPTUI_NAVIGATOR_HXX diff --git a/reportdesign/source/ui/inc/PageNumber.hxx b/reportdesign/source/ui/inc/PageNumber.hxx new file mode 100644 index 000000000000..fd574ff5fa8b --- /dev/null +++ b/reportdesign/source/ui/inc/PageNumber.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_PAGENUMBER_HXX +#define RPTUI_PAGENUMBER_HXX + +#ifndef _DIALOG_HXX //autogen +#include <vcl/dialog.hxx> +#endif +#ifndef _FIXED_HXX //autogen +#include <vcl/fixed.hxx> +#endif +#include <vcl/lstbox.hxx> +#include <vcl/field.hxx> +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <com/sun/star/report/XReportDefinition.hpp> + + +namespace rptui +{ +class OReportController; +/************************************************************************* +|* +|* Groups and Sorting dialog +|* +\************************************************************************/ +class OPageNumberDialog : public ModalDialog +{ + FixedLine m_aFormat; + RadioButton m_aPageN; + RadioButton m_aPageNofM; + + FixedLine m_aPosition; + RadioButton m_aTopPage; + RadioButton m_aBottomPage; + FixedLine m_aMisc; + FixedText m_aAlignment; + ListBox m_aAlignmentLst; + + CheckBox m_aShowNumberOnFirstPage; + FixedLine m_aFl1; + OKButton m_aPB_OK; + CancelButton m_aPB_CANCEL; + HelpButton m_aPB_Help; + + + ::rptui::OReportController* m_pController; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> + m_xHoldAlive; + + OPageNumberDialog(const OPageNumberDialog&); + void operator =(const OPageNumberDialog&); +public: + OPageNumberDialog( Window* pParent + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xHoldAlive + ,::rptui::OReportController* _pController); + virtual ~OPageNumberDialog(); + virtual short Execute(); +}; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // RPTUI_PAGENUMBER_HXX diff --git a/reportdesign/source/ui/inc/ReportComponentHandler.hxx b/reportdesign/source/ui/inc/ReportComponentHandler.hxx new file mode 100644 index 000000000000..080d913d59ab --- /dev/null +++ b/reportdesign/source/ui/inc/ReportComponentHandler.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef RPT_REPORTCOMPONENTHANDLER_HXX +#define RPT_REPORTCOMPONENTHANDLER_HXX + +#include "sal/config.h" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "cppuhelper/compbase2.hxx" +#include "cppuhelper/basemutex.hxx" +#include "com/sun/star/inspection/XPropertyHandler.hpp" +#include "com/sun/star/lang/XServiceInfo.hpp" + +#include <memory> + +//........................................................................ +namespace rptui +{ +//........................................................................ + + class OPropertyInfoService; + + typedef ::cppu::WeakComponentImplHelper2< ::com::sun::star::inspection::XPropertyHandler + , ::com::sun::star::lang::XServiceInfo> ReportComponentHandler_Base; + + class ReportComponentHandler: + private ::cppu::BaseMutex, + public ReportComponentHandler_Base + { + public: + // XServiceInfo - static versions + static ::rtl::OUString getImplementationName_Static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static( ) throw(::com::sun::star::uno::RuntimeException); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&); + + public: + explicit ReportComponentHandler(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XComponent: + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & xListener) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > & aListener) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::inspection::XPropertyHandler: + virtual void SAL_CALL inspect(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & Component) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual void SAL_CALL setPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & Value) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::inspection::LineDescriptor SAL_CALL describePropertyLine(const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& ControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL convertToPropertyValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & ControlValue) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::uno::Any SAL_CALL convertToControlValue(const ::rtl::OUString & PropertyName, const ::com::sun::star::uno::Any & PropertyValue, const ::com::sun::star::uno::Type & ControlValueType) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual void SAL_CALL addPropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & Listener) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual void SAL_CALL removePropertyChangeListener(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & _rxListener) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > SAL_CALL getSupportedProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isComposable(const ::rtl::OUString & PropertyName) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException); + virtual ::com::sun::star::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const ::rtl::OUString & PropertyName, ::sal_Bool Primary, ::com::sun::star::uno::Any & out_Data, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException); + virtual void SAL_CALL actuatingPropertyChanged(const ::rtl::OUString & ActuatingPropertyName, const ::com::sun::star::uno::Any & NewValue, const ::com::sun::star::uno::Any & OldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI > & InspectorUI, ::sal_Bool FirstTimeInit) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::NullPointerException); + virtual ::sal_Bool SAL_CALL suspend(::sal_Bool Suspend) throw (::com::sun::star::uno::RuntimeException); + + protected: + virtual ~ReportComponentHandler() {} + private: + ReportComponentHandler(ReportComponentHandler &); // not defined + void operator =(ReportComponentHandler &); // not defined + + + + // overload 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(); + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler > m_xFormComponentHandler; /// delegatee + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xReportComponent; /// inspectee + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xFormComponent; /// inspectee + ::std::auto_ptr< OPropertyInfoService > m_pInfoService; + }; +//........................................................................ +} // namespace rptui +//........................................................................ + +#endif // RPT_REPORTCOMPONENTHANDLER_HXX diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx new file mode 100644 index 000000000000..6694c81c999b --- /dev/null +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -0,0 +1,487 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_REPORTCONTROLLER_HXX +#define RPTUI_REPORTCONTROLLER_HXX + +#include <dbaccess/singledoccontroller.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> +#include <com/sun/star/io/XObjectOutputStream.hpp> +#include <com/sun/star/io/XObjectInputStream.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/report/XReportDefinition.hpp> +#include <com/sun/star/report/XReportControlModel.hpp> +#include <com/sun/star/report/XReportEngine.hpp> +#include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/embed/XVisualObject.hpp> +#include <cppuhelper/implbase5.hxx> +#include <svtools/transfer.hxx> +#include <svl/lstner.hxx> +#include <svx/svdedtv.hxx> +#include <svx/zoomitem.hxx> +#include "ModuleHelper.hxx" + +#include <comphelper/uno3.hxx> +#include <comphelper/implementationreference.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/propertystatecontainer.hxx> + +#include "RptDef.hxx" +#include "DesignView.hxx" +#include <functional> +#include <boost/shared_ptr.hpp> +#include <com/sun/star/util/XModeSelector.hpp> +#include "ReportControllerObserver.hxx" + +class TransferableHelper; +class TransferableClipboardListener; +class VclWindowEvent; +namespace rptui +{ + class OGroupsSortingDialog; + class OPropertyMediator; + class OReportModel; + class OSectionView; + class OAddFieldWindow; + class OSectionWindow; + + typedef ::dbaui::OSingleDocumentController OReportController_BASE; + typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener + , ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::view::XSelectionSupplier + , ::com::sun::star::util::XModeSelector + , ::com::sun::star::embed::XVisualObject + > OReportController_Listener; + + class OReportController : public OReportController_BASE + ,public OReportController_Listener + ,public SfxListener + ,public ::comphelper::OPropertyStateContainer + ,public ::comphelper::OPropertyArrayUsageHelper < OReportController_BASE > + { + private: + OModuleClient m_aModuleClient; + ::cppu::OInterfaceContainerHelper + m_aSelectionListeners; + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> + m_aCollapsedSections; + TransferableDataHelper m_aSystemClipboard; // content of the clipboard + TransferableClipboardListener* + m_pClipbordNotifier; /// notifier for changes in the clipboard + OGroupsSortingDialog* m_pGroupsFloater; + + OXReportControllerObserver* m_pReportControllerObserver; + + ODesignView* getDesignView() const { return static_cast< ODesignView* >( getView() ); } + + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> m_xReportDefinition; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportEngine> m_xReportEngine; + ::com::sun::star::uno::Reference < ::com::sun::star::frame::XComponentLoader> m_xFrameLoader; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > m_xRowSet; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > m_xRowSetMediator; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > m_xFormatter; // a number formatter working with the report's NumberFormatsSupplier + mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xHoldAlive; + mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xColumns; + ::com::sun::star::awt::Size m_aVisualAreaSize; + + ::boost::shared_ptr<rptui::OReportModel> + m_aReportModel; + ::rtl::OUString m_sName; /// name for the report definition + ::rtl::OUString m_sLastActivePage; /// last active property browser page + ::rtl::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; + sal_Bool m_bShowRuler; + sal_Bool m_bGridVisible; + sal_Bool m_bGridUse; + sal_Bool m_bShowProperties; + sal_Bool m_bGroupFloaterWasVisible; + sal_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 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,const ::rtl::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 a element named PROPERTY_GROUP of type report::XGroup. + */ + void modifyGroup(const bool _bAppend, const ::com::sun::star::uno::Sequence< ::com::sun::star::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 a element named PROPERTY_GROUP of type report::XGroup. + */ + void createGroupSection(const bool _bUndo,const bool _bHeader,const ::com::sun::star::uno::Sequence< ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::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 ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup + ,const ::rtl::OUString& _sPropName + ,sal_Int32 _nGroupPos + ,bool _bShow); + + void executeMethodWithUndo(USHORT _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun); + void alignControlsWithUndo(USHORT _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection = false); + /** shrink a section + @param _nUndoStrId the string id of the string which is shown in undo menu + @param _nShrinkId ID of what you would like to shrink. + */ + protected: + void shrinkSectionBottom(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection); + void shrinkSectionTop(::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection); + public: + + void shrinkSection(USHORT _nUndoStrId, ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > _xSection, sal_Int32 _nShrinkId); + + /** opens the file open dialog to allow the user to select a image which will be + * bound to a newly created image button. + */ + void insertGraphic(); + + /** resets the floater + */ + void updateFloater(); + + /** creates a new function in the given value context + * + * \param _aValue contains a XNameContainer + */ + void createNewFunction(const ::com::sun::star::uno::Any& _aValue); + + /** inserts a label - field pair into the current selected section + * + * \param aArgs + */ + void addPairControls(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs); + + /** inserts a label - field combination to show the page number and/or page count + * + * \param _aArgs + */ + void createPageNumber(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs); + + /** creates a formatted filed with TODAY() function and if set also an NOW() function + * + * \param _aArgs + */ + void createDateTime(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs); + + /** gets the current section (SdrView) + * + * \return the currently selected section or <NULL/> if noone 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 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(); + + private: + OReportController(OReportController const&); + OReportController& operator =(OReportController const&); + public: + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getXFrame(); + + // open the help agent of report designer at start time + void doOpenHelpAgent(); + + /** creates a new default control for the currently set type when the modifier KEY_MOD1 was pressed + * \param _aArgs must contain a properyvalue with name "KeyModifier" and value KEY_MOD1 when control should be created. + */ + void createDefaultControl(const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aArgs); + + /** fills the state for the feture request. + @param _sProperty the property which should be filled in the value + @param _rState the state to fill + */ + void impl_fillState_nothrow(const ::rtl::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 sal_uInt16 _nUndoResId + ,const ::rtl::OUString& _sProperty + ,const ::com::sun::star::uno::Any& _aValue + ,const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _aArgs); + + DECL_LINK( OnInvalidateClipboard, void* ); + DECL_LINK( OnClipboardChanged, void* ); + DECL_LINK( OnExecuteReport, void* ); + DECL_LINK( OnOpenHelpAgent, void* ); + short saveModified(); + // all the features which should be handled by this class + virtual void describeSupportedFeatures(); + // state of a feature. 'feature' may be the handle of a ::com::sun::star::util::URL somebody requested a dispatch interface for OR a toolbar slot. + virtual dbaui::FeatureState GetState(sal_uInt16 nId) const; + // execute a feature + virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs); + + virtual void losingConnection( ); + + virtual void getPropertyDefaultByHandle( sal_Int32 _nHandle, ::com::sun::star::uno::Any& _rDefault ) const; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const ::com::sun::star::uno::Any& rValue) throw (::com::sun::star::uno::Exception); + + virtual ~OReportController(); + public: + OReportController(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & the_context); + + DECL_LINK( NotifyUndoActionHdl, SfxUndoAction* ); + DECL_LINK( EventLstHdl, VclWindowEvent* ); + DECL_LINK( OnCreateHdl, OAddFieldWindow*); + + DECLARE_XINTERFACE( ) + DECLARE_XTYPEPROVIDER( ) + + // SfxListener + virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint); + + virtual void impl_onModifyChanged(); + + // const ::connectivity::OSQLParseNode* getParseTree() const { return m_aSqlIterator.getParseTree();} + // need for undo's and redo's + SfxUndoManager* getUndoMgr(); + + /** returns <TRUE/> when the command is enbaled + @param _nCommand the command id + @param _xControlFormat the report control format + */ + sal_Bool isFormatCommandEnabled(sal_uInt16 _nCommand + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xControlFormat) const; + + virtual sal_Bool Construct(Window* pParent); + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw(::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::frame::XController + virtual sal_Bool SAL_CALL suspend(sal_Bool bSuspend) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::lang::XComponent + virtual void SAL_CALL disposing(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + // need by registration + static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); + + // ::com::sun::star::container::XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& Event) throw( ::com::sun::star::uno::RuntimeException ); + + // XPropertyChangeListener + virtual void SAL_CALL propertyChange( const ::com::sun::star::beans::PropertyChangeEvent& evt ) throw (::com::sun::star::uno::RuntimeException); + + // XSelectionSupplier + virtual ::sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& xSelection ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getSelection( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::frame::XController + virtual sal_Bool SAL_CALL attachModel(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xModel) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getViewData(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL restoreViewData(const ::com::sun::star::uno::Any& Data) throw( ::com::sun::star::uno::RuntimeException ); + + /** gives access to the report definition + * \return the report definition object, may be <NULL/> + */ + inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> getReportDefinition() const { return m_xReportDefinition; } + + // ::com::sun::star::frame::XController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModel(void) throw( ::com::sun::star::uno::RuntimeException ); + + // XTitle + virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException); + + // XModeSelector + virtual void SAL_CALL setMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException) ; + virtual ::rtl::OUString SAL_CALL getMode( ) throw (::com::sun::star::uno::RuntimeException) ; + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedModes( ) throw (::com::sun::star::uno::RuntimeException) ; + virtual ::sal_Bool SAL_CALL supportsMode( const ::rtl::OUString& aMode ) throw (::com::sun::star::uno::RuntimeException) ; + + // XVisualObject + virtual void SAL_CALL setVisualAreaSize( ::sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::embed::WrongStateException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getMapUnit( ::sal_Int64 nAspect ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + + /** returns the current position of the splitter + * + * \return + */ + inline sal_Int32 getSplitPos() const { return m_nSplitPos;} + inline 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. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::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. + */ + ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > getRowSet(); + + /** returns the number formatter + */ + ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter > getReportNumberFormatter() const; + + /** return the SdrModel of the real model + * + * \return + */ + ::boost::shared_ptr<rptui::OReportModel> getSdrModel(); + + inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; } + inline sal_Int16 getZoomValue() const { return m_nZoomValue; } + inline void resetZoomType() { m_eZoomType = SVX_ZOOM_PERCENT; } + + // com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw(::com::sun::star::uno::RuntimeException) + { + return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper()); + } + // comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + // cppu::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const; + ::rtl::OUString getColumnLabel_throw(const ::rtl::OUString& i_sColumnName) const; + + private: + virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager ); + virtual void impl_initialize( ); + bool isUiVisible() const; + }; +} +#endif // RPTUI_REPORTCONTROLLER_HXX + diff --git a/reportdesign/source/ui/inc/ReportControllerObserver.hxx b/reportdesign/source/ui/inc/ReportControllerObserver.hxx new file mode 100644 index 000000000000..5f7868c9fa14 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportControllerObserver.hxx @@ -0,0 +1,132 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef INCLUDED_REPORTCONTROLLEROBSERVER_HXX +#define INCLUDED_REPORTCONTROLLEROBSERVER_HXX + +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/report/XReportDefinition.hpp> +#include <cppuhelper/implbase3.hxx> + +#include <memory> +#include <dllapi.h> +#include <vector> + +// #include <svl/lstner.hxx> +#include <vcl/svapp.hxx> +#include <tools/link.hxx> + +#include <FormattedFieldBeautifier.hxx> +#include <FixedTextColor.hxx> + +namespace rptui +{ + class OReportController; + class OXReportControllerObserverImpl; + + //======================================================================== + class /* REPORTDESIGN_DLLPUBLIC */ OXReportControllerObserver + : public ::cppu::WeakImplHelper3< ::com::sun::star::beans::XPropertyChangeListener + , ::com::sun::star::container::XContainerListener + , ::com::sun::star::util::XModifyListener + > + /*,public SfxListener*/ + { + + const ::std::auto_ptr<OXReportControllerObserverImpl> m_pImpl; + + FormattedFieldBeautifier m_aFormattedFieldBeautifier; + FixedTextColor m_aFixedTextColor; + + // do not allow copy + OXReportControllerObserver(const OXReportControllerObserver&); + OXReportControllerObserver& operator=(const OXReportControllerObserver&); + virtual ~OXReportControllerObserver(); // UNO Object must have private destructor! + public: + OXReportControllerObserver(const OReportController& _rController); + +// protected: + // XPropertyChangeListener + virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw(::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException ); + + // XContainerListener + virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw(::com::sun::star::uno::RuntimeException); + + // XModifyListener + virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + + void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + + void AddSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection); + void RemoveSection( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection ); + + // SfxListener + // virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + /** + 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(); + sal_Bool IsLocked() const; + + void Clear(); + private: + + void TogglePropertyListening(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element); + void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(()); + void switchListening( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(()); + + // void ModeChanged(); // will be called from 'Notify' + DECL_LINK(SettingsChanged, VclWindowEvent* ); + private: + + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild> >::const_iterator getSection(const ::com::sun::star::uno::Reference< ::com::sun::star::container::XChild>& _xContainer) const; + + }; + +} // namespace rptui + +#endif /* INCLUDED_REPORTCONTROLLEROBSERVER_HXX */ + + diff --git a/reportdesign/source/ui/inc/ReportDefines.hxx b/reportdesign/source/ui/inc/ReportDefines.hxx new file mode 100644 index 000000000000..9d207c9c9142 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportDefines.hxx @@ -0,0 +1,39 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_REPORT_DEFINES_HXX +#define RPTUI_REPORT_DEFINES_HXX + +namespace rptui +{ + enum DlgEdMode { RPTUI_INSERT, RPTUI_SELECT, RPTUI_TEST, RPTUI_READONLY }; + +#define REPORT_STARTMARKER_WIDTH 120 +#define REPORT_ENDMARKER_WIDTH 10 +#define REPORT_EXTRA_SPACE 10 + +} +#endif //RPTUI_REPORT_DEFINES_HXX diff --git a/reportdesign/source/ui/inc/ReportRuler.hxx b/reportdesign/source/ui/inc/ReportRuler.hxx new file mode 100644 index 000000000000..ba65b1b80b9f --- /dev/null +++ b/reportdesign/source/ui/inc/ReportRuler.hxx @@ -0,0 +1,63 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_RULER_HXX +#define RPTUI_RULER_HXX + +#include <vcl/window.hxx> +#include <com/sun/star/report/XSection.hpp> + +namespace rptui +{ + class OReportSection; + class OReportWindow; + class OReportRuler : public Window + { + OReportSection* m_pSection; + OReportWindow* m_pParent; + sal_Bool m_bShow; + OReportRuler(OReportRuler&); + void operator =(OReportRuler&); + public: + OReportRuler(Window* _pParent,OReportWindow* _pReportWindowt,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); + virtual ~OReportRuler(); + + // windows overloads + virtual void Resize(); + + inline OReportSection* getSection() const { return m_pSection; } + inline OReportWindow* getView() const { return m_pParent; } + + /** makes the grid visible + * + * \param _bVisible when <TRUE/> the grid is made visible + */ + void SetGridVisible(BOOL _bVisible); + }; +//============================================================================== +} // rptui +//============================================================================== +#endif // RPTUI_RULER_HXX diff --git a/reportdesign/source/ui/inc/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx new file mode 100644 index 000000000000..a95fd72b7f40 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportSection.hxx @@ -0,0 +1,173 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef REPORT_REPORTSECTION_HXX +#define REPORT_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 <svtools/transfer.hxx> +#include <rtl/ref.hxx> +#include <boost/shared_ptr.hpp> +#include <memory> + +namespace rptui +{ + class OReportModel; + class OReportPage; + class OSectionView; + class OSectionWindow; + + class OReportSection : public Window + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + , public DropTargetHelper + { + OReportPage* m_pPage; + OSectionView* m_pView; + OSectionWindow* m_pParent; + ::std::auto_ptr<DlgEdFunc> m_pFunc; + ::boost::shared_ptr<OReportModel> m_pModel; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; + ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > m_xSection; + + DlgEdMode m_eMode; + BOOL m_bDialogModelChanged; + sal_Bool m_bInDrag; + + /** fills the section with all control from the report section + */ + void fill(); + + OReportSection(OReportSection&); + void operator =(OReportSection&); + protected: + // DropTargetHelper overridables + virtual sal_Int8 AcceptDrop( const AcceptDropEvent& _rEvt ); + virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& _rEvt ); + + // window overrides + virtual void Paint( const Rectangle& rRect ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void Command( const CommandEvent& rCEvt ); + virtual void Resize(); + + // OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); + public: + OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); + virtual ~OReportSection(); + + // window overrides + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + /** copies the current selection in this section + @param _rAllreadyCopiedObjects This is an out/in put param which contains all already copied objects. + */ + void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rAllreadyCopiedObjects); + + void Copy(::com::sun::star::uno::Sequence< ::com::sun::star::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 ::com::sun::star::uno::Sequence< ::com::sun::star::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); + + inline OSectionWindow* getSectionWindow() const { return m_pParent; } + inline OSectionView& getSectionView() const { return *m_pView; } + inline OReportPage* getPage() const { return m_pPage; } + inline ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getSection() const { return m_xSection; } + + void SetDialogModelChanged( BOOL bChanged = TRUE ) { m_bDialogModelChanged = bChanged; } + BOOL IsDialogModelChanged() const { return m_bDialogModelChanged; } + DlgEdMode GetMode() const { return m_eMode; } + 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/> + */ + sal_Bool handleKeyEvent(const KeyEvent& _rEvent); + + /** returns the current control report model or <NULL/> + */ + ::com::sun::star::uno::Reference< ::com::sun::star::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< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; + + /** creates a default object (custom shape) + * + * @param _sType + */ + void createDefault(const ::rtl::OUString& _sType); + + /** creates a new default custom shape + * + * \param _sType + * \param _pObj + */ + void createDefault(const ::rtl::OUString& _sType,SdrObject* _pObj); + void stopScrollTimer(); + + /** deactivate the currect active ole object if any + */ + void deactivateOle(); + + /** returns true when an ole object is currently active + */ + bool isUiActive() const; + }; +//================================================================== +} //rptui +//================================================================== +#endif // REPORT_REPORTSECTION_HXX + diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx new file mode 100644 index 000000000000..4267bc0ef6e4 --- /dev/null +++ b/reportdesign/source/ui/inc/ReportWindow.hxx @@ -0,0 +1,238 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_REPORT_WINDOW_HXX +#define RPTUI_REPORT_WINDOW_HXX + +#include <com/sun/star/report/XSection.hpp> +#include "ReportDefines.hxx" +#include "StartMarker.hxx" +#include <svtools/ruler.hxx> +#include <svx/svdedtv.hxx> +#include <svx/zoomitem.hxx> + +#include <vector> +#include <boost/shared_ptr.hpp> + +#include <MarkedSection.hxx> +#include "ViewsWindow.hxx" + +class Splitter; + +namespace rptui +{ + class ODesignView; + class OReportSection; + class OScrollWindowHelper; + class OSectionView; + class OReportModel; + class OEndMarker; + class OReportPage; + class DlgEdFunc; + class DlgEdFactory; + + class OReportWindow : public Window, public IMarkedSection + { + Ruler m_aHRuler; + ODesignView* m_pView; + OScrollWindowHelper* m_pParent; + OViewsWindow m_aViewsWindow; + ::std::auto_ptr<DlgEdFactory> + m_pObjFac; + + void ImplInitSettings(); + + sal_Int32 GetTotalHeight() const; + sal_Int32 impl_getRealPixelWidth() const; + + OReportWindow(OReportWindow&); + void operator =(OReportWindow&); + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + public: + OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView); + virtual ~OReportWindow(); + + /** late ctor + */ + void initialize(); + // WINDOW overloads + virtual void Resize(); + + inline ODesignView* getReportView() const { return m_pView; } + inline OScrollWindowHelper* getScrollWindow() const { return m_pParent; } + + void SetMode( DlgEdMode m_eMode ); + void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString()); + rtl::OUString 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 a object is marked + */ + BOOL HasSelection() const; + + Point getThumbPos() const; + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(USHORT _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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + ,const ::rtl::OUString& _sColorEntry + ,USHORT _nPosition = USHRT_MAX); + + USHORT getSectionCount() const; + + /** turns the grid on or off + * + * \param _bVisible + */ + void toggleGrid(sal_Bool _bVisible); + + + /** shows the ruler + */ + void showRuler(sal_Bool _bShow); + + inline 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 + * + * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not. + * \return the max width + */ + sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const; + + void ScrollChildren(const Point& _aThumbPos); + + void notifySizeChanged(); + + /** unmark all objects on the views without the given one. + * + * @param _pSectionView The view where the objects should not be unmarked. + */ + void unmarkAllObjects(OSectionView* _pSectionView); + + /** triggers the property browser with the report component or section + @param _xReportComponent + */ + void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::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/> + */ + sal_Bool handleKeyEvent(const KeyEvent& _rEvent); + + /** the 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* _pSectionView,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark); + + // IMarkedSection + ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + virtual void markSection(const sal_uInt16 _nPos); + + + /** 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; + + /** collpase all sections given by their position + * + * \param _aCollpasedSections The position of the sections which should be collapsed. + */ + void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections); + + /** align all marked objects in all sections + * + * \param eHor + * \param eVert + * \param bBoundRects + */ + void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false); + + 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< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; + + /** calculates the zoom factor. + @param _eType which kind of zoom is needed + */ + sal_uInt16 getZoomFactor(SvxZoomType _eType) const; + }; +//================================================================== +} //rptui +//================================================================== +#endif // RPTUI_REPORT_WINDOW_HXX + diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx new file mode 100644 index 000000000000..d5080e56d28d --- /dev/null +++ b/reportdesign/source/ui/inc/ScrollHelper.hxx @@ -0,0 +1,229 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_SCROLLHELPER_HXX +#define RPTUI_SCROLLHELPER_HXX + +#include <vcl/scrbar.hxx> +#include <com/sun/star/report/XSection.hpp> +#include <comphelper/propmultiplex.hxx> +#include "ReportDefines.hxx" +#include <svtools/colorcfg.hxx> +#include <svx/svdedtv.hxx> +#include "cppuhelper/basemutex.hxx" +#include <rtl/ref.hxx> +#include <boost/shared_ptr.hpp> +#include <vcl/dockwin.hxx> +#include <MarkedSection.hxx> +#include "ReportWindow.hxx" + +class SdrView; +namespace rptui +{ + class ODesignView; + class OReportWindow; + class OSectionView; + class OReportSection; + class OReportModel; + + /** 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 Window OScrollWindowHelper_BASE; + class OScrollWindowHelper : public ::cppu::BaseMutex + , public OScrollWindowHelper_BASE/*TabPage*/ + , public ::comphelper::OPropertyChangeListener + , public IMarkedSection + { + private: + ScrollBar m_aHScroll; + ScrollBar m_aVScroll; + ScrollBarBox m_aCornerWin; // window in the bottom right corner + Size m_aTotalPixelSize; + ODesignView* m_pParent; + OReportWindow m_aReportWindow; + ::rtl::Reference<comphelper::OPropertyChangeMultiplexer > + m_pReportDefintionMultiPlexer; // listener for property changes + + DECL_LINK( ScrollHdl, ScrollBar*); + Size ResizeScrollBars(); + void ImplInitSettings(); + void impl_initScrollBar( ScrollBar& _rScrollBar ) const; + + OScrollWindowHelper(OScrollWindowHelper&); + void operator =(OScrollWindowHelper&); + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + // window + virtual void Resize(); + virtual long Notify( NotifyEvent& rNEvt ); + // OPropertyChangeListener + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); + public: + OScrollWindowHelper( ODesignView* _pReportDesignView); + virtual ~OScrollWindowHelper(); + + /** late ctor + */ + void initialize(); + + inline Point getThumbPos() const { return Point(m_aHScroll.GetThumbPos(),m_aVScroll.GetThumbPos())/*m_aScrollOffset*/; } + inline const OReportWindow& getReportWindow() const { return m_aReportWindow; } + void setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight); + inline Size getTotalSize() const { return m_aTotalPixelSize; } + inline ScrollBar* GetHScroll() { return &m_aHScroll; } + inline ScrollBar* GetVScroll() { return &m_aVScroll; } + + // forwards + void SetMode( DlgEdMode _eMode ); + void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString()); + rtl::OUString 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 a object is marked + */ + BOOL HasSelection() const; + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(USHORT _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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + ,const ::rtl::OUString& _sColorEntry + ,USHORT _nPosition = USHRT_MAX); + + USHORT getSectionCount() const; + + /** turns the grid on or off + * + * \param _bVisible + */ + void toggleGrid(sal_Bool _bVisible); + + /** unmark all objects on the views without the given one. + * + * @param _pSectionView The view where the objects should not be unmarked. + */ + void unmarkAllObjects(OSectionView* _pSectionView); + + /** shows or hides the ruler. + */ + void showRuler(sal_Bool _bShow); + + /** calculate the max width of the markers + * + * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not. + * \return the max width + */ + sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const; + + /** checks if the keycode is known by the child windows + @param _rCode the keycode + @return <TRUE/> if the keycode is handled otherwise <FALSE/> + */ + sal_Bool handleKeyEvent(const KeyEvent& _rEvent); + + /** the 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* _pSectionView,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark); + + // IMarkedSection + ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + virtual void markSection(const sal_uInt16 _nPos); + + + /** 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; + + /** collpase all sections given by their position + * + * \param _aCollpasedSections The position of the sections which should be collapsed. + */ + void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections); + + /** align all marked objects in all sections + * + * \param eHor + * \param eVert + * \param bBoundRects + */ + void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false); + + 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< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; + + /** calculates the zoom factor. + @param _eType which kind of zoom is needed + */ + sal_uInt16 getZoomFactor(SvxZoomType _eType) const; + }; +} +#endif // RPTUI_SCROLLHELPER_HXX diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx new file mode 100644 index 000000000000..71d07db7b7a2 --- /dev/null +++ b/reportdesign/source/ui/inc/SectionView.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REPORT_SECTIONVIEW_HXX +#define _REPORT_SECTIONVIEW_HXX + + +#include <svx/svdview.hxx> +namespace rptui +{ +class OReportWindow; +class OReportSection; + +//============================================================================ +// OSectionView +//============================================================================ + +class OSectionView : public SdrView +{ +private: + OReportWindow* m_pReportWindow; + OReportSection* m_pSectionWindow; + + void ObjectRemovedInAliveMode( const SdrObject* pObject ); + OSectionView(const OSectionView&); + void operator =(const OSectionView&); +public: + TYPEINFO(); + + OSectionView( SdrModel* pModel, OReportSection* _pSectionWindow, OReportWindow* pEditor ); + virtual ~OSectionView(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void MarkListHasChanged(); + virtual void MakeVisible( const Rectangle& rRect, Window& rWin ); + + inline 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. + */ + short GetLayerIdOfMarkedObjects() const; + + // returns true if objects at Drag & Drop is resize not move + bool IsDragResize() const; +}; +} +#endif //_REPORT_SECTIONVIEW_HXX diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx new file mode 100644 index 000000000000..d9c2fa01d676 --- /dev/null +++ b/reportdesign/source/ui/inc/SectionWindow.hxx @@ -0,0 +1,140 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_SECTIONWINDOW_HXX +#define RPTUI_SECTIONWINDOW_HXX + +#include <com/sun/star/report/XSection.hpp> +#include <vcl/window.hxx> +#include <vcl/split.hxx> +#include <svtools/colorcfg.hxx> +#include <comphelper/propmultiplex.hxx> +#include <cppuhelper/basemutex.hxx> + +#include "UITools.hxx" +#include "UndoActions.hxx" +#include "StartMarker.hxx" +#include "EndMarker.hxx" +#include "ReportSection.hxx" + +#include <list> +#include <map> +#include <boost/shared_ptr.hpp> + +namespace comphelper +{ + class OPropertyChangeMultiplexer; +} +namespace rptui +{ + class OReportWindow; + class ODesignView; + class OViewsWindow; + class OSectionWindow : public Window + , public ::cppu::BaseMutex + , public ::comphelper::OPropertyChangeListener + { + OViewsWindow* m_pParent; + OStartMarker m_aStartMarker; + OReportSection m_aReportSection; + Splitter m_aSplitter; + OEndMarker m_aEndMarker; + + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti; + ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti; + + OSectionWindow(OSectionWindow&); + void operator =(OSectionWindow&); + + /** set the title of the group header or footer + * + * \param _xGroup + * \param _nResId + * \param _pGetSection + * \param _pIsSectionOn + * @return TRUE when title was set otherwise FALSE + */ + bool setGroupSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup,USHORT _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OGroupHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OGroupHelper> _pIsSectionOn); + + /** set the title of the (report/page) header or footer + * + * \param _xGroup + * \param _nResId + * \param _pGetSection + * \param _pIsSectionOn + * @return TRUE when title was set otherwise FALSE + */ + bool setReportSectionTitle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,USHORT _nResId,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OReportHelper> _pGetSection,::std::mem_fun_t<sal_Bool, OReportHelper> _pIsSectionOn); + void ImplInitSettings(); + + DECL_LINK(Collapsed,OColorListener*); + DECL_LINK(StartSplitHdl, Splitter*); + DECL_LINK(SplitHdl, Splitter*); + DECL_LINK(EndSplitHdl, Splitter*); + + + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + // windows overload + virtual void Resize(); + + protected: + virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException); + public: + OSectionWindow( OViewsWindow* _pParent + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + ,const ::rtl::OUString& _sColorEntry); + virtual ~OSectionWindow(); + + inline OStartMarker& getStartMarker() { return m_aStartMarker; } + inline OReportSection& getReportSection() { return m_aReportSection; } + inline OEndMarker& getEndMarker() { return m_aEndMarker; } + inline OViewsWindow* getViewsWindow() { return m_pParent; } + + void setCollapsed(sal_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(sal_Bool _bMark); + + OViewsWindow* getViewsWindow() const { return m_pParent; } + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + + void scrollChildren(long _nThumbPosX); + }; +//============================================================================== +} // rptui +//============================================================================== +#endif // RPTUI_SECTIONWINDOW_HXX + diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx new file mode 100644 index 000000000000..d1746cc46b11 --- /dev/null +++ b/reportdesign/source/ui/inc/StartMarker.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_STARTMARKER_HXX +#define RPTUI_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 + { + + Ruler m_aVRuler; + FixedText m_aText; + FixedImage m_aImage; + OSectionWindow* m_pParent; + static Image* s_pDefCollapsed; + static Image* s_pDefExpanded; + static Image* s_pDefCollapsedHC; + static Image* s_pDefExpandedHC; + static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed + + sal_Bool m_bShowRuler; + + void changeImage(); + void initDefaultNodeImages(); + void setColor(); + virtual void ImplInitSettings(); + OStartMarker(OStartMarker&); + void operator =(OStartMarker&); + public: + OStartMarker(OSectionWindow* _pParent,const ::rtl::OUString& _sColorEntry); + virtual ~OStartMarker(); + + // SfxListener + virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint); + // window overloads + virtual void Paint( const Rectangle& rRect ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void Resize(); + virtual void RequestHelp( const HelpEvent& rHEvt ); + using Window::Notify; + + void setTitle(const String& _sTitle); + sal_Int32 getMinHeight() const; + + /** shows or hides the ruler. + */ + void showRuler(sal_Bool _bShow); + + virtual void setCollapsed(sal_Bool _bCollapsed); + + /** zoom the ruler and view windows + */ + void zoom(const Fraction& _aZoom); + }; +} +#endif // RPTUI_STARTMARKER_HXX + diff --git a/reportdesign/source/ui/inc/UITools.hxx b/reportdesign/source/ui/inc/UITools.hxx new file mode 100644 index 000000000000..d7aa74c240e8 --- /dev/null +++ b/reportdesign/source/ui/inc/UITools.hxx @@ -0,0 +1,189 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_UITOOLS_HXX +#define RPTUI_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 "ReportSection.hxx" +#include <rtl/ref.hxx> +#include <vcl/taskpanelist.hxx> +#include <comphelper/stl_types.hxx> +#include <functional> + +class SdrPage; +class SdrObject; +class SdrUnoObj; +class SdrView; +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 ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _xCollection + ,const ::com::sun::star::uno::Reference< T >& _xSearch) + { + sal_Int32 nCount = _xCollection->getCount(); + sal_Int32 i = (nCount == 0) ? -1 : 0; + for (;i<nCount ; ++i) + { + ::com::sun::star::uno::Reference< T > xObject(_xCollection->getByIndex(i),::com::sun::star::uno::UNO_QUERY); + if ( xObject == _xSearch ) + break; + } // for (;i<nCount ; ++i) + 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 ::com::sun::star::uno::Reference< ::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition + ,::comphelper::OPropertyChangeListener* _pListener); + + /** opens the common character font dialog + */ + bool openCharDialog( + const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat>& _xReportControlFormat, + const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow, + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _out_rNewValues + ); + + /** opens the area dialog for shapes + */ + bool openAreaDialog( + const ::com::sun::star::uno::Reference< ::com::sun::star::report::XShape >& _xShape + ,const ::com::sun::star::uno::Reference< ::com::sun::star::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( ::rtl::OUString& _in_out_rFormula + , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _xContext + , const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>& _xWindow + , const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet >& _xRowSet + ); + + /** applies the character settings previously obtained via openCharDialog + */ + void applyCharacterSettings( + const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlFormat >& _rxReportControlFormat, + const ::com::sun::star::uno::Sequence< ::com::sun::star::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(Window* _pWindow,Window* _pToRegister, ::comphelper::mem_fun1_t<TaskPaneList,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 Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false,SdrObject* _pIgnore = NULL, sal_Int16 _nIgnoreType=0); + + SdrObject* isOver(const Rectangle& _rRect,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects, SdrUnoObj* _pIgnoreList[], int _nIgnoreListLength); + + /** checks whether the given OUnoObject object rectangle overlapps another object in that view. + * + * \param _pObj + * \param _rPage + * \param _rView + * \param _bAllObjects if <TRUE/> all objects are taken into account, otherwise only not marked ones + * \return the object which is overlapped, otherwise <NULL/>. If the given object is not of type OUnoObject <NULL/> will be returned. + */ + SdrObject* isOver(SdrObject* _pObj,SdrPage& _rPage,SdrView& _rView,bool _bAllObjects = false); + + /** retrieves the names of the parameters of the command which the given RowSet is bound to + */ + ::com::sun::star::uno::Sequence< ::rtl::OUString > + getParameterNames( const ::com::sun::star::uno::Reference< ::com::sun::star::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 TRUE whe the control should be inserted, otherwise not. + */ + void correctOverlapping(SdrObject* pControl,OReportSection& _aReportSection,bool _bInsert = true); + + /** returns a Rectangle of a given SdrObject + * + * \param pControl the SdrObject + */ + + 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,Window& _rWindow); +} +#endif //RPTUI_UITOOLS_HXX + diff --git a/reportdesign/source/ui/inc/Undo.hxx b/reportdesign/source/ui/inc/Undo.hxx new file mode 100644 index 000000000000..479872b06573 --- /dev/null +++ b/reportdesign/source/ui/inc/Undo.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_UNDO_HXX +#define RPTUI_UNDO_HXX + +#include "UndoActions.hxx" +#include <functional> + +FORWARD_DECLARE_INTERFACE(awt,XControl) +FORWARD_DECLARE_INTERFACE(awt,XControlContainer) +FORWARD_DECLARE_INTERFACE(drawing,XShape) +namespace dbaui +{ + class IController; +} +namespace rptui +{ + class OObjectBase; + + + /** \class OSectionUndo + * Undo class for section add and remove. + */ + class OSectionUndo : public OCommentUndoAction + { + OSectionUndo(const OSectionUndo&); + void operator =(const OSectionUndo&); + protected: + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> > + m_aControls; + ::std::vector< ::std::pair< ::rtl::OUString ,::com::sun::star::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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); + public: + TYPEINFO(); + OSectionUndo( OReportModel& rMod + ,sal_uInt16 _nSlot + ,Action _eAction + ,USHORT nCommentID); + virtual ~OSectionUndo(); + + virtual void Undo(); + virtual void Redo(); + }; + + /** Undo action for the group header, footer, page header, footer + */ + class OReportSectionUndo : public OSectionUndo + { + OReportHelper m_aReportHelper; + ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > + ,OReportHelper> m_pMemberFunction; + + void implReInsert( ); + void implReRemove( ); + OReportSectionUndo(const OReportSectionUndo&); + void operator =(const OReportSectionUndo&); + public: + TYPEINFO(); + //OReportSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + OReportSectionUndo( OReportModel& rMod + ,sal_uInt16 _nSlot + ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > + ,OReportHelper> _pMemberFunction + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReport + ,Action _eAction + ,USHORT nCommentID); + virtual ~OReportSectionUndo(); + }; + + /** Undo action for the group header, footer + */ + class OGroupSectionUndo : public OSectionUndo + { + OGroupHelper m_aGroupHelper; + ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > + ,OGroupHelper> m_pMemberFunction; + + mutable ::rtl::OUString m_sName; + + void implReInsert( ); + void implReRemove( ); + OGroupSectionUndo(const OGroupSectionUndo&); + void operator =(const OGroupSectionUndo&); + public: + TYPEINFO(); + //OGroupSectionUndo( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + OGroupSectionUndo( OReportModel& rMod + ,sal_uInt16 _nSlot + ,::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > + ,OGroupHelper> _pMemberFunction + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup >& _xGroup + ,Action _eAction + ,USHORT nCommentID); + + virtual String GetComment() const; + }; + + /** /class OGroupUndo + * \brief Undo action for removing a group object. + */ + class OGroupUndo : public OCommentUndoAction + { + ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup> m_xGroup; ///<! the group for the undo redo action + ::com::sun::star::uno::Reference< ::com::sun::star::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: + TYPEINFO(); + OGroupUndo(OReportModel& rMod + ,USHORT nCommentID + ,Action _eAction + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XGroup>& _xGroup + ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition >& _xReportDefinition); + virtual void Undo(); + virtual void Redo(); + }; +} +#endif // RPTUI_UNDO_HXX diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx new file mode 100644 index 000000000000..13b8566933c6 --- /dev/null +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -0,0 +1,361 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_VIEWSWINDOW_HXX +#define RPTUI_VIEWSWINDOW_HXX + +#include <com/sun/star/report/XSection.hpp> +#include <vcl/window.hxx> +#include <svtools/colorcfg.hxx> +#include "ReportDefines.hxx" +#include "ReportSection.hxx" +#include <comphelper/propmultiplex.hxx> +#include "cppuhelper/basemutex.hxx" +#include <svtools/colorcfg.hxx> +#include <com/sun/star/beans/NamedValue.hpp> +#include <svx/svdedtv.hxx> +#include <SectionView.hxx> +#include <unotools/options.hxx> +#include <list> +#include <vector> +#include <boost/shared_ptr.hpp> + +#include <MarkedSection.hxx> +#include <SectionWindow.hxx> + +class SdrHdl; +namespace rptui +{ + class OReportWindow; + class ODesignView; + class OEndMarker; + class OReportSection; + class OSectionView; + + + // ----------------------------------------------------------------------------- + struct RectangleLess : public ::std::binary_function< Rectangle, Rectangle, bool> + { + 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 Rectangle& lhs, const 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 abs(m_aRefPoint.X() - lhs.Center().X()) < abs(m_aRefPoint.X() - rhs.Center().X()); + case POS_CENTER_VERTICAL: + return abs(lhs.Center().Y() - m_aRefPoint.Y()) < abs(rhs.Center().Y() - m_aRefPoint.Y()); + } + return false; + } + }; + + class OWindowPositionCorrector + { + ::std::vector< ::std::pair<Window*,Point> > m_aChildren; + long m_nDeltaX; + long m_nDeltaY; + public: + OWindowPositionCorrector(Window* _pWindow,long _nDeltaX, long _nDeltaY) :m_nDeltaX(_nDeltaX), m_nDeltaY(_nDeltaY) + { + USHORT nCount = _pWindow->GetChildCount(); + m_aChildren.reserve(nCount); + while( nCount ) + { + Window* pChild = _pWindow->GetChild(--nCount); + m_aChildren.push_back(::std::pair<Window*,Point>(pChild,pChild->GetPosPixel())); + } + } + ~OWindowPositionCorrector() + { + ::std::vector< ::std::pair<Window*,Point> >::iterator aIter = m_aChildren.begin(); + ::std::vector< ::std::pair<Window*,Point> >::iterator aEnd = m_aChildren.end(); + for (; aIter != aEnd; ++aIter) + { + const Point aPos = aIter->first->GetPosPixel(); + if ( aPos == aIter->second ) + aIter->first->SetPosPixel(Point(m_nDeltaX,m_nDeltaY) + aPos); + } + } + }; + + class OViewsWindow : public Window + , public utl::ConfigurationListener + , public IMarkedSection + { + typedef ::std::multimap<Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess> TRectangleMap; + public: + typedef ::std::vector< ::boost::shared_ptr<OSectionWindow> > TSectionsMap; + + struct TReportPairHelper : public ::std::unary_function< TSectionsMap::value_type, OReportSection > + { + OReportSection& operator() (const TSectionsMap::value_type& lhs) const + { + return lhs->getReportSection(); + } + }; + struct TStartMarkerHelper : public ::std::unary_function< TSectionsMap::value_type, OStartMarker > + { + OStartMarker& operator() (const TSectionsMap::value_type& lhs) const + { + return lhs->getStartMarker(); + } + }; + private: + TSectionsMap m_aSections; + svtools::ColorConfig m_aColorConfig; + OReportWindow* m_pParent; + ::rtl::OUString m_sShapeType; + sal_Bool m_bInSplitHandler; + sal_Bool m_bInUnmark; + + void ImplInitSettings(); + /** returns the iterator at pos _nPos or the end() + */ + TSectionsMap::iterator getIteratorAtPos(USHORT _nPos); + void collectRectangles(TRectangleMap& _rMap,bool _bBoundRects); + void collectBoundResizeRect(const TRectangleMap& _rSortRectangles,sal_Int32 _nControlModification,bool _bAlignAtSection,bool _bBoundRects,Rectangle& _rBound,Rectangle& _rResize); + void impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet); + + OViewsWindow(OViewsWindow&); + void operator =(OViewsWindow&); + protected: + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + // windows overload + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + + virtual void Paint( const Rectangle& rRect ); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); + public: + OViewsWindow( + OReportWindow* _pReportWindow); + virtual ~OViewsWindow(); + + // windows overload + virtual void Resize(); + + void resize(const OSectionWindow& _rSectionWindow); + + /** late ctor + */ + void initialize(); + + inline OReportWindow* getView() const { return m_pParent; } + + /** removes the section at the given position. + * + * \param _nPosition Zero based. + */ + void removeSection(USHORT _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 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection + ,const ::rtl::OUString& _sColorEntry + ,USHORT _nPosition = USHRT_MAX); + + USHORT getSectionCount() const; + /** return the section at the given position + * + * \param _nPos + * \return the section at this pos or an empty section + */ + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const USHORT _nPos) const; + + /** turns the grid on or off + * + * \param _bVisible + */ + void toggleGrid(sal_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; + + inline bool empty() const { return m_aSections.empty(); } + void SetMode( DlgEdMode m_eMode ); + void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString()); + rtl::OUString GetInsertObjString() const; + /** 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 a 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* _pSectionView); + + /** returns the report section window for the given xsection + @param _xSection the section + */ + // ::boost::shared_ptr<OSectionWindow> getReportSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); + ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::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/> + */ + sal_Bool handleKeyEvent(const KeyEvent& _rEvent); + + /** the 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* _pSectionView,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark); + void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark); + + // IMarkedSection + ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const; + virtual void markSection(const sal_uInt16 _nPos); + + /** align all marked objects in all sections + */ + void alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects = false); + + /** creates a default object + * + */ + void createDefault(); + + /** shows or hides the ruler. + */ + void showRuler(sal_Bool _bShow); + + /** returns the currently set shape type. + * + * \return \member m_sShapeType + */ + inline ::rtl::OUString getShapeType() const { return m_sShapeType; } + + /** returns the current position in the list + */ + USHORT getPosition(const OSectionWindow* _pSectionWindow = NULL) const; + + /** calls on every section BrkAction + * + */ + void BrkAction(); + void BegMarkObj(const Point& _aPnt,const OSectionView* _pSection); + + private: + void BegDragObj_createInvisibleObjectAtPosition(const Rectangle& _aRect, const OSectionView& _rSection); + void EndDragObj_removeInvisibleObjects(); + Point m_aDragDelta; + ::std::vector<SdrObject*> m_aBegDragTempList; + bool isObjectInMyTempList(SdrObject *); + 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 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 _bMove /*= true */, bool _bControlKeySet); + // void MovAction2(const Point& rPnt,const OSectionView* _pSection); + + 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; + + /** collpase all sections given by their position + * + * \param _aCollpasedSections The position of the sections which should be collapsed. + */ + void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections); + + /** 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< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const; + }; +//============================================================================== +} // rptui +//============================================================================== +#endif // RPTUI_VIEWSWINDOW_HXX + diff --git a/reportdesign/source/ui/inc/dlgedclip.hxx b/reportdesign/source/ui/inc/dlgedclip.hxx new file mode 100644 index 000000000000..bc57a83dc45c --- /dev/null +++ b/reportdesign/source/ui/inc/dlgedclip.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REPORT_RPTUICLIP_HXX +#define _REPORT_RPTUICLIP_HXX + +#include <svtools/transfer.hxx> +#include <com/sun/star/beans/NamedValue.hpp> + +namespace rptui +{ +//============================================================================ +// OReportExchange +//============================================================================ +/** \class OReportExchange + * \brief defines a clipboard fromat for copying selection elements. + * \ingroup reportdesign_source_ui_report + * + * + */ +class OReportExchange : public TransferableHelper +{ +public: + typedef ::com::sun::star::uno::Sequence< ::com::sun::star::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 sal_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 sal_uInt32 getDescriptorFormatId(); + +protected: + // TransferableHelper overridables + virtual void AddSupportedFormats(); + virtual sal_Bool GetData( const ::com::sun::star::datatransfer::DataFlavor& rFlavor ); +private: + TSectionElements m_aCopyElements; +}; +} +#endif // _REPORT_RPTUICLIP_HXX diff --git a/reportdesign/source/ui/inc/dlgedfac.hxx b/reportdesign/source/ui/inc/dlgedfac.hxx new file mode 100644 index 000000000000..fd5738447cd6 --- /dev/null +++ b/reportdesign/source/ui/inc/dlgedfac.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REPORT_RPTUIFAC_HXX +#define _REPORT_RPTUIFAC_HXX + + +#include <svx/svdobj.hxx> + +namespace rptui +{ + class OReportSection; +//============================================================================ +// DlgEdFactory +//============================================================================ +class DlgEdFactory +{ +public: + DlgEdFactory(); + ~DlgEdFactory(); + + DECL_LINK( MakeObject, SdrObjFactory * ); +}; +} +#endif // _REPORT_RPTUIFAC_HXX + diff --git a/reportdesign/source/ui/inc/dlgedfunc.hxx b/reportdesign/source/ui/inc/dlgedfunc.hxx new file mode 100644 index 000000000000..0c397c106dbb --- /dev/null +++ b/reportdesign/source/ui/inc/dlgedfunc.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _REPORT_RPTUIFUNC_HXX +#define _REPORT_RPTUIFUNC_HXX + +#include <vcl/timer.hxx> + +class Timer; +class MouseEvent; +class Point; +class SdrTextObj; +class SdrObject; +namespace rptui +{ + +class OReportSection; +class OSectionView; + +//============================================================================ +// DlgEdFunc +//============================================================================ + +class DlgEdFunc /* : public LinkHdl */ +{ + DlgEdFunc(const DlgEdFunc&); + void operator =(const DlgEdFunc&); +protected: + OReportSection* m_pParent; + OSectionView& m_rView; + Timer aScrollTimer; + Point m_aMDPos; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> m_xOverlappingObj; + SdrObject * m_pOverlappingObj; + sal_Int32 m_nOverlappedControlColor; + sal_Int32 m_nOldColor; + bool m_bSelectionMode; + bool m_bUiActive; + bool m_bShowPropertyBrowser; + + DECL_LINK( ScrollTimeout, Timer * ); + 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 a 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(); + + /** 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/> + */ + virtual sal_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(sal_Int32 _nColor); + void stopScrollTimer(); + + /** deactivate all ole object + */ + void deactivateOle(bool _bSelect = false); + + inline bool isUiActive() const { return m_bUiActive; } +protected: + void colorizeOverlappedObject(SdrObject* _pOverlappedObj); + void unColorizeOverlappedObj(); + + +}; + +//============================================================================ +// DlgEdFuncInsert +//============================================================================ + +class DlgEdFuncInsert : public DlgEdFunc +{ +public: + DlgEdFuncInsert( OReportSection* pParent ); + ~DlgEdFuncInsert(); + + virtual BOOL MouseButtonDown( const MouseEvent& rMEvt ); + virtual BOOL MouseButtonUp( const MouseEvent& rMEvt ); + virtual BOOL MouseMove( const MouseEvent& rMEvt ); +}; + +//============================================================================ +// DlgEdFuncSelect +//============================================================================ + +class DlgEdFuncSelect : public DlgEdFunc +{ +public: + DlgEdFuncSelect( OReportSection* pParent ); + ~DlgEdFuncSelect(); + + virtual BOOL MouseButtonDown( const MouseEvent& rMEvt ); + virtual BOOL MouseButtonUp( const MouseEvent& rMEvt ); + virtual BOOL MouseMove( const MouseEvent& rMEvt ); + + void SetInEditMode(SdrTextObj* _pTextObj,const MouseEvent& rMEvt, BOOL bQuickDrag); +}; + +} +#endif //_REPORT_RPTUIFUNC_HXX diff --git a/reportdesign/source/ui/inc/dlgpage.hxx b/reportdesign/source/ui/inc/dlgpage.hxx new file mode 100644 index 000000000000..d335b8f28920 --- /dev/null +++ b/reportdesign/source/ui/inc/dlgpage.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_DLGPAGE_HXX +#define RPTUI_DLGPAGE_HXX + +#include <sfx2/tabdlg.hxx> + +namespace rptui +{ +/************************************************************************* +|* +|* Seite einrichten-Tab-Dialog +|* +\************************************************************************/ +class ORptPageDialog : public SfxTabDialog +{ +private: + const SfxItemSet& rOutAttrs; + + ORptPageDialog(const ORptPageDialog&); + void operator =(const ORptPageDialog&); +public: + + ORptPageDialog( Window* pParent, const SfxItemSet* pAttr,USHORT _nPageId); + virtual ~ORptPageDialog() {} +}; +// ============================================================================= +} // namespace rptui +// ============================================================================= +#endif // RPTUI_DLGPAGE_HXX diff --git a/reportdesign/source/ui/inc/metadata.hxx b/reportdesign/source/ui/inc/metadata.hxx new file mode 100644 index 000000000000..5ab2f53467ba --- /dev/null +++ b/reportdesign/source/ui/inc/metadata.hxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_METADATA_HXX_ +#define RPTUI_METADATA_HXX_ + +#include "ModuleHelper.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/inspection/XPropertyHandler.hpp> +/** === end UNO includes === **/ + +//............................................................................ +namespace rptui +{ +//............................................................................ + + struct OPropertyInfoImpl; + + //======================================================================== + //= OPropertyInfoService + //======================================================================== + class OPropertyInfoService + :public OModuleClient + { + OPropertyInfoService(const OPropertyInfoService&); + void operator =(const OPropertyInfoService&); + protected: + static sal_uInt16 s_nCount; + static OPropertyInfoImpl* s_pPropertyInfos; + // TODO: a real structure which allows quick access by name as well as by id + + public: + OPropertyInfoService(){} + virtual ~OPropertyInfoService(){} + // IPropertyInfoService + sal_Int32 getPropertyId(const String& _rName) const; + String getPropertyTranslation(sal_Int32 _nId) const; + sal_Int32 getPropertyHelpId(sal_Int32 _nId) const; + sal_uInt32 getPropertyUIFlags(sal_Int32 _nId) const; + static void getExcludeProperties(::std::vector< com::sun::star::beans::Property >& _rExcludeProperties,const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _xFormComponentHandler); + + bool isComposable( + const ::rtl::OUString& _rPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyHandler >& _xFormComponentHandler + ); + + protected: + static const OPropertyInfoImpl* getPropertyInfo(); + + static const OPropertyInfoImpl* getPropertyInfo(const String& _rName); + static const OPropertyInfoImpl* getPropertyInfo(sal_Int32 _nId); + }; + + //======================================================================== + //= HelpIdUrl + //======================================================================== + /// small helper to translate help ids into help urls + class HelpIdUrl + { + public: + static ::rtl::OUString getHelpURL( sal_uInt32 _nHelpId ); + }; + + //======================================================================== + //= UI flags (for all browseable properties) + //======================================================================== + +#define PROP_FLAG_NONE 0x00000001 // no special flag +#define PROP_FLAG_ENUM 0x00000002 // the property is some kind of enum property, i.e. its + // value is chosen from a fixed list of possible values +#define PROP_FLAG_ENUM_ONE 0x00000004 // the property is an enum property starting with 1 + // (note that this includes PROP_FLAG_ENUM) +#define PROP_FLAG_COMPOSEABLE 0x00000008 // the property is "composeable", i.e. an intersection of property + // sets should expose it, if all elements do +#define PROP_FLAG_EXPERIMENTAL 0x00000010 // the property is experimental, i.e. should not appear in the + // UI, unless experimental properties are enabled by a configuraiton + // option +#define PROP_FLAG_DATA_PROPERTY 0x00000020 // the property is to appear on the "Data" page + + //======================================================================== + //= property ids (for all browseable 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_FORMULA 16 + #define PROPERTY_ID_PRINTREPEATEDVALUES 17 + #define PROPERTY_ID_CONDITIONALPRINTEXPRESSION 18 + #define PROPERTY_ID_INITIALFORMULA 19 + #define PROPERTY_ID_STARTNEWCOLUMN 20 + #define PROPERTY_ID_TYPE 21 + #define PROPERTY_ID_DATAFIELD 22 + #define PROPERTY_ID_CHARFONTNAME 23 + #define PROPERTY_ID_PRINTWHENGROUPCHANGE 24 + #define PROPERTY_ID_DEEPTRAVERSING 25 + #define PROPERTY_ID_PREEVALUATED 26 + + #define PROPERTY_ID_BACKTRANSPARENT 27 + #define PROPERTY_ID_CONTROLBACKGROUNDTRANSPARENT 28 + #define PROPERTY_ID_BACKCOLOR 29 + #define PROPERTY_ID_CONTROLBACKGROUND 30 + + #define PROPERTY_ID_FORMULALIST 31 + #define PROPERTY_ID_SCOPE 32 + #define PROPERTY_ID_RESETPAGENUMBER 33 + #define PROPERTY_ID_CHARTTYPE 34 + #define PROPERTY_ID_MASTERFIELDS 35 + #define PROPERTY_ID_DETAILFIELDS 36 + #define PROPERTY_ID_PREVIEW_COUNT 37 + #define PROPERTY_ID_AREA 38 + #define PROPERTY_ID_MIMETYPE 39 + + #define PROPERTY_ID_FONT 40 + #define PROPERTY_ID_PARAADJUST 41 + #define PROPERTY_ID_VERTICALALIGN 42 + + +//............................................................................ +} // namespace rptui +//............................................................................ + +#endif // RPTUI_METADATA_HXX_ + diff --git a/reportdesign/source/ui/inc/propbrw.hxx b/reportdesign/source/ui/inc/propbrw.hxx new file mode 100644 index 000000000000..bf64f7687046 --- /dev/null +++ b/reportdesign/source/ui/inc/propbrw.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _REPORT_PROPBRW_HXX +#define _REPORT_PROPBRW_HXX + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/inspection/XObjectInspector.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> +#include <vcl/dockwin.hxx> +#include <svx/svdmark.hxx> +#include "ModuleHelper.hxx" + +namespace rptui +{ + +class OSectionView; +class ODesignView; +class OObjectBase; +//============================================================================ +// PropBrw +//============================================================================ + +class PropBrw : public DockingWindow , public SfxListener, public SfxBroadcaster +{ +private: + OModuleClient m_aModuleClient; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > + m_xInspectorContext; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + m_xORB; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > + m_xMeAsFrame; + ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspector > + m_xBrowserController; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > + m_xBrowserComponentWindow; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> + m_xLastSection; /// is the previously displayed section + ::rtl::OUString m_sLastActivePage; + ODesignView* m_pDesignView; + OSectionView* m_pView; + sal_Bool m_bInitialStateChange; + + PropBrw(PropBrw&); + void operator =(PropBrw&); +protected: + + virtual void Resize(); + virtual sal_Bool Close(); + + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> > + CreateCompPropSet(const SdrMarkList& rMarkList); + + void implSetNewObject( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >& _aObjects = ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >()); + + ::rtl::OUString GetHeadlineName( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> >& _aObjects); + + void implDetachController(); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> CreateComponentPair(OObjectBase* _pObj); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> CreateComponentPair( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xFormComponent + ,const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent); + DECL_LINK( OnAsyncGetFocus, void* ); + +public: + PropBrw(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xORB + ,Window* pParent + ,ODesignView* _pDesignView); + virtual ~PropBrw(); + + virtual void LoseFocus(); + + void Update( OSectionView* m_pView ); + void Update( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent); + inline OSectionView* GetCurView() const { return m_pView; } + ::rtl::OUString getCurrentPage() const; + void setCurrentPage(const ::rtl::OUString& _sLastActivePage); + + ::Size getMinimumSize() const; +private: + using Window::Update; +}; +//============================================================================== +} // rptui +//============================================================================== +#endif // _REPORT_PROPBRW_HXX diff --git a/reportdesign/source/ui/inc/statusbarcontroller.hxx b/reportdesign/source/ui/inc/statusbarcontroller.hxx new file mode 100644 index 000000000000..6fffd36cc4df --- /dev/null +++ b/reportdesign/source/ui/inc/statusbarcontroller.hxx @@ -0,0 +1,92 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_STATUSBARCONTROLLER_HXX +#define RPTUI_STATUSBARCONTROLLER_HXX + +#include <svtools/statusbarcontroller.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase1.hxx> +#include <comphelper/implementationreference.hxx> + +class SfxStatusBarControl; +namespace rptui +{ + typedef ::comphelper::ImplementationReference<SfxStatusBarControl,::com::sun::star::frame::XStatusbarController> TStatusbarHelper; + + typedef ::cppu::ImplHelper1 < ::com::sun::star::lang::XServiceInfo> OStatusbarController_BASE; + class OStatusbarController : public ::svt::StatusbarController, + public OStatusbarController_BASE + { + TStatusbarHelper m_pController; + sal_uInt16 m_nSlotId; + sal_uInt16 m_nId; + public: + OStatusbarController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + + static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); + + private: + void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + // XInterface + DECLARE_XINTERFACE( ) + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + // need by registration + + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + + // XStatusbarController + virtual ::sal_Bool SAL_CALL mouseButtonDown( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseMove( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL mouseButtonUp( const ::com::sun::star::awt::MouseEvent& aMouseEvent ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL command( const ::com::sun::star::awt::Point& aPos, + ::sal_Int32 nCommand, + ::sal_Bool bMouseEvent, + const ::com::sun::star::uno::Any& aData ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL paint( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics >& xGraphics, + const ::com::sun::star::awt::Rectangle& rOutputRectangle, + ::sal_Int32 nItemId, ::sal_Int32 nStyle ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL click() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doubleClick() throw (::com::sun::star::uno::RuntimeException); + }; +} +#endif // DBAUI_STATUSBARCONTROLLER_HXX + diff --git a/reportdesign/source/ui/inc/toolboxcontroller.hxx b/reportdesign/source/ui/inc/toolboxcontroller.hxx new file mode 100644 index 000000000000..447db93fe667 --- /dev/null +++ b/reportdesign/source/ui/inc/toolboxcontroller.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef RPTUI_TOOLBOXCONTROLLER_HXX +#define RPTUI_TOOLBOXCONTROLLER_HXX + +#include <svtools/toolboxcontroller.hxx> +#include <comphelper/stl_types.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/frame/XSubToolbarController.hpp> +#include <cppuhelper/implbase2.hxx> +#include <comphelper/implementationreference.hxx> + +class SfxToolBoxControl; +namespace rptui +{ + typedef ::cppu::ImplHelper2 < ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::frame::XSubToolbarController> TToolboxController_BASE; + typedef ::comphelper::ImplementationReference<SfxToolBoxControl,::com::sun::star::frame::XToolbarController> TToolbarHelper; + + class OToolboxController : public ::svt::ToolboxController + ,public TToolboxController_BASE + { + DECLARE_STL_USTRINGACCESS_MAP(sal_Bool,TCommandState); + TCommandState m_aStates; + TToolbarHelper m_pToolbarController; + sal_uInt16 m_nToolBoxId; + sal_uInt16 m_nSlotId; + OToolboxController(const OToolboxController&); + void operator =(const OToolboxController&); + public: + OToolboxController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + virtual ~OToolboxController(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + // need by registration + static ::rtl::OUString getImplementationName_Static() throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + create(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext); + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + // XStatusListener + virtual void SAL_CALL statusChanged( const ::com::sun::star::frame::FeatureStateEvent& Event ) throw ( ::com::sun::star::uno::RuntimeException ); + // XToolbarController + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createPopupWindow() throw (::com::sun::star::uno::RuntimeException); + + // XSubToolbarController + virtual ::sal_Bool SAL_CALL opensSubToolbar( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubToolbarName( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL functionSelected( const ::rtl::OUString& aCommand ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL updateImage( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createItemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& Parent ) throw (::com::sun::star::uno::RuntimeException); + }; +//.......................................................................... +} // rptui +//.......................................................................... +#endif //RPTUI_TOOLBOXCONTROLLER_HXX + |