summaryrefslogtreecommitdiff
path: root/sc/inc/chartlock.hxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-08-03 12:06:24 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-08-03 12:06:24 +0000
commit2eae1a64eaebff1cdca82179497aa42c2eecd548 (patch)
treee770f6aa8358e0faca35423bc1a9fc4b02ced37e /sc/inc/chartlock.hxx
parent30c5cc9a0456444b2079e665c6f41da07e09c866 (diff)
INTEGRATION: CWS chart10 (1.1.2); FILE ADDED
2007/07/27 12:56:06 iha 1.1.2.2: #i79849# prevent to many view updates of charts - also lock newly loaded charts 2007/07/26 14:28:16 iha 1.1.2.1: #i79849# prevent to many view updates of charts
Diffstat (limited to 'sc/inc/chartlock.hxx')
-rw-r--r--sc/inc/chartlock.hxx94
1 files changed, 94 insertions, 0 deletions
diff --git a/sc/inc/chartlock.hxx b/sc/inc/chartlock.hxx
new file mode 100644
index 000000000000..c6951e3bc115
--- /dev/null
+++ b/sc/inc/chartlock.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: chartlock.hxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: hr $ $Date: 2007-08-03 13:06:24 $
+ *
+ * The Contents of this file are made available subject to
+ * the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2005 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library 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 for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ ************************************************************************/
+
+#ifndef SC_CHARTLOCK_HXX
+#define SC_CHARTLOCK_HXX
+
+
+#include <vcl/timer.hxx>
+
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/frame/XModel.hpp>
+
+#include <memory>
+
+class ScDocument;
+
+/** All current charts in the calc will be locked in constructor and unlocked in destructor.
+*/
+class ScChartLockGuard
+{
+public:
+ ScChartLockGuard( ScDocument* pDoc );
+ virtual ~ScChartLockGuard();
+
+ void AlsoLockThisChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+private:
+ std::vector< ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XModel > > maChartModels;
+
+ ScChartLockGuard();
+ ScChartLockGuard( const ScChartLockGuard& );
+};
+
+/** Use this to lock all charts in the calc for a little time.
+ They will unlock automatically unless you call StartOrContinueLocking() again.
+*/
+class ScTemporaryChartLock
+{
+public:
+ ScTemporaryChartLock( ScDocument* pDoc );
+ virtual ~ScTemporaryChartLock();
+
+ void StartOrContinueLocking();
+ void StopLocking();
+ void AlsoLockThisChart( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xModel );
+
+private:
+ ScDocument* mpDoc;
+ Timer maTimer;
+ std::auto_ptr< ScChartLockGuard > mapScChartLockGuard;
+
+ DECL_LINK( TimeoutHdl, Timer* );
+
+ ScTemporaryChartLock();
+ ScTemporaryChartLock( const ScTemporaryChartLock& );
+};
+
+
+#endif