summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-03-07 23:39:25 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-03-10 08:59:23 +0100
commitdb5c67e1006664916b7b4c8881d21cf096333ee7 (patch)
tree02b11f8c940bbdd6071f2994ace7352255d500f2 /xmloff
parentf351fd1e8eb75a25e7844ac632e5837851b2aeed (diff)
Keying on XTypeProvider::getImplementationId is unnecessary here
...given that cases where "every instance of getPropertySetInfo returns a new object [...] must not be cached" anyway, so just key on the XPropertySetInfo instances. Change-Id: I11f0a1fe030226d1d26d6b6e6a2654f4511fdce8
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/SinglePropertySetInfoCache.cxx51
-rw-r--r--xmloff/source/style/xmlexppr.cxx51
2 files changed, 27 insertions, 75 deletions
diff --git a/xmloff/source/style/SinglePropertySetInfoCache.cxx b/xmloff/source/style/SinglePropertySetInfoCache.cxx
index 701d68685ffe..aa9a0d08c5f3 100644
--- a/xmloff/source/style/SinglePropertySetInfoCache.cxx
+++ b/xmloff/source/style/SinglePropertySetInfoCache.cxx
@@ -17,12 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include <com/sun/star/lang/XTypeProvider.hpp>
#include <cppuhelper/weakref.hxx>
#include <xmloff/SinglePropertySetInfoCache.hxx>
using namespace ::com::sun::star::uno;
-using ::com::sun::star::lang::XTypeProvider;
using ::com::sun::star::beans::XPropertySet;
using ::com::sun::star::beans::XPropertySetInfo;
@@ -32,46 +30,23 @@ sal_Bool SinglePropertySetInfoCache::hasProperty(
{
if( !rPropSetInfo.is() )
rPropSetInfo = rPropSet->getPropertySetInfo();
- sal_Bool bRet = sal_False, bValid = sal_False;
- Reference < XTypeProvider > xTypeProv( rPropSet, UNO_QUERY );
- Sequence< sal_Int8 > aImplId;
- if( xTypeProv.is() )
+ Map::iterator aIter = map_.find( rPropSetInfo );
+ if( aIter != map_.end() )
{
- aImplId = xTypeProv->getImplementationId();
- if( aImplId.getLength() == 16 )
- {
- // The key must not be created outside this block, because it
- // keeps a reference to the property set info.
- PropertySetInfoKey aKey( rPropSetInfo, aImplId );
- iterator aIter = find( aKey );
- if( aIter != end() )
- {
- bRet = (*aIter).second;
- bValid = sal_True;
- }
- }
+ return (*aIter).second;
}
- if( !bValid )
+ bool bRet = rPropSetInfo->hasPropertyByName( sName );
+ // Check whether the property set info is destroyed if it is assigned to a
+ // weak reference only; if it is destroyed, then every instance of
+ // getPropertySetInfo returns a new object; Such property set infos must not
+ // be cached:
+ WeakReference < XPropertySetInfo > xWeakInfo( rPropSetInfo );
+ rPropSetInfo = 0;
+ rPropSetInfo = xWeakInfo;
+ if( rPropSetInfo.is() )
{
- bRet = rPropSetInfo->hasPropertyByName( sName );
- if( xTypeProv.is() && aImplId.getLength() == 16 )
- {
- // Check whether the property set info is destroyed if it is
- // assigned to a weak reference only. If it is destroyed, then
- // every instance of getPropertySetInfo returns a new object.
- // Such property set infos must not be cached.
- WeakReference < XPropertySetInfo > xWeakInfo( rPropSetInfo );
- rPropSetInfo = 0;
- rPropSetInfo = xWeakInfo;
- if( rPropSetInfo.is() )
- {
- PropertySetInfoKey aKey( rPropSetInfo, aImplId );
- value_type aValue( aKey, bRet );
- insert( aValue );
- }
- }
+ map_.insert(Map::value_type(rPropSetInfo, bRet));
}
-
return bRet;
}
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index bddd6eb143d2..8c482294032d 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -21,13 +21,12 @@
#include <com/sun/star/xml/AttributeData.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
#include <rtl/ustrbuf.hxx>
#include <list>
-#include <boost/unordered_map.hpp>
+#include <map>
#include <xmloff/xmlexppr.hxx>
#include <xmloff/xmltoken.hxx>
@@ -36,7 +35,6 @@
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/xmlexp.hxx>
#include <xmloff/xmlprmap.hxx>
-#include <xmloff/PropertySetInfoHash.hxx>
using namespace ::std;
using namespace ::com::sun::star;
@@ -510,7 +508,7 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray(
struct SvXMLExportPropertyMapper::Impl
{
- typedef boost::unordered_map<PropertySetInfoKey, FilterPropertiesInfo_Impl*, PropertySetInfoHash, PropertySetInfoHash> CacheType;
+ typedef std::map<css::uno::Reference<css::beans::XPropertySetInfo>, FilterPropertiesInfo_Impl*> CacheType;
CacheType maCache;
UniReference<SvXMLExportPropertyMapper> mxNextMapper;
@@ -585,21 +583,9 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
FilterPropertiesInfo_Impl *pFilterInfo = 0;
- Reference < XTypeProvider > xTypeProv( xPropSet, UNO_QUERY );
- Sequence< sal_Int8 > aImplId;
- if( xTypeProv.is() )
- {
- aImplId = xTypeProv->getImplementationId();
- if( aImplId.getLength() == 16 )
- {
- // The key must not be created outside this block, because it
- // keeps a reference to the property set info.
- PropertySetInfoKey aKey( xInfo, aImplId );
- Impl::CacheType::iterator aIter = mpImpl->maCache.find(aKey);
- if (aIter != mpImpl->maCache.end())
- pFilterInfo = (*aIter).second;
- }
- }
+ Impl::CacheType::iterator aIter = mpImpl->maCache.find(xInfo);
+ if (aIter != mpImpl->maCache.end())
+ pFilterInfo = (*aIter).second;
sal_Bool bDelInfo = sal_False;
if( !pFilterInfo )
@@ -625,28 +611,19 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
}
}
- if( xTypeProv.is() && aImplId.getLength() == 16 )
+ // Check whether the property set info is destroyed if it is assigned to
+ // a weak reference only; If it is destroyed, then every instance of
+ // getPropertySetInfo returns a new object; such property set infos must
+ // not be cached:
+ WeakReference < XPropertySetInfo > xWeakInfo( xInfo );
+ xInfo = 0;
+ xInfo = xWeakInfo;
+ if( xInfo.is() )
{
- // Check whether the property set info is destroyed if it is
- // assigned to a weak reference only. If it is destroyed, then
- // every instance of getPropertySetInfo returns a new object.
- // Such property set infos must not be cached.
- WeakReference < XPropertySetInfo > xWeakInfo( xInfo );
- xInfo = 0;
- xInfo = xWeakInfo;
- if( xInfo.is() )
- {
- PropertySetInfoKey aKey( xInfo, aImplId );
- mpImpl->maCache.insert(Impl::CacheType::value_type(aKey, pFilterInfo));
- }
- else
- bDelInfo = true;
+ mpImpl->maCache.insert(Impl::CacheType::value_type(xInfo, pFilterInfo));
}
else
- {
- OSL_FAIL("here is no TypeProvider or the ImplId is wrong");
bDelInfo = true;
- }
}
if( pFilterInfo->GetPropertyCount() )