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
ff17738a
Kaydet (Commit)
ff17738a
authored
Tem 08, 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 color picker to color palette
Change-Id: I651f485598ee57af815780e234031f101b63fa24
üst
9ab1a4a0
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
20 deletions
+74
-20
PaletteManager.hxx
include/svx/PaletteManager.hxx
+7
-0
tbcontrl.hxx
include/svx/tbcontrl.hxx
+0
-2
PaletteManager.cxx
svx/source/tbxctrls/PaletteManager.cxx
+30
-1
colorwindow.hxx
svx/source/tbxctrls/colorwindow.hxx
+2
-0
tbcontrl.cxx
svx/source/tbxctrls/tbcontrl.cxx
+35
-17
No files found.
include/svx/PaletteManager.hxx
Dosyayı görüntüle @
ff17738a
...
...
@@ -21,6 +21,7 @@
#include <svx/SvxColorValueSet.hxx>
#include <rtl/ustring.hxx>
#include <svx/tbxcolorupdate.hxx>
class
PaletteManager
{
...
...
@@ -28,7 +29,9 @@ class PaletteManager
sal_uInt16
mnCurrentPalette
;
long
mnColorCount
;
svx
::
ToolboxButtonColorUpdater
*
mpBtnUpdater
;
Color
mLastColor
;
std
::
vector
<
Palette
>
maPalettes
;
public
:
PaletteManager
();
...
...
@@ -38,6 +41,10 @@ public:
void
NextPalette
();
long
GetColorCount
();
OUString
GetPaletteName
();
const
Color
&
GetLastColor
();
void
SetLastColor
(
const
Color
&
rLastColor
);
void
SetBtnUpdater
(
svx
::
ToolboxButtonColorUpdater
*
pBtnUpdater
);
void
PopupColorPicker
();
};
#endif // INCLUDED_SVX_PALETTEMANAGER_HXX
...
...
include/svx/tbcontrl.hxx
Dosyayı görüntüle @
ff17738a
...
...
@@ -221,7 +221,6 @@ class SVX_DLLPUBLIC SvxColorToolBoxControl : public SfxToolBoxControl
using
SfxToolBoxControl
::
StateChanged
;
::
boost
::
scoped_ptr
<
::
svx
::
ToolboxButtonColorUpdater
>
pBtnUpdater
;
Color
mLastColor
;
PaletteManager
mPaletteManager
;
DECL_LINK
(
SelectedHdl
,
Color
*
);
public
:
...
...
@@ -242,7 +241,6 @@ public:
class
SVX_DLLPUBLIC
SvxLineColorToolBoxControl
:
public
SfxToolBoxControl
{
::
boost
::
scoped_ptr
<
::
svx
::
ToolboxButtonColorUpdater
>
pBtnUpdater
;
Color
mLastColor
;
PaletteManager
mPaletteManager
;
DECL_LINK
(
SelectedHdl
,
Color
*
);
public
:
...
...
svx/source/tbxctrls/PaletteManager.cxx
Dosyayı görüntüle @
ff17738a
...
...
@@ -23,11 +23,13 @@
#include <sfx2/objsh.hxx>
#include "svx/drawitem.hxx"
#include <svx/dialogs.hrc>
#include <svtools/colrdlg.hxx>
PaletteManager
::
PaletteManager
()
:
mnNumOfPalettes
(
2
),
mnCurrentPalette
(
0
),
mnColorCount
(
0
)
mnColorCount
(
0
),
mLastColor
(
COL_AUTO
)
{
LoadPalettes
();
mnNumOfPalettes
+=
maPalettes
.
size
();
...
...
@@ -127,4 +129,31 @@ OUString PaletteManager::GetPaletteName()
return
OStringToOUString
(
maPalettes
[
mnCurrentPalette
-
1
].
GetPaletteName
(),
RTL_TEXTENCODING_ASCII_US
);
}
const
Color
&
PaletteManager
::
GetLastColor
()
{
return
mLastColor
;
}
void
PaletteManager
::
SetLastColor
(
const
Color
&
rLastColor
)
{
mLastColor
=
rLastColor
;
}
void
PaletteManager
::
SetBtnUpdater
(
svx
::
ToolboxButtonColorUpdater
*
pBtnUpdater
)
{
mpBtnUpdater
=
pBtnUpdater
;
}
void
PaletteManager
::
PopupColorPicker
()
{
SvColorDialog
aColorDlg
(
0
);
aColorDlg
.
SetColor
(
mLastColor
);
aColorDlg
.
SetMode
(
svtools
::
ColorPickerMode_MODIFY
);
if
(
aColorDlg
.
Execute
()
==
RET_OK
)
{
mpBtnUpdater
->
Update
(
aColorDlg
.
GetColor
()
);
mLastColor
=
aColorDlg
.
GetColor
();
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
svx/source/tbxctrls/colorwindow.hxx
Dosyayı görüntüle @
ff17738a
...
...
@@ -37,6 +37,7 @@ private:
SvxColorValueSet
aColorSet
;
PushButton
aButtonLeft
;
PushButton
aButtonRight
;
PushButton
aButtonPicker
;
FixedText
aPaletteName
;
OUString
maCommand
;
Link
maSelectedLink
;
...
...
@@ -50,6 +51,7 @@ private:
DECL_LINK
(
SelectHdl
,
void
*
);
DECL_LINK
(
StepLeftClickHdl
,
void
*
);
DECL_LINK
(
StepRightClickHdl
,
void
*
);
DECL_LINK
(
OpenPickerClickHdl
,
void
*
);
protected
:
virtual
void
Resize
()
SAL_OVERRIDE
;
...
...
svx/source/tbxctrls/tbcontrl.cxx
Dosyayı görüntüle @
ff17738a
...
...
@@ -1011,6 +1011,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
aColorSet
(
this
,
WinBits
(
WB_ITEMBORDER
|
WB_NAMEFIELD
|
WB_3DLOOK
|
WB_NO_DIRECTSELECT
)
),
aButtonLeft
(
this
),
aButtonRight
(
this
),
aButtonPicker
(
this
),
aPaletteName
(
this
),
maCommand
(
rCommand
),
nNavButtonWidth
(
20
),
...
...
@@ -1050,18 +1051,27 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString& rCommand,
}
aButtonLeft
.
SetText
(
"<"
);
aButtonLeft
.
SetSizePixel
(
Size
(
nNavButtonWidth
,
nNavButtonHeight
));
aButtonLeft
.
SetClickHdl
(
LINK
(
this
,
SvxColorWindow_Impl
,
StepLeftClickHdl
)
);
aButtonLeft
.
Show
();
aButtonRight
.
SetText
(
">"
);
aButtonRight
.
SetSizePixel
(
Size
(
nNavButtonWidth
,
nNavButtonHeight
));
aButtonRight
.
SetClickHdl
(
LINK
(
this
,
SvxColorWindow_Impl
,
StepRightClickHdl
)
);
aButtonRight
.
Show
();
aButtonPicker
.
SetText
(
"P"
);
aButtonPicker
.
SetSizePixel
(
Size
(
nNavButtonWidth
,
nNavButtonHeight
));
aButtonPicker
.
SetClickHdl
(
LINK
(
this
,
SvxColorWindow_Impl
,
OpenPickerClickHdl
)
);
aButtonPicker
.
Show
();
aPaletteName
.
SetSizePixel
(
Size
(
150
,
nNavButtonHeight
));
aColorSet
.
Show
();
aColorSet
.
SetSelectHdl
(
LINK
(
this
,
SvxColorWindow_Impl
,
SelectHdl
)
);
SetHelpId
(
HID_POPUP_COLOR
);
aColorSet
.
SetHelpId
(
HID_POPUP_COLOR_CTRL
);
SetText
(
rWndTitle
);
aColorSet
.
Show
();
aPaletteName
.
Show
();
...
...
@@ -1083,13 +1093,12 @@ void SvxColorWindow_Impl::UpdateGUI()
//TODO: Move left/right buttons above the colors
SetOutputSizePixel
(
Size
(
aNewSize
.
Width
()
+
nAdd
,
aNewSize
.
Height
()
+
nAdd
+
nNavButtonHeight
));
aButtonLeft
.
SetSizePixel
(
Size
(
nNavButtonWidth
,
nNavButtonHeight
));
aButtonLeft
.
SetPosPixel
(
Point
(
0
,
aNewSize
.
Height
()
+
nAdd
+
1
));
aButtonRight
.
SetSizePixel
(
Size
(
nNavButtonWidth
,
nNavButtonHeight
));
aButtonRight
.
SetPosPixel
(
Point
(
aNewSize
.
Width
()
+
nAdd
-
nNavButtonWidth
,
aNewSize
.
Height
()
+
nAdd
+
1
));
aPaletteName
.
SetSizePixel
(
Size
(
150
,
nNavButtonHeight
));
aButtonPicker
.
SetPosPixel
(
Point
(
aNewSize
.
Width
()
+
nAdd
-
2
*
nNavButtonWidth
,
aNewSize
.
Height
()
+
nAdd
+
1
));
aPaletteName
.
SetPosPixel
(
Point
(
nNavButtonWidth
,
aNewSize
.
Height
()
+
nAdd
+
1
));
aPaletteName
.
SetText
(
mrPaletteManager
.
GetPaletteName
());
}
...
...
@@ -1159,6 +1168,12 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, StepRightClickHdl)
return
0
;
}
IMPL_LINK_NOARG
(
SvxColorWindow_Impl
,
OpenPickerClickHdl
)
{
mrPaletteManager
.
PopupColorPicker
();
return
0
;
}
void
SvxColorWindow_Impl
::
Resize
()
{
lcl_ResizeValueSet
(
*
this
,
aColorSet
,
nNavButtonHeight
+
2
);
...
...
@@ -2183,8 +2198,7 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
sal_uInt16
nSlotId
,
sal_uInt16
nId
,
ToolBox
&
rTbx
)
:
SfxToolBoxControl
(
nSlotId
,
nId
,
rTbx
),
mLastColor
(
COL_AUTO
)
SfxToolBoxControl
(
nSlotId
,
nId
,
rTbx
)
{
rTbx
.
SetItemBits
(
nId
,
TIB_DROPDOWN
|
rTbx
.
GetItemBits
(
nId
)
);
...
...
@@ -2193,27 +2207,27 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
{
case
SID_ATTR_CHAR_COLOR
:
addStatusListener
(
OUString
(
".uno:Color"
));
m
LastColor
=
COL_RED
;
m
PaletteManager
.
SetLastColor
(
COL_RED
)
;
break
;
case
SID_ATTR_CHAR_COLOR2
:
addStatusListener
(
OUString
(
".uno:CharColorExt"
));
m
LastColor
=
COL_RED
;
m
PaletteManager
.
SetLastColor
(
COL_RED
)
;
break
;
case
SID_BACKGROUND_COLOR
:
addStatusListener
(
OUString
(
".uno:BackgroundColor"
));
m
LastColor
=
COL_YELLOW
;
m
PaletteManager
.
SetLastColor
(
COL_YELLOW
)
;
break
;
case
SID_ATTR_CHAR_COLOR_BACKGROUND
:
addStatusListener
(
OUString
(
".uno:CharBackgroundExt"
));
m
LastColor
=
COL_YELLOW
;
m
PaletteManager
.
SetLastColor
(
COL_YELLOW
)
;
break
;
case
SID_FRAME_LINECOLOR
:
addStatusListener
(
OUString
(
".uno:FrameLineColor"
));
m
LastColor
=
COL_BLUE
;
m
PaletteManager
.
SetLastColor
(
COL_BLUE
)
;
break
;
case
SID_EXTRUSION_3D_COLOR
:
...
...
@@ -2222,6 +2236,7 @@ SvxColorToolBoxControl::SvxColorToolBoxControl(
}
pBtnUpdater
.
reset
(
new
::
svx
::
ToolboxButtonColorUpdater
(
nSlotId
,
nId
,
&
GetToolBox
()
)
);
mPaletteManager
.
SetBtnUpdater
(
pBtnUpdater
.
get
()
);
}
SvxColorToolBoxControl
::~
SvxColorToolBoxControl
()
...
...
@@ -2274,7 +2289,7 @@ SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
IMPL_LINK
(
SvxColorToolBoxControl
,
SelectedHdl
,
Color
*
,
pColor
)
{
pBtnUpdater
->
Update
(
*
pColor
);
m
LastColor
=
*
pColor
;
m
PaletteManager
.
SetLastColor
(
*
pColor
)
;
return
0
;
}
...
...
@@ -2336,21 +2351,24 @@ void SvxColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
Sequence
<
PropertyValue
>
aArgs
(
1
);
aArgs
[
0
].
Name
=
aParamName
;
aArgs
[
0
].
Value
=
makeAny
(
(
sal_uInt32
)(
m
LastColor
.
GetColor
()
));
aArgs
[
0
].
Value
=
makeAny
(
(
sal_uInt32
)(
m
PaletteManager
.
GetLastColor
()
.
GetColor
()
));
Dispatch
(
aCommand
,
aArgs
);
}
// class SvxLineColorToolBoxControl ----------------------------------------
SvxLineColorToolBoxControl
::
SvxLineColorToolBoxControl
(
sal_uInt16
nSlotId
,
sal_uInt16
nId
,
ToolBox
&
rTbx
)
:
SfxToolBoxControl
(
nSlotId
,
nId
,
rTbx
),
mLastColor
(
COL_BLACK
)
SfxToolBoxControl
(
nSlotId
,
nId
,
rTbx
)
{
rTbx
.
SetItemBits
(
nId
,
TIB_DROPDOWN
|
rTbx
.
GetItemBits
(
nId
)
);
addStatusListener
(
OUString
(
".uno:XLineColor"
)
);
pBtnUpdater
.
reset
(
new
::
svx
::
ToolboxButtonColorUpdater
(
nSlotId
,
nId
,
&
GetToolBox
()
)
);
mPaletteManager
.
SetLastColor
(
COL_BLACK
);
mPaletteManager
.
SetBtnUpdater
(
pBtnUpdater
.
get
()
);
}
SvxLineColorToolBoxControl
::~
SvxLineColorToolBoxControl
()
...
...
@@ -2384,7 +2402,7 @@ SfxPopupWindow* SvxLineColorToolBoxControl::CreatePopupWindow()
IMPL_LINK
(
SvxLineColorToolBoxControl
,
SelectedHdl
,
Color
*
,
pColor
)
{
pBtnUpdater
->
Update
(
*
pColor
);
m
LastColor
=
*
pColor
;
m
PaletteManager
.
SetLastColor
(
*
pColor
)
;
return
0
;
}
...
...
@@ -2401,7 +2419,7 @@ void SvxLineColorToolBoxControl::Select(sal_uInt16 /*nSelectModifier*/)
{
Sequence
<
PropertyValue
>
aArgs
(
1
);
aArgs
[
0
].
Name
=
"XLineColor"
;
aArgs
[
0
].
Value
=
makeAny
(
(
sal_uInt32
)(
m
LastColor
.
GetColor
()
));
aArgs
[
0
].
Value
=
makeAny
(
(
sal_uInt32
)(
m
PaletteManager
.
GetLastColor
()
.
GetColor
()
));
Dispatch
(
OUString
(
".uno:XLineColor"
),
aArgs
);
}
...
...
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