LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File split-icons-search-usr-share.diff of Package libreoffice (Project LibreOffice:Unstable)

Index: vcl/source/gdi/impimagetree.cxx
===================================================================
--- vcl/source/gdi/impimagetree.cxx.orig
+++ vcl/source/gdi/impimagetree.cxx
@@ -156,7 +156,16 @@ void loadFromStream(
 
 }
 
-ImplImageTree::ImplImageTree() { m_cacheIcons = true; }
+ImplImageTree::ImplImageTree()
+{
+    m_cacheIcons = true;
+    m_datadir = ::rtl::OUString( "/usr/share/" );
+#if defined(X86_64)
+    m_libdir = ::rtl::OUString( "/usr/lib64/" );
+#else
+    m_libdir = ::rtl::OUString( "/usr/lib/" );
+#endif
+}
 
 ImplImageTree::~ImplImageTree() {}
 
@@ -297,6 +306,22 @@ void ImplImageTree::setStyle(rtl::OUStri
     }
 }
 
+void ImplImageTree::addUrlToPaths(const rtl::OUString &url) {
+    if ( url.getLength() == 0 ) 
+        return; 
+    m_paths.push_back(
+        std::make_pair(
+        url,
+        css::uno::Reference< css::container::XNameAccess >()));
+    sal_Int32 nLibDirPos = url.indexOf( m_libdir ); 
+    if ( nLibDirPos >= 0 ) {
+    m_paths.push_back(
+            std::make_pair(
+            url.replaceAt( nLibDirPos, m_libdir.getLength(), m_datadir ),
+            css::uno::Reference< css::container::XNameAccess >()));
+    }
+} 
+
 void ImplImageTree::resetPaths() {
     m_paths.clear();
     {
@@ -305,10 +330,7 @@ void ImplImageTree::resetPaths() {
         rtl::Bootstrap::expandMacros(url);
         INetURLObject u(url);
         OSL_ASSERT(!u.HasError());
-        m_paths.push_back(
-            std::make_pair(
-                u.GetMainURL(INetURLObject::NO_DECODE),
-                css::uno::Reference< css::container::XNameAccess >()));
+        addUrlToPaths(u.GetMainURL(INetURLObject::NO_DECODE));
     }
     {
         rtl::OUString url(
@@ -322,17 +344,12 @@ void ImplImageTree::resetPaths() {
         b.appendAscii(RTL_CONSTASCII_STRINGPARAM("_brand"));
         bool ok = u.Append(b.makeStringAndClear(), INetURLObject::ENCODE_ALL);
         OSL_ASSERT(ok); (void) ok;
-        m_paths.push_back(
-            std::make_pair(
-                u.GetMainURL(INetURLObject::NO_DECODE),
-                css::uno::Reference< css::container::XNameAccess >()));
+        addUrlToPaths(u.GetMainURL(INetURLObject::NO_DECODE));
     }
     {
         rtl::OUString url( "$BRAND_BASE_DIR/share/config/images_brand");
         rtl::Bootstrap::expandMacros(url);
-        m_paths.push_back(
-            std::make_pair(
-                url, css::uno::Reference< css::container::XNameAccess >()));
+        addUrlToPaths(url);
     }
     {
         rtl::OUString url(
@@ -345,18 +362,13 @@ void ImplImageTree::resetPaths() {
         b.append(m_style);
         bool ok = u.Append(b.makeStringAndClear(), INetURLObject::ENCODE_ALL);
         OSL_ASSERT(ok); (void) ok;
-        m_paths.push_back(
-            std::make_pair(
-                u.GetMainURL(INetURLObject::NO_DECODE),
-                css::uno::Reference< css::container::XNameAccess >()));
+        addUrlToPaths(u.GetMainURL(INetURLObject::NO_DECODE));
     }
     if ( m_style == "default" )
     {
         rtl::OUString url( "$BRAND_BASE_DIR/share/config/images");
         rtl::Bootstrap::expandMacros(url);
-        m_paths.push_back(
-            std::make_pair(
-                url, css::uno::Reference< css::container::XNameAccess >()));
+        addUrlToPaths(url);
     }
 }
 
Index: vcl/inc/impimagetree.hxx
===================================================================
--- vcl/inc/impimagetree.hxx.orig
+++ vcl/inc/impimagetree.hxx
@@ -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;
     Paths m_paths;
     CheckStyleCache m_checkStyleCache;
@@ -93,6 +97,7 @@ private:
 
     void setStyle(rtl::OUString const & style );
 
+    void addUrlToPaths(const rtl::OUString &url);
     void resetPaths();
 
     bool checkStyleCacheLookup( rtl::OUString const & style, bool &exists );
Index: xmlhelp/source/cxxhelp/provider/provider.cxx
===================================================================
--- xmlhelp/source/cxxhelp/provider/provider.cxx.orig
+++ xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -334,7 +334,7 @@ void ContentProvider::init()
         rtl::OUString( " " ) +
         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" ) );
@@ -343,6 +343,19 @@ void ContentProvider::init()
 
     aPath = rtl::OUString("$BRAND_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;