diff options
author | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-11-25 14:29:43 +0100 |
---|---|---|
committer | Frank Schoenheit [fs] <frank.schoenheit@oracle.com> | 2010-11-25 14:29:43 +0100 |
commit | 4ae5573a0f94cc859ba2c30ac71bcd2ff8677f1f (patch) | |
tree | 42b732a30c938aae158d5f7c1a44dcd3f4ac4ac9 | |
parent | 5cf47c0008eb4126cfc41c59fbeeb4d73c8e22b1 (diff) |
undoapi: migrated report designer to use an own, model-bound UndoManager, instead of the UndoManager formerly bound to the controller
-rwxr-xr-x | dbaccess/inc/dbaundomanager.hxx (renamed from dbaccess/source/ui/misc/dbaundomanager.hxx) | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | reportdesign/inc/ReportDefinition.hxx | 77 | ||||
-rw-r--r-- | reportdesign/inc/RptModel.hxx | 8 | ||||
-rw-r--r-- | reportdesign/inc/UndoActions.hxx | 52 | ||||
-rw-r--r-- | reportdesign/source/core/api/ReportDefinition.cxx | 179 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/RptModel.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/RptObject.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/UndoActions.cxx | 2 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/UndoEnv.cxx | 23 | ||||
-rw-r--r-- | reportdesign/source/core/sdr/formatnormalizer.cxx | 4 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/CondFormat.cxx | 4 | ||||
-rw-r--r-- | reportdesign/source/ui/dlg/GroupsSorting.cxx | 16 | ||||
-rw-r--r-- | reportdesign/source/ui/inc/ReportController.hxx | 95 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ReportController.cxx | 227 | ||||
-rw-r--r-- | reportdesign/source/ui/report/SectionWindow.cxx | 7 | ||||
-rw-r--r-- | reportdesign/source/ui/report/ViewsWindow.cxx | 2 |
16 files changed, 411 insertions, 293 deletions
diff --git a/dbaccess/source/ui/misc/dbaundomanager.hxx b/dbaccess/inc/dbaundomanager.hxx index 99ff86cb39bf..1b8627f66326 100755 --- a/dbaccess/source/ui/misc/dbaundomanager.hxx +++ b/dbaccess/inc/dbaundomanager.hxx @@ -27,6 +27,8 @@ #ifndef DBACCESS_DBAUNDOMANAGER_HXX #define DBACCESS_DBAUNDOMANAGER_HXX +#include "dbaccessdllapi.h" + /** === begin UNO includes === **/ #include <com/sun/star/document/XUndoManager.hpp> /** === end UNO includes === **/ @@ -47,7 +49,7 @@ namespace dbaui //================================================================================================================== struct UndoManager_Impl; typedef ::cppu::ImplHelper1< ::com::sun::star::document::XUndoManager > UndoManager_Base; - class UndoManager : public UndoManager_Base + class DBACCESS_DLLPUBLIC UndoManager : public UndoManager_Base { public: UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex ); diff --git a/reportdesign/inc/ReportDefinition.hxx b/reportdesign/inc/ReportDefinition.hxx index d932110bc5f3..68a16e609b77 100644..100755 --- a/reportdesign/inc/ReportDefinition.hxx +++ b/reportdesign/inc/ReportDefinition.hxx @@ -29,25 +29,36 @@ #define REPORTDESIGN_API_REPORTDEFINITION_HXX #include "dllapi.h" -#include <com/sun/star/report/XReportDefinition.hpp> -#include <cppuhelper/compbase12.hxx> -#include <cppuhelper/basemutex.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> + +#include "ReportHelperDefines.hxx" + +/** === begin UNO includes === **/ +#include <com/sun/star/datatransfer/XTransferable.hpp> +#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> +#include <com/sun/star/document/XUndoManagerSupplier.hpp> +#include <com/sun/star/frame/XModule.hpp> #include <com/sun/star/frame/XTitle.hpp> #include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> #include <com/sun/star/frame/XUntitledNumbers.hpp> -#include <com/sun/star/frame/XModule.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/report/XReportDefinition.hpp> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> -#include <com/sun/star/datatransfer/XTransferable.hpp> -#include <cppuhelper/propertysetmixin.hxx> -#include <comphelper/uno3.hxx> +/** === end UNO includes === **/ + #include <comphelper/embeddedobjectcontainer.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/propertysetmixin.hxx> #include <svx/unomod.hxx> -#include "ReportHelperDefines.hxx" +#if !defined(INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13) +#define INCLUDED_COMPHELPER_IMPLBASE_VAR_HXX_13 +#define COMPHELPER_IMPLBASE_INTERFACE_NUMBER 13 +#include <comphelper/implbase_var.hxx> +#endif + #include <boost/shared_ptr.hpp> @@ -62,32 +73,37 @@ namespace comphelper namespace reportdesign { class OReportComponentProperties; - typedef ::cppu::WeakComponentImplHelper12< com::sun::star::report::XReportDefinition - ,com::sun::star::document::XEventBroadcaster - ,com::sun::star::lang::XServiceInfo - ,com::sun::star::frame::XModule - ,com::sun::star::lang::XUnoTunnel - ,com::sun::star::util::XNumberFormatsSupplier - ,::com::sun::star::frame::XTitle - ,::com::sun::star::frame::XTitleChangeBroadcaster - ,::com::sun::star::frame::XUntitledNumbers - ,::com::sun::star::document::XDocumentPropertiesSupplier - ,::com::sun::star::datatransfer::XTransferable - ,SvxUnoDrawMSFactory> ReportDefinitionBase; - typedef ::cppu::PropertySetMixin<com::sun::star::report::XReportDefinition> ReportDefinitionPropertySet; + typedef ::comphelper::WeakComponentImplHelper13 < ::com::sun::star::report::XReportDefinition + , ::com::sun::star::document::XEventBroadcaster + , ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::frame::XModule + , ::com::sun::star::lang::XUnoTunnel + , ::com::sun::star::util::XNumberFormatsSupplier + , ::com::sun::star::frame::XTitle + , ::com::sun::star::frame::XTitleChangeBroadcaster + , ::com::sun::star::frame::XUntitledNumbers + , ::com::sun::star::document::XDocumentPropertiesSupplier + , ::com::sun::star::datatransfer::XTransferable + , ::com::sun::star::document::XUndoManagerSupplier + , SvxUnoDrawMSFactory + > ReportDefinitionBase; + + typedef ::cppu::PropertySetMixin< ::com::sun::star::report::XReportDefinition > ReportDefinitionPropertySet; struct OReportDefinitionImpl; /** \class OReportDefinition Defines the implementation of a \interface com:::sun::star::report::XReportDefinition * \ingroup reportdesign_api * */ - class REPORTDESIGN_DLLPUBLIC OReportDefinition : public ::cppu::BaseMutex, - public ReportDefinitionBase, - public ReportDefinitionPropertySet, - public ::comphelper::IEmbeddedHelper + class REPORTDESIGN_DLLPUBLIC OReportDefinition :public ::cppu::BaseMutex + ,public ReportDefinitionBase + ,public ReportDefinitionPropertySet + ,public ::comphelper::IEmbeddedHelper { + private: ::boost::shared_ptr<OReportComponentProperties> m_aProps; ::boost::shared_ptr<OReportDefinitionImpl> m_pImpl; + private: OReportDefinition(const OReportDefinition&); OReportDefinition& operator=(const OReportDefinition&); @@ -380,6 +396,9 @@ namespace reportdesign virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw (::com::sun::star::uno::RuntimeException); virtual ::sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::uno::RuntimeException); + // XUndoManagerSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > SAL_CALL getUndoManager( ) throw (::com::sun::star::uno::RuntimeException); + // comphelper::IEmbeddedHelper virtual com::sun::star::uno::Reference < com::sun::star::embed::XStorage > getStorage() const; virtual ::comphelper::EmbeddedObjectContainer& getEmbeddedObjectContainer() const; diff --git a/reportdesign/inc/RptModel.hxx b/reportdesign/inc/RptModel.hxx index 872938426259..da0b92186ace 100644 --- a/reportdesign/inc/RptModel.hxx +++ b/reportdesign/inc/RptModel.hxx @@ -35,7 +35,7 @@ class Window; namespace dbaui { - class OSingleDocumentController; + class DBSubComponentController; } namespace reportdesign { @@ -56,7 +56,7 @@ class REPORTDESIGN_DLLPUBLIC OReportModel : public SdrModel private: OXUndoEnvironment* m_pUndoEnv; - ::dbaui::OSingleDocumentController* m_pController; + ::dbaui::DBSubComponentController* m_pController; ::reportdesign::OReportDefinition* m_pReportDefinition; virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel(); @@ -79,8 +79,8 @@ public: OXUndoEnvironment& GetUndoEnv(); void SetModified(sal_Bool _bModified); - inline dbaui::OSingleDocumentController* getController() const { return m_pController; } - inline void attachController( dbaui::OSingleDocumentController& _rController ) { m_pController = &_rController; } + inline dbaui::DBSubComponentController* getController() const { return m_pController; } + inline void attachController( dbaui::DBSubComponentController& _rController ) { m_pController = &_rController; } void detachController(); OReportPage* createNewPage(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); diff --git a/reportdesign/inc/UndoActions.hxx b/reportdesign/inc/UndoActions.hxx index 180fa616cf39..cda3a2d6b4a2 100644 --- a/reportdesign/inc/UndoActions.hxx +++ b/reportdesign/inc/UndoActions.hxx @@ -28,8 +28,9 @@ #define RPTUI_UNDOACTIONS_HXX #include "dllapi.h" -#include <svx/svdundo.hxx> -#include <tools/string.hxx> + +#include "RptModel.hxx" + /** === begin UNO includes === **/ #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/beans/XPropertySet.hpp> @@ -43,13 +44,16 @@ #include <com/sun/star/report/XReportComponent.hpp> #include <com/sun/star/report/XReportDefinition.hpp> #include <com/sun/star/report/XGroup.hpp> +#include <com/sun/star/document/XUndoManager.hpp> /** === end UNO includes === **/ + #include <cppuhelper/implbase3.hxx> #include <comphelper/uno3.hxx> #include <comphelper/sequence.hxx> #include <svl/lstner.hxx> #include <svx/svdouno.hxx> -#include "RptModel.hxx" +#include <svx/svdundo.hxx> +#include <tools/string.hxx> #include <functional> #include <memory> @@ -119,23 +123,51 @@ namespace rptui static ::std::mem_fun_t< ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection> , OReportHelper> getMemberFunction(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); }; - class REPORTDESIGN_DLLPUBLIC UndoManagerListAction + //================================================================================================================== + //= UndoContext + //================================================================================================================== + class UndoContext { + public: + UndoContext( SfxUndoManager& i_undoManager, const ::rtl::OUString& i_undoTitle ) + :m_rUndoManager( i_undoManager ) + { + m_rUndoManager.EnterListAction( i_undoTitle, String() ); + } + + ~UndoContext() + { + m_rUndoManager.LeaveListAction(); + } + private: - SfxUndoManager& m_rManager; + SfxUndoManager& m_rUndoManager; + }; + //================================================================================================================== + //= UndoSuppressor + //================================================================================================================== + class UndoSuppressor + { public: - UndoManagerListAction( SfxUndoManager& _rManager, const String& _rListActionComment ) - :m_rManager( _rManager ) + UndoSuppressor( SfxUndoManager& i_undoManager ) + :m_rUndoManager( i_undoManager ) { - m_rManager.EnterListAction( _rListActionComment, String() ); + m_rUndoManager.EnableUndo( false ); } - ~UndoManagerListAction() + + ~UndoSuppressor() { - m_rManager.LeaveListAction(); + m_rUndoManager.EnableUndo( true ); } + + private: + SfxUndoManager& m_rUndoManager; }; + //================================================================================================================== + //= OCommentUndoAction + //================================================================================================================== class REPORTDESIGN_DLLPUBLIC OCommentUndoAction : public SdrUndoAction { protected: diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index 2cf848dc0c84..6b8414ad60a3 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -24,18 +24,66 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ + #include "ReportDefinition.hxx" + +#include "FixedLine.hxx" +#include "FixedText.hxx" +#include "FormattedField.hxx" +#include "Functions.hxx" +#include "Groups.hxx" +#include "ImageControl.hxx" +#include "ReportComponent.hxx" +#include "ReportHelperImpl.hxx" +#include "RptDef.hxx" +#include "RptModel.hxx" +#include "Section.hxx" +#include "Shape.hxx" +#include "Tools.hxx" +#include "UndoEnv.hxx" +#include "core_resource.hrc" +#include "core_resource.hxx" +#include "corestrings.hrc" + +/** === begin UNO includes === **/ #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> +#include <com/sun/star/document/EventObject.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/document/XFilter.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/ElementModes.hpp> +#include <com/sun/star/embed/EmbedMapUnits.hpp> +#include <com/sun/star/embed/EntryInitModes.hpp> +#include <com/sun/star/embed/XEmbedPersist.hpp> +#include <com/sun/star/embed/XTransactedObject.hpp> +#include <com/sun/star/frame/FrameSearchFlag.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/io/XActiveDataSource.hpp> +#include <com/sun/star/io/XSeekable.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/report/GroupKeepTogether.hpp> #include <com/sun/star/report/ReportPrintOption.hpp> #include <com/sun/star/report/XFunction.hpp> #include <com/sun/star/sdb/CommandType.hpp> +#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> +#include <com/sun/star/style/GraphicLocation.hpp> +#include <com/sun/star/style/NumberingType.hpp> +#include <com/sun/star/style/PageStyleLayout.hpp> +#include <com/sun/star/style/XStyle.hpp> #include <com/sun/star/table/BorderLine.hpp> #include <com/sun/star/table/ShadowFormat.hpp> -#include <com/sun/star/style/PageStyleLayout.hpp> -#include <com/sun/star/style/GraphicLocation.hpp> +#include <com/sun/star/task/ErrorCodeIOException.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/ui/XUIConfigurationStorage.hpp> #include <com/sun/star/xml/AttributeData.hpp> -#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/xml/sax/XDocumentHandler.hpp> +/** === end UNO includes === **/ + #include <comphelper/broadcasthelper.hxx> #include <comphelper/documentconstants.hxx> #include <comphelper/genericpropertyset.hxx> @@ -44,83 +92,41 @@ #include <comphelper/namecontainer.hxx> #include <comphelper/namedvaluecollection.hxx> #include <comphelper/numberedcollection.hxx> -#include <comphelper/propertystatecontainer.hxx> #include <comphelper/proparrhlp.hxx> #include <comphelper/property.hxx> #include <comphelper/propertysetinfo.hxx> -#include <comphelper/sequence.hxx> +#include <comphelper/propertystatecontainer.hxx> #include <comphelper/seqstream.hxx> +#include <comphelper/sequence.hxx> #include <comphelper/storagehelper.hxx> #include <comphelper/uno3.hxx> -#include <com/sun/star/chart2/data/DatabaseDataProvider.hpp> -#include <vcl/svapp.hxx> -#include <vcl/virdev.hxx> -#include <vos/mutex.hxx> -#include <com/sun/star/beans/XMultiPropertyStates.hpp> -#include <com/sun/star/document/EventObject.hpp> -#include <com/sun/star/document/XEventListener.hpp> -#include <com/sun/star/style/XStyle.hpp> -#include <com/sun/star/embed/XTransactedObject.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/embed/EmbedMapUnits.hpp> -#include <com/sun/star/embed/EntryInitModes.hpp> -#include <com/sun/star/embed/Aspects.hpp> -#include <com/sun/star/io/XActiveDataSource.hpp> -#include <com/sun/star/embed/ElementModes.hpp> -#include <com/sun/star/io/XSeekable.hpp> -#include <com/sun/star/embed/XEmbedPersist.hpp> -#include <com/sun/star/task/XStatusIndicator.hpp> -#include <com/sun/star/task/XStatusIndicatorFactory.hpp> -#include <com/sun/star/ui/XUIConfigurationStorage.hpp> -#include <com/sun/star/document/XExporter.hpp> -#include <com/sun/star/document/XImporter.hpp> -#include <com/sun/star/document/XFilter.hpp> -#include <com/sun/star/task/ErrorCodeIOException.hpp> -#include <com/sun/star/xml/sax/XDocumentHandler.hpp> -#include <com/sun/star/frame/XComponentLoader.hpp> -#include <com/sun/star/frame/FrameSearchFlag.hpp> -#include "corestrings.hrc" -#include "Groups.hxx" -#include "RptDef.hxx" -#include "Section.hxx" -#include "FixedLine.hxx" -#include "core_resource.hrc" -#include "core_resource.hxx" -#include "Tools.hxx" -#include <tools/debug.hxx> -#include <tools/diagnose_ex.h> -#include <unotools/streamwrap.hxx> #include <connectivity/CommonTools.hxx> #include <connectivity/dbconversion.hxx> -#include <framework/titlehelper.hxx> #include <connectivity/dbtools.hxx> -#include <com/sun/star/task/XStatusIndicator.hpp> -#include "Functions.hxx" -#include <boost/mem_fn.hpp> -#include <boost/bind.hpp> -#include <boost/utility.hpp> -#include <unotools/saveopt.hxx> -#include "RptModel.hxx" -#include "UndoEnv.hxx" -#include "FormattedField.hxx" -#include "FixedText.hxx" -#include "ImageControl.hxx" -#include "Shape.hxx" -#include "ReportHelperImpl.hxx" -#include <svl/itempool.hxx> -#include <unotools/moduleoptions.hxx> -#include <osl/thread.hxx> - +#include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <dbaccess/dbaundomanager.hxx> #include <editeng/paperinf.hxx> +#include <framework/titlehelper.hxx> +#include <osl/thread.hxx> +#include <svl/itempool.hxx> +#include <svl/undo.hxx> #include <svx/svdlayer.hxx> +#include <svx/unofill.hxx> #include <svx/xmleohlp.hxx> #include <svx/xmlgrhlp.hxx> -#include <svx/unofill.hxx> -#include <cppuhelper/interfacecontainer.h> -#include <cppuhelper/exc_hlp.hxx> -#include "ReportComponent.hxx" -#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp> -#include <com/sun/star/style/NumberingType.hpp> +#include <tools/debug.hxx> +#include <tools/diagnose_ex.h> +#include <unotools/moduleoptions.hxx> +#include <unotools/saveopt.hxx> +#include <unotools/streamwrap.hxx> +#include <vcl/svapp.hxx> +#include <vcl/virdev.hxx> +#include <vos/mutex.hxx> + +#include <boost/bind.hpp> +#include <boost/mem_fn.hpp> +#include <boost/utility.hpp> #define MAP_LEN(x) x, sizeof(x) - 1 #define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x)) @@ -607,6 +613,7 @@ struct OReportDefinitionImpl ::boost::shared_ptr< ::comphelper::EmbeddedObjectContainer> m_pObjectContainer; ::boost::shared_ptr<rptui::OReportModel> m_pReportModel; + ::rtl::Reference< ::dbaui::UndoManager > m_pUndoManager; ::rtl::OUString m_sCaption; ::rtl::OUString m_sCommand; ::rtl::OUString m_sFilter; @@ -623,6 +630,7 @@ struct OReportDefinitionImpl sal_Bool m_bModified; sal_Bool m_bEscapeProcessing; sal_Bool m_bSetModifiedEnabled; + OReportDefinitionImpl(::osl::Mutex& _aMutex) :m_aStorageChangeListeners(_aMutex) ,m_aCloseListener(_aMutex) @@ -746,7 +754,6 @@ OReportDefinition::~OReportDefinition() } // ----------------------------------------------------------------------------- IMPLEMENT_FORWARD_REFCOUNT( OReportDefinition, ReportDefinitionBase ) -//IMPLEMENT_FORWARD_XINTERFACE2(OReportDefinition,ReportDefinitionBase,ReportDefinitionPropertySet) void OReportDefinition::init() { try @@ -764,7 +771,7 @@ void OReportDefinition::init() pCreatorThread->createSuspended(); pCreatorThread->setPriority(osl_Thread_PriorityBelowNormal); pCreatorThread->resume(); - } // for ( ; pIter != pEnd; ++pIter ) + } } m_pImpl->m_pReportModel.reset(new OReportModel(this)); @@ -775,6 +782,9 @@ void OReportDefinition::init() rAdmin.NewLayer(UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "back" ) ), RPT_LAYER_BACK ); rAdmin.NewLayer( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "HiddenLayer" ) ), RPT_LAYER_HIDDEN ); + m_pImpl->m_pUndoManager = new ::dbaui::UndoManager( *this, m_aMutex ); + m_pImpl->m_pReportModel->SetSdrUndoManager( &m_pImpl->m_pUndoManager->GetSfxUndoManager() ); + m_pImpl->m_xFunctions = new OFunctions(this,m_aProps->m_xContext); if ( !m_pImpl->m_xStorage.is() ) m_pImpl->m_xStorage = ::comphelper::OStorageHelper::GetTemporaryStorage(); @@ -789,9 +799,9 @@ void OReportDefinition::init() } m_pImpl->m_pObjectContainer.reset( new comphelper::EmbeddedObjectContainer(m_pImpl->m_xStorage , static_cast<cppu::OWeakObject*>(this) ) ); } - catch(uno::Exception) + catch ( const uno::Exception& ) { - OSL_ENSURE(0,"Error!"); + DBG_UNHANDLED_EXCEPTION(); } } // ----------------------------------------------------------------------------- @@ -1296,10 +1306,21 @@ void SAL_CALL OReportDefinition::close( ::sal_Bool _bDeliverOwnership ) throw (u ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() ); ::osl::MutexGuard aGuard(m_aMutex); - ::connectivity::checkDisposed(ReportDefinitionBase::rBHelper.bDisposed); + ::connectivity::checkDisposed( ReportDefinitionBase::rBHelper.bDisposed ); ::comphelper::MediaDescriptor aDescriptor( _aArguments ); - fillArgs(aDescriptor); - m_pImpl->m_pReportModel->SetModified(sal_False); + + m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( false ); + try + { + fillArgs(aDescriptor); + m_pImpl->m_pReportModel->SetModified(sal_False); + } + catch ( ... ) + { + m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true ); + throw; + } + m_pImpl->m_pUndoManager->GetSfxUndoManager().EnableUndo( true ); return sal_True; } // ----------------------------------------------------------------------------- @@ -1842,7 +1863,6 @@ void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue else if ( sURL.getLength() ) aStorageSource <<= sURL; else - // TODO: error message throw lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No input source (URL or InputStream) found." ) ), // TODO: resource @@ -2931,8 +2951,15 @@ uno::Sequence< datatransfer::DataFlavor > SAL_CALL OReportDefinition::getTransfe { return aFlavor.MimeType.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/png"))); } + // ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- +uno::Reference< document::XUndoManager > SAL_CALL OReportDefinition::getUndoManager( ) throw (uno::RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + return m_pImpl->m_pUndoManager.get(); +} + + // ============================================================================= }// namespace reportdesign // ============================================================================= diff --git a/reportdesign/source/core/sdr/RptModel.cxx b/reportdesign/source/core/sdr/RptModel.cxx index 7327456c7940..05b9d8d39499 100644 --- a/reportdesign/source/core/sdr/RptModel.cxx +++ b/reportdesign/source/core/sdr/RptModel.cxx @@ -28,7 +28,7 @@ #include "RptModel.hxx" #include "RptPage.hxx" -#include <dbaccess/singledoccontroller.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> #include <tools/debug.hxx> #include <unotools/pathoptions.hxx> diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 7d1cdbc6db30..4b3db47c4078 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -37,7 +37,7 @@ #include <toolkit/helper/convert.hxx> #include "RptPage.hxx" #include "corestrings.hrc" -#include <dbaccess/singledoccontroller.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> #include "ModuleHelper.hxx" #include <RptResId.hrc> diff --git a/reportdesign/source/core/sdr/UndoActions.cxx b/reportdesign/source/core/sdr/UndoActions.cxx index d58fe62e974d..6ebebd30a61a 100644 --- a/reportdesign/source/core/sdr/UndoActions.cxx +++ b/reportdesign/source/core/sdr/UndoActions.cxx @@ -52,7 +52,7 @@ #include <tools/diagnose_ex.h> #include <comphelper/stl_types.hxx> #include <vcl/svapp.hxx> -#include <dbaccess/singledoccontroller.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> #include <svx/unoshape.hxx> #include <vos/mutex.hxx> diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx index f4dd0a7f8645..091dad4b8ad4 100644 --- a/reportdesign/source/core/sdr/UndoEnv.cxx +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -54,7 +54,7 @@ #include <comphelper/stl_types.hxx> #include <comphelper/componentcontext.hxx> #include <vcl/svapp.hxx> -#include <dbaccess/singledoccontroller.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> #include <svx/unoshape.hxx> #include <vos/mutex.hxx> @@ -262,7 +262,7 @@ void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEv if (!xSet.is()) return; - dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); + dbaui::DBSubComponentController* pController = m_pImpl->m_rModel.getController(); if ( !pController ) return; @@ -380,7 +380,7 @@ void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEv if ( pUndo == NULL ) pUndo = new ORptUndoPropertyAction( m_pImpl->m_rModel, _rEvent ); - pController->addUndoActionAndInvalidate(pUndo); + m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( pUndo ); pController->InvalidateAll(); } // ----------------------------------------------------------------------------- @@ -439,12 +439,9 @@ void SAL_CALL OXUndoEnvironment::elementInserted(const ContainerEvent& evt) thro uno::Reference< report::XFunctions> xContainer(evt.Source,uno::UNO_QUERY); if ( xContainer.is() ) { - dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); - pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel - ,rptui::Inserted - ,xContainer.get() - ,xIface - ,RID_STR_UNDO_ADDFUNCTION)); + m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( + new OUndoContainerAction( m_pImpl->m_rModel, rptui::Inserted, xContainer.get(), + xIface, RID_STR_UNDO_ADDFUNCTION ) ); } } } @@ -510,12 +507,8 @@ void SAL_CALL OXUndoEnvironment::elementRemoved(const ContainerEvent& evt) throw uno::Reference< report::XFunctions> xFunctions(evt.Source,uno::UNO_QUERY); if ( xFunctions.is() ) { - dbaui::OSingleDocumentController* pController = m_pImpl->m_rModel.getController(); - pController->addUndoActionAndInvalidate(new OUndoContainerAction(m_pImpl->m_rModel - ,rptui::Removed - ,xFunctions.get() - ,xIface - ,RID_STR_UNDO_ADDFUNCTION)); + m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( new OUndoContainerAction( + m_pImpl->m_rModel, rptui::Removed, xFunctions.get(), xIface, RID_STR_UNDO_ADDFUNCTION ) ); } } } diff --git a/reportdesign/source/core/sdr/formatnormalizer.cxx b/reportdesign/source/core/sdr/formatnormalizer.cxx index e4817bbe9f44..f5fba8129d54 100644 --- a/reportdesign/source/core/sdr/formatnormalizer.cxx +++ b/reportdesign/source/core/sdr/formatnormalizer.cxx @@ -35,7 +35,7 @@ #include <com/sun/star/util/XNumberFormatTypes.hpp> /** === end UNO includes === **/ -#include <dbaccess/singledoccontroller.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> #include <unotools/syslocale.hxx> #include <connectivity/statementcomposer.hxx> #include <connectivity/dbtools.hxx> @@ -186,7 +186,7 @@ namespace rptui if ( !m_xReportDefinition.is() ) return false; - ::dbaui::OSingleDocumentController* pController( m_rModel.getController() ); + ::dbaui::DBSubComponentController* pController( m_rModel.getController() ); OSL_ENSURE( pController, "FormatNormalizer::impl_ensureUpToDateFieldList_nothrow: no controller? how can *this* happen?!" ); if ( !pController ) return false; diff --git a/reportdesign/source/ui/dlg/CondFormat.cxx b/reportdesign/source/ui/dlg/CondFormat.cxx index b271a3324022..3bf5cc9c37da 100644 --- a/reportdesign/source/ui/dlg/CondFormat.cxx +++ b/reportdesign/source/ui/dlg/CondFormat.cxx @@ -465,8 +465,8 @@ namespace rptui short nRet = ModalDialog::Execute(); if ( nRet == RET_OK ) { - String sUndoAction( ModuleRes( RID_STR_UNDO_CONDITIONAL_FORMATTING ) ); - UndoManagerListAction aListAction(m_rController.GetUndoManager(),sUndoAction); + const String sUndoAction( ModuleRes( RID_STR_UNDO_CONDITIONAL_FORMATTING ) ); + const UndoContext aUndoContext( m_rController.getUndoManager(), sUndoAction ); try { sal_Int32 j(0), i(0);; diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index 5a6b7bd1e22b..b471d271b867 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -316,8 +316,8 @@ void OFieldExpressionControl::moveGroups(const uno::Sequence<uno::Any>& _aGroups m_bIgnoreEvent = true; { sal_Int32 nRow = _nRow; - String sUndoAction(ModuleRes(RID_STR_UNDO_MOVE_GROUP)); - UndoManagerListAction aListAction(m_pParent->m_pController->GetUndoManager(),sUndoAction); + const String sUndoAction(ModuleRes(RID_STR_UNDO_MOVE_GROUP)); + const UndoContext aUndoContext( m_pParent->m_pController->getUndoManager(), sUndoAction ); uno::Reference< report::XGroups> xGroups = m_pParent->getGroups(); const uno::Any* pIter = _aGroups.getConstArray(); @@ -455,7 +455,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow) { bAppend = sal_True; String sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP)); - m_pParent->m_pController->GetUndoManager().EnterListAction( sUndoAction, String() ); + m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, String() ); xGroup = m_pParent->getGroups()->createGroup(); xGroup->setHeaderOn(sal_True); @@ -499,7 +499,7 @@ BOOL OFieldExpressionControl::SaveModified(bool _bAppendRow) ::rptui::adjustSectionName(xGroup,nPos); if ( bAppend ) - m_pParent->m_pController->GetUndoManager().LeaveListAction(); + m_pParent->m_pController->getUndoManager().LeaveListAction(); } if ( Controller() ) @@ -824,7 +824,7 @@ void OFieldExpressionControl::DeleteRows() { bFirstTime = false; String sUndoAction(ModuleRes(RID_STR_UNDO_REMOVE_SELECTION)); - m_pParent->m_pController->GetUndoManager().EnterListAction( sUndoAction, String() ); + m_pParent->m_pController->getUndoManager().EnterListAction( sUndoAction, String() ); } sal_Int32 nGroupPos = m_aGroupPositions[nIndex]; @@ -844,7 +844,7 @@ void OFieldExpressionControl::DeleteRows() } // while( nIndex >= 0 ) if ( !bFirstTime ) - m_pParent->m_pController->GetUndoManager().LeaveListAction(); + m_pParent->m_pController->getUndoManager().LeaveListAction(); m_nDataPos = GetCurRow(); InvalidateStatusCell( nOldDataPos ); @@ -930,8 +930,8 @@ void OFieldExpressionControl::InsertRows( long nRow ) { m_bIgnoreEvent = false; { - String sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP)); - UndoManagerListAction aListAction(m_pParent->m_pController->GetUndoManager(),sUndoAction); + const String sUndoAction(ModuleRes(RID_STR_UNDO_APPEND_GROUP)); + const UndoContext aUndoContext( m_pParent->m_pController->getUndoManager(), sUndoAction ); uno::Reference<report::XGroups> xGroups = m_pParent->getGroups(); sal_Int32 nGroupPos = 0; diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index e3ced50861b3..5777635cc476 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -27,48 +27,52 @@ #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 "DesignView.hxx" +#include "ModuleHelper.hxx" +#include "ReportControllerObserver.hxx" +#include "RptDef.hxx" + +/** === begin UNO includes === **/ #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/beans/XPropertySet.hpp> +#include <com/sun/star/embed/XVisualObject.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/io/XObjectInputStream.hpp> +#include <com/sun/star/io/XObjectOutputStream.hpp> #include <com/sun/star/report/XReportControlModel.hpp> +#include <com/sun/star/report/XReportDefinition.hpp> #include <com/sun/star/report/XReportEngine.hpp> #include <com/sun/star/report/XSection.hpp> +#include <com/sun/star/sdbc/XConnection.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XModeSelector.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> -#include <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" +/** === end UNO includes === **/ -#include <comphelper/uno3.hxx> #include <comphelper/implementationreference.hxx> #include <comphelper/proparrhlp.hxx> #include <comphelper/propertystatecontainer.hxx> +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase5.hxx> +#include <dbaccess/dbsubcomponentcontroller.hxx> +#include <svl/lstner.hxx> +#include <svtools/transfer.hxx> +#include <svx/svdedtv.hxx> +#include <svx/zoomitem.hxx> -#include "RptDef.hxx" -#include "DesignView.hxx" -#include <functional> +#include <boost/noncopyable.hpp> #include <boost/shared_ptr.hpp> -#include <com/sun/star/util/XModeSelector.hpp> -#include "ReportControllerObserver.hxx" +#include <functional> class TransferableHelper; class TransferableClipboardListener; class VclWindowEvent; +class SfxUndoManager; namespace rptui { class OGroupsSortingDialog; @@ -78,7 +82,7 @@ namespace rptui class OAddFieldWindow; class OSectionWindow; - typedef ::dbaui::OSingleDocumentController OReportController_BASE; + typedef ::dbaui::DBSubComponentController OReportController_BASE; typedef ::cppu::ImplHelper5 < ::com::sun::star::container::XContainerListener , ::com::sun::star::beans::XPropertyChangeListener , ::com::sun::star::view::XSelectionSupplier @@ -91,6 +95,7 @@ namespace rptui ,public SfxListener ,public ::comphelper::OPropertyStateContainer ,public ::comphelper::OPropertyArrayUsageHelper < OReportController_BASE > + ,public ::boost::noncopyable { private: OModuleClient m_aModuleClient; @@ -107,9 +112,9 @@ namespace rptui 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::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; @@ -215,15 +220,20 @@ namespace rptui void executeMethodWithUndo(USHORT _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun); void alignControlsWithUndo(USHORT _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection = false); + + // open the help agent of report designer at start time + void doOpenHelpAgent(); + + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getXFrame(); + /** 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: + 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 @@ -292,14 +302,11 @@ namespace rptui */ void impl_zoom_nothrow(); - private: - OReportController(OReportController const&); - OReportController& operator =(OReportController const&); - public: - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > getXFrame(); + virtual void impl_onModifyChanged(); - // open the help agent of report designer at start time - void doOpenHelpAgent(); + virtual void onLoadedMenu( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& _xLayoutManager ); + virtual void impl_initialize( ); + bool isUiVisible() const; /** creates a new default control for the currently set type when the modifier KEY_MOD1 was pressed * \param _aArgs must contain a properyvalue with name "KeyModifier" and value KEY_MOD1 when control should be created. @@ -336,11 +343,12 @@ namespace rptui 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); + private: 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*); @@ -350,8 +358,6 @@ namespace rptui // SfxListener virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint); - virtual void impl_onModifyChanged(); - /** returns <TRUE/> when the command is enbaled @param _nCommand the command id @param _xControlFormat the report control format @@ -449,7 +455,7 @@ namespace rptui * * \return */ - ::boost::shared_ptr<rptui::OReportModel> getSdrModel(); + ::boost::shared_ptr<rptui::OReportModel> getSdrModel() const; inline ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > getContext() const { return m_xContext; } inline sal_Int16 getZoomValue() const { return m_nZoomValue; } @@ -471,10 +477,9 @@ namespace rptui ::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; + SfxUndoManager& getUndoManager() const; + void clearUndoManager() const; + void addUndoAction( SfxUndoAction* i_pAction ); }; } #endif // RPTUI_REPORTCONTROLLER_HXX diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index b66b527aeb35..9b7dd3374b44 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -99,6 +99,7 @@ #include <com/sun/star/sdb/SQLContext.hpp> #include <com/sun/star/sdbc/SQLWarning.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/document/XUndoManagerSupplier.hpp> #include <vcl/svapp.hxx> #include <vcl/msgbox.hxx> @@ -117,7 +118,7 @@ #include <svx/zoomitem.hxx> #include <svx/zoomslideritem.hxx> #include <editeng/brshitem.hxx> -#include <svx/flagsdef.hxx> //CHINA001 +#include <svx/flagsdef.hxx> #include <svx/svdpagv.hxx> #include <svx/svxdlg.hxx> #include <svx/zoom_def.hxx> @@ -137,7 +138,7 @@ #include <svl/itempool.hxx> #include <svl/itemset.hxx> -#include <svl/aeitem.hxx> //CHINA001 +#include <svl/aeitem.hxx> #include <svtools/cliplistener.hxx> #include <unotools/syslocale.hxx> #include <unotools/viewoptions.hxx> @@ -152,17 +153,17 @@ #include <toolkit/helper/vclunohelper.hxx> #include "UndoEnv.hxx" #include "InsertFunctions.hxx" +#include "ReportControllerObserver.hxx" #include <boost/mem_fn.hpp> #include <boost/bind.hpp> #include <boost/utility.hpp> +#include <boost/scoped_ptr.hpp> #include <cppuhelper/exc_hlp.hxx> #include <unotools/confignode.hxx> #include <helpids.hrc> -#include <ReportControllerObserver.hxx> - #define MAX_ROWS_FOR_PREVIEW 50 using namespace ::com::sun::star; @@ -245,14 +246,16 @@ void lcl_getReportControlFormat(const Sequence< PropertyValue >& aArgs, SequenceAsHashMap aMap(aArgs); xReportControlFormat = aMap.getUnpackedValueOrDefault(REPORTCONTROLFORMAT,uno::Reference< report::XReportControlFormat>()); _xWindow = aMap.getUnpackedValueOrDefault(CURRENT_WINDOW,uno::Reference< awt::XWindow>()); - } // if ( aArgs.getLength() ) + } + if ( !xReportControlFormat.is() ) { _pView->fillControlModelSelection(_rControlsFormats); - //xReportControlFormat.set( _pView->getCurrentControlModel(),uno::UNO_QUERY); - } // if ( !xReportControlFormat.is() ) + } else + { _rControlsFormats.push_back(xReportControlFormat); + } if ( !_xWindow.is() ) _xWindow = VCLUnoHelper::GetInterface(_pView); @@ -372,14 +375,15 @@ void OReportController::disposing() pSectionWindow = getDesignView()->getMarkedSection(); if ( pSectionWindow ) pSectionWindow->getReportSection().deactivateOle(); - GetUndoManager().Clear(); // clear all undo redo things + clearUndoManager(); if ( m_aReportModel ) listen(false); m_pReportControllerObserver->Clear(); m_pReportControllerObserver->release(); } - catch(uno::Exception&) + catch ( const uno::Exception& ) { + DBG_UNHANDLED_EXCEPTION(); } } @@ -456,8 +460,20 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const break; case SID_REDO: case SID_UNDO: - aReturn = OReportController_BASE::GetState(_nId); - aReturn.bEnabled = aReturn.bEnabled; + { + USHORT ( SfxUndoManager::*retrieveCount )( bool const ) const = + ( _nId == SID_UNDO ) ? &SfxUndoManager::GetUndoActionCount : &SfxUndoManager::GetRedoActionCount; + + SfxUndoManager& rUndoManager( getUndoManager() ); + aReturn.bEnabled = ( rUndoManager.*retrieveCount )( ::svl::IUndoManager::TopLevel ) > 0; + if ( aReturn.bEnabled ) + { + // TODO: add "Undo/Redo: prefix" + String ( SfxUndoManager::*retrieveComment )( USHORT, bool const ) const = + ( _nId == SID_UNDO ) ? &SfxUndoManager::GetUndoActionComment : &SfxUndoManager::GetRedoActionComment; + aReturn.sTitle = (rUndoManager.*retrieveComment)( 0, ::svl::IUndoManager::TopLevel ); + } + } break; case SID_OBJECT_RESIZING: case SID_OBJECT_SMALLESTWIDTH: @@ -1023,10 +1039,12 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_REDO: case SID_UNDO: { - // const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() ); - // We would like to know if we are in undo mode const OXUndoEnvironment::OUndoMode aLock( m_aReportModel->GetUndoEnv() ); - OReportController_BASE::Execute( _nId, aArgs ); + BOOL ( SfxUndoManager::*doXDo )() = + ( _nId == SID_UNDO ) ? &SfxUndoManager::Undo : &SfxUndoManager::Redo; + + SfxUndoManager& rUndoManager( getUndoManager() ); + (rUndoManager.*doXDo)(); InvalidateAll(); updateFloater(); } @@ -1164,7 +1182,7 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > uno::Reference< report::XFunctions> xFunctions(xFunction->getParent(),uno::UNO_QUERY_THROW); sal_Int32 nIndex = getPositionInIndexAccess(xFunctions.get(),xFunction); const String sUndoAction = String((ModuleRes(RID_STR_UNDO_REMOVE_FUNCTION))); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); xFunctions->removeByIndex(nIndex); select(uno::makeAny(xFunctions->getParent())); InvalidateFeature( SID_SAVEDOC ); @@ -1191,14 +1209,6 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > InvalidateAll(); break; case SID_INSERT_DIAGRAM: - /*{ - OSectionView* pView = getCurrentSectionView(); - if ( pView ) - { - Reference< awt::XWindow> xWindow = VCLUnoHelper::GetInterface(getView()->Window::GetParent()); - InsertChart(m_xContext,m_xReportDefinition.get(),xWindow,pView,getSdrModel().get()); - } - }*/ getDesignView()->SetMode( RPTUI_INSERT ); getDesignView()->SetInsertObj( OBJ_OLE2); createDefaultControl(aArgs); @@ -1451,19 +1461,16 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > case SID_ATTR_CHAR_POSTURE: case SID_ATTR_CHAR_UNDERLINE: { - ::std::auto_ptr<UndoManagerListAction> pListAction; uno::Reference< awt::XWindow> xWindow; ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats; lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats ); - bool bMulti = aControlsFormats.size() > 1; + + const String sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT)); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); + ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aControlsFormats.begin(); for(; aIter != aControlsFormats.end();++aIter) { - if ( !pListAction.get() && bMulti) - { - const String sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT)); - pListAction.reset(new UndoManagerListAction(GetUndoManager(),sUndoAction)); - } // if ( !pListAction.get() ) uno::Reference< report::XReportControlFormat> xReportControlFormat(*aIter,uno::UNO_QUERY); lcl_setFontWPU_nothrow(xReportControlFormat,_nId); } @@ -1527,32 +1534,37 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > break; case SID_CHAR_DLG: { - ::std::auto_ptr<UndoManagerListAction> pListAction; uno::Sequence< beans::NamedValue > aSettings; uno::Reference< awt::XWindow> xWindow; ::std::vector< uno::Reference< uno::XInterface > > aControlsFormats; lcl_getReportControlFormat( aArgs, getDesignView(), xWindow, aControlsFormats ); - ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aControlsFormats.begin(); - for(; aIter != aControlsFormats.end();++aIter) + + if ( !aControlsFormats.empty() ) { - uno::Reference< report::XReportControlFormat > xFormat(*aIter,uno::UNO_QUERY); - if ( xFormat.is() ) + const String sUndoAction( ModuleRes( RID_STR_UNDO_CHANGEFONT ) ); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); + + ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aControlsFormats.begin(); + for(; aIter != aControlsFormats.end();++aIter) { - if ( !pListAction.get() ) + uno::Reference< report::XReportControlFormat > xFormat( *aIter, uno::UNO_QUERY ); + if ( !xFormat.is() ) + continue; + + if ( aSettings.getLength() == 0 ) { - const String sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEFONT)); - pListAction.reset(new UndoManagerListAction(GetUndoManager(),sUndoAction)); - rptui::openCharDialog(xFormat,xWindow,aSettings); - } // if ( !pListAction.get() ) + ::rptui::openCharDialog( xFormat, xWindow, aSettings ); + if ( aSettings.getLength() == 0 ) + break; + } + applyCharacterSettings( xFormat, aSettings ); } - } // for(; aIter != aControlsFormats.end();++aIter) - if ( !aControlsFormats.empty() ) + InvalidateAll(); + } } break; - //case SID_FM_DESIGN_MODE: - // break; case SID_INSERT_GRAPHIC: insertGraphic(); break; @@ -1673,10 +1685,14 @@ void OReportController::impl_initialize( ) { //m_sName = m_xReportDefinition->getName(); getView()->initialize(); // show the windows and fill with our informations - GetUndoManager().Clear(); // clear all undo redo things - getSdrModel(); + + m_aReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition); if ( !m_aReportModel ) - throw Exception(); + throw RuntimeException(); + m_aReportModel->attachController( *this ); + + clearUndoManager(); + UndoSuppressor aSuppressUndo( getUndoManager() ); ::comphelper::NamedValueCollection aArgs(getModel()->getArgs()); setMode(aArgs.getOrDefault("Mode", rtl::OUString::createFromAscii("normal"))); @@ -1828,7 +1844,7 @@ sal_Bool SAL_CALL OReportController::suspend(sal_Bool /*_bSuspend*/) throw( Runt // ----------------------------------------------------------------------------- void OReportController::describeSupportedFeatures() { - OSingleDocumentController::describeSupportedFeatures(); + DBSubComponentController::describeSupportedFeatures(); implDescribeSupportedFeature( ".uno:TextDocument", SID_RPT_TEXTDOCUMENT, CommandGroup::APPLICATION ); implDescribeSupportedFeature( ".uno:Spreadsheet", SID_RPT_SPREADSHEET, CommandGroup::APPLICATION ); @@ -2097,7 +2113,7 @@ void OReportController::impl_onModifyChanged() { if ( m_xReportDefinition.is() ) m_xReportDefinition->setModified( impl_isModified() ); - OSingleDocumentController::impl_onModifyChanged(); + DBSubComponentController::impl_onModifyChanged(); } catch(uno::Exception) { @@ -2363,13 +2379,6 @@ IMPL_LINK( OReportController, OnClipboardChanged, void*, EMPTYARG ) return OnInvalidateClipboard( NULL ); } //------------------------------------------------------------------------------ -IMPL_LINK( OReportController, NotifyUndoActionHdl, SfxUndoAction*, _pUndoAction ) -{ - OSL_ENSURE(_pUndoAction,"UndoAction is NULL!"); - addUndoActionAndInvalidate(_pUndoAction); - return 0L; -} -//------------------------------------------------------------------------------ IMPL_LINK(OReportController, OnInvalidateClipboard, void*, EMPTYARG) { InvalidateFeature(SID_CUT); @@ -2470,7 +2479,7 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ { uno::Reference< beans::XPropertySet> xProp(getUsedStyle(m_xReportDefinition),uno::UNO_QUERY_THROW); const String sUndoAction(ModuleRes(RID_STR_UNDO_CHANGEPAGE)); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); const SfxPoolItem* pItem = NULL; if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_SIZE,sal_True,&pItem)) { @@ -2521,13 +2530,24 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ delete pDefaults[i]; } + // ----------------------------------------------------------------------------- sal_Bool SAL_CALL OReportController::attachModel(const uno::Reference< frame::XModel > & xModel) throw( uno::RuntimeException ) { ::osl::MutexGuard aGuard( getMutex() ); - m_xReportDefinition.set(xModel,uno::UNO_QUERY); - return m_xReportDefinition.is(); + + uno::Reference< report::XReportDefinition > xReportDefinition( xModel, UNO_QUERY ); + if ( !xReportDefinition.is() ) + return sal_False; + + uno::Reference< document::XUndoManagerSupplier > xTestSuppUndo( xModel, UNO_QUERY ); + if ( !xTestSuppUndo.is() ) + return sal_False; + + m_xReportDefinition = xReportDefinition; + return sal_True; } + // ----------------------------------------------------------------------------- void OReportController::openSortingAndGroupingDialog() { @@ -2584,7 +2604,7 @@ void OReportController::Notify(SfxBroadcaster & /* _rBc */, SfxHint const & _rHi void OReportController::executeMethodWithUndo(USHORT _nUndoStrId,const ::std::mem_fun_t<void,ODesignView>& _pMemfun) { const String sUndoAction = String((ModuleRes(_nUndoStrId))); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); _pMemfun( getDesignView() ); InvalidateFeature( SID_SAVEDOC ); InvalidateFeature( SID_UNDO ); @@ -2593,7 +2613,7 @@ void OReportController::executeMethodWithUndo(USHORT _nUndoStrId,const ::std::me void OReportController::alignControlsWithUndo(USHORT _nUndoStrId,sal_Int32 _nControlModification,bool _bAlignAtSection) { const String sUndoAction = String((ModuleRes(_nUndoStrId))); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); getDesignView()->alignMarkedObjects(_nControlModification,_bAlignAtSection); InvalidateFeature( SID_SAVEDOC ); InvalidateFeature( SID_UNDO ); @@ -2678,7 +2698,7 @@ void OReportController::shrinkSection(USHORT _nUndoStrId, uno::Reference<report: if ( _xSection.is() ) { const String sUndoAction = String((ModuleRes(_nUndoStrId))); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); if (_nSid == SID_SECTION_SHRINK) { @@ -3038,17 +3058,8 @@ void OReportController::insertGraphic() } } // ----------------------------------------------------------------------------- -::boost::shared_ptr<rptui::OReportModel> OReportController::getSdrModel() +::boost::shared_ptr<rptui::OReportModel> OReportController::getSdrModel() const { - if ( !m_aReportModel ) - { - m_aReportModel = reportdesign::OReportDefinition::getSdrModel(m_xReportDefinition); - if ( m_aReportModel ) - { - m_aReportModel->attachController( *this ); - m_aReportModel->SetNotifyUndoActionHdl(LINK( this, OReportController, NotifyUndoActionHdl )); - } - } return m_aReportModel; } // ----------------------------------------------------------------------------- @@ -3252,7 +3263,7 @@ void OReportController::createDateTime(const Sequence< PropertyValue >& _aArgs) getDesignView()->unmarkAllObjects(NULL); const String sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL)); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); SequenceAsHashMap aMap(_aArgs); aMap.createItemIfMissing(PROPERTY_FORMATKEY,aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE,sal_Int32(0))); @@ -3280,7 +3291,7 @@ void OReportController::createPageNumber(const Sequence< PropertyValue >& _aArgs getDesignView()->unmarkAllObjects(NULL); const String sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL)); - UndoManagerListAction aListAction(GetUndoManager(),sUndoAction); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); if ( !m_xReportDefinition->getPageHeaderOn() ) { @@ -3324,7 +3335,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) } uno::Reference<report::XSection> xCurrentSection = getDesignView()->getCurrentSection(); - UndoManagerListAction aUndo( GetUndoManager(), String( ModuleRes( RID_STR_UNDO_INSERT_CONTROL ) ) ); + UndoContext aUndoContext( getUndoManager(), String( ModuleRes( RID_STR_UNDO_INSERT_CONTROL ) ) ); try { @@ -3792,19 +3803,21 @@ void OReportController::switchReportSection(const sal_Int16 _nId) { const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() ); const bool bSwitchOn = !m_xReportDefinition->getReportHeaderOn(); + + ::boost::scoped_ptr< UndoContext > pUndoContext; if ( SID_REPORTHEADERFOOTER == _nId ) { const String sUndoAction(ModuleRes(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER)); - GetUndoManager().EnterListAction( sUndoAction, String() ); + pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) ); - addUndoActionAndInvalidate(new OReportSectionUndo(*(m_aReportModel),SID_REPORTHEADER_WITHOUT_UNDO + addUndoAction(new OReportSectionUndo(*(m_aReportModel),SID_REPORTHEADER_WITHOUT_UNDO ,::std::mem_fun(&OReportHelper::getReportHeader) ,m_xReportDefinition ,bSwitchOn ? Inserted : Removed ,0 )); - addUndoActionAndInvalidate(new OReportSectionUndo(*(m_aReportModel),SID_REPORTFOOTER_WITHOUT_UNDO + addUndoAction(new OReportSectionUndo(*(m_aReportModel),SID_REPORTFOOTER_WITHOUT_UNDO ,::std::mem_fun(&OReportHelper::getReportFooter) ,m_xReportDefinition ,bSwitchOn ? Inserted : Removed @@ -3827,7 +3840,7 @@ void OReportController::switchReportSection(const sal_Int16 _nId) } if ( SID_REPORTHEADERFOOTER == _nId ) - GetUndoManager().LeaveListAction(); + pUndoContext.reset(); getView()->Resize(); } } @@ -3840,12 +3853,13 @@ void OReportController::switchPageSection(const sal_Int16 _nId) const OXUndoEnvironment::OUndoEnvLock aLock( m_aReportModel->GetUndoEnv() ); const bool bSwitchOn = !m_xReportDefinition->getPageHeaderOn(); + ::boost::scoped_ptr< UndoContext > pUndoContext; if ( SID_PAGEHEADERFOOTER == _nId ) { const String sUndoAction(ModuleRes(bSwitchOn ? RID_STR_UNDO_ADD_REPORTHEADERFOOTER : RID_STR_UNDO_REMOVE_REPORTHEADERFOOTER)); - GetUndoManager().EnterListAction( sUndoAction, String() ); + pUndoContext.reset( new UndoContext( getUndoManager(), sUndoAction ) ); - addUndoActionAndInvalidate(new OReportSectionUndo(*m_aReportModel + addUndoAction(new OReportSectionUndo(*m_aReportModel ,SID_PAGEHEADER_WITHOUT_UNDO ,::std::mem_fun(&OReportHelper::getPageHeader) ,m_xReportDefinition @@ -3853,7 +3867,7 @@ void OReportController::switchPageSection(const sal_Int16 _nId) ,0 )); - addUndoActionAndInvalidate(new OReportSectionUndo(*m_aReportModel + addUndoAction(new OReportSectionUndo(*m_aReportModel ,SID_PAGEFOOTER_WITHOUT_UNDO ,::std::mem_fun(&OReportHelper::getPageFooter) ,m_xReportDefinition @@ -3875,7 +3889,7 @@ void OReportController::switchPageSection(const sal_Int16 _nId) break; } if ( SID_PAGEHEADERFOOTER == _nId ) - GetUndoManager().LeaveListAction(); + pUndoContext.reset(); getView()->Resize(); } } @@ -3901,7 +3915,7 @@ void OReportController::modifyGroup(const bool _bAppend, const Sequence< Propert rUndoEnv.AddElement( xGroup->getFunctions() ); } - addUndoActionAndInvalidate( new OGroupUndo( + addUndoAction( new OGroupUndo( *m_aReportModel, _bAppend ? RID_STR_UNDO_APPEND_GROUP : RID_STR_UNDO_REMOVE_GROUP, _bAppend ? Inserted : Removed, @@ -3935,7 +3949,7 @@ void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader { const OXUndoEnvironment::OUndoEnvLock aLock(m_aReportModel->GetUndoEnv()); if ( _bUndo ) - addUndoActionAndInvalidate(new OGroupSectionUndo(*m_aReportModel + addUndoAction(new OGroupSectionUndo(*m_aReportModel ,_bHeader ? SID_GROUPHEADER_WITHOUT_UNDO : SID_GROUPFOOTER_WITHOUT_UNDO ,_bHeader ? ::std::mem_fun(&OGroupHelper::getHeader) : ::std::mem_fun(&OGroupHelper::getFooter) ,xGroup @@ -4190,23 +4204,21 @@ sal_Bool OReportController::isFormatCommandEnabled(sal_uInt16 _nCommand,const un // ----------------------------------------------------------------------------- bool OReportController::impl_setPropertyAtControls_throw(const sal_uInt16 _nUndoResId,const ::rtl::OUString& _sProperty,const uno::Any& _aValue,const Sequence< PropertyValue >& _aArgs) { - ::std::auto_ptr<UndoManagerListAction> pListAction; ::std::vector< uno::Reference< uno::XInterface > > aSelection; uno::Reference< awt::XWindow> xWindow; lcl_getReportControlFormat( _aArgs, getDesignView(), xWindow, aSelection ); - const bool bMultiSet = aSelection.size() > 1; ::std::vector< uno::Reference< uno::XInterface > >::iterator aIter = aSelection.begin(); + + const String sUndoAction = String( ModuleRes( _nUndoResId ) ); + UndoContext aUndoContext( getUndoManager(), sUndoAction ); + for(; aIter != aSelection.end();++aIter) { - if ( !pListAction.get() && _nUndoResId && bMultiSet ) - { - const String sUndoAction = String(ModuleRes(_nUndoResId)); - pListAction.reset(new UndoManagerListAction(GetUndoManager(),sUndoAction)); - } // if ( !pListAction.get() ) const uno::Reference< beans::XPropertySet > xControlModel(*aIter,uno::UNO_QUERY); if ( xControlModel.is() ) xControlModel->setPropertyValue(_sProperty,_aValue); - } // for(; aIter != aSelection.end();++aIter) + } + return !aSelection.empty(); } // ----------------------------------------------------------------------------- @@ -4375,4 +4387,33 @@ uno::Reference< container::XNameAccess > OReportController::getColumns() const } return sLabel; } + +// ----------------------------------------------------------------------------- +SfxUndoManager& OReportController::getUndoManager() const +{ + DBG_TESTSOLARMUTEX(); + // this is expected to be called during UI actions, so the SM is assumed to be locked + + ::boost::shared_ptr< OReportModel > pReportModel( getSdrModel() ); + ENSURE_OR_THROW( !!pReportModel, "no access to our model" ); + + SfxUndoManager* pUndoManager( pReportModel->GetSdrUndoManager() ); + ENSURE_OR_THROW( pUndoManager != NULL, "no access to our model's UndoManager" ); + + return *pUndoManager; +} + +// ----------------------------------------------------------------------------- +void OReportController::clearUndoManager() const +{ + getUndoManager().Clear(); +} + // ----------------------------------------------------------------------------- +void OReportController::addUndoAction( SfxUndoAction* i_pAction ) +{ + getUndoManager().AddUndoAction( i_pAction ); + + InvalidateFeature( SID_UNDO ); + InvalidateFeature( SID_REDO ); +} diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index ae9c8e0e0bb3..063986f140b4 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -329,15 +329,14 @@ void OSectionWindow::zoom(const Fraction& _aZoom) //----------------------------------------------------------------------------- IMPL_LINK( OSectionWindow, StartSplitHdl, Splitter*, ) { - const String sEmpty(ModuleRes(RID_STR_UNDO_CHANGE_SIZE)); - getViewsWindow()->getView()->getReportView()->getController().GetUndoManager().EnterListAction(sEmpty,String()); + const String sUndoAction( ModuleRes( RID_STR_UNDO_CHANGE_SIZE ) ); + getViewsWindow()->getView()->getReportView()->getController().getUndoManager().EnterListAction( sUndoAction, String() ); return 0L; } //------------------------------------------------------------------------------ IMPL_LINK( OSectionWindow, EndSplitHdl, Splitter*, ) { - getViewsWindow()->getView()->getReportView()->getController().GetUndoManager().LeaveListAction(); - /*getViewsWindow()->Resize();*/ + getViewsWindow()->getView()->getReportView()->getController().getUndoManager().LeaveListAction(); return 0L; } //----------------------------------------------------------------------------- diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 21735676d078..2de8db6c25f0 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -1329,7 +1329,7 @@ void OViewsWindow::EndDragObj_removeInvisibleObjects() void OViewsWindow::EndDragObj(BOOL _bControlKeyPressed, const OSectionView* _pSection,const Point& _aPnt) { const String sUndoAction = String((ModuleRes(RID_STR_UNDO_CHANGEPOSITION))); - UndoManagerListAction aListAction(getView()->getReportView()->getController().GetUndoManager(),sUndoAction); + const UndoContext aUndoContext( getView()->getReportView()->getController().getUndoManager(), sUndoAction ); Point aNewPos = _aPnt; OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aNewPos); |