summaryrefslogtreecommitdiff
path: root/unotools
diff options
context:
space:
mode:
authorThomas Lange [tl] <tl@openoffice.org>2010-02-05 13:45:10 +0100
committerThomas Lange [tl] <tl@openoffice.org>2010-02-05 13:45:10 +0100
commit0e3b2c2af5e872665e2c57a0176f4956a1b8f3db (patch)
treebda1a40b4336b05073e48c97652041665656e4f9 /unotools
parent70e22566b64a3cb76a7e5ed8187ee642e9ee9ace (diff)
#161586# allowing for thesaurus vendor images
Diffstat (limited to 'unotools')
-rwxr-xr-x[-rw-r--r--]unotools/inc/unotools/lingucfg.hxx4
-rwxr-xr-x[-rw-r--r--]unotools/source/config/lingucfg.cxx71
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;
}