libreoffice/split-icons-search-usr-share.diff

140 lines
5.1 KiB
Diff

--- vcl/inc/vcl/impimagetree.hxx.old 2010-06-18 10:32:12.000000000 +0200
+++ vcl/inc/vcl/impimagetree.hxx 2010-07-27 17:21:18.000000000 +0200
@@ -85,6 +85,10 @@ private:
typedef boost::unordered_map<
rtl::OUString, std::pair< bool, BitmapEx >, rtl::OUStringHash > IconCache;
+ // we want to search zip files (icons) also in /usr/share/
+ ::rtl::OUString m_datadir; // /usr/share/
+ ::rtl::OUString m_libdir; // /usr/lib or /usr/lib64
+
rtl::OUString m_style;
Zips m_zips;
CheckStyleCache m_checkStyleCache;
@@ -92,6 +96,7 @@ private:
void setStyle(rtl::OUString const & style );
+ void addUrlToZips(const rtl::OUString &url);
void resetZips();
bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists );
--- vcl/source/gdi/impimagetree.cxx.old 2010-06-18 10:32:12.000000000 +0200
+++ vcl/source/gdi/impimagetree.cxx 2010-07-27 17:33:50.000000000 +0200
@@ -114,7 +114,15 @@ void loadFromStream(
}
-ImplImageTree::ImplImageTree() {}
+ImplImageTree::ImplImageTree()
+{
+ m_datadir = ::rtl::OUString::createFromAscii ( "/usr/share/" );
+#if defined(X86_64)
+ m_libdir = ::rtl::OUString::createFromAscii ( "/usr/lib64/" );
+#else
+ m_libdir = ::rtl::OUString::createFromAscii ( "/usr/lib/" );
+#endif
+}
ImplImageTree::~ImplImageTree() {}
@@ -252,6 +246,22 @@ void ImplImageTree::setStyle(rtl::OUStri
}
}
+void ImplImageTree::addUrlToZips(const rtl::OUString &url) {
+ if ( url.getLength() == 0 )
+ return;
+ m_zips.push_back(
+ std::make_pair(
+ url,
+ css::uno::Reference< css::container::XNameAccess >()));
+ sal_Int32 nLibDirPos = url.indexOf( m_libdir );
+ if ( nLibDirPos >= 0 ) {
+ m_zips.push_back(
+ std::make_pair(
+ url.replaceAt( nLibDirPos, m_libdir.getLength(), m_datadir ),
+ css::uno::Reference< css::container::XNameAccess >()));
+ }
+}
+
void ImplImageTree::resetZips() {
m_zips.clear();
{
@@ -277,19 +297,14 @@ void ImplImageTree::resetZips() {
b.appendAscii(RTL_CONSTASCII_STRINGPARAM("_brand.zip"));
bool ok = u.Append(b.makeStringAndClear(), INetURLObject::ENCODE_ALL);
OSL_ASSERT(ok); (void) ok;
- m_zips.push_back(
- std::make_pair(
- u.GetMainURL(INetURLObject::NO_DECODE),
- css::uno::Reference< css::container::XNameAccess >()));
+ addUrlToZips(u.GetMainURL(INetURLObject::NO_DECODE));
}
{
rtl::OUString url(
RTL_CONSTASCII_USTRINGPARAM(
"$BRAND_BASE_DIR/share/config/images_brand.zip"));
rtl::Bootstrap::expandMacros(url);
- m_zips.push_back(
- std::make_pair(
- url, css::uno::Reference< css::container::XNameAccess >()));
+ addUrlToZips(url);
}
{
rtl::OUString url(
@@ -303,10 +318,7 @@ void ImplImageTree::resetZips() {
b.appendAscii(RTL_CONSTASCII_STRINGPARAM(".zip"));
bool ok = u.Append(b.makeStringAndClear(), INetURLObject::ENCODE_ALL);
OSL_ASSERT(ok); (void) ok;
- m_zips.push_back(
- std::make_pair(
- u.GetMainURL(INetURLObject::NO_DECODE),
- css::uno::Reference< css::container::XNameAccess >()));
+ addUrlToZips(u.GetMainURL(INetURLObject::NO_DECODE));
}
if ( m_style.equals(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("default"))) )
{
@@ -314,9 +326,7 @@ void ImplImageTree::resetZips() {
RTL_CONSTASCII_USTRINGPARAM(
"$OOO_BASE_DIR/share/config/images.zip"));
rtl::Bootstrap::expandMacros(url);
- m_zips.push_back(
- std::make_pair(
- url, css::uno::Reference< css::container::XNameAccess >()));
+ addUrlToZips(url);
}
}
--- xmlhelp/source/cxxhelp/provider/provider.cxx.old 2010-06-18 10:32:13.000000000 +0200
+++ xmlhelp/source/cxxhelp/provider/provider.cxx 2010-07-27 17:35:56.000000000 +0200
@@ -346,7 +346,7 @@ void ContentProvider::init()
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( " " )) +
setupextension );
- uno::Sequence< rtl::OUString > aImagesZipPaths( 2 );
+ uno::Sequence< rtl::OUString > aImagesZipPaths( 3 );
xHierAccess = getHierAccess( sProvider, "org.openoffice.Office.Common" );
rtl::OUString aPath( getKey( xHierAccess, "Path/Current/UserConfig" ) );
@@ -355,6 +355,19 @@ void ContentProvider::init()
aPath = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("$OOO_BASE_DIR/share/config"));
rtl::Bootstrap::expandMacros(aPath);
+ aImagesZipPaths[ 2 ] = aPath;
+
+ // try also /usr/share and even before /usr/lib
+ ::rtl::OUString aDataDir = ::rtl::OUString::createFromAscii ( "/usr/share/" );
+#if defined(X86_64)
+ ::rtl::OUString aLibDir = ::rtl::OUString::createFromAscii ( "/usr/lib64/" );
+#else
+ ::rtl::OUString aLibDir = ::rtl::OUString::createFromAscii ( "/usr/lib/" );
+#endif
+ sal_Int32 nLibDirPos = aPath.indexOf( aLibDir );
+
+ if ( nLibDirPos >= 0 )
+ aPath = aPath.replaceAt( nLibDirPos, aLibDir.getLength(), aDataDir );
aImagesZipPaths[ 1 ] = aPath;
uno::Reference< uno::XComponentContext > xContext;