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
c9df840d
Kaydet (Commit)
c9df840d
authored
Agu 26, 2015
tarafından
Tomaž Vajngerl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
ColorSets: add preview to ThemePanel, move impl. to own file
Change-Id: I1b05edc954125e5bdeed05b5fdce1430f8eaba26
üst
48d2dca4
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
290 additions
and
113 deletions
+290
-113
ColorSets.hxx
include/svx/ColorSets.hxx
+70
-0
Library_svxcore.mk
svx/Library_svxcore.mk
+1
-0
ColorSets.cxx
svx/source/styles/ColorSets.cxx
+126
-0
ThemePanel.cxx
sw/source/uibase/sidebar/ThemePanel.cxx
+70
-97
ThemePanel.hxx
sw/source/uibase/sidebar/ThemePanel.hxx
+11
-2
sidebartheme.ui
sw/uiconfig/swriter/ui/sidebartheme.ui
+12
-14
No files found.
include/svx/ColorSets.hxx
0 → 100644
Dosyayı görüntüle @
c9df840d
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#ifndef INCLUDED_SVX_COLORSETS_HXX
#define INCLUDED_SVX_COLORSETS_HXX
#include <svx/svxdllapi.h>
#include <vector>
#include <rtl/ustring.hxx>
#include <tools/color.hxx>
namespace
svx
{
class
SVX_DLLPUBLIC
ColorSet
{
OUString
maName
;
std
::
vector
<
Color
>
maColors
;
public
:
ColorSet
(
OUString
aName
);
~
ColorSet
();
void
add
(
sal_uInt32
nIndex
,
sal_uInt32
aColorData
)
{
maColors
[
nIndex
]
=
Color
(
aColorData
);
}
const
OUString
&
getName
()
const
{
return
maName
;
}
const
Color
&
getColor
(
sal_uInt32
nIndex
)
const
{
return
maColors
[
nIndex
];
}
};
class
SVX_DLLPUBLIC
ColorSets
{
std
::
vector
<
ColorSet
>
maColorSets
;
public
:
ColorSets
();
~
ColorSets
();
void
init
();
const
std
::
vector
<
ColorSet
>&
getColorSets
()
{
return
maColorSets
;
}
const
ColorSet
&
getColorSet
(
sal_uInt32
nIndex
)
{
return
maColorSets
[
nIndex
];
}
const
ColorSet
&
getColorSet
(
const
OUString
&
rName
);
};
}
// end of namespace svx
#endif // INCLUDED_SVX_COLORSETS_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
svx/Library_svxcore.mk
Dosyayı görüntüle @
c9df840d
...
@@ -341,6 +341,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
...
@@ -341,6 +341,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/svdraw/svdxcgv \
svx/source/svdraw/svdxcgv \
svx/source/styles/CommonStylePreviewRenderer \
svx/source/styles/CommonStylePreviewRenderer \
svx/source/styles/CommonStyleManager \
svx/source/styles/CommonStyleManager \
svx/source/styles/ColorSets \
svx/source/table/cell \
svx/source/table/cell \
svx/source/table/cellcursor \
svx/source/table/cellcursor \
svx/source/table/cellrange \
svx/source/table/cellrange \
...
...
svx/source/styles/ColorSets.cxx
0 → 100644
Dosyayı görüntüle @
c9df840d
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*/
#include <svx/ColorSets.hxx>
namespace
svx
{
ColorSet
::
ColorSet
(
OUString
aName
)
:
maName
(
aName
)
,
maColors
(
12
)
{}
ColorSet
::~
ColorSet
()
{}
ColorSets
::
ColorSets
()
{}
ColorSets
::~
ColorSets
()
{}
void
ColorSets
::
init
()
{
{
ColorSet
aColorSet
(
"Breeze"
);
aColorSet
.
add
(
0
,
0x232629
);
aColorSet
.
add
(
1
,
0xFCFCFC
);
aColorSet
.
add
(
2
,
0x31363B
);
aColorSet
.
add
(
3
,
0xEFF0F1
);
aColorSet
.
add
(
4
,
0xDA4453
);
aColorSet
.
add
(
5
,
0xF47750
);
aColorSet
.
add
(
6
,
0xFDBC4B
);
aColorSet
.
add
(
7
,
0xC9CE3B
);
aColorSet
.
add
(
8
,
0x1CDC9A
);
aColorSet
.
add
(
9
,
0x2ECC71
);
aColorSet
.
add
(
10
,
0x1D99F3
);
aColorSet
.
add
(
11
,
0x3DAEE9
);
maColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
(
"Tango"
);
aColorSet
.
add
(
0
,
0x000000
);
aColorSet
.
add
(
1
,
0xFFFFFF
);
aColorSet
.
add
(
2
,
0x2E3436
);
aColorSet
.
add
(
3
,
0xBABDB6
);
aColorSet
.
add
(
4
,
0x3465A4
);
aColorSet
.
add
(
5
,
0x73D216
);
aColorSet
.
add
(
6
,
0xF57900
);
aColorSet
.
add
(
7
,
0x888A85
);
aColorSet
.
add
(
8
,
0xEDD400
);
aColorSet
.
add
(
9
,
0xEF2929
);
aColorSet
.
add
(
10
,
0x75507B
);
aColorSet
.
add
(
11
,
0x555753
);
maColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
(
"Material Blue"
);
aColorSet
.
add
(
0
,
0x212121
);
aColorSet
.
add
(
1
,
0xFFFFFF
);
aColorSet
.
add
(
2
,
0x37474F
);
aColorSet
.
add
(
3
,
0xECEFF1
);
aColorSet
.
add
(
4
,
0x7986CB
);
aColorSet
.
add
(
5
,
0x303F9F
);
aColorSet
.
add
(
6
,
0x64B5F6
);
aColorSet
.
add
(
7
,
0x1976D2
);
aColorSet
.
add
(
8
,
0x4FC3F7
);
aColorSet
.
add
(
9
,
0x0277BD
);
aColorSet
.
add
(
10
,
0x4DD0E1
);
aColorSet
.
add
(
11
,
0x0097A7
);
maColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
(
"Material Red"
);
aColorSet
.
add
(
0
,
0x212121
);
aColorSet
.
add
(
1
,
0xFFFFFF
);
aColorSet
.
add
(
2
,
0x424242
);
aColorSet
.
add
(
3
,
0xF5F5F5
);
aColorSet
.
add
(
4
,
0xFF9800
);
aColorSet
.
add
(
5
,
0xFF6D00
);
aColorSet
.
add
(
6
,
0xFF5722
);
aColorSet
.
add
(
7
,
0xDD2C00
);
aColorSet
.
add
(
8
,
0xF44336
);
aColorSet
.
add
(
9
,
0xD50000
);
aColorSet
.
add
(
10
,
0xE91E63
);
aColorSet
.
add
(
11
,
0xC51162
);
maColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
(
"Material Green"
);
aColorSet
.
add
(
0
,
0x212121
);
aColorSet
.
add
(
1
,
0xFFFFFF
);
aColorSet
.
add
(
2
,
0x424242
);
aColorSet
.
add
(
3
,
0xF5F5F5
);
aColorSet
.
add
(
4
,
0x009688
);
aColorSet
.
add
(
5
,
0x00bfa5
);
aColorSet
.
add
(
6
,
0x4caf50
);
aColorSet
.
add
(
7
,
0x00c853
);
aColorSet
.
add
(
8
,
0x8bc34a
);
aColorSet
.
add
(
9
,
0x64dd17
);
aColorSet
.
add
(
10
,
0xcddc39
);
aColorSet
.
add
(
11
,
0xaeea00
);
maColorSets
.
push_back
(
aColorSet
);
}
}
const
ColorSet
&
ColorSets
::
getColorSet
(
const
OUString
&
rName
)
{
for
(
size_t
i
=
0
;
i
<
maColorSets
.
size
();
++
i
)
{
if
(
maColorSets
[
i
].
getName
()
==
rName
)
return
maColorSets
[
i
];
}
return
maColorSets
[
0
];
}
}
// end of namespace svx
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sw/source/uibase/sidebar/ThemePanel.cxx
Dosyayı görüntüle @
c9df840d
...
@@ -15,8 +15,6 @@
...
@@ -15,8 +15,6 @@
#include <swtypes.hxx>
#include <swtypes.hxx>
#include <cmdid.h>
#include <cmdid.h>
#include <tools/helpers.hxx>
#include <svl/intitem.hxx>
#include <svl/intitem.hxx>
#include <svx/svxids.hrc>
#include <svx/svxids.hrc>
#include <svx/dlgutil.hxx>
#include <svx/dlgutil.hxx>
...
@@ -55,13 +53,6 @@ public:
...
@@ -55,13 +53,6 @@ public:
OUString
msBaseFont
;
OUString
msBaseFont
;
};
};
class
ColorSet
{
public
:
OUString
maName
;
Color
maColors
[
10
];
};
class
ColorVariable
class
ColorVariable
{
{
public
:
public
:
...
@@ -99,26 +90,13 @@ public:
...
@@ -99,26 +90,13 @@ public:
maVariable
=
aVariable
;
maVariable
=
aVariable
;
}
}
Color
getColor
(
ColorSet
&
rColorSet
)
Color
getColor
(
svx
::
ColorSet
&
rColorSet
)
{
{
Color
aColor
;
Color
aColor
;
if
(
maVariable
.
mnIndex
>
-
1
)
if
(
maVariable
.
mnIndex
>
-
1
)
{
{
aColor
.
SetColor
(
rColorSet
.
maColors
[
maVariable
.
mnIndex
].
GetColor
());
aColor
=
rColorSet
.
getColor
(
maVariable
.
mnIndex
);
if
(
maVariable
.
mnTintShade
<
0
)
aColor
.
ApplyTintOrShade
(
maVariable
.
mnTintShade
);
{
double
fFactor
=
std
::
abs
(
maVariable
.
mnTintShade
)
/
10000.0
;
aColor
.
SetRed
(
MinMax
(
aColor
.
GetRed
()
+
(
fFactor
*
(
255.0
-
aColor
.
GetRed
())),
0
,
255
));
aColor
.
SetGreen
(
MinMax
(
aColor
.
GetGreen
()
+
(
fFactor
*
(
255.0
-
aColor
.
GetGreen
())),
0
,
255
));
aColor
.
SetBlue
(
MinMax
(
aColor
.
GetBlue
()
+
(
fFactor
*
(
255.0
-
aColor
.
GetBlue
())),
0
,
255
));
}
else
if
(
maVariable
.
mnTintShade
>
0
)
{
double
fFactor
=
1.0
-
std
::
abs
(
maVariable
.
mnTintShade
)
/
10000.0
;
aColor
.
SetRed
(
MinMax
(
aColor
.
GetRed
()
*
fFactor
,
0
,
255
));
aColor
.
SetGreen
(
MinMax
(
aColor
.
GetGreen
()
*
fFactor
,
0
,
255
));
aColor
.
SetBlue
(
MinMax
(
aColor
.
GetBlue
()
*
fFactor
,
0
,
255
));
}
}
}
else
else
{
{
...
@@ -163,61 +141,61 @@ StyleSet setupThemes()
...
@@ -163,61 +141,61 @@ StyleSet setupThemes()
{
{
StyleRedefinition
aRedefinition
(
"Heading 1"
);
StyleRedefinition
aRedefinition
(
"Heading 1"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
4
000
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
10
,
-
1
000
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 2"
);
StyleRedefinition
aRedefinition
(
"Heading 2"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
2
500
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
7
,
-
500
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 3"
);
StyleRedefinition
aRedefinition
(
"Heading 3"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
100
0
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
5
,
0
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 4"
);
StyleRedefinition
aRedefinition
(
"Heading 4"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
6
,
-
100
0
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 5"
);
StyleRedefinition
aRedefinition
(
"Heading 5"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
-
500
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
4
,
-
1
500
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 6"
);
StyleRedefinition
aRedefinition
(
"Heading 6"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
-
10
00
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
3
,
-
25
00
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 7"
);
StyleRedefinition
aRedefinition
(
"Heading 7"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
-
1
500
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
3
,
-
2
500
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 8"
);
StyleRedefinition
aRedefinition
(
"Heading 8"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
-
200
0
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
2
,
0
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 9"
);
StyleRedefinition
aRedefinition
(
"Heading 9"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
-
250
0
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
2
,
0
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
{
{
StyleRedefinition
aRedefinition
(
"Heading 10"
);
StyleRedefinition
aRedefinition
(
"Heading 10"
);
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
-
300
0
));
aRedefinition
.
setColorVariable
(
ColorVariable
(
0
,
0
));
aSet
.
add
(
aRedefinition
);
aSet
.
add
(
aRedefinition
);
}
}
...
@@ -276,7 +254,7 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet* pStyle, FontSet& rFontSet)
...
@@ -276,7 +254,7 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet* pStyle, FontSet& rFontSet)
}
}
}*/
}*/
void
changeColor
(
SwTextFormatColl
*
pCollection
,
ColorSet
&
rColorSet
,
StyleRedefinition
*
pRedefinition
)
void
changeColor
(
SwTextFormatColl
*
pCollection
,
svx
::
ColorSet
&
rColorSet
,
StyleRedefinition
*
pRedefinition
)
{
{
Color
aColor
=
pRedefinition
->
getColor
(
rColorSet
);
Color
aColor
=
pRedefinition
->
getColor
(
rColorSet
);
...
@@ -373,62 +351,15 @@ FontSet getFontSet(const OUString& rFontVariant, std::vector<FontSet>& aFontSets
...
@@ -373,62 +351,15 @@ FontSet getFontSet(const OUString& rFontVariant, std::vector<FontSet>& aFontSets
return
aFontSets
[
0
];
return
aFontSets
[
0
];
}
}
std
::
vector
<
ColorSet
>
initColorSets
()
void
applyTheme
(
SfxStyleSheetBasePool
*
pPool
,
const
OUString
&
sFontSetName
,
const
OUString
&
sColorSetName
,
{
StyleSet
&
rStyleSet
,
svx
::
ColorSets
&
rColorSets
)
std
::
vector
<
ColorSet
>
aColorSets
;
{
ColorSet
aColorSet
;
aColorSet
.
maName
=
"Default"
;
aColorSet
.
maColors
[
0
]
=
Color
(
0x00
,
0x00
,
0x00
);
aColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
;
aColorSet
.
maName
=
"Red"
;
aColorSet
.
maColors
[
0
]
=
Color
(
0xa4
,
0x00
,
0x00
);
aColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
;
aColorSet
.
maName
=
"Green"
;
aColorSet
.
maColors
[
0
]
=
Color
(
0x00
,
0xa4
,
0x00
);
aColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
;
aColorSet
.
maName
=
"Blue"
;
aColorSet
.
maColors
[
0
]
=
Color
(
0x00
,
0x00
,
0xa4
);
aColorSets
.
push_back
(
aColorSet
);
}
{
ColorSet
aColorSet
;
aColorSet
.
maName
=
"Sky"
;
aColorSet
.
maColors
[
0
]
=
Color
(
0x72
,
0x9f
,
0xcf
);
aColorSets
.
push_back
(
aColorSet
);
}
return
aColorSets
;
}
ColorSet
getColorSet
(
const
OUString
&
rColorVariant
,
std
::
vector
<
ColorSet
>&
aColorSets
)
{
for
(
size_t
i
=
0
;
i
<
aColorSets
.
size
();
++
i
)
{
if
(
aColorSets
[
i
].
maName
==
rColorVariant
)
return
aColorSets
[
i
];
}
return
aColorSets
[
0
];
}
void
applyTheme
(
SfxStyleSheetBasePool
*
pPool
,
const
OUString
&
sFontSetName
,
const
OUString
&
sColorSetName
,
StyleSet
&
rStyleSet
)
{
{
SwDocStyleSheet
*
pStyle
;
SwDocStyleSheet
*
pStyle
;
std
::
vector
<
FontSet
>
aFontSets
=
initFontSets
();
std
::
vector
<
FontSet
>
aFontSets
=
initFontSets
();
FontSet
aFontSet
=
getFontSet
(
sFontSetName
,
aFontSets
);
FontSet
aFontSet
=
getFontSet
(
sFontSetName
,
aFontSets
);
std
::
vector
<
ColorSet
>
aColorSets
=
initColorSets
();
svx
::
ColorSet
aColorSet
=
rColorSets
.
getColorSet
(
sColorSetName
);
ColorSet
aColorSet
=
getColorSet
(
sColorSetName
,
aColorSets
);
pPool
->
SetSearchMask
(
SFX_STYLE_FAMILY_PARA
);
pPool
->
SetSearchMask
(
SFX_STYLE_FAMILY_PARA
);
pStyle
=
static_cast
<
SwDocStyleSheet
*>
(
pPool
->
First
());
pStyle
=
static_cast
<
SwDocStyleSheet
*>
(
pPool
->
First
());
...
@@ -480,19 +411,53 @@ VclPtr<vcl::Window> ThemePanel::Create (vcl::Window* pParent,
...
@@ -480,19 +411,53 @@ VclPtr<vcl::Window> ThemePanel::Create (vcl::Window* pParent,
return
VclPtr
<
ThemePanel
>::
Create
(
pParent
,
rxFrame
,
pBindings
);
return
VclPtr
<
ThemePanel
>::
Create
(
pParent
,
rxFrame
,
pBindings
);
}
}
BitmapEx
ThemePanel
::
GenerateColorPreview
(
const
svx
::
ColorSet
&
rColorSet
)
{
ScopedVclPtrInstance
<
VirtualDevice
>
pVirtualDev
(
*
Application
::
GetDefaultDevice
());
sal_Int32
nScaleFactor
=
pVirtualDev
->
GetDPIScaleFactor
();
long
BORDER
=
2
*
nScaleFactor
;
long
SIZE
=
12
*
nScaleFactor
;
Size
aSize
(
BORDER
*
7
+
SIZE
*
6
,
BORDER
*
3
+
SIZE
*
2
);
pVirtualDev
->
SetOutputSizePixel
(
aSize
);
long
x
=
BORDER
;
long
y1
=
BORDER
;
long
y2
=
y1
+
SIZE
+
BORDER
;
pVirtualDev
->
SetLineColor
(
COL_LIGHTGRAY
);
for
(
sal_uInt32
i
=
0
;
i
<
12
;
i
+=
2
)
{
pVirtualDev
->
SetFillColor
(
rColorSet
.
getColor
(
i
));
pVirtualDev
->
DrawRect
(
Rectangle
(
x
,
y1
,
x
+
SIZE
,
y1
+
SIZE
));
pVirtualDev
->
SetFillColor
(
rColorSet
.
getColor
(
i
+
1
));
pVirtualDev
->
DrawRect
(
Rectangle
(
x
,
y2
,
x
+
SIZE
,
y2
+
SIZE
));
x
+=
SIZE
+
BORDER
;
}
return
pVirtualDev
->
GetBitmapEx
(
Point
(),
aSize
);
}
ThemePanel
::
ThemePanel
(
vcl
::
Window
*
pParent
,
ThemePanel
::
ThemePanel
(
vcl
::
Window
*
pParent
,
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
,
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
,
SfxBindings
*
pBindings
)
SfxBindings
*
pBindings
)
:
PanelLayout
(
pParent
,
"ThemePanel"
,
"modules/swriter/ui/sidebartheme.ui"
,
rxFrame
)
:
PanelLayout
(
pParent
,
"ThemePanel"
,
"modules/swriter/ui/sidebartheme.ui"
,
rxFrame
)
,
mpBindings
(
pBindings
)
,
mpBindings
(
pBindings
)
,
maColorSets
()
{
{
get
(
mpListBoxFonts
,
"listbox_fonts"
);
get
(
mpListBoxFonts
,
"listbox_fonts"
);
get
(
mpListBoxColors
,
"listbox_colors"
);
get
(
mpValueSetColors
,
"valueset_colors"
);
get
(
mpApplyButton
,
"apply"
);
get
(
mpApplyButton
,
"apply"
);
mpValueSetColors
->
SetColCount
(
2
);
mpValueSetColors
->
SetLineCount
(
4
);
mpApplyButton
->
SetClickHdl
(
LINK
(
this
,
ThemePanel
,
ClickHdl
));
mpApplyButton
->
SetClickHdl
(
LINK
(
this
,
ThemePanel
,
ClickHdl
));
mpListBoxFonts
->
SetDoubleClickHdl
(
LINK
(
this
,
ThemePanel
,
DoubleClickHdl
));
mpListBoxFonts
->
SetDoubleClickHdl
(
LINK
(
this
,
ThemePanel
,
DoubleClickHdl
));
mp
ListBox
Colors
->
SetDoubleClickHdl
(
LINK
(
this
,
ThemePanel
,
DoubleClickHdl
));
mp
ValueSet
Colors
->
SetDoubleClickHdl
(
LINK
(
this
,
ThemePanel
,
DoubleClickHdl
));
std
::
vector
<
FontSet
>
aFontSets
=
initFontSets
();
std
::
vector
<
FontSet
>
aFontSets
=
initFontSets
();
for
(
size_t
i
=
0
;
i
<
aFontSets
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
aFontSets
.
size
();
++
i
)
...
@@ -500,10 +465,16 @@ ThemePanel::ThemePanel(vcl::Window* pParent,
...
@@ -500,10 +465,16 @@ ThemePanel::ThemePanel(vcl::Window* pParent,
mpListBoxFonts
->
InsertEntry
(
aFontSets
[
i
].
maName
);
mpListBoxFonts
->
InsertEntry
(
aFontSets
[
i
].
maName
);
}
}
std
::
vector
<
ColorSet
>
aColorSets
=
initColorSets
();
maColorSets
.
init
();
const
std
::
vector
<
svx
::
ColorSet
>&
aColorSets
=
maColorSets
.
getColorSets
();
for
(
size_t
i
=
0
;
i
<
aColorSets
.
size
();
++
i
)
for
(
size_t
i
=
0
;
i
<
aColorSets
.
size
();
++
i
)
{
{
mpListBoxColors
->
InsertEntry
(
aColorSets
[
i
].
maName
);
const
svx
::
ColorSet
&
rColorSet
=
aColorSets
[
i
];
OUString
aName
=
rColorSet
.
getName
();
BitmapEx
aPreview
=
GenerateColorPreview
(
rColorSet
);
mpValueSetColors
->
InsertItem
(
i
,
Image
(
aPreview
),
aName
);
}
}
}
}
...
@@ -515,7 +486,7 @@ ThemePanel::~ThemePanel()
...
@@ -515,7 +486,7 @@ ThemePanel::~ThemePanel()
void
ThemePanel
::
dispose
()
void
ThemePanel
::
dispose
()
{
{
mpListBoxFonts
.
clear
();
mpListBoxFonts
.
clear
();
mp
ListBox
Colors
.
clear
();
mp
ValueSet
Colors
.
clear
();
mpApplyButton
.
clear
();
mpApplyButton
.
clear
();
PanelLayout
::
dispose
();
PanelLayout
::
dispose
();
...
@@ -525,17 +496,19 @@ IMPL_LINK_NOARG_TYPED(ThemePanel, ClickHdl, Button*, void)
...
@@ -525,17 +496,19 @@ IMPL_LINK_NOARG_TYPED(ThemePanel, ClickHdl, Button*, void)
{
{
DoubleClickHdl
(
NULL
);
DoubleClickHdl
(
NULL
);
}
}
IMPL_LINK_NOARG
(
ThemePanel
,
DoubleClickHdl
)
IMPL_LINK_NOARG
(
ThemePanel
,
DoubleClickHdl
)
{
{
SwDocShell
*
pDocSh
=
static_cast
<
SwDocShell
*>
(
SfxObjectShell
::
Current
());
SwDocShell
*
pDocSh
=
static_cast
<
SwDocShell
*>
(
SfxObjectShell
::
Current
());
if
(
pDocSh
)
if
(
pDocSh
)
{
{
OUString
sEntryFonts
=
mpListBoxFonts
->
GetSelectEntry
();
OUString
sEntryFonts
=
mpListBoxFonts
->
GetSelectEntry
();
OUString
sEntryColors
=
mpListBoxColors
->
GetSelectEntry
();
sal_uInt32
nItemId
=
mpValueSetColors
->
GetSelectItemId
();
OUString
sEntryColors
=
maColorSets
.
getColorSet
(
nItemId
).
getName
();
StyleSet
aStyleSet
=
setupThemes
();
StyleSet
aStyleSet
=
setupThemes
();
applyTheme
(
pDocSh
->
GetStyleSheetPool
(),
sEntryFonts
,
sEntryColors
,
aStyleSet
);
applyTheme
(
pDocSh
->
GetStyleSheetPool
(),
sEntryFonts
,
sEntryColors
,
aStyleSet
,
maColorSets
);
}
}
return
1
;
return
1
;
}
}
...
...
sw/source/uibase/sidebar/ThemePanel.hxx
Dosyayı görüntüle @
c9df840d
...
@@ -32,8 +32,12 @@
...
@@ -32,8 +32,12 @@
#include <svl/intitem.hxx>
#include <svl/intitem.hxx>
#include <svl/lstner.hxx>
#include <svl/lstner.hxx>
#include <svtools/valueset.hxx>
#include <svx/fntctrl.hxx>
#include <svx/fntctrl.hxx>
#include <svx/ColorSets.hxx>
#include "docsh.hxx"
#include "docsh.hxx"
namespace
sw
{
namespace
sidebar
{
namespace
sw
{
namespace
sidebar
{
...
@@ -56,18 +60,23 @@ private:
...
@@ -56,18 +60,23 @@ private:
ThemePanel
(
vcl
::
Window
*
pParent
,
ThemePanel
(
vcl
::
Window
*
pParent
,
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
,
const
css
::
uno
::
Reference
<
css
::
frame
::
XFrame
>&
rxFrame
,
SfxBindings
*
pBindings
);
SfxBindings
*
pBindings
);
virtual
~
ThemePanel
();
virtual
~
ThemePanel
();
virtual
void
dispose
()
SAL_OVERRIDE
;
virtual
void
dispose
()
SAL_OVERRIDE
;
BitmapEx
GenerateColorPreview
(
const
svx
::
ColorSet
&
rColorSet
);
SfxBindings
*
mpBindings
;
SfxBindings
*
mpBindings
;
VclPtr
<
ListBox
>
mpListBoxFonts
;
VclPtr
<
ListBox
>
mpListBoxFonts
;
VclPtr
<
ListBox
>
mpListBox
Colors
;
VclPtr
<
ValueSet
>
mpValueSet
Colors
;
VclPtr
<
PushButton
>
mpApplyButton
;
VclPtr
<
PushButton
>
mpApplyButton
;
svx
::
ColorSets
maColorSets
;
DECL_LINK_TYPED
(
ClickHdl
,
Button
*
,
void
);
DECL_LINK_TYPED
(
ClickHdl
,
Button
*
,
void
);
DECL_LINK
(
DoubleClickHdl
,
void
*
);
DECL_LINK
(
DoubleClickHdl
,
void
*
);
};
};
}}
// end of namespace sw::sidebar
}}
// end of namespace sw::sidebar
...
...
sw/uiconfig/swriter/ui/sidebartheme.ui
Dosyayı görüntüle @
c9df840d
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
<!-- Generated with glade 3.18.3 -->
<!-- Generated with glade 3.18.3 -->
<interface>
<interface>
<requires
lib=
"gtk+"
version=
"3.0"
/>
<requires
lib=
"gtk+"
version=
"3.0"
/>
<requires
lib=
"LibreOffice"
version=
"1.0"
/>
<object
class=
"GtkGrid"
id=
"ThemePanel"
>
<object
class=
"GtkGrid"
id=
"ThemePanel"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
...
@@ -43,20 +45,6 @@
...
@@ -43,20 +45,6 @@
<property
name=
"top_attach"
>
1
</property>
<property
name=
"top_attach"
>
1
</property>
</packing>
</packing>
</child>
</child>
<child>
<object
class=
"GtkTreeView"
id=
"listbox_colors"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
True
</property>
<property
name=
"hexpand"
>
True
</property>
<child
internal-child=
"selection"
>
<object
class=
"GtkTreeSelection"
id=
"treeview-selection2"
/>
</child>
</object>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
3
</property>
</packing>
</child>
<child>
<child>
<object
class=
"GtkLabel"
id=
"label2"
>
<object
class=
"GtkLabel"
id=
"label2"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
...
@@ -82,6 +70,16 @@
...
@@ -82,6 +70,16 @@
<property
name=
"top_attach"
>
4
</property>
<property
name=
"top_attach"
>
4
</property>
</packing>
</packing>
</child>
</child>
<child>
<object
class=
"svtlo-ValueSet"
id=
"valueset_colors"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
</object>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"top_attach"
>
3
</property>
</packing>
</child>
</object>
</object>
</child>
</child>
</object>
</object>
...
...
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