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
61ff0d65
Kaydet (Commit)
61ff0d65
authored
Kas 13, 2015
tarafından
Noel Grandin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
sc: boost::ptr_vector->std::vector<std::unique_ptr>
Change-Id: I9bcb6a55b568548e969e5528e5ce1399829e1222
üst
44266621
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
16 deletions
+13
-16
xestyle.cxx
sc/source/filter/excel/xestyle.cxx
+13
-16
No files found.
sc/source/filter/excel/xestyle.cxx
Dosyayı görüntüle @
61ff0d65
...
@@ -51,7 +51,6 @@
...
@@ -51,7 +51,6 @@
#include "conditio.hxx"
#include "conditio.hxx"
#include <oox/token/tokens.hxx>
#include <oox/token/tokens.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <o3tl/make_unique.hxx>
#include <o3tl/make_unique.hxx>
using
namespace
::
com
::
sun
::
star
;
using
namespace
::
com
::
sun
::
star
;
...
@@ -300,7 +299,7 @@ private:
...
@@ -300,7 +299,7 @@ private:
const
Color
&
rColor
)
const
;
const
Color
&
rColor
)
const
;
private
:
private
:
typedef
boost
::
ptr_vector
<
XclListColor
>
XclListColorList
;
typedef
std
::
vector
<
std
::
unique_ptr
<
XclListColor
>
>
XclListColorList
;
typedef
std
::
shared_ptr
<
XclListColorList
>
XclListColorListRef
;
typedef
std
::
shared_ptr
<
XclListColorList
>
XclListColorListRef
;
typedef
::
std
::
vector
<
XclColorIdData
>
XclColorIdDataVec
;
typedef
::
std
::
vector
<
XclColorIdData
>
XclColorIdDataVec
;
typedef
::
std
::
vector
<
XclPaletteColor
>
XclPaletteColorVec
;
typedef
::
std
::
vector
<
XclPaletteColor
>
XclPaletteColorVec
;
...
@@ -356,7 +355,7 @@ void XclExpPaletteImpl::Finalize()
...
@@ -356,7 +355,7 @@ void XclExpPaletteImpl::Finalize()
maColorIdDataVec
.
resize
(
nCount
);
maColorIdDataVec
.
resize
(
nCount
);
for
(
sal_uInt32
nIdx
=
0
;
nIdx
<
nCount
;
++
nIdx
)
for
(
sal_uInt32
nIdx
=
0
;
nIdx
<
nCount
;
++
nIdx
)
{
{
const
XclListColor
&
listColor
=
mxColorList
->
at
(
nIdx
);
const
XclListColor
&
listColor
=
*
mxColorList
->
at
(
nIdx
).
get
(
);
maColorIdDataVec
[
listColor
.
GetColorId
()
].
Set
(
listColor
.
GetColor
(),
nIdx
);
maColorIdDataVec
[
listColor
.
GetColorId
()
].
Set
(
listColor
.
GetColor
(),
nIdx
);
}
}
...
@@ -384,7 +383,7 @@ void XclExpPaletteImpl::Finalize()
...
@@ -384,7 +383,7 @@ void XclExpPaletteImpl::Finalize()
// find nearest unused default color for each unprocessed list color
// find nearest unused default color for each unprocessed list color
for
(
nIndex
=
0
;
nIndex
<
nCount
;
++
nIndex
)
for
(
nIndex
=
0
;
nIndex
<
nCount
;
++
nIndex
)
aNearestVec
[
nIndex
].
mnDist
=
aRemapVec
[
nIndex
].
mbProcessed
?
SAL_MAX_INT32
:
aNearestVec
[
nIndex
].
mnDist
=
aRemapVec
[
nIndex
].
mbProcessed
?
SAL_MAX_INT32
:
GetNearestPaletteColor
(
aNearestVec
[
nIndex
].
mnPalIndex
,
mxColorList
->
at
(
nIndex
)
.
GetColor
(),
true
);
GetNearestPaletteColor
(
aNearestVec
[
nIndex
].
mnPalIndex
,
mxColorList
->
at
(
nIndex
)
->
GetColor
(),
true
);
// find the list color which is nearest to a default color
// find the list color which is nearest to a default color
sal_uInt32
nFound
=
0
;
sal_uInt32
nFound
=
0
;
for
(
nIndex
=
1
;
nIndex
<
nCount
;
++
nIndex
)
for
(
nIndex
=
1
;
nIndex
<
nCount
;
++
nIndex
)
...
@@ -393,7 +392,7 @@ void XclExpPaletteImpl::Finalize()
...
@@ -393,7 +392,7 @@ void XclExpPaletteImpl::Finalize()
// replace default color with list color
// replace default color with list color
sal_uInt32
nNearest
=
aNearestVec
[
nFound
].
mnPalIndex
;
sal_uInt32
nNearest
=
aNearestVec
[
nFound
].
mnPalIndex
;
OSL_ENSURE
(
nNearest
<
maPalette
.
size
(),
"XclExpPaletteImpl::Finalize - algorithm error"
);
OSL_ENSURE
(
nNearest
<
maPalette
.
size
(),
"XclExpPaletteImpl::Finalize - algorithm error"
);
maPalette
[
nNearest
].
SetColor
(
mxColorList
->
at
(
nFound
)
.
GetColor
()
);
maPalette
[
nNearest
].
SetColor
(
mxColorList
->
at
(
nFound
)
->
GetColor
()
);
aRemapVec
[
nFound
].
SetIndex
(
nNearest
);
aRemapVec
[
nFound
].
SetIndex
(
nNearest
);
}
}
...
@@ -521,7 +520,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
...
@@ -521,7 +520,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
// search optimization for equal-colored objects occurring repeatedly
// search optimization for equal-colored objects occurring repeatedly
if
(
mnLastIdx
<
mxColorList
->
size
())
if
(
mnLastIdx
<
mxColorList
->
size
())
{
{
pEntry
=
&
(
*
mxColorList
)[
mnLastIdx
]
;
pEntry
=
(
*
mxColorList
)[
mnLastIdx
].
get
()
;
if
(
pEntry
->
GetColor
()
==
rColor
)
if
(
pEntry
->
GetColor
()
==
rColor
)
{
{
rnIndex
=
mnLastIdx
;
rnIndex
=
mnLastIdx
;
...
@@ -536,7 +535,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
...
@@ -536,7 +535,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
while
(
!
bFound
&&
(
nBegIdx
<
nEndIdx
)
)
while
(
!
bFound
&&
(
nBegIdx
<
nEndIdx
)
)
{
{
rnIndex
=
(
nBegIdx
+
nEndIdx
)
/
2
;
rnIndex
=
(
nBegIdx
+
nEndIdx
)
/
2
;
pEntry
=
&
(
*
mxColorList
)[
rnIndex
]
;
pEntry
=
(
*
mxColorList
)[
rnIndex
].
get
()
;
bFound
=
pEntry
->
GetColor
()
==
rColor
;
bFound
=
pEntry
->
GetColor
()
==
rColor
;
if
(
!
bFound
)
if
(
!
bFound
)
{
{
...
@@ -558,9 +557,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
...
@@ -558,9 +557,7 @@ XclListColor* XclExpPaletteImpl::SearchListEntry( const Color& rColor, sal_uInt3
XclListColor
*
XclExpPaletteImpl
::
CreateListEntry
(
const
Color
&
rColor
,
sal_uInt32
nIndex
)
XclListColor
*
XclExpPaletteImpl
::
CreateListEntry
(
const
Color
&
rColor
,
sal_uInt32
nIndex
)
{
{
XclListColor
*
pEntry
=
new
XclListColor
(
rColor
,
mxColorList
->
size
()
);
XclListColor
*
pEntry
=
new
XclListColor
(
rColor
,
mxColorList
->
size
()
);
XclListColorList
::
iterator
itr
=
mxColorList
->
begin
();
mxColorList
->
insert
(
mxColorList
->
begin
()
+
nIndex
,
std
::
unique_ptr
<
XclListColor
>
(
pEntry
));
::
std
::
advance
(
itr
,
nIndex
);
mxColorList
->
insert
(
itr
,
pEntry
);
return
pEntry
;
return
pEntry
;
}
}
...
@@ -599,7 +596,7 @@ void XclExpPaletteImpl::RawReducePalette( sal_uInt32 nPass )
...
@@ -599,7 +596,7 @@ void XclExpPaletteImpl::RawReducePalette( sal_uInt32 nPass )
for
(
sal_uInt32
nIdx
=
0
,
nCount
=
xOldList
->
size
();
nIdx
<
nCount
;
++
nIdx
)
for
(
sal_uInt32
nIdx
=
0
,
nCount
=
xOldList
->
size
();
nIdx
<
nCount
;
++
nIdx
)
{
{
// get the old list entry
// get the old list entry
const
XclListColor
*
pOldEntry
=
&
(
xOldList
->
at
(
nIdx
)
);
const
XclListColor
*
pOldEntry
=
xOldList
->
at
(
nIdx
).
get
(
);
nR
=
pOldEntry
->
GetColor
().
GetRed
();
nR
=
pOldEntry
->
GetColor
().
GetRed
();
nG
=
pOldEntry
->
GetColor
().
GetGreen
();
nG
=
pOldEntry
->
GetColor
().
GetGreen
();
nB
=
pOldEntry
->
GetColor
().
GetBlue
();
nB
=
pOldEntry
->
GetColor
().
GetBlue
();
...
@@ -637,8 +634,8 @@ void XclExpPaletteImpl::ReduceLeastUsedColor()
...
@@ -637,8 +634,8 @@ void XclExpPaletteImpl::ReduceLeastUsedColor()
sal_uInt32
nKeep
=
GetNearestListColor
(
nRemove
);
sal_uInt32
nKeep
=
GetNearestListColor
(
nRemove
);
// merge both colors to one color, remove one color from list
// merge both colors to one color, remove one color from list
XclListColor
*
pKeepEntry
=
&
mxColorList
->
at
(
nKeep
);
XclListColor
*
pKeepEntry
=
mxColorList
->
at
(
nKeep
).
get
(
);
XclListColor
*
pRemoveEntry
=
&
mxColorList
->
at
(
nRemove
);
XclListColor
*
pRemoveEntry
=
mxColorList
->
at
(
nRemove
).
get
(
);
if
(
pKeepEntry
&&
pRemoveEntry
)
if
(
pKeepEntry
&&
pRemoveEntry
)
{
{
// merge both colors (if pKeepEntry is a base color, it will not change)
// merge both colors (if pKeepEntry is a base color, it will not change)
...
@@ -667,7 +664,7 @@ sal_uInt32 XclExpPaletteImpl::GetLeastUsedListColor() const
...
@@ -667,7 +664,7 @@ sal_uInt32 XclExpPaletteImpl::GetLeastUsedListColor() const
for
(
sal_uInt32
nIdx
=
0
,
nCount
=
mxColorList
->
size
();
nIdx
<
nCount
;
++
nIdx
)
for
(
sal_uInt32
nIdx
=
0
,
nCount
=
mxColorList
->
size
();
nIdx
<
nCount
;
++
nIdx
)
{
{
XclListColor
&
pEntry
=
mxColorList
->
at
(
nIdx
);
XclListColor
&
pEntry
=
*
mxColorList
->
at
(
nIdx
).
get
(
);
// ignore the base colors
// ignore the base colors
if
(
!
pEntry
.
IsBaseColor
()
&&
(
pEntry
.
GetWeighting
()
<
nMinW
)
)
if
(
!
pEntry
.
IsBaseColor
()
&&
(
pEntry
.
GetWeighting
()
<
nMinW
)
)
{
{
...
@@ -687,7 +684,7 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( const Color& rColor, sal_uInt
...
@@ -687,7 +684,7 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( const Color& rColor, sal_uInt
{
{
if
(
nIdx
!=
nIgnore
)
if
(
nIdx
!=
nIgnore
)
{
{
if
(
XclListColor
*
pEntry
=
&
mxColorList
->
at
(
nIdx
)
)
if
(
XclListColor
*
pEntry
=
mxColorList
->
at
(
nIdx
).
get
(
)
)
{
{
sal_Int32
nDist
=
lclGetColorDistance
(
rColor
,
pEntry
->
GetColor
()
);
sal_Int32
nDist
=
lclGetColorDistance
(
rColor
,
pEntry
->
GetColor
()
);
if
(
nDist
<
nMinD
)
if
(
nDist
<
nMinD
)
...
@@ -705,7 +702,7 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( sal_uInt32 nIndex ) const
...
@@ -705,7 +702,7 @@ sal_uInt32 XclExpPaletteImpl::GetNearestListColor( sal_uInt32 nIndex ) const
{
{
if
(
nIndex
>=
mxColorList
->
size
())
if
(
nIndex
>=
mxColorList
->
size
())
return
0
;
return
0
;
XclListColor
*
pEntry
=
&
mxColorList
->
at
(
nIndex
);
XclListColor
*
pEntry
=
mxColorList
->
at
(
nIndex
).
get
(
);
return
GetNearestListColor
(
pEntry
->
GetColor
(),
nIndex
);
return
GetNearestListColor
(
pEntry
->
GetColor
(),
nIndex
);
}
}
...
...
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