summaryrefslogtreecommitdiff
path: root/xmloff/source
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2012-11-12 17:09:32 +0000
committerMichael Meeks <michael.meeks@suse.com>2012-11-15 16:06:06 +0000
commit1099f6d52b1b8319c0eb9364ead75540318cfdc3 (patch)
treeaaa3b45a388da7ad0ffbfa60838fd337bc4f064a /xmloff/source
parentced21f28931e749a16a676420c31c1e880fb8854 (diff)
Revert "sb140: #i117310# remove unnecessary dependency
on XTypeProvider::getImplementationId" This reverts commit 27b9f9f348b720e08f37db829533372dc4b73248. Conflicts: xmloff/inc/xmloff/txtparae.hxx xmloff/source/style/SinglePropertySetInfoCache.cxx
Diffstat (limited to 'xmloff/source')
-rw-r--r--xmloff/source/style/SinglePropertySetInfoCache.cxx53
-rw-r--r--xmloff/source/style/xmlexppr.cxx58
2 files changed, 78 insertions, 33 deletions
diff --git a/xmloff/source/style/SinglePropertySetInfoCache.cxx b/xmloff/source/style/SinglePropertySetInfoCache.cxx
index 7b70aabeba59..c1188fb51137 100644
--- a/xmloff/source/style/SinglePropertySetInfoCache.cxx
+++ b/xmloff/source/style/SinglePropertySetInfoCache.cxx
@@ -26,11 +26,12 @@
*
************************************************************************/
+#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;
@@ -40,24 +41,46 @@ sal_Bool SinglePropertySetInfoCache::hasProperty(
{
if( !rPropSetInfo.is() )
rPropSetInfo = rPropSet->getPropertySetInfo();
- iterator aIter = find( rPropSetInfo );
- if( aIter != end() )
+ sal_Bool bRet = sal_False, bValid = sal_False;
+ Reference < XTypeProvider > xTypeProv( rPropSet, UNO_QUERY );
+ Sequence< sal_Int8 > aImplId;
+ if( xTypeProv.is() )
{
- return aIter->second;
+ 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;
+ }
+ }
}
- 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() )
+ if( !bValid )
{
- value_type aValue( rPropSetInfo, bRet );
- insert( aValue );
+ 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 );
+ }
+ }
}
+
return bRet;
}
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index c1f143204bf5..7513d4b3dac4 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -30,6 +30,7 @@
#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>
@@ -228,7 +229,7 @@ public:
typedef boost::unordered_map
<
- Reference< XPropertySetInfo >,
+ PropertySetInfoKey,
FilterPropertiesInfo_Impl *,
PropertySetInfoHash,
PropertySetInfoHash
@@ -628,12 +629,24 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
FilterPropertiesInfo_Impl *pFilterInfo = 0;
- if( pCache )
+ Reference < XTypeProvider > xTypeProv( xPropSet, UNO_QUERY );
+ Sequence< sal_Int8 > aImplId;
+ if( xTypeProv.is() )
{
- FilterPropertiesInfos_Impl::iterator aIter =
- pCache->find( xInfo );
- if( aIter != pCache->end() )
- pFilterInfo = (*aIter).second;
+ aImplId = xTypeProv->getImplementationId();
+ if( aImplId.getLength() == 16 )
+ {
+ if( pCache )
+ {
+ // The key must not be created outside this block, because it
+ // keeps a reference to the property set info.
+ PropertySetInfoKey aKey( xInfo, aImplId );
+ FilterPropertiesInfos_Impl::iterator aIter =
+ pCache->find( aKey );
+ if( aIter != pCache->end() )
+ pFilterInfo = (*aIter).second;
+ }
+ }
}
sal_Bool bDelInfo = sal_False;
@@ -660,22 +673,31 @@ vector< XMLPropertyState > SvXMLExportPropertyMapper::_Filter(
}
}
- // 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() )
+ if( xTypeProv.is() && aImplId.getLength() == 16 )
{
- if( !pCache )
- ((SvXMLExportPropertyMapper *)this)->pCache =
- new FilterPropertiesInfos_Impl;
- (*pCache)[xInfo] = pFilterInfo;
+ // 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() )
+ {
+ if( !pCache )
+ ((SvXMLExportPropertyMapper *)this)->pCache =
+ new FilterPropertiesInfos_Impl;
+ PropertySetInfoKey aKey( xInfo, aImplId );
+ (*pCache)[aKey] = pFilterInfo;
+ }
+ else
+ bDelInfo = sal_True;
}
else
+ {
+ OSL_FAIL("here is no TypeProvider or the ImplId is wrong");
bDelInfo = sal_True;
+ }
}
if( pFilterInfo->GetPropertyCount() )