本文整理汇总了C++中Sheet::cellStorage方法的典型用法代码示例。如果您正苦于以下问题:C++ Sheet::cellStorage方法的具体用法?C++ Sheet::cellStorage怎么用?C++ Sheet::cellStorage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sheet
的用法示例。
在下文中一共展示了Sheet::cellStorage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: regionChanged
void BindingManager::regionChanged(const Region& region)
{
Sheet* sheet;
QList< QPair<QRectF, Binding> > bindings;
Region::ConstIterator end(region.constEnd());
for (Region::ConstIterator it = region.constBegin(); it != end; ++it) {
sheet = (*it)->sheet();
const Region changedRegion((*it)->rect(), sheet);
bindings = sheet->cellStorage()->bindingStorage()->intersectingPairs(changedRegion);
for (int j = 0; j < bindings.count(); ++j)
bindings[j].second.update(changedRegion);
}
}
示例2: initTestCase
void TestInformationFunctions::initTestCase()
{
FunctionModuleRegistry::instance()->loadFunctionModules();
m_map = new Map(0 /* no Doc */);
m_map->addNewSheet();
Sheet* sheet = m_map->sheet(0);
sheet->setSheetName("Sheet1");
CellStorage* storage = sheet->cellStorage();
//
// Test case data set
//
// A19:A31
storage->setValue(1,19, Value( 1 ) );
storage->setValue(1,20, Value( 2 ) );
storage->setValue(1,21, Value( 4 ) );
storage->setValue(1,22, Value( 8 ) );
storage->setValue(1,23, Value( 16 ) );
storage->setValue(1,24, Value( 32 ) );
storage->setValue(1,25, Value( 64 ) );
storage->setValue(1,26, Value( 128 ) );
storage->setValue(1,27, Value( 256 ) );
storage->setValue(1,28, Value( 512 ) );
storage->setValue(1,29, Value( 1024 ) );
storage->setValue(1,30, Value( 2048 ) );
storage->setValue(1,31, Value( 4096 ) );
// B1:B2
Formula formula(sheet);
formula.setExpression("=SUM(A19:A31)");
storage->setFormula(2,1, formula);
storage->setFormula(2,2, Formula::empty());
// B3:B17
storage->setValue(2, 3, Value("7"));
storage->setValue(2, 4, Value(2));
storage->setValue(2, 5, Value(3));
storage->setValue(2, 6, Value(true));
storage->setValue(2, 7, Value("Hello"));
// B8 leave empty
storage->setValue(2, 9, Value::errorDIV0());
storage->setValue(2, 10, Value(0));
// storage->setValue(2,11, Value( 3 ) );
// storage->setValue(2,12, Value( 4 ) );
// storage->setValue(2,13, Value( "2005-0131T01:00:00" ));
// storage->setValue(2,14, Value( 1 ) );
// storage->setValue(2,15, Value( 2 ) );
// storage->setValue(2,16, Value( 3 ) );
// storage->setValue(2,17, Value( 4 ) );
//
//
// // C4:C7
storage->setValue(3, 4, Value(4));
storage->setValue(3, 5, Value(5));
// storage->setValue(3, 6, Value( 7 ) );
storage->setValue(3, 7, Value("2005-01-31"));
// C11:C17
storage->setValue(3,11, Value( 5 ) );
storage->setValue(3,12, Value( 6 ) );
storage->setValue(3,13, Value( 8 ) );
storage->setValue(3,14, Value( 4 ) );
storage->setValue(3,15, Value( 3 ) );
storage->setValue(3,16, Value( 2 ) );
storage->setValue(3,17, Value( 1 ) );
// // C19:C31
// storage->setValue(3,19, Value( 0 ) );
// storage->setValue(3,20, Value( 5 ) );
// storage->setValue(3,21, Value( 2 ) );
// storage->setValue(3,22, Value( 5 ) );
// storage->setValue(3,23, Value( 3 ) );
// storage->setValue(3,24, Value( 4 ) );
// storage->setValue(3,25, Value( 4 ) );
// storage->setValue(3,26, Value( 0 ) );
// storage->setValue(3,27, Value( 8 ) );
// storage->setValue(3,28, Value( 1 ) );
// storage->setValue(3,29, Value( 9 ) );
// storage->setValue(3,30, Value( 6 ) );
// storage->setValue(3,31, Value( 2 ) );
// // C51:C57
// storage->setValue(3,51, Value( 7 ) );
// storage->setValue(3,52, Value( 9 ) );
// storage->setValue(3,53, Value( 11 ) );
// storage->setValue(3,54, Value( 12 ) );
// storage->setValue(3,55, Value( 15 ) );
// storage->setValue(3,56, Value( 17 ) );
// storage->setValue(3,57, Value( 19 ) );
//
// // D51:D57
// storage->setValue(4,51, Value( 100 ) );
// storage->setValue(4,52, Value( 105 ) );
// storage->setValue(4,53, Value( 104 ) );
// storage->setValue(4,54, Value( 108 ) );
// storage->setValue(4,55, Value( 111 ) );
// storage->setValue(4,56, Value( 120 ) );
// storage->setValue(4,57, Value( 133 ) );
//
//.........这里部分代码省略.........
示例3: testRichText
void CellTest::testRichText()
{
KoOdfStylesReader stylesReader;
QBuffer buffer;
buffer.open(QIODevice::ReadOnly);
KoStore *store = KoStore::createStore(&buffer, KoStore::Read);
KoOdfLoadingContext odfContext(stylesReader, store);
OdfLoadingContext context(odfContext);
KoDocumentResourceManager documentResources;
KoShapeLoadingContext shapeContext(odfContext, &documentResources);
context.shapeContext = &shapeContext;
Styles autoStyles;
QString cellStyleName;
Map map;
Sheet* sheet = map.addNewSheet();
CellStorage* storage = sheet->cellStorage();
storage->setValue(1, 1, Value(1));
Cell cell = storage->firstInRow(1);
QVERIFY(!cell.isNull());
{ // Test the simple case. Only one paragraph with some simple text.
KoXmlDocument doc = xmlDocument("<text:p>Some text</text:p>");
KoXmlElement e = doc.documentElement();
QVERIFY(!e.isNull());
cell.loadOdfCellText(e, context, autoStyles, cellStyleName);
QVERIFY(!cell.isNull());
QVERIFY(!cell.richText());
QVERIFY(cell.userInput().split('\n').count() == 1);
}
{ // Text in the paragraph and in a child text:span means rich-text.
KoXmlDocument doc = xmlDocument("<text:p>First<text:span>Second<text:span>Theird</text:span></text:span></text:p>");
KoXmlElement e = doc.documentElement();
QVERIFY(!e.isNull());
cell.loadOdfCellText(e, context, autoStyles, cellStyleName);
QVERIFY(!cell.isNull());
QVERIFY(cell.richText());
QVERIFY(cell.userInput().split('\n').count() == 1);
}
{ // The text:line-break should be translated into a \n newline and since there is no other rich-text it should not be detected as such.
KoXmlDocument doc = xmlDocument("<text:p>First<text:line-break/>Second</text:p>");
KoXmlElement e = doc.documentElement();
QVERIFY(!e.isNull());
cell.loadOdfCellText(e, context, autoStyles, cellStyleName);
QVERIFY(!cell.isNull());
QVERIFY(!cell.richText());
QVERIFY(cell.userInput().split('\n').count() == 2);
}
{ // The text:s and text:tab should be translated into space and tabulator. No rich-text else.
KoXmlDocument doc = xmlDocument("<text:p>First<text:s/>Second<text:tab/>Theird</text:p>");
KoXmlElement e = doc.documentElement();
QVERIFY(!e.isNull());
cell.loadOdfCellText(e, context, autoStyles, cellStyleName);
QVERIFY(!cell.isNull());
QVERIFY(!cell.richText());
QVERIFY(cell.userInput().split('\n').count() == 1);
}
}
示例4: process
bool AdjustColumnRowManipulator::process(Element* element)
{
Sheet* sheet = m_sheet; // TODO Stefan: element->sheet();
if (m_sheet && sheet != m_sheet) {
return true;
}
QMap<int, double> heights;
QMap<int, double> widths;
if (m_reverse) {
heights = m_oldHeights;
widths = m_oldWidths;
} else {
heights = m_newHeights;
widths = m_newWidths;
}
QRect range = element->rect();
if (m_adjustColumn) {
if (element->isRow()) {
for (int row = range.top(); row <= range.bottom(); ++row) {
Cell cell = sheet->cellStorage()->firstInRow(row);
while (!cell.isNull()) {
int col = cell.column();
if (!cell.isEmpty() && !cell.isPartOfMerged()) {
if (widths.contains(col) && widths[col] != -1.0) {
ColumnFormat* format = sheet->nonDefaultColumnFormat(col);
if (qAbs(format->width() - widths[col]) > DBL_EPSILON) {
format->setWidth(qMax(2.0, widths[col]));
}
}
}
cell = sheet->cellStorage()->nextInRow(col, row);
}
}
} else {
for (int col = range.left(); col <= range.right(); ++col) {
if (widths.contains(col) && widths[col] != -1.0) {
ColumnFormat* format = sheet->nonDefaultColumnFormat(col);
if (qAbs(format->width() - widths[col]) > DBL_EPSILON) {
format->setWidth(qMax(2.0, widths[col]));
}
}
}
}
}
if (m_adjustRow) {
if (element->isColumn()) {
for (int col = range.left(); col <= range.right(); ++col) {
Cell cell = sheet->cellStorage()->firstInColumn(col);
while (!cell.isNull()) {
int row = cell.row();
if (!cell.isEmpty() && !cell.isPartOfMerged()) {
if (heights.contains(row) && heights[row] != -1.0) {
sheet->rowFormats()->setRowHeight(row, row, heights[row]);
}
}
cell = sheet->cellStorage()->nextInColumn(col, row);
}
}
} else {
for (int row = range.top(); row <= range.bottom(); ++row) {
if (heights.contains(row) && heights[row] != -1.0) {
sheet->rowFormats()->setRowHeight(row, row, heights[row]);
}
}
}
}
// The cell width(s) or height(s) changed, which are cached: rebuild them.
const Region region(m_adjustRow ? 1 : range.left(),
m_adjustColumn ? 1 : range.top(),
m_adjustRow ? KS_colMax : range.width(),
m_adjustColumn ? KS_rowMax : range.height());
m_sheet->map()->addDamage(new CellDamage(m_sheet, region, CellDamage::Appearance));
return true;
}