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
cfdefe48
Kaydet (Commit)
cfdefe48
authored
Tem 25, 2014
tarafından
Krisztian Pinter
Kaydeden (comit)
Tomaž Vajngerl
Eyl 17, 2014
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add loading .soc palettes
Change-Id: Ie0d084a70d9b135658840bb7529f2099a702d280
üst
d1d5c918
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
73 deletions
+152
-73
Palette.hxx
include/svx/Palette.hxx
+37
-7
PaletteManager.hxx
include/svx/PaletteManager.hxx
+3
-1
SvxColorValueSet.hxx
include/svx/SvxColorValueSet.hxx
+0
-2
Palette.cxx
svx/source/tbxctrls/Palette.cxx
+90
-37
PaletteManager.cxx
svx/source/tbxctrls/PaletteManager.cxx
+22
-12
SvxColorValueSet.cxx
svx/source/tbxctrls/SvxColorValueSet.cxx
+0
-14
No files found.
include/svx/Palette.hxx
Dosyayı görüntüle @
cfdefe48
...
@@ -19,16 +19,30 @@
...
@@ -19,16 +19,30 @@
#ifndef INCLUDED_SVX_PALETTE_HXX
#ifndef INCLUDED_SVX_PALETTE_HXX
#define INCLUDED_SVX_PALETTE_HXX
#define INCLUDED_SVX_PALETTE_HXX
#include <svx/SvxColorValueSet.hxx>
#include <svx/xtable.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
#include <tools/color.hxx>
#include <tools/stream.hxx>
#include <tools/stream.hxx>
typedef
std
::
pair
<
Color
,
OString
>
NamedColor
;
typedef
std
::
vector
<
NamedColor
>
ColorList
;
class
Palette
class
Palette
{
{
public
:
public
:
typedef
std
::
pair
<
Color
,
OString
>
NamedColor
;
virtual
~
Palette
();
typedef
std
::
vector
<
NamedColor
>
ColorList
;
private
:
virtual
const
OUString
&
GetName
()
=
0
;
virtual
void
LoadColorSet
(
SvxColorValueSet
&
rColorSet
)
=
0
;
virtual
bool
IsValid
()
=
0
;
};
class
PaletteGPL
:
public
Palette
{
bool
mbLoadedPalette
;
bool
mbLoadedPalette
;
bool
mbValidPalette
;
bool
mbValidPalette
;
OUString
maFName
;
OUString
maFName
;
...
@@ -40,12 +54,28 @@ private:
...
@@ -40,12 +54,28 @@ private:
void
LoadPaletteHeader
();
void
LoadPaletteHeader
();
void
LoadPalette
();
void
LoadPalette
();
public
:
public
:
Palette
(
const
OUString
&
rFPath
,
const
OUString
&
rFName
);
PaletteGPL
(
const
OUString
&
rFPath
,
const
OUString
&
rFName
);
virtual
~
PaletteGPL
();
virtual
const
OUString
&
GetName
();
virtual
void
LoadColorSet
(
SvxColorValueSet
&
rColorSet
);
virtual
bool
IsValid
();
};
class
PaletteSOC
:
public
Palette
{
//TODO add lazy loading
OUString
maName
;
XColorListRef
mpColorList
;
public
:
PaletteSOC
(
const
OUString
&
rFPath
,
const
OUString
&
rFName
);
virtual
~
PaletteSOC
();
const
OUString
&
GetName
();
virtual
const
OUString
&
GetName
();
const
ColorList
&
GetPaletteColors
(
);
virtual
void
LoadColorSet
(
SvxColorValueSet
&
rColorSet
);
bool
IsValid
();
virtual
bool
IsValid
();
};
};
#endif // INCLUDED_SVX_PALETTE_HXX
#endif // INCLUDED_SVX_PALETTE_HXX
...
...
include/svx/PaletteManager.hxx
Dosyayı görüntüle @
cfdefe48
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#define INCLUDED_SVX_PALETTEMANAGER_HXX
#define INCLUDED_SVX_PALETTEMANAGER_HXX
#include <svx/SvxColorValueSet.hxx>
#include <svx/SvxColorValueSet.hxx>
#include <svx/Palette.hxx>
#include <rtl/ustring.hxx>
#include <rtl/ustring.hxx>
#include <svx/tbxcolorupdate.hxx>
#include <svx/tbxcolorupdate.hxx>
...
@@ -32,9 +33,10 @@ class PaletteManager
...
@@ -32,9 +33,10 @@ class PaletteManager
svx
::
ToolboxButtonColorUpdater
*
mpBtnUpdater
;
svx
::
ToolboxButtonColorUpdater
*
mpBtnUpdater
;
Color
mLastColor
;
Color
mLastColor
;
std
::
vector
<
Palette
>
maPalettes
;
std
::
vector
<
Palette
*
>
maPalettes
;
public
:
public
:
PaletteManager
();
PaletteManager
();
~
PaletteManager
();
void
LoadPalettes
();
void
LoadPalettes
();
void
ReloadColorSet
(
SvxColorValueSet
&
rColorSet
);
void
ReloadColorSet
(
SvxColorValueSet
&
rColorSet
);
std
::
vector
<
OUString
>
GetPaletteList
();
std
::
vector
<
OUString
>
GetPaletteList
();
...
...
include/svx/SvxColorValueSet.hxx
Dosyayı görüntüle @
cfdefe48
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
#ifndef INCLUDED_SVX_SVXCOLORVALUESET_HXX
#ifndef INCLUDED_SVX_SVXCOLORVALUESET_HXX
#define INCLUDED_SVX_SVXCOLORVALUESET_HXX
#define INCLUDED_SVX_SVXCOLORVALUESET_HXX
#include <svx/Palette.hxx>
#include <svtools/valueset.hxx>
#include <svtools/valueset.hxx>
#include <svx/svxdllapi.h>
#include <svx/svxdllapi.h>
...
@@ -41,7 +40,6 @@ public:
...
@@ -41,7 +40,6 @@ public:
void
addEntriesForXColorList
(
const
XColorList
&
rXColorList
,
sal_uInt32
nStartIndex
=
1
);
void
addEntriesForXColorList
(
const
XColorList
&
rXColorList
,
sal_uInt32
nStartIndex
=
1
);
void
loadColorVector
(
const
std
::
vector
<
Color
>&
rColorVector
,
const
OUString
&
rNamePrefix
,
sal_uInt32
nStartIndex
=
1
);
void
loadColorVector
(
const
std
::
vector
<
Color
>&
rColorVector
,
const
OUString
&
rNamePrefix
,
sal_uInt32
nStartIndex
=
1
);
void
loadPalette
(
Palette
&
rPalette
);
Size
layoutAllVisible
(
sal_uInt32
nEntryCount
);
Size
layoutAllVisible
(
sal_uInt32
nEntryCount
);
Size
layoutToGivenHeight
(
sal_uInt32
nHeight
,
sal_uInt32
nEntryCount
);
Size
layoutToGivenHeight
(
sal_uInt32
nHeight
,
sal_uInt32
nEntryCount
);
};
};
...
...
svx/source/tbxctrls/Palette.cxx
Dosyayı görüntüle @
cfdefe48
...
@@ -19,39 +19,16 @@
...
@@ -19,39 +19,16 @@
#include <svx/Palette.hxx>
#include <svx/Palette.hxx>
// finds first token in rStr from index, separated by whitespace
// returns position of next token in index
OString
lcl_getToken
(
const
OString
&
rStr
,
sal_Int32
&
index
)
{
sal_Int32
substart
,
toklen
=
0
;
while
(
index
<
rStr
.
getLength
()
&&
(
rStr
[
index
]
==
' '
||
rStr
[
index
]
==
'\n'
||
rStr
[
index
]
==
'\t'
))
++
index
;
if
(
index
==
rStr
.
getLength
())
{
index
=
-
1
;
return
OString
();
}
substart
=
index
;
while
(
index
<
rStr
.
getLength
()
&&
Palette
::~
Palette
()
!
(
rStr
[
index
]
==
' '
||
rStr
[
index
]
==
'\n'
||
rStr
[
index
]
==
'\t'
))
{
{
}
++
index
;
++
toklen
;
}
while
(
index
<
rStr
.
getLength
()
&&
// PaletteGPL ------------------------------------------------------------------
(
rStr
[
index
]
==
' '
||
rStr
[
index
]
==
'\n'
||
rStr
[
index
]
==
'\t'
))
++
index
;
if
(
index
==
rStr
.
getLength
())
index
=
-
1
;
return
rStr
.
copy
(
substart
,
toklen
);
OString
lcl_getToken
(
const
OString
&
rStr
,
sal_Int32
&
index
);
}
Palette
::
Palette
(
const
OUString
&
rFPath
,
const
OUString
&
rFName
)
:
Palette
GPL
::
PaletteGPL
(
const
OUString
&
rFPath
,
const
OUString
&
rFName
)
:
mbLoadedPalette
(
false
),
mbLoadedPalette
(
false
),
mbValidPalette
(
false
),
mbValidPalette
(
false
),
maFName
(
rFName
),
maFName
(
rFName
),
...
@@ -60,23 +37,36 @@ Palette::Palette( const OUString &rFPath, const OUString &rFName ) :
...
@@ -60,23 +37,36 @@ Palette::Palette( const OUString &rFPath, const OUString &rFName ) :
LoadPaletteHeader
();
LoadPaletteHeader
();
}
}
const
OUString
&
Palette
::
GetName
()
PaletteGPL
::~
PaletteGPL
()
{
}
const
OUString
&
PaletteGPL
::
GetName
()
{
{
return
maName
;
return
maName
;
}
}
const
Palette
::
ColorList
&
Palette
::
GetPaletteColors
(
)
void
PaletteGPL
::
LoadColorSet
(
SvxColorValueSet
&
rColorSet
)
{
{
LoadPalette
();
LoadPalette
();
return
maColors
;
rColorSet
.
Clear
();
int
nIx
=
1
;
for
(
ColorList
::
const_iterator
it
=
maColors
.
begin
();
it
!=
maColors
.
end
();
++
it
)
{
// TODO make it->second OUString
rColorSet
.
InsertItem
(
nIx
,
it
->
first
,
OStringToOUString
(
it
->
second
,
RTL_TEXTENCODING_ASCII_US
));
++
nIx
;
}
}
}
bool
Palette
::
IsValid
()
bool
Palette
GPL
::
IsValid
()
{
{
return
mbValidPalette
;
return
mbValidPalette
;
}
}
bool
Palette
::
ReadPaletteHeader
(
SvFileStream
&
rFileStream
)
bool
Palette
GPL
::
ReadPaletteHeader
(
SvFileStream
&
rFileStream
)
{
{
OString
aLine
;
OString
aLine
;
OString
aName
;
OString
aName
;
...
@@ -98,14 +88,13 @@ bool Palette::ReadPaletteHeader(SvFileStream& rFileStream)
...
@@ -98,14 +88,13 @@ bool Palette::ReadPaletteHeader(SvFileStream& rFileStream)
return
true
;
return
true
;
}
}
//TODO make this LoadPaletteHeader and set a bool if palette is incorrect
void
PaletteGPL
::
LoadPaletteHeader
()
void
Palette
::
LoadPaletteHeader
()
{
{
SvFileStream
aFile
(
maFPath
,
STREAM_READ
);
SvFileStream
aFile
(
maFPath
,
STREAM_READ
);
mbValidPalette
=
ReadPaletteHeader
(
aFile
);
mbValidPalette
=
ReadPaletteHeader
(
aFile
);
}
}
void
Palette
::
LoadPalette
()
void
Palette
GPL
::
LoadPalette
()
{
{
if
(
mbLoadedPalette
)
return
;
if
(
mbLoadedPalette
)
return
;
mbLoadedPalette
=
true
;
mbLoadedPalette
=
true
;
...
@@ -145,4 +134,68 @@ void Palette::LoadPalette()
...
@@ -145,4 +134,68 @@ void Palette::LoadPalette()
}
while
(
aFile
.
ReadLine
(
aLine
));
}
while
(
aFile
.
ReadLine
(
aLine
));
}
}
// finds first token in rStr from index, separated by whitespace
// returns position of next token in index
OString
lcl_getToken
(
const
OString
&
rStr
,
sal_Int32
&
index
)
{
sal_Int32
substart
,
toklen
=
0
;
OUString
aWhitespaceChars
(
"
\n\t
"
);
while
(
index
<
rStr
.
getLength
()
&&
aWhitespaceChars
.
indexOf
(
rStr
[
index
]
)
!=
-
1
)
++
index
;
if
(
index
==
rStr
.
getLength
())
{
index
=
-
1
;
return
OString
();
}
substart
=
index
;
//counts length of token
while
(
index
<
rStr
.
getLength
()
&&
aWhitespaceChars
.
indexOf
(
rStr
[
index
]
)
==
-
1
)
{
++
index
;
++
toklen
;
}
//counts to position of next token
while
(
index
<
rStr
.
getLength
()
&&
aWhitespaceChars
.
indexOf
(
rStr
[
index
]
)
!=
-
1
)
++
index
;
if
(
index
==
rStr
.
getLength
())
index
=
-
1
;
return
rStr
.
copy
(
substart
,
toklen
);
}
// PaletteSOC ------------------------------------------------------------------
PaletteSOC
::
PaletteSOC
(
const
OUString
&
rFPath
,
const
OUString
&
rFName
)
{
maName
=
rFName
;
mpColorList
=
XPropertyList
::
AsColorList
(
XPropertyList
::
CreatePropertyListFromURL
(
XCOLOR_LIST
,
rFPath
));
mpColorList
->
Load
();
}
PaletteSOC
::~
PaletteSOC
()
{
}
const
OUString
&
PaletteSOC
::
GetName
()
{
return
maName
;
}
void
PaletteSOC
::
LoadColorSet
(
SvxColorValueSet
&
rColorSet
)
{
rColorSet
.
Clear
();
rColorSet
.
addEntriesForXColorList
(
*
mpColorList
);
}
bool
PaletteSOC
::
IsValid
()
{
return
mpColorList
.
is
();
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
svx/source/tbxctrls/PaletteManager.cxx
Dosyayı görüntüle @
cfdefe48
...
@@ -39,6 +39,16 @@ PaletteManager::PaletteManager() :
...
@@ -39,6 +39,16 @@ PaletteManager::PaletteManager() :
mnNumOfPalettes
+=
maPalettes
.
size
();
mnNumOfPalettes
+=
maPalettes
.
size
();
}
}
PaletteManager
::~
PaletteManager
()
{
for
(
std
::
vector
<
Palette
*>::
iterator
it
=
maPalettes
.
begin
();
it
!=
maPalettes
.
end
();
++
it
)
{
delete
*
it
;
}
}
void
PaletteManager
::
LoadPalettes
()
void
PaletteManager
::
LoadPalettes
()
{
{
OUString
aPalPath
=
SvtPathOptions
().
GetPalettePath
();
OUString
aPalPath
=
SvtPathOptions
().
GetPalettePath
();
...
@@ -57,12 +67,14 @@ void PaletteManager::LoadPalettes()
...
@@ -57,12 +67,14 @@ void PaletteManager::LoadPalettes()
if
(
aFileStat
.
isRegular
()
||
aFileStat
.
isLink
())
if
(
aFileStat
.
isRegular
()
||
aFileStat
.
isLink
())
{
{
OUString
aFName
=
aFileStat
.
getFileName
();
OUString
aFName
=
aFileStat
.
getFileName
();
Palette
*
pPalette
=
0
;
if
(
aFName
.
endsWithIgnoreAsciiCase
(
".gpl"
)
)
if
(
aFName
.
endsWithIgnoreAsciiCase
(
".gpl"
)
)
{
pPalette
=
new
PaletteGPL
(
aFileStat
.
getFileURL
(),
aFName
);
Palette
aPalette
(
aFileStat
.
getFileURL
(),
aFName
);
else
if
(
aFName
.
endsWithIgnoreAsciiCase
(
".soc"
)
)
if
(
aPalette
.
IsValid
()
)
pPalette
=
new
PaletteSOC
(
aFileStat
.
getFileURL
(),
aFName
);
maPalettes
.
push_back
(
aPalette
);
}
if
(
pPalette
&&
pPalette
->
IsValid
()
)
maPalettes
.
push_back
(
pPalette
);
}
}
}
}
}
}
...
@@ -104,10 +116,8 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
...
@@ -104,10 +116,8 @@ void PaletteManager::ReloadColorSet(SvxColorValueSet &rColorSet)
}
}
else
else
{
{
Palette
&
rPal
=
maPalettes
[
mnCurrentPalette
-
1
];
maPalettes
[
mnCurrentPalette
-
1
]
->
LoadColorSet
(
rColorSet
);
mnColorCount
=
rPal
.
GetPaletteColors
().
size
();
mnColorCount
=
rColorSet
.
GetItemCount
();
rColorSet
.
Clear
();
rColorSet
.
loadPalette
(
rPal
);
}
}
}
}
...
@@ -117,11 +127,11 @@ std::vector<OUString> PaletteManager::GetPaletteList()
...
@@ -117,11 +127,11 @@ std::vector<OUString> PaletteManager::GetPaletteList()
aPaletteNames
.
push_back
(
STR_DEFAULT_PAL
);
aPaletteNames
.
push_back
(
STR_DEFAULT_PAL
);
for
(
std
::
vector
<
Palette
>::
iterator
it
=
maPalettes
.
begin
();
for
(
std
::
vector
<
Palette
*
>::
iterator
it
=
maPalettes
.
begin
();
it
!=
maPalettes
.
end
();
it
!=
maPalettes
.
end
();
++
it
)
++
it
)
{
{
aPaletteNames
.
push_back
(
it
->
GetName
()
);
aPaletteNames
.
push_back
(
(
*
it
)
->
GetName
()
);
}
}
aPaletteNames
.
push_back
(
STR_DOC_COLORS
);
aPaletteNames
.
push_back
(
STR_DOC_COLORS
);
...
@@ -151,7 +161,7 @@ OUString PaletteManager::GetPaletteName()
...
@@ -151,7 +161,7 @@ OUString PaletteManager::GetPaletteName()
else
if
(
mnCurrentPalette
==
mnNumOfPalettes
-
1
)
else
if
(
mnCurrentPalette
==
mnNumOfPalettes
-
1
)
return
OUString
(
STR_DOC_COLORS
);
return
OUString
(
STR_DOC_COLORS
);
else
else
return
maPalettes
[
mnCurrentPalette
-
1
]
.
GetName
();
return
maPalettes
[
mnCurrentPalette
-
1
]
->
GetName
();
}
}
const
Color
&
PaletteManager
::
GetLastColor
()
const
Color
&
PaletteManager
::
GetLastColor
()
...
...
svx/source/tbxctrls/SvxColorValueSet.cxx
Dosyayı görüntüle @
cfdefe48
...
@@ -106,20 +106,6 @@ void SvxColorValueSet::loadColorVector(const std::vector<Color>& rColorVector, c
...
@@ -106,20 +106,6 @@ void SvxColorValueSet::loadColorVector(const std::vector<Color>& rColorVector, c
}
}
}
}
void
SvxColorValueSet
::
loadPalette
(
Palette
&
rPalette
)
{
const
Palette
::
ColorList
&
rColors
=
rPalette
.
GetPaletteColors
();
Clear
();
int
nIx
=
1
;
for
(
Palette
::
ColorList
::
const_iterator
it
=
rColors
.
begin
();
it
!=
rColors
.
end
();
++
it
)
{
InsertItem
(
nIx
,
it
->
first
,
OStringToOUString
(
it
->
second
,
RTL_TEXTENCODING_ASCII_US
));
++
nIx
;
}
}
Size
SvxColorValueSet
::
layoutAllVisible
(
sal_uInt32
nEntryCount
)
Size
SvxColorValueSet
::
layoutAllVisible
(
sal_uInt32
nEntryCount
)
{
{
if
(
!
nEntryCount
)
if
(
!
nEntryCount
)
...
...
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