void PropertiesPalette_Table::updateBorders() { if (!m_doc || !m_item || !m_item->isTable()) return; PageItem_Table* table = m_item->asTable(); TableSideSelector::Sides selectedSides = sideSelector->selection(); m_doc->dontResize = true; if (m_doc->appMode != modeEditTable) { if (selectedSides & TableSideSelector::Left) table->setLeftBorder(m_currentBorder); if (selectedSides & TableSideSelector::Right) table->setRightBorder(m_currentBorder); if (selectedSides & TableSideSelector::Top) table->setTopBorder(m_currentBorder); if (selectedSides & TableSideSelector::Bottom) table->setBottomBorder(m_currentBorder); } else { TableCell cell = table->activeCell(); if (selectedSides & TableSideSelector::Left) cell.setLeftBorder(m_currentBorder); if (selectedSides & TableSideSelector::Right) cell.setRightBorder(m_currentBorder); if (selectedSides & TableSideSelector::Top) cell.setTopBorder(m_currentBorder); if (selectedSides & TableSideSelector::Bottom) cell.setBottomBorder(m_currentBorder); } table->adjustTable(); table->update(); }
void PropertiesPalette_Table::updateStyleControls() { if (m_item && m_item->isTable()) { PageItem_Table* table = m_item->asTable(); tableStyleCombo->setEnabled(true); cellStyleCombo->setEnabled(true); buttonClearTableStyle->setEnabled(true); buttonClearCellStyle->setEnabled(true); // Fill in values. if (m_doc->appMode != modeEditTable) { displayTableStyle(table->style()); cellStyleCombo->setEnabled(false); buttonClearCellStyle->setEnabled(false); } else { // displayTableStyle(table->style()); displayCellStyle(table->activeCell().style()); } } else { tableStyleCombo->setEnabled(false); cellStyleCombo->setEnabled(false); buttonClearTableStyle->setEnabled(false); buttonClearCellStyle->setEnabled(false); } }
void PropertiesPalette_Table::on_buttonClearCellStyle_clicked() { if (!m_item || !m_item->isTable()) return; m_doc->dontResize = true; PageItem_Table* table = m_item->asTable(); table->activeCell().unsetDirectFormatting(); table->adjustTable(); table->update(); }
void PropertiesPalette_Table::on_fillShade_valueChanged(int shade) { if (!m_item || !m_item->isTable()) return; QString color = fillColor->currentColor(); if (color == CommonStrings::tr_NoneColor) color = CommonStrings::None; PageItem_Table* table = m_item->asTable(); if (m_doc->appMode != modeEditTable) { table->setFillColor(color); table->setFillShade(shade); } else { TableCell cell = table->activeCell(); cell.setFillColor(color); cell.setFillShade(shade); } table->update(); }
void PropertiesPalette_Table::on_fillColor_activated(const QString& colorName) { if (!m_item || !m_item->isTable()) return; QString color = colorName; if (colorName == CommonStrings::tr_NoneColor) color = CommonStrings::None; PageItem_Table* table = m_item->asTable(); if (m_doc->appMode != modeEditTable) { table->setFillColor(color); table->setFillShade(fillShade->value()); } else { TableCell cell = table->activeCell(); cell.setFillColor(color); cell.setFillShade(fillShade->value()); } table->update(); }
void PropertiesPalette_Table::updateFillControls() { if (m_item && m_item->isTable()) { PageItem_Table* table = m_item->asTable(); // Enable fill editing controls. fillColor->setEnabled(true); fillColorLabel->setEnabled(true); fillShade->setEnabled(true); fillShadeLabel->setEnabled(true); // Fill in values. if (m_doc->appMode != modeEditTable) { QString color = table->fillColor(); if (color == CommonStrings::None) color = CommonStrings::tr_NoneColor; setCurrentComboItem(fillColor, color); fillShade->setValue(table->fillShade()); } else { TableCell cell = table->activeCell(); QString color = cell.fillColor(); if (color == CommonStrings::None) color = CommonStrings::tr_NoneColor; setCurrentComboItem(fillColor, color); fillShade->setValue(cell.fillShade()); } } else { // Disable fill editing controls. fillColor->setEnabled(false); fillColorLabel->setEnabled(false); fillShade->setEnabled(false); fillShadeLabel->setEnabled(false); } }