Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
3820d954
Kaydet (Commit)
3820d954
authored
Kas 23, 2014
tarafından
Jan Holesovsky
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
icons: Store paths of more styles at the same time.
Change-Id: I9a13aa3ed928b989eaa2b2da8d1acfc5a37f506e
üst
9e4a1396
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
23 deletions
+43
-23
impimagetree.hxx
vcl/inc/impimagetree.hxx
+13
-3
impimagetree.cxx
vcl/source/gdi/impimagetree.cxx
+30
-20
No files found.
vcl/inc/impimagetree.hxx
Dosyayı görüntüle @
3820d954
...
@@ -58,17 +58,27 @@ public:
...
@@ -58,17 +58,27 @@ public:
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
getNameAccess
();
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
getNameAccess
();
private
:
private
:
struct
IconSet
{
OUString
maURL
;
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
maNameAccess
;
IconSet
()
{}
IconSet
(
const
OUString
&
aURL
)
:
maURL
(
aURL
)
{}
};
/// Map between the theme name(s) and the content.
typedef
boost
::
unordered_map
<
OUString
,
IconSet
,
OUStringHash
>
StyleIconSet
;
StyleIconSet
maIconSet
;
bool
doLoadImage
(
bool
doLoadImage
(
OUString
const
&
name
,
OUString
const
&
style
,
OUString
const
&
name
,
OUString
const
&
style
,
BitmapEx
&
bitmap
,
bool
localized
);
BitmapEx
&
bitmap
,
bool
localized
);
typedef
std
::
pair
<
OUString
,
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>>
Path
;
typedef
boost
::
unordered_map
<
OUString
,
std
::
pair
<
bool
,
BitmapEx
>
,
OUStringHash
>
IconCache
;
typedef
boost
::
unordered_map
<
OUString
,
std
::
pair
<
bool
,
BitmapEx
>
,
OUStringHash
>
IconCache
;
typedef
boost
::
unordered_map
<
OUString
,
OUString
,
OUStringHash
>
IconLinkHash
;
typedef
boost
::
unordered_map
<
OUString
,
OUString
,
OUStringHash
>
IconLinkHash
;
OUString
m_style
;
OUString
m_style
;
Path
m_path
;
IconCache
m_iconCache
;
IconCache
m_iconCache
;
IconLinkHash
m_linkHash
;
IconLinkHash
m_linkHash
;
...
...
vcl/source/gdi/impimagetree.cxx
Dosyayı görüntüle @
3820d954
...
@@ -47,6 +47,8 @@
...
@@ -47,6 +47,8 @@
#include "impimagetree.hxx"
#include "impimagetree.hxx"
#include <vcldemo-debug.hxx>
#include <vcldemo-debug.hxx>
using
namespace
css
;
namespace
{
namespace
{
static
OUString
createPath
(
OUString
const
&
name
,
sal_Int32
pos
,
OUString
const
&
locale
)
static
OUString
createPath
(
OUString
const
&
name
,
sal_Int32
pos
,
OUString
const
&
locale
)
...
@@ -191,6 +193,9 @@ void ImplImageTree::setStyle(OUString const & style)
...
@@ -191,6 +193,9 @@ void ImplImageTree::setStyle(OUString const & style)
void
ImplImageTree
::
resetPaths
()
void
ImplImageTree
::
resetPaths
()
{
{
if
(
maIconSet
.
find
(
m_style
)
!=
maIconSet
.
end
())
return
;
OUString
url
(
"$BRAND_BASE_DIR/"
LIBO_SHARE_FOLDER
"/config/"
);
OUString
url
(
"$BRAND_BASE_DIR/"
LIBO_SHARE_FOLDER
"/config/"
);
rtl
::
Bootstrap
::
expandMacros
(
url
);
rtl
::
Bootstrap
::
expandMacros
(
url
);
if
(
m_style
!=
"default"
)
if
(
m_style
!=
"default"
)
...
@@ -203,8 +208,8 @@ void ImplImageTree::resetPaths()
...
@@ -203,8 +208,8 @@ void ImplImageTree::resetPaths()
}
}
else
else
url
+=
"images"
;
url
+=
"images"
;
m_path
=
std
::
make_pair
(
url
,
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
()
);
maIconSet
[
m_style
]
=
IconSet
(
url
);
}
}
bool
ImplImageTree
::
iconCacheLookup
(
OUString
const
&
name
,
bool
localized
,
BitmapEx
&
bitmap
)
bool
ImplImageTree
::
iconCacheLookup
(
OUString
const
&
name
,
bool
localized
,
BitmapEx
&
bitmap
)
...
@@ -223,14 +228,16 @@ bool ImplImageTree::findImage(std::vector<OUString> const & paths, BitmapEx & bi
...
@@ -223,14 +228,16 @@ bool ImplImageTree::findImage(std::vector<OUString> const & paths, BitmapEx & bi
if
(
!
checkPathAccess
())
if
(
!
checkPathAccess
())
return
false
;
return
false
;
for
(
std
::
vector
<
OUString
>::
const_reverse_iterator
j
(
paths
.
rbegin
());
const
uno
::
Reference
<
container
::
XNameAccess
>
&
rNameAccess
=
maIconSet
[
m_style
].
maNameAccess
;
j
!=
paths
.
rend
();
++
j
)
for
(
std
::
vector
<
OUString
>::
const_reverse_iterator
j
(
paths
.
rbegin
());
j
!=
paths
.
rend
();
++
j
)
{
{
if
(
m_path
.
second
->
hasByName
(
*
j
))
if
(
rNameAccess
->
hasByName
(
*
j
))
{
{
css
::
uno
::
Reference
<
css
::
io
::
XInputStream
>
s
;
css
::
uno
::
Reference
<
css
::
io
::
XInputStream
>
s
;
bool
ok
=
m_path
.
second
->
getByName
(
*
j
)
>>=
s
;
bool
ok
=
rNameAccess
->
getByName
(
*
j
)
>>=
s
;
OSL_ASSERT
(
ok
);
(
void
)
ok
;
assert
(
ok
);
loadImageFromStream
(
wrapStream
(
s
),
*
j
,
bitmap
);
loadImageFromStream
(
wrapStream
(
s
),
*
j
,
bitmap
);
return
true
;
return
true
;
}
}
...
@@ -245,11 +252,13 @@ void ImplImageTree::loadImageLinks()
...
@@ -245,11 +252,13 @@ void ImplImageTree::loadImageLinks()
if
(
!
checkPathAccess
())
if
(
!
checkPathAccess
())
return
;
return
;
if
(
m_path
.
second
->
hasByName
(
aLinkFilename
)
)
const
uno
::
Reference
<
container
::
XNameAccess
>
&
rNameAccess
=
maIconSet
[
m_style
].
maNameAccess
;
if
(
rNameAccess
->
hasByName
(
aLinkFilename
))
{
{
css
::
uno
::
Reference
<
css
::
io
::
XInputStream
>
s
;
css
::
uno
::
Reference
<
css
::
io
::
XInputStream
>
s
;
bool
ok
=
m_path
.
second
->
getByName
(
aLinkFilename
)
>>=
s
;
bool
ok
=
rNameAccess
->
getByName
(
aLinkFilename
)
>>=
s
;
OSL_ASSERT
(
ok
);
(
void
)
ok
;
assert
(
ok
)
;
parseLinkFile
(
wrapStream
(
s
)
);
parseLinkFile
(
wrapStream
(
s
)
);
return
;
return
;
...
@@ -293,25 +302,27 @@ OUString const & ImplImageTree::getRealImageName(OUString const & name)
...
@@ -293,25 +302,27 @@ OUString const & ImplImageTree::getRealImageName(OUString const & name)
bool
ImplImageTree
::
checkPathAccess
()
bool
ImplImageTree
::
checkPathAccess
()
{
{
if
(
m_path
.
second
.
is
())
uno
::
Reference
<
container
::
XNameAccess
>
&
rNameAccess
=
maIconSet
[
m_style
].
maNameAccess
;
if
(
rNameAccess
.
is
())
return
true
;
return
true
;
try
{
try
{
m_path
.
second
=
css
::
packages
::
zip
::
ZipFileAccess
::
createWithURL
(
comphelper
::
getProcessComponentContext
(),
m_path
.
first
+
".zip"
);
rNameAccess
=
css
::
packages
::
zip
::
ZipFileAccess
::
createWithURL
(
comphelper
::
getProcessComponentContext
(),
maIconSet
[
m_style
].
maURL
+
".zip"
);
}
catch
(
const
css
::
uno
::
RuntimeException
&
)
{
}
catch
(
const
css
::
uno
::
RuntimeException
&
)
{
throw
;
throw
;
}
catch
(
const
css
::
uno
::
Exception
&
e
)
{
}
SAL_INFO
(
"vcl"
,
"ImplImageTree::zip file location exception "
catch
(
const
css
::
uno
::
Exception
&
e
)
{
<<
e
.
Message
<<
" for "
<<
m_path
.
first
);
SAL_INFO
(
"vcl"
,
"ImplImageTree::zip file location exception "
<<
e
.
Message
<<
" for "
<<
maIconSet
[
m_style
].
maURL
);
return
false
;
return
false
;
}
}
return
m_path
.
second
.
is
();
return
rNameAccess
.
is
();
}
}
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
ImplImageTree
::
getNameAccess
()
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
ImplImageTree
::
getNameAccess
()
{
{
checkPathAccess
();
checkPathAccess
();
return
m
_path
.
second
;
return
m
aIconSet
[
m_style
].
maNameAccess
;
}
}
/// Recursively dump all names ...
/// Recursively dump all names ...
...
@@ -319,8 +330,7 @@ css::uno::Sequence<OUString> ImageTree_getAllImageNames()
...
@@ -319,8 +330,7 @@ css::uno::Sequence<OUString> ImageTree_getAllImageNames()
{
{
static
ImplImageTreeSingletonRef
aImageTree
;
static
ImplImageTreeSingletonRef
aImageTree
;
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
xRef
(
css
::
uno
::
Reference
<
css
::
container
::
XNameAccess
>
xRef
(
aImageTree
->
getNameAccess
());
aImageTree
->
getNameAccess
()
);
return
xRef
->
getElementNames
();
return
xRef
->
getElementNames
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment