moveColumns(long colFrom, long colTo, bool right) Move columns. 0 1 2 3 4 | A | B | C | D | E | */
| 374 | | A | B | C | D | E | |
| 375 | */ |
| 376 | void CsvDataStorage::moveColumns(table_index_t colFrom, table_index_t colTo, bool right) { |
| 377 | table_index_t R = rows(); |
| 378 | table_index_t C = columns(); |
| 379 | std::string buffer = ""; |
| 380 | |
| 381 | if( right ) { |
| 382 | if( colTo < C - 1 && colFrom >= 0 ) { |
| 383 | for( table_index_t r = 0; r < R; ++r ) { |
| 384 | std::vector<std::string> row = splitString(tableData.at(r)); |
| 385 | buffer = row.at(colTo + 1); |
| 386 | for( int c = colTo; c >= colFrom; --c ) { |
| 387 | row.at(c + 1) = row.at(c); |
| 388 | } |
| 389 | row.at(colFrom) = buffer; |
| 390 | tableData.at(r) = mergeString(row); |
| 391 | } |
| 392 | } |
| 393 | } else { |
| 394 | if( colFrom > 0 && colTo < C ) { |
| 395 | for( table_index_t r = 0; r < R; ++r ) { |
| 396 | std::vector<std::string> row = splitString(tableData.at(r)); |
| 397 | buffer = row.at(colFrom - 1); |
| 398 | for( int c = colFrom; c <= colTo; ++c ) { |
| 399 | row.at(c - 1) = row.at(c); |
| 400 | } |
| 401 | row.at(colTo) = buffer; |
| 402 | tableData.at(r) = mergeString(row); |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | |
| 409 | bool CsvDataStorage::cellContainsLineBreak(table_index_t R, table_index_t C) { |