void PropertyWidget_ParEffect::handleParEffectUse() { if (!m_doc || !m_item) return; ParagraphStyle newStyle; enableParEffect(peCombo->currentIndex() != 0); if (peCombo->currentIndex() == 1) { enableDropCap(true); newStyle.setDropCapLines(dropCapLines->value()); newStyle.setHasDropCap(true); newStyle.setHasBullet(false); newStyle.setHasNum(false); } else if (peCombo->currentIndex() == 2) { enableBullet(true); newStyle.setHasBullet(true); QString bStr = bulletStrEdit->currentText(); if (bStr.isEmpty()) bStr = QChar(0x2022); newStyle.setBulletStr(bStr); newStyle.setHasNum(false); newStyle.setHasDropCap(false); } else if (peCombo->currentIndex() == 3) { enableNum(true); newStyle.setHasDropCap(false); newStyle.setHasBullet(false); newStyle.setHasNum(true); newStyle.setNumName(numComboBox->currentText()); newStyle.setNumFormat(numFormatCombo->currentIndex()); newStyle.setNumLevel(numLevelSpin->value() -1); newStyle.setNumStart(numStart->value()); newStyle.setNumPrefix(numPrefix->text()); newStyle.setNumSuffix(numSuffix->text()); if (newStyle.numName() == "<local block>") { newStyle.setNumOther(true); newStyle.setNumHigher(true); } } else { newStyle.setHasDropCap(false); newStyle.setHasBullet(false); newStyle.setHasNum(false); } newStyle.setParEffectOffset(peOffset->value() / m_unitRatio); newStyle.setParEffectIndent(peIndent->isChecked()); handleChanges(m_item, newStyle); }
void gtAction::setParaStyleAttributes(gtParagraphStyle *pstyle, ParagraphStyle& style) { double linesp; int flags = pstyle->getFlags(); style.erase(); style.setName(pstyle->getName()); if (pstyle->getAutoLineSpacing()) linesp = getLineSpacing(pstyle->getFont()->getSize()); else linesp = pstyle->getLineSpacing(); style.setLineSpacingMode(pstyle->isAdjToBaseline() ? ParagraphStyle::BaselineGridLineSpacing : ParagraphStyle::FixedLineSpacing); style.setLineSpacing(linesp); if (flags & gtParagraphStyle::alignmentWasSet) style.setAlignment(static_cast<ParagraphStyle::AlignmentType>(pstyle->getAlignment())); if (flags & gtParagraphStyle::indentWasSet) style.setLeftMargin(pstyle->getIndent()); if (flags & gtParagraphStyle::firstIndentWasSet) style.setFirstIndent(pstyle->getFirstLineIndent()); if (flags & gtParagraphStyle::spaceAboveWasSet) style.setGapBefore(pstyle->getSpaceAbove()); if (flags & gtParagraphStyle::spaceBelowWasSet) style.setGapAfter(pstyle->getSpaceBelow()); if (flags & gtParagraphStyle::tabValueWasSet) style.setTabValues(*pstyle->getTabValues()); if (flags & gtParagraphStyle::dropCapWasSet) style.setHasDropCap(pstyle->hasDropCap()); if (flags & gtParagraphStyle::dropCapHeightWasSet) style.setDropCapLines(pstyle->getDropCapHeight()); if (flags & gtParagraphStyle::bulletWasSet) { style.setHasBullet(pstyle->hasBullet()); style.setBulletStr(pstyle->getBullet()); } if (flags & gtParagraphStyle::numWasSet) { style.setHasNum(pstyle->hasNum()); style.setNumName(pstyle->getName()); style.setNumFormat(pstyle->getNumFormat()); style.setNumLevel(pstyle->getNumLevel()); style.setNumStart(pstyle->getNumStart()); style.setNumHigher(true); style.setNumOther(true); style.setNumPrefix(pstyle->getNumPrefix()); style.setNumSuffix(pstyle->getNumSuffix()); } /*vg.setDropCapOffset(0);*/ }