summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2005-03-23 11:41:23 +0000
committerVladimir Glazounov <vg@openoffice.org>2005-03-23 11:41:23 +0000
commit73972d98bf5337655bd5f3e4a9799e22b9d1e120 (patch)
tree1d09e47c1f22cdd956f8b12484911a4a7c9c2ddc /xmloff
parent450c9161f664d4ad1681cd39a5aee861d0eadb0b (diff)
INTEGRATION: CWS calcuno01 (1.40.18); FILE MERGED
2004/10/13 10:55:15 sab 1.40.18.5: RESYNC: (1.40-1.42); FILE MERGED 2004/04/28 14:59:51 sab 1.40.18.4: #i22706#; use lacal variable 2004/02/25 08:00:47 sab 1.40.18.3: #i22706#; don't use MultiPropertySet to get defaults 2004/02/12 17:39:56 sab 1.40.18.2: #i22706#; add getDirectPropertyValuesTolerant 2004/01/05 15:41:47 sab 1.40.18.1: #i22706#; using new interface XTolerantMultiPropertySet
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/style/xmlexppr.cxx294
1 files changed, 183 insertions, 111 deletions
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index d59efe087fbf..3bf6db5d6450 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmlexppr.cxx,v $
*
- * $Revision: 1.42 $
+ * $Revision: 1.43 $
*
- * last change: $Author: hr $ $Date: 2004-08-02 14:16:04 $
+ * last change: $Author: vg $ $Date: 2005-03-23 12:41:23 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -80,6 +80,12 @@
#ifndef _COM_SUN_STAR_BEANS_XMULTIPROPERTYSET_HPP_
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#endif
+#ifndef _COM_SUN_STAR_BEANS_XTOLERANTMULTIPROPERTYSET_HPP_
+#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_TOLERANTPROPERTYSETRESULTTYPE_HPP_
+#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
+#endif
#ifndef _RTL_USTRBUF_HXX_
#include <rtl/ustrbuf.hxx>
@@ -427,154 +433,220 @@ void FilterPropertiesInfo_Impl::FillPropertyStateArray(
const uno::Sequence<OUString>& rApiNames = GetApiNames();
- Sequence < PropertyState > aStates;
- const PropertyState *pStates = 0;
- Reference< XPropertyState > xPropState( rPropSet, UNO_QUERY );
- if( xPropState.is() )
- {
- aStates = xPropState->getPropertyStates( rApiNames );
- pStates = aStates.getConstArray();
- }
-
- Reference < XMultiPropertySet > xMultiPropSet( rPropSet, UNO_QUERY );
- if( xMultiPropSet.is() && !bDefault )
+ Reference < XTolerantMultiPropertySet > xTolPropSet( rPropSet, UNO_QUERY );
+ if (xTolPropSet.is())
{
- Sequence < Any > aValues;
- if( pStates )
+ if (!bDefault)
{
- // step 1: get value count
- sal_uInt32 nValueCount = 0;
- sal_uInt32 i;
+ Sequence < beans::GetDirectPropertyTolerantResult > aResults(xTolPropSet->getDirectPropertyValuesTolerant(rApiNames));
+ sal_Int32 nResultCount(aResults.getLength());
+ if (nResultCount > 0)
+ {
+ const beans::GetDirectPropertyTolerantResult *pResults = aResults.getConstArray();
+ FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin());
+ XMLPropertyState aNewProperty( -1 );
+ sal_uInt32 i = 0;
+ while (nResultCount > 0 && i < nCount)
+ {
+ if (pResults->Name == aPropIter->GetApiName())
+ {
+ aNewProperty.mnIndex = -1;
+ aNewProperty.maValue = pResults->Value;
- for( i = 0; i < nCount; i++, pStates++ )
+ for( std::list<sal_uInt32>::iterator aIndexItr(aPropIter->GetIndexes().begin());
+ aIndexItr != aPropIter->GetIndexes().end();
+ ++aIndexItr )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ ++pResults;
+ --nResultCount;
+ }
+ ++aPropIter;
+ ++i;
+ }
+ }
+ }
+ else
+ {
+ Sequence < beans::GetPropertyTolerantResult > aResults(xTolPropSet->getPropertyValuesTolerant(rApiNames));
+ OSL_ENSURE( rApiNames.getLength() == aResults.getLength(), "wrong implemented XTolerantMultiPropertySet" );
+ const beans::GetPropertyTolerantResult *pResults = aResults.getConstArray();
+ FilterPropertyInfoList_Impl::iterator aPropIter(aPropInfos.begin());
+ XMLPropertyState aNewProperty( -1 );
+ sal_uInt32 nResultCount(aResults.getLength());
+ OSL_ENSURE( nCount == nResultCount, "wrong implemented XTolerantMultiPropertySet??" );
+ for( sal_uInt32 i = 0; i < nResultCount; ++i )
{
- if( *pStates == PropertyState_DIRECT_VALUE )
- nValueCount++;
+ if ((pResults->Result == beans::TolerantPropertySetResultType::SUCCESS) &&
+ ((pResults->State == PropertyState_DIRECT_VALUE) || (pResults->State == PropertyState_DEFAULT_VALUE)))
+ {
+ aNewProperty.mnIndex = -1;
+ aNewProperty.maValue = pResults->Value;
+
+ for( std::list<sal_uInt32>::iterator aIndexItr(aPropIter->GetIndexes().begin());
+ aIndexItr != aPropIter->GetIndexes().end();
+ ++aIndexItr )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ }
+ ++pResults;
+ ++aPropIter;
}
+ }
+ }
+ else
+ {
+ Sequence < PropertyState > aStates;
+ const PropertyState *pStates = 0;
+ Reference< XPropertyState > xPropState( rPropSet, UNO_QUERY );
+ if( xPropState.is() )
+ {
+ aStates = xPropState->getPropertyStates( rApiNames );
+ pStates = aStates.getConstArray();
+ }
- if( nValueCount )
+ Reference < XMultiPropertySet > xMultiPropSet( rPropSet, UNO_QUERY );
+ if( xMultiPropSet.is() && !bDefault )
+ {
+ Sequence < Any > aValues;
+ if( pStates )
{
- // step 2: collect property names
- Sequence < OUString > aAPINames( nValueCount );
- OUString *pAPINames = aAPINames.getArray();
-
- FilterPropertyInfoList_Impl::iterator *aPropIters =
- new FilterPropertyInfoList_Impl::iterator[nValueCount];
- FilterPropertyInfoList_Impl::iterator *pPropIter = aPropIters;
+ // step 1: get value count
+ sal_uInt32 nValueCount = 0;
+ sal_uInt32 i;
- FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
- OSL_ENSURE(aItr != aPropInfos.end(),"Invalid iterator!");
+ for( i = 0; i < nCount; i++, pStates++ )
+ {
+ if( (*pStates == PropertyState_DIRECT_VALUE)/* || (bDefault && (*pStates == PropertyState_DEFAULT_VALUE))*/ )
+ nValueCount++;
+ }
- pStates = aStates.getConstArray();
- i = 0;
- while( i < nValueCount )
+ if( nValueCount )
{
- if( *pStates == PropertyState_DIRECT_VALUE )
+ // step 2: collect property names
+ Sequence < OUString > aAPINames( nValueCount );
+ OUString *pAPINames = aAPINames.getArray();
+
+ FilterPropertyInfoList_Impl::iterator *aPropIters =
+ new FilterPropertyInfoList_Impl::iterator[nValueCount];
+ FilterPropertyInfoList_Impl::iterator *pPropIter = aPropIters;
+
+ FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
+ OSL_ENSURE(aItr != aPropInfos.end(),"Invalid iterator!");
+
+ pStates = aStates.getConstArray();
+ i = 0;
+ while( i < nValueCount )
{
- const OUString& rApiName = aItr->GetApiName();
- *pAPINames++ = rApiName;
- *pPropIter++ = aItr;
- i++;
+ if( (*pStates == PropertyState_DIRECT_VALUE)/* || (bDefault && (*pStates == PropertyState_DEFAULT_VALUE))*/ )
+ {
+ *pAPINames++ = aItr->GetApiName();
+ *pPropIter++ = aItr;
+ i++;
+ }
+ aItr++;
+ pStates++;
}
- aItr++;
- pStates++;
- }
- aValues = xMultiPropSet->getPropertyValues( aAPINames );
+ aValues = xMultiPropSet->getPropertyValues( aAPINames );
+ const Any *pValues = aValues.getConstArray();
+ pPropIter = aPropIters;
+ XMLPropertyState aNewProperty( -1 );
+ for( i = 0; i < nValueCount; i++ )
+ {
+ aNewProperty.mnIndex = -1;
+ aNewProperty.maValue = *pValues;
+
+ for( std::list<sal_uInt32>::iterator aIndexItr =
+ (*pPropIter)->GetIndexes().begin();
+ aIndexItr != (*pPropIter)->GetIndexes().end();
+ aIndexItr++ )
+ {
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+
+ pPropIter++;
+ pValues++;
+ }
+ delete[] aPropIters;
+ }
+ }
+ else
+ {
+ aValues = xMultiPropSet->getPropertyValues( rApiNames );
const Any *pValues = aValues.getConstArray();
- pPropIter = aPropIters;
- XMLPropertyState aNewProperty( -1 );
- for( i = 0; i < nValueCount; i++ )
+
+ FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
+ for(sal_uInt32 i = 0; i < nCount; i++ )
{
- aNewProperty.mnIndex = -1;
+ // The value is stored in the PropertySet itself, add to list.
+ sal_Bool bGotValue = sal_False;
+ XMLPropertyState aNewProperty( -1 );
aNewProperty.maValue = *pValues;
-
+ ++pValues;
for( std::list<sal_uInt32>::iterator aIndexItr =
- (*pPropIter)->GetIndexes().begin();
- aIndexItr != (*pPropIter)->GetIndexes().end();
+ aItr->GetIndexes().begin();
+ aIndexItr != aItr->GetIndexes().end();
aIndexItr++ )
{
aNewProperty.mnIndex = *aIndexItr;
aPropStates.AddPropertyState( aNewProperty );
}
-
- pPropIter++;
- pValues++;
+ aItr++;
}
- delete[] aPropIters;
}
}
else
{
- aValues = xMultiPropSet->getPropertyValues( rApiNames );
- const Any *pValues = aValues.getConstArray();
-
FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
for(sal_uInt32 i = 0; i < nCount; i++ )
{
- // The value is stored in the PropertySet itself, add to list.
- sal_Bool bGotValue = sal_False;
- XMLPropertyState aNewProperty( -1 );
- aNewProperty.maValue = *pValues;
- ++pValues;
- for( std::list<sal_uInt32>::iterator aIndexItr =
- aItr->GetIndexes().begin();
- aIndexItr != aItr->GetIndexes().end();
- aIndexItr++ )
- {
- aNewProperty.mnIndex = *aIndexItr;
- aPropStates.AddPropertyState( aNewProperty );
- }
- aItr++;
- }
- }
- }
- else
- {
- FilterPropertyInfoList_Impl::iterator aItr = aPropInfos.begin();
- for(sal_uInt32 i = 0; i < nCount; i++ )
- {
- sal_Bool bDirectValue =
- !pStates || *pStates == PropertyState_DIRECT_VALUE;
- if( bDirectValue || bDefault )
- {
- // The value is stored in the PropertySet itself, add to list.
- sal_Bool bGotValue = sal_False;
- XMLPropertyState aNewProperty( -1 );
- for( std::list<sal_uInt32>::iterator aIndexItr =
- aItr->GetIndexes().begin();
- aIndexItr != aItr->GetIndexes().end();
- aIndexItr++ )
+ sal_Bool bDirectValue =
+ !pStates || *pStates == PropertyState_DIRECT_VALUE;
+ if( bDirectValue || bDefault )
{
- if( bDirectValue ||
- (rPropMapper->GetEntryFlags( *aIndexItr ) &
- MID_FLAG_DEFAULT_ITEM_EXPORT) != 0 )
+ // The value is stored in the PropertySet itself, add to list.
+ sal_Bool bGotValue = sal_False;
+ XMLPropertyState aNewProperty( -1 );
+ for( std::list<sal_uInt32>::iterator aIndexItr =
+ aItr->GetIndexes().begin();
+ aIndexItr != aItr->GetIndexes().end();
+ aIndexItr++ )
{
- try
+ if( bDirectValue ||
+ (rPropMapper->GetEntryFlags( *aIndexItr ) &
+ MID_FLAG_DEFAULT_ITEM_EXPORT) != 0 )
{
- if( !bGotValue )
+ try
{
- const OUString& rApiName = aItr->GetApiName();
- aNewProperty.maValue =
- rPropSet->getPropertyValue( rApiName );
- bGotValue = sal_True;
+ if( !bGotValue )
+ {
+ aNewProperty.maValue =
+ rPropSet->getPropertyValue( aItr->GetApiName() );
+ bGotValue = sal_True;
+ }
+ aNewProperty.mnIndex = *aIndexItr;
+ aPropStates.AddPropertyState( aNewProperty );
+ }
+ catch( UnknownPropertyException& )
+ {
+ // might be a problem of getImplemenetationId
+ OSL_ENSURE( !this, "unknown property in getPropertyValue" );
}
- aNewProperty.mnIndex = *aIndexItr;
- aPropStates.AddPropertyState( aNewProperty );
- }
- catch( UnknownPropertyException& )
- {
- // might be a problem of getImplemenetationId
- OSL_ENSURE( !this, "unknown property in getPropertyValue" );
- }
+ }
}
}
- }
- aItr++;
- if( pStates )
- pStates++;
+ aItr++;
+ if( pStates )
+ pStates++;
+ }
}
}
aPropStates.FillPropertyStateVector(rPropStates);