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
63efb93a
Kaydet (Commit)
63efb93a
authored
Şub 18, 2013
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
no need to expand the BRAND_BASE_DIR macro multiple times
Change-Id: I085759537f64489e76e2f33a820cde14767d116a
üst
96189af5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
brand.cxx
vcl/source/app/brand.cxx
+18
-16
No files found.
vcl/source/app/brand.cxx
Dosyayı görüntüle @
63efb93a
...
...
@@ -27,10 +27,9 @@
#include <vcl/svgdata.hxx>
namespace
{
static
bool
loadPng
(
rtl
::
OUString
aUri
,
BitmapEx
&
rBitmap
)
static
bool
loadPng
(
const
OUString
&
rPath
,
BitmapEx
&
rBitmap
)
{
rtl
::
Bootstrap
::
expandMacros
(
aUri
);
INetURLObject
aObj
(
aUri
);
INetURLObject
aObj
(
rPath
);
SvFileStream
aStrm
(
aObj
.
PathToFileName
(),
STREAM_STD_READ
);
if
(
!
aStrm
.
GetError
()
)
{
vcl
::
PNGReader
aReader
(
aStrm
);
...
...
@@ -40,25 +39,24 @@ namespace {
else
return
false
;
}
static
bool
tryLoadPng
(
const
OUString
&
rName
,
BitmapEx
&
rBitmap
)
static
bool
tryLoadPng
(
const
OUString
&
r
BaseDir
,
const
OUString
&
r
Name
,
BitmapEx
&
rBitmap
)
{
return
loadPng
(
"$BRAND_BASE_DIR
/program/edition"
+
rName
,
rBitmap
)
||
loadPng
(
"$BRAND_BASE_DIR
/program"
+
rName
,
rBitmap
);
loadPng
(
rBaseDir
+
"
/program/edition"
+
rName
,
rBitmap
)
||
loadPng
(
rBaseDir
+
"
/program"
+
rName
,
rBitmap
);
}
static
bool
loadSvg
(
rtl
::
OUString
aUri
,
BitmapEx
&
rBitmap
)
static
bool
loadSvg
(
const
OUString
&
rPath
,
BitmapEx
&
rBitmap
)
{
rtl
::
Bootstrap
::
expandMacros
(
aUri
);
INetURLObject
aObj
(
aUri
);
INetURLObject
aObj
(
rPath
);
SvgData
aSvgData
(
aObj
.
PathToFileName
());
rBitmap
=
aSvgData
.
getReplacement
();
return
!
rBitmap
.
IsEmpty
();
}
static
bool
tryLoadSvg
(
const
OUString
&
rName
,
BitmapEx
&
rBitmap
)
static
bool
tryLoadSvg
(
const
OUString
&
r
BaseDir
,
const
OUString
&
r
Name
,
BitmapEx
&
rBitmap
)
{
return
loadSvg
(
"$BRAND_BASE_DIR
/program/edition"
+
rName
,
rBitmap
)
||
loadSvg
(
"$BRAND_BASE_DIR
/program"
+
rName
,
rBitmap
);
loadSvg
(
rBaseDir
+
"
/program/edition"
+
rName
,
rBitmap
)
||
loadSvg
(
rBaseDir
+
"
/program"
+
rName
,
rBitmap
);
}
}
...
...
@@ -66,6 +64,8 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap)
{
// TODO - if we want more flexibility we could add a branding path
// in an rc file perhaps fallback to "about.bmp"
OUString
aBaseDir
(
"$BRAND_BASE_DIR"
);
rtl
::
Bootstrap
::
expandMacros
(
aBaseDir
);
OUString
aBaseName
(
"/"
+
OUString
::
createFromAscii
(
pName
)
);
OUString
aPng
(
".png"
);
...
...
@@ -76,11 +76,11 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap)
::
std
::
vector
<
OUString
>
aFallbacks
(
aLanguageTag
.
getFallbackStrings
());
for
(
size_t
i
=
0
;
i
<
aFallbacks
.
size
();
++
i
)
{
if
(
tryLoadPng
(
aBaseName
+
"-"
+
aFallbacks
[
i
]
+
aPng
,
rBitmap
))
if
(
tryLoadPng
(
aBase
Dir
,
aBase
Name
+
"-"
+
aFallbacks
[
i
]
+
aPng
,
rBitmap
))
return
true
;
}
if
(
tryLoadPng
(
aBaseName
+
aPng
,
rBitmap
))
if
(
tryLoadPng
(
aBase
Dir
,
aBase
Name
+
aPng
,
rBitmap
))
return
true
;
return
false
;
...
...
@@ -88,6 +88,8 @@ bool Application::LoadBrandBitmap (const char* pName, BitmapEx &rBitmap)
bool
Application
::
LoadBrandSVG
(
const
char
*
pName
,
BitmapEx
&
rBitmap
)
{
OUString
aBaseDir
(
"$BRAND_BASE_DIR"
);
rtl
::
Bootstrap
::
expandMacros
(
aBaseDir
);
rtl
::
OUString
aBaseName
(
"/"
+
rtl
::
OUString
::
createFromAscii
(
pName
)
);
rtl
::
OUString
aSvg
(
".svg"
);
...
...
@@ -98,11 +100,11 @@ bool Application::LoadBrandSVG (const char *pName, BitmapEx &rBitmap)
::
std
::
vector
<
OUString
>
aFallbacks
(
aLanguageTag
.
getFallbackStrings
());
for
(
size_t
i
=
0
;
i
<
aFallbacks
.
size
();
++
i
)
{
if
(
tryLoadSvg
(
aBaseName
+
"-"
+
aFallbacks
[
i
]
+
aSvg
,
rBitmap
))
if
(
tryLoadSvg
(
aBase
Dir
,
aBase
Name
+
"-"
+
aFallbacks
[
i
]
+
aSvg
,
rBitmap
))
return
true
;
}
if
(
tryLoadSvg
(
aBaseName
+
aSvg
,
rBitmap
))
if
(
tryLoadSvg
(
aBase
Dir
,
aBase
Name
+
aSvg
,
rBitmap
))
return
true
;
return
false
;
...
...
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