~ubuntu-branches/ubuntu/saucy/koffice/saucy

« back to all changes in this revision

Viewing changes to kspread/Sheet.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-12-06 15:30:09 UTC
  • mfrom: (0.13.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101206153009-yf0dqbp9l7fzwxi8
Tags: 1:2.2.91-0ubuntu1
New upstream RC release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1983
1983
    static const QString sCoveredTableCell      = QString::fromLatin1("covered-table-cell");
1984
1984
    static const QString sNumberColumnsRepeated = QString::fromLatin1("number-columns-repeated");
1985
1985
 
1986
 
    static const QString nsTable = QString::fromLatin1(KoXmlNS::table);
1987
 
 
1988
1986
//    kDebug(36003)<<"Sheet::loadRowFormat( const KoXmlElement& row, int &rowIndex,const KoOdfStylesReader& stylesReader, bool isLast )***********";
1989
1987
    KoOdfLoadingContext& odfContext = tableContext.odfContext;
1990
1988
    bool isNonDefaultRow = false;
1991
1989
 
1992
1990
    KoStyleStack styleStack;
1993
 
    if (row.hasAttributeNS(nsTable, sStyleName)) {
1994
 
        QString str = row.attributeNS(nsTable, sStyleName, QString());
 
1991
    if (row.hasAttributeNS(KoXmlNS::table, sStyleName)) {
 
1992
        QString str = row.attributeNS(KoXmlNS::table, sStyleName, QString());
1995
1993
        const KoXmlElement *style = odfContext.stylesReader().findStyle(str, "table-row");
1996
1994
        if (style) {
1997
1995
            styleStack.push(*style);
2001
1999
    styleStack.setTypeProperties("table-row");
2002
2000
 
2003
2001
    int number = 1;
2004
 
    if (row.hasAttributeNS(nsTable, sNumberRowsRepeated)) {
 
2002
    if (row.hasAttributeNS(KoXmlNS::table, sNumberRowsRepeated)) {
2005
2003
        bool ok = true;
2006
 
        int n = row.attributeNS(nsTable, sNumberRowsRepeated, QString()).toInt(&ok);
 
2004
        int n = row.attributeNS(KoXmlNS::table, sNumberRowsRepeated, QString()).toInt(&ok);
2007
2005
        if (ok)
2008
2006
            // Some spreadsheet programs may support more rows than KSpread so
2009
2007
            // limit the number of repeated rows.
2012
2010
    }
2013
2011
 
2014
2012
    QString rowCellStyleName;
2015
 
    if (row.hasAttributeNS(nsTable, sDefaultCellStyleName)) {
2016
 
        rowCellStyleName = row.attributeNS(nsTable, sDefaultCellStyleName, QString());
 
2013
    if (row.hasAttributeNS(KoXmlNS::table, sDefaultCellStyleName)) {
 
2014
        rowCellStyleName = row.attributeNS(KoXmlNS::table, sDefaultCellStyleName, QString());
2017
2015
        if (!rowCellStyleName.isEmpty()) {
2018
2016
            rowStyleRegions[rowCellStyleName] += QRect(1, rowIndex, KS_colMax, number);
2019
2017
        }
2027
2025
    }
2028
2026
 
2029
2027
    enum { Visible, Collapsed, Filtered } visibility = Visible;
2030
 
    if (row.hasAttributeNS(nsTable, sVisibility)) {
2031
 
        const QString string = row.attributeNS(nsTable, sVisibility, sVisible);
 
2028
    if (row.hasAttributeNS(KoXmlNS::table, sVisibility)) {
 
2029
        const QString string = row.attributeNS(KoXmlNS::table, sVisibility, sVisible);
2032
2030
        if (string == sCollapse)
2033
2031
            visibility = Collapsed;
2034
2032
        else if (string == sFilter)
2073
2071
 
2074
2072
    KoXmlElement cellElement;
2075
2073
    forEachElement(cellElement, row) {
2076
 
        if (cellElement.namespaceURI() != nsTable)
 
2074
        if (cellElement.namespaceURI() != KoXmlNS::table)
2077
2075
            continue;
2078
2076
        if (cellElement.localName() != sTableCell && cellElement.localName() != sCoveredTableCell)
2079
2077
            continue;
2080
2078
 
2081
2079
 
2082
2080
        bool ok = false;
2083
 
        const int n = cellElement.attributeNS(nsTable, sNumberColumnsRepeated, QString()).toInt(&ok);
 
2081
        const int n = cellElement.attributeNS(KoXmlNS::table, sNumberColumnsRepeated, QString()).toInt(&ok);
2084
2082
        // Some spreadsheet programs may support more columns than
2085
2083
        // KSpread so limit the number of repeated columns.
2086
2084
        // FIXME POSSIBLE DATA LOSS!
2088
2086
        columnMaximal = qMax(numberColumns, columnMaximal);
2089
2087
 
2090
2088
        // Styles are inserted at the end of the loading process, so check the XML directly here.
2091
 
        const QString styleName = cellElement.attributeNS(nsTable , sStyleName, QString());
 
2089
        const QString styleName = cellElement.attributeNS(KoXmlNS::table , sStyleName, QString());
2092
2090
        if (!styleName.isEmpty())
2093
2091
            cellStyleRegions[styleName] += QRect(columnIndex, rowIndex, numberColumns, number);
2094
2092