[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra/textshape-stylesWidget-PierreSt] plugins/textshape: First step in new style manager
From: Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date: 2013-02-03 21:41:39
Message-ID: 20130203214139.2C765A60E0 () git ! kde ! org
[Download RAW message or body]
Git commit 32db4b43f61f897195bfd2754c19f501bfd5b3c5 by Pierre Stirnweiss.
Committed on 22/01/2013 at 17:51.
Pushed by pstirnweiss into branch 'textshape-stylesWidget-PierreSt'.
First step in new style manager
M +19 -1 plugins/textshape/CMakeLists.txt
M +7 -1 plugins/textshape/TextTool.cpp
M +3 -1 plugins/textshape/dialogs/CharacterHighlighting.cpp
M +3 -0 plugins/textshape/dialogs/StyleManager.ui
C +148 -134 plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.cpp \
[from: plugins/textshape/dialogs/CharacterHighlighting.cpp - 050% similarity] A +105 \
-0 plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.h [License: \
LGPL (v2+)] A +213 -0 \
plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.ui A +381 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.cpp [License: \
LGPL (v2+)] A +76 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.h [License: \
LGPL (v2+)] A +317 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.ui A +69 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.cpp [License: LGPL \
(v2+)] A +52 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.h [License: LGPL \
(v2+)] A +123 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.ui A +124 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.cpp [License: LGPL \
(v2+)] A +65 -0 plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.h \
[License: LGPL (v2+)] A +179 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.ui A +290 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.cpp [License: \
LGPL (v2+)] A +75 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.h [License: LGPL \
(v2+)] A +258 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.ui A +131 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.cpp [License: LGPL \
(v2+)] A +56 -0 plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.h \
[License: LGPL (v2+)] A +125 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.ui A +116 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.cpp [License: LGPL \
(v2+)] A +59 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.h [License: LGPL \
(v2+)] A +37 -0 plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.cpp \
[License: LGPL (v2+)] A +41 -0 \
plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.h [License: LGPL (v2+)] \
A +151 -0 plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.ui A +33 \
-0 plugins/textshape/dialogs/stylemanager/StylesManager.cpp [License: LGPL \
(v2+)] A +41 -0 plugins/textshape/dialogs/stylemanager/StylesManager.h \
[License: LGPL (v2+)] A +136 -0 \
plugins/textshape/dialogs/stylemanager/StylesManager.ui
http://commits.kde.org/calligra/32db4b43f61f897195bfd2754c19f501bfd5b3c5
diff --git a/plugins/textshape/CMakeLists.txt b/plugins/textshape/CMakeLists.txt
index 672ed29..90311ef 100644
--- a/plugins/textshape/CMakeLists.txt
+++ b/plugins/textshape/CMakeLists.txt
@@ -91,6 +91,15 @@ SET ( textshape_SRCS
dialogs/BibliographyPreview.cpp
dialogs/ListLevelChooser.cpp
+ dialogs/stylemanager/CharacterHighlightingTab.cpp
+ dialogs/stylemanager/ParagraphBulletsNumbersTab.cpp
+ dialogs/stylemanager/ParagraphDecorationsTab.cpp
+ dialogs/stylemanager/ParagraphDropCapsTab.cpp
+ dialogs/stylemanager/ParagraphIndentSpacingTab.cpp
+ dialogs/stylemanager/ParagraphLayoutTab.cpp
+ dialogs/stylemanager/ParagraphStylesTab.cpp
+ dialogs/stylemanager/StylesManager.cpp
+
commands/ChangeListLevelCommand.cpp
commands/ShowChangesCommand.cpp
commands/AcceptChangeCommand.cpp
@@ -123,7 +132,16 @@ kde4_add_ui_files(textshape_SRCS
dialogs/TableDialog.ui
dialogs/BibliographyConfigureDialog.ui
dialogs/TableOfContentsConfigure.ui
- dialogs/TableOfContentsStyleConfigure.ui
+ dialogs/TableOfContentsStyleConfigure.ui
+
+ dialogs/stylemanager/CharacterHighlightingTab.ui
+ dialogs/stylemanager/ParagraphBulletsNumbersTab.ui
+ dialogs/stylemanager/ParagraphDecorationsTab.ui
+ dialogs/stylemanager/ParagraphDropCapsTab.ui
+ dialogs/stylemanager/ParagraphIndentSpacingTab.ui
+ dialogs/stylemanager/ParagraphLayoutTab.ui
+ dialogs/stylemanager/ParagraphStylesTab.ui
+ dialogs/stylemanager/StylesManager.ui
dialogs/FontDecorations.ui
dialogs/LanguageTab.ui
diff --git a/plugins/textshape/TextTool.cpp b/plugins/textshape/TextTool.cpp
index 0008ce7..6b1f8fa 100644
--- a/plugins/textshape/TextTool.cpp
+++ b/plugins/textshape/TextTool.cpp
@@ -38,6 +38,8 @@
#include "commands/ChangeListLevelCommand.h"
#include "FontSizeAction.h"
+#include "dialogs/stylemanager/StylesManager.h"
+
#include <KoOdf.h>
#include <KoCanvasBase.h>
#include <KoShapeController.h>
@@ -2488,7 +2490,10 @@ void TextTool::showStyleManager(int styleId)
Q_ASSERT(styleManager);
if (!styleManager)
return; //don't crash
- StyleManagerDialog *dia = new StyleManagerDialog(canvas()->canvasWidget());
+
+ StylesManager *dia = new StylesManager();
+ dia->show();
+/* StyleManagerDialog *dia = new StyleManagerDialog(canvas()->canvasWidget());
dia->setStyleManager(styleManager);
dia->setUnit(canvas()->unit());
@@ -2501,6 +2506,7 @@ void TextTool::showStyleManager(int styleId)
dia->setCharacterStyle(characterStyle);
}
dia->show();
+*/
}
void TextTool::startTextEditingPlugin(const QString &pluginId)
diff --git a/plugins/textshape/dialogs/CharacterHighlighting.cpp \
b/plugins/textshape/dialogs/CharacterHighlighting.cpp index c2477fd..f3f0fac 100644
--- a/plugins/textshape/dialogs/CharacterHighlighting.cpp
+++ b/plugins/textshape/dialogs/CharacterHighlighting.cpp
@@ -33,6 +33,8 @@
#include <QMessageBox>
#include <QTextCharFormat>
+#include <KDebug>
+
enum Position {
Normal,
Superscript,
@@ -403,7 +405,7 @@ void CharacterHighlighting::save(KoCharacterStyle *style)
if (style == 0)
return;
-
+ kDebug() << "QFont() weight: " << QFont().weight();
KFontChooser::FontDiffFlags fontDiff = m_fontChooser->fontDiffFlags();
if (m_uniqueFormat || (fontDiff & KFontChooser::FontDiffFamily)){
style->setFontFamily(m_fontChooser->font().family());
diff --git a/plugins/textshape/dialogs/StyleManager.ui \
b/plugins/textshape/dialogs/StyleManager.ui index f9efe07..0a79e88 100644
--- a/plugins/textshape/dialogs/StyleManager.ui
+++ b/plugins/textshape/dialogs/StyleManager.ui
@@ -25,6 +25,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
<widget class="QListView" name="paragraphStylesListView">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
diff --git a/plugins/textshape/dialogs/CharacterHighlighting.cpp \
b/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.cpp similarity \
index 50% copy from plugins/textshape/dialogs/CharacterHighlighting.cpp
copy to plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.cpp
index c2477fd..9110859 100644
--- a/plugins/textshape/dialogs/CharacterHighlighting.cpp
+++ b/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.cpp
@@ -20,7 +20,8 @@
* Boston, MA 02110-1301, USA.
*/
-#include "CharacterHighlighting.h"
+#include "CharacterHighlightingTab.h"
+#include "ui_CharacterHighlightingTab.h"
#include <KoText.h>
#include <KoCharacterStyle.h>
@@ -33,6 +34,8 @@
#include <QMessageBox>
#include <QTextCharFormat>
+#include <KDebug>
+
enum Position {
Normal,
Superscript,
@@ -40,54 +43,65 @@ enum Position {
Custom
};
-CharacterHighlighting::CharacterHighlighting(bool uniqueFormat,QWidget* parent)
- : QWidget(parent),
- m_uniqueFormat(uniqueFormat)
+CharacterHighlightingTab::CharacterHighlightingTab(QWidget* parent)
+ : QWidget(parent)
+ , ui(new Ui::CharacterHighlightingTab)
+{
+ ui->setupUi(this);
+}
+
+CharacterHighlightingTab::~CharacterHighlightingTab()
{
- widget.setupUi(this);
+ delete ui;
+ ui = 0;
+}
+
+void CharacterHighlightingTab::init(bool uniqueFormat)
+{
+ m_uniqueFormat = uniqueFormat;
QStringList list;
KFontChooser::getFontList(list, KFontChooser::SmoothScalableFonts);
m_fontChooser = new KFontChooser(this, (m_uniqueFormat) ? \
KFontChooser::NoDisplayFlags : KFontChooser::ShowDifferences, list, false); \
m_fontChooser->setSampleBoxVisible(false);
- widget.fontLayout->addWidget(m_fontChooser);
+ ui->fontLayout->addWidget(m_fontChooser);
- widget.capitalizationList->addItems(capitalizationList());
- widget.underlineStyle->addItems(KoText::underlineTypeList());
- widget.underlineLineStyle->addItems(KoText::underlineStyleList());
+ ui->capitalizationList->addItems(capitalizationList());
+ ui->underlineStyle->addItems(KoText::underlineTypeList());
+ ui->underlineLineStyle->addItems(KoText::underlineStyleList());
- widget.positionList->addItems(fontLayoutPositionList());
+ ui->positionList->addItems(fontLayoutPositionList());
- widget.strikethroughStyle->addItems(KoText::underlineTypeList()); //TODO make \
KoText consistent: either add strikethroughTypeList, or change from underlineTypeList \
to lineTypeList
- widget.strikethroughLineStyle->addItems(KoText::underlineStyleList()); //TODO \
idem + ui->strikethroughStyle->addItems(KoText::underlineTypeList()); //TODO make \
KoText consistent: either add strikethroughTypeList, or change from underlineTypeList \
to lineTypeList + \
ui->strikethroughLineStyle->addItems(KoText::underlineStyleList()); //TODO idem
- connect(widget.underlineStyle, SIGNAL(activated(int)), this, \
SLOT(underlineTypeChanged(int)));
- connect(widget.underlineLineStyle, SIGNAL(activated(int)), this, \
SLOT(underlineStyleChanged(int)));
- connect(widget.underlineColor, SIGNAL(changed(QColor)), this, \
SLOT(underlineColorChanged(QColor))); + connect(ui->underlineStyle, \
SIGNAL(activated(int)), this, SLOT(underlineTypeChanged(int))); + \
connect(ui->underlineLineStyle, SIGNAL(activated(int)), this, \
SLOT(underlineStyleChanged(int))); + connect(ui->underlineColor, \
SIGNAL(changed(QColor)), this, SLOT(underlineColorChanged(QColor)));
- connect(widget.strikethroughStyle, SIGNAL(activated(int)), this, \
SLOT(strikethroughTypeChanged(int)));
- connect(widget.strikethroughLineStyle, SIGNAL(activated(int)), this, \
SLOT(strikethroughStyleChanged(int)));
- connect(widget.strikethroughColor, SIGNAL(changed(QColor)), this, \
SLOT(strikethroughColorChanged(QColor))); + connect(ui->strikethroughStyle, \
SIGNAL(activated(int)), this, SLOT(strikethroughTypeChanged(int))); + \
connect(ui->strikethroughLineStyle, SIGNAL(activated(int)), this, \
SLOT(strikethroughStyleChanged(int))); + connect(ui->strikethroughColor, \
SIGNAL(changed(QColor)), this, SLOT(strikethroughColorChanged(QColor)));
- connect(widget.capitalizationList, SIGNAL(activated(int)), this, \
SLOT(capitalisationChanged(int))); + connect(ui->capitalizationList, \
SIGNAL(activated(int)), this, SLOT(capitalisationChanged(int)));
- connect(widget.positionList, SIGNAL(activated(int)), this, \
SLOT(positionChanged(int))); + connect(ui->positionList, SIGNAL(activated(int)), \
this, SLOT(positionChanged(int)));
connect(m_fontChooser, SIGNAL(fontSelected(const QFont &)), this, \
SIGNAL(fontChanged(const QFont &)));
connect(m_fontChooser, SIGNAL(fontSelected(const QFont &)), this, \
SIGNAL(charStyleChanged()));
const KIcon clearIcon(koIconName("edit-clear"));
- widget.resetTextColor->setIcon(clearIcon);
- widget.resetBackground->setIcon(clearIcon);
- connect(widget.textColor, SIGNAL(changed(const QColor&)), this, \
SLOT(textColorChanged()));
- connect(widget.backgroundColor, SIGNAL(changed(const QColor&)), this, \
SLOT(backgroundColorChanged()));
- connect(widget.resetTextColor, SIGNAL(clicked()), this, SLOT(clearTextColor()));
- connect(widget.resetBackground, SIGNAL(clicked()), this, \
SLOT(clearBackgroundColor()));
- connect(widget.enableText, SIGNAL(toggled(bool)), this, \
SLOT(textToggled(bool)));
- connect(widget.enableBackground, SIGNAL(toggled(bool)), this, \
SLOT(backgroundToggled(bool))); + ui->resetTextColor->setIcon(clearIcon);
+ ui->resetBackground->setIcon(clearIcon);
+ connect(ui->textColor, SIGNAL(changed(const QColor&)), this, \
SLOT(textColorChanged())); + connect(ui->backgroundColor, SIGNAL(changed(const \
QColor&)), this, SLOT(backgroundColorChanged())); + connect(ui->resetTextColor, \
SIGNAL(clicked()), this, SLOT(clearTextColor())); + connect(ui->resetBackground, \
SIGNAL(clicked()), this, SLOT(clearBackgroundColor())); + connect(ui->enableText, \
SIGNAL(toggled(bool)), this, SLOT(textToggled(bool))); + \
connect(ui->enableBackground, SIGNAL(toggled(bool)), this, \
SLOT(backgroundToggled(bool))); }
-KoCharacterStyle::LineType CharacterHighlighting::indexToLineType(int index)
+KoCharacterStyle::LineType CharacterHighlightingTab::indexToLineType(int index)
{
KoCharacterStyle::LineType lineType;
switch (index) {
@@ -100,7 +114,7 @@ KoCharacterStyle::LineType \
CharacterHighlighting::indexToLineType(int index) return lineType;
}
-KoCharacterStyle::LineStyle CharacterHighlighting::indexToLineStyle(int index)
+KoCharacterStyle::LineStyle CharacterHighlightingTab::indexToLineStyle(int index)
{
KoCharacterStyle::LineStyle lineStyle;
switch (index) {
@@ -116,7 +130,7 @@ KoCharacterStyle::LineStyle \
CharacterHighlighting::indexToLineStyle(int index) return lineStyle;
}
-int CharacterHighlighting::lineTypeToIndex(KoCharacterStyle::LineType type)
+int CharacterHighlightingTab::lineTypeToIndex(KoCharacterStyle::LineType type)
{
int index;
switch (type) {
@@ -128,7 +142,7 @@ int \
CharacterHighlighting::lineTypeToIndex(KoCharacterStyle::LineType type) return \
index; }
-int CharacterHighlighting::lineStyleToIndex(KoCharacterStyle::LineStyle type)
+int CharacterHighlightingTab::lineStyleToIndex(KoCharacterStyle::LineStyle type)
{
int index;
switch (type) {
@@ -143,9 +157,9 @@ int \
CharacterHighlighting::lineStyleToIndex(KoCharacterStyle::LineStyle type) return \
index; }
-void CharacterHighlighting::capitalisationChanged(int item)
+void CharacterHighlightingTab::capitalisationChanged(int item)
{
- if (m_uniqueFormat || widget.capitalizationList->currentIndex() >= 0) {
+ if (m_uniqueFormat || ui->capitalizationList->currentIndex() >= 0) {
switch (item) {
case 0:
emit capitalizationChanged(QFont::MixedCase);
@@ -172,108 +186,108 @@ void CharacterHighlighting::capitalisationChanged(int item)
emit charStyleChanged();
}
-void CharacterHighlighting::positionChanged(int item)
+void CharacterHighlightingTab::positionChanged(int item)
{
m_positionInherited = false;
emit charStyleChanged();
}
-void CharacterHighlighting::underlineTypeChanged(int item)
+void CharacterHighlightingTab::underlineTypeChanged(int item)
{
- widget.underlineLineStyle->setEnabled(item > 0);
- widget.underlineColor->setEnabled(item > 0);
+ ui->underlineLineStyle->setEnabled(item > 0);
+ ui->underlineColor->setEnabled(item > 0);
m_underlineTypeInherited = false;
- emit underlineChanged(indexToLineType(item), \
indexToLineStyle(widget.underlineLineStyle->currentIndex()), \
widget.underlineColor->color()); + emit underlineChanged(indexToLineType(item), \
indexToLineStyle(ui->underlineLineStyle->currentIndex()), \
ui->underlineColor->color()); emit charStyleChanged();
}
-void CharacterHighlighting::underlineStyleChanged(int item)
+void CharacterHighlightingTab::underlineStyleChanged(int item)
{
- if (widget.underlineStyle->currentIndex())
- emit underlineChanged(indexToLineType(widget.underlineStyle->currentIndex()), \
indexToLineStyle(item), widget.underlineColor->color()); + if \
(ui->underlineStyle->currentIndex()) + emit \
underlineChanged(indexToLineType(ui->underlineStyle->currentIndex()), \
indexToLineStyle(item), ui->underlineColor->color()); m_underlineStyleInherited = \
false; emit charStyleChanged();
}
-void CharacterHighlighting::underlineColorChanged(QColor color)
+void CharacterHighlightingTab::underlineColorChanged(QColor color)
{
- if (widget.underlineStyle->currentIndex())
- emit underlineChanged(indexToLineType(widget.underlineStyle->currentIndex()), \
indexToLineStyle(widget.underlineLineStyle->currentIndex()), color); + if \
(ui->underlineStyle->currentIndex()) + emit \
underlineChanged(indexToLineType(ui->underlineStyle->currentIndex()), \
indexToLineStyle(ui->underlineLineStyle->currentIndex()), color); emit \
charStyleChanged(); }
-void CharacterHighlighting::strikethroughTypeChanged(int item)
+void CharacterHighlightingTab::strikethroughTypeChanged(int item)
{
- widget.strikethroughLineStyle->setEnabled(item > 0);
- widget.strikethroughColor->setEnabled(item > 0);
+ ui->strikethroughLineStyle->setEnabled(item > 0);
+ ui->strikethroughColor->setEnabled(item > 0);
m_strikeoutTypeInherited = false;
- emit strikethroughChanged(indexToLineType(item), \
indexToLineStyle(widget.strikethroughLineStyle->currentIndex()), \
widget.strikethroughColor->color()); + emit \
strikethroughChanged(indexToLineType(item), \
indexToLineStyle(ui->strikethroughLineStyle->currentIndex()), \
ui->strikethroughColor->color()); emit charStyleChanged();
}
-void CharacterHighlighting::strikethroughStyleChanged(int item)
+void CharacterHighlightingTab::strikethroughStyleChanged(int item)
{
- if (widget.strikethroughStyle->currentIndex())
- emit strikethroughChanged(indexToLineType(widget.strikethroughStyle->currentIndex()), \
indexToLineStyle(item), widget.strikethroughColor->color()); + if \
(ui->strikethroughStyle->currentIndex()) + emit \
strikethroughChanged(indexToLineType(ui->strikethroughStyle->currentIndex()), \
indexToLineStyle(item), ui->strikethroughColor->color()); m_strikeoutStyleInherited \
= false; emit charStyleChanged();
}
-void CharacterHighlighting::strikethroughColorChanged(QColor color)
+void CharacterHighlightingTab::strikethroughColorChanged(QColor color)
{
- if (widget.strikethroughStyle->currentIndex())
- emit strikethroughChanged(indexToLineType(widget.strikethroughStyle->currentIndex()), \
indexToLineStyle(widget.strikethroughLineStyle->currentIndex()), color); + if \
(ui->strikethroughStyle->currentIndex()) + emit \
strikethroughChanged(indexToLineType(ui->strikethroughStyle->currentIndex()), \
indexToLineStyle(ui->strikethroughLineStyle->currentIndex()), color); \
m_strikeoutcolorInherited = false; emit charStyleChanged();
}
-void CharacterHighlighting::backgroundColorChanged()
+void CharacterHighlightingTab::backgroundColorChanged()
{
m_backgroundColorReset = false; m_backgroundColorChanged = true;
- if (widget.enableBackground->isChecked() && \
widget.backgroundColor->color().isValid())
- emit backgroundColorChanged(widget.backgroundColor->color());
+ if (ui->enableBackground->isChecked() && ui->backgroundColor->color().isValid())
+ emit backgroundColorChanged(ui->backgroundColor->color());
emit charStyleChanged();
}
-void CharacterHighlighting::textColorChanged()
+void CharacterHighlightingTab::textColorChanged()
{
m_textColorReset = false; m_textColorChanged = true;
- if (widget.enableText->isChecked() && widget.textColor->color().isValid())
- emit textColorChanged(widget.textColor->color());
+ if (ui->enableText->isChecked() && ui->textColor->color().isValid())
+ emit textColorChanged(ui->textColor->color());
emit charStyleChanged();
}
-void CharacterHighlighting::textToggled(bool state)
+void CharacterHighlightingTab::textToggled(bool state)
{
- widget.textColor->setEnabled(state);
- widget.resetTextColor->setEnabled(state);
+ ui->textColor->setEnabled(state);
+ ui->resetTextColor->setEnabled(state);
emit charStyleChanged();
}
-void CharacterHighlighting::backgroundToggled(bool state)
+void CharacterHighlightingTab::backgroundToggled(bool state)
{
- widget.backgroundColor->setEnabled(state);
- widget.resetBackground->setEnabled(state);
+ ui->backgroundColor->setEnabled(state);
+ ui->resetBackground->setEnabled(state);
emit charStyleChanged();
}
-void CharacterHighlighting::clearTextColor()
+void CharacterHighlightingTab::clearTextColor()
{
- widget.textColor->setColor(widget.textColor->defaultColor());
+ ui->textColor->setColor(ui->textColor->defaultColor());
m_textColorReset = true;
emit textColorChanged(QColor(Qt::black));
emit charStyleChanged();
}
-void CharacterHighlighting::clearBackgroundColor()
+void CharacterHighlightingTab::clearBackgroundColor()
{
- widget.backgroundColor->setColor(widget.backgroundColor->defaultColor());
+ ui->backgroundColor->setColor(ui->backgroundColor->defaultColor());
m_backgroundColorReset = true;
emit backgroundColorChanged(QColor(Qt::transparent));
emit charStyleChanged();
}
-QStringList CharacterHighlighting::capitalizationList()
+QStringList CharacterHighlightingTab::capitalizationList()
{
QStringList lst;
lst <<i18n("Normal");
@@ -284,7 +298,7 @@ QStringList CharacterHighlighting::capitalizationList()
return lst;
}
-QStringList CharacterHighlighting::fontLayoutPositionList()
+QStringList CharacterHighlightingTab::fontLayoutPositionList()
{
QStringList lst;
lst <<i18n("Normal");
@@ -292,7 +306,7 @@ QStringList CharacterHighlighting::fontLayoutPositionList()
lst <<i18n("Subscript");
return lst;
}
-void CharacterHighlighting::setDisplay(KoCharacterStyle *style)
+void CharacterHighlightingTab::setDisplay(KoCharacterStyle *style)
{
if (style == 0)
return;
@@ -307,18 +321,18 @@ void CharacterHighlighting::setDisplay(KoCharacterStyle *style)
m_positionInherited = !style->hasProperty(QTextFormat::TextVerticalAlignment);
switch (style->verticalAlignment()) {
case QTextCharFormat::AlignSuperScript:
- widget.positionList->setCurrentIndex(1);
+ ui->positionList->setCurrentIndex(1);
break;
case QTextCharFormat::AlignSubScript:
- widget.positionList->setCurrentIndex(2);
+ ui->positionList->setCurrentIndex(2);
break;
default:
// TODO check if its custom instead.
- widget.positionList->setCurrentIndex(0);
+ ui->positionList->setCurrentIndex(0);
}
if (!m_uniqueFormat){
- widget.positionList->setEnabled(false);
- widget.positionList->setCurrentIndex(-1);
+ ui->positionList->setEnabled(false);
+ ui->positionList->setCurrentIndex(-1);
}
m_underlineStyleInherited = \
!style->hasProperty(KoCharacterStyle::UnderlineStyle); @@ -333,36 +347,36 @@ void \
CharacterHighlighting::setDisplay(KoCharacterStyle *style) m_capitalizInherited = \
!style->hasProperty(QFont::Capitalize);
//set the underline up
- widget.underlineStyle->setCurrentIndex(1);
- widget.underlineLineStyle->setCurrentIndex(lineStyleToIndex(style->underlineStyle()));
+ ui->underlineStyle->setCurrentIndex(1);
+ ui->underlineLineStyle->setCurrentIndex(lineStyleToIndex(style->underlineStyle()));
if (m_uniqueFormat)
- widget.underlineStyle->setCurrentIndex(lineTypeToIndex(style->underlineType()));
+ ui->underlineStyle->setCurrentIndex(lineTypeToIndex(style->underlineType()));
else
- widget.underlineStyle->setCurrentIndex(-1);
+ ui->underlineStyle->setCurrentIndex(-1);
- underlineTypeChanged(widget.underlineStyle->currentIndex());
- widget.underlineColor->setColor(style->underlineColor());
+ underlineTypeChanged(ui->underlineStyle->currentIndex());
+ ui->underlineColor->setColor(style->underlineColor());
//set the strikethrough up
- widget.strikethroughStyle->setCurrentIndex(1);
- widget.strikethroughLineStyle->setCurrentIndex(lineStyleToIndex(style->strikeOutStyle()));
+ ui->strikethroughStyle->setCurrentIndex(1);
+ ui->strikethroughLineStyle->setCurrentIndex(lineStyleToIndex(style->strikeOutStyle()));
if (m_uniqueFormat)
- widget.strikethroughStyle->setCurrentIndex(lineTypeToIndex(style->strikeOutType()));
+ ui->strikethroughStyle->setCurrentIndex(lineTypeToIndex(style->strikeOutType()));
else
- widget.strikethroughStyle->setCurrentIndex(-1);
- strikethroughTypeChanged(widget.strikethroughStyle->currentIndex());
- widget.strikethroughColor->setColor(style->strikeOutColor());
+ ui->strikethroughStyle->setCurrentIndex(-1);
+ strikethroughTypeChanged(ui->strikethroughStyle->currentIndex());
+ ui->strikethroughColor->setColor(style->strikeOutColor());
//Now set the capitalisation
int index;
switch (style->fontCapitalization()) {
- case QFont::MixedCase: widget.capitalizationList->setCurrentIndex(0);index=0; \
break;
- case QFont::SmallCaps: widget.capitalizationList->setCurrentIndex(1);index=1; \
break;
- case QFont::AllUppercase: widget.capitalizationList->setCurrentIndex(2);index=2; \
break;
- case QFont::AllLowercase: widget.capitalizationList->setCurrentIndex(3);index=3; \
break;
- case QFont::Capitalize: widget.capitalizationList->setCurrentIndex(4);index=4; \
break; + case QFont::MixedCase: \
ui->capitalizationList->setCurrentIndex(0);index=0; break; + case \
QFont::SmallCaps: ui->capitalizationList->setCurrentIndex(1);index=1; break; + \
case QFont::AllUppercase: ui->capitalizationList->setCurrentIndex(2);index=2; break; \
+ case QFont::AllLowercase: ui->capitalizationList->setCurrentIndex(3);index=3; \
break; + case QFont::Capitalize: \
ui->capitalizationList->setCurrentIndex(4);index=4; break; default:
- widget.capitalizationList->setCurrentIndex(0);
+ ui->capitalizationList->setCurrentIndex(0);
index =0;
break;
}
@@ -370,16 +384,16 @@ void CharacterHighlighting::setDisplay(KoCharacterStyle *style)
if(m_uniqueFormat)
capitalisationChanged(index);
else{
- widget.capitalizationList->setCurrentIndex(-1);
- widget.capitalizationList->setEnabled(false);
+ ui->capitalizationList->setCurrentIndex(-1);
+ ui->capitalizationList->setEnabled(false);
}
//Set font decoration display
- widget.enableText->setVisible(!m_uniqueFormat);
- widget.enableText->setChecked(m_uniqueFormat);
+ ui->enableText->setVisible(!m_uniqueFormat);
+ ui->enableText->setChecked(m_uniqueFormat);
textToggled(m_uniqueFormat);
- widget.enableBackground->setVisible(!m_uniqueFormat);
- widget.enableBackground->setChecked(m_uniqueFormat);
+ ui->enableBackground->setVisible(!m_uniqueFormat);
+ ui->enableBackground->setChecked(m_uniqueFormat);
backgroundToggled(m_uniqueFormat);
m_textColorChanged = false;
@@ -388,22 +402,22 @@ void CharacterHighlighting::setDisplay(KoCharacterStyle *style)
if (m_textColorReset || (style->foreground().style() == Qt::NoBrush)) {
clearTextColor();
} else {
- widget.textColor->setColor(style->foreground().color());
+ ui->textColor->setColor(style->foreground().color());
}
m_backgroundColorReset = ! style->hasProperty(QTextFormat::BackgroundBrush);
if (m_backgroundColorReset || (style->background().style() == Qt::NoBrush)) {
clearBackgroundColor();
} else {
- widget.backgroundColor->setColor(style->background().color());
+ ui->backgroundColor->setColor(style->background().color());
}
}
-void CharacterHighlighting::save(KoCharacterStyle *style)
+void CharacterHighlightingTab::save(KoCharacterStyle *style)
{
if (style == 0)
return;
-
+ kDebug() << "QFont() weight: " << QFont().weight();
KFontChooser::FontDiffFlags fontDiff = m_fontChooser->fontDiffFlags();
if (m_uniqueFormat || (fontDiff & KFontChooser::FontDiffFamily)){
style->setFontFamily(m_fontChooser->font().family());
@@ -416,55 +430,55 @@ void CharacterHighlighting::save(KoCharacterStyle *style)
style->setFontItalic(m_fontChooser->font().italic()); //TODO should set \
style instead of italic }
- if (widget.underlineStyle->currentIndex() == 0) {
+ if (ui->underlineStyle->currentIndex() == 0) {
style->setUnderlineType(KoCharacterStyle::NoLineType);
style->setUnderlineStyle(KoCharacterStyle::NoLineStyle);
- } else if (widget.underlineStyle->currentIndex() > 0) {
+ } else if (ui->underlineStyle->currentIndex() > 0) {
if (!m_underlineTypeInherited) {
- style->setUnderlineType(indexToLineType(widget.underlineStyle->currentIndex()));
+ style->setUnderlineType(indexToLineType(ui->underlineStyle->currentIndex()));
}
if (!m_underlineStyleInherited) {
- style->setUnderlineStyle(indexToLineStyle(widget.underlineLineStyle->currentIndex()));
+ style->setUnderlineStyle(indexToLineStyle(ui->underlineLineStyle->currentIndex()));
}
- style->setUnderlineColor(widget.underlineColor->color());
+ style->setUnderlineColor(ui->underlineColor->color());
}
- if (widget.strikethroughStyle->currentIndex() == 0) {
+ if (ui->strikethroughStyle->currentIndex() == 0) {
style->setStrikeOutType(KoCharacterStyle::NoLineType);
style->setStrikeOutStyle(KoCharacterStyle::NoLineStyle);
- } else if (widget.strikethroughStyle->currentIndex() > 0) {
+ } else if (ui->strikethroughStyle->currentIndex() > 0) {
if (!m_strikeoutTypeInherited) {
- style->setStrikeOutType(indexToLineType(widget.strikethroughStyle->currentIndex()));
+ style->setStrikeOutType(indexToLineType(ui->strikethroughStyle->currentIndex()));
}
if (!m_strikeoutStyleInherited) {
- style->setStrikeOutStyle(indexToLineStyle(widget.strikethroughLineStyle->currentIndex()));
+ style->setStrikeOutStyle(indexToLineStyle(ui->strikethroughLineStyle->currentIndex()));
}
if (!m_strikeoutcolorInherited) {
- style->setStrikeOutColor(widget.strikethroughColor->color());
+ style->setStrikeOutColor(ui->strikethroughColor->color());
}
}
- if (m_uniqueFormat || widget.capitalizationList->currentIndex() >= 0) {
- if (widget.capitalizationList->currentIndex() == 0 && !m_mixedCaseInherited)
+ if (m_uniqueFormat || ui->capitalizationList->currentIndex() >= 0) {
+ if (ui->capitalizationList->currentIndex() == 0 && !m_mixedCaseInherited)
style->setFontCapitalization(QFont::MixedCase);
- else if (widget.capitalizationList->currentIndex() == 1 && \
!m_smallCapsInherited) + else if (ui->capitalizationList->currentIndex() == 1 \
&& !m_smallCapsInherited) style->setFontCapitalization(QFont::SmallCaps);
- else if (widget.capitalizationList->currentIndex() == 2 && \
!m_allUpperCaseInherited) + else if (ui->capitalizationList->currentIndex() == \
2 && !m_allUpperCaseInherited) style->setFontCapitalization(QFont::AllUppercase);
- else if (widget.capitalizationList->currentIndex() == 3 && \
!m_allLowerCaseInherited) + else if (ui->capitalizationList->currentIndex() == \
3 && !m_allLowerCaseInherited) style->setFontCapitalization(QFont::AllLowercase);
- else if (widget.capitalizationList->currentIndex() == 4 && \
!m_capitalizInherited) + else if (ui->capitalizationList->currentIndex() == 4 \
&& !m_capitalizInherited) style->setFontCapitalization(QFont::Capitalize);
}
QTextCharFormat::VerticalAlignment va;
- if (m_uniqueFormat || widget.positionList->currentIndex() >= 0){
+ if (m_uniqueFormat || ui->positionList->currentIndex() >= 0){
if (!m_positionInherited ) {
- if (widget.positionList->currentIndex() == 0)
+ if (ui->positionList->currentIndex() == 0)
va = QTextCharFormat::AlignNormal;
- else if (widget.positionList->currentIndex() == 2)
+ else if (ui->positionList->currentIndex() == 2)
va = QTextCharFormat::AlignSubScript;
- else if (widget.positionList->currentIndex() == 1)
+ else if (ui->positionList->currentIndex() == 1)
va = QTextCharFormat::AlignSuperScript;
else
va = QTextCharFormat::AlignNormal;
@@ -472,14 +486,14 @@ void CharacterHighlighting::save(KoCharacterStyle *style)
}
}
- if (widget.enableBackground->isChecked() && m_backgroundColorReset)
+ if (ui->enableBackground->isChecked() && m_backgroundColorReset)
style->setBackground(QBrush(Qt::NoBrush));
- else if (widget.enableBackground->isChecked() && m_backgroundColorChanged)
- style->setBackground(QBrush(widget.backgroundColor->color()));
- if (widget.enableText->isChecked() && m_textColorReset)
+ else if (ui->enableBackground->isChecked() && m_backgroundColorChanged)
+ style->setBackground(QBrush(ui->backgroundColor->color()));
+ if (ui->enableText->isChecked() && m_textColorReset)
style->setForeground(QBrush(Qt::NoBrush));
- else if (widget.enableText->isChecked() && m_textColorChanged)
- style->setForeground(QBrush(widget.textColor->color()));
+ else if (ui->enableText->isChecked() && m_textColorChanged)
+ style->setForeground(QBrush(ui->textColor->color()));
}
-#include <CharacterHighlighting.moc>
+#include <CharacterHighlightingTab.moc>
diff --git a/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.h \
b/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.h new file mode \
100644 index 0000000..7ddb089
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.h
@@ -0,0 +1,105 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
+ Copyright (C) 2006 Thomas Zander <zander@kde.org>
+ Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CHARACTERHIGHLIGHTINGTAB_H
+#define CHARACTERHIGHLIGHTINGTAB_H
+
+#include "KoCharacterStyle.h"
+#include <kfontchooser.h>
+
+class QColor;
+
+namespace Ui {
+ class CharacterHighlightingTab;
+}
+
+class CharacterHighlightingTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit CharacterHighlightingTab(QWidget* parent = 0);
+ ~CharacterHighlightingTab();
+
+ void init(bool uniqueFormat);
+
+ void setDisplay(KoCharacterStyle *style);
+ void save(KoCharacterStyle *style);
+
+ QStringList capitalizationList();
+ QStringList fontLayoutPositionList();
+
+signals:
+ void underlineChanged(KoCharacterStyle::LineType, KoCharacterStyle::LineStyle, \
QColor); + void strikethroughChanged(KoCharacterStyle::LineType, \
KoCharacterStyle::LineStyle, QColor); + void \
capitalizationChanged(QFont::Capitalization); + void fontChanged(const QFont \
&font); + void textColorChanged(QColor);
+ void backgroundColorChanged(QColor);
+ void charStyleChanged();
+
+
+private slots:
+ void underlineTypeChanged(int item);
+ void underlineStyleChanged(int item);
+ void underlineColorChanged(QColor color);
+ void strikethroughTypeChanged(int item);
+ void strikethroughStyleChanged(int item);
+ void strikethroughColorChanged(QColor color);
+ void capitalisationChanged(int item);
+ void positionChanged(int item);
+ void textToggled(bool state);
+ void backgroundToggled(bool state);
+ void clearTextColor();
+ void clearBackgroundColor();
+ void textColorChanged();
+ void backgroundColorChanged();
+
+private:
+ KoCharacterStyle::LineType indexToLineType(int index);
+ KoCharacterStyle::LineStyle indexToLineStyle(int index);
+ int lineTypeToIndex(KoCharacterStyle::LineType type);
+ int lineStyleToIndex(KoCharacterStyle::LineStyle type);
+
+ Ui::CharacterHighlightingTab *ui;
+
+ KFontChooser *m_fontChooser;
+
+ bool m_uniqueFormat;
+ bool m_underlineStyleInherited;
+ bool m_underlineTypeInherited;
+ bool m_strikeoutStyleInherited;
+ bool m_strikeoutcolorInherited;
+ bool m_strikeoutTypeInherited;
+ bool m_mixedCaseInherited;
+ bool m_smallCapsInherited;
+ bool m_allUpperCaseInherited;
+ bool m_allLowerCaseInherited;
+ bool m_capitalizInherited;
+ bool m_positionInherited;
+ bool m_hyphenateInherited;
+ bool m_textColorChanged;
+ bool m_textColorReset;
+ bool m_backgroundColorChanged;
+ bool m_backgroundColorReset;
+};
+
+#endif
diff --git a/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.ui \
b/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.ui new file mode \
100644 index 0000000..0dcdf28
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/CharacterHighlightingTab.ui
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CharacterHighlightingTab</class>
+ <widget class="QWidget" name="CharacterHighlightingTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>520</width>
+ <height>456</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QGridLayout" name="fontLayout"/>
+ </item>
+ <item>
+ <layout class="QHBoxLayout">
+ <item>
+ <layout class="QHBoxLayout" stretch="0,0,0,0,1">
+ <item>
+ <widget class="QCheckBox" name="enableText"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="textColorLabel">
+ <property name="text">
+ <string>Text color:</string>
+ </property>
+ <property name="buddy">
+ <cstring>textColor</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KColorButton" name="textColor"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="resetTextColor">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" stretch="0,0,0,0,1">
+ <item>
+ <widget class="QCheckBox" name="enableBackground">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="backgroundColorLabel">
+ <property name="text">
+ <string>Background color:</string>
+ </property>
+ <property name="buddy">
+ <cstring>backgroundColor</cstring>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KColorButton" name="backgroundColor"/>
+ </item>
+ <item>
+ <widget class="QToolButton" name="resetBackground">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QFormLayout">
+ <item row="0" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Underlining:</string>
+ </property>
+ <property name="buddy">
+ <cstring>underlineStyle</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="KComboBox" name="underlineStyle"/>
+ </item>
+ <item>
+ <widget class="KComboBox" name="underlineLineStyle">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KColorButton" name="underlineColor">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Strikethrough:</string>
+ </property>
+ <property name="buddy">
+ <cstring>strikethroughStyle</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <layout class="QHBoxLayout">
+ <item>
+ <widget class="QComboBox" name="strikethroughStyle"/>
+ </item>
+ <item>
+ <widget class="QComboBox" name="strikethroughLineStyle">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="KColorButton" name="strikethroughColor">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Capitalization:</string>
+ </property>
+ <property name="buddy">
+ <cstring>capitalizationList</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QComboBox" name="capitalizationList"/>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel">
+ <property name="text">
+ <string>Position:</string>
+ </property>
+ <property name="buddy">
+ <cstring>positionList</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <widget class="QComboBox" name="positionList"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KColorButton</class>
+ <extends>QPushButton</extends>
+ <header>kcolorbutton.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <includes>
+ <include location="local">kcolorbutton.h</include>
+ <include location="local">kcombobox.h</include>
+ </includes>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.cpp new file mode \
100644 index 0000000..7f3f482
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.cpp
@@ -0,0 +1,381 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007, 2009-2010 Thomas Zander <zander@kde.org>
+ * Copyright (C) 2008 Girish Ramakrishnan <girish@forwardbias.in>
+ * Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParagraphBulletsNumbersTab.h"
+
+#include <KoParagraphStyle.h>
+#include <KoListLevelProperties.h>
+#include <KoImageData.h>
+#include <KoImageCollection.h>
+
+#include <KDebug>
+#include <KCharSelect>
+#include <KDialog>
+#include <KUrl>
+#include <KFileDialog>
+#include <KIO/Job>
+
+ParagraphBulletsNumbersTab::ParagraphBulletsNumbersTab(QWidget *parent)
+ : QWidget(parent),
+ m_alignmentMode(false),
+ m_imageCollection(0),
+ m_data(0),
+ m_fontSize(0)
+{
+ widget.setupUi(this);
+
+ foreach(const Lists::ListStyleItem & item, Lists::genericListStyleItems())
+ addStyle(item);
+ addStyle(Lists::ListStyleItem(i18n("Custom Bullet"), \
KoListStyle::CustomCharItem)); + m_blankCharIndex = \
addStyle(Lists::ListStyleItem(i18n("No Bullet"), KoListStyle::CustomCharItem)); + \
foreach(const Lists::ListStyleItem & item, Lists::otherListStyleItems()) + \
addStyle(item); +
+ widget.alignment->addItem(i18nc("Automatic horizontal alignment", "Auto"));
+ widget.alignment->addItem(i18nc("Text alignment", "Left"));
+ widget.alignment->addItem(i18nc("Text alignment", "Right"));
+ widget.alignment->addItem(i18nc("Text alignment", "Centered"));
+
+ widget.labelFollowedBy->addItem(i18nc("Tab follows the bullet or number", "Tab \
Stop")); + widget.labelFollowedBy->addItem(i18nc("Space", "Space"));
+ widget.labelFollowedBy->addItem(i18nc("None", "Nothing"));
+
+ widget.doubleSpinBox->setSingleStep(0.05);
+ widget.doubleSpinBox_2->setSingleStep(0.05);
+ widget.doubleSpinBox_3->setSingleStep(0.05);
+
+ connect(widget.labelFollowedBy,SIGNAL(currentIndexChanged(int)),this,SLOT(labelFollowedByIndexChanged(int)));
+ connect(widget.listTypes, SIGNAL(currentRowChanged(int)), this, \
SLOT(styleChanged(int))); + connect(widget.customCharacter, SIGNAL(clicked(bool)), \
this, SLOT(customCharButtonPressed())); + connect(widget.letterSynchronization, \
SIGNAL(toggled(bool)), widget.startValue, SLOT(setLetterSynchronization(bool))); + \
connect(widget.prefix, SIGNAL(textChanged(const QString&)), this, \
SLOT(recalcPreview())); + connect(widget.suffix, SIGNAL(textChanged(const \
QString&)), this, SLOT(recalcPreview())); + connect(widget.depth, \
SIGNAL(valueChanged(int)), this, SLOT(recalcPreview())); + connect(widget.levels, \
SIGNAL(valueChanged(int)), this, SLOT(recalcPreview())); + \
connect(widget.startValue, SIGNAL(valueChanged(int)), this, SLOT(recalcPreview())); + \
connect(widget.insertImage, SIGNAL(clicked()), this, SLOT(selectListImage())); + \
connect(widget.imageHeight, SIGNAL(valueChanged(double)), this, \
SLOT(recalcPreview())); + connect(widget.imageWidth, SIGNAL(valueChanged(double)), \
this, SLOT(recalcPreview())); + connect(widget.restartNumbering, \
SIGNAL(clicked()), this, SLOT(recalcPreview())); +}
+
+int ParagraphBulletsNumbersTab::addStyle(const Lists::ListStyleItem &lsi)
+{
+ m_mapping.insert(widget.listTypes->count(), lsi.style);
+ widget.listTypes->addItem(lsi.name);
+ return widget.listTypes->count() - 1;
+}
+
+void ParagraphBulletsNumbersTab::setDisplay(KoParagraphStyle *style, int level)
+{
+ KoListStyle *listStyle = style->listStyle();
+ widget.listPropertiesPane->setEnabled(listStyle != 0);
+ widget.customCharacter->setText("-");
+ if (listStyle == 0) {
+ widget.listTypes->setCurrentRow(0);
+ return;
+ }
+
+ KoListLevelProperties llp = listStyle->levelProperties(level);
+ m_previousLevel = llp.level();
+ widget.prefix->setText(llp.listItemPrefix());
+ widget.suffix->setText(llp.listItemSuffix());
+ widget.letterSynchronization->setChecked(llp.letterSynchronization());
+ KoListStyle::Style s = llp.style();
+ foreach(int row, m_mapping.keys()) {
+ if (m_mapping[row] == s) {
+ widget.listTypes->setCurrentRow(row);
+ break;
+ }
+ }
+ int align;
+ if (llp.alignment() == (Qt::AlignLeft | Qt::AlignAbsolute))
+ align = 1;
+ else if (llp.alignment() == (Qt::AlignRight | Qt::AlignAbsolute))
+ align = 2;
+ else if (llp.alignment() == Qt::AlignCenter)
+ align = 3;
+ else
+ align = 0;
+
+ widget.alignment->setCurrentIndex(align);
+ widget.depth->setValue(llp.level());
+ widget.levels->setValue(llp.displayLevel());
+ widget.startValue->setValue(llp.startValue());
+ if (s == KoListStyle::CustomCharItem)
+ widget.customCharacter->setText(llp.bulletCharacter());
+
+ if (s == KoListStyle::ImageItem) {
+ m_data = llp.bulletImage();
+ widget.imageHeight->setValue(llp.height());
+ widget.imageWidth->setValue(llp.width());
+ } else {
+ m_data = 0;
+ widget.imageHeight->setValue(0);
+ widget.imageWidth->setValue(0);
+ }
+
+ if(llp.alignmentMode()==false) {//for \
list-level-position-and-space-mode=label-width-and-position disable the following \
options + widget.label_8->setEnabled(false);
+ widget.label_9->setEnabled(false);
+ widget.label_10->setEnabled(false);
+ widget.label_11->setEnabled(false);
+
+ widget.labelFollowedBy->setEnabled(false);
+ widget.doubleSpinBox->setEnabled(false);
+ widget.doubleSpinBox_2->setEnabled(false);
+ widget.doubleSpinBox_3->setEnabled(false);
+ } else {
+ m_alignmentMode=true;
+ switch(llp.labelFollowedBy()) {
+ case KoListStyle::ListTab:
+ widget.doubleSpinBox->setEnabled(true);
+ widget.labelFollowedBy->setCurrentIndex(0);
+ widget.doubleSpinBox->setValue(KoUnit::toCentimeter(llp.tabStopPosition()));
+ break;
+ case KoListStyle::Space:
+ widget.doubleSpinBox->setEnabled(false);
+ widget.labelFollowedBy->setCurrentIndex(1);
+ break;
+ case KoListStyle::Nothing:
+ widget.doubleSpinBox->setEnabled(false);
+ widget.labelFollowedBy->setCurrentIndex(2);
+ break;
+ default:
+ Q_ASSERT(false);
+ }
+
+ widget.doubleSpinBox_2->setValue(KoUnit::toCentimeter(llp.margin()));
+ widget.doubleSpinBox_3->setValue(KoUnit::toCentimeter(llp.margin())+KoUnit::toCentimeter(llp.textIndent()));
+ }
+
+ // *** features not in GUI;
+ // character style
+ // relative bullet size (percent)
+ // minimum label width
+ recalcPreview();
+}
+
+void ParagraphBulletsNumbersTab::save(KoParagraphStyle *savingStyle)
+{
+ Q_ASSERT(savingStyle);
+
+ KoUnit unit(KoUnit::Centimeter);
+
+ const int currentRow = widget.listTypes->currentRow();
+ KoListStyle::Style style = m_mapping[currentRow];
+ if (style == KoListStyle::None) {
+ savingStyle->setListStyle(0);
+ return;
+ }
+ if (savingStyle->listStyle() == 0) {
+ KoListStyle *listStyle = new KoListStyle(savingStyle);
+ savingStyle->setListStyle(listStyle);
+ }
+ KoListStyle *listStyle = savingStyle->listStyle();
+ KoListLevelProperties llp = listStyle->levelProperties(widget.depth->value());
+ llp.setStyle(style);
+ llp.setLevel(widget.depth->value());
+ llp.setDisplayLevel(widget.levels->value());
+ llp.setStartValue(widget.startValue->value());
+ llp.setListItemPrefix(widget.prefix->text());
+ llp.setListItemSuffix(widget.suffix->text());
+ llp.setLetterSynchronization(widget.letterSynchronization->isVisible() && \
widget.letterSynchronization->isChecked()); +
+ if(m_alignmentMode==true) {
+ llp.setAlignmentMode(true);
+ switch(widget.labelFollowedBy->currentIndex()) {
+ case 0: llp.setLabelFollowedBy(KoListStyle::ListTab);
+ llp.setTabStopPosition(unit.fromUserValue(widget.doubleSpinBox->value()));
+ break;
+ case 1: llp.setLabelFollowedBy(KoListStyle::Space);
+ break;
+ case 2: llp.setLabelFollowedBy(KoListStyle::Nothing);
+ break;
+ default:
+ Q_ASSERT(false);
+ }
+
+ llp.setMargin(unit.fromUserValue(widget.doubleSpinBox_2->value()));
+ llp.setTextIndent(unit.fromUserValue(widget.doubleSpinBox_3->value())-unit.fromUserValue(widget.doubleSpinBox_2->value()));
+ }
+
+ if (style == KoListStyle::ImageItem) {
+ if (m_data) {
+ llp.setBulletImage(m_data);
+ }
+ llp.setWidth(widget.imageWidth->value());
+ llp.setHeight(widget.imageHeight->value());
+ } else if (style == KoListStyle::CustomCharItem) {
+ llp.setBulletCharacter((currentRow == m_blankCharIndex) ? QChar() : \
widget.customCharacter->text().remove('&').at(0)); + }
+ // it is important to not use 45 for CustomCharItem as it is also char based
+ else if (!KoListStyle::isNumberingStyle(style)) {
+ llp.setRelativeBulletSize(45); //for non-numbering bullets the default \
relative bullet size is 45%(The spec does not say it; we take it) + }
+
+ Qt::Alignment align;
+ switch (widget.alignment->currentIndex()) {
+ case 0: align = Qt::AlignLeft; break;
+ case 1: align = Qt::AlignLeft | Qt::AlignAbsolute; break;
+ case 2: align = Qt::AlignRight | Qt::AlignAbsolute; break;
+ case 3: align = Qt::AlignCenter; break;
+ default:
+ Q_ASSERT(false);
+ }
+ llp.setAlignment(align);
+
+ if (llp.level() != m_previousLevel)
+ listStyle->removeLevelProperties(m_previousLevel);
+ listStyle->setLevelProperties(llp);
+}
+
+void ParagraphBulletsNumbersTab::styleChanged(int index)
+{
+ KoListStyle::Style style = m_mapping[index];
+ bool showLetterSynchronization = false;
+
+ if (style == KoListStyle::ImageItem) {
+ widget.startValue->setValue(1);
+ widget.startValue->setEnabled(false);
+ widget.levels->setValue(1);
+ widget.levels->setEnabled(false);
+ widget.insertImage->setEnabled(true);
+ widget.imageHeight->setEnabled(true);
+ widget.imageWidth->setEnabled(true);
+
+ if (widget.imageHeight->value() == 0 && widget.imageWidth->value() == 0) {
+ widget.imageHeight->setValue(m_fontSize);
+ widget.imageWidth->setValue(m_fontSize);
+ }
+ } else if (!KoListStyle::isNumberingStyle(style)) {
+ widget.startValue->setCounterType(KoListStyle::DecimalItem);
+ widget.startValue->setValue(1);
+ widget.startValue->setEnabled(false);
+ widget.levels->setValue(1);
+ widget.levels->setEnabled(false);
+ widget.insertImage->setEnabled(false);
+ widget.imageHeight->setEnabled(false);
+ widget.imageWidth->setEnabled(false);
+ widget.imageHeight->setValue(0);
+ widget.imageWidth->setValue(0);
+ } else {
+ switch (style) {
+ case KoListStyle::AlphaLowerItem:
+ case KoListStyle::UpperAlphaItem:
+ showLetterSynchronization = true;
+ // fall through
+ default:
+ widget.levels->setEnabled(true);
+ widget.startValue->setEnabled(true);
+ widget.startValue->setCounterType(style);
+ int value = widget.startValue->value();
+ widget.startValue->setValue(value + 1);
+ widget.startValue->setValue(value); // surely to trigger a change event.
+ widget.insertImage->setEnabled(false);
+ widget.imageHeight->setEnabled(false);
+ widget.imageWidth->setEnabled(false);
+ }
+ widget.imageHeight->setValue(0);
+ widget.imageWidth->setValue(0);
+ }
+
+ widget.customCharacter->setEnabled(style == KoListStyle::CustomCharItem && index \
!= m_blankCharIndex); + \
widget.letterSynchronization->setVisible(showLetterSynchronization); + \
widget.listPropertiesPane->setEnabled(style != KoListStyle::None); + \
recalcPreview(); +}
+
+void ParagraphBulletsNumbersTab::customCharButtonPressed()
+{
+ KDialog *dialog = new KDialog(this);
+ dialog->setModal(true);
+ dialog->setButtons(KDialog::Ok | KDialog::Cancel);
+ dialog->setDefaultButton(KDialog::Ok);
+
+ KCharSelect *kcs = new KCharSelect(dialog, 0,
+ KCharSelect::SearchLine | KCharSelect::FontCombo | \
KCharSelect::BlockCombos + | KCharSelect::CharacterTable | \
KCharSelect::DetailBrowser); +
+ dialog->setMainWidget(kcs);
+ if (dialog->exec() == KDialog::Accepted) {
+ QChar character = kcs->currentChar();
+ widget.customCharacter->setText(character);
+
+ // also switch to the custom list style.
+ foreach(int row, m_mapping.keys()) {
+ if (m_mapping[row] == KoListStyle::CustomCharItem) {
+ widget.listTypes->setCurrentRow(row);
+ break;
+ }
+ }
+ }
+ delete dialog;
+ recalcPreview();
+}
+
+void ParagraphBulletsNumbersTab::recalcPreview()
+{
+ emit parStyleChanged();
+}
+
+void ParagraphBulletsNumbersTab::labelFollowedByIndexChanged(int index)
+{
+ if(index==1 || index==2) {
+ widget.doubleSpinBox->setEnabled(false);
+ } else {
+ widget.doubleSpinBox->setEnabled(true);
+ }
+ emit parStyleChanged();
+ emit recalcPreview();
+}
+
+void ParagraphBulletsNumbersTab::setImageCollection(KoImageCollection \
*imageCollection) +{
+ m_imageCollection = imageCollection;
+}
+
+void ParagraphBulletsNumbersTab::selectListImage()
+{
+ KUrl url = KFileDialog::getOpenUrl();
+ if (!url.isEmpty()) {
+ KIO::StoredTransferJob *job = KIO::storedGet(url, KIO::NoReload, 0);
+ connect(job, SIGNAL(result(KJob*)), this, SLOT(setImageData(KJob*)));
+ }
+}
+
+void ParagraphBulletsNumbersTab::setImageData(KJob *job)
+{
+ KIO::StoredTransferJob *transferJob = \
qobject_cast<KIO::StoredTransferJob*>(job); + Q_ASSERT(transferJob);
+
+ if (m_imageCollection) {
+ m_data = m_imageCollection->createImageData(transferJob->data());
+ }
+ emit recalcPreview();
+}
+
+void ParagraphBulletsNumbersTab::setFontSize(const KoCharacterStyle *style)
+{
+ m_fontSize = style->fontPointSize();
+}
+
+#include <ParagraphBulletsNumbersTab.moc>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.h new file mode \
100644 index 0000000..2e7a582
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.h
@@ -0,0 +1,76 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007, 2010 Thomas Zander <zander@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PARAGRAPHBULLETSNUMBERSTAB_H
+#define PARAGRAPHBULLETSNUMBERSTAB_H
+
+#include <ui_ParagraphBulletsNumbersTab.h>
+#include <ListItemsHelper.h>
+
+#include <KoListStyle.h>
+
+#include <QWidget>
+
+class KoParagraphStyle;
+class KoCharacterStyle;
+class KoImageCollection;
+class KJob;
+class KoImageData;
+
+class ParagraphBulletsNumbersTab : public QWidget
+{
+ Q_OBJECT
+public:
+ ParagraphBulletsNumbersTab(QWidget *parent = 0);
+
+ void setDisplay(KoParagraphStyle *style, int level = 0);
+
+ void save(KoParagraphStyle *style);
+
+ int addStyle(const Lists::ListStyleItem &lsi);
+
+ void setImageCollection(KoImageCollection *imageCollection);
+
+signals:
+ void parStyleChanged();
+
+public slots:
+ void setFontSize(const KoCharacterStyle *style);
+
+private slots:
+ void styleChanged(int);
+ void customCharButtonPressed();
+ void recalcPreview();
+ void labelFollowedByIndexChanged(int);
+ void selectListImage();
+ void setImageData(KJob *job);
+
+private:
+ Ui::ParagraphBulletsNumbersTab widget;
+
+ QHash<int, KoListStyle::Style> m_mapping;
+ int m_previousLevel;
+ int m_blankCharIndex;
+ bool m_alignmentMode;
+ KoImageCollection *m_imageCollection;
+ KoImageData *m_data;
+ int m_fontSize;
+};
+
+#endif
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.ui \
b/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.ui new file mode \
100644 index 0000000..4104a6d
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphBulletsNumbersTab.ui
@@ -0,0 +1,317 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ParagraphBulletsNumbersTab</class>
+ <widget class="QWidget" name="ParagraphBulletsNumbersTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>453</width>
+ <height>386</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QListWidget" name="listTypes"/>
+ </item>
+ <item row="0" column="1">
+ <widget class="QWidget" name="listPropertiesPane" native="true">
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0" colspan="3">
+ <layout class="QGridLayout">
+ <item row="0" column="3">
+ <widget class="QLineEdit" name="suffix"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Start at:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>startValue</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="ListsSpinBox" name="startValue">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>9999</number>
+ </property>
+ <property name="value">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Alignment:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>alignment</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Prefix:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>prefix</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QLineEdit" name="prefix"/>
+ </item>
+ <item row="0" column="2">
+ <widget class="QLabel" name="label_5">
+ <property name="text">
+ <string>Suffix:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>suffix</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="3">
+ <widget class="QComboBox" name="labelFollowedBy"/>
+ </item>
+ <item row="1" column="3">
+ <widget class="QComboBox" name="alignment"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Depth:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>depth</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="QSpinBox" name="depth">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>10</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2">
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Display Levels:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>levels</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="3">
+ <widget class="QSpinBox" name="levels">
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>Bullet/Number followed by</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="3">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox">
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="2">
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>at</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_2">
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Aligned at</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="3">
+ <widget class="QDoubleSpinBox" name="doubleSpinBox_3">
+ <property name="suffix">
+ <string> cm</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="2">
+ <widget class="QLabel" name="label_11">
+ <property name="text">
+ <string>Indented at</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Custom character:</string>
+ </property>
+ <property name="buddy">
+ <cstring>customCharacter</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QToolButton" name="customCharacter">
+ <property name="text">
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>251</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="13" column="0" colspan="3">
+ <widget class="QCheckBox" name="restartNumbering">
+ <property name="text">
+ <string>Restart numbering at this paragraph</string>
+ </property>
+ </widget>
+ </item>
+ <item row="14" column="0" colspan="3">
+ <widget class="QCheckBox" name="letterSynchronization">
+ <property name="text">
+ <string>Letter Synchronization</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3">
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="1" column="0">
+ <widget class="QLabel" name="widthLabel">
+ <property name="text">
+ <string>Width</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="insertImageLabel">
+ <property name="text">
+ <string>Insert Image</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="QDoubleSpinBox" name="imageWidth"/>
+ </item>
+ <item row="1" column="2">
+ <widget class="QLabel" name="heightLabel">
+ <property name="text">
+ <string>Height</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="3">
+ <widget class="QDoubleSpinBox" name="imageHeight"/>
+ </item>
+ <item row="0" column="1">
+ <widget class="QPushButton" name="insertImage">
+ <property name="text">
+ <string>Browse...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="15" column="0" colspan="3">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ListsSpinBox</class>
+ <extends>QSpinBox</extends>
+ <header>dialogs/ListsSpinBox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.cpp new file mode \
100644 index 0000000..ea30a5c
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.cpp
@@ -0,0 +1,69 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001, 2002 Montel Laurent <lmontel@mandrakesoft.com>
+ Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "ParagraphDecorationsTab.h"
+
+#include <KDebug>
+
+ParagraphDecorationsTab::ParagraphDecorationsTab(QWidget* parent)
+ : QWidget(parent)
+{
+ widget.setupUi(this);
+
+ connect(widget.backgroundColor, SIGNAL(changed(const QColor&)), this, \
SLOT(slotBackgroundColorChanged())); + connect(widget.resetBackgroundColor, \
SIGNAL(clicked()), this, SLOT(clearBackgroundColor())); +}
+
+void ParagraphDecorationsTab::slotBackgroundColorChanged()
+{
+ m_backgroundColorReset = false; m_backgroundColorChanged = true;
+ emit parStyleChanged();
+}
+
+void ParagraphDecorationsTab::setDisplay(KoParagraphStyle *style)
+{
+ m_backgroundColorChanged = false;
+ m_backgroundColorReset = style->background().style() == Qt::NoBrush;
+ if (m_backgroundColorReset) {
+ clearBackgroundColor();
+ } else {
+ widget.backgroundColor->setColor(style->background().color());
+ }
+}
+
+void ParagraphDecorationsTab::save(KoParagraphStyle *style) const
+{
+ Q_ASSERT(style);
+ if (m_backgroundColorReset)
+ // clearing the property doesn't work since ParagraphSettingsDialog does a \
mergeBlockFormat + // so we'll set it to a Qt::NoBrush brush instead
+ style->setBackground(QBrush(Qt::NoBrush));
+ else if (m_backgroundColorChanged)
+ style->setBackground(QBrush(widget.backgroundColor->color()));
+}
+
+void ParagraphDecorationsTab::clearBackgroundColor()
+{
+ widget.backgroundColor->setColor(widget.backgroundColor->defaultColor());
+ m_backgroundColorReset = true;
+ emit parStyleChanged();
+}
+
+#include <ParagraphDecorationsTab.moc>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.h new file mode \
100644 index 0000000..2f6131f
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.h
@@ -0,0 +1,52 @@
+/* This file is part of the KDE project
+ Copyright (C) 2001,2002,2003 Montel Laurent <lmontel@mandrakesoft.com>
+ Copyright (C) 2006-2007 Thomas Zander <zander@kde.org>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef FONTDECORATIONSTAB_H
+#define FONTDECORATIONSTAB_H
+
+#include <ui_ParagraphDecorationsTab.h>
+
+#include <KoParagraphStyle.h>
+
+class ParagraphDecorationsTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit ParagraphDecorationsTab(QWidget* parent = 0);
+ ~ParagraphDecorationsTab() {}
+
+ void setDisplay(KoParagraphStyle *style);
+ void save(KoParagraphStyle *style) const;
+
+signals:
+ void parStyleChanged();
+
+private slots:
+ void clearBackgroundColor();
+ void slotBackgroundColorChanged();
+
+private:
+ Ui::ParagraphDecorationsTab widget;
+
+ bool m_backgroundColorChanged, m_backgroundColorReset;
+};
+
+#endif
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.ui \
b/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.ui new file mode \
100644 index 0000000..d82e31d
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphDecorationsTab.ui
@@ -0,0 +1,123 @@
+<ui version="4.0" >
+ <class>ParagraphDecorationsTab</class>
+ <widget class="QWidget" name="ParagraphDecorationsTab" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>437</width>
+ <height>271</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <item>
+ <widget class="QGroupBox" name="groupBox" >
+ <property name="title" >
+ <string>Background</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>9</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>9</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>9</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>6</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>6</number>
+ </property>
+ <item row="0" column="2" >
+ <widget class="QToolButton" name="resetBackgroundColor" >
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="KColorButton" native="1" name="backgroundColor" />
+ </item>
+ <item row="0" column="0" >
+ <widget class="QLabel" name="backgroundColorLabel" >
+ <property name="text" >
+ <string>Background color</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>false</bool>
+ </property>
+ <property name="buddy" >
+ <cstring>backgroundColor</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="3" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <layoutdefault spacing="6" margin="11" />
+ <customwidgets>
+ <customwidget>
+ <class>KColorButton</class>
+ <extends>QWidget</extends>
+ <header>kcolorbutton.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <includes>
+ <include location="local" >knuminput.h</include>
+ <include location="local" >kcolorbutton.h</include>
+ <include location="local" >kpushbutton.h</include>
+ </includes>
+ <resources>
+ </resources>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.cpp new file mode \
100644 index 0000000..0d1b1fd
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.cpp
@@ -0,0 +1,124 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
+ Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#include "ParagraphDropCapsTab.h"
+
+#include "KoParagraphStyle.h"
+#include <QMessageBox>
+
+ParagraphDropCapsTab::ParagraphDropCapsTab(QWidget *parent) :
+ QWidget(parent)
+{
+ widget.setupUi(this);
+
+ widget.distance->changeValue(0);
+ widget.characters->setSpecialValueText(i18n("Whole Word"));
+ widget.characters->setValue(0);
+ widget.lines->setValue(2);
+
+ connect(widget.capsState, SIGNAL(stateChanged(int)), this, \
SLOT(dropCapsStateChanged())); + connect(widget.distance, \
SIGNAL(valueChangedPt(qreal)), this, SLOT(paragraphDistanceChanged(qreal))); + \
connect(widget.characters, SIGNAL(valueChanged(int)), this, \
SLOT(dropedCharacterCountChanged(int))); + connect(widget.lines, \
SIGNAL(valueChanged(int)), this, SLOT(dropsLineSpanChanged(int))); +}
+
+void ParagraphDropCapsTab::dropCapsStateChanged()
+{
+ if (widget.capsState->isChecked()) {
+ widget.setting->setEnabled(true);
+ m_dropCapsInherited = false;
+ }
+ else {
+ widget.setting->setEnabled(false);
+ }
+ emit parStyleChanged();
+}
+
+void ParagraphDropCapsTab::setDisplay(KoParagraphStyle *style)
+{
+ if (!style)
+ return;
+ if (!style->dropCaps()) {
+ widget.setting->setEnabled(false);
+ return;
+ }
+
+ widget.capsState->setChecked(true);
+ widget.distance->changeValue(style->dropCapsDistance());
+ widget.characters->setValue(style->dropCapsLength());
+ widget.lines->setValue(style->dropCapsLines());
+
+ m_dropCapsInherited = !style->hasProperty(KoParagraphStyle::DropCaps);
+ m_capsDistanceInherited = \
!style->hasProperty(KoParagraphStyle::DropCapsDistance); + m_capsLengthInherited = \
!style->hasProperty(KoParagraphStyle::DropCapsLength); + m_capsLinesInherited = \
!style->hasProperty(KoParagraphStyle::DropCapsLines); +}
+
+void ParagraphDropCapsTab::save(KoParagraphStyle *style)
+{
+ if (!style)
+ return;
+
+ if (!m_dropCapsInherited) {
+ style->setDropCaps(widget.capsState->isChecked());
+ }
+
+ if (!m_capsDistanceInherited) {
+ style->setDropCapsDistance(widget.distance->value());
+ }
+
+ if (!m_capsLengthInherited) {
+ style->setDropCapsLength(widget.characters->value());
+ }
+
+ if (!m_capsLinesInherited) {
+ style->setDropCapsLines(widget.lines->value());
+ }
+}
+
+void ParagraphDropCapsTab::setUnit(const KoUnit &unit)
+{
+ widget.distance->setUnit(unit);
+}
+
+void ParagraphDropCapsTab::paragraphDistanceChanged(qreal distance)
+{
+ Q_UNUSED(distance);
+ m_capsDistanceInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphDropCapsTab::dropsLineSpanChanged(int lineSpan)
+{
+ Q_UNUSED(lineSpan);
+ m_capsLinesInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphDropCapsTab::dropedCharacterCountChanged(int count)
+{
+ Q_UNUSED(count);
+ m_capsLengthInherited = false;
+ emit parStyleChanged();
+}
+
+#include "ParagraphDropCapsTab.moc"
+
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.h new file mode 100644
index 0000000..144bbad
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.h
@@ -0,0 +1,65 @@
+/* This file is part of the KDE project
+
+ Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
+ Copyright (C) 2012 Gopalakrishna Bhat A <gopalakbhat@gmail.com>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PARAGRAPHDROPCAPSTAB_H
+#define PARAGRAPHDROPCAPSTAB_H
+#include "ui_ParagraphDropCapsTab.h"
+
+#include "KoUnit.h"
+#include <QWidget>
+
+class KoParagraphStyle;
+
+namespace Ui {
+ class ParagraphDropCapsTab;
+}
+
+class ParagraphDropCapsTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ ParagraphDropCapsTab(QWidget *parent = 0);
+
+ void setDisplay(KoParagraphStyle *style);
+ void save(KoParagraphStyle *style);
+
+ void setUnit(const KoUnit &unit);
+
+signals:
+ void parStyleChanged();
+
+private slots:
+ void dropCapsStateChanged();
+ void paragraphDistanceChanged(qreal distance);
+ void dropsLineSpanChanged(int lineSpan);
+ void dropedCharacterCountChanged(int count);
+
+private:
+ Ui::ParagraphDropCapsTab widget;
+
+ bool m_dropCapsInherited;
+ bool m_capsDistanceInherited;
+ bool m_capsLengthInherited;
+ bool m_capsLinesInherited;
+};
+
+#endif // PARAGRAPHDROPCAPSTAB_H
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.ui \
b/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.ui new file mode 100644
index 0000000..abdf44f
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphDropCapsTab.ui
@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ParagraphDropCapsTab</class>
+ <widget class="QWidget" name="ParagraphDropCapsTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>368</width>
+ <height>318</height>
+ </rect>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>368</width>
+ <height>318</height>
+ </size>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="2" column="0">
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>144</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="0" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Drop caps:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="capsState">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>118</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0">
+ <widget class="QWidget" name="setting" native="true">
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QLabel" name="label_2">
+ <property name="text">
+ <string>Distance to paragraph:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Number of characters:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4">
+ <property name="text">
+ <string>Number of lines it covers:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="KoUnitDoubleSpinBox" name="distance"/>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="characters">
+ <property name="wrapping">
+ <bool>false</bool>
+ </property>
+ <property name="minimum">
+ <number>0</number>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="lines">
+ <property name="minimum">
+ <number>2</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KoUnitDoubleSpinBox</class>
+ <extends>QDoubleSpinBox</extends>
+ <header>KoUnitDoubleSpinBox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.cpp new file mode \
100644 index 0000000..3b4cf1a
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.cpp
@@ -0,0 +1,290 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007, 2009 Thomas Zander <zander@kde.org>
+ * Copyright (c) 2003 David Faure <faure@kde.org>
+ * Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParagraphIndentSpacingTab.h"
+
+#include <KoParagraphStyle.h>
+#include <KDebug>
+
+ParagraphIndentSpacingTab::ParagraphIndentSpacingTab(QWidget *parent)
+ : QWidget(parent),
+ m_fontMetricsChecked(false)
+{
+ widget.setupUi(this);
+
+ connect(widget.first, SIGNAL(valueChangedPt(qreal)), this, \
SLOT(firstLineMarginChanged(qreal))); + connect(widget.left, \
SIGNAL(valueChangedPt(qreal)), this, SLOT(leftMarginChanged(qreal))); + \
connect(widget.right, SIGNAL(valueChangedPt(qreal)), this, \
SLOT(rightMarginChanged(qreal))); +
+ // Keep order in sync with lineSpacingType() and display()
+ widget.lineSpacing->addItem(i18nc("Line spacing value", "Single"));
+ widget.lineSpacing->addItem(i18nc("Line spacing value", "1.5 Lines"));
+ widget.lineSpacing->addItem(i18nc("Line spacing value", "Double"));
+ widget.lineSpacing->addItem(i18nc("Line spacing type", "Proportional")); // \
called Proportional like in OO + widget.lineSpacing->addItem(i18nc("Line spacing \
type", "Additional")); // normal distance + absolute value + \
widget.lineSpacing->addItem(i18nc("Line spacing type", "Fixed")); + \
widget.lineSpacing->addItem(i18nc("Line spacing type", "At least")); +
+ connect(widget.first, SIGNAL(valueChangedPt(qreal)), this, \
SLOT(firstIndentValueChanged())); + connect(widget.left, \
SIGNAL(valueChangedPt(qreal)), this, SLOT(leftMarginValueChanged())); + \
connect(widget.right, SIGNAL(valueChangedPt(qreal)), this, \
SLOT(rightMarginValueChanged())); + connect(widget.after, \
SIGNAL(valueChangedPt(qreal)), this, SLOT(bottomMarginValueChanged())); + \
connect(widget.before, SIGNAL(valueChangedPt(qreal)), this, \
SLOT(topMarginValueChanged())); + connect(widget.lineSpacing, \
SIGNAL(currentIndexChanged(int)), this, SLOT(lineSpacingChanged(int))); + \
connect(widget.useFont, SIGNAL(toggled(bool)), this, SLOT(useFontMetrices(bool))); + \
connect(widget.autoTextIndent, SIGNAL(stateChanged(int)), this, \
SLOT(autoTextIndentChanged(int))); + connect(widget.proportional, \
SIGNAL(valueChanged(int)), this, SLOT(spacingPercentChanged(int))); + \
connect(widget.custom, SIGNAL(valueChangedPt(qreal)), this, \
SLOT(spacingValueChanged(qreal))); + lineSpacingChanged(0);
+}
+
+void ParagraphIndentSpacingTab::autoTextIndentChanged(int state)
+{
+ widget.first->setEnabled(state == Qt::Unchecked);
+ m_autoTextIndentInherited = false;
+ emit parStyleChanged();
+}
+void ParagraphIndentSpacingTab::firstIndentValueChanged()
+{
+ m_textIndentInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::rightMarginValueChanged()
+{
+ m_rightMarginIngerited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::leftMarginValueChanged()
+{
+ m_leftMarginInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::topMarginValueChanged()
+{
+ m_topMarginInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::bottomMarginValueChanged()
+{
+ m_bottomMarginInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::setDisplay(KoParagraphStyle *style)
+{
+ m_style = style;
+ // TODO : handle relatives
+ widget.first->changeValue(style->textIndent());
+ widget.left->changeValue(style->leftMargin());
+ widget.right->changeValue(style->rightMargin());
+ widget.before->changeValue(style->topMargin());
+ widget.after->changeValue(style->bottomMargin());
+
+ m_rightMarginIngerited = !style->hasProperty(QTextFormat::BlockRightMargin);
+ m_leftMarginInherited = !style->hasProperty(QTextFormat::BlockLeftMargin);
+ m_topMarginInherited = !style->hasProperty(QTextFormat::BlockTopMargin);
+ m_bottomMarginInherited = !style->hasProperty(QTextFormat::BlockBottomMargin);
+ m_autoTextIndentInherited = \
!style->hasProperty(KoParagraphStyle::AutoTextIndent); + m_textIndentInherited = \
!style->hasProperty(QTextFormat::TextIndent); +
+ widget.autoTextIndent->setChecked(style->autoTextIndent());
+
+ m_spacingInherited = !(style->hasProperty(KoParagraphStyle::FixedLineHeight) || \
style->hasProperty(KoParagraphStyle::LineSpacing) || \
style->hasProperty(KoParagraphStyle::PercentLineHeight) \
||style->hasProperty(KoParagraphStyle::MinimumLineHeight)); +
+ int index;
+ if (style->hasProperty(KoParagraphStyle::FixedLineHeight) && \
style->lineHeightAbsolute() != 0) { + // this is the strongest; if this is set \
we don't care what other properties there are. + index = 5;
+ } else if (style->hasProperty(KoParagraphStyle::LineSpacing) && \
style->lineSpacing() != 0) { + // if LineSpacing is set then percent is \
ignored. + index = 4;
+ } else if (style->hasProperty(KoParagraphStyle::PercentLineHeight) && \
style->lineHeightPercent() != 0) { + int percent = style->lineHeightPercent();
+ if (percent == 120)
+ index = 0; // single
+ else if (percent == 180)
+ index = 1; // 1.5
+ else if (percent == 240)
+ index = 2; // double
+ else
+ index = 3; // proportional
+ } else if (style->hasProperty(KoParagraphStyle::MinimumLineHeight) && \
style->minimumLineHeight() != 0) { + index = 6;
+ } else {
+ index = 0; // nothing set, default is 'single' just like for geeks.
+ }
+ widget.lineSpacing->setCurrentIndex(index);
+ //widget.minimumLineSpacing->changeValue(style->minimumLineHeight());
+ widget.useFont->setChecked(style->lineSpacingFromFont());
+ m_fontMetricsChecked = style->lineSpacingFromFont();
+}
+
+void ParagraphIndentSpacingTab::lineSpacingChanged(int row)
+{
+ bool percent = false, custom = false;
+ qreal customValue = 0.0;
+ switch (row) {
+ case 0:
+ case 1:
+ case 2:
+ break;
+ case 3: // proportional
+ percent = true;
+ widget.proportional->setValue(m_style->lineHeightPercent());
+ break;
+ case 4: // additional
+ custom = true;
+ customValue = qMax(qreal(0.1), m_style->lineSpacing());
+ break;
+ case 5: // fixed
+ custom = true;
+ if (m_style->lineHeightAbsolute() == 0) // unset
+ customValue = 12.0; // nice default value...
+ else
+ customValue = m_style->lineHeightAbsolute();
+ break;
+ case 6: // minimum
+ custom = true;
+ customValue = m_style->minimumLineHeight();
+ break;
+ default:; // other cases don't need the spinboxes
+ }
+
+ m_spacingInherited = false;
+
+ if (custom) {
+ widget.custom->setEnabled(true);
+ widget.spacingStack->setCurrentWidget(widget.unitsPage);
+ widget.custom->changeValue(customValue);
+ } else {
+ widget.spacingStack->setCurrentWidget(widget.percentPage);
+ widget.proportional->setEnabled(percent);
+ if (! percent)
+ widget.proportional->setValue(100);
+ }
+
+ widget.useFont->setEnabled(row != 5);
+ widget.useFont->setChecked(row == 5 ? false : m_fontMetricsChecked);
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::spacingPercentChanged(int percent)
+{
+ m_spacingInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::spacingValueChanged(qreal value)
+{
+ m_spacingInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::save(KoParagraphStyle *style)
+{
+ // general note; we have to unset values by setting it to zero instead of \
removing the item + // since this dialog may be used on a copy style, which will \
be applied later. And removing + // items doesn't work for that.
+ if (!m_textIndentInherited){
+ style->setTextIndent(QTextLength(QTextLength::FixedLength, \
widget.first->value())); + }
+ if (!m_leftMarginInherited){
+ style->setLeftMargin(QTextLength(QTextLength::FixedLength, \
widget.left->value())); + }
+ if (!m_rightMarginIngerited){
+ style->setRightMargin(QTextLength(QTextLength::FixedLength, \
widget.right->value())); + }
+ if (!m_topMarginInherited){
+ style->setTopMargin(QTextLength(QTextLength::FixedLength, \
widget.before->value())); + }
+ if (!m_bottomMarginInherited){
+ style->setBottomMargin(QTextLength(QTextLength::FixedLength, \
widget.after->value())); + }
+ if (!m_autoTextIndentInherited){
+ style->setAutoTextIndent(widget.autoTextIndent->isChecked());
+ }
+ if (!m_spacingInherited) {
+ style->setLineHeightAbsolute(0); // since it trumps percentage based line \
heights, unset it. + \
style->setMinimumLineHeight(QTextLength(QTextLength::FixedLength, 0)); + \
style->setLineSpacing(0); + switch (widget.lineSpacing->currentIndex()) {
+ case 0: style->setLineHeightPercent(120); break;
+ case 1: style->setLineHeightPercent(180); break;
+ case 2: style->setLineHeightPercent(240); break;
+ case 3: style->setLineHeightPercent(widget.proportional->value()); break;
+ case 4:
+ if (widget.custom->value() == 0.0) { // then we need to save it \
differently. + style->setLineHeightPercent(100);
+ } else {
+ style->setLineSpacing(widget.custom->value());
+ }
+ break;
+ case 5:
+ style->setLineHeightAbsolute(widget.custom->value());
+ break;
+ case 6:
+ style->setMinimumLineHeight(QTextLength(QTextLength::FixedLength, \
widget.custom->value())); + break;
+ }
+ style->setLineSpacingFromFont(widget.lineSpacing->currentIndex() != 5 && \
widget.useFont->isChecked()); + }
+}
+
+void ParagraphIndentSpacingTab::setUnit(const KoUnit &unit)
+{
+ widget.first->setUnit(unit);
+ widget.left->setUnit(unit);
+ widget.right->setUnit(unit);
+ widget.before->setUnit(unit);
+ widget.after->setUnit(unit);
+ widget.custom->setUnit(unit);
+}
+
+void ParagraphIndentSpacingTab::useFontMetrices(bool on)
+{
+ if (widget.lineSpacing->currentIndex() != 5)
+ m_fontMetricsChecked = on;
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::firstLineMarginChanged(qreal margin)
+{
+ Q_UNUSED(margin);
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::leftMarginChanged(qreal margin)
+{
+ Q_UNUSED(margin);
+ emit parStyleChanged();
+}
+
+void ParagraphIndentSpacingTab::rightMarginChanged(qreal margin)
+{
+ Q_UNUSED(margin);
+ emit parStyleChanged();
+}
+
+#include <ParagraphIndentSpacingTab.moc>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.h new file mode \
100644 index 0000000..18f02fb
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.h
@@ -0,0 +1,75 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Thomas Zander <zander@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PARAGRAPHINDENTSPACINGTAB_H
+#define PARAGRAPHINDENTSPACINGTAB_H
+
+#include <ui_ParagraphIndentSpacingTab.h>
+
+#include <KoUnit.h>
+
+#include <QWidget>
+
+class KoParagraphStyle;
+
+class ParagraphIndentSpacingTab : public QWidget
+{
+ Q_OBJECT
+public:
+ ParagraphIndentSpacingTab(QWidget *parent = 0);
+ // open and display the style
+ void setDisplay(KoParagraphStyle *style);
+ void setUnit(const KoUnit &unit);
+
+ // save widget state to style
+ void save(KoParagraphStyle *style);
+
+signals:
+ void parStyleChanged();
+
+private slots:
+ void lineSpacingChanged(int);
+ void spacingValueChanged(qreal value);
+ void spacingPercentChanged(int percent);
+ void useFontMetrices(bool);
+ void autoTextIndentChanged(int state);
+ void firstIndentValueChanged();
+ void leftMarginValueChanged();
+ void rightMarginValueChanged();
+ void bottomMarginValueChanged();
+ void topMarginValueChanged();
+ void firstLineMarginChanged(qreal margin);
+ void leftMarginChanged(qreal margin);
+ void rightMarginChanged(qreal margin);
+
+private:
+ Ui::ParagraphIndentSpacingTab widget;
+
+ KoParagraphStyle *m_style;
+ bool m_fontMetricsChecked;
+ bool m_rightMarginIngerited;
+ bool m_leftMarginInherited;
+ bool m_topMarginInherited;
+ bool m_bottomMarginInherited;
+ bool m_textIndentInherited;
+ bool m_autoTextIndentInherited;
+ bool m_spacingInherited;
+};
+
+#endif
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.ui \
b/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.ui new file mode \
100644 index 0000000..288e306
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphIndentSpacingTab.ui
@@ -0,0 +1,258 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ParagraphIndentSpacingTab</class>
+ <widget class="QWidget" name="ParagraphIndentSpacingTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>449</width>
+ <height>412</height>
+ </rect>
+ </property>
+ <property name="whatsThis">
+ <string><p><ul><li><b>Single</b>: The normal \
linespacing</li></ul></p> </string> + </property>
+ <layout class="QGridLayout">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Indent</string>
+ </property>
+ <layout class="QGridLayout" columnstretch="0,0,1">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Left:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>left</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KoUnitDoubleSpinBox" name="left"/>
+ </item>
+ <item row="0" column="2" rowspan="2">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Right:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>right</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KoUnitDoubleSpinBox" name="right"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>First Line:</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+ </property>
+ <property name="buddy">
+ <cstring>first</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1">
+ <widget class="KoUnitDoubleSpinBox" name="first"/>
+ </item>
+ <item row="2" column="2">
+ <widget class="QCheckBox" name="autoTextIndent">
+ <property name="text">
+ <string>Auto-infer from text size</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="whatsThis">
+ <string><p><ul><li><b>Single</b>: The normal \
linespacing</li></ul></p> </string> + </property>
+ <property name="title">
+ <string>Line Spacing</string>
+ </property>
+ <layout class="QVBoxLayout">
+ <item>
+ <layout class="QHBoxLayout" stretch="0,0,1">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QComboBox" name="lineSpacing"/>
+ </item>
+ <item>
+ <widget class="QStackedWidget" name="spacingStack">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="unitsPage">
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="KoUnitDoubleSpinBox" name="custom"/>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="percentPage">
+ <layout class="QHBoxLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QSpinBox" name="proportional">
+ <property name="suffix">
+ <string> %</string>
+ </property>
+ <property name="minimum">
+ <number>85</number>
+ </property>
+ <property name="maximum">
+ <number>999</number>
+ </property>
+ <property name="singleStep">
+ <number>5</number>
+ </property>
+ <property name="value">
+ <number>100</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QFormLayout">
+ <property name="fieldGrowthPolicy">
+ <enum>QFormLayout::ExpandingFieldsGrow</enum>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Use Font Metrics:</string>
+ </property>
+ <property name="buddy">
+ <cstring>useFont</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="useFont">
+ <property name="text">
+ <string/>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Paragraph Space</string>
+ </property>
+ <layout class="QFormLayout">
+ <item row="0" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Before:</string>
+ </property>
+ <property name="buddy">
+ <cstring>before</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="KoUnitDoubleSpinBox" name="before"/>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>After:</string>
+ </property>
+ <property name="buddy">
+ <cstring>after</cstring>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1">
+ <widget class="KoUnitDoubleSpinBox" name="after"/>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>313</width>
+ <height>16</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KoUnitDoubleSpinBox</class>
+ <extends>QDoubleSpinBox</extends>
+ <header>KoUnitDoubleSpinBox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.cpp new file mode 100644
index 0000000..e2a4179
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.cpp
@@ -0,0 +1,131 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Thomas Zander <zander@kde.org>
+ * Copyright (C) 2011 Mojtaba Shahi Senobari <mojtaba.shahi3000@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParagraphLayoutTab.h"
+
+#include <KoParagraphStyle.h>
+
+ParagraphLayoutTab::ParagraphLayoutTab(QWidget *parent)
+ : QWidget(parent)
+{
+ widget.setupUi(this);
+
+ connect(widget.right, SIGNAL(toggled(bool)), this, SLOT(slotAlignChanged()));
+ connect(widget.center, SIGNAL(toggled(bool)), this, SLOT(slotAlignChanged()));
+ connect(widget.justify, SIGNAL(toggled(bool)), this, SLOT(slotAlignChanged()));
+ connect(widget.left, SIGNAL(toggled(bool)), this, SLOT(slotAlignChanged()));
+ connect(widget.breakAfter, SIGNAL(stateChanged(int)), this, \
SLOT(breakAfterChanged())); + connect(widget.breakBefore, \
SIGNAL(stateChanged(int)), this, SLOT(breakBeforeChanged())); + \
connect(widget.threshold, SIGNAL(valueChanged(int)), this, \
SLOT(thresholdValueChanged())); +}
+
+void ParagraphLayoutTab::slotAlignChanged()
+{
+ Qt::Alignment align;
+ if (widget.right->isChecked())
+ align = Qt::AlignRight;
+ else if (widget.center->isChecked())
+ align = Qt::AlignHCenter;
+ else if (widget.justify->isChecked())
+ align = Qt::AlignJustify;
+ else
+ align = Qt::AlignLeft;
+
+ m_alignmentInherited = false;
+
+ emit parStyleChanged();
+}
+
+void ParagraphLayoutTab::breakAfterChanged()
+{
+ m_breakAfterInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphLayoutTab::breakBeforeChanged()
+{
+ m_breakBeforeInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphLayoutTab::thresholdValueChanged()
+{
+ m_orphanThresholdInherited = false;
+ emit parStyleChanged();
+}
+
+void ParagraphLayoutTab::setDisplay(KoParagraphStyle *style)
+{
+ switch (style->alignment()) {
+ case Qt::AlignRight: widget.right->setChecked(true); break;
+ case Qt::AlignHCenter: widget.center->setChecked(true); break;
+ case Qt::AlignJustify: widget.justify->setChecked(true); break;
+ case Qt::AlignLeft:
+ default:
+ widget.left->setChecked(true); break;
+ }
+
+ m_alignmentInherited = !style->hasProperty(QTextFormat::BlockAlignment);
+ m_breakAfterInherited = !style->hasProperty(KoParagraphStyle::BreakAfter);
+ m_breakBeforeInherited = !style->hasProperty(KoParagraphStyle::BreakBefore);
+ m_orphanThresholdInherited = \
!style->hasProperty(KoParagraphStyle::OrphanThreshold); +
+ widget.keepTogether->setChecked(style->nonBreakableLines());
+ widget.breakBefore->setChecked(style->breakBefore());
+ widget.breakAfter->setChecked(style->breakAfter());
+
+ widget.threshold->setValue(style->orphanThreshold());
+}
+
+void ParagraphLayoutTab::save(KoParagraphStyle *style)
+{
+ if (!m_alignmentInherited) {
+ Qt::Alignment align;
+ if (widget.right->isChecked())
+ align = Qt::AlignRight;
+ else if (widget.center->isChecked())
+ align = Qt::AlignHCenter;
+ else if (widget.justify->isChecked())
+ align = Qt::AlignJustify;
+ else
+ align = Qt::AlignLeft;
+ style->setAlignment(align);
+ }
+
+ style->setNonBreakableLines(widget.keepTogether->isChecked());
+ if (!m_breakBeforeInherited){
+ if (widget.breakBefore->isChecked())
+ style->setBreakBefore(KoText::PageBreak);
+ else
+ style->setBreakBefore(KoText::NoBreak);
+ }
+ if (!m_breakAfterInherited){
+ if (widget.breakAfter->isChecked())
+ style->setBreakAfter(KoText::PageBreak);
+ else
+ style->setBreakAfter(KoText::NoBreak);
+ }
+
+ if (!m_orphanThresholdInherited) {
+ style->setOrphanThreshold(widget.threshold->value());
+ }
+}
+
+#include <ParagraphLayoutTab.moc>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.h new file mode 100644
index 0000000..f2efd1f
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.h
@@ -0,0 +1,56 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Thomas Zander <zander@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PARAGRAPHLAYOUTTAB_H
+#define PARAGRAPHLAYOUTTAB_H
+
+#include <ui_ParagraphLayoutTab.h>
+
+#include <QWidget>
+
+class KoParagraphStyle;
+
+class ParagraphLayoutTab : public QWidget
+{
+ Q_OBJECT
+public:
+ ParagraphLayoutTab(QWidget *parent = 0);
+
+ void setDisplay(KoParagraphStyle *style);
+
+ void save(KoParagraphStyle *style);
+
+signals:
+ void parStyleChanged();
+
+private slots:
+ void slotAlignChanged();
+ void breakAfterChanged();
+ void breakBeforeChanged();
+ void thresholdValueChanged();
+
+private:
+ Ui::ParagraphLayoutTab widget;
+ bool m_alignmentInherited;
+ bool m_breakAfterInherited;
+ bool m_breakBeforeInherited;
+ bool m_orphanThresholdInherited;
+};
+
+#endif
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.ui \
b/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.ui new file mode 100644
index 0000000..a79ddea
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphLayoutTab.ui
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ParagraphLayoutTab</class>
+ <widget class="QWidget" name="ParagraphLayoutTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>376</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>Alignment</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="0" column="0">
+ <widget class="QRadioButton" name="left">
+ <property name="text">
+ <string>Left</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QRadioButton" name="center">
+ <property name="text">
+ <string>Center</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QRadioButton" name="right">
+ <property name="text">
+ <string>Right</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <widget class="QRadioButton" name="justify">
+ <property name="text">
+ <string>Justify</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="groupBox_2">
+ <property name="title">
+ <string>Behavior at End of Frame/Page</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="keepTogether">
+ <property name="text">
+ <string>Keep lines together</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="breakBefore">
+ <property name="text">
+ <string>Insert break before paragraph</string>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0">
+ <widget class="QCheckBox" name="breakAfter">
+ <property name="text">
+ <string>Insert break after paragraph</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Leave at least this many lines (orphans):</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="threshold"/>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.cpp new file mode \
100644 index 0000000..e6b66e6
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.cpp
@@ -0,0 +1,116 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007, 2010 Thomas Zander <zander@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParagraphSettingsDialog.h"
+
+#include "ParagraphGeneral.h"
+#include "../TextTool.h"
+
+#include <KoParagraphStyle.h>
+#include <KoTextDocument.h>
+#include <KoTextEditor.h>
+#include <KoListLevelProperties.h>
+
+#include <QTextBlock>
+#include <QTimer>
+
+ParagraphSettingsDialog::ParagraphSettingsDialog(TextTool *tool, KoTextEditor \
*editor, QWidget* parent) + : KDialog(parent)
+ , m_tool(tool)
+ , m_editor(editor)
+ , m_styleChanged(false)
+{
+ setCaption(i18n("Paragraph Format"));
+ setModal(true);
+ setButtons(Ok | Cancel | Apply);
+ setDefaultButton(Ok);
+
+ m_paragraphGeneral = new ParagraphGeneral;
+ m_paragraphGeneral->hideStyleName(true);
+ setMainWidget(m_paragraphGeneral);
+
+
+ connect(this, SIGNAL(applyClicked()), this, SLOT(slotApply()));
+ connect(this, SIGNAL(okClicked()), this, SLOT(slotOk()));
+ initTabs();
+
+ // Do this after initTabs so it doesn't cause signals prematurely
+ connect(m_paragraphGeneral, SIGNAL(styleChanged()), this, SLOT(styleChanged()));
+}
+
+ParagraphSettingsDialog::~ParagraphSettingsDialog()
+{
+}
+
+void ParagraphSettingsDialog::initTabs()
+{
+ KoParagraphStyle *style = KoParagraphStyle::fromBlock(m_editor->block());
+ m_paragraphGeneral->setStyle(style, KoList::level(m_editor->block()));
+}
+
+void ParagraphSettingsDialog::styleChanged(bool state)
+{
+ m_styleChanged = state;
+}
+
+void ParagraphSettingsDialog::slotOk()
+{
+ slotApply();
+ KDialog::accept();
+}
+
+void ParagraphSettingsDialog::slotApply()
+{
+ if (!m_styleChanged)
+ return;
+
+ m_editor->beginEditBlock(i18n("Paragraph Settings"));
+ KoParagraphStyle chosenStyle;
+ m_paragraphGeneral->save(&chosenStyle);
+ QTextCharFormat cformat;
+ QTextBlockFormat format;
+ chosenStyle.KoCharacterStyle::applyStyle(cformat);
+ chosenStyle.applyStyle(format);
+
+ m_editor->mergeAutoStyle(cformat, format);
+ if (chosenStyle.listStyle()) {
+ KoTextEditor::ChangeListFlags flags(KoTextEditor::AutoListStyle | \
KoTextEditor::DontUnsetIfSame); + \
m_tool->textEditor()->setListProperties(chosenStyle.listStyle()->levelProperties(chosenStyle.listStyle()->listLevels().first()),
+ flags);
+ } else {
+ QTextList *list = m_editor->block().textList();
+ if (list) { // then remove it.
+ list->remove(m_editor->block());
+ }
+ }
+ m_editor->endEditBlock();
+ m_styleChanged = false;
+}
+
+void ParagraphSettingsDialog::setUnit(const KoUnit &unit)
+{
+ m_paragraphGeneral->setUnit(unit);
+}
+
+void ParagraphSettingsDialog::setImageCollection(KoImageCollection *imageCollection)
+{
+ m_paragraphGeneral->setImageCollection(imageCollection);
+}
+
+#include <ParagraphSettingsDialog.moc>
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.h new file mode \
100644 index 0000000..720077f
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphSettingsDialog.h
@@ -0,0 +1,59 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2007 Thomas Zander <zander@kde.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+#ifndef PARAGRAPHSETTINGSDIALOG_H
+#define PARAGRAPHSETTINGSDIALOG_H
+
+#include <KoUnit.h>
+#include <KoTextEditor.h>
+
+#include <KDialog>
+
+class TextTool;
+class ParagraphGeneral;
+class KoImageCollection;
+
+/// A dialog to show the settings for a paragraph
+class ParagraphSettingsDialog : public KDialog
+{
+ Q_OBJECT
+public:
+ explicit ParagraphSettingsDialog(TextTool *tool, KoTextEditor *editor, QWidget* \
parent = 0); + ~ParagraphSettingsDialog();
+
+ void setUnit(const KoUnit &unit);
+
+ void setImageCollection(KoImageCollection *imageCollection);
+
+protected slots:
+ void styleChanged(bool state = true);
+
+ void slotApply();
+ void slotOk();
+
+private:
+ void initTabs();
+
+ ParagraphGeneral *m_paragraphGeneral;
+ TextTool *m_tool;
+ KoTextEditor *m_editor;
+ bool m_uniqueFormat;
+ bool m_styleChanged;
+};
+
+#endif
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.cpp \
b/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.cpp new file mode 100644
index 0000000..b0ac5a6
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.cpp
@@ -0,0 +1,37 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "ParagraphStylesTab.h"
+#include "ui_ParagraphStylesTab.h"
+
+ParagraphStylesTab::ParagraphStylesTab(QWidget *parent) :
+ QWidget(parent),
+ ui(new Ui::ParagraphStylesTab)
+{
+ ui->setupUi(this);
+
+ ui->characterHighlighting->init(true);
+
+ updateGeometry();
+}
+
+ParagraphStylesTab::~ParagraphStylesTab()
+{
+ delete ui;
+}
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.h \
b/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.h new file mode 100644
index 0000000..e5eb704
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.h
@@ -0,0 +1,41 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PARAGRAPHSTYLESTAB_H
+#define PARAGRAPHSTYLESTAB_H
+
+#include <QWidget>
+
+namespace Ui {
+class ParagraphStylesTab;
+}
+
+class ParagraphStylesTab : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit ParagraphStylesTab(QWidget *parent = 0);
+ ~ParagraphStylesTab();
+
+private:
+ Ui::ParagraphStylesTab *ui;
+};
+
+#endif // PARAGRAPHSTYLESTAB_H
diff --git a/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.ui \
b/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.ui new file mode 100644
index 0000000..c91c717
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/ParagraphStylesTab.ui
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ParagraphStylesTab</class>
+ <widget class="QWidget" name="ParagraphStylesTab">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>883</width>
+ <height>414</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <widget class="QListView" name="paragraphListView"/>
+ </item>
+ <item>
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="documentMode">
+ <bool>true</bool>
+ </property>
+ <widget class="CharacterHighlightingTab" name="characterHighlighting">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Font</string>
+ </attribute>
+ </widget>
+ <widget class="ParagraphIndentSpacingTab" name="indentSpacing">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Indent/Spacing</string>
+ </attribute>
+ </widget>
+ <widget class="ParagraphLayoutTab" name="paragraphLayout">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>GeneralLayout</string>
+ </attribute>
+ </widget>
+ <widget class="ParagraphBulletsNumbersTab" name="bulletNumbers">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Bullet/Numbers</string>
+ </attribute>
+ </widget>
+ <widget class="ParagraphDecorationsTab" name="decorations">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Decorations</string>
+ </attribute>
+ </widget>
+ <widget class="ParagraphDropCapsTab" name="dropCaps">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Drop Caps</string>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>CharacterHighlightingTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/CharacterHighlightingTab.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ParagraphIndentSpacingTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/ParagraphIndentSpacingTab.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ParagraphLayoutTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/ParagraphLayoutTab.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ParagraphBulletsNumbersTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/ParagraphBulletsNumbersTab.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ParagraphDecorationsTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/ParagraphDecorationsTab.h</header>
+ <container>1</container>
+ </customwidget>
+ <customwidget>
+ <class>ParagraphDropCapsTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/ParagraphDropCapsTab.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/plugins/textshape/dialogs/stylemanager/StylesManager.cpp \
b/plugins/textshape/dialogs/stylemanager/StylesManager.cpp new file mode 100644
index 0000000..9395a39
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/StylesManager.cpp
@@ -0,0 +1,33 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "StylesManager.h"
+#include "ui_StylesManager.h"
+
+StylesManager::StylesManager(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::StylesManager)
+{
+ ui->setupUi(this);
+}
+
+StylesManager::~StylesManager()
+{
+ delete ui;
+}
diff --git a/plugins/textshape/dialogs/stylemanager/StylesManager.h \
b/plugins/textshape/dialogs/stylemanager/StylesManager.h new file mode 100644
index 0000000..d9493a9
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/StylesManager.h
@@ -0,0 +1,41 @@
+/* This file is part of the KDE project
+ * Copyright (C) 2012 Pierre Stirnweiss <pstirnweiss@googlemail.org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef STYLESMANAGER_H
+#define STYLESMANAGER_H
+
+#include <QDialog>
+
+namespace Ui {
+class StylesManager;
+}
+
+class StylesManager : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit StylesManager(QWidget *parent = 0);
+ ~StylesManager();
+
+private:
+ Ui::StylesManager *ui;
+};
+
+#endif // STYLESMANAGER_H
diff --git a/plugins/textshape/dialogs/stylemanager/StylesManager.ui \
b/plugins/textshape/dialogs/stylemanager/StylesManager.ui new file mode 100644
index 0000000..3902c37
--- /dev/null
+++ b/plugins/textshape/dialogs/stylemanager/StylesManager.ui
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>StylesManager</class>
+ <widget class="QDialog" name="StylesManager">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>1001</width>
+ <height>441</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTabWidget" name="stylesPages">
+ <property name="tabPosition">
+ <enum>QTabWidget::West</enum>
+ </property>
+ <property name="currentIndex">
+ <number>0</number>
+ </property>
+ <property name="documentMode">
+ <bool>true</bool>
+ </property>
+ <widget class="ParagraphStylesTab" name="paragraphTab">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Paragraph Styles</string>
+ </attribute>
+ </widget>
+ <widget class="QWidget" name="characterStyleTab">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <attribute name="title">
+ <string>Tab 2</string>
+ </attribute>
+ </widget>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="previewArea" native="true"/>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetNoConstraint</enum>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>0</width>
+ <height>0</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>ParagraphStylesTab</class>
+ <extends>QWidget</extends>
+ <header>dialogs/stylemanager/ParagraphStylesTab.h</header>
+ <container>1</container>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>StylesManager</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>StylesManager</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic