summaryrefslogtreecommitdiff
path: root/chart2/source/controller
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller')
-rw-r--r--chart2/source/controller/main/ChartController.cxx2
-rw-r--r--chart2/source/controller/main/UndoActions.cxx (renamed from chart2/source/controller/main/ImplDocumentActions.cxx)2
-rw-r--r--chart2/source/controller/main/UndoActions.hxx (renamed from chart2/source/controller/main/ImplDocumentActions.hxx)0
-rw-r--r--chart2/source/controller/main/UndoGuard.cxx2
-rw-r--r--chart2/source/controller/main/UndoGuard.hxx112
-rw-r--r--chart2/source/controller/main/makefile.mk2
6 files changed, 116 insertions, 4 deletions
diff --git a/chart2/source/controller/main/ChartController.cxx b/chart2/source/controller/main/ChartController.cxx
index 7df48b757174..1acf71c17fff 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -52,7 +52,7 @@
#include "AccessibleChartView.hxx"
#include "DrawCommandDispatch.hxx"
#include "ShapeController.hxx"
-#include "ImplDocumentActions.hxx"
+#include "UndoActions.hxx"
#include <comphelper/InlineContainer.hxx>
diff --git a/chart2/source/controller/main/ImplDocumentActions.cxx b/chart2/source/controller/main/UndoActions.cxx
index a565c81dad56..86c0e365f590 100644
--- a/chart2/source/controller/main/ImplDocumentActions.cxx
+++ b/chart2/source/controller/main/UndoActions.cxx
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_chart2.hxx"
-#include "ImplDocumentActions.hxx"
+#include "UndoActions.hxx"
#include "DisposeHelper.hxx"
#include "CommonFunctors.hxx"
#include "PropertyHelper.hxx"
diff --git a/chart2/source/controller/main/ImplDocumentActions.hxx b/chart2/source/controller/main/UndoActions.hxx
index 2c98d6af1d54..2c98d6af1d54 100644
--- a/chart2/source/controller/main/ImplDocumentActions.hxx
+++ b/chart2/source/controller/main/UndoActions.hxx
diff --git a/chart2/source/controller/main/UndoGuard.cxx b/chart2/source/controller/main/UndoGuard.cxx
index e331aee3a762..97418e725140 100644
--- a/chart2/source/controller/main/UndoGuard.cxx
+++ b/chart2/source/controller/main/UndoGuard.cxx
@@ -30,7 +30,7 @@
#include "UndoGuard.hxx"
#include "ChartModelClone.hxx"
-#include "ImplDocumentActions.hxx"
+#include "UndoActions.hxx"
#include <com/sun/star/container/XChild.hpp>
diff --git a/chart2/source/controller/main/UndoGuard.hxx b/chart2/source/controller/main/UndoGuard.hxx
new file mode 100644
index 000000000000..6040d7472329
--- /dev/null
+++ b/chart2/source/controller/main/UndoGuard.hxx
@@ -0,0 +1,112 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_UNDOGUARD_HXX
+#define CHART2_UNDOGUARD_HXX
+
+#include "ChartModelClone.hxx"
+
+#include <com/sun/star/document/XUndoManager.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+/** A guard which which does nothing, unless you explicitly call commitAction. In particular, in its destructor, it
+ does neither auto-commit nor auto-rollback the model changes.
+ */
+class UndoGuard
+{
+public:
+ explicit UndoGuard(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager,
+ const ModelFacet i_facet = E_MODEL
+ );
+ ~UndoGuard();
+
+ void commit();
+ void rollback();
+
+protected:
+ bool isActionPosted() const { return m_bActionPosted; }
+
+private:
+ void discardSnapshot();
+
+private:
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xChartModel;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > m_xUndoManager;
+
+ ::boost::shared_ptr< ChartModelClone > m_pDocumentSnapshot;
+ rtl::OUString m_aUndoString;
+ bool m_bActionPosted;
+};
+
+/** A guard which, in its destructor, restores the model state it found in the constructor. If
+ <member>commitAction</member> is called inbetween, the restouration is not performed.
+ */
+class UndoLiveUpdateGuard : public UndoGuard
+{
+public:
+ explicit UndoLiveUpdateGuard(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ ~UndoLiveUpdateGuard();
+};
+
+/** Same as UndoLiveUpdateGuard but with additional storage of the chart's data.
+ Only use this if the data has internal data.
+ */
+class UndoLiveUpdateGuardWithData :
+ public UndoGuard
+{
+public:
+ explicit UndoLiveUpdateGuardWithData(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ ~UndoLiveUpdateGuardWithData();
+};
+
+class UndoGuardWithSelection : public UndoGuard
+{
+public:
+ explicit UndoGuardWithSelection(
+ const ::rtl::OUString& i_undoMessage,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::document::XUndoManager > & i_undoManager
+ );
+ virtual ~UndoGuardWithSelection();
+};
+
+}
+// CHART2_UNDOGUARD_HXX
+#endif
diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk
index af2dbcb39c8d..557d6cf6216f 100644
--- a/chart2/source/controller/main/makefile.mk
+++ b/chart2/source/controller/main/makefile.mk
@@ -72,7 +72,7 @@ SLOFILES = \
$(SLO)$/DrawCommandDispatch.obj \
$(SLO)$/ShapeController.obj \
$(SLO)$/ShapeToolbarController.obj \
- $(SLO)$/ImplDocumentActions.obj \
+ $(SLO)$/UndoActions.obj \
$(SLO)$/UndoGuard.obj \
$(SLO)$/ChartModelClone.obj \