summaryrefslogtreecommitdiff
path: root/svx/source/form
diff options
context:
space:
mode:
Diffstat (limited to 'svx/source/form')
-rw-r--r--svx/source/form/fmundo.cxx33
1 files changed, 12 insertions, 21 deletions
diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx
index 0c554afb4b02..9bbe99a81d6e 100644
--- a/svx/source/form/fmundo.cxx
+++ b/svx/source/form/fmundo.cxx
@@ -151,6 +151,9 @@ struct PropertyInfo
// as if it's transient or persistent
};
+}
+
+
struct PropertySetInfo
{
typedef std::map<OUString, PropertyInfo> AllProperties;
@@ -160,17 +163,11 @@ struct PropertySetInfo
// sal_False -> the set has _no_ such property or its value isn't empty
};
-}
-
-typedef std::map<Reference< XPropertySet >, PropertySetInfo> PropertySetInfoCache;
-
-
static OUString static_STR_UNDO_PROPERTY;
FmXUndoEnvironment::FmXUndoEnvironment(FmFormModel& _rModel)
:rModel( _rModel )
- ,m_pPropertySetCache( nullptr )
,m_pScriptingEnv( new svxform::FormScriptingEnvironment( _rModel ) )
,m_Locks( 0 )
,bReadOnly( false )
@@ -189,9 +186,6 @@ FmXUndoEnvironment::~FmXUndoEnvironment()
{
if ( !m_bDisposed ) // i120746, call FormScriptingEnvironment::dispose to avoid memory leak
m_pScriptingEnv->dispose();
-
- if (m_pPropertySetCache)
- delete static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
}
void FmXUndoEnvironment::dispose()
@@ -515,10 +509,9 @@ void SAL_CALL FmXUndoEnvironment::disposing(const EventObject& e)
Reference< XPropertySet > xSourceSet(e.Source, UNO_QUERY);
if (xSourceSet.is())
{
- PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
- PropertySetInfoCache::iterator aSetPos = pCache->find(xSourceSet);
- if (aSetPos != pCache->end())
- pCache->erase(aSetPos);
+ PropertySetInfoCache::iterator aSetPos = m_pPropertySetCache->find(xSourceSet);
+ if (aSetPos != m_pPropertySetCache->end())
+ m_pPropertySetCache->erase(aSetPos);
}
}
}
@@ -573,12 +566,11 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
// which does not have a "ExternalData" property being <TRUE/>
if (!m_pPropertySetCache)
- m_pPropertySetCache = new PropertySetInfoCache;
- PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
+ m_pPropertySetCache = std::make_unique<PropertySetInfoCache>();
// let's see if we know something about the set
- PropertySetInfoCache::iterator aSetPos = pCache->find(xSet);
- if (aSetPos == pCache->end())
+ PropertySetInfoCache::iterator aSetPos = m_pPropertySetCache->find(xSet);
+ if (aSetPos == m_pPropertySetCache->end())
{
PropertySetInfo aNewEntry;
if (!::comphelper::hasProperty(FM_PROP_CONTROLSOURCE, xSet))
@@ -597,8 +589,8 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
DBG_UNHANDLED_EXCEPTION("svx");
}
}
- aSetPos = pCache->emplace(xSet,aNewEntry).first;
- DBG_ASSERT(aSetPos != pCache->end(), "FmXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
+ aSetPos = m_pPropertySetCache->emplace(xSet,aNewEntry).first;
+ DBG_ASSERT(aSetPos != m_pPropertySetCache->end(), "FmXUndoEnvironment::propertyChange : just inserted it ... why it's not there ?");
}
else
{ // is it the DataField property ?
@@ -711,8 +703,7 @@ void SAL_CALL FmXUndoEnvironment::propertyChange(const PropertyChangeEvent& evt)
if (m_pPropertySetCache && evt.PropertyName == FM_PROP_CONTROLSOURCE)
{
Reference< XPropertySet > xSet(evt.Source, UNO_QUERY);
- PropertySetInfoCache* pCache = static_cast<PropertySetInfoCache*>(m_pPropertySetCache);
- PropertySetInfo& rSetInfo = (*pCache)[xSet];
+ PropertySetInfo& rSetInfo = (*m_pPropertySetCache)[xSet];
rSetInfo.bHasEmptyControlSource = !evt.NewValue.hasValue() || ::comphelper::getString(evt.NewValue).isEmpty();
}
}