summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-24 13:50:11 (UTC)
committer mickeyl <mickeyl>2004-04-24 13:50:11 (UTC)
commit0e24210ea7aa2deaf2facf29c366413aa93d0482 (patch) (unidiff)
tree1adae72f49c3f5005be836e6e7525dc79fb098cd
parent9ac401fbe5c80f710757926920d734e93a7e159b (diff)
downloadopie-0e24210ea7aa2deaf2facf29c366413aa93d0482.zip
opie-0e24210ea7aa2deaf2facf29c366413aa93d0482.tar.gz
opie-0e24210ea7aa2deaf2facf29c366413aa93d0482.tar.bz2
gcc 3.4 fixlet
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/sheet.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp
index d4419af..88847da 100644
--- a/noncore/apps/opie-sheet/sheet.cpp
+++ b/noncore/apps/opie-sheet/sheet.cpp
@@ -1964,261 +1964,261 @@ void Sheet::copySheetData(QList<typeCellData> *destSheetData)
1964 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 1964 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
1965 { 1965 {
1966 newCellData=new typeCellData; 1966 newCellData=new typeCellData;
1967 *newCellData=*tempCellData; 1967 *newCellData=*tempCellData;
1968 destSheetData->append(newCellData); 1968 destSheetData->append(newCellData);
1969 } 1969 }
1970} 1970}
1971 1971
1972void Sheet::setSheetData(QList<typeCellData> *srcSheetData) 1972void Sheet::setSheetData(QList<typeCellData> *srcSheetData)
1973{ 1973{
1974 typeCellData *tempCellData, *newCellData; 1974 typeCellData *tempCellData, *newCellData;
1975 1975
1976 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 1976 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
1977 { 1977 {
1978 clearCell(tempCellData->row, tempCellData->col); 1978 clearCell(tempCellData->row, tempCellData->col);
1979 updateCell(tempCellData->row, tempCellData->col); 1979 updateCell(tempCellData->row, tempCellData->col);
1980 } 1980 }
1981 sheetData.clear(); 1981 sheetData.clear();
1982 1982
1983 for (tempCellData=srcSheetData->first(); tempCellData; tempCellData=srcSheetData->next()) 1983 for (tempCellData=srcSheetData->first(); tempCellData; tempCellData=srcSheetData->next())
1984 { 1984 {
1985 newCellData=new typeCellData; 1985 newCellData=new typeCellData;
1986 *newCellData=*tempCellData; 1986 *newCellData=*tempCellData;
1987 sheetData.append(newCellData); 1987 sheetData.append(newCellData);
1988 setText(newCellData->row, newCellData->col, dataParser(findCellName(newCellData->row, newCellData->col), newCellData->data)); 1988 setText(newCellData->row, newCellData->col, dataParser(findCellName(newCellData->row, newCellData->col), newCellData->data));
1989 } 1989 }
1990 emit sheetModified(); 1990 emit sheetModified();
1991} 1991}
1992 1992
1993void Sheet::setName(const QString &name) 1993void Sheet::setName(const QString &name)
1994{ 1994{
1995 sheetName=name; 1995 sheetName=name;
1996 emit sheetModified(); 1996 emit sheetModified();
1997} 1997}
1998 1998
1999QString Sheet::getName() 1999QString Sheet::getName()
2000{ 2000{
2001 return sheetName; 2001 return sheetName;
2002} 2002}
2003 2003
2004void Sheet::setBrush(int row, int col, const QBrush &brush) 2004void Sheet::setBrush(int row, int col, const QBrush &brush)
2005{ 2005{
2006 typeCellData *cellData=findCellData(row, col); 2006 typeCellData *cellData=findCellData(row, col);
2007 if (!cellData) cellData=createCellData(row, col); 2007 if (!cellData) cellData=createCellData(row, col);
2008 if (cellData) 2008 if (cellData)
2009 { 2009 {
2010 cellData->background=brush; 2010 cellData->background=brush;
2011 emit sheetModified(); 2011 emit sheetModified();
2012 } 2012 }
2013} 2013}
2014 2014
2015QBrush Sheet::getBrush(int row, int col) 2015QBrush Sheet::getBrush(int row, int col)
2016{ 2016{
2017 typeCellData *cellData=findCellData(row, col); 2017 typeCellData *cellData=findCellData(row, col);
2018 if (!cellData) cellData=&defaultCellData; 2018 if (!cellData) cellData=&defaultCellData;
2019 return cellData->background; 2019 return cellData->background;
2020} 2020}
2021 2021
2022void Sheet::setTextAlign(int row, int col, Qt::AlignmentFlags flags) 2022void Sheet::setTextAlign(int row, int col, Qt::AlignmentFlags flags)
2023{ 2023{
2024 typeCellData *cellData=findCellData(row, col); 2024 typeCellData *cellData=findCellData(row, col);
2025 if (!cellData) cellData=createCellData(row, col); 2025 if (!cellData) cellData=createCellData(row, col);
2026 if (cellData) 2026 if (cellData)
2027 { 2027 {
2028 cellData->alignment=flags; 2028 cellData->alignment=flags;
2029 emit sheetModified(); 2029 emit sheetModified();
2030 } 2030 }
2031} 2031}
2032 2032
2033Qt::AlignmentFlags Sheet::getAlignment(int row, int col) 2033Qt::AlignmentFlags Sheet::getAlignment(int row, int col)
2034{ 2034{
2035 typeCellData *cellData=findCellData(row, col); 2035 typeCellData *cellData=findCellData(row, col);
2036 if (!cellData) cellData=&defaultCellData; 2036 if (!cellData) cellData=&defaultCellData;
2037 return cellData->alignment; 2037 return cellData->alignment;
2038} 2038}
2039 2039
2040void Sheet::setTextFont(int row, int col, const QFont &font, const QColor &color) 2040void Sheet::setTextFont(int row, int col, const QFont &font, const QColor &color)
2041{ 2041{
2042 typeCellData *cellData=findCellData(row, col); 2042 typeCellData *cellData=findCellData(row, col);
2043 if (!cellData) cellData=createCellData(row, col); 2043 if (!cellData) cellData=createCellData(row, col);
2044 if (cellData) 2044 if (cellData)
2045 { 2045 {
2046 cellData->font=font; 2046 cellData->font=font;
2047 cellData->fontColor=color; 2047 cellData->fontColor=color;
2048 emit sheetModified(); 2048 emit sheetModified();
2049 } 2049 }
2050} 2050}
2051 2051
2052QFont Sheet::getFont(int row, int col) 2052QFont Sheet::getFont(int row, int col)
2053{ 2053{
2054 typeCellData *cellData=findCellData(row, col); 2054 typeCellData *cellData=findCellData(row, col);
2055 if (!cellData) cellData=&defaultCellData; 2055 if (!cellData) cellData=&defaultCellData;
2056 return cellData->font; 2056 return cellData->font;
2057} 2057}
2058 2058
2059QColor Sheet::getFontColor(int row, int col) 2059QColor Sheet::getFontColor(int row, int col)
2060{ 2060{
2061 typeCellData *cellData=findCellData(row, col); 2061 typeCellData *cellData=findCellData(row, col);
2062 if (!cellData) cellData=&defaultCellData; 2062 if (!cellData) cellData=&defaultCellData;
2063 return cellData->fontColor; 2063 return cellData->fontColor;
2064} 2064}
2065 2065
2066void Sheet::setPen(int row, int col, int vertical, const QPen &pen) 2066void Sheet::setPen(int row, int col, int vertical, const QPen &pen)
2067{ 2067{
2068 typeCellData *cellData=findCellData(row, col); 2068 typeCellData *cellData=findCellData(row, col);
2069 if (!cellData) cellData=createCellData(row, col); 2069 if (!cellData) cellData=createCellData(row, col);
2070 if (cellData) 2070 if (cellData)
2071 { 2071 {
2072 if (vertical) 2072 if (vertical)
2073 cellData->borders.right=pen; 2073 cellData->borders.right=pen;
2074 else 2074 else
2075 cellData->borders.bottom=pen; 2075 cellData->borders.bottom=pen;
2076 emit sheetModified(); 2076 emit sheetModified();
2077 } 2077 }
2078} 2078}
2079 2079
2080QPen Sheet::getPen(int row, int col, int vertical) 2080QPen Sheet::getPen(int row, int col, int vertical)
2081{ 2081{
2082 typeCellData *cellData=findCellData(row, col); 2082 typeCellData *cellData=findCellData(row, col);
2083 if (!cellData) cellData=&defaultCellData; 2083 if (!cellData) cellData=&defaultCellData;
2084 return (vertical ? cellData->borders.right : cellData->borders.bottom); 2084 return (vertical ? cellData->borders.right : cellData->borders.bottom);
2085} 2085}
2086 2086
2087void Sheet::getSelection(int *row1, int *col1, int *row2, int *col2) 2087void Sheet::getSelection(int *row1, int *col1, int *row2, int *col2)
2088{ 2088{
2089 int selectionNo=currentSelection(); 2089 int selectionNo=currentSelection();
2090 if (selectionNo>=0) 2090 if (selectionNo>=0)
2091 { 2091 {
2092 QTableSelection selection(selection(selectionNo)); 2092 QTableSelection select(selection(selectionNo));
2093 *row1=selection.topRow(); 2093 *row1=select.topRow();
2094 *row2=selection.bottomRow(); 2094 *row2=select.bottomRow();
2095 *col1=selection.leftCol(); 2095 *col1=select.leftCol();
2096 *col2=selection.rightCol(); 2096 *col2=select.rightCol();
2097 } 2097 }
2098 else 2098 else
2099 { 2099 {
2100 *row1=*row2=currentRow(); 2100 *row1=*row2=currentRow();
2101 *col1=*col2=currentColumn(); 2101 *col1=*col2=currentColumn();
2102 } 2102 }
2103} 2103}
2104 2104
2105void Sheet::editClear() 2105void Sheet::editClear()
2106{ 2106{
2107 int row1, row2, col1, col2; 2107 int row1, row2, col1, col2;
2108 getSelection(&row1, &col1, &row2, &col2); 2108 getSelection(&row1, &col1, &row2, &col2);
2109 2109
2110 int row, col; 2110 int row, col;
2111 for (row=row1; row<=row2; ++row) 2111 for (row=row1; row<=row2; ++row)
2112 for (col=col1; col<=col2; ++col) 2112 for (col=col1; col<=col2; ++col)
2113 { 2113 {
2114 setText(row, col, ""); 2114 setText(row, col, "");
2115 slotCellChanged(row, col); 2115 slotCellChanged(row, col);
2116 } 2116 }
2117} 2117}
2118 2118
2119void Sheet::editCopy() 2119void Sheet::editCopy()
2120{ 2120{
2121 clipboardData.clear(); 2121 clipboardData.clear();
2122 2122
2123 int row1, row2, col1, col2; 2123 int row1, row2, col1, col2;
2124 getSelection(&row1, &col1, &row2, &col2); 2124 getSelection(&row1, &col1, &row2, &col2);
2125 2125
2126 typeCellData *cellData, *newCellData; 2126 typeCellData *cellData, *newCellData;
2127 int row, col; 2127 int row, col;
2128 for (row=row1; row<=row2; ++row) 2128 for (row=row1; row<=row2; ++row)
2129 for (col=col1; col<=col2; ++col) 2129 for (col=col1; col<=col2; ++col)
2130 { 2130 {
2131 cellData=findCellData(row, col); 2131 cellData=findCellData(row, col);
2132 if (cellData) 2132 if (cellData)
2133 { 2133 {
2134 newCellData=new typeCellData; 2134 newCellData=new typeCellData;
2135 *newCellData=*cellData; 2135 *newCellData=*cellData;
2136 newCellData->row-=row1; 2136 newCellData->row-=row1;
2137 newCellData->col-=col1; 2137 newCellData->col-=col1;
2138 clipboardData.append(newCellData); 2138 clipboardData.append(newCellData);
2139 } 2139 }
2140 } 2140 }
2141} 2141}
2142 2142
2143void Sheet::editCut() 2143void Sheet::editCut()
2144{ 2144{
2145 editCopy(); 2145 editCopy();
2146 editClear(); 2146 editClear();
2147} 2147}
2148 2148
2149void Sheet::editPaste(bool onlyContents) 2149void Sheet::editPaste(bool onlyContents)
2150{ 2150{
2151 int row1=currentRow(), col1=currentColumn(); 2151 int row1=currentRow(), col1=currentColumn();
2152 typeCellData *cellData, *tempCellData; 2152 typeCellData *cellData, *tempCellData;
2153 2153
2154 for (tempCellData=clipboardData.first(); tempCellData; tempCellData=clipboardData.next()) 2154 for (tempCellData=clipboardData.first(); tempCellData; tempCellData=clipboardData.next())
2155 { 2155 {
2156 cellData=findCellData(tempCellData->row+row1, tempCellData->col+col1); 2156 cellData=findCellData(tempCellData->row+row1, tempCellData->col+col1);
2157 if (!cellData) cellData=createCellData(tempCellData->row+row1, tempCellData->col+col1); 2157 if (!cellData) cellData=createCellData(tempCellData->row+row1, tempCellData->col+col1);
2158 if (cellData) 2158 if (cellData)
2159 { 2159 {
2160 if (onlyContents) 2160 if (onlyContents)
2161 cellData->data=tempCellData->data; 2161 cellData->data=tempCellData->data;
2162 else 2162 else
2163 { 2163 {
2164 *cellData=*tempCellData; 2164 *cellData=*tempCellData;
2165 cellData->row+=row1; 2165 cellData->row+=row1;
2166 cellData->col+=col1; 2166 cellData->col+=col1;
2167 } 2167 }
2168 setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data)); 2168 setText(cellData->row, cellData->col, dataParser(findCellName(cellData->row, cellData->col), cellData->data));
2169 emit sheetModified(); 2169 emit sheetModified();
2170 } 2170 }
2171 } 2171 }
2172} 2172}
2173 2173
2174void Sheet::insertRows(int no, bool allColumns) 2174void Sheet::insertRows(int no, bool allColumns)
2175{ 2175{
2176 setNumRows(numRows()+no); 2176 setNumRows(numRows()+no);
2177 2177
2178 typeCellData *tempCellData; 2178 typeCellData *tempCellData;
2179 int row=currentRow(), col=currentColumn(); 2179 int row=currentRow(), col=currentColumn();
2180 2180
2181 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 2181 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
2182 if (tempCellData->row>=row && (allColumns || tempCellData->col==col)) 2182 if (tempCellData->row>=row && (allColumns || tempCellData->col==col))
2183 { 2183 {
2184 clearCell(tempCellData->row, tempCellData->col); 2184 clearCell(tempCellData->row, tempCellData->col);
2185 tempCellData->row+=no; 2185 tempCellData->row+=no;
2186 } 2186 }
2187 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 2187 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
2188 if (tempCellData->row>=row && (allColumns || tempCellData->col==col)) 2188 if (tempCellData->row>=row && (allColumns || tempCellData->col==col))
2189 { 2189 {
2190 updateCell(tempCellData->row-no, tempCellData->col); 2190 updateCell(tempCellData->row-no, tempCellData->col);
2191 setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); 2191 setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data));
2192 } 2192 }
2193 emit sheetModified(); 2193 emit sheetModified();
2194} 2194}
2195 2195
2196void Sheet::insertColumns(int no, bool allRows) 2196void Sheet::insertColumns(int no, bool allRows)
2197{ 2197{
2198 int noCols=numCols(); 2198 int noCols=numCols();
2199 int newCols=noCols+no; 2199 int newCols=noCols+no;
2200 setNumCols(newCols); 2200 setNumCols(newCols);
2201 for (int i=noCols; i<newCols; ++i) 2201 for (int i=noCols; i<newCols; ++i)
2202 horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH); 2202 horizontalHeader()->setLabel(i, getHeaderString(i+1), DEFAULT_COL_WIDTH);
2203 2203
2204 typeCellData *tempCellData; 2204 typeCellData *tempCellData;
2205 int col=currentColumn(), row=currentRow(); 2205 int col=currentColumn(), row=currentRow();
2206 2206
2207 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 2207 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
2208 if (tempCellData->col>=col && (allRows || tempCellData->row==row)) 2208 if (tempCellData->col>=col && (allRows || tempCellData->row==row))
2209 { 2209 {
2210 clearCell(tempCellData->row, tempCellData->col); 2210 clearCell(tempCellData->row, tempCellData->col);
2211 tempCellData->col+=no; 2211 tempCellData->col+=no;
2212 } 2212 }
2213 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next()) 2213 for (tempCellData=sheetData.first(); tempCellData; tempCellData=sheetData.next())
2214 if (tempCellData->col>=col && (allRows || tempCellData->row==row)) 2214 if (tempCellData->col>=col && (allRows || tempCellData->row==row))
2215 { 2215 {
2216 updateCell(tempCellData->row, tempCellData->col-no); 2216 updateCell(tempCellData->row, tempCellData->col-no);
2217 setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data)); 2217 setText(tempCellData->row, tempCellData->col, dataParser(findCellName(tempCellData->row, tempCellData->col), tempCellData->data));
2218 } 2218 }
2219 emit sheetModified(); 2219 emit sheetModified();
2220} 2220}
2221 2221
2222void Sheet::dataFindReplace(const QString &findStr, const QString &replaceStr, bool matchCase, bool allCells, bool entireCell, bool replace, bool replaceAll) 2222void Sheet::dataFindReplace(const QString &findStr, const QString &replaceStr, bool matchCase, bool allCells, bool entireCell, bool replace, bool replaceAll)
2223{ 2223{
2224 typeCellData *tempCellData; 2224 typeCellData *tempCellData;