[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/kotext
From: Carlos Licea <carlos_licea () hotmail ! com>
Date: 2010-09-14 19:07:26
Message-ID: 20100914190726.0B866AC871 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1175335 by clicea:
Add a some new methods to keep track of the default cell style for the rows or
columns.
M +45 -0 KoTableColumnAndRowStyleManager.cpp
M +33 -0 KoTableColumnAndRowStyleManager.h
--- trunk/koffice/libs/kotext/KoTableColumnAndRowStyleManager.cpp #1175334:1175335
@@ -21,6 +21,7 @@
#include "styles/KoTableColumnStyle.h"
#include "styles/KoTableRowStyle.h"
+#include "styles/KoTableCellStyle.h"
#include <QVector>
#include <QSet>
@@ -34,6 +35,9 @@
}
QVector<KoTableColumnStyle> tableColumnStyles;
QVector<KoTableRowStyle> tableRowStyles;
+
+ QVector<KoTableCellStyle*> defaultRowCellStyles;
+ QVector<KoTableCellStyle*> defaultColumnCellStyles;
};
KoTableColumnAndRowStyleManager::KoTableColumnAndRowStyleManager()
@@ -102,3 +106,44 @@
return d->tableRowStyles.value(row);
}
+KoTableCellStyle* KoTableColumnAndRowStyleManager::defaultColumnCellStyle(int column) const
+{
+ Q_ASSERT(column >= 0);
+
+ return d->defaultColumnCellStyles.value(column);
+}
+
+void KoTableColumnAndRowStyleManager::setDefaultColumnCellStyle(int column, KoTableCellStyle* cellStyle)
+{
+ Q_ASSERT(column >= 0);
+
+ if (column < d->defaultColumnCellStyles.size() && d->defaultColumnCellStyles.value(column) == cellStyle) {
+ return;
+ }
+
+ while (column > d->defaultColumnCellStyles.size())
+ d->defaultColumnCellStyles.append(0);
+
+ d->defaultColumnCellStyles.append(cellStyle);
+}
+
+KoTableCellStyle* KoTableColumnAndRowStyleManager::defaultRowCellStyle(int row) const
+{
+ Q_ASSERT(row >= 0);
+
+ return d->defaultRowCellStyles.value(row);
+}
+
+void KoTableColumnAndRowStyleManager::setDefaultRowCellStyle(int row, KoTableCellStyle* cellStyle)
+{
+ Q_ASSERT(row >= 0);
+
+ if (row < d->defaultRowCellStyles.size() && d->defaultRowCellStyles.value(row) == cellStyle) {
+ return;
+ }
+
+ while (row > d->defaultRowCellStyles.size())
+ d->defaultRowCellStyles.append(0);
+
+ d->defaultRowCellStyles.append(cellStyle);
+}
--- trunk/koffice/libs/kotext/KoTableColumnAndRowStyleManager.h #1175334:1175335
@@ -24,6 +24,7 @@
class KoTableColumnStyle;
class KoTableRowStyle;
+class KoTableCellStyle;
/**
* Manages all column and row styles for a single table.
@@ -75,6 +76,38 @@
*/
KoTableRowStyle rowStyle(int row) const;
+ /**
+ * Get the default cell style for the row \a row.
+ *
+ * @param row the row to get the style for.
+ * @return the default cell style for \a row.
+ */
+ KoTableCellStyle* defaultRowCellStyle(int row) const;
+
+ /**
+ * Set the default cell style for the row \a row.
+ *
+ * @param row the row to set the style to.
+ * @return the default cell style for \a row.
+ */
+ void setDefaultRowCellStyle(int row, KoTableCellStyle* cellStyle);
+
+ /**
+ * Get the default cell style for the column \a column.
+ *
+ * @param column the column to get the style for.
+ * @return the default cell style for \a column.
+ */
+ KoTableCellStyle* defaultColumnCellStyle(int column) const;
+
+ /**
+ * Set the default cell style for the column \a column.
+ *
+ * @param column the column to set the style to.
+ * @return the default cell style for \a column.
+ */
+ void setDefaultColumnCellStyle(int column, KoTableCellStyle* cellStyle);
+
private:
class Private;
Private* const d;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic