diff options
author | Laurent Godard <lgodard.libre@laposte.net> | 2013-07-01 15:43:46 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-07-01 17:11:42 +0000 |
commit | 92c7eca78e6ac84ef2b1be5dca102ecfaee9766b (patch) | |
tree | 40fcf627fc18597de0fd0b18dd13aa9d608c20e2 /sc | |
parent | cb44db2fe78b43424491d25f0c9e34f16aba5c24 (diff) |
simplify AddPrintRanges calls at import time
- at import time, use directly core functions
- honor IsUndoEnabled in uno calls
Change-Id: If1e762df0ca9cfa22fa2c0e75518fe892be602b6
Reviewed-on: https://gerrit.libreoffice.org/4656
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/xml/xmltabi.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 7 |
2 files changed, 10 insertions, 9 deletions
diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx index 1069f47605fe..17015291e6c8 100644 --- a/sc/source/filter/xml/xmltabi.cxx +++ b/sc/source/filter/xml/xmltabi.cxx @@ -359,14 +359,12 @@ void ScXMLTableContext::EndElement() SCTAB nCurTab = rTables.GetCurrentSheet(); if (!sPrintRanges.isEmpty()) { - Reference< sheet::XPrintAreas > xPrintAreas( - rTables.GetCurrentXSheet(), UNO_QUERY); - - if( xPrintAreas.is() ) + ScRangeList aRangeList; + ScRangeStringConverter::GetRangeListFromString( aRangeList, sPrintRanges, pDoc, ::formula::FormulaGrammar::CONV_OOO ); + size_t nCount = aRangeList.size(); + for (size_t i=0; i< nCount; i++ ) { - Sequence< table::CellRangeAddress > aRangeList; - ScRangeStringConverter::GetRangeListFromString( aRangeList, sPrintRanges, pDoc, ::formula::FormulaGrammar::CONV_OOO ); - xPrintAreas->setPrintAreas( aRangeList ); + pDoc->AddPrintRange( nCurTab, *aRangeList[i] ); } } else if (!bPrintEntireSheet) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 763bf67051cf..1d0a8e8f129c 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -7503,13 +7503,15 @@ void SAL_CALL ScTableSheetObj::setPrintAreas( throw(uno::RuntimeException) { SolarMutexGuard aGuard; + ScPrintRangeSaver* pOldRanges; ScDocShell* pDocSh = GetDocShell(); if ( pDocSh ) { ScDocument* pDoc = pDocSh->GetDocument(); SCTAB nTab = GetTab_Impl(); - ScPrintRangeSaver* pOldRanges = pDoc->CreatePrintRangeSaver(); + if ( pDoc->IsUndoEnabled() ) + pOldRanges = pDoc->CreatePrintRangeSaver(); sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength(); pDoc->ClearPrintRanges( nTab ); @@ -7524,7 +7526,8 @@ void SAL_CALL ScTableSheetObj::setPrintAreas( } } - PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. + if ( pDoc->IsUndoEnabled() ) + PrintAreaUndo_Impl( pOldRanges ); // Undo, Umbrueche, Modified etc. } } |