Kaydet (Commit) c9df840d authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

ColorSets: add preview to ThemePanel, move impl. to own file

Change-Id: I1b05edc954125e5bdeed05b5fdce1430f8eaba26
üst 48d2dca4
/* -*- 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: */
......@@ -341,6 +341,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/svdraw/svdxcgv \
svx/source/styles/CommonStylePreviewRenderer \
svx/source/styles/CommonStyleManager \
svx/source/styles/ColorSets \
svx/source/table/cell \
svx/source/table/cellcursor \
svx/source/table/cellrange \
......
/* -*- 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: */
......@@ -32,8 +32,12 @@
#include <svl/intitem.hxx>
#include <svl/lstner.hxx>
#include <svtools/valueset.hxx>
#include <svx/fntctrl.hxx>
#include <svx/ColorSets.hxx>
#include "docsh.hxx"
namespace sw { namespace sidebar {
......@@ -56,18 +60,23 @@ private:
ThemePanel(vcl::Window* pParent,
const css::uno::Reference<css::frame::XFrame>& rxFrame,
SfxBindings* pBindings);
virtual ~ThemePanel();
virtual void dispose() SAL_OVERRIDE;
BitmapEx GenerateColorPreview(const svx::ColorSet& rColorSet);
SfxBindings* mpBindings;
VclPtr<ListBox> mpListBoxFonts;
VclPtr<ListBox> mpListBoxColors;
VclPtr<ValueSet> mpValueSetColors;
VclPtr<PushButton> mpApplyButton;
svx::ColorSets maColorSets;
DECL_LINK_TYPED(ClickHdl, Button*, void);
DECL_LINK(DoubleClickHdl, void*);
};
}} // end of namespace sw::sidebar
......
......@@ -2,6 +2,8 @@
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<requires lib="LibreOffice" version="1.0"/>
<object class="GtkGrid" id="ThemePanel">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -43,20 +45,6 @@
<property name="top_attach">1</property>
</packing>
</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>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
......@@ -82,6 +70,16 @@
<property name="top_attach">4</property>
</packing>
</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>
</child>
</object>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment