diff options
-rwxr-xr-x[-rw-r--r--] | unotools/inc/unotools/lingucfg.hxx | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | unotools/source/config/lingucfg.cxx | 71 |
2 files changed, 64 insertions, 11 deletions
diff --git a/unotools/inc/unotools/lingucfg.hxx b/unotools/inc/unotools/lingucfg.hxx index 49500db964c2..68d0acb43ff7 100644..100755 --- a/unotools/inc/unotools/lingucfg.hxx +++ b/unotools/inc/unotools/lingucfg.hxx @@ -233,8 +233,10 @@ public: ::rtl::OUString GetSpellAndGrammarDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; ::rtl::OUString GetSpellAndGrammarContextSuggestionImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; ::rtl::OUString GetSpellAndGrammarContextDictionaryImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetThesaurusDialogImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; + ::rtl::OUString GetSynonymsContextImage( const ::rtl::OUString &rServiceImplName, bool bHighContrast = false ) const; - bool HasAnyVendorImages() const; + bool HasVendorImages( const char *pImageName ) const; bool HasGrammarChecker() const; }; diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index d4eff83efec6..917862fdd5bf 100644..100755 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -1409,21 +1409,72 @@ rtl::OUString SvtLinguConfig::GetSpellAndGrammarContextDictionaryImage( } -bool SvtLinguConfig::HasAnyVendorImages() const +::rtl::OUString SvtLinguConfig::GetThesaurusDialogImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const { - bool bRes = false; - try + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) { - uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); - xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + rtl::OUString aImageName( A2OU( bHighContrast ? "ThesaurusDialogImage_HC" : "ThesaurusDialogImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; + } + return aRes; +} - uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); - bRes = aElementNames.getLength() > 0; + +::rtl::OUString SvtLinguConfig::GetSynonymsContextImage( + const ::rtl::OUString &rServiceImplName, + bool bHighContrast ) const +{ + rtl::OUString aRes; + if (rServiceImplName.getLength() > 0) + { + rtl::OUString aImageName( A2OU( bHighContrast ? "SynonymsContextMenuImage_HC" : "SynonymsContextMenuImage" )); + rtl::OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) ); + aRes = aPath; } - catch (uno::Exception &) + return aRes; +} + + +bool SvtLinguConfig::HasVendorImages( const char *pImageName ) const +{ + bool bRes = false; + if (pImageName) { - DBG_ASSERT( 0, "exception caught. HasAnyVendorImages failed" ); + try + { + uno::Reference< container::XNameAccess > xNA( GetMainUpdateAccess(), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("Images") ), uno::UNO_QUERY_THROW ); + xNA.set( xNA->getByName( A2OU("VendorImages") ), uno::UNO_QUERY_THROW ); + + uno::Sequence< rtl::OUString > aElementNames( xNA->getElementNames() ); + sal_Int32 nVendors = aElementNames.getLength(); + const rtl::OUString *pVendor = aElementNames.getConstArray(); + for (sal_Int32 i = 0; i < nVendors; ++i) + { + uno::Reference< container::XNameAccess > xNA2( xNA->getByName( pVendor[i] ), uno::UNO_QUERY_THROW ); + uno::Sequence< rtl::OUString > aPropNames( xNA2->getElementNames() ); + sal_Int32 nProps = aPropNames.getLength(); + const rtl::OUString *pPropNames = aPropNames.getConstArray(); + for (sal_Int32 k = 0; k < nProps; ++k) + { + // for a quicker check we ignore the HC image names here + const OUString &rName = pPropNames[k]; + if (rName.equalsAscii( pImageName )) + { + bRes = true; + break; + } + } + } + } + catch (uno::Exception &) + { + DBG_ASSERT( 0, "exception caught. HasVendorImages failed" ); + } } return bRes; } |