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
a19b18ad
Kaydet (Commit)
a19b18ad
authored
Kas 04, 2016
tarafından
Caolán McNamara
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
move now combined ColorLB to location of last user
Change-Id: I5dc1204c28b65d5dca993bf38aea217bbb49e913
üst
a989a0b1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
331 additions
and
328 deletions
+331
-328
optchart.cxx
cui/source/options/optchart.cxx
+328
-0
optchart.hxx
cui/source/options/optchart.hxx
+2
-0
optchartcolorspage.ui
cui/uiconfig/ui/optchartcolorspage.ui
+1
-1
dlgctrl.hxx
include/svx/dlgctrl.hxx
+0
-74
dlgctrl.cxx
svx/source/dialog/dlgctrl.cxx
+0
-253
No files found.
cui/source/options/optchart.cxx
Dosyayı görüntüle @
a19b18ad
...
...
@@ -21,9 +21,337 @@
#include <cuires.hrc>
#include "optchart.hxx"
#include <dialmgr.hxx>
#include <vcl/builderfactory.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/svapp.hxx>
#include <svx/svxids.hrc>
class
SAL_WARN_UNUSED
SVX_DLLPUBLIC
ColorLB
:
public
ListBox
{
ImpColorList
*
pColorList
;
// separate liste, in case of user data are required from outside
Size
aImageSize
;
using
Window
::
ImplInit
;
SVT_DLLPRIVATE
void
ImplInit
();
SVT_DLLPRIVATE
void
ImplDestroyColorEntries
();
public
:
ColorLB
(
vcl
::
Window
*
pParent
,
WinBits
nWinStyle
=
WB_BORDER
);
virtual
~
ColorLB
()
override
;
virtual
void
dispose
()
override
;
virtual
void
UserDraw
(
const
UserDrawEvent
&
rUDEvt
)
override
;
using
ListBox
::
InsertEntry
;
sal_Int32
InsertEntry
(
const
OUString
&
rStr
,
sal_Int32
nPos
=
LISTBOX_APPEND
);
sal_Int32
InsertEntry
(
const
Color
&
rColor
,
const
OUString
&
rStr
,
sal_Int32
nPos
=
LISTBOX_APPEND
);
bool
IsAutomaticSelected
()
{
return
!
GetSelectEntryPos
();
}
using
ListBox
::
RemoveEntry
;
void
RemoveEntry
(
sal_Int32
nPos
);
void
Clear
();
void
CopyEntries
(
const
ColorLB
&
rBox
);
using
ListBox
::
GetEntryPos
;
sal_Int32
GetEntryPos
(
const
Color
&
rColor
)
const
;
Color
GetEntryColor
(
sal_Int32
nPos
)
const
;
void
SelectEntry
(
const
OUString
&
rStr
)
{
ListBox
::
SelectEntry
(
rStr
);
}
void
SelectEntry
(
const
Color
&
rColor
)
{
sal_Int32
nPos
=
GetEntryPos
(
rColor
);
if
(
nPos
!=
LISTBOX_ENTRY_NOTFOUND
)
ListBox
::
SelectEntryPos
(
nPos
);
}
Color
GetSelectEntryColor
()
const
{
sal_Int32
nPos
=
GetSelectEntryPos
();
Color
aColor
;
if
(
nPos
!=
LISTBOX_ENTRY_NOTFOUND
)
aColor
=
GetEntryColor
(
nPos
);
return
aColor
;
}
using
ListBox
::
IsEntrySelected
;
bool
IsEntrySelected
(
const
Color
&
rColor
)
const
{
sal_Int32
nPos
=
GetEntryPos
(
rColor
);
if
(
nPos
!=
LISTBOX_ENTRY_NOTFOUND
)
return
IsEntryPosSelected
(
nPos
);
else
return
false
;
}
void
Fill
(
const
XColorListRef
&
pTab
);
void
Append
(
const
XColorEntry
&
rEntry
);
void
Modify
(
const
XColorEntry
&
rEntry
,
sal_Int32
nPos
);
private
:
ColorLB
(
const
ColorLB
&
)
=
delete
;
ColorLB
&
operator
=
(
const
ColorLB
&
)
=
delete
;
};
VCL_BUILDER_DECL_FACTORY
(
ColorLB
)
{
bool
bDropdown
=
VclBuilder
::
extractDropdown
(
rMap
);
WinBits
nWinBits
=
WB_LEFT
|
WB_VCENTER
|
WB_3DLOOK
|
WB_SIMPLEMODE
|
WB_TABSTOP
;
if
(
bDropdown
)
nWinBits
|=
WB_DROPDOWN
;
OString
sBorder
=
VclBuilder
::
extractCustomProperty
(
rMap
);
if
(
!
sBorder
.
isEmpty
())
nWinBits
|=
WB_BORDER
;
VclPtrInstance
<
ColorLB
>
pListBox
(
pParent
,
nWinBits
);
pListBox
->
EnableAutoSize
(
true
);
rRet
=
pListBox
;
}
class
ImplColorListData
{
public
:
Color
aColor
;
bool
bColor
;
ImplColorListData
()
:
aColor
(
COL_BLACK
)
{
bColor
=
false
;
}
explicit
ImplColorListData
(
const
Color
&
rColor
)
:
aColor
(
rColor
)
{
bColor
=
true
;
}
};
void
ColorLB
::
ImplInit
()
{
pColorList
=
new
ImpColorList
();
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
aImageSize
=
rStyleSettings
.
GetListBoxPreviewDefaultPixelSize
();
EnableUserDraw
(
true
);
SetUserItemSize
(
aImageSize
);
}
void
ColorLB
::
ImplDestroyColorEntries
()
{
for
(
size_t
n
=
pColorList
->
size
();
n
;
)
delete
(
*
pColorList
)[
--
n
];
pColorList
->
clear
();
}
ColorLB
::
ColorLB
(
vcl
::
Window
*
pParent
,
WinBits
nWinStyle
)
:
ListBox
(
pParent
,
nWinStyle
)
{
ImplInit
();
SetEdgeBlending
(
true
);
}
ColorLB
::~
ColorLB
()
{
disposeOnce
();
}
void
ColorLB
::
dispose
()
{
if
(
pColorList
)
{
ImplDestroyColorEntries
();
delete
pColorList
;
pColorList
=
nullptr
;
}
ListBox
::
dispose
();
}
sal_Int32
ColorLB
::
InsertEntry
(
const
OUString
&
rStr
,
sal_Int32
nPos
)
{
nPos
=
ListBox
::
InsertEntry
(
rStr
,
nPos
);
if
(
nPos
!=
LISTBOX_ERROR
)
{
ImplColorListData
*
pData
=
new
ImplColorListData
;
if
(
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pColorList
->
insert
(
it
,
pData
);
}
else
{
pColorList
->
push_back
(
pData
);
nPos
=
pColorList
->
size
()
-
1
;
}
}
return
nPos
;
}
sal_Int32
ColorLB
::
InsertEntry
(
const
Color
&
rColor
,
const
OUString
&
rStr
,
sal_Int32
nPos
)
{
nPos
=
ListBox
::
InsertEntry
(
rStr
,
nPos
);
if
(
nPos
!=
LISTBOX_ERROR
)
{
ImplColorListData
*
pData
=
new
ImplColorListData
(
rColor
);
if
(
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pColorList
->
insert
(
it
,
pData
);
}
else
{
pColorList
->
push_back
(
pData
);
nPos
=
pColorList
->
size
()
-
1
;
}
}
return
nPos
;
}
void
ColorLB
::
RemoveEntry
(
sal_Int32
nPos
)
{
ListBox
::
RemoveEntry
(
nPos
);
if
(
0
<=
nPos
&&
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
delete
*
it
;
pColorList
->
erase
(
it
);
}
}
void
ColorLB
::
Clear
()
{
ImplDestroyColorEntries
();
ListBox
::
Clear
();
}
void
ColorLB
::
CopyEntries
(
const
ColorLB
&
rBox
)
{
// Liste leeren
ImplDestroyColorEntries
();
// Daten kopieren
size_t
nCount
=
rBox
.
pColorList
->
size
();
for
(
size_t
n
=
0
;
n
<
nCount
;
n
++
)
{
ImplColorListData
*
pData
=
(
*
rBox
.
pColorList
)[
n
];
sal_Int32
nPos
=
InsertEntry
(
rBox
.
GetEntry
(
n
)
);
if
(
nPos
!=
LISTBOX_ERROR
)
{
if
(
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pColorList
->
insert
(
it
,
new
ImplColorListData
(
*
pData
)
);
}
else
{
pColorList
->
push_back
(
new
ImplColorListData
(
*
pData
)
);
}
}
}
}
sal_Int32
ColorLB
::
GetEntryPos
(
const
Color
&
rColor
)
const
{
for
(
sal_Int32
n
=
(
sal_Int32
)
pColorList
->
size
();
n
;
)
{
ImplColorListData
*
pData
=
(
*
pColorList
)[
--
n
];
if
(
pData
->
bColor
&&
(
pData
->
aColor
==
rColor
)
)
return
n
;
}
return
LISTBOX_ENTRY_NOTFOUND
;
}
Color
ColorLB
::
GetEntryColor
(
sal_Int32
nPos
)
const
{
Color
aColor
;
ImplColorListData
*
pData
=
(
0
<=
nPos
&&
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
?
(
*
pColorList
)[
nPos
]
:
nullptr
;
if
(
pData
&&
pData
->
bColor
)
aColor
=
pData
->
aColor
;
return
aColor
;
}
void
ColorLB
::
UserDraw
(
const
UserDrawEvent
&
rUDEvt
)
{
size_t
nPos
=
rUDEvt
.
GetItemId
();
ImplColorListData
*
pData
=
(
nPos
<
pColorList
->
size
()
)
?
(
*
pColorList
)[
nPos
]
:
nullptr
;
if
(
pData
)
{
if
(
pData
->
bColor
)
{
Point
aPos
(
rUDEvt
.
GetRect
().
TopLeft
()
);
aPos
.
X
()
+=
2
;
aPos
.
Y
()
+=
(
rUDEvt
.
GetRect
().
GetHeight
()
-
aImageSize
.
Height
()
)
/
2
;
const
Rectangle
aRect
(
aPos
,
aImageSize
);
vcl
::
RenderContext
*
pRenderContext
=
rUDEvt
.
GetRenderContext
();
pRenderContext
->
Push
();
pRenderContext
->
SetFillColor
(
pData
->
aColor
);
pRenderContext
->
SetLineColor
(
pRenderContext
->
GetTextColor
());
pRenderContext
->
DrawRect
(
aRect
);
pRenderContext
->
Pop
();
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
const
sal_uInt16
nEdgeBlendingPercent
(
GetEdgeBlending
()
?
rStyleSettings
.
GetEdgeBlending
()
:
0
);
if
(
nEdgeBlendingPercent
)
{
const
Color
&
rTopLeft
(
rStyleSettings
.
GetEdgeBlendingTopLeftColor
());
const
Color
&
rBottomRight
(
rStyleSettings
.
GetEdgeBlendingBottomRightColor
());
const
sal_uInt8
nAlpha
((
nEdgeBlendingPercent
*
255
)
/
100
);
const
BitmapEx
aBlendFrame
(
createBlendFrame
(
aRect
.
GetSize
(),
nAlpha
,
rTopLeft
,
rBottomRight
));
if
(
!
aBlendFrame
.
IsEmpty
())
{
pRenderContext
->
DrawBitmapEx
(
aRect
.
TopLeft
(),
aBlendFrame
);
}
}
ListBox
::
DrawEntry
(
rUDEvt
,
false
,
false
);
}
else
ListBox
::
DrawEntry
(
rUDEvt
,
false
,
true
);
}
else
ListBox
::
DrawEntry
(
rUDEvt
,
true
,
false
);
}
// Fills the Listbox with color and strings
void
ColorLB
::
Fill
(
const
XColorListRef
&
pColorTab
)
{
if
(
!
pColorTab
.
is
()
)
return
;
long
nCount
=
pColorTab
->
Count
();
SetUpdateMode
(
false
);
for
(
long
i
=
0
;
i
<
nCount
;
i
++
)
{
const
XColorEntry
*
pEntry
=
pColorTab
->
GetColor
(
i
);
InsertEntry
(
pEntry
->
GetColor
(),
pEntry
->
GetName
()
);
}
AdaptDropDownLineCountToMaximum
();
SetUpdateMode
(
true
);
}
void
ColorLB
::
Append
(
const
XColorEntry
&
rEntry
)
{
InsertEntry
(
rEntry
.
GetColor
(),
rEntry
.
GetName
()
);
AdaptDropDownLineCountToMaximum
();
}
void
ColorLB
::
Modify
(
const
XColorEntry
&
rEntry
,
sal_Int32
nPos
)
{
RemoveEntry
(
nPos
);
InsertEntry
(
rEntry
.
GetColor
(),
rEntry
.
GetName
(),
nPos
);
}
namespace
{
void
FillBoxChartColorLB
(
ColorLB
*
pLB
,
const
SvxChartColorTable
&
rTab
)
...
...
cui/source/options/optchart.hxx
Dosyayı görüntüle @
a19b18ad
...
...
@@ -29,6 +29,8 @@
#include "cfgchart.hxx"
class
ColorLB
;
class
SvxDefaultColorOptPage
:
public
SfxTabPage
{
...
...
cui/uiconfig/ui/optchartcolorspage.ui
Dosyayı görüntüle @
a19b18ad
...
...
@@ -26,7 +26,7 @@
<property
name=
"top_padding"
>
6
</property>
<property
name=
"left_padding"
>
12
</property>
<child>
<object
class=
"
svx
lo-ColorLB"
id=
"colors:border"
>
<object
class=
"
cui
lo-ColorLB"
id=
"colors:border"
>
<property
name=
"dropdown"
>
False
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
...
...
include/svx/dlgctrl.hxx
Dosyayı görüntüle @
a19b18ad
...
...
@@ -207,80 +207,6 @@ public:
/************************************************************************/
class
SAL_WARN_UNUSED
SVX_DLLPUBLIC
ColorLB
:
public
ListBox
{
ImpColorList
*
pColorList
;
// separate liste, in case of user data are required from outside
Size
aImageSize
;
using
Window
::
ImplInit
;
SVT_DLLPRIVATE
void
ImplInit
();
SVT_DLLPRIVATE
void
ImplDestroyColorEntries
();
public
:
ColorLB
(
vcl
::
Window
*
pParent
,
WinBits
nWinStyle
=
WB_BORDER
);
virtual
~
ColorLB
()
override
;
virtual
void
dispose
()
override
;
virtual
void
UserDraw
(
const
UserDrawEvent
&
rUDEvt
)
override
;
using
ListBox
::
InsertEntry
;
sal_Int32
InsertEntry
(
const
OUString
&
rStr
,
sal_Int32
nPos
=
LISTBOX_APPEND
);
sal_Int32
InsertEntry
(
const
Color
&
rColor
,
const
OUString
&
rStr
,
sal_Int32
nPos
=
LISTBOX_APPEND
);
bool
IsAutomaticSelected
()
{
return
!
GetSelectEntryPos
();
}
using
ListBox
::
RemoveEntry
;
void
RemoveEntry
(
sal_Int32
nPos
);
void
Clear
();
void
CopyEntries
(
const
ColorLB
&
rBox
);
using
ListBox
::
GetEntryPos
;
sal_Int32
GetEntryPos
(
const
Color
&
rColor
)
const
;
Color
GetEntryColor
(
sal_Int32
nPos
)
const
;
void
SelectEntry
(
const
OUString
&
rStr
)
{
ListBox
::
SelectEntry
(
rStr
);
}
void
SelectEntry
(
const
Color
&
rColor
)
{
sal_Int32
nPos
=
GetEntryPos
(
rColor
);
if
(
nPos
!=
LISTBOX_ENTRY_NOTFOUND
)
ListBox
::
SelectEntryPos
(
nPos
);
}
Color
GetSelectEntryColor
()
const
{
sal_Int32
nPos
=
GetSelectEntryPos
();
Color
aColor
;
if
(
nPos
!=
LISTBOX_ENTRY_NOTFOUND
)
aColor
=
GetEntryColor
(
nPos
);
return
aColor
;
}
using
ListBox
::
IsEntrySelected
;
bool
IsEntrySelected
(
const
Color
&
rColor
)
const
{
sal_Int32
nPos
=
GetEntryPos
(
rColor
);
if
(
nPos
!=
LISTBOX_ENTRY_NOTFOUND
)
return
IsEntryPosSelected
(
nPos
);
else
return
false
;
}
void
Fill
(
const
XColorListRef
&
pTab
);
void
Append
(
const
XColorEntry
&
rEntry
);
void
Modify
(
const
XColorEntry
&
rEntry
,
sal_Int32
nPos
);
private
:
ColorLB
(
const
ColorLB
&
)
=
delete
;
ColorLB
&
operator
=
(
const
ColorLB
&
)
=
delete
;
};
/************************************************************************/
class
SAL_WARN_UNUSED
SVX_DLLPUBLIC
HatchingLB
:
public
ListBox
{
public
:
...
...
svx/source/dialog/dlgctrl.cxx
Dosyayı görüntüle @
a19b18ad
...
...
@@ -1103,259 +1103,6 @@ void SvxPixelCtl::Reset()
Invalidate
();
}
VCL_BUILDER_DECL_FACTORY
(
ColorLB
)
{
bool
bDropdown
=
VclBuilder
::
extractDropdown
(
rMap
);
WinBits
nWinBits
=
WB_LEFT
|
WB_VCENTER
|
WB_3DLOOK
|
WB_SIMPLEMODE
|
WB_TABSTOP
;
if
(
bDropdown
)
nWinBits
|=
WB_DROPDOWN
;
OString
sBorder
=
VclBuilder
::
extractCustomProperty
(
rMap
);
if
(
!
sBorder
.
isEmpty
())
nWinBits
|=
WB_BORDER
;
VclPtrInstance
<
ColorLB
>
pListBox
(
pParent
,
nWinBits
);
pListBox
->
EnableAutoSize
(
true
);
rRet
=
pListBox
;
}
class
ImplColorListData
{
public
:
Color
aColor
;
bool
bColor
;
ImplColorListData
()
:
aColor
(
COL_BLACK
)
{
bColor
=
false
;
}
explicit
ImplColorListData
(
const
Color
&
rColor
)
:
aColor
(
rColor
)
{
bColor
=
true
;
}
};
void
ColorLB
::
ImplInit
()
{
pColorList
=
new
ImpColorList
();
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
aImageSize
=
rStyleSettings
.
GetListBoxPreviewDefaultPixelSize
();
EnableUserDraw
(
true
);
SetUserItemSize
(
aImageSize
);
}
void
ColorLB
::
ImplDestroyColorEntries
()
{
for
(
size_t
n
=
pColorList
->
size
();
n
;
)
delete
(
*
pColorList
)[
--
n
];
pColorList
->
clear
();
}
ColorLB
::
ColorLB
(
vcl
::
Window
*
pParent
,
WinBits
nWinStyle
)
:
ListBox
(
pParent
,
nWinStyle
)
{
ImplInit
();
SetEdgeBlending
(
true
);
}
ColorLB
::~
ColorLB
()
{
disposeOnce
();
}
void
ColorLB
::
dispose
()
{
if
(
pColorList
)
{
ImplDestroyColorEntries
();
delete
pColorList
;
pColorList
=
nullptr
;
}
ListBox
::
dispose
();
}
sal_Int32
ColorLB
::
InsertEntry
(
const
OUString
&
rStr
,
sal_Int32
nPos
)
{
nPos
=
ListBox
::
InsertEntry
(
rStr
,
nPos
);
if
(
nPos
!=
LISTBOX_ERROR
)
{
ImplColorListData
*
pData
=
new
ImplColorListData
;
if
(
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pColorList
->
insert
(
it
,
pData
);
}
else
{
pColorList
->
push_back
(
pData
);
nPos
=
pColorList
->
size
()
-
1
;
}
}
return
nPos
;
}
sal_Int32
ColorLB
::
InsertEntry
(
const
Color
&
rColor
,
const
OUString
&
rStr
,
sal_Int32
nPos
)
{
nPos
=
ListBox
::
InsertEntry
(
rStr
,
nPos
);
if
(
nPos
!=
LISTBOX_ERROR
)
{
ImplColorListData
*
pData
=
new
ImplColorListData
(
rColor
);
if
(
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pColorList
->
insert
(
it
,
pData
);
}
else
{
pColorList
->
push_back
(
pData
);
nPos
=
pColorList
->
size
()
-
1
;
}
}
return
nPos
;
}
void
ColorLB
::
RemoveEntry
(
sal_Int32
nPos
)
{
ListBox
::
RemoveEntry
(
nPos
);
if
(
0
<=
nPos
&&
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
delete
*
it
;
pColorList
->
erase
(
it
);
}
}
void
ColorLB
::
Clear
()
{
ImplDestroyColorEntries
();
ListBox
::
Clear
();
}
void
ColorLB
::
CopyEntries
(
const
ColorLB
&
rBox
)
{
// Liste leeren
ImplDestroyColorEntries
();
// Daten kopieren
size_t
nCount
=
rBox
.
pColorList
->
size
();
for
(
size_t
n
=
0
;
n
<
nCount
;
n
++
)
{
ImplColorListData
*
pData
=
(
*
rBox
.
pColorList
)[
n
];
sal_Int32
nPos
=
InsertEntry
(
rBox
.
GetEntry
(
n
)
);
if
(
nPos
!=
LISTBOX_ERROR
)
{
if
(
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
{
ImpColorList
::
iterator
it
=
pColorList
->
begin
();
::
std
::
advance
(
it
,
nPos
);
pColorList
->
insert
(
it
,
new
ImplColorListData
(
*
pData
)
);
}
else
{
pColorList
->
push_back
(
new
ImplColorListData
(
*
pData
)
);
}
}
}
}
sal_Int32
ColorLB
::
GetEntryPos
(
const
Color
&
rColor
)
const
{
for
(
sal_Int32
n
=
(
sal_Int32
)
pColorList
->
size
();
n
;
)
{
ImplColorListData
*
pData
=
(
*
pColorList
)[
--
n
];
if
(
pData
->
bColor
&&
(
pData
->
aColor
==
rColor
)
)
return
n
;
}
return
LISTBOX_ENTRY_NOTFOUND
;
}
Color
ColorLB
::
GetEntryColor
(
sal_Int32
nPos
)
const
{
Color
aColor
;
ImplColorListData
*
pData
=
(
0
<=
nPos
&&
static_cast
<
size_t
>
(
nPos
)
<
pColorList
->
size
()
)
?
(
*
pColorList
)[
nPos
]
:
nullptr
;
if
(
pData
&&
pData
->
bColor
)
aColor
=
pData
->
aColor
;
return
aColor
;
}
void
ColorLB
::
UserDraw
(
const
UserDrawEvent
&
rUDEvt
)
{
size_t
nPos
=
rUDEvt
.
GetItemId
();
ImplColorListData
*
pData
=
(
nPos
<
pColorList
->
size
()
)
?
(
*
pColorList
)[
nPos
]
:
nullptr
;
if
(
pData
)
{
if
(
pData
->
bColor
)
{
Point
aPos
(
rUDEvt
.
GetRect
().
TopLeft
()
);
aPos
.
X
()
+=
2
;
aPos
.
Y
()
+=
(
rUDEvt
.
GetRect
().
GetHeight
()
-
aImageSize
.
Height
()
)
/
2
;
const
Rectangle
aRect
(
aPos
,
aImageSize
);
vcl
::
RenderContext
*
pRenderContext
=
rUDEvt
.
GetRenderContext
();
pRenderContext
->
Push
();
pRenderContext
->
SetFillColor
(
pData
->
aColor
);
pRenderContext
->
SetLineColor
(
pRenderContext
->
GetTextColor
());
pRenderContext
->
DrawRect
(
aRect
);
pRenderContext
->
Pop
();
const
StyleSettings
&
rStyleSettings
=
Application
::
GetSettings
().
GetStyleSettings
();
const
sal_uInt16
nEdgeBlendingPercent
(
GetEdgeBlending
()
?
rStyleSettings
.
GetEdgeBlending
()
:
0
);
if
(
nEdgeBlendingPercent
)
{
const
Color
&
rTopLeft
(
rStyleSettings
.
GetEdgeBlendingTopLeftColor
());
const
Color
&
rBottomRight
(
rStyleSettings
.
GetEdgeBlendingBottomRightColor
());
const
sal_uInt8
nAlpha
((
nEdgeBlendingPercent
*
255
)
/
100
);
const
BitmapEx
aBlendFrame
(
createBlendFrame
(
aRect
.
GetSize
(),
nAlpha
,
rTopLeft
,
rBottomRight
));
if
(
!
aBlendFrame
.
IsEmpty
())
{
pRenderContext
->
DrawBitmapEx
(
aRect
.
TopLeft
(),
aBlendFrame
);
}
}
ListBox
::
DrawEntry
(
rUDEvt
,
false
,
false
);
}
else
ListBox
::
DrawEntry
(
rUDEvt
,
false
,
true
);
}
else
ListBox
::
DrawEntry
(
rUDEvt
,
true
,
false
);
}
// Fills the Listbox with color and strings
void
ColorLB
::
Fill
(
const
XColorListRef
&
pColorTab
)
{
if
(
!
pColorTab
.
is
()
)
return
;
long
nCount
=
pColorTab
->
Count
();
SetUpdateMode
(
false
);
for
(
long
i
=
0
;
i
<
nCount
;
i
++
)
{
const
XColorEntry
*
pEntry
=
pColorTab
->
GetColor
(
i
);
InsertEntry
(
pEntry
->
GetColor
(),
pEntry
->
GetName
()
);
}
AdaptDropDownLineCountToMaximum
();
SetUpdateMode
(
true
);
}
void
ColorLB
::
Append
(
const
XColorEntry
&
rEntry
)
{
InsertEntry
(
rEntry
.
GetColor
(),
rEntry
.
GetName
()
);
AdaptDropDownLineCountToMaximum
();
}
void
ColorLB
::
Modify
(
const
XColorEntry
&
rEntry
,
sal_Int32
nPos
)
{
RemoveEntry
(
nPos
);
InsertEntry
(
rEntry
.
GetColor
(),
rEntry
.
GetName
(),
nPos
);
}
// Fills the listbox (provisional) with strings
HatchingLB
::
HatchingLB
(
vcl
::
Window
*
pParent
,
WinBits
nWinStyle
)
...
...
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