[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/kotext/opendocument
From:       Pierre Ducroquet <pinaraf () gmail ! com>
Date:       2009-07-20 14:23:40
Message-ID: 1248099820.130096.15064.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 999873 by ducroquet:

Fix crash on document from bug report #130825

 M  +12 -6     KoTextLoader.cpp  


--- trunk/koffice/libs/kotext/opendocument/KoTextLoader.cpp #999872:999873
@@ -246,8 +246,11 @@
                     cursor.insertText("\n");
                     cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor, \
1);  QTextTableFormat tableFormat;
-                    KoTableStyle *tblStyle = \
d->textSharedData->tableStyle(tag.attributeNS(KoXmlNS::table, "style-name", \
                "1"),false);
-                    tblStyle->applyStyle(tableFormat);
+                    QString tableStyleName = tag.attributeNS(KoXmlNS::table, \
"style-name", ""); +                    if (!tableStyleName.isEmpty()) {
+                        KoTableStyle *tblStyle = \
d->textSharedData->tableStyle(tag.attributeNS(KoXmlNS::table, "style-name", ""), \
d->stylesDotXml); +                        tblStyle->applyStyle(tableFormat);
+                    }
                     QTextTable *tbl = cursor.insertTable(1, 1, tableFormat);
                     int rows = 0;
                     int columns = 0;
@@ -288,10 +291,13 @@
                                                     // rowsSpanned disabled for now \
as that would mean spanning into rows not yet created. Need to figure out some way to \
                handle this
                                                     tbl->mergeCells(currentRow, \
currentCell, 1/*rowsSpanned*/, columnsSpanned);  
-                                                    KoTableCellStyle *cellStyle = \
d->textSharedData->tableCellStyle(rowTag.attributeNS(KoXmlNS::table, "style-name", \
                "1"),false);
-                                                    QTextTableCellFormat cellFormat \
                = cell.format().toTableCellFormat();
-                                                    \
                cellStyle->applyStyle(cellFormat);
-                                                    cell.setFormat(cellFormat);
+                                                    QString cellStyleName = \
rowTag.attributeNS(KoXmlNS::table, "style-name", ""); +                               \
if (!cellStyleName.isEmpty()) { +                                                     \
KoTableCellStyle *cellStyle = d->textSharedData->tableCellStyle(cellStyleName, \
d->stylesDotXml); +                                                        \
QTextTableCellFormat cellFormat = cell.format().toTableCellFormat(); +                \
cellStyle->applyStyle(cellFormat); +                                                  \
cell.setFormat(cellFormat); +                                                    }
 
                                                     if (cell.isValid()) {
                                                         cursor = \
cell.firstCursorPosition();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic