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