LibreOffice Module svx (master)  1
fmundo.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <sal/config.h>
21 
22 #include <map>
23 
24 #include <sal/macros.h>
25 #include <fmundo.hxx>
26 #include <fmpgeimp.hxx>
27 #include <svx/svditer.hxx>
28 #include <fmobj.hxx>
29 #include <fmprop.hxx>
30 #include <svx/strings.hrc>
31 #include <svx/dialmgr.hxx>
32 #include <svx/fmmodel.hxx>
33 #include <svx/fmpage.hxx>
34 
35 #include <com/sun/star/util/XModifyBroadcaster.hpp>
36 #include <com/sun/star/beans/PropertyAttribute.hpp>
37 #include <com/sun/star/container/XContainer.hpp>
38 #include <com/sun/star/container/XContainerListener.hpp>
39 #include <com/sun/star/script/XEventAttacherManager.hpp>
40 #include <com/sun/star/form/binding/XBindableValue.hpp>
41 #include <com/sun/star/form/binding/XListEntrySink.hpp>
42 #include <com/sun/star/sdbc/XConnection.hpp>
43 #include <com/sun/star/uno/XComponentContext.hpp>
44 
45 #include <svx/fmtools.hxx>
46 #include <tools/debug.hxx>
47 #include <tools/diagnose_ex.h>
48 #include <sfx2/objsh.hxx>
49 #include <sfx2/event.hxx>
50 #include <osl/mutex.hxx>
51 #include <comphelper/property.hxx>
52 #include <comphelper/types.hxx>
53 #include <connectivity/dbtools.hxx>
54 #include <vcl/svapp.hxx>
55 
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::awt;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::container;
60 using namespace ::com::sun::star::script;
61 using namespace ::com::sun::star::lang;
62 using namespace ::com::sun::star::form;
63 using namespace ::com::sun::star::util;
64 using namespace ::com::sun::star::form::binding;
65 using namespace ::com::sun::star::sdbc;
66 using namespace ::svxform;
67 using namespace ::dbtools;
68 
69 
70 #include <com/sun/star/script/XScriptListener.hpp>
72 #include <cppuhelper/implbase.hxx>
73 
74 namespace {
75 
76 class ScriptEventListenerWrapper : public cppu::WeakImplHelper< XScriptListener >
77 {
78 public:
80  explicit ScriptEventListenerWrapper( FmFormModel& _rModel)
81  :m_rModel( _rModel )
82  ,m_attemptedListenerCreation( false )
83  {
84 
85  }
86  // XEventListener
87  virtual void SAL_CALL disposing(const EventObject& ) override {}
88 
89  // XScriptListener
90  virtual void SAL_CALL firing(const ScriptEvent& evt) override
91  {
92  attemptListenerCreation();
93  if ( m_vbaListener.is() )
94  {
95  m_vbaListener->firing( evt );
96  }
97  }
98 
99  virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) override
100  {
101  attemptListenerCreation();
102  if ( m_vbaListener.is() )
103  {
104  return m_vbaListener->approveFiring( evt );
105  }
106  return Any();
107  }
108 
109 private:
110  void attemptListenerCreation()
111  {
112  if ( m_attemptedListenerCreation )
113  return;
114  m_attemptedListenerCreation = true;
115 
116  try
117  {
118  css::uno::Reference<css::uno::XComponentContext> context(
120  Reference< XScriptListener > const xScriptListener(
121  context->getServiceManager()->createInstanceWithContext(
122  "ooo.vba.EventListener", context),
123  UNO_QUERY_THROW);
124  Reference< XPropertySet > const xListenerProps( xScriptListener, UNO_QUERY_THROW );
125  // SfxObjectShellRef is good here since the model controls the lifetime of the shell
126  SfxObjectShellRef const xObjectShell = m_rModel.GetObjectShell();
127  ENSURE_OR_THROW( xObjectShell.is(), "no object shell!" );
128  xListenerProps->setPropertyValue("Model", makeAny( xObjectShell->GetModel() ) );
129 
130  m_vbaListener = xScriptListener;
131  }
132  catch( Exception const & )
133  {
135  }
136  }
138  Reference< XScriptListener > m_vbaListener;
139  bool m_attemptedListenerCreation;
140 
141 
142 };
143 
144 
145 // some helper structs for caching property infos
146 
147 struct PropertyInfo
148 {
149  bool bIsTransientOrReadOnly : 1; // the property is transient or read-only, thus we need no undo action for it
150  bool bIsValueProperty : 1; // the property is the special value property, thus it may be handled
151  // as if it's transient or persistent
152 };
153 
154 struct PropertySetInfo
155 {
156  typedef std::map<OUString, PropertyInfo> AllProperties;
157 
158  AllProperties aProps; // all properties of this set which we know so far
159  bool bHasEmptyControlSource; // sal_True -> the set has a DataField property, and the current value is an empty string
160  // sal_False -> the set has _no_ such property or its value isn't empty
161 };
162 
163 }
164 
165 typedef std::map<Reference< XPropertySet >, PropertySetInfo> PropertySetInfoCache;
166 
167 
168 static OUString static_STR_UNDO_PROPERTY;
169 
170 
172  :rModel( _rModel )
173  ,m_pPropertySetCache( nullptr )
174  ,m_pScriptingEnv( new svxform::FormScriptingEnvironment( _rModel ) )
175  ,m_Locks( 0 )
176  ,bReadOnly( false )
177  ,m_bDisposed( false )
178 {
179  try
180  {
181  m_vbaListener = new ScriptEventListenerWrapper( _rModel );
182  }
183  catch( Exception& )
184  {
185  }
186 }
187 
189 {
190  if ( !m_bDisposed ) // i120746, call FormScriptingEnvironment::dispose to avoid memory leak
191  m_pScriptingEnv->dispose();
192 
194  delete static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
195 }
196 
198 {
199  OSL_ENSURE( !m_bDisposed, "FmXUndoEnvironment::dispose: disposed twice?" );
200  if ( !m_bDisposed )
201  return;
202 
203  Lock();
204 
205  sal_uInt16 nCount = rModel.GetPageCount();
206  sal_uInt16 i;
207  for (i = 0; i < nCount; i++)
208  {
209  FmFormPage* pPage = dynamic_cast<FmFormPage*>( rModel.GetPage(i) );
210  if ( pPage )
211  {
212  Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
213  if ( xForms.is() )
214  RemoveElement( xForms );
215  }
216  }
217 
218  nCount = rModel.GetMasterPageCount();
219  for (i = 0; i < nCount; i++)
220  {
221  FmFormPage* pPage = dynamic_cast<FmFormPage*>( rModel.GetMasterPage(i) );
222  if ( pPage )
223  {
224  Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
225  if ( xForms.is() )
226  RemoveElement( xForms );
227  }
228  }
229 
230  UnLock();
231 
232  OSL_PRECOND( rModel.GetObjectShell(), "FmXUndoEnvironment::dispose: no object shell anymore!" );
233  if ( rModel.GetObjectShell() )
235 
236  if ( IsListening( rModel ) )
237  EndListening( rModel );
238 
239  m_pScriptingEnv->dispose();
240 
241  m_bDisposed = true;
242 }
243 
244 
246 {
247  OSL_PRECOND( rModel.GetObjectShell(), "FmXUndoEnvironment::ModeChanged: no object shell anymore!" );
248  if ( !rModel.GetObjectShell() )
249  return;
250 
252  {
253  bReadOnly = !bReadOnly;
254 
255  sal_uInt16 nCount = rModel.GetPageCount();
256  sal_uInt16 i;
257  for (i = 0; i < nCount; i++)
258  {
259  FmFormPage* pPage = dynamic_cast<FmFormPage*>( rModel.GetPage(i) );
260  if ( pPage )
261  {
262  Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
263  if ( xForms.is() )
264  TogglePropertyListening( xForms );
265  }
266  }
267 
268  nCount = rModel.GetMasterPageCount();
269  for (i = 0; i < nCount; i++)
270  {
271  FmFormPage* pPage = dynamic_cast<FmFormPage*>( rModel.GetMasterPage(i) );
272  if ( pPage )
273  {
274  Reference< css::form::XForms > xForms = pPage->GetForms( false ).get();
275  if ( xForms.is() )
276  TogglePropertyListening( xForms );
277  }
278  }
279 
280  if (!bReadOnly)
282  else
284  }
285 }
286 
287 
288 void FmXUndoEnvironment::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
289 {
290  if (rHint.GetId() == SfxHintId::ThisIsAnSdrHint)
291  {
292  const SdrHint* pSdrHint = static_cast<const SdrHint*>(&rHint);
293  switch (pSdrHint->GetKind())
294  {
296  {
297  SdrObject* pSdrObj = const_cast<SdrObject*>(pSdrHint->GetObject());
298  Inserted( pSdrObj );
299  } break;
301  {
302  SdrObject* pSdrObj = const_cast<SdrObject*>(pSdrHint->GetObject());
303  Removed( pSdrObj );
304  }
305  break;
306  default:
307  break;
308  }
309  }
310  else if (rHint.GetId() != SfxHintId::NONE)
311  {
312  switch (rHint.GetId())
313  {
314  case SfxHintId::Dying:
315  dispose();
316  rModel.SetObjectShell( nullptr );
317  break;
318  case SfxHintId::ModeChanged:
319  ModeChanged();
320  break;
321  default: break;
322  }
323  }
324  else if (const SfxEventHint* pEventHint = dynamic_cast<const SfxEventHint*>(&rHint))
325  {
326  switch (pEventHint->GetEventId())
327  {
328  case SfxEventHintId::CreateDoc:
329  case SfxEventHintId::OpenDoc:
330  ModeChanged();
331  break;
332  default: break;
333  }
334  }
335 }
336 
338 {
339  if (pObj->GetObjInventor() == SdrInventor::FmForm)
340  {
341  FmFormObj* pFormObj = dynamic_cast<FmFormObj*>( pObj );
342  Inserted( pFormObj );
343  }
344  else if (pObj->IsGroupObject())
345  {
346  SdrObjListIter aIter(pObj->GetSubList());
347  while ( aIter.IsMore() )
348  Inserted( aIter.Next() );
349  }
350 }
351 
352 
353 namespace
354 {
355  bool lcl_searchElement(const Reference< XIndexAccess>& xCont, const Reference< XInterface >& xElement)
356  {
357  if (!xCont.is() || !xElement.is())
358  return false;
359 
360  sal_Int32 nCount = xCont->getCount();
362  for (sal_Int32 i = 0; i < nCount; i++)
363  {
364  try
365  {
366  xCont->getByIndex(i) >>= xComp;
367  if (xComp.is())
368  {
369  if ( xElement == xComp )
370  return true;
371  else
372  {
373  Reference< XIndexAccess> xCont2(xComp, UNO_QUERY);
374  if (xCont2.is() && lcl_searchElement(xCont2, xElement))
375  return true;
376  }
377  }
378  }
379  catch(const Exception&)
380  {
382  }
383  }
384  return false;
385  }
386 }
387 
388 
389 void FmXUndoEnvironment::Inserted(FmFormObj* pObj)
390 {
391  DBG_ASSERT( pObj, "FmXUndoEnvironment::Inserted: invalid object!" );
392  if ( !pObj )
393  return;
394 
395  // is the control still assigned to a form
396  Reference< XInterface > xModel(pObj->GetUnoControlModel(), UNO_QUERY);
397  Reference< XFormComponent > xContent(xModel, UNO_QUERY);
398  if (xContent.is() && pObj->getSdrPageFromSdrObject())
399  {
400  // if the component doesn't belong to a form, yet, find one to insert into
401  if (!xContent->getParent().is())
402  {
403  try
404  {
405  const Reference< XIndexContainer >& xObjectParent = pObj->GetOriginalParent();
406 
407  FmFormPage& rPage(dynamic_cast< FmFormPage& >( *pObj->getSdrPageFromSdrObject()));
408  Reference< XIndexAccess > xForms( rPage.GetForms(), UNO_QUERY_THROW );
409 
410  Reference< XIndexContainer > xNewParent;
411  Reference< XForm > xForm;
412  sal_Int32 nPos = -1;
413  if ( lcl_searchElement( xForms, xObjectParent ) )
414  {
415  // the form which was the parent of the object when it was removed is still
416  // part of the form component hierarchy of the current page
417  xNewParent = xObjectParent;
418  xForm.set( xNewParent, UNO_QUERY_THROW );
419  nPos = ::std::min( pObj->GetOriginalIndex(), xNewParent->getCount() );
420  }
421  else
422  {
423  xForm.set( rPage.GetImpl().findPlaceInFormComponentHierarchy( xContent ), UNO_SET_THROW );
424  xNewParent.set( xForm, UNO_QUERY_THROW );
425  nPos = xNewParent->getCount();
426  }
427 
428  FmFormPageImpl::setUniqueName( xContent, xForm );
429  xNewParent->insertByIndex( nPos, makeAny( xContent ) );
430 
431  Reference< XEventAttacherManager > xManager( xNewParent, UNO_QUERY_THROW );
432  xManager->registerScriptEvents( nPos, pObj->GetOriginalEvents() );
433  }
434  catch( const Exception& )
435  {
437  }
438  }
439 
440  // reset FormObject
441  pObj->ClearObjEnv();
442  }
443 }
444 
445 
447 {
448  if ( pObj->IsVirtualObj() )
449  // for virtual objects, we've already been notified of the removal of the master
450  // object, which is sufficient here
451  return;
452 
453  if (pObj->GetObjInventor() == SdrInventor::FmForm)
454  {
455  FmFormObj* pFormObj = dynamic_cast<FmFormObj*>( pObj );
456  Removed(pFormObj);
457  }
458  else if (pObj->IsGroupObject())
459  {
460  SdrObjListIter aIter(pObj->GetSubList());
461  while ( aIter.IsMore() )
462  Removed( aIter.Next() );
463  }
464 }
465 
466 
467 void FmXUndoEnvironment::Removed(FmFormObj* pObj)
468 {
469  DBG_ASSERT( pObj, "FmXUndoEnvironment::Removed: invalid object!" );
470  if ( !pObj )
471  return;
472 
473  // is the control still assigned to a form
474  Reference< XFormComponent > xContent(pObj->GetUnoControlModel(), UNO_QUERY);
475  if (xContent.is())
476  {
477  // The object is taken out of a list.
478  // If a father exists, the object is removed at the father and
479  // noted at the FormObject!
480 
481  // If the object is reinserted and a parent exists, this parent is set though.
482  Reference< XIndexContainer > xForm(xContent->getParent(), UNO_QUERY);
483  if (xForm.is())
484  {
485  Reference< XIndexAccess > xIndexAccess(xForm.get());
486  // determine which position the child was at
487  const sal_Int32 nPos = getElementPos(xIndexAccess, xContent);
488  if (nPos >= 0)
489  {
490  Sequence< ScriptEventDescriptor > aEvts;
491  Reference< XEventAttacherManager > xManager(xForm, UNO_QUERY);
492  if (xManager.is())
493  aEvts = xManager->getScriptEvents(nPos);
494 
495  try
496  {
497  pObj->SetObjEnv(xForm, nPos, aEvts);
498  xForm->removeByIndex(nPos);
499  }
500  catch(Exception&)
501  {
503  }
504 
505  }
506  }
507  }
508 }
509 
510 // XEventListener
511 
512 void SAL_CALL FmXUndoEnvironment::disposing(const EventObject& e)
513 {
514  // check if it's an object we have cached information about
516  {
517  Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY);
518  if (xSourceSet.is())
519  {
520  PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
521  PropertySetInfoCache::iterator aSetPos = pCache->find(xSourceSet);
522  if (aSetPos != pCache->end())
523  pCache->erase(aSetPos);
524  }
525  }
526 }
527 
528 // XPropertyChangeListener
529 
530 void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
531 {
532  ::osl::ClearableMutexGuard aGuard( m_aMutex );
533 
534  if (!IsLocked())
535  {
536  Reference< XPropertySet > xSet(evt.Source, UNO_QUERY);
537  if (!xSet.is())
538  return;
539 
540  // if it's a "default value" property of a control model, set the according "value" property
541  static const OUStringLiteral pDefaultValueProperties[] = {
544  };
545  static const OUStringLiteral aValueProperties[] = {
548  };
549  sal_Int32 nDefaultValueProps = SAL_N_ELEMENTS(pDefaultValueProperties);
550  OSL_ENSURE(SAL_N_ELEMENTS(aValueProperties) == nDefaultValueProps,
551  "FmXUndoEnvironment::propertyChange: inconsistence!");
552  for (sal_Int32 i=0; i<nDefaultValueProps; ++i)
553  {
554  if (evt.PropertyName == pDefaultValueProperties[i])
555  {
556  try
557  {
558  xSet->setPropertyValue(aValueProperties[i], evt.NewValue);
559  }
560  catch(const Exception&)
561  {
562  OSL_FAIL("FmXUndoEnvironment::propertyChange: could not adjust the value property!");
563  }
564  }
565  }
566 
567  // no Undo for transient and readonly props. But unfortunately "transient" is not only that the
568  // "transient" flag is set for the property in question, instead it is somewhat more complex
569  // Transience criterions are:
570  // - the "transient" flag is set for the property
571  // - OR the control has a non-empty COntrolSource property, i.e. is intended to be bound
572  // to a database column. Note that it doesn't matter here whether the control actually
573  // *is* bound to a column
574  // - OR the control is bound to an external value via XBindableValue/XValueBinding
575  // which does not have a "ExternalData" property being <TRUE/>
576 
577  if (!m_pPropertySetCache)
579  PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
580 
581  // let's see if we know something about the set
582  PropertySetInfoCache::iterator aSetPos = pCache->find(xSet);
583  if (aSetPos == pCache->end())
584  {
585  PropertySetInfo aNewEntry;
587  {
588  aNewEntry.bHasEmptyControlSource = false;
589  }
590  else
591  {
592  try
593  {
594  Any aCurrentControlSource = xSet->getPropertyValue(FM_PROP_CONTROLSOURCE);
595  aNewEntry.bHasEmptyControlSource = !aCurrentControlSource.hasValue() || ::comphelper::getString(aCurrentControlSource).isEmpty();
596  }
597  catch(const Exception&)
598  {
600  }
601  }
602  aSetPos = pCache->emplace(xSet,aNewEntry).first;
603  DBG_ASSERT(aSetPos != pCache->end(), "FmXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
604  }
605  else
606  { // is it the DataField property ?
607  if (evt.PropertyName == FM_PROP_CONTROLSOURCE)
608  {
609  aSetPos->second.bHasEmptyControlSource = !evt.NewValue.hasValue() || ::comphelper::getString(evt.NewValue).isEmpty();
610  }
611  }
612 
613  // now we have access to the cached info about the set
614  // let's see what we know about the property
615  PropertySetInfo::AllProperties& rPropInfos = aSetPos->second.aProps;
616  PropertySetInfo::AllProperties::iterator aPropertyPos = rPropInfos.find(evt.PropertyName);
617  if (aPropertyPos == rPropInfos.end())
618  { // nothing 'til now ... have to change this...
619  PropertyInfo aNewEntry;
620 
621  // the attributes
622  sal_Int32 nAttributes = xSet->getPropertySetInfo()->getPropertyByName(evt.PropertyName).Attributes;
623  aNewEntry.bIsTransientOrReadOnly = ((nAttributes & PropertyAttribute::READONLY) != 0) || ((nAttributes & PropertyAttribute::TRANSIENT) != 0);
624 
625  // check if it is the special "DataFieldProperty"
626  aNewEntry.bIsValueProperty = false;
627  try
628  {
630  {
631  Any aControlSourceProperty = xSet->getPropertyValue(FM_PROP_CONTROLSOURCEPROPERTY);
632  OUString sControlSourceProperty;
633  aControlSourceProperty >>= sControlSourceProperty;
634 
635  aNewEntry.bIsValueProperty = (sControlSourceProperty == evt.PropertyName);
636  }
637  }
638  catch(const Exception&)
639  {
641  }
642 
643  // insert the new entry
644  aPropertyPos = rPropInfos.emplace(evt.PropertyName,aNewEntry).first;
645  DBG_ASSERT(aPropertyPos != rPropInfos.end(), "FmXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
646  }
647 
648  // now we have access to the cached info about the property affected
649  // and are able to decide whether or not we need an undo action
650 
651  bool bAddUndoAction = rModel.IsUndoEnabled();
652  // no UNDO for transient/readonly properties
653  if ( bAddUndoAction && aPropertyPos->second.bIsTransientOrReadOnly )
654  bAddUndoAction = false;
655 
656  if ( bAddUndoAction && aPropertyPos->second.bIsValueProperty )
657  {
658  // no UNDO when the "value" property changes, but the ControlSource is non-empty
659  // (in this case the control is intended to be bound to a database column)
660  if ( !aSetPos->second.bHasEmptyControlSource )
661  bAddUndoAction = false;
662 
663  // no UNDO if the control is currently bound to an external value
664  if ( bAddUndoAction )
665  {
666  Reference< XBindableValue > xBindable( evt.Source, UNO_QUERY );
667  Reference< XValueBinding > xBinding;
668  if ( xBindable.is() )
669  xBinding = xBindable->getValueBinding();
670 
671  Reference< XPropertySet > xBindingProps;
672  Reference< XPropertySetInfo > xBindingPropsPSI;
673  if ( xBindable.is() )
674  xBindingProps.set( xBinding, UNO_QUERY );
675  if ( xBindingProps.is() )
676  xBindingPropsPSI = xBindingProps->getPropertySetInfo();
677  // TODO: we should cache all those things, else this might be too expensive.
678  // However, this requires we're notified of changes in the value binding
679 
680  static const char s_sExternalData[] = "ExternalData";
681  if ( xBindingPropsPSI.is() && xBindingPropsPSI->hasPropertyByName( s_sExternalData ) )
682  {
683  bool bExternalData = true;
684  OSL_VERIFY( xBindingProps->getPropertyValue( s_sExternalData ) >>= bExternalData );
685  bAddUndoAction = !bExternalData;
686  }
687  else
688  bAddUndoAction = !xBinding.is();
689  }
690  }
691 
692  if ( bAddUndoAction && ( evt.PropertyName == FM_PROP_STRINGITEMLIST ) )
693  {
694  Reference< XListEntrySink > xSink( evt.Source, UNO_QUERY );
695  if ( xSink.is() && xSink->getListEntrySource().is() )
696  // #i41029# / 2005-01-31 / frank.schoenheit@sun.com
697  bAddUndoAction = false;
698  }
699 
700  if ( bAddUndoAction )
701  {
702  aGuard.clear();
703  // TODO: this is a potential race condition: two threads here could in theory
704  // add their undo actions out-of-order
705 
706  SolarMutexGuard aSolarGuard;
707  rModel.AddUndo(std::make_unique<FmUndoPropertyAction>(rModel, evt));
708  }
709  }
710  else
711  {
712  // if it's the DataField property we may have to adjust our cache
713  if (m_pPropertySetCache && evt.PropertyName == FM_PROP_CONTROLSOURCE)
714  {
715  Reference< XPropertySet > xSet(evt.Source, UNO_QUERY);
716  PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
717  PropertySetInfo& rSetInfo = (*pCache)[xSet];
718  rSetInfo.bHasEmptyControlSource = !evt.NewValue.hasValue() || ::comphelper::getString(evt.NewValue).isEmpty();
719  }
720  }
721 }
722 
723 // XContainerListener
724 
725 void SAL_CALL FmXUndoEnvironment::elementInserted(const ContainerEvent& evt)
726 {
727  SolarMutexGuard aSolarGuard;
728  ::osl::MutexGuard aGuard( m_aMutex );
729 
730  // new object for listening
732  evt.Element >>= xIface;
733  OSL_ENSURE(xIface.is(), "FmXUndoEnvironment::elementInserted: invalid container notification!");
734  AddElement(xIface);
735 
736  implSetModified();
737 }
738 
739 
741 {
742  if ( !IsLocked() && rModel.GetObjectShell() )
743  {
745  }
746 }
747 
748 
749 void SAL_CALL FmXUndoEnvironment::elementReplaced(const ContainerEvent& evt)
750 {
751  SolarMutexGuard aSolarGuard;
752  ::osl::MutexGuard aGuard( m_aMutex );
753 
755  evt.ReplacedElement >>= xIface;
756  OSL_ENSURE(xIface.is(), "FmXUndoEnvironment::elementReplaced: invalid container notification!");
757  RemoveElement(xIface);
758 
759  evt.Element >>= xIface;
760  AddElement(xIface);
761 
762  implSetModified();
763 }
764 
765 
766 void SAL_CALL FmXUndoEnvironment::elementRemoved(const ContainerEvent& evt)
767 {
768  SolarMutexGuard aSolarGuard;
769  ::osl::MutexGuard aGuard( m_aMutex );
770 
771  Reference< XInterface > xIface( evt.Element, UNO_QUERY );
772  OSL_ENSURE(xIface.is(), "FmXUndoEnvironment::elementRemoved: invalid container notification!");
773  RemoveElement(xIface);
774 
775  implSetModified();
776 }
777 
778 
779 void SAL_CALL FmXUndoEnvironment::modified( const EventObject& /*aEvent*/ )
780 {
781  implSetModified();
782 }
783 
784 
785 void FmXUndoEnvironment::AddForms(const Reference< XNameContainer > & rForms)
786 {
787  Lock();
788  AddElement(Reference<XInterface>( rForms, UNO_QUERY ));
789  UnLock();
790 }
791 
792 
793 void FmXUndoEnvironment::RemoveForms(const Reference< XNameContainer > & rForms)
794 {
795  Lock();
796  RemoveElement(Reference<XInterface>( rForms, UNO_QUERY ));
797  UnLock();
798 }
799 
800 
802 {
803  // listen at the container
804  Reference< XIndexContainer > xContainer(Element, UNO_QUERY);
805  if (xContainer.is())
806  {
807  sal_uInt32 nCount = xContainer->getCount();
809  for (sal_uInt32 i = 0; i < nCount; i++)
810  {
811  xContainer->getByIndex(i) >>= xIface;
812  TogglePropertyListening(xIface);
813  }
814  }
815 
816  Reference< XPropertySet > xSet(Element, UNO_QUERY);
817  if (xSet.is())
818  {
819  if (!bReadOnly)
820  xSet->addPropertyChangeListener( OUString(), this );
821  else
822  xSet->removePropertyChangeListener( OUString(), this );
823  }
824 }
825 
826 
827 void FmXUndoEnvironment::switchListening( const Reference< XIndexContainer >& _rxContainer, bool _bStartListening )
828 {
829  OSL_PRECOND( _rxContainer.is(), "FmXUndoEnvironment::switchListening: invalid container!" );
830  if ( !_rxContainer.is() )
831  return;
832 
833  try
834  {
835  // if it's an EventAttacherManager, then we need to listen for
836  // script events
837  Reference< XEventAttacherManager > xManager( _rxContainer, UNO_QUERY );
838  if ( xManager.is() )
839  {
840  if ( _bStartListening )
841  {
842  m_pScriptingEnv->registerEventAttacherManager( xManager );
843  if ( m_vbaListener.is() )
844  xManager->addScriptListener( m_vbaListener );
845  }
846  else
847  {
848  m_pScriptingEnv->revokeEventAttacherManager( xManager );
849  if ( m_vbaListener.is() )
850  xManager->removeScriptListener( m_vbaListener );
851  }
852  }
853 
854  // also handle all children of this element
855  sal_uInt32 nCount = _rxContainer->getCount();
856  Reference< XInterface > xInterface;
857  for ( sal_uInt32 i = 0; i < nCount; ++i )
858  {
859  _rxContainer->getByIndex( i ) >>= xInterface;
860  if ( _bStartListening )
861  AddElement( xInterface );
862  else
863  RemoveElement( xInterface );
864  }
865 
866  // be notified of any changes in the container elements
867  Reference< XContainer > xSimpleContainer( _rxContainer, UNO_QUERY );
868  OSL_ENSURE( xSimpleContainer.is(), "FmXUndoEnvironment::switchListening: how are we expected to be notified of changes in the container?" );
869  if ( xSimpleContainer.is() )
870  {
871  if ( _bStartListening )
872  xSimpleContainer->addContainerListener( this );
873  else
874  xSimpleContainer->removeContainerListener( this );
875  }
876  }
877  catch( const Exception& )
878  {
879  TOOLS_WARN_EXCEPTION( "svx", "FmXUndoEnvironment::switchListening" );
880  }
881 }
882 
883 
884 void FmXUndoEnvironment::switchListening( const Reference< XInterface >& _rxObject, bool _bStartListening )
885 {
886  OSL_PRECOND( _rxObject.is(), "FmXUndoEnvironment::switchListening: how should I listen at a NULL object?" );
887 
888  try
889  {
890  if ( !bReadOnly )
891  {
892  Reference< XPropertySet > xProps( _rxObject, UNO_QUERY );
893  if ( xProps.is() )
894  {
895  if ( _bStartListening )
896  xProps->addPropertyChangeListener( OUString(), this );
897  else
898  xProps->removePropertyChangeListener( OUString(), this );
899  }
900  }
901 
902  Reference< XModifyBroadcaster > xBroadcaster( _rxObject, UNO_QUERY );
903  if ( xBroadcaster.is() )
904  {
905  if ( _bStartListening )
906  xBroadcaster->addModifyListener( this );
907  else
908  xBroadcaster->removeModifyListener( this );
909  }
910  }
911  catch( const Exception& )
912  {
913  TOOLS_WARN_EXCEPTION( "svx", "FmXUndoEnvironment::switchListening" );
914  }
915 }
916 
917 
919 {
920  OSL_ENSURE( !m_bDisposed, "FmXUndoEnvironment::AddElement: not when I'm already disposed!" );
921 
922  // listen at the container
923  Reference< XIndexContainer > xContainer( _rxElement, UNO_QUERY );
924  if ( xContainer.is() )
925  switchListening( xContainer, true );
926 
927  switchListening( _rxElement, true );
928 }
929 
930 
932 {
933  if ( m_bDisposed )
934  return;
935 
936  switchListening( _rxElement, false );
937 
938  if (!bReadOnly)
939  {
940  // reset the ActiveConnection if the form is to be removed. This will (should) free the resources
941  // associated with this connection
942  // 86299 - 05/02/2001 - frank.schoenheit@germany.sun.com
943  Reference< XForm > xForm( _rxElement, UNO_QUERY );
944  Reference< XPropertySet > xFormProperties( xForm, UNO_QUERY );
945  if ( xFormProperties.is() )
946  {
947  Reference< XConnection > xDummy;
948  if ( !isEmbeddedInDatabase( _rxElement, xDummy ) )
949  // (if there is a connection in the context of the component, setting
950  // a new connection would be vetoed, anyway)
951  // #i34196#
952  xFormProperties->setPropertyValue( FM_PROP_ACTIVE_CONNECTION, Any() );
953  }
954  }
955 
956  Reference< XIndexContainer > xContainer( _rxElement, UNO_QUERY );
957  if ( xContainer.is() )
958  switchListening( xContainer, false );
959 }
960 
961 
962 FmUndoPropertyAction::FmUndoPropertyAction(FmFormModel& rNewMod, const PropertyChangeEvent& evt)
963  :SdrUndoAction(rNewMod)
964  ,xObj(evt.Source, UNO_QUERY)
965  ,aPropertyName(evt.PropertyName)
966  ,aNewValue(evt.NewValue)
967  ,aOldValue(evt.OldValue)
968 {
969  if (rNewMod.GetObjectShell())
970  rNewMod.GetObjectShell()->SetModified();
971  if(static_STR_UNDO_PROPERTY.isEmpty())
972  static_STR_UNDO_PROPERTY = SvxResId(RID_STR_UNDO_PROPERTY);
973 }
974 
975 
977 {
978  FmXUndoEnvironment& rEnv = static_cast<FmFormModel&>(rMod).GetUndoEnv();
979 
980  if (xObj.is() && !rEnv.IsLocked())
981  {
982  rEnv.Lock();
983  try
984  {
985  xObj->setPropertyValue( aPropertyName, aOldValue );
986  }
987  catch( const Exception& )
988  {
989  TOOLS_WARN_EXCEPTION( "svx", "FmUndoPropertyAction::Undo" );
990  }
991  rEnv.UnLock();
992  }
993 }
994 
995 
997 {
998  FmXUndoEnvironment& rEnv = static_cast<FmFormModel&>(rMod).GetUndoEnv();
999 
1000  if (xObj.is() && !rEnv.IsLocked())
1001  {
1002  rEnv.Lock();
1003  try
1004  {
1005  xObj->setPropertyValue( aPropertyName, aNewValue );
1006  }
1007  catch( const Exception& )
1008  {
1009  TOOLS_WARN_EXCEPTION( "svx", "FmUndoPropertyAction::Redo" );
1010  }
1011  rEnv.UnLock();
1012  }
1013 }
1014 
1015 
1017 {
1018  OUString aStr = static_STR_UNDO_PROPERTY.replaceFirst( "#", aPropertyName );
1019  return aStr;
1020 }
1021 
1022 
1024  Action _eAction,
1025  const Reference< XIndexContainer > & xCont,
1026  const Reference< XInterface > & xElem,
1027  sal_Int32 nIdx)
1028  :SdrUndoAction( _rMod )
1029  ,m_xContainer( xCont )
1030  ,m_nIndex( nIdx )
1031  ,m_eAction( _eAction )
1032 {
1033  OSL_ENSURE( nIdx >= 0, "FmUndoContainerAction::FmUndoContainerAction: invalid index!" );
1034  // some old code suggested this could be a valid argument. However, this code was
1035  // buggy, and it *seemed* that nobody used it - so it was removed.
1036 
1037  if ( xCont.is() && xElem.is() )
1038  {
1039  // normalize
1040  m_xElement = xElem;
1041  if ( m_eAction == Removed )
1042  {
1043  if (m_nIndex >= 0)
1044  {
1045  Reference< XEventAttacherManager > xManager( xCont, UNO_QUERY );
1046  if ( xManager.is() )
1047  m_aEvents = xManager->getScriptEvents(m_nIndex);
1048  }
1049  else
1050  m_xElement = nullptr;
1051 
1052  // we now own the element
1054  }
1055  }
1056 }
1057 
1058 
1060 {
1061  // if we own the object...
1063 }
1064 
1065 
1067 {
1068  Reference< XComponent > xComp( xElem, UNO_QUERY );
1069  if ( xComp.is() )
1070  {
1071  // and the object does not have a parent
1072  Reference< XChild > xChild( xElem, UNO_QUERY );
1073  if ( xChild.is() && !xChild->getParent().is() )
1074  // -> dispose it
1075  xComp->dispose();
1076  }
1077 }
1078 
1079 
1081 {
1082  if ( m_xContainer->getCount() >= m_nIndex )
1083  {
1084  // insert the element
1085  Any aVal;
1086  if ( m_xContainer->getElementType() == cppu::UnoType<XFormComponent>::get() )
1087  {
1088  aVal <<= Reference< XFormComponent >( m_xElement, UNO_QUERY );
1089  }
1090  else
1091  {
1092  aVal <<= Reference< XForm >( m_xElement, UNO_QUERY );
1093  }
1094  m_xContainer->insertByIndex( m_nIndex, aVal );
1095 
1096  OSL_ENSURE( getElementPos( m_xContainer.get(), m_xElement ) == m_nIndex, "FmUndoContainerAction::implReInsert: insertion did not work!" );
1097 
1098  // register the events
1099  Reference< XEventAttacherManager > xManager( m_xContainer, UNO_QUERY );
1100  if ( xManager.is() )
1101  xManager->registerScriptEvents( m_nIndex, m_aEvents );
1102 
1103  // we don't own the object anymore
1104  m_xOwnElement = nullptr;
1105  }
1106 }
1107 
1108 
1110 {
1111  Reference< XInterface > xElement;
1112  if ( ( m_nIndex >= 0 ) && ( m_nIndex < m_xContainer->getCount() ) )
1113  m_xContainer->getByIndex( m_nIndex ) >>= xElement;
1114 
1115  if ( xElement != m_xElement )
1116  {
1117  // the indexes in the container changed. Okay, so go the long way and
1118  // manually determine the index
1120  if ( m_nIndex != -1 )
1121  xElement = m_xElement;
1122  }
1123 
1124  OSL_ENSURE( xElement == m_xElement, "FmUndoContainerAction::implReRemove: cannot find the element which I'm responsible for!" );
1125  if ( xElement == m_xElement )
1126  {
1127  Reference< XEventAttacherManager > xManager( m_xContainer, UNO_QUERY );
1128  if ( xManager.is() )
1129  m_aEvents = xManager->getScriptEvents( m_nIndex );
1130  m_xContainer->removeByIndex( m_nIndex );
1131  // from now on, we own this object
1133  }
1134 }
1135 
1136 
1138 {
1139  FmXUndoEnvironment& rEnv = static_cast< FmFormModel& >( rMod ).GetUndoEnv();
1140 
1141  if ( m_xContainer.is() && !rEnv.IsLocked() && m_xElement.is() )
1142  {
1143  rEnv.Lock();
1144  try
1145  {
1146  switch ( m_eAction )
1147  {
1148  case Inserted:
1149  implReRemove();
1150  break;
1151 
1152  case Removed:
1153  implReInsert();
1154  break;
1155  }
1156  }
1157  catch( const Exception& )
1158  {
1159  TOOLS_WARN_EXCEPTION( "svx", "FmUndoContainerAction::Undo" );
1160  }
1161  rEnv.UnLock();
1162  }
1163 }
1164 
1165 
1167 {
1168  FmXUndoEnvironment& rEnv = static_cast< FmFormModel& >( rMod ).GetUndoEnv();
1169  if ( m_xContainer.is() && !rEnv.IsLocked() && m_xElement.is() )
1170  {
1171  rEnv.Lock();
1172  try
1173  {
1174  switch ( m_eAction )
1175  {
1176  case Inserted:
1177  implReInsert();
1178  break;
1179 
1180  case Removed:
1181  implReRemove();
1182  break;
1183  }
1184  }
1185  catch( const Exception& )
1186  {
1187  TOOLS_WARN_EXCEPTION( "svx", "FmUndoContainerAction::Redo" );
1188  }
1189  rEnv.UnLock();
1190  }
1191 }
1192 
1193 
1194 FmUndoModelReplaceAction::FmUndoModelReplaceAction(FmFormModel& _rMod, SdrUnoObj* _pObject, const Reference< XControlModel > & _xReplaced)
1195  :SdrUndoAction(_rMod)
1196  ,m_xReplaced(_xReplaced)
1197  ,m_pObject(_pObject)
1198 {
1199 }
1200 
1201 
1203 {
1204  // dispose our element if nobody else is responsible for
1206 }
1207 
1208 
1209 void FmUndoModelReplaceAction::DisposeElement( const css::uno::Reference< css::awt::XControlModel>& xReplaced )
1210 {
1211  Reference< XComponent > xComp(xReplaced, UNO_QUERY);
1212  if (xComp.is())
1213  {
1214  Reference< XChild > xChild(xReplaced, UNO_QUERY);
1215  if (!xChild.is() || !xChild->getParent().is())
1216  xComp->dispose();
1217  }
1218 }
1219 
1220 
1222 {
1223  try
1224  {
1225  Reference< XControlModel > xCurrentModel( m_pObject->GetUnoControlModel() );
1226 
1227  // replace the model within the parent
1228  Reference< XChild > xCurrentAsChild( xCurrentModel, UNO_QUERY );
1229  Reference< XNameContainer > xCurrentsParent;
1230  if ( xCurrentAsChild.is() )
1231  xCurrentsParent.set(xCurrentAsChild->getParent(), css::uno::UNO_QUERY);
1232  DBG_ASSERT( xCurrentsParent.is(), "FmUndoModelReplaceAction::Undo: invalid current model!" );
1233 
1234  if ( xCurrentsParent.is() )
1235  {
1236  // the form container works with FormComponents
1237  Reference< XFormComponent > xComponent( m_xReplaced, UNO_QUERY );
1238  DBG_ASSERT( xComponent.is(), "FmUndoModelReplaceAction::Undo: the new model is no form component !" );
1239 
1240  Reference< XPropertySet > xCurrentAsSet( xCurrentModel, UNO_QUERY );
1241  DBG_ASSERT( ::comphelper::hasProperty(FM_PROP_NAME, xCurrentAsSet ), "FmUndoModelReplaceAction::Undo : one of the models is invalid !");
1242 
1243  OUString sName;
1244  xCurrentAsSet->getPropertyValue( FM_PROP_NAME ) >>= sName;
1245  xCurrentsParent->replaceByName( sName, makeAny( xComponent ) );
1246 
1248  m_pObject->SetChanged();
1249 
1250  m_xReplaced = xCurrentModel;
1251  }
1252  }
1253  catch(Exception&)
1254  {
1255  OSL_FAIL("FmUndoModelReplaceAction::Undo : could not replace the model !");
1256  }
1257 }
1258 
1259 
1261 {
1262  return SvxResId(RID_STR_UNDO_MODEL_REPLACE);
1263 }
1264 
1265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XInterface > m_xOwnElement
Definition: fmundo.hxx:93
tools::SvRef< SvBaseLink > xSink
bool is() const
void * m_pPropertySetCache
Definition: fmundo.hxx:187
void TogglePropertyListening(const css::uno::Reference< css::uno::XInterface > &Element)
Definition: fmundo.cxx:801
#define FM_PROP_DEFAULTCHECKED
Definition: fmprop.hxx:61
SdrHintKind GetKind() const
Definition: svdmodel.hxx:124
virtual ~FmUndoContainerAction() override
Definition: fmundo.cxx:1059
css::uno::Reference< css::awt::XControlModel > m_xReplaced
Definition: fmundo.hxx:102
bool m_bDisposed
virtual void Undo() override
Definition: fmundo.cxx:976
css::uno::Reference< css::form::XForm > findPlaceInFormComponentHierarchy(const css::uno::Reference< css::form::XFormComponent > &rContent, const css::uno::Reference< css::sdbc::XDataSource > &rDatabase=css::uno::Reference< css::sdbc::XDataSource >(), const OUString &rDBTitle=OUString(), const OUString &rCursorSource=OUString(), sal_Int32 nCommandType=0)
finds a place in the form component hierarchy where to insert the given component ...
Definition: fmpgeimp.cxx:443
void Inserted(SdrObject *pObj)
Definition: fmundo.cxx:337
static OUString setUniqueName(const css::uno::Reference< css::form::XFormComponent > &xFormComponent, const css::uno::Reference< css::form::XForm > &xControls)
Definition: fmpgeimp.cxx:618
void Removed(SdrObject *pObj)
Definition: fmundo.cxx:446
std::map< OUString, bool > AllProperties
#define FM_PROP_VALUE
Definition: fmprop.hxx:35
void switchListening(const css::uno::Reference< css::container::XIndexContainer > &_rxContainer, bool _bStartListening)
virtual void SetModified(bool bModified=true)
OUString aPropertyName
Definition: fmundo.hxx:49
virtual void Redo() override
Definition: fmundo.cxx:996
SdrUnoObj * m_pObject
Definition: fmundo.hxx:103
Abstract base class (ABC) for all UndoActions of DrawingEngine.
Definition: svdundo.hxx:54
virtual OUString GetComment() const override
Definition: fmundo.cxx:1260
sal_Int32 getElementPos(const Reference< css::container::XIndexAccess > &xCont, const Reference< XInterface > &xElement)
Definition: fmtools.cxx:128
const SdrPage * GetMasterPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1930
css::uno::Reference< css::frame::XModel > GetModel() const
bool bReadOnly
#define FM_PROP_STRINGITEMLIST
Definition: fmprop.hxx:59
bool IsReadOnlyUI() const
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:647
SfxHintId GetId() const
FmXUndoEnvironment(FmFormModel &_rModel)
Definition: fmundo.cxx:171
virtual ~FmXUndoEnvironment() override
Definition: fmundo.cxx:188
bool IsListening(SfxBroadcaster &rBroadcaster) const
#define FM_PROP_NAME
Definition: fmprop.hxx:29
SdrModel & rMod
Definition: svdundo.hxx:57
FmUndoPropertyAction(FmFormModel &rMod, const css::beans::PropertyChangeEvent &evt)
Definition: fmundo.cxx:962
Reference< XNameAccess > m_xContainer
virtual OUString GetComment() const override
Definition: fmundo.cxx:1016
OUString SvxResId(const char *pId)
Definition: dialmgr.cxx:28
void RemoveElement(const css::uno::Reference< css::uno::XInterface > &Element)
Definition: fmundo.cxx:931
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdmodel.cxx:546
void AddElement(const css::uno::Reference< css::uno::XInterface > &Element)
Definition: fmundo.cxx:918
int nCount
sal_Int32 m_nIndex
Definition: fmundo.hxx:94
static void DisposeElement(const css::uno::Reference< css::awt::XControlModel > &xReplaced)
Definition: fmundo.cxx:1209
#define FM_PROP_EFFECTIVE_VALUE
Definition: fmprop.hxx:102
FmFormPageImpl & GetImpl() const
Definition: fmpage.hxx:62
virtual void SAL_CALL elementReplaced(const css::container::ContainerEvent &rEvent) override
Definition: fmundo.cxx:749
css::uno::Reference< css::lang::XComponent > xComponent
#define FM_PROP_TIME
Definition: fmprop.hxx:56
static void DisposeElement(const css::uno::Reference< css::uno::XInterface > &xElem)
Definition: fmundo.cxx:1066
#define SAL_N_ELEMENTS(arr)
#define FM_PROP_SELECT_SEQ
Definition: fmprop.hxx:69
css::uno::Reference< css::uno::XInterface > m_xElement
Definition: fmundo.hxx:91
#define DBG_UNHANDLED_EXCEPTION(...)
#define TOOLS_WARN_EXCEPTION(area, stream)
sal_uInt16 GetMasterPageCount() const
Definition: svdmodel.cxx:1942
#define DBG_ASSERT(sCon, aError)
void implSetModified()
Definition: fmundo.cxx:740
int i
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
Definition: svdmodel.cxx:577
virtual void SAL_CALL modified(const css::lang::EventObject &aEvent) override
Definition: fmundo.cxx:779
OUString sName
css::uno::Any aNewValue
Definition: fmundo.hxx:50
#define FM_PROP_DEFAULT_TEXT
Definition: fmprop.hxx:60
OBoundControlModel & m_rModel
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1904
virtual void SetUnoControlModel(const css::uno::Reference< css::awt::XControlModel > &xModel)
Definition: svdouno.cxx:419
sal_Int16 nAttributes
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: fmundo.cxx:288
bool IsGroupObject() const
Definition: svdobj.cxx:642
#define FM_PROP_CONTROLSOURCEPROPERTY
Definition: fmprop.hxx:129
css::uno::Type const & get()
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
bool IsLocked() const
Definition: fmundo.hxx:136
FmUndoModelReplaceAction(FmFormModel &rMod, SdrUnoObj *pObject, const css::uno::Reference< css::awt::XControlModel > &xReplaced)
Definition: fmundo.cxx:1194
Abstract DrawObject.
Definition: svdobj.hxx:312
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
Definition: fmundo.cxx:530
FmFormModel & rModel
Definition: fmundo.hxx:186
FmUndoContainerAction(FmFormModel &rMod, Action _eAction, const css::uno::Reference< css::container::XIndexContainer > &xCont, const css::uno::Reference< css::uno::XInterface > &xElem, sal_Int32 nIdx)
Definition: fmundo.cxx:1023
#define FM_PROP_DEFAULT_TIME
Definition: fmprop.hxx:63
bool IsReadOnly() const
virtual SdrInventor GetObjInventor() const
Definition: svdobj.cxx:553
#define ENSURE_OR_THROW(c, m)
virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent &rEvent) override
Definition: fmundo.cxx:766
#define FM_PROP_EFFECTIVE_DEFAULT
Definition: fmprop.hxx:103
#define FM_PROP_DEFAULT_VALUE
Definition: fmprop.hxx:64
virtual void Undo() override
Definition: fmundo.cxx:1137
void ModeChanged()
Definition: fmundo.cxx:245
void AddForms(const css::uno::Reference< css::container::XNameContainer > &rForms)
Definition: fmundo.cxx:785
#define FM_PROP_STATE
Definition: fmprop.hxx:57
::rtl::Reference< svxform::FormScriptingEnvironment > m_pScriptingEnv
Definition: fmundo.hxx:188
css::uno::Reference< css::beans::XPropertySet > xObj
Definition: fmundo.hxx:48
#define FM_PROP_ACTIVE_CONNECTION
Definition: fmprop.hxx:128
virtual void Undo() override
Definition: fmundo.cxx:1221
#define FM_PROP_DEFAULT_DATE
Definition: fmprop.hxx:62
void SetObjectShell(SfxObjectShell *pShell)
Definition: fmmodel.cxx:178
OOO_DLLPUBLIC_DBTOOLS bool isEmbeddedInDatabase(const css::uno::Reference< css::uno::XInterface > &_rxComponent, css::uno::Reference< css::sdbc::XConnection > &_rxActualConnection)
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
css::uno::Reference< css::script::XScriptListener > m_vbaListener
Definition: fmundo.hxx:193
bool IsVirtualObj() const
Definition: svdobj.hxx:783
Reference< XComponentContext > getProcessComponentContext()
virtual void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: fmundo.cxx:512
#define FM_PROP_DATE
Definition: fmprop.hxx:55
void RemoveForms(const css::uno::Reference< css::container::XNameContainer > &rForms)
Definition: fmundo.cxx:793
const css::uno::Reference< css::awt::XControlModel > & GetUnoControlModel() const
Definition: svdouno.hxx:91
bool hasProperty(const OUString &_rName, const Reference< XPropertySet > &_rxSet)
uno::Reference< ucb::XContent > xContent
css::uno::Reference< css::container::XIndexContainer > m_xContainer
Definition: fmundo.hxx:89
Reference< XModel > xModel
class FmSearchEngine - Impl class for FmSearchDialog
#define FM_PROP_CONTROLSOURCE
Definition: fmprop.hxx:43
const css::uno::Reference< css::form::XForms > & GetForms(bool _bForceCreate=true) const
Definition: fmpage.cxx:84
css::uno::Any aOldValue
Definition: fmundo.hxx:51
#define FM_PROP_TEXT
Definition: fmprop.hxx:39
virtual void SetChanged()
Definition: svdobj.cxx:929
virtual void Redo() override
Definition: fmundo.cxx:1166
SectionViewAction m_eAction
::osl::Mutex m_aMutex
Definition: fmundo.hxx:190
static OUString static_STR_UNDO_PROPERTY
Definition: fmundo.cxx:168
#define FM_PROP_DEFAULT_SELECT_SEQ
Definition: fmprop.hxx:71
virtual ~FmUndoModelReplaceAction() override
Definition: fmundo.cxx:1202
aStr
std::map< Reference< XPropertySet >, PropertySetInfo > PropertySetInfoCache
Definition: fmundo.cxx:165
css::uno::Sequence< css::script::ScriptEventDescriptor > m_aEvents
Definition: fmundo.hxx:96
sal_uInt16 GetPageCount() const
Definition: svdmodel.cxx:1916
sal_uInt16 nPos
SfxObjectShell * GetObjectShell() const
Definition: fmmodel.hxx:58
const SdrObject * GetObject() const
Definition: svdmodel.hxx:123
virtual void SAL_CALL elementInserted(const css::container::ContainerEvent &rEvent) override
Definition: fmundo.cxx:725
css::uno::Any SAL_CALL makeAny(const SharedUNOComponent< INTERFACE, COMPONENT > &value)