summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dbaccess/inc/IEnvironment.hxx77
-rw-r--r--dbaccess/inc/dataview.hxx17
-rwxr-xr-xdbaccess/inc/dbaundomanager.hxx103
-rw-r--r--dbaccess/inc/dbsubcomponentcontroller.hxx (renamed from dbaccess/inc/singledoccontroller.hxx)59
-rwxr-xr-x[-rw-r--r--]dbaccess/qa/complex/dbaccess/DatabaseApplication.java0
-rwxr-xr-xdbaccess/qa/complex/dbaccess/makefile.mk6
-rw-r--r--dbaccess/source/ui/app/AppController.cxx4
-rw-r--r--dbaccess/source/ui/browser/dataview.cxx39
-rw-r--r--dbaccess/source/ui/browser/genericcontroller.cxx12
-rw-r--r--dbaccess/source/ui/control/sqledit.cxx4
-rw-r--r--dbaccess/source/ui/dlg/UserAdminDlg.src1
-rw-r--r--dbaccess/source/ui/dlg/advancedsettings.src1
-rw-r--r--dbaccess/source/ui/dlg/dbadmin.src2
-rw-r--r--dbaccess/source/ui/dlg/dbadminsetup.src1
-rw-r--r--dbaccess/source/ui/inc/JoinController.hxx12
-rw-r--r--dbaccess/source/ui/inc/TableController.hxx23
-rwxr-xr-xdbaccess/source/ui/inc/singledoccontroller.hxx93
-rwxr-xr-xdbaccess/source/ui/misc/dbaundomanager.cxx395
-rw-r--r--dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx672
-rw-r--r--dbaccess/source/ui/misc/linkeddocuments.cxx3
-rw-r--r--dbaccess/source/ui/misc/makefile.mk75
-rwxr-xr-x[-rw-r--r--]dbaccess/source/ui/misc/singledoccontroller.cxx697
-rw-r--r--dbaccess/source/ui/querydesign/QueryDesignView.cxx4
-rw-r--r--dbaccess/source/ui/querydesign/QueryTableView.cxx6
-rw-r--r--dbaccess/source/ui/querydesign/QueryViewSwitch.cxx2
-rw-r--r--dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx8
-rw-r--r--dbaccess/source/ui/querydesign/querycontroller.cxx8
-rw-r--r--dbaccess/source/ui/relationdesign/RelationController.cxx2
-rw-r--r--dbaccess/source/ui/relationdesign/RelationTableView.cxx29
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.cxx26
-rw-r--r--dbaccess/source/ui/tabledesign/TEditControl.hxx2
-rw-r--r--dbaccess/source/ui/tabledesign/TableController.cxx11
-rwxr-xr-x[-rw-r--r--]reportdesign/inc/ReportDefinition.hxx77
-rw-r--r--reportdesign/inc/RptModel.hxx8
-rw-r--r--reportdesign/inc/UndoActions.hxx52
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx179
-rw-r--r--reportdesign/source/core/sdr/RptModel.cxx2
-rw-r--r--reportdesign/source/core/sdr/RptObject.cxx2
-rw-r--r--reportdesign/source/core/sdr/UndoActions.cxx2
-rw-r--r--reportdesign/source/core/sdr/UndoEnv.cxx23
-rw-r--r--reportdesign/source/core/sdr/formatnormalizer.cxx4
-rw-r--r--reportdesign/source/ui/dlg/CondFormat.cxx4
-rw-r--r--reportdesign/source/ui/dlg/GroupsSorting.cxx16
-rw-r--r--reportdesign/source/ui/dlg/Navigator.cxx2
-rw-r--r--reportdesign/source/ui/inc/ReportController.hxx101
-rw-r--r--reportdesign/source/ui/inc/RptUndo.hxx (renamed from reportdesign/source/ui/inc/Undo.hxx)0
-rw-r--r--reportdesign/source/ui/inspection/DataProviderHandler.cxx2
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx2
-rw-r--r--reportdesign/source/ui/inspection/ReportComponentHandler.cxx2
-rw-r--r--reportdesign/source/ui/misc/RptUndo.cxx (renamed from reportdesign/source/ui/misc/Undo.cxx)11
-rw-r--r--reportdesign/source/ui/misc/makefile.mk2
-rw-r--r--reportdesign/source/ui/report/ReportController.cxx242
-rw-r--r--reportdesign/source/ui/report/SectionWindow.cxx7
-rw-r--r--reportdesign/source/ui/report/ViewsWindow.cxx2
54 files changed, 1875 insertions, 1261 deletions
diff --git a/dbaccess/inc/IEnvironment.hxx b/dbaccess/inc/IEnvironment.hxx
deleted file mode 100644
index bc6766c91ebb..000000000000
--- a/dbaccess/inc/IEnvironment.hxx
+++ /dev/null
@@ -1,77 +0,0 @@
-/*************************************************************************
- *
- * 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 DBAUI_IENVIRONMENT_HXX
-#define DBAUI_IENVIRONMENT_HXX
-
-#include <com/sun/star/sdbc/SQLException.hpp>
-
-#include <connectivity/standardsqlstate.hxx>
-
-namespace dbtools
-{
- class SQLExceptionInfo;
-}
-
-namespace dbaui
-{
- // interface class for a generell environment
- class IEnvironment
- {
- public:
- /** appends an error in the current environment.
- */
- virtual void appendError(
- const ::rtl::OUString& _rErrorMessage,
- const ::dbtools::StandardSQLState _eSQLState = ::dbtools::SQL_GENERAL_ERROR,
- const sal_Int32 _nErrorCode = 1000
- ) = 0;
-
- /** clears the error state.
- */
- virtual void clearError() = 0;
-
- /** @retrun
- returns <TRUE/> when an error was set otherwise <FALSE/>
- */
- virtual sal_Bool hasError() const = 0;
-
- /** returns the current error
- */
- virtual const ::dbtools::SQLExceptionInfo& getError() const = 0;
-
- /** displays the current error, or does nothing if there is no current error
- */
- virtual void displayError() = 0;
-
- /** gives access to the currently used connection
- @return
- the currently used connection.
- */
- virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& getConnection() const = 0;
- };
-}
-#endif // DBAUI_IENVIRONMENT_HXX
diff --git a/dbaccess/inc/dataview.hxx b/dbaccess/inc/dataview.hxx
index ae93fa1d3284..fdb99014433a 100644
--- a/dbaccess/inc/dataview.hxx
+++ b/dbaccess/inc/dataview.hxx
@@ -27,17 +27,13 @@
#ifndef DBAUI_DATAVIEW_HXX
#define DBAUI_DATAVIEW_HXX
-#ifndef _SV_WINDOW_HXX
-#include <vcl/window.hxx>
-#endif
-#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include "dbaccessdllapi.h"
+
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#endif
-#ifndef INCLUDED_SVTOOLS_ACCELERATOREXECUTE_HXX
#include <svtools/acceleratorexecute.hxx>
-#endif
+#include <vcl/fixed.hxx>
+
#include <memory>
-#include "dbaccessdllapi.h"
class FixedLine;
class SvtMiscOptions;
@@ -50,7 +46,7 @@ namespace dbaui
protected:
IController& m_rController; // the controller in where we resides in
- FixedLine* m_pSeparator; // our separator above the toolbox (may be NULL)
+ FixedLine m_aSeparator;
::std::auto_ptr< ::svt::AcceleratorExecute> m_pAccel;
public:
@@ -75,9 +71,6 @@ namespace dbaui
*/
virtual void resizeControls(const Size& /*_rDiff*/) { Resize(); }
- void enableSeparator( const sal_Bool _bEnable = sal_True );
- sal_Bool isSeparatorEnabled() const { return NULL != m_pSeparator; }
-
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getORB() { return m_xServiceFactory;}
// the default implementation simply calls resizeAll( GetSizePixel() )
diff --git a/dbaccess/inc/dbaundomanager.hxx b/dbaccess/inc/dbaundomanager.hxx
new file mode 100755
index 000000000000..1b8627f66326
--- /dev/null
+++ b/dbaccess/inc/dbaundomanager.hxx
@@ -0,0 +1,103 @@
+/*************************************************************************
+ * 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 DBACCESS_DBAUNDOMANAGER_HXX
+#define DBACCESS_DBAUNDOMANAGER_HXX
+
+#include "dbaccessdllapi.h"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/document/XUndoManager.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+
+#include <boost/scoped_ptr.hpp>
+
+class SfxUndoManager;
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= UndoManager
+ //==================================================================================================================
+ struct UndoManager_Impl;
+ typedef ::cppu::ImplHelper1< ::com::sun::star::document::XUndoManager > UndoManager_Base;
+ class DBACCESS_DLLPUBLIC UndoManager : public UndoManager_Base
+ {
+ public:
+ UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex );
+ virtual ~UndoManager();
+
+ SfxUndoManager& GetSfxUndoManager() const;
+
+ // XInterface
+ virtual void SAL_CALL acquire( ) throw ();
+ virtual void SAL_CALL release( ) throw ();
+
+ // XComponent equivalents
+ void disposing();
+
+ // XUndoManager
+ virtual void SAL_CALL enterUndoContext( const ::rtl::OUString& i_title ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL enterHiddenUndoContext( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL leaveUndoContext( ) throw (::com::sun::star::util::InvalidStateException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addUndoAction( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoAction >& i_action ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL undo( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL redo( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::document::UndoFailedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isUndoPossible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isRedoPossible( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentUndoActionTitle( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual ::rtl::OUString SAL_CALL getCurrentRedoActionTitle( ) throw (::com::sun::star::document::EmptyUndoStackException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoActionTitles( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoActionTitles( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clear( ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL clearRedo( ) throw (::com::sun::star::document::UndoContextNotClosedException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeUndoManagerListener( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManagerListener >& i_listener ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XLockable (base of XUndoManager)
+ virtual void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL unlock( ) throw (::com::sun::star::util::NotLockedException, ::com::sun::star::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL isLocked( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XChild (base of XUndoManager)
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
+
+ private:
+ ::boost::scoped_ptr< UndoManager_Impl > m_pImpl;
+ };
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
+
+#endif // DBACCESS_DBAUNDOMANAGER_HXX
diff --git a/dbaccess/inc/singledoccontroller.hxx b/dbaccess/inc/dbsubcomponentcontroller.hxx
index 5bda31fb4608..cd93a29df321 100644
--- a/dbaccess/inc/singledoccontroller.hxx
+++ b/dbaccess/inc/dbsubcomponentcontroller.hxx
@@ -25,11 +25,10 @@
*
************************************************************************/
-#ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
-#define DBAUI_SINGLEDOCCONTROLLER_HXX
+#ifndef DBAUI_SUBCOMPONENTCONTROLLER_HXX
+#define DBAUI_SUBCOMPONENTCONTROLLER_HXX
#include "genericcontroller.hxx"
-#include "IEnvironment.hxx"
/** === begin UNO includes === **/
#include <com/sun/star/document/XScriptInvocationContext.hpp>
@@ -45,7 +44,6 @@
#include <comphelper/propertycontainer.hxx>
#include <connectivity/dbmetadata.hxx>
#include <cppuhelper/implbase2.hxx>
-#include <svl/undo.hxx>
#include <memory>
@@ -55,25 +53,20 @@ namespace dbaui
//........................................................................
//====================================================================
- //= OSingleDocumentController
+ //= DBSubComponentController
//====================================================================
- class OSingleDocumentController;
+ class DBSubComponentController;
typedef ::cppu::ImplInheritanceHelper2 < OGenericUnoController
, ::com::sun::star::document::XScriptInvocationContext
, ::com::sun::star::util::XModifiable
- > OSingleDocumentController_Base;
+ > DBSubComponentController_Base;
- struct OSingleDocumentControllerImpl;
- class DBACCESS_DLLPUBLIC OSingleDocumentController
- :public OSingleDocumentController_Base
- ,public IEnvironment
+ struct DBSubComponentController_Impl;
+ class DBACCESS_DLLPUBLIC DBSubComponentController : public DBSubComponentController_Base
{
private:
- ::std::auto_ptr<OSingleDocumentControllerImpl> m_pImpl;
-
- protected:
- SfxUndoManager m_aUndoManager;
+ ::std::auto_ptr<DBSubComponentController_Impl> m_pImpl;
private:
/** forces usage of a connection which we do not own
@@ -85,9 +78,7 @@ namespace dbaui
// OGenericUnoController - initialization
virtual void impl_initialize();
- // 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 FeatureState GetState(sal_uInt16 nId) const;
- // execute a feature
+ // OGenericUnoController
virtual void Execute(sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > getPrivateModel() const;
@@ -101,14 +92,6 @@ namespace dbaui
sal_Bool isEditable() const;
void setEditable(sal_Bool _bEditable);
- // need for undo's and redo's
- SfxUndoManager* getUndoMgr();
-
- /** addUndoActionAndInvalidate adds an undo action to the undoManager,
- additionally invalidates the UNDO and REDO slot
- @param pAction the undo action to add
- */
- void addUndoActionAndInvalidate(SfxUndoAction *pAction);
// ----------------------------------------------------------------
// asking for connection-related stuff
@@ -131,10 +114,9 @@ namespace dbaui
*/
const ::dbtools::DatabaseMetaData& getSdbMetaData() const;
- // IEnvironment
/** appends an error in the current environment.
*/
- virtual void appendError(
+ void appendError(
const ::rtl::OUString& _rErrorMessage,
const ::dbtools::StandardSQLState _eSQLState = ::dbtools::SQL_GENERAL_ERROR,
const sal_Int32 _nErrorCode = 1000
@@ -142,20 +124,20 @@ namespace dbaui
/** clears the error state.
*/
- virtual void clearError();
+ void clearError();
/** @return
<TRUE/> when an error was set otherwise <FALSE/>
*/
- virtual sal_Bool hasError() const;
+ sal_Bool hasError() const;
/** returns the current error
*/
- virtual const ::dbtools::SQLExceptionInfo& getError() const;
+ const ::dbtools::SQLExceptionInfo& getError() const;
/** displays the current error, or does nothing if there is no current error
*/
- virtual void displayError();
+ void displayError();
/** shows an info box with the string conntection lost.
*/
@@ -165,7 +147,7 @@ namespace dbaui
@return
the currently used connection.
*/
- virtual const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
+ const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >&
getConnection() const;
/** returns the number formatter
@@ -191,8 +173,8 @@ namespace dbaui
virtual ::rtl::OUString SAL_CALL getTitle( ) throw (::com::sun::star::uno::RuntimeException);
protected:
- OSingleDocumentController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB);
- virtual ~OSingleDocumentController();
+ DBSubComponentController(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB);
+ virtual ~DBSubComponentController();
virtual void disconnect();
virtual void reconnect( sal_Bool _bUI );
@@ -203,9 +185,6 @@ namespace dbaui
*/
virtual void losingConnection( );
- // late construction
- virtual sal_Bool Construct(Window* pParent);
-
protected:
// XEventListener
virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException );
@@ -223,12 +202,12 @@ namespace dbaui
sal_Int32 getCurrentStartNumber() const;
private:
- OSingleDocumentController(); // never implemented
+ DBSubComponentController(); // never implemented
};
//........................................................................
} // namespace dbaui
//........................................................................
-#endif // DBAUI_SINGLEDOCCONTROLLER_HXX
+#endif // DBAUI_SUBCOMPONENTCONTROLLER_HXX
diff --git a/dbaccess/qa/complex/dbaccess/DatabaseApplication.java b/dbaccess/qa/complex/dbaccess/DatabaseApplication.java
index 0941bd318d47..0941bd318d47 100644..100755
--- a/dbaccess/qa/complex/dbaccess/DatabaseApplication.java
+++ b/dbaccess/qa/complex/dbaccess/DatabaseApplication.java
diff --git a/dbaccess/qa/complex/dbaccess/makefile.mk b/dbaccess/qa/complex/dbaccess/makefile.mk
index b96faa01d605..760f94a294fa 100755
--- a/dbaccess/qa/complex/dbaccess/makefile.mk
+++ b/dbaccess/qa/complex/dbaccess/makefile.mk
@@ -64,9 +64,7 @@ JAVATESTFILES = \
RowSet.java \
SingleSelectQueryComposer.java \
UISettings.java \
- CopyTableWizard.java
-
-# disable for now (#i115753#)
+ CopyTableWizard.java \
# put here all other files
JAVAFILES = $(JAVATESTFILES) \
@@ -75,7 +73,7 @@ JAVAFILES = $(JAVATESTFILES) \
DatabaseApplication.java \
FileHelper.java \
RowSetEventListener.java \
- TestCase.java
+ TestCase.java \
# Sample how to debug
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index 595d9b412851..f624853c8852 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -482,10 +482,6 @@ sal_Bool OApplicationController::Construct(Window* _pParent)
return sal_False;
}
- DBG_ASSERT( getView(), "OApplicationController::Construct: have no view!" );
- if ( getView() )
- getView()->enableSeparator( );
-
// now that we have a view we can create the clipboard listener
m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() );
m_aSystemClipboard.StartClipboardListening( );
diff --git a/dbaccess/source/ui/browser/dataview.cxx b/dbaccess/source/ui/browser/dataview.cxx
index 382aac477727..8112250ad23e 100644
--- a/dbaccess/source/ui/browser/dataview.cxx
+++ b/dbaccess/source/ui/browser/dataview.cxx
@@ -44,9 +44,6 @@
#ifndef _SFXIMGMGR_HXX
#include <sfx2/imgmgr.hxx>
#endif
-#ifndef _SV_FIXED_HXX
-#include <vcl/fixed.hxx>
-#endif
#ifndef DBAUI_ICONTROLLER_HXX
#include "IController.hxx"
#endif
@@ -103,11 +100,12 @@ namespace dbaui
:Window(pParent,nStyle)
,m_xServiceFactory(_rFactory)
,m_rController( _rController )
- ,m_pSeparator( NULL )
+ ,m_aSeparator( this )
{
DBG_CTOR(ODataView,NULL);
m_rController.acquire();
m_pAccel.reset(::svt::AcceleratorExecute::createAcceleratorHelper());
+ m_aSeparator.Show();
}
// -------------------------------------------------------------------------
@@ -120,30 +118,10 @@ namespace dbaui
{
DBG_DTOR(ODataView,NULL);
- enableSeparator( sal_False );
m_rController.release();
}
// -------------------------------------------------------------------------
- void ODataView::enableSeparator( const sal_Bool _bEnable )
- {
- if ( _bEnable == isSeparatorEnabled() )
- // nothing to do
- return;
-
- if ( _bEnable )
- {
- m_pSeparator = new FixedLine( this );
- m_pSeparator->Show( );
- }
- else
- {
- ::std::auto_ptr<FixedLine> aTemp(m_pSeparator);
- m_pSeparator = NULL;
- }
- Resize();
- }
- // -------------------------------------------------------------------------
void ODataView::resizeDocumentView( Rectangle& /*_rPlayground*/ )
{
}
@@ -167,15 +145,10 @@ namespace dbaui
{
Rectangle aPlayground( _rPlayground );
- // position thew separator
- if ( m_pSeparator )
- {
- Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
-
- m_pSeparator->SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
-
- aPlayground.Top() += aSeparatorSize.Height() + 1;
- }
+ // position the separator
+ const Size aSeparatorSize = Size( aPlayground.GetWidth(), 2 );
+ m_aSeparator.SetPosSizePixel( aPlayground.TopLeft(), aSeparatorSize );
+ aPlayground.Top() += aSeparatorSize.Height() + 1;
// position the controls of the document's view
resizeDocumentView( aPlayground );
diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx
index b81b073a56bf..0c0190318c72 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -704,6 +704,18 @@ void OGenericUnoController::InvalidateFeature_Impl()
// -----------------------------------------------------------------------
void OGenericUnoController::ImplInvalidateFeature( sal_Int32 _nId, const Reference< XStatusListener >& _xListener, sal_Bool _bForceBroadcast )
{
+#if OSL_DEBUG_LEVEL > 0
+ if ( _nId != -1 )
+ {
+ SupportedFeatures::iterator aFeaturePos = ::std::find_if(
+ m_aSupportedFeatures.begin(),
+ m_aSupportedFeatures.end(),
+ ::std::bind2nd( CompareFeatureById(), _nId )
+ );
+ OSL_ENSURE( aFeaturePos != m_aSupportedFeatures.end(), "OGenericUnoController::ImplInvalidateFeature: invalidating an unsupported feature is suspicious, at least!" );
+ }
+#endif
+
FeatureListener aListener;
aListener.nId = _nId;
aListener.xListener = _xListener;
diff --git a/dbaccess/source/ui/control/sqledit.cxx b/dbaccess/source/ui/control/sqledit.cxx
index 89cdc855a0cd..69ed6bcd84f0 100644
--- a/dbaccess/source/ui/control/sqledit.cxx
+++ b/dbaccess/source/ui/control/sqledit.cxx
@@ -126,11 +126,11 @@ IMPL_LINK(OSqlEdit, OnUndoActionTimer, void*, EMPTYARG)
if(aText != m_strOrigText)
{
OJoinController& rController = m_pView->getContainerWindow()->getDesignView()->getController();
- SfxUndoManager* pUndoMgr = rController.getUndoMgr();
+ SfxUndoManager& rUndoMgr = rController.GetUndoManager();
OSqlEditUndoAct* pUndoAct = new OSqlEditUndoAct( this );
pUndoAct->SetOriginalText( m_strOrigText );
- pUndoMgr->AddUndoAction( pUndoAct );
+ rUndoMgr.AddUndoAction( pUndoAct );
rController.InvalidateFeature(SID_UNDO);
rController.InvalidateFeature(SID_REDO);
diff --git a/dbaccess/source/ui/dlg/UserAdminDlg.src b/dbaccess/source/ui/dlg/UserAdminDlg.src
index faa7f33302d7..d3a59a511deb 100644
--- a/dbaccess/source/ui/dlg/UserAdminDlg.src
+++ b/dbaccess/source/ui/dlg/UserAdminDlg.src
@@ -49,7 +49,6 @@ TabDialog DLG_DATABASE_USERADMIN
{
OutputSize = TRUE ;
HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
};
String STR_PAGETITLE_USERADMIN
{
diff --git a/dbaccess/source/ui/dlg/advancedsettings.src b/dbaccess/source/ui/dlg/advancedsettings.src
index 6d144890b415..9a2dc467d586 100644
--- a/dbaccess/source/ui/dlg/advancedsettings.src
+++ b/dbaccess/source/ui/dlg/advancedsettings.src
@@ -370,7 +370,6 @@ TabDialog DLG_DATABASE_ADVANCED
{
OutputSize = TRUE ;
HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
};
String STR_GENERATED_VALUE
diff --git a/dbaccess/source/ui/dlg/dbadmin.src b/dbaccess/source/ui/dlg/dbadmin.src
index 1d8744f07b53..f16edc83a761 100644
--- a/dbaccess/source/ui/dlg/dbadmin.src
+++ b/dbaccess/source/ui/dlg/dbadmin.src
@@ -113,7 +113,6 @@ TabDialog DLG_DATABASE_ADMINISTRATION
{
OutputSize = TRUE ;
HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
};
//.........................................................................
@@ -147,7 +146,6 @@ ModalDialog DLG_DATABASE_TYPE_CHANGE
{
OutputSize = TRUE ;
HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
};
Text [ en-US ] = "Database properties" ;
};
diff --git a/dbaccess/source/ui/dlg/dbadminsetup.src b/dbaccess/source/ui/dlg/dbadminsetup.src
index 5fc9cdc12f23..4d6812143598 100644
--- a/dbaccess/source/ui/dlg/dbadminsetup.src
+++ b/dbaccess/source/ui/dlg/dbadminsetup.src
@@ -56,7 +56,6 @@ ModalDialog DLG_DATABASE_WIZARD
{
OutputSize = TRUE ;
HelpId = HID_DSADMIN_TABCONTROL;
- SingleLine=TRUE;
};
String STR_DBWIZARDTITLE
diff --git a/dbaccess/source/ui/inc/JoinController.hxx b/dbaccess/source/ui/inc/JoinController.hxx
index 41ee2458fa2f..8ff5fe99b727 100644
--- a/dbaccess/source/ui/inc/JoinController.hxx
+++ b/dbaccess/source/ui/inc/JoinController.hxx
@@ -27,26 +27,14 @@
#ifndef DBAUI_JOINCONTROLLER_HXX
#define DBAUI_JOINCONTROLLER_HXX
-#ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
#include "singledoccontroller.hxx"
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
-#endif
-#ifndef DBAUI_JOINTABLEVIEW_HXX
#include "JoinTableView.hxx"
-#endif
-#ifndef DBAUI_JOINDESIGNVIEW_HXX
#include "JoinDesignView.hxx"
-#endif
#include "TableConnectionData.hxx"
#include "TableWindowData.hxx"
-#ifndef _MEMORY_
#include <memory>
-#endif
#include <boost/shared_ptr.hpp>
namespace comphelper
diff --git a/dbaccess/source/ui/inc/TableController.hxx b/dbaccess/source/ui/inc/TableController.hxx
index 3651c5632504..a1f1b8158c65 100644
--- a/dbaccess/source/ui/inc/TableController.hxx
+++ b/dbaccess/source/ui/inc/TableController.hxx
@@ -27,36 +27,16 @@
#ifndef DBUI_TABLECONTROLLER_HXX
#define DBUI_TABLECONTROLLER_HXX
-#ifndef DBAUI_SINGLEDOCCONTROLLER_HXX
#include "singledoccontroller.hxx"
-#endif
-#ifndef _DBAUI_MODULE_DBU_HXX_
#include "moduledbu.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
#include <com/sun/star/sdbc/XConnection.hpp>
-#endif
-#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOBJECTOUTPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectOutputStream.hpp>
-#endif
-#ifndef _COM_SUN_STAR_IO_XOBJECTINPUTSTREAM_HPP_
#include <com/sun/star/io/XObjectInputStream.hpp>
-#endif
-#ifndef DBAUI_TYPEINFO_HXX
#include "TypeInfo.hxx"
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XCOLUMNSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_SDBCX_XKEYSSUPPLIER_HPP_
#include <com/sun/star/sdbcx/XKeysSupplier.hpp>
-#endif
-#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
-#endif
class FixedText;
namespace dbaui
@@ -129,9 +109,6 @@ namespace dbaui
virtual void impl_onModifyChanged();
- // const ::connectivity::OSQLParseNode* getParseTree() const { return m_aSqlIterator.getParseTree();}
- // need for undo's and redo's
- SfxUndoManager* getUndoMgr();
inline ::std::vector< ::boost::shared_ptr<OTableRow> >* getRows() { return &m_vRowList; }
/// returns the postion of the the first empty row
diff --git a/dbaccess/source/ui/inc/singledoccontroller.hxx b/dbaccess/source/ui/inc/singledoccontroller.hxx
new file mode 100755
index 000000000000..c738bd94e81c
--- /dev/null
+++ b/dbaccess/source/ui/inc/singledoccontroller.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ * 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 DBAUI_SINGLEDOCCONTROLLER_HXX
+#define DBAUI_SINGLEDOCCONTROLLER_HXX
+
+#include "dbsubcomponentcontroller.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/document/XUndoManagerSupplier.hpp>
+/** === end UNO includes === **/
+
+#include <cppuhelper/implbase1.hxx>
+
+class SfxUndoAction;
+class SfxUndoManager;
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ //==================================================================================================================
+ //= OSingleDocumentController
+ //==================================================================================================================
+ struct OSingleDocumentController_Data;
+ typedef ::cppu::ImplInheritanceHelper1 < DBSubComponentController
+ , ::com::sun::star::document::XUndoManagerSupplier
+ > OSingleDocumentController_Base;
+ class OSingleDocumentController : public OSingleDocumentController_Base
+ {
+ protected:
+ OSingleDocumentController( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxORB );
+ virtual ~OSingleDocumentController();
+
+ // OComponentHelper
+ virtual void SAL_CALL disposing();
+
+ public:
+ /// need for undo's and redo's
+ SfxUndoManager& GetUndoManager() const;
+
+ /// complete clears the Undo/Redo stacks
+ void ClearUndoManager();
+
+ /** addUndoActionAndInvalidate adds an undo action to the undoManager,
+ additionally invalidates the UNDO and REDO slot
+ @param pAction the undo action to add
+ */
+ void addUndoActionAndInvalidate( SfxUndoAction* pAction );
+
+ // OGenericUnoController
+ virtual FeatureState GetState( sal_uInt16 nId ) const;
+ virtual void Execute( sal_uInt16 nId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& aArgs );
+
+ // XUndoManagerSupplier
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > SAL_CALL getUndoManager( ) 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 );
+
+ private:
+ ::std::auto_ptr< OSingleDocumentController_Data > m_pData;
+ };
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
+
+#endif // DBAUI_SINGLEDOCCONTROLLER_HXX
diff --git a/dbaccess/source/ui/misc/dbaundomanager.cxx b/dbaccess/source/ui/misc/dbaundomanager.cxx
new file mode 100755
index 000000000000..1e60a027a693
--- /dev/null
+++ b/dbaccess/source/ui/misc/dbaundomanager.cxx
@@ -0,0 +1,395 @@
+/*************************************************************************
+ * 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.
+ *
+ ************************************************************************/
+
+#include "precompiled_dbaccess.hxx"
+
+#include "dbaundomanager.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/lang/DisposedException.hpp>
+/** === end UNO includes === **/
+
+#include <svl/undo.hxx>
+#include <vcl/svapp.hxx>
+#include <vos/mutex.hxx>
+#include <framework/undomanagerhelper.hxx>
+
+//......................................................................................................................
+namespace dbaui
+{
+//......................................................................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::document::XUndoManager;
+ using ::com::sun::star::lang::DisposedException;
+ using ::com::sun::star::document::UndoContextNotClosedException;
+ using ::com::sun::star::document::UndoFailedException;
+ using ::com::sun::star::document::EmptyUndoStackException;
+ using ::com::sun::star::util::InvalidStateException;
+ using ::com::sun::star::document::XUndoAction;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::document::XUndoManagerListener;
+ using ::com::sun::star::util::NotLockedException;
+ using ::com::sun::star::lang::NoSupportException;
+ /** === end UNO using === **/
+
+ //==================================================================================================================
+ //= UndoManager_Impl
+ //==================================================================================================================
+ struct UndoManager_Impl : public ::framework::IUndoManagerImplementation
+ {
+ UndoManager_Impl( UndoManager& i_antiImpl, ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :rAntiImpl( i_antiImpl )
+ ,rParent( i_parent )
+ ,rMutex( i_mutex )
+ ,bDisposed( false )
+ ,aUndoManager()
+ ,aUndoHelper( *this )
+ {
+ }
+
+ virtual ~UndoManager_Impl()
+ {
+ }
+
+ UndoManager& rAntiImpl;
+ ::cppu::OWeakObject& rParent;
+ ::osl::Mutex& rMutex;
+ bool bDisposed;
+ SfxUndoManager aUndoManager;
+ ::framework::UndoManagerHelper aUndoHelper;
+
+ // IUndoManagerImplementation
+ virtual ::svl::IUndoManager& getImplUndoManager();
+ virtual Reference< XUndoManager > getThis();
+ };
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::svl::IUndoManager& UndoManager_Impl::getImplUndoManager()
+ {
+ return aUndoManager;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XUndoManager > UndoManager_Impl::getThis()
+ {
+ return static_cast< XUndoManager* >( &rAntiImpl );
+ }
+
+ //==============================================================================================================
+ //= OslMutexFacade
+ //==============================================================================================================
+ class OslMutexFacade : public ::framework::IMutex
+ {
+ public:
+ OslMutexFacade( ::osl::Mutex& i_mutex )
+ :m_rMutex( i_mutex )
+ {
+ }
+
+ virtual void acquire();
+ virtual void release();
+
+ private:
+ ::osl::Mutex& m_rMutex;
+ };
+
+ //--------------------------------------------------------------------------------------------------------------
+ void OslMutexFacade::acquire()
+ {
+ m_rMutex.acquire();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void OslMutexFacade::release()
+ {
+ m_rMutex.release();
+ }
+
+ //==============================================================================================================
+ //= UndoManagerMethodGuard
+ //==============================================================================================================
+ /** guard for public UNO methods of the UndoManager
+ */
+ class UndoManagerMethodGuard : public ::framework::IMutexGuard
+ {
+ public:
+ UndoManagerMethodGuard( UndoManager_Impl& i_impl )
+ :m_aGuard( i_impl.rMutex )
+ ,m_aMutexFacade( i_impl.rMutex )
+ {
+ // throw if the instance is already disposed
+ if ( i_impl.bDisposed )
+ throw DisposedException( ::rtl::OUString(), i_impl.getThis() );
+ }
+ virtual ~UndoManagerMethodGuard()
+ {
+ }
+
+ // IMutexGuard
+ virtual ::framework::IMutex& getGuardedMutex();
+
+ // IGuard
+ virtual void clear();
+ virtual void reset();
+
+ private:
+ ::osl::ResettableMutexGuard m_aGuard;
+ OslMutexFacade m_aMutexFacade;
+ };
+
+ //--------------------------------------------------------------------------------------------------------------
+ ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex()
+ {
+ return m_aMutexFacade;
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManagerMethodGuard::clear()
+ {
+ m_aGuard.clear();
+ }
+
+ //--------------------------------------------------------------------------------------------------------------
+ void UndoManagerMethodGuard::reset()
+ {
+ m_aGuard.reset();
+ }
+
+ //==================================================================================================================
+ //= UndoManager
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ UndoManager::UndoManager( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :m_pImpl( new UndoManager_Impl( *this, i_parent, i_mutex ) )
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ UndoManager::~UndoManager()
+ {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ SfxUndoManager& UndoManager::GetSfxUndoManager() const
+ {
+ return m_pImpl->aUndoManager;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::acquire( ) throw ()
+ {
+ m_pImpl->rParent.acquire();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::release( ) throw ()
+ {
+ m_pImpl->rParent.release();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void UndoManager::disposing()
+ {
+ {
+ ::osl::MutexGuard aGuard( m_pImpl->rMutex );
+ m_pImpl->bDisposed = true;
+ }
+ m_pImpl->aUndoHelper.disposing();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::enterUndoContext( const ::rtl::OUString& i_title ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.enterUndoContext( i_title, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::enterHiddenUndoContext( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.enterHiddenUndoContext( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::leaveUndoContext( ) throw (InvalidStateException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.leaveUndoContext( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addUndoAction( const Reference< XUndoAction >& i_action ) throw (IllegalArgumentException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.addUndoAction( i_action, aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::undo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // (all our UndoActions work directly on VCL code, usually, so ...)
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.undo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::redo( ) throw (EmptyUndoStackException, UndoContextNotClosedException, UndoFailedException, RuntimeException)
+ {
+ ::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
+ // (all our UndoActions work directly on VCL code, usually, so ...)
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.redo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isUndoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.isUndoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isRedoPossible( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.isRedoPossible();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UndoManager::getCurrentUndoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getCurrentUndoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::rtl::OUString SAL_CALL UndoManager::getCurrentRedoActionTitle( ) throw (EmptyUndoStackException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getCurrentRedoActionTitle();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllUndoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getAllUndoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Sequence< ::rtl::OUString > SAL_CALL UndoManager::getAllRedoActionTitles( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.getAllRedoActionTitles();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::clear( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.clear( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::clearRedo( ) throw (UndoContextNotClosedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.clearRedo( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::reset( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.reset( aGuard );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::addUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.addUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::removeUndoManagerListener( const Reference< XUndoManagerListener >& i_listener ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.removeUndoManagerListener( i_listener );
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::lock( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.lock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::unlock( ) throw (NotLockedException, RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ m_pImpl->aUndoHelper.unlock();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL UndoManager::isLocked( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return m_pImpl->aUndoHelper.isLocked();
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ Reference< XInterface > SAL_CALL UndoManager::getParent( ) throw (RuntimeException)
+ {
+ UndoManagerMethodGuard aGuard( *m_pImpl );
+ return *&m_pImpl->rParent;
+ }
+
+ //------------------------------------------------------------------------------------------------------------------
+ void SAL_CALL UndoManager::setParent( const Reference< XInterface >& i_parent ) throw (NoSupportException, RuntimeException)
+ {
+ (void)i_parent;
+ throw NoSupportException( ::rtl::OUString(), m_pImpl->getThis() );
+ }
+
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
new file mode 100644
index 000000000000..eb1b34710ff8
--- /dev/null
+++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx
@@ -0,0 +1,672 @@
+/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_dbaccess.hxx"
+
+#include "browserids.hxx"
+#include "commontypes.hxx"
+#include "dataview.hxx"
+#include "dbu_misc.hrc"
+#include "dbustrings.hrc"
+#include "moduledbu.hxx"
+#include "dbsubcomponentcontroller.hxx"
+
+/** === begin UNO includes === **/
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/container/XChild.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/sdb/XDocumentDataSource.hpp>
+#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
+#include <com/sun/star/sdbc/XDataSource.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/frame/XUntitledNumbers.hpp>
+/** === end UNO includes === **/
+
+#include <comphelper/sequence.hxx>
+#include <comphelper/types.hxx>
+#include <connectivity/dbexception.hxx>
+#include <connectivity/dbtools.hxx>
+#include <cppuhelper/typeprovider.hxx>
+#include <rtl/ustrbuf.hxx>
+#include <toolkit/unohlp.hxx>
+#include <tools/debug.hxx>
+#include <tools/diagnose_ex.h>
+#include <vcl/msgbox.hxx>
+
+//........................................................................
+namespace dbaui
+{
+//........................................................................
+
+ /** === begin UNO using === **/
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::beans::XPropertySet;
+ using ::com::sun::star::util::XNumberFormatter;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Type;
+ using ::com::sun::star::sdbc::XConnection;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::container::XChild;
+ using ::com::sun::star::sdbc::XDataSource;
+ using ::com::sun::star::util::XNumberFormatter;
+ using ::com::sun::star::util::XNumberFormatsSupplier;
+ using ::com::sun::star::frame::XFrame;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::sdbc::SQLException;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::beans::PropertyValue;
+ using ::com::sun::star::frame::XModel;
+ using ::com::sun::star::sdb::XOfficeDatabaseDocument;
+ using ::com::sun::star::awt::XWindow;
+ using ::com::sun::star::sdbc::XDatabaseMetaData;
+ using ::com::sun::star::sdb::XDocumentDataSource;
+ using ::com::sun::star::document::XEmbeddedScripts;
+ using ::com::sun::star::lang::IllegalArgumentException;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::frame::XUntitledNumbers;
+ using ::com::sun::star::beans::PropertyVetoException;
+ /** === end UNO using === **/
+
+ class DataSourceHolder
+ {
+ public:
+ DataSourceHolder()
+ {
+ }
+
+ DataSourceHolder( const Reference< XDataSource >& _rxDataSource )
+ {
+ m_xDataSource = _rxDataSource;
+ Reference< XDocumentDataSource > xDocDS( m_xDataSource, UNO_QUERY );
+ if ( xDocDS.is() )
+ m_xDocument = xDocDS->getDatabaseDocument();
+
+ m_xDataSourceProps.set( m_xDataSource, UNO_QUERY );
+ }
+
+ const Reference< XDataSource >& getDataSource() const { return m_xDataSource; }
+ const Reference< XPropertySet >& getDataSourceProps() const { return m_xDataSourceProps; }
+ const Reference< XOfficeDatabaseDocument > getDatabaseDocument() const { return m_xDocument; }
+
+ bool is() const { return m_xDataSource.is(); }
+
+ void clear()
+ {
+ m_xDataSource.clear();
+ m_xDocument.clear();
+ }
+
+ private:
+ Reference< XDataSource > m_xDataSource;
+ Reference< XPropertySet > m_xDataSourceProps;
+ Reference< XOfficeDatabaseDocument > m_xDocument;
+ };
+
+ struct DBSubComponentController_Impl
+ {
+ private:
+ ::boost::optional< bool > m_aDocScriptSupport;
+
+ public:
+ OModuleClient m_aModuleClient;
+ ::dbtools::SQLExceptionInfo m_aCurrentError;
+
+ ::cppu::OInterfaceContainerHelper
+ m_aModifyListeners;
+
+ // <properties>
+ SharedConnection m_xConnection;
+ ::dbtools::DatabaseMetaData m_aSdbMetaData;
+ // </properties>
+ ::rtl::OUString m_sDataSourceName; // the data source we're working for
+ DataSourceHolder m_aDataSource;
+ Reference< XModel > m_xDocument;
+ Reference< XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
+ sal_Int32 m_nDocStartNumber;
+ sal_Bool m_bSuspended; // is true when the controller was already suspended
+ sal_Bool m_bEditable; // is the control readonly or not
+ sal_Bool m_bModified; // is the data modified
+ bool m_bNotAttached;
+
+ DBSubComponentController_Impl( ::osl::Mutex& i_rMutex )
+ :m_aDocScriptSupport()
+ ,m_aModifyListeners( i_rMutex )
+ ,m_nDocStartNumber(0)
+ ,m_bSuspended( sal_False )
+ ,m_bEditable(sal_True)
+ ,m_bModified(sal_False)
+ ,m_bNotAttached(true)
+ {
+ }
+
+ bool documentHasScriptSupport() const
+ {
+ OSL_PRECOND( !!m_aDocScriptSupport,
+ "DBSubComponentController_Impl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
+ return !!m_aDocScriptSupport && *m_aDocScriptSupport;
+ }
+
+ void setDocumentScriptSupport( const bool _bSupport )
+ {
+ OSL_PRECOND( !m_aDocScriptSupport,
+ "DBSubComponentController_Impl::setDocumentScriptSupport: already initialized!" );
+ m_aDocScriptSupport = ::boost::optional< bool >( _bSupport );
+ }
+ };
+
+ //====================================================================
+ //= DBSubComponentController
+ //====================================================================
+ //--------------------------------------------------------------------
+ DBSubComponentController::DBSubComponentController(const Reference< XMultiServiceFactory >& _rxORB)
+ :DBSubComponentController_Base( _rxORB )
+ ,m_pImpl( new DBSubComponentController_Impl( getMutex() ) )
+ {
+ }
+
+ //--------------------------------------------------------------------
+ DBSubComponentController::~DBSubComponentController()
+ {
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::impl_initialize()
+ {
+ OGenericUnoController::impl_initialize();
+
+ const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
+
+ Reference< XConnection > xConnection;
+ xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, xConnection );
+
+ if ( !xConnection.is() )
+ ::dbtools::isEmbeddedInDatabase( getModel(), xConnection );
+
+ if ( xConnection.is() )
+ initializeConnection( xConnection );
+
+ bool bShowError = true;
+ if ( !isConnected() )
+ {
+ reconnect( sal_False );
+ bShowError = false;
+ }
+ if ( !isConnected() )
+ {
+ if ( bShowError )
+ connectionLostMessage();
+ throw IllegalArgumentException();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ Any SAL_CALL DBSubComponentController::queryInterface(const Type& _rType) throw (RuntimeException)
+ {
+ if ( _rType.equals( XScriptInvocationContext::static_type() ) )
+ {
+ if ( m_pImpl->documentHasScriptSupport() )
+ return makeAny( Reference< XScriptInvocationContext >( this ) );
+ return Any();
+ }
+
+ return DBSubComponentController_Base::queryInterface( _rType );
+ }
+
+ //--------------------------------------------------------------------
+ Sequence< Type > SAL_CALL DBSubComponentController::getTypes( ) throw (RuntimeException)
+ {
+ Sequence< Type > aTypes( DBSubComponentController_Base::getTypes() );
+ if ( !m_pImpl->documentHasScriptSupport() )
+ {
+ Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 );
+ ::std::remove_copy_if(
+ aTypes.getConstArray(),
+ aTypes.getConstArray() + aTypes.getLength(),
+ aStrippedTypes.getArray(),
+ ::std::bind2nd( ::std::equal_to< Type >(), XScriptInvocationContext::static_type() )
+ );
+ aTypes = aStrippedTypes;
+ }
+ return aTypes;
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::initializeConnection( const Reference< XConnection >& _rxForeignConn )
+ {
+ DBG_ASSERT( !isConnected(), "DBSubComponentController::initializeConnection: not to be called when already connected!" );
+ // usually this gets called from within initialize of derived classes ...
+ if ( isConnected() )
+ disconnect();
+
+ m_pImpl->m_xConnection.reset( _rxForeignConn, SharedConnection::NoTakeOwnership );
+ m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
+ startConnectionListening( m_pImpl->m_xConnection );
+
+ // get the data source the connection belongs to
+ try
+ {
+ // determine our data source
+ OSL_PRECOND( !m_pImpl->m_aDataSource.is(), "DBSubComponentController::initializeConnection: already a data source in this phase?" );
+ {
+ Reference< XChild > xConnAsChild( m_pImpl->m_xConnection, UNO_QUERY );
+ Reference< XDataSource > xDS;
+ if ( xConnAsChild.is() )
+ xDS = Reference< XDataSource >( xConnAsChild->getParent(), UNO_QUERY );
+
+ // (take the indirection through XDataSource to ensure we have a correct object ....)
+ m_pImpl->m_aDataSource = xDS;
+ }
+ OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "DBSubComponentController::initializeConnection: unable to obtain the data source object!" );
+
+ if ( m_pImpl->m_bNotAttached )
+ {
+ Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY );
+ m_pImpl->m_nDocStartNumber = 1;
+ if ( xUntitledProvider.is() )
+ m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
+ }
+
+ // determine the availability of script support in our document. Our own XScriptInvocationContext
+ // interface depends on this
+ m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() );
+
+ // get a number formatter
+ Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps(), UNO_SET_THROW );
+ xDataSourceProps->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->m_sDataSourceName;
+ DBG_ASSERT( m_pImpl->m_sDataSourceName.getLength(), "DBSubComponentController::initializeConnection: invalid data source name!" );
+ Reference< XNumberFormatsSupplier> xSupplier = ::dbtools::getNumberFormats(m_pImpl->m_xConnection);
+ if(xSupplier.is())
+ {
+ m_pImpl->m_xFormatter = Reference< XNumberFormatter >(getORB()
+ ->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")), UNO_QUERY);
+ m_pImpl->m_xFormatter->attachNumberFormatsSupplier(xSupplier);
+ }
+ OSL_ENSURE(m_pImpl->m_xFormatter.is(),"No NumberFormatter!");
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::reconnect( sal_Bool _bUI )
+ {
+ OSL_ENSURE(!m_pImpl->m_bSuspended, "Cannot reconnect while suspended!");
+
+ stopConnectionListening( m_pImpl->m_xConnection );
+ m_pImpl->m_aSdbMetaData.reset( NULL );
+ m_pImpl->m_xConnection.clear();
+
+ // reconnect
+ sal_Bool bReConnect = sal_True;
+ if ( _bUI )
+ {
+ QueryBox aQuery( getView(), ModuleRes(QUERY_CONNECTION_LOST) );
+ bReConnect = ( RET_YES == aQuery.Execute() );
+ }
+
+ // now really reconnect ...
+ if ( bReConnect )
+ {
+ m_pImpl->m_xConnection.reset( connect( m_pImpl->m_aDataSource.getDataSource(), NULL ), SharedConnection::TakeOwnership );
+ m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
+ }
+
+ // invalidate all slots
+ InvalidateAll();
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::disconnect()
+ {
+ stopConnectionListening(m_pImpl->m_xConnection);
+ m_pImpl->m_aSdbMetaData.reset( NULL );
+ m_pImpl->m_xConnection.clear();
+
+ InvalidateAll();
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::losingConnection()
+ {
+ // our connection was disposed so we need a new one
+ reconnect( sal_True );
+ InvalidateAll();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::disposing()
+ {
+ DBSubComponentController_Base::disposing();
+
+ disconnect();
+
+ attachFrame( Reference < XFrame >() );
+
+ m_pImpl->m_aDataSource.clear();
+ }
+
+ //--------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::disposing(const EventObject& _rSource) throw( RuntimeException )
+ {
+ if ( _rSource.Source == getConnection() )
+ {
+ if ( !m_pImpl->m_bSuspended // when already suspended then we don't have to reconnect
+ && !getBroadcastHelper().bInDispose
+ && !getBroadcastHelper().bDisposed
+ && isConnected()
+ )
+ {
+ losingConnection();
+ }
+ else
+ {
+ m_pImpl->m_xConnection.reset( m_pImpl->m_xConnection, SharedConnection::NoTakeOwnership );
+ // this prevents the "disposeComponent" call in disconnect
+ disconnect();
+ }
+ }
+ else
+ DBSubComponentController_Base::disposing( _rSource );
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::appendError( const ::rtl::OUString& _rErrorMessage, const ::dbtools::StandardSQLState _eSQLState,
+ const sal_Int32 _nErrorCode )
+ {
+ m_pImpl->m_aCurrentError.append( ::dbtools::SQLExceptionInfo::SQL_EXCEPTION, _rErrorMessage, getStandardSQLStateAscii( _eSQLState ),
+ _nErrorCode );
+ }
+ //--------------------------------------------------------------------
+ void DBSubComponentController::clearError()
+ {
+ m_pImpl->m_aCurrentError = ::dbtools::SQLExceptionInfo();
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool DBSubComponentController::hasError() const
+ {
+ return m_pImpl->m_aCurrentError.isValid();
+ }
+
+ //--------------------------------------------------------------------
+ const ::dbtools::SQLExceptionInfo& DBSubComponentController::getError() const
+ {
+ return m_pImpl->m_aCurrentError;
+ }
+
+ //--------------------------------------------------------------------
+ void DBSubComponentController::displayError()
+ {
+ showError( m_pImpl->m_aCurrentError );
+ }
+
+ //--------------------------------------------------------------------
+ sal_Bool SAL_CALL DBSubComponentController::suspend(sal_Bool bSuspend) throw( RuntimeException )
+ {
+ m_pImpl->m_bSuspended = bSuspend;
+ if ( !bSuspend && !isConnected() )
+ reconnect(sal_True);
+
+
+ return sal_True;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool SAL_CALL DBSubComponentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException )
+ {
+ if ( !_rxModel.is() )
+ return sal_False;
+ if ( !DBSubComponentController_Base::attachModel( _rxModel ) )
+ return sal_False;
+
+ m_pImpl->m_bNotAttached = false;
+ if ( m_pImpl->m_nDocStartNumber == 1 )
+ releaseNumberForComponent();
+
+ Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY );
+ m_pImpl->m_nDocStartNumber = 1;
+ if ( xUntitledProvider.is() )
+ m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
+
+ return sal_True;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs)
+ {
+ if ( _nId == ID_BROWSER_CLOSE )
+ {
+ closeTask();
+ return;
+ }
+
+ DBSubComponentController_Base::Execute( _nId, _rArgs );
+ InvalidateFeature( _nId );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::rtl::OUString DBSubComponentController::getDataSourceName() const
+ {
+ ::rtl::OUString sName;
+ Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps() );
+ if ( xDataSourceProps.is() )
+ xDataSourceProps->getPropertyValue(PROPERTY_NAME) >>= sName;
+ return sName;
+ }
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::connectionLostMessage() const
+ {
+ String aMessage(ModuleRes(RID_STR_CONNECTION_LOST));
+ Reference< XWindow > xWindow = getTopMostContainerWindow();
+ Window* pWin = NULL;
+ if ( xWindow.is() )
+ pWin = VCLUnoHelper::GetWindow(xWindow);
+ if ( !pWin )
+ pWin = getView()->Window::GetParent();
+
+ InfoBox(pWin, aMessage).Execute();
+ }
+ // -----------------------------------------------------------------------------
+ const Reference< XConnection >& DBSubComponentController::getConnection() const
+ {
+ return m_pImpl->m_xConnection;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::isReadOnly() const
+ {
+ return !m_pImpl->m_bEditable;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::isEditable() const
+ {
+ return m_pImpl->m_bEditable;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::setEditable(sal_Bool _bEditable)
+ {
+ m_pImpl->m_bEditable = _bEditable;
+ }
+
+ // -----------------------------------------------------------------------------
+ const ::dbtools::DatabaseMetaData& DBSubComponentController::getSdbMetaData() const
+ {
+ return m_pImpl->m_aSdbMetaData;
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::isConnected() const
+ {
+ return m_pImpl->m_xConnection.is();
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XDatabaseMetaData > DBSubComponentController::getMetaData( ) const
+ {
+ Reference< XDatabaseMetaData > xMeta;
+ try
+ {
+ if ( isConnected() )
+ xMeta.set( m_pImpl->m_xConnection->getMetaData(), UNO_SET_THROW );
+ }
+ catch( const Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ return xMeta;
+ }
+
+ // -----------------------------------------------------------------------------
+ const Reference< XPropertySet >& DBSubComponentController::getDataSource() const
+ {
+ return m_pImpl->m_aDataSource.getDataSourceProps();
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::haveDataSource() const
+ {
+ return m_pImpl->m_aDataSource.is();
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XModel > DBSubComponentController::getDatabaseDocument() const
+ {
+ return Reference< XModel >( m_pImpl->m_aDataSource.getDatabaseDocument(), UNO_QUERY );
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XNumberFormatter > DBSubComponentController::getNumberFormatter() const
+ {
+ return m_pImpl->m_xFormatter;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XModel > DBSubComponentController::getPrivateModel() const
+ {
+ return getDatabaseDocument();
+ }
+ // -----------------------------------------------------------------------------
+ // XTitle
+ ::rtl::OUString SAL_CALL DBSubComponentController::getTitle()
+ throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ if ( m_bExternalTitle )
+ return impl_getTitleHelper_throw()->getTitle ();
+
+ ::rtl::OUStringBuffer sTitle;
+ Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
+ if ( xTitle.is() )
+ {
+ sTitle.append( xTitle->getTitle() );
+ sTitle.appendAscii(" : ");
+ }
+ sTitle.append( getPrivateTitle() );
+ return sTitle.makeStringAndClear();
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Int32 DBSubComponentController::getCurrentStartNumber() const
+ {
+ return m_pImpl->m_nDocStartNumber;
+ }
+
+ // -----------------------------------------------------------------------------
+ Reference< XEmbeddedScripts > SAL_CALL DBSubComponentController::getScriptContainer() throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ if ( !m_pImpl->documentHasScriptSupport() )
+ return NULL;
+
+ return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW );
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_pImpl->m_aModifyListeners.addInterface( i_Listener );
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ m_pImpl->m_aModifyListeners.removeInterface( i_Listener );
+ }
+
+ // -----------------------------------------------------------------------------
+ ::sal_Bool SAL_CALL DBSubComponentController::isModified( ) throw (RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( getMutex() );
+ return impl_isModified();
+ }
+
+ // -----------------------------------------------------------------------------
+ void SAL_CALL DBSubComponentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException)
+ {
+ ::osl::ClearableMutexGuard aGuard( getMutex() );
+
+ if ( m_pImpl->m_bModified == i_bModified )
+ return;
+
+ m_pImpl->m_bModified = i_bModified;
+ impl_onModifyChanged();
+
+ EventObject aEvent( *this );
+ aGuard.clear();
+ m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
+ }
+
+ // -----------------------------------------------------------------------------
+ sal_Bool DBSubComponentController::impl_isModified() const
+ {
+ return m_pImpl->m_bModified;
+ }
+
+ // -----------------------------------------------------------------------------
+ void DBSubComponentController::impl_onModifyChanged()
+ {
+ InvalidateFeature( ID_BROWSER_SAVEDOC );
+ if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
+ InvalidateFeature( ID_BROWSER_SAVEASDOC );
+ }
+
+//........................................................................
+} // namespace dbaui
+//........................................................................
+
diff --git a/dbaccess/source/ui/misc/linkeddocuments.cxx b/dbaccess/source/ui/misc/linkeddocuments.cxx
index 4d3472e623b7..553050f961e9 100644
--- a/dbaccess/source/ui/misc/linkeddocuments.cxx
+++ b/dbaccess/source/ui/misc/linkeddocuments.cxx
@@ -114,9 +114,6 @@
#ifndef _SB_SBUNO_HXX
#include <basic/sbuno.hxx>
#endif
-#ifndef _SFX_MACROCONF_HXX
-#include <sfx2/macrconf.hxx>
-#endif
#ifndef _EHDL_HXX
#include <svtools/ehdl.hxx>
#endif
diff --git a/dbaccess/source/ui/misc/makefile.mk b/dbaccess/source/ui/misc/makefile.mk
index 7f9bbed56023..534d90e3995c 100644
--- a/dbaccess/source/ui/misc/makefile.mk
+++ b/dbaccess/source/ui/misc/makefile.mk
@@ -25,8 +25,8 @@
#
#*************************************************************************
-PRJ=..$/..$/..
-PRJINC=$(PRJ)$/source
+PRJ=../../..
+PRJINC=$(PRJ)/source
PRJNAME=dbaccess
TARGET=uimisc
@@ -35,50 +35,53 @@ ENABLE_EXCEPTIONS=TRUE
# --- Settings ----------------------------------
.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/makefile.pmk
+.INCLUDE : $(PRJ)/util/makefile.pmk
# --- Files -------------------------------------
# ... resource files ............................
SRS1NAME=$(TARGET)
-SRC1FILES = \
- dbumiscres.src \
+SRC1FILES = \
+ dbumiscres.src \
WizardPages.src
# ... object files ............................
-SLOFILES= \
- $(SLO)$/asyncmodaldialog.obj \
- $(SLO)$/imageprovider.obj \
- $(SLO)$/singledoccontroller.obj \
- $(SLO)$/datasourceconnector.obj \
- $(SLO)$/linkeddocuments.obj \
- $(SLO)$/indexcollection.obj \
- $(SLO)$/UITools.obj \
- $(SLO)$/WCPage.obj \
- $(SLO)$/WCopyTable.obj \
- $(SLO)$/WTypeSelect.obj \
- $(SLO)$/TokenWriter.obj \
- $(SLO)$/HtmlReader.obj \
- $(SLO)$/RtfReader.obj \
- $(SLO)$/propertysetitem.obj \
- $(SLO)$/databaseobjectview.obj \
- $(SLO)$/DExport.obj \
- $(SLO)$/uiservices.obj \
- $(SLO)$/RowSetDrop.obj \
- $(SLO)$/TableCopyHelper.obj \
- $(SLO)$/moduledbu.obj \
- $(SLO)$/WColumnSelect.obj \
- $(SLO)$/WExtendPages.obj \
- $(SLO)$/WNameMatch.obj \
- $(SLO)$/ToolBoxHelper.obj \
- $(SLO)$/stringlistitem.obj \
- $(SLO)$/charsets.obj \
- $(SLO)$/defaultobjectnamecheck.obj \
- $(SLO)$/dsmeta.obj \
- $(SLO)$/controllerframe.obj \
- $(SLO)$/propertystorage.obj
+SLOFILES= \
+ $(SLO)/asyncmodaldialog.obj \
+ $(SLO)/imageprovider.obj \
+ $(SLO)/singledoccontroller.obj \
+ $(SLO)/dbsubcomponentcontroller.obj \
+ $(SLO)/datasourceconnector.obj \
+ $(SLO)/linkeddocuments.obj \
+ $(SLO)/indexcollection.obj \
+ $(SLO)/UITools.obj \
+ $(SLO)/WCPage.obj \
+ $(SLO)/WCopyTable.obj \
+ $(SLO)/WTypeSelect.obj \
+ $(SLO)/TokenWriter.obj \
+ $(SLO)/HtmlReader.obj \
+ $(SLO)/RtfReader.obj \
+ $(SLO)/propertysetitem.obj \
+ $(SLO)/databaseobjectview.obj \
+ $(SLO)/DExport.obj \
+ $(SLO)/uiservices.obj \
+ $(SLO)/RowSetDrop.obj \
+ $(SLO)/TableCopyHelper.obj \
+ $(SLO)/moduledbu.obj \
+ $(SLO)/WColumnSelect.obj \
+ $(SLO)/WExtendPages.obj \
+ $(SLO)/WNameMatch.obj \
+ $(SLO)/ToolBoxHelper.obj \
+ $(SLO)/stringlistitem.obj \
+ $(SLO)/charsets.obj \
+ $(SLO)/defaultobjectnamecheck.obj \
+ $(SLO)/dsmeta.obj \
+ $(SLO)/controllerframe.obj \
+ $(SLO)/propertystorage.obj \
+ $(SLO)/dbaundomanager.obj \
+
# --- Targets ----------------------------------
.INCLUDE : target.mk
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 87ddfa1f197b..2e8c002a2097 100644..100755
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -1,5 +1,4 @@
/*************************************************************************
- *
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
@@ -25,725 +24,177 @@
*
************************************************************************/
-// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_dbaccess.hxx"
+#include "dbaundomanager.hxx"
+#include "singledoccontroller.hxx"
#include "browserids.hxx"
-#include "commontypes.hxx"
-#include "dataview.hxx"
#include "dbu_misc.hrc"
#include "dbustrings.hrc"
#include "moduledbu.hxx"
-#include "singledoccontroller.hxx"
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
/** === begin UNO includes === **/
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/sdb/XDocumentDataSource.hpp>
-#include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
-#include <com/sun/star/sdbc/XDataSource.hpp>
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/frame/XUntitledNumbers.hpp>
/** === end UNO includes === **/
-#include <comphelper/sequence.hxx>
-#include <comphelper/types.hxx>
-#include <connectivity/dbexception.hxx>
-#include <connectivity/dbtools.hxx>
-#include <cppuhelper/typeprovider.hxx>
-#include <rtl/ustrbuf.hxx>
-#include <toolkit/unohlp.hxx>
-#include <tools/debug.hxx>
-#include <tools/diagnose_ex.h>
-#include <vcl/msgbox.hxx>
+#include <svl/undo.hxx>
+
+#include <boost/scoped_ptr.hpp>
-//........................................................................
+//......................................................................................................................
namespace dbaui
{
-//........................................................................
+//......................................................................................................................
/** === begin UNO using === **/
- using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
- using ::com::sun::star::beans::XPropertySet;
- using ::com::sun::star::util::XNumberFormatter;
- using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::RuntimeException;
+ using ::com::sun::star::uno::Any;
+ using ::com::sun::star::uno::makeAny;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Type;
- using ::com::sun::star::sdbc::XConnection;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::container::XChild;
- using ::com::sun::star::sdbc::XDataSource;
- using ::com::sun::star::util::XNumberFormatter;
- using ::com::sun::star::util::XNumberFormatsSupplier;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::sdbc::SQLException;
- using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::document::XUndoManager;
+ using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::beans::PropertyValue;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::sdb::XOfficeDatabaseDocument;
- using ::com::sun::star::awt::XWindow;
- using ::com::sun::star::sdbc::XDatabaseMetaData;
- using ::com::sun::star::sdb::XDocumentDataSource;
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::lang::IllegalArgumentException;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::frame::XUntitledNumbers;
- using ::com::sun::star::beans::PropertyVetoException;
+ using ::com::sun::star::lang::EventObject;
/** === end UNO using === **/
- class DataSourceHolder
+ //==================================================================================================================
+ //= OSingleDocumentController_Data
+ //==================================================================================================================
+ struct OSingleDocumentController_Data
{
- public:
- DataSourceHolder()
- {
- }
+ ::boost::scoped_ptr< UndoManager > m_pUndoManager;
- DataSourceHolder( const Reference< XDataSource >& _rxDataSource )
+ OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
+ :m_pUndoManager( new UndoManager( i_parent, i_mutex ) )
{
- m_xDataSource = _rxDataSource;
- Reference< XDocumentDataSource > xDocDS( m_xDataSource, UNO_QUERY );
- if ( xDocDS.is() )
- m_xDocument = xDocDS->getDatabaseDocument();
-
- m_xDataSourceProps.set( m_xDataSource, UNO_QUERY );
}
-
- const Reference< XDataSource >& getDataSource() const { return m_xDataSource; }
- const Reference< XPropertySet >& getDataSourceProps() const { return m_xDataSourceProps; }
- const Reference< XOfficeDatabaseDocument > getDatabaseDocument() const { return m_xDocument; }
-
- bool is() const { return m_xDataSource.is(); }
-
- void clear()
- {
- m_xDataSource.clear();
- m_xDocument.clear();
- }
-
- private:
- Reference< XDataSource > m_xDataSource;
- Reference< XPropertySet > m_xDataSourceProps;
- Reference< XOfficeDatabaseDocument > m_xDocument;
};
- struct OSingleDocumentControllerImpl
- {
- private:
- ::boost::optional< bool > m_aDocScriptSupport;
-
- public:
- OModuleClient m_aModuleClient;
- ::dbtools::SQLExceptionInfo m_aCurrentError; // contains the current error which can be set through IEnvironment
-
- ::cppu::OInterfaceContainerHelper
- m_aModifyListeners;
-
- // <properties>
- SharedConnection m_xConnection;
- ::dbtools::DatabaseMetaData m_aSdbMetaData;
- // </properties>
- ::rtl::OUString m_sDataSourceName; // the data source we're working for
- DataSourceHolder m_aDataSource;
- Reference< XModel > m_xDocument;
- Reference< XNumberFormatter > m_xFormatter; // a number formatter working with the connection's NumberFormatsSupplier
- sal_Int32 m_nDocStartNumber;
- sal_Bool m_bSuspended; // is true when the controller was already suspended
- sal_Bool m_bEditable; // is the control readonly or not
- sal_Bool m_bModified; // is the data modified
- bool m_bNotAttached;
-
- OSingleDocumentControllerImpl( ::osl::Mutex& i_rMutex )
- :m_aDocScriptSupport()
- ,m_aModifyListeners( i_rMutex )
- ,m_nDocStartNumber(0)
- ,m_bSuspended( sal_False )
- ,m_bEditable(sal_True)
- ,m_bModified(sal_False)
- ,m_bNotAttached(true)
- {
- }
-
- bool documentHasScriptSupport() const
- {
- OSL_PRECOND( !!m_aDocScriptSupport,
- "OSingleDocumentControllerImpl::documentHasScriptSupport: not completely initialized, yet - don't know!?" );
- return !!m_aDocScriptSupport && *m_aDocScriptSupport;
- }
-
- void setDocumentScriptSupport( const bool _bSupport )
- {
- OSL_PRECOND( !m_aDocScriptSupport,
- "OSingleDocumentControllerImpl::setDocumentScriptSupport: already initialized!" );
- m_aDocScriptSupport = ::boost::optional< bool >( _bSupport );
- }
- };
-
- //====================================================================
+ //==================================================================================================================
//= OSingleDocumentController
- //====================================================================
- //--------------------------------------------------------------------
- OSingleDocumentController::OSingleDocumentController(const Reference< XMultiServiceFactory >& _rxORB)
+ //==================================================================================================================
+ //------------------------------------------------------------------------------------------------------------------
+ OSingleDocumentController::OSingleDocumentController( const Reference< XMultiServiceFactory >& _rxORB )
:OSingleDocumentController_Base( _rxORB )
- ,m_pImpl( new OSingleDocumentControllerImpl( getMutex() ) )
+ ,m_pData( new OSingleDocumentController_Data( *this, getMutex() ) )
{
}
- //--------------------------------------------------------------------
+ //------------------------------------------------------------------------------------------------------------------
OSingleDocumentController::~OSingleDocumentController()
{
}
- //--------------------------------------------------------------------
- void OSingleDocumentController::impl_initialize()
- {
- OGenericUnoController::impl_initialize();
-
- const ::comphelper::NamedValueCollection& rArguments( getInitParams() );
-
- Reference< XConnection > xConnection;
- xConnection = rArguments.getOrDefault( (::rtl::OUString)PROPERTY_ACTIVE_CONNECTION, xConnection );
-
- if ( !xConnection.is() )
- ::dbtools::isEmbeddedInDatabase( getModel(), xConnection );
-
- if ( xConnection.is() )
- initializeConnection( xConnection );
-
- bool bShowError = true;
- if ( !isConnected() )
- {
- reconnect( sal_False );
- bShowError = false;
- }
- if ( !isConnected() )
- {
- if ( bShowError )
- connectionLostMessage();
- throw IllegalArgumentException();
- }
- }
-
- //--------------------------------------------------------------------
- Any SAL_CALL OSingleDocumentController::queryInterface(const Type& _rType) throw (RuntimeException)
- {
- if ( _rType.equals( XScriptInvocationContext::static_type() ) )
- {
- if ( m_pImpl->documentHasScriptSupport() )
- return makeAny( Reference< XScriptInvocationContext >( this ) );
- return Any();
- }
-
- return OSingleDocumentController_Base::queryInterface( _rType );
- }
-
- //--------------------------------------------------------------------
- Sequence< Type > SAL_CALL OSingleDocumentController::getTypes( ) throw (RuntimeException)
- {
- Sequence< Type > aTypes( OSingleDocumentController_Base::getTypes() );
- if ( !m_pImpl->documentHasScriptSupport() )
- {
- Sequence< Type > aStrippedTypes( aTypes.getLength() - 1 );
- ::std::remove_copy_if(
- aTypes.getConstArray(),
- aTypes.getConstArray() + aTypes.getLength(),
- aStrippedTypes.getArray(),
- ::std::bind2nd( ::std::equal_to< Type >(), XScriptInvocationContext::static_type() )
- );
- aTypes = aStrippedTypes;
- }
- return aTypes;
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::initializeConnection( const Reference< XConnection >& _rxForeignConn )
- {
- DBG_ASSERT( !isConnected(), "OSingleDocumentController::initializeConnection: not to be called when already connected!" );
- // usually this gets called from within initialize of derived classes ...
- if ( isConnected() )
- disconnect();
-
- m_pImpl->m_xConnection.reset( _rxForeignConn, SharedConnection::NoTakeOwnership );
- m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
- startConnectionListening( m_pImpl->m_xConnection );
-
- // get the data source the connection belongs to
- try
- {
- // determine our data source
- OSL_PRECOND( !m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: already a data source in this phase?" );
- {
- Reference< XChild > xConnAsChild( m_pImpl->m_xConnection, UNO_QUERY );
- Reference< XDataSource > xDS;
- if ( xConnAsChild.is() )
- xDS = Reference< XDataSource >( xConnAsChild->getParent(), UNO_QUERY );
-
- // (take the indirection through XDataSource to ensure we have a correct object ....)
- m_pImpl->m_aDataSource = xDS;
- }
- OSL_POSTCOND( m_pImpl->m_aDataSource.is(), "OSingleDocumentController::initializeConnection: unable to obtain the data source object!" );
-
- if ( m_pImpl->m_bNotAttached )
- {
- Reference< XUntitledNumbers > xUntitledProvider( getDatabaseDocument(), UNO_QUERY );
- m_pImpl->m_nDocStartNumber = 1;
- if ( xUntitledProvider.is() )
- m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
- }
-
- // determine the availability of script support in our document. Our own XScriptInvocationContext
- // interface depends on this
- m_pImpl->setDocumentScriptSupport( Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY ).is() );
-
- // get a number formatter
- Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps(), UNO_SET_THROW );
- xDataSourceProps->getPropertyValue( PROPERTY_NAME ) >>= m_pImpl->m_sDataSourceName;
- DBG_ASSERT( m_pImpl->m_sDataSourceName.getLength(), "OSingleDocumentController::initializeConnection: invalid data source name!" );
- Reference< XNumberFormatsSupplier> xSupplier = ::dbtools::getNumberFormats(m_pImpl->m_xConnection);
- if(xSupplier.is())
- {
- m_pImpl->m_xFormatter = Reference< XNumberFormatter >(getORB()
- ->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.NumberFormatter")), UNO_QUERY);
- m_pImpl->m_xFormatter->attachNumberFormatsSupplier(xSupplier);
- }
- OSL_ENSURE(m_pImpl->m_xFormatter.is(),"No NumberFormatter!");
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::reconnect( sal_Bool _bUI )
- {
- OSL_ENSURE(!m_pImpl->m_bSuspended, "Cannot reconnect while suspended!");
-
- stopConnectionListening( m_pImpl->m_xConnection );
- m_pImpl->m_aSdbMetaData.reset( NULL );
- m_pImpl->m_xConnection.clear();
-
- // reconnect
- sal_Bool bReConnect = sal_True;
- if ( _bUI )
- {
- QueryBox aQuery( getView(), ModuleRes(QUERY_CONNECTION_LOST) );
- bReConnect = ( RET_YES == aQuery.Execute() );
- }
-
- // now really reconnect ...
- if ( bReConnect )
- {
- m_pImpl->m_xConnection.reset( connect( m_pImpl->m_aDataSource.getDataSource(), NULL ), SharedConnection::TakeOwnership );
- m_pImpl->m_aSdbMetaData.reset( m_pImpl->m_xConnection );
- }
-
- // invalidate all slots
- InvalidateAll();
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::disconnect()
- {
- stopConnectionListening(m_pImpl->m_xConnection);
- m_pImpl->m_aSdbMetaData.reset( NULL );
- m_pImpl->m_xConnection.clear();
-
- InvalidateAll();
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::losingConnection()
- {
- // our connection was disposed so we need a new one
- reconnect( sal_True );
- }
-
- //--------------------------------------------------------------------
+ // -----------------------------------------------------------------------------
void SAL_CALL OSingleDocumentController::disposing()
{
OSingleDocumentController_Base::disposing();
- m_aUndoManager.Clear();
-
- disconnect();
-
- attachFrame( Reference < XFrame >() );
-
- m_pImpl->m_aDataSource.clear();
- }
-
- //--------------------------------------------------------------------
- sal_Bool OSingleDocumentController::Construct(Window* _pParent)
- {
- DBG_ASSERT( getView(), "OSingleDocumentController::Construct: have no view!" );
- if ( getView() )
- getView()->enableSeparator( );
-
- return OSingleDocumentController_Base::Construct( _pParent );
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::disposing(const EventObject& _rSource) throw( RuntimeException )
- {
- if ( _rSource.Source == getConnection() )
- {
- if ( !m_pImpl->m_bSuspended // when already suspended then we don't have to reconnect
- && !getBroadcastHelper().bInDispose
- && !getBroadcastHelper().bDisposed
- && isConnected()
- )
- {
- losingConnection();
- }
- else
- {
- m_pImpl->m_xConnection.reset( m_pImpl->m_xConnection, SharedConnection::NoTakeOwnership );
- // this prevents the "disposeComponent" call in disconnect
- disconnect();
- }
- }
- else
- OSingleDocumentController_Base::disposing( _rSource );
- }
-
- //--------------------------------------------------------------------
- void OSingleDocumentController::appendError( const ::rtl::OUString& _rErrorMessage, const ::dbtools::StandardSQLState _eSQLState,
- const sal_Int32 _nErrorCode )
- {
- m_pImpl->m_aCurrentError.append( ::dbtools::SQLExceptionInfo::SQL_EXCEPTION, _rErrorMessage, getStandardSQLStateAscii( _eSQLState ),
- _nErrorCode );
- }
- //--------------------------------------------------------------------
- void OSingleDocumentController::clearError()
- {
- m_pImpl->m_aCurrentError = ::dbtools::SQLExceptionInfo();
+ ClearUndoManager();
+ m_pData->m_pUndoManager->disposing();
}
- //--------------------------------------------------------------------
- sal_Bool OSingleDocumentController::hasError() const
+ // -----------------------------------------------------------------------------
+ void SAL_CALL OSingleDocumentController::disposing( const EventObject& i_event ) throw( RuntimeException )
{
- return m_pImpl->m_aCurrentError.isValid();
+ // simply disambiguate
+ OSingleDocumentController_Base::disposing( i_event );
}
- //--------------------------------------------------------------------
- const ::dbtools::SQLExceptionInfo& OSingleDocumentController::getError() const
+ // -----------------------------------------------------------------------------
+ void OSingleDocumentController::ClearUndoManager()
{
- return m_pImpl->m_aCurrentError;
+ GetUndoManager().Clear();
}
- //--------------------------------------------------------------------
- void OSingleDocumentController::displayError()
+ // -----------------------------------------------------------------------------
+ SfxUndoManager& OSingleDocumentController::GetUndoManager() const
{
- showError( m_pImpl->m_aCurrentError );
+ return m_pData->m_pUndoManager->GetSfxUndoManager();
}
- //--------------------------------------------------------------------
- sal_Bool SAL_CALL OSingleDocumentController::suspend(sal_Bool bSuspend) throw( RuntimeException )
+ // -----------------------------------------------------------------------------
+ void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction)
{
- m_pImpl->m_bSuspended = bSuspend;
- if ( !bSuspend && !isConnected() )
- reconnect(sal_True);
+ // add undo action
+ GetUndoManager().AddUndoAction( _pAction );
+ // when we add an undo action the controller was modified
+ setModified( sal_True );
- return sal_True;
+ // now inform me that or states changed
+ InvalidateFeature( ID_BROWSER_UNDO );
+ InvalidateFeature( ID_BROWSER_REDO );
}
// -----------------------------------------------------------------------------
- sal_Bool SAL_CALL OSingleDocumentController::attachModel( const Reference< XModel > & _rxModel) throw( RuntimeException )
+ Reference< XUndoManager > SAL_CALL OSingleDocumentController::getUndoManager( ) throw (RuntimeException)
{
- if ( !_rxModel.is() )
- return sal_False;
- if ( !OSingleDocumentController_Base::attachModel( _rxModel ) )
- return sal_False;
-
- m_pImpl->m_bNotAttached = false;
- if ( m_pImpl->m_nDocStartNumber == 1 )
- releaseNumberForComponent();
-
- Reference< XUntitledNumbers > xUntitledProvider( _rxModel, UNO_QUERY );
- m_pImpl->m_nDocStartNumber = 1;
- if ( xUntitledProvider.is() )
- m_pImpl->m_nDocStartNumber = xUntitledProvider->leaseNumber( static_cast< XWeak* >( this ) );
-
- return sal_True;
+ return m_pData->m_pUndoManager.get();
}
// -----------------------------------------------------------------------------
FeatureState OSingleDocumentController::GetState(sal_uInt16 _nId) const
{
FeatureState aReturn;
- // (disabled automatically)
- aReturn.bEnabled = sal_True;
-
- switch (_nId)
+ switch ( _nId )
{
case ID_BROWSER_UNDO:
- aReturn.bEnabled = m_pImpl->m_bEditable && m_aUndoManager.GetUndoActionCount() != 0;
+ aReturn.bEnabled = isEditable() && GetUndoManager().GetUndoActionCount() != 0;
if ( aReturn.bEnabled )
{
String sUndo(ModuleRes(STR_UNDO_COLON));
sUndo += String(RTL_CONSTASCII_USTRINGPARAM(" "));
- sUndo += m_aUndoManager.GetUndoActionComment();
+ sUndo += GetUndoManager().GetUndoActionComment();
aReturn.sTitle = sUndo;
}
break;
+
case ID_BROWSER_REDO:
- aReturn.bEnabled = m_pImpl->m_bEditable && m_aUndoManager.GetRedoActionCount() != 0;
+ aReturn.bEnabled = isEditable() && GetUndoManager().GetRedoActionCount() != 0;
if ( aReturn.bEnabled )
{
String sRedo(ModuleRes(STR_REDO_COLON));
sRedo += String(RTL_CONSTASCII_USTRINGPARAM(" "));
- sRedo += m_aUndoManager.GetRedoActionComment();
+ sRedo += GetUndoManager().GetRedoActionComment();
aReturn.sTitle = sRedo;
}
break;
+
default:
aReturn = OSingleDocumentController_Base::GetState(_nId);
}
return aReturn;
}
// -----------------------------------------------------------------------------
- void OSingleDocumentController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs)
+ void OSingleDocumentController::Execute( sal_uInt16 _nId, const Sequence< PropertyValue >& _rArgs )
{
- switch(_nId)
+ switch ( _nId )
{
- case ID_BROWSER_CLOSE:
- closeTask();
- return;
case ID_BROWSER_UNDO:
- m_aUndoManager.Undo();
- InvalidateFeature(ID_BROWSER_REDO);
+ GetUndoManager().Undo();
+ InvalidateFeature( ID_BROWSER_UNDO );
+ InvalidateFeature( ID_BROWSER_REDO );
break;
+
case ID_BROWSER_REDO:
- m_aUndoManager.Redo();
- InvalidateFeature(ID_BROWSER_UNDO);
+ GetUndoManager().Redo();
+ InvalidateFeature( ID_BROWSER_UNDO );
+ InvalidateFeature( ID_BROWSER_REDO );
break;
+
default:
OSingleDocumentController_Base::Execute( _nId, _rArgs );
break;
}
InvalidateFeature(_nId);
}
- // -----------------------------------------------------------------------------
- SfxUndoManager* OSingleDocumentController::getUndoMgr()
- {
- return &m_aUndoManager;
- }
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::addUndoActionAndInvalidate(SfxUndoAction *_pAction)
- {
- // add undo action
- m_aUndoManager.AddUndoAction(_pAction);
- // when we add an undo action the controller was modified
- setModified(sal_True);
- // now inform me that or states changed
- InvalidateFeature(ID_BROWSER_UNDO);
- InvalidateFeature(ID_BROWSER_REDO);
- }
-
- // -----------------------------------------------------------------------------
- ::rtl::OUString OSingleDocumentController::getDataSourceName() const
- {
- ::rtl::OUString sName;
- Reference< XPropertySet > xDataSourceProps( m_pImpl->m_aDataSource.getDataSourceProps() );
- if ( xDataSourceProps.is() )
- xDataSourceProps->getPropertyValue(PROPERTY_NAME) >>= sName;
- return sName;
- }
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::connectionLostMessage() const
- {
- String aMessage(ModuleRes(RID_STR_CONNECTION_LOST));
- Reference< XWindow > xWindow = getTopMostContainerWindow();
- Window* pWin = NULL;
- if ( xWindow.is() )
- pWin = VCLUnoHelper::GetWindow(xWindow);
- if ( !pWin )
- pWin = getView()->Window::GetParent();
-
- InfoBox(pWin, aMessage).Execute();
- }
- // -----------------------------------------------------------------------------
- const Reference< XConnection >& OSingleDocumentController::getConnection() const
- {
- return m_pImpl->m_xConnection;
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isReadOnly() const
- {
- return !m_pImpl->m_bEditable;
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isEditable() const
- {
- return m_pImpl->m_bEditable;
- }
-
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::setEditable(sal_Bool _bEditable)
- {
- m_pImpl->m_bEditable = _bEditable;
- }
-
- // -----------------------------------------------------------------------------
- const ::dbtools::DatabaseMetaData& OSingleDocumentController::getSdbMetaData() const
- {
- return m_pImpl->m_aSdbMetaData;
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::isConnected() const
- {
- return m_pImpl->m_xConnection.is();
- }
-
- // -----------------------------------------------------------------------------
- Reference< XDatabaseMetaData > OSingleDocumentController::getMetaData( ) const
- {
- Reference< XDatabaseMetaData > xMeta;
- try
- {
- if ( isConnected() )
- xMeta.set( m_pImpl->m_xConnection->getMetaData(), UNO_SET_THROW );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xMeta;
- }
-
- // -----------------------------------------------------------------------------
- const Reference< XPropertySet >& OSingleDocumentController::getDataSource() const
- {
- return m_pImpl->m_aDataSource.getDataSourceProps();
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::haveDataSource() const
- {
- return m_pImpl->m_aDataSource.is();
- }
-
- // -----------------------------------------------------------------------------
- Reference< XModel > OSingleDocumentController::getDatabaseDocument() const
- {
- return Reference< XModel >( m_pImpl->m_aDataSource.getDatabaseDocument(), UNO_QUERY );
- }
-
- // -----------------------------------------------------------------------------
- Reference< XNumberFormatter > OSingleDocumentController::getNumberFormatter() const
- {
- return m_pImpl->m_xFormatter;
- }
-
- // -----------------------------------------------------------------------------
- Reference< XModel > OSingleDocumentController::getPrivateModel() const
- {
- return getDatabaseDocument();
- }
- // -----------------------------------------------------------------------------
- // XTitle
- ::rtl::OUString SAL_CALL OSingleDocumentController::getTitle()
- throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- if ( m_bExternalTitle )
- return impl_getTitleHelper_throw()->getTitle ();
-
- ::rtl::OUStringBuffer sTitle;
- Reference< XTitle > xTitle(getPrivateModel(),UNO_QUERY);
- if ( xTitle.is() )
- {
- sTitle.append( xTitle->getTitle() );
- sTitle.appendAscii(" : ");
- }
- sTitle.append( getPrivateTitle() );
- // There can be only one view with the same object
- //const sal_Int32 nCurrentView = getCurrentStartNumber();
- //if ( nCurrentView > 1 )
- //{
- // sTitle.appendAscii(" : ");
- // sTitle.append(nCurrentView);
- //}
-
- return sTitle.makeStringAndClear();
- }
- // -----------------------------------------------------------------------------
- sal_Int32 OSingleDocumentController::getCurrentStartNumber() const
- {
- return m_pImpl->m_nDocStartNumber;
- }
-
- // -----------------------------------------------------------------------------
- Reference< XEmbeddedScripts > SAL_CALL OSingleDocumentController::getScriptContainer() throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- if ( !m_pImpl->documentHasScriptSupport() )
- return NULL;
-
- return Reference< XEmbeddedScripts >( getDatabaseDocument(), UNO_QUERY_THROW );
- }
-
- // -----------------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::addModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- m_pImpl->m_aModifyListeners.addInterface( i_Listener );
- }
-
- // -----------------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::removeModifyListener( const Reference< XModifyListener >& i_Listener ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- m_pImpl->m_aModifyListeners.removeInterface( i_Listener );
- }
-
- // -----------------------------------------------------------------------------
- ::sal_Bool SAL_CALL OSingleDocumentController::isModified( ) throw (RuntimeException)
- {
- ::osl::MutexGuard aGuard( getMutex() );
- return impl_isModified();
- }
-
- // -----------------------------------------------------------------------------
- void SAL_CALL OSingleDocumentController::setModified( ::sal_Bool i_bModified ) throw (PropertyVetoException, RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( getMutex() );
-
- if ( m_pImpl->m_bModified == i_bModified )
- return;
-
- m_pImpl->m_bModified = i_bModified;
- impl_onModifyChanged();
-
- EventObject aEvent( *this );
- aGuard.clear();
- m_pImpl->m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvent );
- }
-
- // -----------------------------------------------------------------------------
- sal_Bool OSingleDocumentController::impl_isModified() const
- {
- return m_pImpl->m_bModified;
- }
-
- // -----------------------------------------------------------------------------
- void OSingleDocumentController::impl_onModifyChanged()
- {
- InvalidateFeature( ID_BROWSER_SAVEDOC );
- if ( isFeatureSupported( ID_BROWSER_SAVEASDOC ) )
- InvalidateFeature( ID_BROWSER_SAVEASDOC );
- }
-
-//........................................................................
-} // namespace dbaui
-//........................................................................
+//......................................................................................................................
+} // namespace dbaui
+//......................................................................................................................
diff --git a/dbaccess/source/ui/querydesign/QueryDesignView.cxx b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
index 67385fd02d67..576fa52c1a21 100644
--- a/dbaccess/source/ui/querydesign/QueryDesignView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryDesignView.cxx
@@ -2177,7 +2177,7 @@ namespace
while ( false );
// Durch das Neuerzeugen wurden wieder Undo-Actions in den Manager gestellt
- rController.getUndoMgr()->Clear();
+ rController.ClearUndoManager();
_pSelectionBrw->Invalidate();
return eErrorCode;
}
@@ -3234,7 +3234,7 @@ void OQueryDesignView::initByFieldDescriptions( const Sequence< PropertyValue >&
InsertField( pField, sal_True, sal_False );
}
- rController.getUndoMgr()->Clear();
+ rController.ClearUndoManager();
m_pSelectionBox->Invalidate();
}
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index c083392a9613..16052816f07a 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -847,8 +847,8 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
// mein Parent brauche ich, da es vom Loeschen erfahren soll
OQueryDesignView* pParent = static_cast<OQueryDesignView*>(getDesignView());
- SfxUndoManager* pUndoMgr = m_pView->getController().getUndoMgr();
- pUndoMgr->EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
+ SfxUndoManager& rUndoMgr = m_pView->getController().GetUndoManager();
+ rUndoMgr.EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
// Undo-Action anlegen
OQueryTabWinDelUndoAct* pUndoAction = new OQueryTabWinDelUndoAct(this);
@@ -861,7 +861,7 @@ void OQueryTableView::RemoveTabWin(OTableWindow* pTabWin)
pParent->TableDeleted( static_cast< OQueryTableWindowData*>(pTabWin->GetData().get())->GetAliasName() );
m_pView->getController().addUndoActionAndInvalidate( pUndoAction );
- pUndoMgr->LeaveListAction();
+ rUndoMgr.LeaveListAction();
if (m_lnkTabWinsChangeHandler.IsSet())
{
diff --git a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
index ec3b22899225..5943485a7bb5 100644
--- a/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
+++ b/dbaccess/source/ui/querydesign/QueryViewSwitch.cxx
@@ -299,7 +299,7 @@ bool OQueryViewSwitch::impl_postViewSwitch( const bool i_bGraphicalDesign, const
if ( pContainer )
pContainer->Resize();
- m_pDesignView->getController().getUndoMgr()->Clear();
+ m_pDesignView->getController().ClearUndoManager();
m_pDesignView->getController().InvalidateAll();
return i_bSuccess;
diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
index 66b6eec9465c..223c00cfbd2a 100644
--- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
+++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx
@@ -1021,7 +1021,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
strOldCellContents = pEntry->GetField();
bListAction = sal_True;
if ( !m_bInUndoMode )
- rController.getUndoMgr()->EnterListAction(String(),String());
+ rController.GetUndoManager().EnterListAction(String(),String());
USHORT nPos = m_pFieldCell->GetEntryPos(aFieldName);
String aAliasName = pEntry->GetAlias();
@@ -1050,7 +1050,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
{
sNewValue = aFieldName;
if ( !m_bInUndoMode )
- static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->LeaveListAction();
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().LeaveListAction();
bListAction = sal_False;
}
else
@@ -1282,7 +1282,7 @@ sal_Bool OSelectionBrowseBox::SaveModified()
}
if ( bListAction && !m_bInUndoMode )
- static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->LeaveListAction();
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().LeaveListAction();
return pEntry != NULL && !bError;
}
@@ -2644,7 +2644,7 @@ void OSelectionBrowseBox::appendUndoAction(const String& _rOldValue,const String
if ( !_bListAction )
{
_bListAction = sal_True;
- static_cast<OQueryController&>(getDesignView()->getController()).getUndoMgr()->EnterListAction(String(),String());
+ static_cast<OQueryController&>(getDesignView()->getController()).GetUndoManager().EnterListAction(String(),String());
}
appendUndoAction(_rOldValue,_rNewValue,_nRow);
}
diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx
index 06b6804fa9be..2659580a91b4 100644
--- a/dbaccess/source/ui/querydesign/querycontroller.cxx
+++ b/dbaccess/source/ui/querydesign/querycontroller.cxx
@@ -685,9 +685,9 @@ void OQueryController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue >&
break;
case SID_BROWSER_CLEAR_QUERY:
{
- getUndoMgr()->EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
+ GetUndoManager().EnterListAction( String( ModuleRes(STR_QUERY_UNDO_TABWINDELETE) ), String() );
getContainer()->clear();
- getUndoMgr()->LeaveListAction();
+ GetUndoManager().LeaveListAction();
setStatement_fireEvent( ::rtl::OUString() );
if(m_bGraphicalDesign)
@@ -1037,7 +1037,7 @@ void OQueryController::impl_initialize()
}
}
- getUndoMgr()->Clear();
+ ClearUndoManager();
if ( ( m_bGraphicalDesign )
&& ( ( !m_sName.getLength() && !editingCommand() )
@@ -1789,7 +1789,7 @@ void OQueryController::reset()
{
impl_reset();
getContainer()->reset( NULL );
- getUndoMgr()->Clear();
+ ClearUndoManager();
}
// -----------------------------------------------------------------------------
diff --git a/dbaccess/source/ui/relationdesign/RelationController.cxx b/dbaccess/source/ui/relationdesign/RelationController.cxx
index 99fe03a7004d..66dbc066324c 100644
--- a/dbaccess/source/ui/relationdesign/RelationController.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationController.cxx
@@ -494,7 +494,7 @@ IMPL_LINK( ORelationController, OnThreadFinished, void*, /*NOTINTERESTEDIN*/ )
{
getView()->initialize(); // show the windows and fill with our informations
getView()->Invalidate(INVALIDATE_NOERASE);
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
if(m_vTableData.empty())
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 0c9d0cc1a456..dfbc022d4f7d 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -375,7 +375,7 @@ void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin )
OSQLWarningBox aDlg( this, ModuleRes( STR_QUERY_REL_DELETE_WINDOW ), WB_YES_NO | WB_DEF_YES );
if ( m_bInRemove || aDlg.Execute() == RET_YES )
{
- m_pView->getController().getUndoMgr()->Clear();
+ m_pView->getController().ClearUndoManager();
OJoinTableView::RemoveTabWin( pTabWin );
m_pView->getController().InvalidateFeature(SID_RELATION_ADD_RELATION);
@@ -383,30 +383,7 @@ void ORelationTableView::RemoveTabWin( OTableWindow* pTabWin )
m_pView->getController().InvalidateFeature(ID_BROWSER_REDO);
}
}
-// -----------------------------------------------------------------------------
-//namespace
-//{
-// class OReleationAskDialog : public ButtonDialog
-// {
-// FixedImage m_aInfoImage;
-// FixedText m_aTitle;
-// FixedText m_aMessage;
-// public:
-// OReleationDialog(Window* _pParent) : ButtonDialog(_pParent,WB_HORZ | WB_STDDIALOG)
-// ,m_aInfoImage(this)
-// ,m_aTitle(this,WB_WORDBREAK | WB_LEFT)
-// ,m_aMessage(this,WB_WORDBREAK | WB_LEFT)
-// {
-// m_aMessage.SetText(ModuleRes(STR_QUERY_REL_EDIT_RELATION));
-// m_aMessage.Show();
-//
-// // Changed as per BugID 79541 Branding/Configuration
-// String sDialogTitle( lcl_getProductName() );
-// SetText( sDialogTitle.AppendAscii( " Base" ) );
-// m_aTitle.Show();
-// }
-// };
-//}
+
// -----------------------------------------------------------------------------
void ORelationTableView::lookForUiActivities()
{
@@ -469,7 +446,7 @@ void ORelationTableView::_elementRemoved( const container::ContainerEvent& _rEve
OTableWindow* pTableWindow = GetTabWindow(sName);
if ( pTableWindow )
{
- m_pView->getController().getUndoMgr()->Clear();
+ m_pView->getController().ClearUndoManager();
OJoinTableView::RemoveTabWin( pTableWindow );
m_pView->getController().InvalidateFeature(SID_RELATION_ADD_RELATION);
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.cxx b/dbaccess/source/ui/tabledesign/TEditControl.cxx
index 4d3cdb6652a9..693c7dbf585a 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.cxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.cxx
@@ -263,9 +263,9 @@ OTableEditorCtrl::OTableEditorCtrl(Window* pWindow)
}
//------------------------------------------------------------------------------
-SfxUndoManager* OTableEditorCtrl::GetUndoManager() const
+SfxUndoManager& OTableEditorCtrl::GetUndoManager() const
{
- return GetView()->getController().getUndoMgr();
+ return GetView()->getController().GetUndoManager();
}
//------------------------------------------------------------------------------
@@ -388,7 +388,7 @@ OTableEditorCtrl::~OTableEditorCtrl()
DBG_DTOR(OTableEditorCtrl,NULL);
//////////////////////////////////////////////////////////////////////
// Undo-Manager zuruecksetzen
- GetUndoManager()->Clear();
+ GetUndoManager().Clear();
//////////////////////////////////////////////////////////////////////
// Moegliche Events aus Queue entfernen
@@ -683,7 +683,7 @@ sal_Bool OTableEditorCtrl::SaveData(long nRow, sal_uInt16 nColId)
// Wenn FieldDescr existiert, wurde Feld geloescht und alter Inhalt wird wiederhergestellt
if (pActFieldDescr)
{
- GetUndoManager()->AddUndoAction(new OTableEditorTypeSelUndoAct(this, nRow, FIELD_TYPE, pActFieldDescr->getTypeInfo()));
+ GetUndoManager().AddUndoAction(new OTableEditorTypeSelUndoAct(this, nRow, FIELD_TYPE, pActFieldDescr->getTypeInfo()));
SwitchType(TOTypeInfoSP());
pActFieldDescr = pActRow->GetActFieldDescr();
}
@@ -858,7 +858,7 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
default: sActionDescription = String( ModuleRes( STR_CHANGE_COLUMN_ATTRIBUTE ) ); break;
}
- GetUndoManager()->EnterListAction( sActionDescription, String() );
+ GetUndoManager().EnterListAction( sActionDescription, String() );
if (!pActFieldDescr)
{
const OTypeInfoMap* pTypeInfoMap = GetView()->getController().getTypeInfo();
@@ -875,20 +875,20 @@ void OTableEditorCtrl::CellModified( long nRow, sal_uInt16 nColId )
nInvalidateTypeEvent = Application::PostUserEvent( LINK(this, OTableEditorCtrl, InvalidateFieldType) );
pActFieldDescr = pActRow->GetActFieldDescr();
pDescrWin->DisplayData( pActFieldDescr );
- GetUndoManager()->AddUndoAction( new OTableEditorTypeSelUndoAct(this, nRow, nColId+1, TOTypeInfoSP()) );
+ GetUndoManager().AddUndoAction( new OTableEditorTypeSelUndoAct(this, nRow, nColId+1, TOTypeInfoSP()) );
}
if( nColId != FIELD_TYPE )
- GetUndoManager()->AddUndoAction( new OTableDesignCellUndoAct(this, nRow, nColId) );
+ GetUndoManager().AddUndoAction( new OTableDesignCellUndoAct(this, nRow, nColId) );
else
{
- GetUndoManager()->AddUndoAction(new OTableEditorTypeSelUndoAct(this, GetCurRow(), nColId, GetFieldDescr(GetCurRow())->getTypeInfo()));
+ GetUndoManager().AddUndoAction(new OTableEditorTypeSelUndoAct(this, GetCurRow(), nColId, GetFieldDescr(GetCurRow())->getTypeInfo()));
resetType();
}
SaveData(nRow,nColId);
// SaveData could create a undo action as well
- GetUndoManager()->LeaveListAction();
+ GetUndoManager().LeaveListAction();
RowModified(nRow);
CellControllerRef xController(Controller());
if(xController.Is())
@@ -1051,7 +1051,7 @@ void OTableEditorCtrl::InsertRows( long nRow )
//////////////////////////////////////////////////////////////////////
// Undo-Action erzeugen
- GetUndoManager()->AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) );
+ GetUndoManager().AddUndoAction( new OTableEditorInsUndoAct(this, nRow,vInsertedUndoRedoRows) );
GetView()->getController().setModified( sal_True );
InvalidateFeatures();
}
@@ -1063,7 +1063,7 @@ void OTableEditorCtrl::DeleteRows()
OSL_ENSURE(GetView()->getController().isDropAllowed(),"Call of DeleteRows not valid here. Please check isDropAllowed!");
//////////////////////////////////////////////////////////////////////
// Undo-Action erzeugen
- GetUndoManager()->AddUndoAction( new OTableEditorDelUndoAct(this) );
+ GetUndoManager().AddUndoAction( new OTableEditorDelUndoAct(this) );
//////////////////////////////////////////////////////////////////////
@@ -1111,7 +1111,7 @@ void OTableEditorCtrl::InsertNewRows( long nRow )
long nInsertRows = GetSelectRowCount();
if( !nInsertRows )
nInsertRows = 1;
- GetUndoManager()->AddUndoAction( new OTableEditorInsNewUndoAct(this, nRow, nInsertRows) );
+ GetUndoManager().AddUndoAction( new OTableEditorInsNewUndoAct(this, nRow, nInsertRows) );
//////////////////////////////////////////////////////////////////////
// Zahl der selektierten Zeilen werden neu eingefuegt
for( long i=nRow; i<(nRow+nInsertRows); i++ )
@@ -1889,7 +1889,7 @@ void OTableEditorCtrl::SetPrimaryKey( sal_Bool bSet )
}
}
- GetUndoManager()->AddUndoAction( new OPrimKeyUndoAct(this, aDeletedPrimKeys, aInsertedPrimKeys) );
+ GetUndoManager().AddUndoAction( new OPrimKeyUndoAct(this, aDeletedPrimKeys, aInsertedPrimKeys) );
//////////////////////////////////////////////////////////////////////
// Handle-Spalte invalidieren
diff --git a/dbaccess/source/ui/tabledesign/TEditControl.hxx b/dbaccess/source/ui/tabledesign/TEditControl.hxx
index 2a7a36f3a051..edf941cf1f39 100644
--- a/dbaccess/source/ui/tabledesign/TEditControl.hxx
+++ b/dbaccess/source/ui/tabledesign/TEditControl.hxx
@@ -148,7 +148,7 @@ namespace dbaui
virtual ~OTableEditorCtrl();
virtual BOOL CursorMoving(long nNewRow, USHORT nNewCol);
virtual void UpdateAll();
- SfxUndoManager* GetUndoManager() const;
+ SfxUndoManager& GetUndoManager() const;
void SetDescrWin( OTableFieldDescWin* pWin ){ pDescrWin = pWin; if (pDescrWin && pActRow) pDescrWin->DisplayData(pActRow->GetActFieldDescr()); }
BOOL SaveCurRow();
diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx
index a848eb8de18c..fa8d1809b595 100644
--- a/dbaccess/source/ui/tabledesign/TableController.cxx
+++ b/dbaccess/source/ui/tabledesign/TableController.cxx
@@ -568,7 +568,7 @@ void OTableController::impl_initialize()
{
loadData(); // fill the column information form the table
getView()->initialize(); // show the windows and fill with our informations
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
}
catch( const Exception& )
@@ -666,11 +666,6 @@ void OTableController::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:EditDoc", ID_BROWSER_EDITDOC, CommandGroup::EDIT );
}
// -----------------------------------------------------------------------------
-SfxUndoManager* OTableController::getUndoMgr()
-{
- return &m_aUndoManager;
-}
-// -----------------------------------------------------------------------------
void OTableController::impl_onModifyChanged()
{
OSingleDocumentController::impl_onModifyChanged();
@@ -1521,7 +1516,7 @@ void OTableController::reSyncRows()
}
static_cast<OTableDesignView*>(getView())->reSync(); // show the windows and fill with our informations
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
}
// -----------------------------------------------------------------------------
@@ -1577,7 +1572,7 @@ void OTableController::reload()
{
loadData(); // fill the column information form the table
static_cast<OTableDesignView*>(getView())->reSync(); // show the windows and fill with our informations
- getUndoMgr()->Clear(); // clear all undo redo things
+ ClearUndoManager();
setModified(sal_False); // and we are not modified yet
static_cast<OTableDesignView*>(getView())->Invalidate();
}
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 d3617749d10b..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.getUndoMgr(),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 d4ea5fa17a48..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->getUndoMgr(),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->getUndoMgr()->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->getUndoMgr()->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->getUndoMgr()->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->getUndoMgr()->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->getUndoMgr(),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/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx
index af61f3b6d514..506fa4abd90b 100644
--- a/reportdesign/source/ui/dlg/Navigator.cxx
+++ b/reportdesign/source/ui/dlg/Navigator.cxx
@@ -31,7 +31,7 @@
#include "uistrings.hrc"
#include "ReportController.hxx"
#include "UITools.hxx"
-#include "Undo.hxx"
+#include "RptUndo.hxx"
#include "reportformula.hxx"
#include <com/sun/star/container/XContainerListener.hpp>
#include <com/sun/star/report/XReportDefinition.hpp>
diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx
index 6694c81c999b..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.
@@ -333,16 +340,15 @@ namespace rptui
// 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);
+ 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*);
@@ -352,12 +358,6 @@ namespace rptui
// 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
@@ -455,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; }
@@ -477,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/inc/Undo.hxx b/reportdesign/source/ui/inc/RptUndo.hxx
index 479872b06573..479872b06573 100644
--- a/reportdesign/source/ui/inc/Undo.hxx
+++ b/reportdesign/source/ui/inc/RptUndo.hxx
diff --git a/reportdesign/source/ui/inspection/DataProviderHandler.cxx b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
index 8ac5053ff39f..dcc327060806 100644
--- a/reportdesign/source/ui/inspection/DataProviderHandler.cxx
+++ b/reportdesign/source/ui/inspection/DataProviderHandler.cxx
@@ -51,7 +51,7 @@
#include <com/sun/star/inspection/XNumericControl.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
-#include <vcl/fldunit.hxx>
+#include <tools/fldunit.hxx>
#include "metadata.hxx"
#include <vcl/svapp.hxx>
#include <vos/mutex.hxx>
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 084bd77f8d5b..c02683a97452 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -66,7 +66,7 @@
#include <vcl/msgbox.hxx>
#include <vcl/waitobj.hxx>
-#include <vcl/fldunit.hxx>
+#include <tools/fldunit.hxx>
#include <vcl/stdtext.hxx>
#include "ModuleHelper.hxx"
diff --git a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
index 859c0da38709..d992206b6f54 100644
--- a/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
+++ b/reportdesign/source/ui/inspection/ReportComponentHandler.cxx
@@ -40,7 +40,7 @@
#include <com/sun/star/inspection/XNumericControl.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
-#include <vcl/fldunit.hxx>
+#include <tools/fldunit.hxx>
#include "metadata.hxx"
//........................................................................
diff --git a/reportdesign/source/ui/misc/Undo.cxx b/reportdesign/source/ui/misc/RptUndo.cxx
index d944dc2aee20..312946139a0a 100644
--- a/reportdesign/source/ui/misc/Undo.cxx
+++ b/reportdesign/source/ui/misc/RptUndo.cxx
@@ -26,21 +26,16 @@
************************************************************************/
#include "precompiled_reportdesign.hxx"
-#include "Undo.hxx"
-#ifndef REPORTDESIGN_SHARED_UISTRINGS_HRC
+#include "RptUndo.hxx"
#include "uistrings.hrc"
-#endif
-#ifndef _RPTUI_SLOTID_HRC_
#include "rptui_slotid.hrc"
-#endif
-#ifndef RPTUI_TOOLS_HXX
#include "UITools.hxx"
-#endif
+#include "UndoEnv.hxx"
+
#include <dbaccess/IController.hxx>
#include <com/sun/star/report/XSection.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
-#include "UndoEnv.hxx"
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
#include <svx/unoshape.hxx>
diff --git a/reportdesign/source/ui/misc/makefile.mk b/reportdesign/source/ui/misc/makefile.mk
index b12bafdc7760..494b68023d62 100644
--- a/reportdesign/source/ui/misc/makefile.mk
+++ b/reportdesign/source/ui/misc/makefile.mk
@@ -44,7 +44,7 @@ VISIBILITY_HIDDEN=TRUE
# ... object files ............................
EXCEPTIONSFILES= \
- $(SLO)$/Undo.obj \
+ $(SLO)$/RptUndo.obj \
$(SLO)$/ColorListener.obj \
$(SLO)$/UITools.obj \
$(SLO)$/rptuiservices.obj \
diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx
index cf303fb8e706..fc0a01dd715c 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>
@@ -126,7 +127,7 @@
#include "DesignView.hxx"
#include "ModuleHelper.hxx"
#include "RptObject.hxx"
-#include "Undo.hxx"
+#include "RptUndo.hxx"
#include "uistrings.hrc"
#include "RptDef.hxx"
#include "ReportSection.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,10 +153,12 @@
#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>
@@ -245,14 +248,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 +377,15 @@ void OReportController::disposing()
pSectionWindow = getDesignView()->getMarkedSection();
if ( pSectionWindow )
pSectionWindow->getReportSection().deactivateOle();
- getUndoMgr()->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();
}
}
@@ -391,7 +397,6 @@ void OReportController::disposing()
OReportController_BASE::disposing();
- // disconnect();
try
{
m_xReportDefinition.clear();
@@ -457,8 +462,20 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const
break;
case SID_REDO:
case SID_UNDO:
- aReturn = OReportController_BASE::GetState(_nId);
- aReturn.bEnabled = aReturn.bEnabled;
+ {
+ size_t ( 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 )( size_t, 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:
@@ -1024,10 +1041,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();
}
@@ -1165,7 +1184,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(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
xFunctions->removeByIndex(nIndex);
select(uno::makeAny(xFunctions->getParent()));
InvalidateFeature( SID_SAVEDOC );
@@ -1192,14 +1211,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);
@@ -1452,19 +1463,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(m_aUndoManager,sUndoAction));
- } // if ( !pListAction.get() )
uno::Reference< report::XReportControlFormat> xReportControlFormat(*aIter,uno::UNO_QUERY);
lcl_setFontWPU_nothrow(xReportControlFormat,_nId);
}
@@ -1528,32 +1536,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(m_aUndoManager,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;
@@ -1674,10 +1687,14 @@ void OReportController::impl_initialize( )
{
//m_sName = m_xReportDefinition->getName();
getView()->initialize(); // show the windows and fill with our informations
- getUndoMgr()->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")));
@@ -1829,7 +1846,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 );
@@ -2092,18 +2109,13 @@ void OReportController::describeSupportedFeatures()
implDescribeSupportedFeature( ".uno:ExpandSection", SID_EXPAND_SECTION);
}
// -----------------------------------------------------------------------------
-SfxUndoManager* OReportController::getUndoMgr()
-{
- return &m_aUndoManager;
-}
-// -----------------------------------------------------------------------------
void OReportController::impl_onModifyChanged()
{
try
{
if ( m_xReportDefinition.is() )
m_xReportDefinition->setModified( impl_isModified() );
- OSingleDocumentController::impl_onModifyChanged();
+ DBSubComponentController::impl_onModifyChanged();
}
catch(uno::Exception)
{
@@ -2111,14 +2123,6 @@ void OReportController::impl_onModifyChanged()
}
}
// -----------------------------------------------------------------------------
-void OReportController::losingConnection( )
-{
- // let the base class do it's reconnect
- OReportController_BASE::losingConnection( );
-
- InvalidateAll();
-}
-// -----------------------------------------------------------------------------
void OReportController::onLoadedMenu(const Reference< frame::XLayoutManager >& _xLayoutManager)
{
if ( _xLayoutManager.is() )
@@ -2305,6 +2309,7 @@ void SAL_CALL OReportController::propertyChange( const beans::PropertyChangeEven
// -----------------------------------------------------------------------------
void SAL_CALL OReportController::disposing( const lang::EventObject& Source ) throw(uno::RuntimeException)
{
+ // simply disambiguate
OReportController_BASE::disposing(Source);
}
@@ -2376,13 +2381,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);
@@ -2483,7 +2481,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(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
const SfxPoolItem* pItem = NULL;
if ( SFX_ITEM_SET == pSet->GetItemState( RPTUI_ID_SIZE,sal_True,&pItem))
{
@@ -2534,13 +2532,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()
{
@@ -2597,7 +2606,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(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
_pMemfun( getDesignView() );
InvalidateFeature( SID_SAVEDOC );
InvalidateFeature( SID_UNDO );
@@ -2606,7 +2615,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(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
getDesignView()->alignMarkedObjects(_nControlModification,_bAlignAtSection);
InvalidateFeature( SID_SAVEDOC );
InvalidateFeature( SID_UNDO );
@@ -2691,7 +2700,7 @@ void OReportController::shrinkSection(USHORT _nUndoStrId, uno::Reference<report:
if ( _xSection.is() )
{
const String sUndoAction = String((ModuleRes(_nUndoStrId)));
- UndoManagerListAction aListAction(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
if (_nSid == SID_SECTION_SHRINK)
{
@@ -3051,17 +3060,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;
}
// -----------------------------------------------------------------------------
@@ -3265,7 +3265,7 @@ void OReportController::createDateTime(const Sequence< PropertyValue >& _aArgs)
getDesignView()->unmarkAllObjects(NULL);
const String sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL));
- UndoManagerListAction aListAction(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
SequenceAsHashMap aMap(_aArgs);
aMap.createItemIfMissing(PROPERTY_FORMATKEY,aMap.getUnpackedValueOrDefault(PROPERTY_FORMATKEYDATE,sal_Int32(0)));
@@ -3293,7 +3293,7 @@ void OReportController::createPageNumber(const Sequence< PropertyValue >& _aArgs
getDesignView()->unmarkAllObjects(NULL);
const String sUndoAction(ModuleRes(RID_STR_UNDO_INSERT_CONTROL));
- UndoManagerListAction aListAction(m_aUndoManager,sUndoAction);
+ UndoContext aUndoContext( getUndoManager(), sUndoAction );
if ( !m_xReportDefinition->getPageHeaderOn() )
{
@@ -3337,7 +3337,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs)
}
uno::Reference<report::XSection> xCurrentSection = getDesignView()->getCurrentSection();
- UndoManagerListAction aUndo( *getUndoMgr(), String( ModuleRes( RID_STR_UNDO_INSERT_CONTROL ) ) );
+ UndoContext aUndoContext( getUndoManager(), String( ModuleRes( RID_STR_UNDO_INSERT_CONTROL ) ) );
try
{
@@ -3805,19 +3805,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));
- getUndoMgr()->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
@@ -3840,7 +3842,7 @@ void OReportController::switchReportSection(const sal_Int16 _nId)
}
if ( SID_REPORTHEADERFOOTER == _nId )
- getUndoMgr()->LeaveListAction();
+ pUndoContext.reset();
getView()->Resize();
}
}
@@ -3853,12 +3855,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));
- getUndoMgr()->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
@@ -3866,7 +3869,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
@@ -3888,7 +3891,7 @@ void OReportController::switchPageSection(const sal_Int16 _nId)
break;
}
if ( SID_PAGEHEADERFOOTER == _nId )
- getUndoMgr()->LeaveListAction();
+ pUndoContext.reset();
getView()->Resize();
}
}
@@ -3914,7 +3917,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,
@@ -3948,7 +3951,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
@@ -4203,23 +4206,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(m_aUndoManager,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();
}
// -----------------------------------------------------------------------------
@@ -4388,4 +4389,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 26ce8c13c2a6..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().getUndoMgr()->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().getUndoMgr()->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 bcd50236aab3..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().getUndoMgr(),sUndoAction);
+ const UndoContext aUndoContext( getView()->getReportView()->getController().getUndoManager(), sUndoAction );
Point aNewPos = _aPnt;
OSectionView* pInSection = getSectionRelativeToPosition(_pSection, aNewPos);