sc/source/filter/xml/xmltabi.cxx |   12 +++++-------
 sc/source/ui/unoobj/cellsuno.cxx |    7 +++++--
 2 files changed, 10 insertions(+), 9 deletions(-)

New commits:
commit 92c7eca78e6ac84ef2b1be5dca102ecfaee9766b
Author: Laurent Godard <lgodard.li...@laposte.net>
Date:   Mon Jul 1 15:43:46 2013 +0200

    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.mohrh...@googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

diff --git a/sc/source/filter/xml/xmltabi.cxx b/sc/source/filter/xml/xmltabi.cxx
index 1069f47..1701529 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 763bf67..1d0a8e8 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.
     }
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to