xref: /AOO41X/main/reportdesign/source/core/sdr/UndoEnv.cxx (revision 9e0e41911c53968aad5ad356e2b2126da667034f)
1*9e0e4191SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9e0e4191SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9e0e4191SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9e0e4191SAndrew Rist  * distributed with this work for additional information
6*9e0e4191SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9e0e4191SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9e0e4191SAndrew Rist  * "License"); you may not use this file except in compliance
9*9e0e4191SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11*9e0e4191SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13*9e0e4191SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9e0e4191SAndrew Rist  * software distributed under the License is distributed on an
15*9e0e4191SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0e4191SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9e0e4191SAndrew Rist  * specific language governing permissions and limitations
18*9e0e4191SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20*9e0e4191SAndrew Rist  *************************************************************/
21*9e0e4191SAndrew Rist 
22*9e0e4191SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #include "UndoActions.hxx"
25cdf0e10cSrcweir #include "UndoEnv.hxx"
26cdf0e10cSrcweir #include "formatnormalizer.hxx"
27cdf0e10cSrcweir #include "conditionupdater.hxx"
28cdf0e10cSrcweir #include "corestrings.hrc"
29cdf0e10cSrcweir #include "rptui_slotid.hrc"
30cdf0e10cSrcweir #include "RptDef.hxx"
31cdf0e10cSrcweir #include "ModuleHelper.hxx"
32cdf0e10cSrcweir #include "RptObject.hxx"
33cdf0e10cSrcweir #include "RptPage.hxx"
34cdf0e10cSrcweir #include "RptResId.hrc"
35cdf0e10cSrcweir #include "RptModel.hxx"
36cdf0e10cSrcweir 
37cdf0e10cSrcweir /** === begin UNO includes === **/
38cdf0e10cSrcweir #include <com/sun/star/script/XEventAttacherManager.hpp>
39cdf0e10cSrcweir #include <com/sun/star/container/XChild.hpp>
40cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
41cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
42cdf0e10cSrcweir #include <com/sun/star/util/XModifyBroadcaster.hpp>
43cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospectionAccess.hpp>
44cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospection.hpp>
45cdf0e10cSrcweir /** === end UNO includes === **/
46cdf0e10cSrcweir 
47cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
48cdf0e10cSrcweir #include <svl/smplhint.hxx>
49cdf0e10cSrcweir #include <tools/diagnose_ex.h>
50cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
51cdf0e10cSrcweir #include <comphelper/componentcontext.hxx>
52cdf0e10cSrcweir #include <vcl/svapp.hxx>
53cdf0e10cSrcweir #include <dbaccess/dbsubcomponentcontroller.hxx>
54cdf0e10cSrcweir #include <svx/unoshape.hxx>
55cdf0e10cSrcweir #include <vos/mutex.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir namespace rptui
58cdf0e10cSrcweir {
59cdf0e10cSrcweir 	using namespace ::com::sun::star;
60cdf0e10cSrcweir 	using namespace uno;
61cdf0e10cSrcweir 	using namespace lang;
62cdf0e10cSrcweir 	using namespace script;
63cdf0e10cSrcweir 	using namespace beans;
64cdf0e10cSrcweir 	using namespace awt;
65cdf0e10cSrcweir 	using namespace util;
66cdf0e10cSrcweir 	using namespace container;
67cdf0e10cSrcweir 	using namespace report;
68cdf0e10cSrcweir //----------------------------------------------------------------------------
69cdf0e10cSrcweir 
70cdf0e10cSrcweir 
71cdf0e10cSrcweir struct PropertyInfo
72cdf0e10cSrcweir {
73cdf0e10cSrcweir     bool    bIsReadonlyOrTransient;
74cdf0e10cSrcweir 
PropertyInforptui::PropertyInfo75cdf0e10cSrcweir     PropertyInfo()
76cdf0e10cSrcweir         :bIsReadonlyOrTransient( false )
77cdf0e10cSrcweir     {
78cdf0e10cSrcweir     }
79cdf0e10cSrcweir 
PropertyInforptui::PropertyInfo80cdf0e10cSrcweir     PropertyInfo( const bool i_bIsTransientOrReadOnly )
81cdf0e10cSrcweir         :bIsReadonlyOrTransient( i_bIsTransientOrReadOnly )
82cdf0e10cSrcweir     {
83cdf0e10cSrcweir     }
84cdf0e10cSrcweir };
85cdf0e10cSrcweir 
86cdf0e10cSrcweir typedef ::std::hash_map< ::rtl::OUString, PropertyInfo, ::rtl::OUStringHash >    PropertiesInfo;
87cdf0e10cSrcweir 
88cdf0e10cSrcweir struct ObjectInfo
89cdf0e10cSrcweir {
90cdf0e10cSrcweir     PropertiesInfo              aProperties;
91cdf0e10cSrcweir     Reference< XPropertySet >   xPropertyIntrospection;
92cdf0e10cSrcweir 
ObjectInforptui::ObjectInfo93cdf0e10cSrcweir     ObjectInfo()
94cdf0e10cSrcweir         :aProperties()
95cdf0e10cSrcweir         ,xPropertyIntrospection()
96cdf0e10cSrcweir     {
97cdf0e10cSrcweir     }
98cdf0e10cSrcweir };
99cdf0e10cSrcweir 
100cdf0e10cSrcweir typedef ::std::map< Reference< XPropertySet >, ObjectInfo, ::comphelper::OInterfaceCompare< XPropertySet > >    PropertySetInfoCache;
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // -----------------------------------------------------------------------------
103cdf0e10cSrcweir 
104cdf0e10cSrcweir class OXUndoEnvironmentImpl
105cdf0e10cSrcweir {
106cdf0e10cSrcweir     OXUndoEnvironmentImpl(OXUndoEnvironmentImpl&);
107cdf0e10cSrcweir     void operator =(OXUndoEnvironmentImpl&);
108cdf0e10cSrcweir public:
109cdf0e10cSrcweir     OReportModel&                                       m_rModel;
110cdf0e10cSrcweir     PropertySetInfoCache                                m_aPropertySetCache;
111cdf0e10cSrcweir     FormatNormalizer                                    m_aFormatNormalizer;
112cdf0e10cSrcweir     ConditionUpdater                                    m_aConditionUpdater;
113cdf0e10cSrcweir     ::osl::Mutex                                        m_aMutex;
114cdf0e10cSrcweir 	::std::vector< uno::Reference< container::XChild> > m_aSections;
115cdf0e10cSrcweir     Reference< XIntrospection >                         m_xIntrospection;
116cdf0e10cSrcweir     oslInterlockedCount                                 m_nLocks;
117cdf0e10cSrcweir 	sal_Bool	                                        m_bReadOnly;
118cdf0e10cSrcweir     sal_Bool                                            m_bIsUndo;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir     OXUndoEnvironmentImpl(OReportModel& _rModel);
121cdf0e10cSrcweir };
122cdf0e10cSrcweir 
OXUndoEnvironmentImpl(OReportModel & _rModel)123cdf0e10cSrcweir OXUndoEnvironmentImpl::OXUndoEnvironmentImpl(OReportModel& _rModel) : m_rModel(_rModel)
124cdf0e10cSrcweir         ,m_aFormatNormalizer( _rModel )
125cdf0e10cSrcweir         ,m_aConditionUpdater()
126cdf0e10cSrcweir         ,m_nLocks(0)
127cdf0e10cSrcweir 		,m_bReadOnly(sal_False)
128cdf0e10cSrcweir         ,m_bIsUndo(sal_False)
129cdf0e10cSrcweir {
130cdf0e10cSrcweir }
131cdf0e10cSrcweir 
132cdf0e10cSrcweir //------------------------------------------------------------------------------
133cdf0e10cSrcweir DBG_NAME( rpt_OXUndoEnvironment );
134cdf0e10cSrcweir //------------------------------------------------------------------------------
OXUndoEnvironment(OReportModel & _rModel)135cdf0e10cSrcweir OXUndoEnvironment::OXUndoEnvironment(OReportModel& _rModel)
136cdf0e10cSrcweir 				   :m_pImpl(new OXUndoEnvironmentImpl(_rModel) )
137cdf0e10cSrcweir {
138cdf0e10cSrcweir 	DBG_CTOR( rpt_OXUndoEnvironment,NULL);
139cdf0e10cSrcweir     StartListening(m_pImpl->m_rModel);
140cdf0e10cSrcweir }
141cdf0e10cSrcweir 
142cdf0e10cSrcweir //------------------------------------------------------------------------------
~OXUndoEnvironment()143cdf0e10cSrcweir OXUndoEnvironment::~OXUndoEnvironment()
144cdf0e10cSrcweir {
145cdf0e10cSrcweir 	DBG_DTOR( rpt_OXUndoEnvironment,NULL);
146cdf0e10cSrcweir }
147cdf0e10cSrcweir // -----------------------------------------------------------------------------
Lock()148cdf0e10cSrcweir void OXUndoEnvironment::Lock()
149cdf0e10cSrcweir {
150cdf0e10cSrcweir     OSL_ENSURE(m_refCount,"Illegal call to dead object!");
151cdf0e10cSrcweir     osl_incrementInterlockedCount( &m_pImpl->m_nLocks );
152cdf0e10cSrcweir }
UnLock()153cdf0e10cSrcweir void OXUndoEnvironment::UnLock()
154cdf0e10cSrcweir {
155cdf0e10cSrcweir     OSL_ENSURE(m_refCount,"Illegal call to dead object!");
156cdf0e10cSrcweir 
157cdf0e10cSrcweir     osl_decrementInterlockedCount( &m_pImpl->m_nLocks );
158cdf0e10cSrcweir }
IsLocked() const159cdf0e10cSrcweir sal_Bool OXUndoEnvironment::IsLocked() const { return m_pImpl->m_nLocks != 0; }
160cdf0e10cSrcweir // -----------------------------------------------------------------------------
RemoveSection(OReportPage * _pPage)161cdf0e10cSrcweir void OXUndoEnvironment::RemoveSection(OReportPage* _pPage)
162cdf0e10cSrcweir {
163cdf0e10cSrcweir     if ( _pPage )
164cdf0e10cSrcweir     {
165cdf0e10cSrcweir         Reference< XInterface > xSection(_pPage->getSection());
166cdf0e10cSrcweir         if ( xSection.is() )
167cdf0e10cSrcweir 		    RemoveElement( xSection );
168cdf0e10cSrcweir     }
169cdf0e10cSrcweir }
170cdf0e10cSrcweir //------------------------------------------------------------------------------
Clear(const Accessor &)171cdf0e10cSrcweir void OXUndoEnvironment::Clear(const Accessor& /*_r*/)
172cdf0e10cSrcweir {
173cdf0e10cSrcweir 	OUndoEnvLock aLock(*this);
174cdf0e10cSrcweir 
175cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
176cdf0e10cSrcweir     // TODO: LLA->OJ please describe what you are doing in this code fragment.
177cdf0e10cSrcweir     PropertySetInfoCache::iterator aIter = m_pImpl->m_aPropertySetCache.begin();
178cdf0e10cSrcweir     PropertySetInfoCache::iterator aEnd = m_pImpl->m_aPropertySetCache.end();
179cdf0e10cSrcweir     int ndbg_len = m_pImpl->m_aPropertySetCache.size();
180cdf0e10cSrcweir     ndbg_len = ndbg_len;
181cdf0e10cSrcweir     for (int idbg_ = 0; aIter != aEnd; ++aIter,++idbg_)
182cdf0e10cSrcweir     {
183cdf0e10cSrcweir         uno::Reference<beans::XPropertySet> xProp(aIter->first,uno::UNO_QUERY);
184cdf0e10cSrcweir         xProp->getPropertySetInfo();
185cdf0e10cSrcweir         int nlen = aIter->second.aProperties.size();
186cdf0e10cSrcweir         nlen = nlen;
187cdf0e10cSrcweir     }
188cdf0e10cSrcweir #endif
189cdf0e10cSrcweir     m_pImpl->m_aPropertySetCache.clear();
190cdf0e10cSrcweir 
191cdf0e10cSrcweir 	sal_uInt16 nCount = m_pImpl->m_rModel.GetPageCount();
192cdf0e10cSrcweir 	sal_uInt16 i;
193cdf0e10cSrcweir 	for (i = 0; i < nCount; i++)
194cdf0e10cSrcweir 	{
195cdf0e10cSrcweir         OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetPage(i) );
196cdf0e10cSrcweir         RemoveSection(pPage);
197cdf0e10cSrcweir 	}
198cdf0e10cSrcweir 
199cdf0e10cSrcweir 	nCount = m_pImpl->m_rModel.GetMasterPageCount();
200cdf0e10cSrcweir 	for (i = 0; i < nCount; i++)
201cdf0e10cSrcweir 	{
202cdf0e10cSrcweir         OReportPage* pPage = PTR_CAST( OReportPage, m_pImpl->m_rModel.GetMasterPage(i) );
203cdf0e10cSrcweir         RemoveSection(pPage);
204cdf0e10cSrcweir 	}
205cdf0e10cSrcweir 
206cdf0e10cSrcweir     m_pImpl->m_aSections.clear();
207cdf0e10cSrcweir 
208cdf0e10cSrcweir 	if (IsListening(m_pImpl->m_rModel))
209cdf0e10cSrcweir 		EndListening(m_pImpl->m_rModel);
210cdf0e10cSrcweir }
211cdf0e10cSrcweir 
212cdf0e10cSrcweir //------------------------------------------------------------------------------
ModeChanged()213cdf0e10cSrcweir void OXUndoEnvironment::ModeChanged()
214cdf0e10cSrcweir {
215cdf0e10cSrcweir 	m_pImpl->m_bReadOnly = !m_pImpl->m_bReadOnly;
216cdf0e10cSrcweir 
217cdf0e10cSrcweir 	if (!m_pImpl->m_bReadOnly)
218cdf0e10cSrcweir 		StartListening(m_pImpl->m_rModel);
219cdf0e10cSrcweir 	else
220cdf0e10cSrcweir 		EndListening(m_pImpl->m_rModel);
221cdf0e10cSrcweir }
222cdf0e10cSrcweir 
223cdf0e10cSrcweir //------------------------------------------------------------------------------
Notify(SfxBroadcaster &,const SfxHint & rHint)224cdf0e10cSrcweir void OXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
225cdf0e10cSrcweir {
226cdf0e10cSrcweir     if (rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_MODECHANGED )
227cdf0e10cSrcweir         ModeChanged();
228cdf0e10cSrcweir }
229cdf0e10cSrcweir // -----------------------------------------------------------------------------
230cdf0e10cSrcweir //	XEventListener
231cdf0e10cSrcweir //------------------------------------------------------------------------------
disposing(const EventObject & e)232cdf0e10cSrcweir void SAL_CALL OXUndoEnvironment::disposing(const EventObject& e) throw( RuntimeException )
233cdf0e10cSrcweir {
234cdf0e10cSrcweir 	// check if it's an object we have cached informations about
235cdf0e10cSrcweir     Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY);
236cdf0e10cSrcweir     if ( xSourceSet.is() )
237cdf0e10cSrcweir     {
238cdf0e10cSrcweir         uno::Reference< report::XSection> xSection(xSourceSet,uno::UNO_QUERY);
239cdf0e10cSrcweir         if ( xSection.is() )
240cdf0e10cSrcweir             RemoveSection(xSection);
241cdf0e10cSrcweir         else
242cdf0e10cSrcweir             RemoveElement(xSourceSet);
243cdf0e10cSrcweir         /*if (!m_pImpl->m_aPropertySetCache.empty())
244cdf0e10cSrcweir 			m_pImpl->m_aPropertySetCache.erase(xSourceSet);*/
245cdf0e10cSrcweir 	}
246cdf0e10cSrcweir }
247cdf0e10cSrcweir 
248cdf0e10cSrcweir // XPropertyChangeListener
249cdf0e10cSrcweir //------------------------------------------------------------------------------
propertyChange(const PropertyChangeEvent & _rEvent)250cdf0e10cSrcweir void SAL_CALL OXUndoEnvironment::propertyChange( const PropertyChangeEvent& _rEvent ) throw(uno::RuntimeException)
251cdf0e10cSrcweir {
252cdf0e10cSrcweir     ::osl::ClearableMutexGuard aGuard( m_pImpl->m_aMutex );
253cdf0e10cSrcweir 
254cdf0e10cSrcweir 	if ( IsLocked() )
255cdf0e10cSrcweir         return;
256cdf0e10cSrcweir 
257cdf0e10cSrcweir     Reference< XPropertySet >  xSet( _rEvent.Source, UNO_QUERY );
258cdf0e10cSrcweir 	if (!xSet.is())
259cdf0e10cSrcweir 		return;
260cdf0e10cSrcweir 
261cdf0e10cSrcweir 	dbaui::DBSubComponentController* pController = m_pImpl->m_rModel.getController();
262cdf0e10cSrcweir     if ( !pController )
263cdf0e10cSrcweir         return;
264cdf0e10cSrcweir 
265cdf0e10cSrcweir     // no Undo for transient and readonly props.
266cdf0e10cSrcweir 	// let's see if we know something about the set
267cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
268cdf0e10cSrcweir     int nlen = m_pImpl->m_aPropertySetCache.size();
269cdf0e10cSrcweir     nlen = nlen;
270cdf0e10cSrcweir #endif
271cdf0e10cSrcweir     PropertySetInfoCache::iterator objectPos = m_pImpl->m_aPropertySetCache.find(xSet);
272cdf0e10cSrcweir 	if (objectPos == m_pImpl->m_aPropertySetCache.end())
273cdf0e10cSrcweir 	{
274cdf0e10cSrcweir 		objectPos = m_pImpl->m_aPropertySetCache.insert( PropertySetInfoCache::value_type(
275cdf0e10cSrcweir             xSet, ObjectInfo()
276cdf0e10cSrcweir         ) ).first;
277cdf0e10cSrcweir 		DBG_ASSERT(objectPos != m_pImpl->m_aPropertySetCache.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
278cdf0e10cSrcweir 	}
279cdf0e10cSrcweir 	if ( objectPos == m_pImpl->m_aPropertySetCache.end() )
280cdf0e10cSrcweir         return;
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	// now we have access to the cached info about the set
283cdf0e10cSrcweir 	// let's see what we know about the property
284cdf0e10cSrcweir     ObjectInfo& rObjectInfo = objectPos->second;
285cdf0e10cSrcweir     PropertiesInfo::iterator aPropertyPos = rObjectInfo.aProperties.find( _rEvent.PropertyName );
286cdf0e10cSrcweir 	if ( aPropertyPos == rObjectInfo.aProperties.end() )
287cdf0e10cSrcweir 	{	// nothing 'til now ... have to change this ....
288cdf0e10cSrcweir 		// the attributes
289cdf0e10cSrcweir         Reference< XPropertySetInfo > xPSI( xSet->getPropertySetInfo(), UNO_SET_THROW );
290cdf0e10cSrcweir 		sal_Int32 nPropertyAttributes = 0;
291cdf0e10cSrcweir         try
292cdf0e10cSrcweir         {
293cdf0e10cSrcweir             if ( xPSI->hasPropertyByName( _rEvent.PropertyName ) )
294cdf0e10cSrcweir             {
295cdf0e10cSrcweir                 nPropertyAttributes = xPSI->getPropertyByName( _rEvent.PropertyName ).Attributes;
296cdf0e10cSrcweir             }
297cdf0e10cSrcweir             else
298cdf0e10cSrcweir             {
299cdf0e10cSrcweir                 // it's perfectly valid for a component to notify a change in a property which it doesn't have - as long
300cdf0e10cSrcweir                 // as it has an attribute with this name
301cdf0e10cSrcweir                 if ( !rObjectInfo.xPropertyIntrospection.is() )
302cdf0e10cSrcweir                 {
303cdf0e10cSrcweir                     if ( !m_pImpl->m_xIntrospection.is() )
304cdf0e10cSrcweir                     {
305cdf0e10cSrcweir                         ::comphelper::ComponentContext aContext( m_pImpl->m_rModel.getController()->getORB() );
306cdf0e10cSrcweir                         OSL_VERIFY( aContext.createComponent( "com.sun.star.beans.Introspection", m_pImpl->m_xIntrospection ) );
307cdf0e10cSrcweir                     }
308cdf0e10cSrcweir                     if ( m_pImpl->m_xIntrospection.is() )
309cdf0e10cSrcweir                     {
310cdf0e10cSrcweir                         Reference< XIntrospectionAccess > xIntrospection(
311cdf0e10cSrcweir                             m_pImpl->m_xIntrospection->inspect( makeAny( _rEvent.Source ) ),
312cdf0e10cSrcweir                             UNO_SET_THROW
313cdf0e10cSrcweir                         );
314cdf0e10cSrcweir                         rObjectInfo.xPropertyIntrospection.set( xIntrospection->queryAdapter( XPropertySet::static_type() ), UNO_QUERY_THROW );
315cdf0e10cSrcweir                     }
316cdf0e10cSrcweir                 }
317cdf0e10cSrcweir                 if ( rObjectInfo.xPropertyIntrospection.is() )
318cdf0e10cSrcweir                 {
319cdf0e10cSrcweir                     xPSI.set( rObjectInfo.xPropertyIntrospection->getPropertySetInfo(), UNO_SET_THROW );
320cdf0e10cSrcweir                     nPropertyAttributes = xPSI->getPropertyByName( _rEvent.PropertyName ).Attributes;
321cdf0e10cSrcweir                 }
322cdf0e10cSrcweir             }
323cdf0e10cSrcweir         }
324cdf0e10cSrcweir         catch( const Exception& )
325cdf0e10cSrcweir         {
326cdf0e10cSrcweir         	DBG_UNHANDLED_EXCEPTION();
327cdf0e10cSrcweir         }
328cdf0e10cSrcweir 		const bool bTransReadOnly =
329cdf0e10cSrcweir                     ( ( nPropertyAttributes & PropertyAttribute::READONLY ) != 0 )
330cdf0e10cSrcweir                 ||  ( ( nPropertyAttributes & PropertyAttribute::TRANSIENT ) != 0 );
331cdf0e10cSrcweir 
332cdf0e10cSrcweir 		// insert the new entry
333cdf0e10cSrcweir 		aPropertyPos = rObjectInfo.aProperties.insert( PropertiesInfo::value_type(
334cdf0e10cSrcweir             _rEvent.PropertyName,
335cdf0e10cSrcweir             PropertyInfo( bTransReadOnly )
336cdf0e10cSrcweir         ) ).first;
337cdf0e10cSrcweir 		DBG_ASSERT(aPropertyPos != rObjectInfo.aProperties.end(), "OXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
338cdf0e10cSrcweir 	}
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 	implSetModified();
341cdf0e10cSrcweir 
342cdf0e10cSrcweir 	// now we have access to the cached info about the property affected
343cdf0e10cSrcweir 	// and are able to decide wether or not we need an undo action
344cdf0e10cSrcweir 
345cdf0e10cSrcweir 	// no UNDO for transient/readonly properties
346cdf0e10cSrcweir 	if ( aPropertyPos->second.bIsReadonlyOrTransient )
347cdf0e10cSrcweir         return;
348cdf0e10cSrcweir 
349cdf0e10cSrcweir     // give components with sub responsibilities a chance
350cdf0e10cSrcweir     m_pImpl->m_aFormatNormalizer.notifyPropertyChange( _rEvent );
351cdf0e10cSrcweir     m_pImpl->m_aConditionUpdater.notifyPropertyChange( _rEvent );
352cdf0e10cSrcweir 
353cdf0e10cSrcweir     aGuard.clear();
354cdf0e10cSrcweir 	// TODO: this is a potential race condition: two threads here could in theory
355cdf0e10cSrcweir 	// add their undo actions out-of-order
356cdf0e10cSrcweir 
357cdf0e10cSrcweir     ::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
358cdf0e10cSrcweir     ORptUndoPropertyAction* pUndo = NULL;
359cdf0e10cSrcweir     try
360cdf0e10cSrcweir     {
361cdf0e10cSrcweir         uno::Reference< report::XSection> xSection( xSet, uno::UNO_QUERY );
362cdf0e10cSrcweir         if ( xSection.is() )
363cdf0e10cSrcweir         {
364cdf0e10cSrcweir             uno::Reference< report::XGroup> xGroup = xSection->getGroup();
365cdf0e10cSrcweir             if ( xGroup.is() )
366cdf0e10cSrcweir                 pUndo = new OUndoPropertyGroupSectionAction( m_pImpl->m_rModel, _rEvent, OGroupHelper::getMemberFunction( xSection ), xGroup );
367cdf0e10cSrcweir             else
368cdf0e10cSrcweir                 pUndo = new OUndoPropertyReportSectionAction( m_pImpl->m_rModel, _rEvent, OReportHelper::getMemberFunction( xSection ), xSection->getReportDefinition() );
369cdf0e10cSrcweir         }
370cdf0e10cSrcweir     }
371cdf0e10cSrcweir     catch(const Exception&)
372cdf0e10cSrcweir     {
373cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
374cdf0e10cSrcweir     }
375cdf0e10cSrcweir 
376cdf0e10cSrcweir     if ( pUndo == NULL )
377cdf0e10cSrcweir         pUndo = new ORptUndoPropertyAction( m_pImpl->m_rModel, _rEvent );
378cdf0e10cSrcweir 
379cdf0e10cSrcweir     m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( pUndo );
380cdf0e10cSrcweir     pController->InvalidateAll();
381cdf0e10cSrcweir }
382cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSection(const Reference<container::XChild> & _xContainer) const383cdf0e10cSrcweir ::std::vector< uno::Reference< container::XChild> >::const_iterator OXUndoEnvironment::getSection(const Reference<container::XChild>& _xContainer) const
384cdf0e10cSrcweir {
385cdf0e10cSrcweir     ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = m_pImpl->m_aSections.end();
386cdf0e10cSrcweir     if ( _xContainer.is() )
387cdf0e10cSrcweir     {
388cdf0e10cSrcweir         aFind = ::std::find(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),_xContainer);
389cdf0e10cSrcweir 
390cdf0e10cSrcweir 	    if ( aFind == m_pImpl->m_aSections.end() )
391cdf0e10cSrcweir 	    {
392cdf0e10cSrcweir             Reference<container::XChild> xParent(_xContainer->getParent(),uno::UNO_QUERY);
393cdf0e10cSrcweir             aFind = getSection(xParent);
394cdf0e10cSrcweir         }
395cdf0e10cSrcweir     }
396cdf0e10cSrcweir     return aFind;
397cdf0e10cSrcweir }
398cdf0e10cSrcweir // XContainerListener
399cdf0e10cSrcweir //------------------------------------------------------------------------------
elementInserted(const ContainerEvent & evt)400cdf0e10cSrcweir void SAL_CALL OXUndoEnvironment::elementInserted(const ContainerEvent& evt) throw(uno::RuntimeException)
401cdf0e10cSrcweir {
402cdf0e10cSrcweir 	::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
403cdf0e10cSrcweir     ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
404cdf0e10cSrcweir 
405cdf0e10cSrcweir 	// neues Object zum lauschen
406cdf0e10cSrcweir 	Reference< uno::XInterface >  xIface( evt.Element, UNO_QUERY );
407cdf0e10cSrcweir 	if ( !IsLocked() )
408cdf0e10cSrcweir     {
409cdf0e10cSrcweir         Reference< report::XReportComponent >  xReportComponent( xIface, UNO_QUERY );
410cdf0e10cSrcweir         if ( xReportComponent.is() )
411cdf0e10cSrcweir 	    {
412cdf0e10cSrcweir             Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY);
413cdf0e10cSrcweir 
414cdf0e10cSrcweir 		    ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get());
415cdf0e10cSrcweir 
416cdf0e10cSrcweir 		    if ( aFind != m_pImpl->m_aSections.end() )
417cdf0e10cSrcweir 		    {
418cdf0e10cSrcweir                 OUndoEnvLock aLock(*this);
419cdf0e10cSrcweir                 try
420cdf0e10cSrcweir                 {
421cdf0e10cSrcweir                     OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection>(*aFind,uno::UNO_QUERY));
422cdf0e10cSrcweir                     OSL_ENSURE(pPage,"No page could be found for section!");
423cdf0e10cSrcweir                     if ( pPage )
424cdf0e10cSrcweir 			            pPage->insertObject(xReportComponent);
425cdf0e10cSrcweir                 }
426cdf0e10cSrcweir                 catch(uno::Exception&)
427cdf0e10cSrcweir                 {
428cdf0e10cSrcweir                     DBG_UNHANDLED_EXCEPTION();
429cdf0e10cSrcweir                 }
430cdf0e10cSrcweir 
431cdf0e10cSrcweir 		    }
432cdf0e10cSrcweir 	    }
433cdf0e10cSrcweir         else
434cdf0e10cSrcweir         {
435cdf0e10cSrcweir             uno::Reference< report::XFunctions> xContainer(evt.Source,uno::UNO_QUERY);
436cdf0e10cSrcweir             if ( xContainer.is() )
437cdf0e10cSrcweir             {
438cdf0e10cSrcweir                 m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction(
439cdf0e10cSrcweir                     new OUndoContainerAction( m_pImpl->m_rModel, rptui::Inserted, xContainer.get(),
440cdf0e10cSrcweir                         xIface, RID_STR_UNDO_ADDFUNCTION ) );
441cdf0e10cSrcweir             }
442cdf0e10cSrcweir         }
443cdf0e10cSrcweir     }
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 	AddElement(xIface);
446cdf0e10cSrcweir 
447cdf0e10cSrcweir 	implSetModified();
448cdf0e10cSrcweir }
449cdf0e10cSrcweir 
450cdf0e10cSrcweir //------------------------------------------------------------------------------
implSetModified()451cdf0e10cSrcweir void OXUndoEnvironment::implSetModified()
452cdf0e10cSrcweir {
453cdf0e10cSrcweir 	//if ( !IsLocked() )
454cdf0e10cSrcweir 	m_pImpl->m_rModel.SetModified( sal_True );
455cdf0e10cSrcweir }
456cdf0e10cSrcweir 
457cdf0e10cSrcweir //------------------------------------------------------------------------------
elementReplaced(const ContainerEvent & evt)458cdf0e10cSrcweir void SAL_CALL OXUndoEnvironment::elementReplaced(const ContainerEvent& evt) throw(uno::RuntimeException)
459cdf0e10cSrcweir {
460cdf0e10cSrcweir 	::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
461cdf0e10cSrcweir     ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
462cdf0e10cSrcweir 
463cdf0e10cSrcweir     Reference< XInterface >  xIface(evt.ReplacedElement,uno::UNO_QUERY);
464cdf0e10cSrcweir 	OSL_ENSURE(xIface.is(), "OXUndoEnvironment::elementReplaced: invalid container notification!");
465cdf0e10cSrcweir 	RemoveElement(xIface);
466cdf0e10cSrcweir 
467cdf0e10cSrcweir     xIface.set(evt.Element,uno::UNO_QUERY);
468cdf0e10cSrcweir 	AddElement(xIface);
469cdf0e10cSrcweir 
470cdf0e10cSrcweir     implSetModified();
471cdf0e10cSrcweir }
472cdf0e10cSrcweir 
473cdf0e10cSrcweir //------------------------------------------------------------------------------
elementRemoved(const ContainerEvent & evt)474cdf0e10cSrcweir void SAL_CALL OXUndoEnvironment::elementRemoved(const ContainerEvent& evt) throw(uno::RuntimeException)
475cdf0e10cSrcweir {
476cdf0e10cSrcweir 	::vos::OClearableGuard aSolarGuard( Application::GetSolarMutex() );
477cdf0e10cSrcweir     ::osl::MutexGuard aGuard( m_pImpl->m_aMutex );
478cdf0e10cSrcweir 
479cdf0e10cSrcweir     Reference< uno::XInterface >  xIface( evt.Element, UNO_QUERY );
480cdf0e10cSrcweir     if ( !IsLocked() )
481cdf0e10cSrcweir     {
482cdf0e10cSrcweir 	    Reference< report::XSection > xContainer(evt.Source,uno::UNO_QUERY);
483cdf0e10cSrcweir 	    ::std::vector< uno::Reference< container::XChild> >::const_iterator aFind = getSection(xContainer.get());
484cdf0e10cSrcweir 
485cdf0e10cSrcweir         Reference< report::XReportComponent >  xReportComponent( xIface, UNO_QUERY );
486cdf0e10cSrcweir 	    if ( aFind != m_pImpl->m_aSections.end() && xReportComponent.is() )
487cdf0e10cSrcweir 	    {
488cdf0e10cSrcweir             OXUndoEnvironment::OUndoEnvLock aLock(*this);
489cdf0e10cSrcweir             try
490cdf0e10cSrcweir             {
491cdf0e10cSrcweir                 OReportPage* pPage = m_pImpl->m_rModel.getPage(uno::Reference< report::XSection >( *aFind, uno::UNO_QUERY_THROW ) );
492cdf0e10cSrcweir                 OSL_ENSURE( pPage, "OXUndoEnvironment::elementRemoved: no page for the section!" );
493cdf0e10cSrcweir                 if ( pPage )
494cdf0e10cSrcweir 			        pPage->removeSdrObject(xReportComponent);
495cdf0e10cSrcweir             }
496cdf0e10cSrcweir             catch(const uno::Exception&)
497cdf0e10cSrcweir             {
498cdf0e10cSrcweir                 DBG_UNHANDLED_EXCEPTION();
499cdf0e10cSrcweir             }
500cdf0e10cSrcweir 	    }
501cdf0e10cSrcweir         else
502cdf0e10cSrcweir         {
503cdf0e10cSrcweir             uno::Reference< report::XFunctions> xFunctions(evt.Source,uno::UNO_QUERY);
504cdf0e10cSrcweir             if ( xFunctions.is() )
505cdf0e10cSrcweir             {
506cdf0e10cSrcweir                 m_pImpl->m_rModel.GetSdrUndoManager()->AddUndoAction( new OUndoContainerAction(
507cdf0e10cSrcweir                     m_pImpl->m_rModel, rptui::Removed, xFunctions.get(), xIface, RID_STR_UNDO_ADDFUNCTION ) );
508cdf0e10cSrcweir             }
509cdf0e10cSrcweir         }
510cdf0e10cSrcweir     }
511cdf0e10cSrcweir 
512cdf0e10cSrcweir 	if ( xIface.is() )
513cdf0e10cSrcweir 		RemoveElement(xIface);
514cdf0e10cSrcweir 
515cdf0e10cSrcweir 	implSetModified();
516cdf0e10cSrcweir }
517cdf0e10cSrcweir 
518cdf0e10cSrcweir //------------------------------------------------------------------------------
modified(const EventObject &)519cdf0e10cSrcweir void SAL_CALL OXUndoEnvironment::modified( const EventObject& /*aEvent*/ ) throw (RuntimeException)
520cdf0e10cSrcweir {
521cdf0e10cSrcweir     implSetModified();
522cdf0e10cSrcweir }
523cdf0e10cSrcweir 
524cdf0e10cSrcweir //------------------------------------------------------------------------------
AddSection(const Reference<report::XSection> & _xSection)525cdf0e10cSrcweir void OXUndoEnvironment::AddSection(const Reference< report::XSection > & _xSection)
526cdf0e10cSrcweir {
527cdf0e10cSrcweir 	OUndoEnvLock aLock(*this);
528cdf0e10cSrcweir     try
529cdf0e10cSrcweir     {
530cdf0e10cSrcweir 	    uno::Reference<container::XChild> xChild = _xSection.get();
531cdf0e10cSrcweir 	    uno::Reference<report::XGroup> xGroup(xChild->getParent(),uno::UNO_QUERY);
532cdf0e10cSrcweir 	    m_pImpl->m_aSections.push_back(xChild);
533cdf0e10cSrcweir 	    Reference< XInterface >  xInt(_xSection);
534cdf0e10cSrcweir 	    AddElement(xInt);
535cdf0e10cSrcweir     }
536cdf0e10cSrcweir     catch(const uno::Exception&)
537cdf0e10cSrcweir     {
538cdf0e10cSrcweir         DBG_UNHANDLED_EXCEPTION();
539cdf0e10cSrcweir     }
540cdf0e10cSrcweir }
541cdf0e10cSrcweir 
542cdf0e10cSrcweir //------------------------------------------------------------------------------
RemoveSection(const Reference<report::XSection> & _xSection)543cdf0e10cSrcweir void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSection)
544cdf0e10cSrcweir {
545cdf0e10cSrcweir 	OUndoEnvLock aLock(*this);
546cdf0e10cSrcweir     try
547cdf0e10cSrcweir     {
548cdf0e10cSrcweir 	    uno::Reference<container::XChild> xChild(_xSection.get());
549cdf0e10cSrcweir 	    m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),
550cdf0e10cSrcweir 		    xChild), m_pImpl->m_aSections.end());
551cdf0e10cSrcweir 	    Reference< XInterface >  xInt(_xSection);
552cdf0e10cSrcweir 	    RemoveElement(xInt);
553cdf0e10cSrcweir     }
554cdf0e10cSrcweir     catch(uno::Exception&){}
555cdf0e10cSrcweir }
556cdf0e10cSrcweir 
557cdf0e10cSrcweir //------------------------------------------------------------------------------
TogglePropertyListening(const Reference<XInterface> & Element)558cdf0e10cSrcweir void OXUndoEnvironment::TogglePropertyListening(const Reference< XInterface > & Element)
559cdf0e10cSrcweir {
560cdf0e10cSrcweir 	// am Container horchen
561cdf0e10cSrcweir 	Reference< XIndexAccess >  xContainer(Element, UNO_QUERY);
562cdf0e10cSrcweir 	if (xContainer.is())
563cdf0e10cSrcweir 	{
564cdf0e10cSrcweir 		Reference< XInterface > xInterface;
565cdf0e10cSrcweir 		sal_Int32 nCount = xContainer->getCount();
566cdf0e10cSrcweir 		for(sal_Int32 i = 0;i != nCount;++i)
567cdf0e10cSrcweir 		{
568cdf0e10cSrcweir 			xInterface.set(xContainer->getByIndex( i ),uno::UNO_QUERY);
569cdf0e10cSrcweir 			TogglePropertyListening(xInterface);
570cdf0e10cSrcweir 		}
571cdf0e10cSrcweir 	}
572cdf0e10cSrcweir 
573cdf0e10cSrcweir 	Reference< XPropertySet >  xSet(Element, UNO_QUERY);
574cdf0e10cSrcweir 	if (xSet.is())
575cdf0e10cSrcweir 	{
576cdf0e10cSrcweir 		if (!m_pImpl->m_bReadOnly)
577cdf0e10cSrcweir 			xSet->addPropertyChangeListener( ::rtl::OUString(), this );
578cdf0e10cSrcweir 		else
579cdf0e10cSrcweir 			xSet->removePropertyChangeListener( ::rtl::OUString(), this );
580cdf0e10cSrcweir 	}
581cdf0e10cSrcweir }
582cdf0e10cSrcweir 
583cdf0e10cSrcweir 
584cdf0e10cSrcweir //------------------------------------------------------------------------------
switchListening(const Reference<XIndexAccess> & _rxContainer,bool _bStartListening)585cdf0e10cSrcweir void OXUndoEnvironment::switchListening( const Reference< XIndexAccess >& _rxContainer, bool _bStartListening ) SAL_THROW(())
586cdf0e10cSrcweir {
587cdf0e10cSrcweir     OSL_PRECOND( _rxContainer.is(), "OXUndoEnvironment::switchListening: invalid container!" );
588cdf0e10cSrcweir     if ( !_rxContainer.is() )
589cdf0e10cSrcweir         return;
590cdf0e10cSrcweir 
591cdf0e10cSrcweir     try
592cdf0e10cSrcweir     {
593cdf0e10cSrcweir         // also handle all children of this element
594cdf0e10cSrcweir 		Reference< XInterface > xInterface;
595cdf0e10cSrcweir         sal_Int32 nCount = _rxContainer->getCount();
596cdf0e10cSrcweir 		for(sal_Int32 i = 0;i != nCount;++i)
597cdf0e10cSrcweir 		{
598cdf0e10cSrcweir 			xInterface.set(_rxContainer->getByIndex( i ),uno::UNO_QUERY);
599cdf0e10cSrcweir             if ( _bStartListening )
600cdf0e10cSrcweir 		        AddElement( xInterface );
601cdf0e10cSrcweir             else
602cdf0e10cSrcweir 		        RemoveElement( xInterface );
603cdf0e10cSrcweir 	    }
604cdf0e10cSrcweir 
605cdf0e10cSrcweir         // be notified of any changes in the container elements
606cdf0e10cSrcweir 	    Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY );
607cdf0e10cSrcweir         // OSL_ENSURE( xSimpleContainer.is(), "OXUndoEnvironment::switchListening: how are we expected to be notified of changes in the container?" );
608cdf0e10cSrcweir 	    if ( xSimpleContainer.is() )
609cdf0e10cSrcweir         {
610cdf0e10cSrcweir             if ( _bStartListening )
611cdf0e10cSrcweir 		        xSimpleContainer->addContainerListener( this );
612cdf0e10cSrcweir             else
613cdf0e10cSrcweir 		        xSimpleContainer->removeContainerListener( this );
614cdf0e10cSrcweir         }
615cdf0e10cSrcweir     }
616cdf0e10cSrcweir     catch( const Exception& )
617cdf0e10cSrcweir     {
618cdf0e10cSrcweir     	DBG_UNHANDLED_EXCEPTION();
619cdf0e10cSrcweir     }
620cdf0e10cSrcweir }
621cdf0e10cSrcweir 
622cdf0e10cSrcweir //------------------------------------------------------------------------------
switchListening(const Reference<XInterface> & _rxObject,bool _bStartListening)623cdf0e10cSrcweir void OXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening ) SAL_THROW(())
624cdf0e10cSrcweir {
625cdf0e10cSrcweir     OSL_PRECOND( _rxObject.is(), "OXUndoEnvironment::switchListening: how should I listen at a NULL object?" );
626cdf0e10cSrcweir 
627cdf0e10cSrcweir     try
628cdf0e10cSrcweir     {
629cdf0e10cSrcweir         if ( !m_pImpl->m_bReadOnly )
630cdf0e10cSrcweir         {
631cdf0e10cSrcweir             Reference< XPropertySet > xProps( _rxObject, UNO_QUERY );
632cdf0e10cSrcweir 	        if ( xProps.is() )
633cdf0e10cSrcweir             {
634cdf0e10cSrcweir                 if ( _bStartListening )
635cdf0e10cSrcweir     		        xProps->addPropertyChangeListener( ::rtl::OUString(), this );
636cdf0e10cSrcweir                 else
637cdf0e10cSrcweir     	    	    xProps->removePropertyChangeListener( ::rtl::OUString(), this );
638cdf0e10cSrcweir             }
639cdf0e10cSrcweir         }
640cdf0e10cSrcweir 
641cdf0e10cSrcweir         Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY );
642cdf0e10cSrcweir         if ( xBroadcaster.is() )
643cdf0e10cSrcweir         {
644cdf0e10cSrcweir             if ( _bStartListening )
645cdf0e10cSrcweir                 xBroadcaster->addModifyListener( this );
646cdf0e10cSrcweir             else
647cdf0e10cSrcweir                 xBroadcaster->removeModifyListener( this );
648cdf0e10cSrcweir         }
649cdf0e10cSrcweir     }
650cdf0e10cSrcweir     catch( const Exception& )
651cdf0e10cSrcweir     {
652cdf0e10cSrcweir     	//OSL_ENSURE( sal_False, "OXUndoEnvironment::switchListening: caught an exception!" );
653cdf0e10cSrcweir     }
654cdf0e10cSrcweir }
655cdf0e10cSrcweir 
656cdf0e10cSrcweir //------------------------------------------------------------------------------
AddElement(const Reference<XInterface> & _rxElement)657cdf0e10cSrcweir void OXUndoEnvironment::AddElement(const Reference< XInterface >& _rxElement )
658cdf0e10cSrcweir {
659cdf0e10cSrcweir 	if ( !IsLocked() )
660cdf0e10cSrcweir 		m_pImpl->m_aFormatNormalizer.notifyElementInserted( _rxElement );
661cdf0e10cSrcweir 
662cdf0e10cSrcweir     // if it's a container, start listening at all elements
663cdf0e10cSrcweir     Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY );
664cdf0e10cSrcweir 	if ( xContainer.is() )
665cdf0e10cSrcweir         switchListening( xContainer, true );
666cdf0e10cSrcweir 
667cdf0e10cSrcweir     switchListening( _rxElement, true );
668cdf0e10cSrcweir }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir //------------------------------------------------------------------------------
RemoveElement(const Reference<XInterface> & _rxElement)671cdf0e10cSrcweir void OXUndoEnvironment::RemoveElement(const Reference< XInterface >& _rxElement)
672cdf0e10cSrcweir {
673cdf0e10cSrcweir     uno::Reference<beans::XPropertySet> xProp(_rxElement,uno::UNO_QUERY);
674cdf0e10cSrcweir     if (!m_pImpl->m_aPropertySetCache.empty())
675cdf0e10cSrcweir         m_pImpl->m_aPropertySetCache.erase(xProp);
676cdf0e10cSrcweir     switchListening( _rxElement, false );
677cdf0e10cSrcweir 
678cdf0e10cSrcweir 	Reference< XIndexAccess > xContainer( _rxElement, UNO_QUERY );
679cdf0e10cSrcweir     if ( xContainer.is() )
680cdf0e10cSrcweir         switchListening( xContainer, false );
681cdf0e10cSrcweir }
682cdf0e10cSrcweir 
SetUndoMode(sal_Bool _bUndo)683cdf0e10cSrcweir void OXUndoEnvironment::SetUndoMode(sal_Bool _bUndo)
684cdf0e10cSrcweir {
685cdf0e10cSrcweir     m_pImpl->m_bIsUndo = _bUndo;
686cdf0e10cSrcweir }
687cdf0e10cSrcweir 
IsUndoMode() const688cdf0e10cSrcweir sal_Bool OXUndoEnvironment::IsUndoMode() const
689cdf0e10cSrcweir {
690cdf0e10cSrcweir     return m_pImpl->m_bIsUndo;
691cdf0e10cSrcweir }
692cdf0e10cSrcweir //============================================================================
693cdf0e10cSrcweir } // rptui
694cdf0e10cSrcweir //============================================================================
695