diff options
author | Kurt Zenker <kz@openoffice.org> | 2010-08-11 13:21:33 +0200 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2010-08-11 13:21:33 +0200 |
commit | 68e7d26cd5c56f47fed357e4d4764b9c6cdc0ecc (patch) | |
tree | 9b8335cd30847f88cd969f930a6b6550c574d8df /sc | |
parent | 48018b48b69b584bf3e97ee797c0dbd2c49385ca (diff) | |
parent | 86b36edc50929b3d42c63d3f78bf8812282cd7c2 (diff) |
CWS-TOOLING: integrate CWS calc57
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/table.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 68 | ||||
-rw-r--r-- | sc/source/core/data/table5.cxx | 16 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 32 | ||||
-rw-r--r-- | sc/source/ui/cctrl/dpcontrol.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/dbgui/textimportoptions.src | 30 | ||||
-rw-r--r-- | sc/source/ui/docshell/externalrefmgr.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/src/optdlg.src | 6 | ||||
-rw-r--r-- | sc/source/ui/unoobj/confuno.cxx | 13 |
9 files changed, 143 insertions, 44 deletions
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 5f42a2f37247..63cefe22626a 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -683,6 +683,8 @@ public: void UpdatePageBreaks( const ScRange* pUserArea ); void RemoveManualBreaks(); BOOL HasManualBreaks() const; + void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks ); + void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks ); void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const; void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const; diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index b8bd9037c900..d54e16b8cbd7 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -155,6 +155,22 @@ void ScTable::InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE mpFilteredRows->insertSegment(nStartRow, nSize, true); mpHiddenRows->insertSegment(nStartRow, nSize, true); + + if (!maRowManualBreaks.empty()) + { + std::set<SCROW>::reverse_iterator rit = maRowManualBreaks.rbegin(); + while (rit != maRowManualBreaks.rend()) + { + SCROW nRow = *rit; + if (nRow < nStartRow) + break; // while + else + { + maRowManualBreaks.erase( (++rit).base()); + maRowManualBreaks.insert( static_cast<SCROW>( nRow + nSize)); + } + } + } } for (SCCOL j=nStartCol; j<=nEndCol; j++) @@ -185,6 +201,18 @@ void ScTable::DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE mpFilteredRows->removeSegment(nStartRow, nStartRow+nSize); mpHiddenRows->removeSegment(nStartRow, nStartRow+nSize); + + if (!maRowManualBreaks.empty()) + { + std::set<SCROW>::iterator it = maRowManualBreaks.upper_bound( static_cast<SCROW>( nStartRow + nSize - 1)); + maRowManualBreaks.erase( maRowManualBreaks.lower_bound( nStartRow), it); + while (it != maRowManualBreaks.end()) + { + SCROW nRow = *it; + maRowManualBreaks.erase( it++); + maRowManualBreaks.insert( static_cast<SCROW>( nRow - nSize)); + } + } } { // scope for bulk broadcast @@ -233,6 +261,22 @@ void ScTable::InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE mpHiddenCols->insertSegment(nStartCol, static_cast<SCCOL>(nSize), true); mpFilteredCols->insertSegment(nStartCol, static_cast<SCCOL>(nSize), true); + + if (!maColManualBreaks.empty()) + { + std::set<SCCOL>::reverse_iterator rit = maColManualBreaks.rbegin(); + while (rit != maColManualBreaks.rend()) + { + SCCOL nCol = *rit; + if (nCol < nStartCol) + break; // while + else + { + maColManualBreaks.erase( (++rit).base()); + maColManualBreaks.insert( static_cast<SCCOL>( nCol + nSize)); + } + } + } } @@ -291,6 +335,18 @@ void ScTable::DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE SCCOL nRmSize = nStartCol + static_cast<SCCOL>(nSize); mpHiddenCols->removeSegment(nStartCol, nRmSize); mpFilteredCols->removeSegment(nStartCol, nRmSize); + + if (!maColManualBreaks.empty()) + { + std::set<SCCOL>::iterator it = maColManualBreaks.upper_bound( static_cast<SCCOL>( nStartCol + nSize - 1)); + maColManualBreaks.erase( maColManualBreaks.lower_bound( nStartCol), it); + while (it != maColManualBreaks.end()) + { + SCCOL nCol = *it; + maColManualBreaks.erase( it++); + maColManualBreaks.insert( static_cast<SCCOL>( nCol - nSize)); + } + } } @@ -688,6 +744,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pDestTab->IncRecalcLevel(); if (bWidth) + { for (SCCOL i=nCol1; i<=nCol2; i++) { bool bThisHidden = ColHidden(i); @@ -703,6 +760,8 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bChange) bFlagChange = true; } + pDestTab->SetColManualBreaks( maColManualBreaks); + } if (bHeight) { @@ -754,6 +813,7 @@ void ScTable::CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, pDestTab->SetRowFiltered(i, nLastRow, bFiltered); i = nLastRow; } + pDestTab->SetRowManualBreaks( maRowManualBreaks); } pDestTab->DecRecalcLevel(); } @@ -791,11 +851,17 @@ void ScTable::UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, if (bWidth||bHeight) { if (bWidth) + { for (SCCOL i=nCol1; i<=nCol2; i++) pDestTab->pColWidth[i] = pColWidth[i]; + pDestTab->SetColManualBreaks( maColManualBreaks); + } if (bHeight) + { pDestTab->CopyRowHeight(*this, nRow1, nRow2, 0); - DecRecalcLevel(); + pDestTab->SetRowManualBreaks( maRowManualBreaks); + } + DecRecalcLevel(); } } } diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index e7ee96367785..7c13756aab38 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -326,6 +326,22 @@ BOOL ScTable::HasManualBreaks() const return !maRowManualBreaks.empty() || !maColManualBreaks.empty(); } +void ScTable::SetRowManualBreaks( const ::std::set<SCROW>& rBreaks ) +{ + maRowManualBreaks = rBreaks; + InvalidatePageBreaks(); + if (IsStreamValid()) + SetStreamValid(FALSE); +} + +void ScTable::SetColManualBreaks( const ::std::set<SCCOL>& rBreaks ) +{ + maColManualBreaks = rBreaks; + InvalidatePageBreaks(); + if (IsStreamValid()) + SetStreamValid(FALSE); +} + void ScTable::GetAllRowBreaks(set<SCROW>& rBreaks, bool bPage, bool bManual) const { if (bPage) diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 8e78f64b2090..ae5a7bcebe66 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -487,21 +487,31 @@ void ScXMLTableRowCellContext::DoMerge(const com::sun::star::table::CellAddress& uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange()); if ( xCellRange.is() ) { - table::CellRangeAddress aCellAddress; - if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress)) + // Stored merge range may actually be of a larger extend than what + // we support, in which case getCellRangeByPosition() throws + // IndexOutOfBoundsException. Do nothing then. + try { - //unmerge + table::CellRangeAddress aCellAddress; + if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress)) + { + //unmerge + uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow, + aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY); + if (xMergeable.is()) + xMergeable->merge(sal_False); + } + + //merge uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow, - aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY); + aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY); if (xMergeable.is()) - xMergeable->merge(sal_False); + xMergeable->merge(sal_True); + } + catch ( lang::IndexOutOfBoundsException & ) + { + DBG_ERRORFILE("ScXMLTableRowCellContext::DoMerge: range to be merged larger than what we support"); } - - //merge - uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow, - aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY); - if (xMergeable.is()) - xMergeable->merge(sal_True); } } } diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx index 2f23166966b6..82c276d98f2c 100644 --- a/sc/source/ui/cctrl/dpcontrol.cxx +++ b/sc/source/ui/cctrl/dpcontrol.cxx @@ -975,7 +975,7 @@ ScDPFieldPopupWindow::ScDPFieldPopupWindow(Window* pParent, ScDocument* pDoc) : mnCurTabStop(0), mpExtendedData(NULL), mpOKAction(NULL), - maWndSize(160, 330), + maWndSize(240, 330), mePrevToggleAllState(STATE_DONTKNOW) { maTabStopCtrls.reserve(7); @@ -1048,7 +1048,7 @@ void ScDPFieldPopupWindow::getSectionPosSize(Point& rPos, Size& rSize, SectionTy const sal_uInt16 nMenuHeight = 60; const sal_uInt16 nSingleItemBtnAreaHeight = 32; // height of the middle area below the list box where the single-action buttons are. const sal_uInt16 nBottomBtnAreaHeight = 50; // height of the bottom area where the OK and Cancel buttons are. - const sal_uInt16 nBtnWidth = 60; + const sal_uInt16 nBtnWidth = 90; const sal_uInt16 nLabelHeight = static_cast< sal_uInt16 >( getLabelFont().GetHeight() ); const sal_uInt16 nBtnHeight = nLabelHeight*2; const sal_uInt16 nBottomMargin = 10; @@ -1105,7 +1105,7 @@ void ScDPFieldPopupWindow::getSectionPosSize(Point& rPos, Size& rSize, SectionTy { long h = 26; rPos = Point(nListBoxMargin, nSingleBtnAreaY); - rPos.X() += 75; + rPos.X() += 150; rPos.Y() += (nSingleItemBtnAreaHeight - h)/2; rSize = Size(h, h); } @@ -1114,7 +1114,7 @@ void ScDPFieldPopupWindow::getSectionPosSize(Point& rPos, Size& rSize, SectionTy { long h = 26; rPos = Point(nListBoxMargin, nSingleBtnAreaY); - rPos.X() += 75 + h + 10; + rPos.X() += 150 + h + 10; rPos.Y() += (nSingleItemBtnAreaHeight - h)/2; rSize = Size(h, h); } diff --git a/sc/source/ui/dbgui/textimportoptions.src b/sc/source/ui/dbgui/textimportoptions.src index fff3c4b40749..69e2d69b3142 100644 --- a/sc/source/ui/dbgui/textimportoptions.src +++ b/sc/source/ui/dbgui/textimportoptions.src @@ -33,34 +33,34 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS { Text [ en-US ] = "Import Options" ; - Size = MAP_APPFONT ( 190 , 101 ) ; + Size = MAP_APPFONT ( 230 , 101 ) ; Moveable = TRUE ; Closeable = TRUE ; OutputSize = TRUE ; OKButton BTN_OK { - Pos = MAP_APPFONT ( 135, 6 ) ; + Pos = MAP_APPFONT ( 175, 6 ) ; Size = MAP_APPFONT ( 50, 14 ) ; DefButton = TRUE ; }; CancelButton BTN_CANCEL { - Pos = MAP_APPFONT ( 135, 23 ) ; + Pos = MAP_APPFONT ( 175, 23 ) ; Size = MAP_APPFONT ( 50, 14 ) ; }; HelpButton BTN_HELP { - Pos = MAP_APPFONT ( 135, 43 ) ; + Pos = MAP_APPFONT ( 175, 43 ) ; Size = MAP_APPFONT ( 50, 14 ) ; }; FixedLine FL_CHOOSE_LANG { Pos = MAP_APPFONT( 6, 3 ) ; - Size = MAP_APPFONT( 125, 14 ) ; + Size = MAP_APPFONT( 165, 14 ) ; Text [ en-US ] = "Select the language to use for import" ; }; @@ -68,7 +68,7 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS RadioButton RB_AUTOMATIC { Pos = MAP_APPFONT( 12, 20 ) ; - Size = MAP_APPFONT( 50, 10 ) ; + Size = MAP_APPFONT( 159, 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Automatic" ; @@ -77,7 +77,7 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS RadioButton RB_CUSTOM { Pos = MAP_APPFONT( 12, 34 ) ; - Size = MAP_APPFONT( 50, 10 ) ; + Size = MAP_APPFONT( 159, 10 ) ; TabStop = TRUE ; Text [ en-US ] = "Custom" ; @@ -86,7 +86,7 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS ListBox LB_CUSTOM_LANG { Pos = MAP_APPFONT( 20, 50 ) ; - Size = MAP_APPFONT( 100, 55 ) ; + Size = MAP_APPFONT( 140, 120 ) ; TabStop = TRUE ; DropDown = TRUE ; Sort = TRUE ; @@ -94,19 +94,17 @@ ModalDialog RID_SCDLG_TEXT_IMPORT_OPTIONS FixedLine FL_OPTION { - Pos = MAP_APPFONT( 6, 70 ); - Size = MAP_APPFONT( 125, 14 ); - - Text [ en-US ] = "Options" ; + Pos = MAP_APPFONT( 6, 70 ); + Size = MAP_APPFONT( 165, 14 ); + Text [ en-US ] = "Options" ; }; CheckBox BTN_CONVERT_DATE { Pos = MAP_APPFONT( 12, 86 ); - Size = MAP_APPFONT( 125, 10 ); - TabStop = TRUE ; - - Text [ en-US ] = "Detect special numbers (such as dates)." ; + Size = MAP_APPFONT( 159, 10 ); + TabStop = TRUE ; + Text [ en-US ] = "Detect special numbers (such as dates)." ; }; }; diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 0569e95605b1..7fa31246275a 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2024,7 +2024,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri if (!isFileLoadable(aFile)) return NULL; - String aOptions; + String aOptions( pFileData->maFilterOptions ); ScDocumentLoader::GetFilterName(aFile, rFilter, aOptions, true, false); const SfxFilter* pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName(rFilter); @@ -2040,9 +2040,6 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri setRelativeFileName(nFileId, aStr); } - // Update the filter data now that we are loading it again. - setFilterData(nFileId, rFilter, aOptions); - SfxItemSet* pSet = new SfxAllItemSet(SFX_APP()->GetPool()); if (aOptions.Len()) pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions)); @@ -2077,6 +2074,13 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, Stri pExtOptNew->GetDocSettings().mnLinkCnt = nLinkCount + 1; pNewShell->DoLoad(pMedium.release()); + + // with UseInteractionHandler, options may be set by dialog during DoLoad + String aNew = ScDocumentLoader::GetOptions(*pNewShell->GetMedium()); + if (aNew.Len() && aNew != aOptions) + aOptions = aNew; + setFilterData(nFileId, rFilter, aOptions); // update the filter data, including the new options + return aRef; } diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src index ea7cabf7716d..4c64e312bc2d 100644 --- a/sc/source/ui/src/optdlg.src +++ b/sc/source/ui/src/optdlg.src @@ -152,13 +152,13 @@ TabPage RID_SCPAGE_CALC CheckBox BTN_GENERAL_PREC { Pos = MAP_APPFONT ( 12 , 147 ) ; - Size = MAP_APPFONT ( 136 , 10 ) ; + Size = MAP_APPFONT ( 148 , 10 ) ; Text [ en-US ] = "Limit decimals for general number format" ; }; FixedText FT_PREC { - Pos = MAP_APPFONT ( 150 , 148 ) ; - Size = MAP_APPFONT ( 72 , 8 ) ; + Pos = MAP_APPFONT ( 138 , 148 ) ; + Size = MAP_APPFONT ( 84 , 8 ) ; Text [ en-US ] = "~Decimal places" ; Right = TRUE ; }; diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 75e415b8f018..a680185a1d1c 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -193,11 +193,14 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( if (pPrinter) { String aString(sPrinterName); - SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString ); - if (pNewPrinter->IsKnown()) - pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER ); - else - delete pNewPrinter; + if (pPrinter->GetName() != aString) + { + SfxPrinter* pNewPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aString ); + if (pNewPrinter->IsKnown()) + pDocShell->SetPrinter( pNewPrinter, SFX_PRINTER_PRINTER ); + else + delete pNewPrinter; + } } else throw uno::RuntimeException(); |