diff options
author | Sascha Ballach <sab@openoffice.org> | 2001-03-21 09:52:49 +0000 |
---|---|---|
committer | Sascha Ballach <sab@openoffice.org> | 2001-03-21 09:52:49 +0000 |
commit | 573406eacce67c147dfe57b63ca6fe0c73864855 (patch) | |
tree | c39556d82b94cfcc81efff91eb0a39ac641c74ab /xmloff | |
parent | 652fc784bb4a3eddcda1737ad5ad7c4439bb9d3f (diff) |
#85196#, only try to create Instance if the Service is provided
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx index 6a10696386d1..eb4f6f8d8987 100644 --- a/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx +++ b/xmloff/source/text/XMLIndexBibliographyConfigurationContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLIndexBibliographyConfigurationContext.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: dvo $ $Date: 2001-01-25 11:35:25 $ + * last change: $Author: sab $ $Date: 2001-03-21 10:52:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -285,41 +285,57 @@ void XMLIndexBibliographyConfigurationContext::CreateAndInsert( Reference<XMultiServiceFactory> xFactory(GetImport().GetModel(),UNO_QUERY); if( xFactory.is() ) { - Reference<XInterface> xIfc = - xFactory->createInstance(sFieldMaster_Bibliography); - if( xIfc.is() ) + Sequence<rtl::OUString> aServices = xFactory->getAvailableServiceNames(); + sal_Bool bFound(sal_False); + sal_Int32 i(0); + sal_Int32 nCount(aServices.getLength()); + while (i < nCount && !bFound) { - Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY ); - Any aAny; - - if (sSuffix.getLength() > 0) + if (aServices[i].equals(sFieldMaster_Bibliography)) + // here we should use a methode which compares in reverse order if available + // #85282# + bFound = sal_True; + else + i++; + } + if (bFound) + { + Reference<XInterface> xIfc = + xFactory->createInstance(sFieldMaster_Bibliography); + if( xIfc.is() ) { - aAny <<= sSuffix; - xPropSet->setPropertyValue(sBracketAfter, aAny); - } + Reference<XPropertySet> xPropSet( xIfc, UNO_QUERY ); + Any aAny; - if (sPrefix.getLength() > 0) - { - aAny <<= sPrefix; - xPropSet->setPropertyValue(sBracketBefore, aAny); - } + if (sSuffix.getLength() > 0) + { + aAny <<= sSuffix; + xPropSet->setPropertyValue(sBracketAfter, aAny); + } - aAny.setValue(&bNumberedEntries, ::getBooleanCppuType()); - xPropSet->setPropertyValue(sIsNumberEntries, aAny); + if (sPrefix.getLength() > 0) + { + aAny <<= sPrefix; + xPropSet->setPropertyValue(sBracketBefore, aAny); + } - aAny.setValue(&bSortByPosition, ::getBooleanCppuType()); - xPropSet->setPropertyValue(sIsSortByPosition, aAny); + aAny.setValue(&bNumberedEntries, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sIsNumberEntries, aAny); - sal_Int32 nCount = aSortKeys.size(); - Sequence<Sequence<PropertyValue> > aKeysSeq(nCount); - for(sal_Int32 i = 0; i < nCount; i++) - { - aKeysSeq[i] = aSortKeys[i]; + aAny.setValue(&bSortByPosition, ::getBooleanCppuType()); + xPropSet->setPropertyValue(sIsSortByPosition, aAny); + + sal_Int32 nCount = aSortKeys.size(); + Sequence<Sequence<PropertyValue> > aKeysSeq(nCount); + for(sal_Int32 i = 0; i < nCount; i++) + { + aKeysSeq[i] = aSortKeys[i]; + } + aAny <<= aKeysSeq; + xPropSet->setPropertyValue(sSortKeys, aAny); } - aAny <<= aKeysSeq; - xPropSet->setPropertyValue(sSortKeys, aAny); + // else: can't get FieldMaster -> ignore } - // else: can't get FieldMaster -> ignore } // else: can't even get Factory -> ignore } |