SimpleParagraphWidget::SimpleParagraphWidget(TextTool *tool, QWidget *parent)
        : QWidget(parent)
        , m_styleManager(0)
        , m_blockSignals(false)
        , m_tool(tool)
        , m_directionButtonState(Auto)
        , m_thumbnailer(new KoStyleThumbnailer())
        , m_mapper(new QSignalMapper(this))
        , m_stylesModel(new StylesModel(0, StylesModel::ParagraphStyle))
        , m_sortedStylesModel(new DockerStylesComboModel())
        , m_stylesDelegate(0)
{
    widget.setupUi(this);
    widget.alignCenter->setDefaultAction(tool->action("format_aligncenter"));
    widget.alignBlock->setDefaultAction(tool->action("format_alignblock"));
    // RTL layout will reverse the button order, but the align left/right then get mixed up.
    // this makes sure that whatever happens the 'align left' is to the left of the 'align right'
    if (QApplication::isRightToLeft()) {
        widget.alignLeft->setDefaultAction(tool->action("format_alignright"));
        widget.alignRight->setDefaultAction(tool->action("format_alignleft"));
    } else {
        widget.alignLeft->setDefaultAction(tool->action("format_alignleft"));
        widget.alignRight->setDefaultAction(tool->action("format_alignright"));
    }

    widget.decreaseIndent->setDefaultAction(tool->action("format_decreaseindent"));
    widget.increaseIndent->setDefaultAction(tool->action("format_increaseindent"));
    widget.changeTextDirection->setDefaultAction(tool->action("change_text_direction"));

    widget.moreOptions->setText("...");
    widget.moreOptions->setToolTip(i18n("Change paragraph format"));
    connect(widget.moreOptions, SIGNAL(clicked(bool)), tool->action("format_paragraph"), SLOT(trigger()));

    connect(widget.changeTextDirection, SIGNAL(clicked()), this, SIGNAL(doneWithFocus()));
    connect(widget.alignCenter, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.alignBlock, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.alignLeft, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.alignRight, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.decreaseIndent, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.increaseIndent, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));

    widget.bulletListButton->setDefaultAction(tool->action("format_bulletlist"));
    widget.bulletListButton->setNumColumns(3);

    fillListButtons();
    widget.bulletListButton->addSeparator();

    connect(widget.bulletListButton, SIGNAL(itemTriggered(int)), this, SLOT(listStyleChanged(int)));

    m_stylesModel->setStyleThumbnailer(m_thumbnailer);
    widget.paragraphStyleCombo->setStylesModel(m_sortedStylesModel);
    connect(widget.paragraphStyleCombo, SIGNAL(selected(QModelIndex&)), this, SLOT(styleSelected(QModelIndex&)));
    connect(widget.paragraphStyleCombo, SIGNAL(newStyleRequested(QString)), this, SIGNAL(newStyleRequested(QString)));
    connect(widget.paragraphStyleCombo, SIGNAL(newStyleRequested(QString)), this, SIGNAL(doneWithFocus()));
    connect(widget.paragraphStyleCombo, SIGNAL(showStyleManager(int)), this, SLOT(slotShowStyleManager(int)));

    connect(m_mapper, SIGNAL(mapped(int)), this, SLOT(changeListLevel(int)));

    m_sortedStylesModel->setStylesModel(m_stylesModel);
}
SimpleFootEndNotesWidget::SimpleFootEndNotesWidget(TextTool *tool ,QWidget *parent)
        : QWidget(parent)
{
    widget.setupUi(this);
    widget.addFootnote->addAction(tool->action("insert_autofootnote"));
    widget.addFootnote->addAction(tool->action("insert_labeledfootnote"));
    widget.addFootnote->addAction(tool->action("format_footnotes"));
    widget.addFootnote->setIcon(koIcon("insert-footnote"));
    widget.addFootnote->setToolTip(i18n("Inserts a footnote at the current cursor position"));
    widget.addEndnote->addAction(tool->action("insert_autoendnote"));
    widget.addEndnote->addAction(tool->action("insert_labeledendnote"));
    widget.addEndnote->addAction(tool->action("format_endnotes"));
    widget.addEndnote->setIcon(koIcon("insert-endnote"));
    widget.addEndnote->setToolTip(i18n("Inserts an endnote at the current cursor position"));

    connect(widget.addFootnote, SIGNAL(doneWithFocus()), this, SIGNAL(doneWithFocus()));
    connect(widget.addEndnote, SIGNAL(doneWithFocus()), this, SIGNAL(doneWithFocus()));
}
示例#3
0
void StylesWidget::applyCharacterStyle()
{
    QModelIndex index = widget.stylesView->currentIndex();
    Q_ASSERT(index.isValid());
    KoCharacterStyle *characterStyle = m_stylesModel->characterStyleForIndex(index);
    if (characterStyle) {
        emit characterStyleSelected(characterStyle);
        emit doneWithFocus();
        return;
    }
}
示例#4
0
void StylesWidget::applyParagraphStyle()
{
    QModelIndex index = widget.stylesView->currentIndex();
    Q_ASSERT(index.isValid());
    KoParagraphStyle *paragraphStyle = m_stylesModel->paragraphStyleForIndex(index);
    if (paragraphStyle) {
        emit paragraphStyleSelected(paragraphStyle);
        emit doneWithFocus();
        return;
    }
}
示例#5
0
SimpleTableWidget::SimpleTableWidget(TextTool *tool, QWidget *parent)
        : QWidget(parent)
        , m_blockSignals(false)
        , m_tool(tool)
        , m_lastStyleEmitted(2)
{
    widget.setupUi(this);
    widget.addRowAbove->setDefaultAction(tool->action("insert_tablerow_above"));
    widget.addRowBelow->setDefaultAction(tool->action("insert_tablerow_below"));
    widget.addColumnLeft->setDefaultAction(tool->action("insert_tablecolumn_left"));
    widget.addColumnRight->setDefaultAction(tool->action("insert_tablecolumn_right"));
    widget.deleteRow->setDefaultAction(tool->action("delete_tablerow"));
    widget.deleteColumn->setDefaultAction(tool->action("delete_tablecolumn"));
    widget.mergeCells->setDefaultAction(tool->action("merge_tablecells"));
    widget.splitCells->setDefaultAction(tool->action("split_tablecells"));

    connect(tool->action("activate_borderpainter"), SIGNAL(triggered(bool)), this, SLOT(restartPainting()));
    widget.border->setDefaultAction(tool->action("activate_borderpainter"));

    fillBorderButton(QColor(0,0,0));

    KoColorPopupAction *actionBorderColor = new KoColorPopupAction(this);
    actionBorderColor->setIcon(koIcon("format-fill-color"));
    actionBorderColor->setText(i18n("Set Border Color..."));
    widget.border->addAction(actionBorderColor);
    connect(actionBorderColor, SIGNAL(colorChanged(KoColor)), this, SLOT(setBorderColor(KoColor)));

    connect(widget.addRowAbove, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.addRowBelow, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.addColumnLeft, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.addColumnRight, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.deleteRow, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.deleteColumn, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.mergeCells, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.splitCells, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.border, SIGNAL(itemTriggered(int)), this, SLOT(emitTableBorderDataUpdated(int)));
    connect(widget.border, SIGNAL(clicked(bool)), this, SIGNAL(doneWithFocus()));
    connect(widget.border, SIGNAL(doneWithFocus()), this, SIGNAL(doneWithFocus()));
}
示例#6
0
QList<QPointer<QWidget> > ReferencesTool::createOptionWidgets()
{
    QList<QPointer<QWidget> > widgets;
    m_stocw = new SimpleTableOfContentsWidget(this, 0);

    m_sfenw = new SimpleFootEndNotesWidget(this, 0);

    m_scbw = new SimpleCitationBibliographyWidget(this, 0);

    m_slw = new SimpleLinksWidget(this, 0);
    // Connect to/with simple table of contents option widget
    connect(m_stocw, SIGNAL(doneWithFocus()), this, SLOT(returnFocusToCanvas()));

    // Connect to/with simple citation index option widget
    //connect(scw, SIGNAL(doneWithFocus()), this, SLOT(returnFocusToCanvas()));

    // Connect to/with simple citation index option widget
    connect(m_sfenw, SIGNAL(doneWithFocus()), this, SLOT(returnFocusToCanvas()));

    connect(m_slw, SIGNAL(doneWithFocus()), this, SLOT(returnFocusToCanvas()));

    m_stocw->setWindowTitle(i18nc("as in table of contents, list of pictures, index", "Tables, Lists & Indexes"));
    widgets.append(m_stocw);

    m_sfenw->setWindowTitle(i18n("Footnotes and Endnotes"));
    widgets.append(m_sfenw);

    m_scbw->setWindowTitle(i18n("Citations and Bibliography"));
    widgets.append(m_scbw);

    m_slw->setWindowTitle(i18n("Links and Bookmarks"));
    widgets.append(m_slw);
    //widgets.insert(i18n("Captions"), scapw);
    connect(textEditor(), SIGNAL(cursorPositionChanged()), this, SLOT(updateButtons()));
    return widgets;
}
示例#7
0
QList<QPointer<QWidget> > ReviewTool::createOptionWidgets()
{
    QList<QPointer<QWidget> > widgets;
    SimpleSpellCheckingWidget* sscw = new SimpleSpellCheckingWidget(this, 0);
    SimpleAnnotationWidget *saw = new SimpleAnnotationWidget(this, 0);

    connect(saw, SIGNAL(doneWithFocus()), this, SLOT(returnFocusToCanvas()));

    sscw->setWindowTitle(i18n("Spell check"));
    widgets.append(sscw);

    saw->setWindowTitle(i18n("Comments"));
    widgets.append(saw);

    return widgets;
}
void ChangeTrackingOptionsWidget::configureSettingsPressed()
{
    m_tool->configureChangeTracking();
    emit doneWithFocus();
}
void ChangeTrackingOptionsWidget::showChangesChanged(int isChecked)
{
    m_tool->toggleShowChanges(isChecked);
    emit doneWithFocus();
}