Commits

Anonymous committed ee9cde6 Merge

CWS-TOOLING: integrate CWS calc61

  • Participants
  • Parent commits 1fdfb7c, 2fe7ce2

Comments (0)

Files changed (3)

File sc/source/ui/unoobj/docuno.cxx

 			rMark.MarkFromRangeList( rRanges, FALSE );
 			rMark.MarkToSimple();
 
+            if ( rMark.IsMultiMarked() )
+            {
+                // #i115266# copy behavior of old printing:
+                // treat multiple selection like a single selection with the enclosing range
+                ScRange aMultiMarkArea;
+                rMark.GetMultiMarkArea( aMultiMarkArea );
+                rMark.ResetMark();
+                rMark.SetMarkArea( aMultiMarkArea );
+            }
+
 			if ( rMark.IsMarked() && !rMark.IsMultiMarked() )
 			{
 				// a sheet object is treated like an empty selection: print the used area of the sheet
 	ScMarkData aMark;
 	ScPrintSelectionStatus aStatus;
     String aPagesStr;
-    if ( !FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr ) )
-		throw lang::IllegalArgumentException();
-
-	if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) )
-	{
-		delete pPrintFuncCache;
-		pPrintFuncCache = new ScPrintFuncCache( pDocShell, aMark, aStatus );
-	}
-	long nTotalPages = pPrintFuncCache->GetPageCount();
+    // #i115266# if FillRenderMarkData fails, keep nTotalPages at 0, but still handle getRenderer(0) below
+    long nTotalPages = 0;
+    if ( FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr ) )
+    {
+        if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) )
+        {
+            delete pPrintFuncCache;
+            pPrintFuncCache = new ScPrintFuncCache( pDocShell, aMark, aStatus );
+        }
+        nTotalPages = pPrintFuncCache->GetPageCount();
+    }
     sal_Int32 nRenderer = lcl_GetRendererNum( nSelRenderer, aPagesStr, nTotalPages );
 	if ( nRenderer >= nTotalPages )
     {

File sc/source/ui/view/pfuncache.cxx

 		long nThisTab = 0;
 		if ( rMark.GetTableSelect( nTab ) )
 		{
+            pDoc->InvalidatePageBreaks( nTab );                 // user print area (selection) may be different
+
 			ScPrintFunc aFunc( pDocSh, pPrinter, nTab, nAttrPage, 0, pSelRange, &aSelection.GetOptions() );
 			nThisTab = aFunc.GetTotalPages();
 			nFirstAttr[nTab] = aFunc.GetFirstPageNo();			// from page style or previous sheet

File sfx2/source/view/viewprn.cxx

         aRenderOptions[1].Value = i_rViewProp;
         aRenderOptions[2].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrinter" ) );
         aRenderOptions[2].Value <<= sal_True;
-        Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) );
-        int nProps = aRenderParms.getLength();
-        for( int i = 0; i < nProps; i++ )
+        try
         {
-            if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) )
+            Sequence< beans::PropertyValue > aRenderParms( mxRenderable->getRenderer( 0 , getSelectionObject(), aRenderOptions ) );
+            int nProps = aRenderParms.getLength();
+            for( int i = 0; i < nProps; i++ )
             {
-                Sequence< beans::PropertyValue > aUIProps;
-                aRenderParms[i].Value >>= aUIProps;
-                setUIOptions( aUIProps );
-                break;
+                if( aRenderParms[i].Name.equalsAscii( "ExtraPrintUIOptions" ) )
+                {
+                    Sequence< beans::PropertyValue > aUIProps;
+                    aRenderParms[i].Value >>= aUIProps;
+                    setUIOptions( aUIProps );
+                    break;
+                }
             }
         }
+        catch( lang::IllegalArgumentException& )
+        {
+            // the first renderer should always be available for the UI options,
+            // but catch the exception to be safe
+        }
     }
 
     // set some job parameters
     if( mxRenderable.is() && pPrinter )
     {
         Sequence< beans::PropertyValue > aJobOptions( getMergedOptions() );
-        aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions );
+        try
+        {
+            aResult = mxRenderable->getRenderer( i_nPage, getSelectionObject(), aJobOptions );
+        }
+        catch( lang::IllegalArgumentException& )
+        {
+        }
     }
     return aResult;
 }