diff options
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/docuno.hxx | 5 | ||||
-rw-r--r-- | sc/inc/pch/precompiled_sc.hxx | 2 | ||||
-rw-r--r-- | sc/inc/sc.hrc | 2 | ||||
-rw-r--r-- | sc/inc/viewuno.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/inc/core_pch.hxx | 2 | ||||
-rw-r--r-- | sc/source/core/tool/printopt.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/inc/filt_pch.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/inc/pfuncache.hxx | 6 | ||||
-rw-r--r-- | sc/source/ui/inc/ui_pch.hxx | 2 | ||||
-rw-r--r-- | sc/source/ui/src/scstring.src | 26 | ||||
-rw-r--r-- | sc/source/ui/unoobj/docuno.cxx | 322 | ||||
-rw-r--r-- | sc/source/ui/view/olkact.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/pfuncache.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/prevwsh2.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/view/printfun.cxx | 20 | ||||
-rw-r--r-- | sc/source/ui/view/viewfun3.cxx | 2 |
17 files changed, 377 insertions, 36 deletions
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx index defe627dd812..3487a6c30416 100644 --- a/sc/inc/docuno.hxx +++ b/sc/inc/docuno.hxx @@ -75,6 +75,7 @@ class ScTableSheetObj; class SvxFmDrawPage; class SvxDrawPage; class ScRangeList; +class ScPrintUIOptions; class SC_DLLPUBLIC ScModelObj : public SfxBaseModel, public com::sun::star::sheet::XSpreadsheetDocument, @@ -97,6 +98,7 @@ private: SfxItemPropertySet aPropSet; ScDocShell* pDocShell; ScPrintFuncCache* pPrintFuncCache; + ScPrintUIOptions* pPrinterOptions; com::sun::star::uno::Reference<com::sun::star::uno::XAggregation> xNumberAgg; com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawGradTab; com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawHatchTab; @@ -109,7 +111,8 @@ private: ::cppu::OInterfaceContainerHelper maChangesListeners; BOOL FillRenderMarkData( const com::sun::star::uno::Any& aSelection, - ScMarkData& rMark, ScPrintSelectionStatus& rStatus ) const; + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rOptions, + ScMarkData& rMark, ScPrintSelectionStatus& rStatus, String& rPagesStr ) const; rtl::OUString maBuildId; protected: diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx index b905bb19db03..956bdaf6994d 100644 --- a/sc/inc/pch/precompiled_sc.hxx +++ b/sc/inc/pch/precompiled_sc.hxx @@ -160,7 +160,7 @@ #include <svtools/listener.hxx> #include <svtools/lstner.hxx> #include <svtools/pathoptions.hxx> -#include <svtools/solar.hrc> +#include <vcl/solar.hrc> #include <svtools/useroptions.hxx> #include <svx/editobj.hxx> #include <svx/eeitem.hxx> diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 8fb6b929337b..e6bd5bb6fd36 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -1382,6 +1382,8 @@ #define SCSTR_RENAMEOBJECT (STR_START + 215) +#define SCSTR_PRINT_OPTIONS (STR_START+216) + // Navigator - in der Reihenfolge wie SC_CONTENT_... #define SCSTR_CONTENT_ROOT (STR_START + 250) #define SCSTR_CONTENT_TABLE (STR_START + 251) diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx index e489cb718163..e3d3bc49481e 100644 --- a/sc/inc/viewuno.hxx +++ b/sc/inc/viewuno.hxx @@ -96,13 +96,14 @@ private: USHORT nPane; // ScSplitPos oder SC_VIEWPANE_ACTIVE protected: - ScTabViewShell* GetViewShell() const { return pViewShell; } ::com::sun::star::awt::Rectangle GetVisArea() const; public: ScViewPaneBase(ScTabViewShell* pViewSh, USHORT nP); virtual ~ScViewPaneBase(); + ScTabViewShell* GetViewShell() const { return pViewShell; } + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); diff --git a/sc/source/core/inc/core_pch.hxx b/sc/source/core/inc/core_pch.hxx index d756d1a91246..dc03417d6f49 100644 --- a/sc/source/core/inc/core_pch.hxx +++ b/sc/source/core/inc/core_pch.hxx @@ -71,7 +71,7 @@ #include <svtools/lstner.hxx> #include <svtools/poolitem.hxx> #include <tools/time.hxx> -#include <svtools/solar.hrc> +#include <vcl/solar.hrc> #include <tools/date.hxx> #include <svtools/brdcst.hxx> #include <svx/svxids.hrc> diff --git a/sc/source/core/tool/printopt.cxx b/sc/source/core/tool/printopt.cxx index dae055b5f47e..dc13bdf09adb 100644 --- a/sc/source/core/tool/printopt.cxx +++ b/sc/source/core/tool/printopt.cxx @@ -77,13 +77,13 @@ const ScPrintOptions& ScPrintOptions::operator=( const ScPrintOptions& rCpy ) return *this; } -inline int ScPrintOptions::operator==( const ScPrintOptions& rOpt ) const +int ScPrintOptions::operator==( const ScPrintOptions& rOpt ) const { return bSkipEmpty == rOpt.bSkipEmpty && bAllSheets == rOpt.bAllSheets; } -inline int ScPrintOptions::operator!=( const ScPrintOptions& rOpt ) const +int ScPrintOptions::operator!=( const ScPrintOptions& rOpt ) const { return !(operator==(rOpt)); } diff --git a/sc/source/filter/inc/filt_pch.hxx b/sc/source/filter/inc/filt_pch.hxx index b0ef236519a3..fb5665930a55 100644 --- a/sc/source/filter/inc/filt_pch.hxx +++ b/sc/source/filter/inc/filt_pch.hxx @@ -108,7 +108,7 @@ #include <markarr.hxx> #include <root.hxx> #include <flttypes.hxx> -#include <svtools/solar.hrc> +#include <vcl/solar.hrc> #include <sfx2/sfxsids.hrc> #include <svtools/cntwids.hrc> #include <sfx2/cntids.hrc> diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index d4df2863eec5..c703062e7a04 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2138,15 +2138,20 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, } } - if ( n+1 < nCollateCopies && pPrinter->GetDuplexMode() == DUPLEX_ON && ( nPrinted % 2 ) == 1 ) + if ( n+1 < nCollateCopies && + (pPrinter->GetDuplexMode() == DUPLEX_SHORTEDGE || pPrinter->GetDuplexMode() == DUPLEX_LONGEDGE) && + ( nPrinted % 2 ) == 1 ) { // #105584# when several collated copies are printed in duplex mode, and there is // an odd number of pages, print an empty page between copies, so the first page of // the second copy isn't printed on the back of the last page of the first copy. // (same as in Writer ViewShell::Prt) + // FIXME: needs to be adapted to XRenderable interface + #if 0 pPrinter->StartPage(); pPrinter->EndPage(); + #endif } } } diff --git a/sc/source/ui/inc/pfuncache.hxx b/sc/source/ui/inc/pfuncache.hxx index 93ff22fad0a8..a35084d453d6 100644 --- a/sc/source/ui/inc/pfuncache.hxx +++ b/sc/source/ui/inc/pfuncache.hxx @@ -34,6 +34,7 @@ #include <vector> #include <tools/gen.hxx> #include "rangelst.hxx" +#include "printopt.hxx" class ScDocShell; class ScMarkData; @@ -58,6 +59,7 @@ class ScPrintSelectionStatus { ScPrintSelectionMode eMode; ScRangeList aRanges; + ScPrintOptions aOptions; public: ScPrintSelectionStatus() : eMode(SC_PRINTSEL_INVALID) {} @@ -65,11 +67,13 @@ public: void SetMode(ScPrintSelectionMode eNew) { eMode = eNew; } void SetRanges(const ScRangeList& rNew) { aRanges = rNew; } + void SetOptions(const ScPrintOptions& rNew) { aOptions = rNew; } BOOL operator==(const ScPrintSelectionStatus& rOther) const - { return eMode == rOther.eMode && aRanges == rOther.aRanges; } + { return eMode == rOther.eMode && aRanges == rOther.aRanges && aOptions == rOther.aOptions; } ScPrintSelectionMode GetMode() const { return eMode; } + const ScPrintOptions& GetOptions() const { return aOptions; } }; diff --git a/sc/source/ui/inc/ui_pch.hxx b/sc/source/ui/inc/ui_pch.hxx index 335f7e917505..6e5baf9a54be 100644 --- a/sc/source/ui/inc/ui_pch.hxx +++ b/sc/source/ui/inc/ui_pch.hxx @@ -43,7 +43,7 @@ #include <tools/solar.h> #include <tools/string.hxx> -#include <svtools/solar.hrc> +#include <vcl/solar.hrc> #include <tools/rtti.hxx> #include <string.h> #include <tools/contnr.hxx> diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src index efe9a0312b02..2dfcd84a4726 100644 --- a/sc/source/ui/src/scstring.src +++ b/sc/source/ui/src/scstring.src @@ -738,3 +738,29 @@ String SCSTR_MOREBTN_FEWEROPTIONS Text [ en-US ] = "Fewer ~Options"; }; +StringArray SCSTR_PRINT_OPTIONS +{ + ItemList [en-US] = + { + < "Pages"; >; + < "~Include output of empty pages"; >; + < "If checked empty pages that have no cell contents or draw objects are not printed."; >; + < "Sheets"; >; + < "Print ~only selected sheets"; >; + < "If checked only contents from selected sheets are printed, even if you specify a wider range in the Format - Print Ranges dialog. Content from sheets that are not selected will not be printed."; >; + < "Print content"; >; + < "~All sheets"; >; + < "The printout will be created from all sheets in the document."; >; + < "~Selected sheets"; >; + < "The printout will be created only from the currently selected sheets."; >; + < "Selected cells"; >; + < "The printout will be created only from the currently selected cells."; >; + < "Thereof print"; >; + < "All ~pages"; >; + < "Print all pages of the printable content."; >; + < "Pa~ges"; >; + < "Print only some pages of the printable content."; >; + < "%PRODUCTNAME %s"; >; + }; +}; + diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index c924205bdce5..fb09f3e309d6 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -43,12 +43,14 @@ #include <svtools/numuno.hxx> #include <svtools/smplhint.hxx> #include <svtools/undoopt.hxx> +#include <svtools/moduleoptions.hxx> #include <sfx2/printer.hxx> #include <sfx2/bindings.hxx> #include <vcl/pdfextoutdevdata.hxx> #include <vcl/waitobj.hxx> #include <unotools/charclass.hxx> #include <tools/multisel.hxx> +#include <tools/resary.hxx> #include <toolkit/awt/vclxdevice.hxx> #include <ctype.h> #include <float.h> // DBL_MAX @@ -87,11 +89,15 @@ #include "unoguard.hxx" #include "unonames.hxx" #include "shapeuno.hxx" +#include "viewuno.hxx" +#include "tabvwsh.hxx" #include "printfun.hxx" #include "pfuncache.hxx" #include "scmod.hxx" #include "rangeutl.hxx" #include "ViewSettingsSequenceDefines.hxx" +#include "sc.hrc" +#include "scresid.hxx" #ifndef _SVX_UNOSHAPE_HXX #include <svx/unoshape.hxx> @@ -206,6 +212,147 @@ SC_SIMPLE_SERVICE_INFO( ScTableSheetsObj, "ScTableSheetsObj", "com.sun.star.shee //------------------------------------------------------------------------ +class ScPrintUIOptions : public vcl::PrinterOptionsHelper +{ +public: + ScPrintUIOptions(); + void SetDefaults(); +}; + +ScPrintUIOptions::ScPrintUIOptions() +{ + const ScPrintOptions& rPrintOpt = SC_MOD()->GetPrintOptions(); + sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1; + sal_Bool bSuppress = rPrintOpt.GetSkipEmpty(); + + ResStringArray aStrings( ScResId( SCSTR_PRINT_OPTIONS ) ); + DBG_ASSERT( aStrings.Count() >= 19, "resource incomplete" ); + if( aStrings.Count() < 19 ) // bad resource ? + return; + + m_aUIProperties.realloc( 8 ); + + // create Section for spreadsheet (results in an extra tab page in dialog) + SvtModuleOptions aOpt; + String aAppGroupname( aStrings.GetString( 18 ) ); + aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ), + aOpt.GetModuleName( SvtModuleOptions::E_SCALC ) ); + m_aUIProperties[0].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() ); + + // create subgroup for pages + m_aUIProperties[1].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 0 ) ), rtl::OUString() ); + + // create a bool option for empty pages + m_aUIProperties[2].Value = getBoolControlOpt( rtl::OUString( aStrings.GetString( 1 ) ), + rtl::OUString( aStrings.GetString( 2 ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsIncludeEmptyPages" ) ), + ! bSuppress + ); + // create Subgroup for print content + vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt; + aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); + m_aUIProperties[3].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 6 ) ), + rtl::OUString(), + aPrintRangeOpt + ); + + // create a choice for the content to create + uno::Sequence< rtl::OUString > aChoices( 3 ), aHelpTexts( 3 ); + aChoices[0] = aStrings.GetString( 7 ); + aHelpTexts[0] = aStrings.GetString( 8 ); + aChoices[1] = aStrings.GetString( 9 ); + aHelpTexts[1] = aStrings.GetString( 10 ); + aChoices[2] = aStrings.GetString( 11 ); + aHelpTexts[2] = aStrings.GetString( 12 ); + m_aUIProperties[4].Value = getChoiceControlOpt( rtl::OUString(), + aHelpTexts, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ), + aChoices, + nContent ); + + // create Subgroup for print range + aPrintRangeOpt.mbInternalOnly = sal_True; + m_aUIProperties[5].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 13 ) ), + rtl::OUString(), + aPrintRangeOpt + ); + + // create a choice for the range to print + rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ); + aChoices.realloc( 2 ); + aHelpTexts.realloc( 2 ); + aChoices[0] = aStrings.GetString( 14 ); + aHelpTexts[0] = aStrings.GetString( 15 ); + aChoices[1] = aStrings.GetString( 16 ); + aHelpTexts[1] = aStrings.GetString( 17 ); + m_aUIProperties[6].Value = getChoiceControlOpt( rtl::OUString(), + aHelpTexts, + aPrintRangeName, + aChoices, + 0 ); + + // create a an Edit dependent on "Pages" selected + vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True ); + m_aUIProperties[7].Value = getEditControlOpt( rtl::OUString(), + rtl::OUString(), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), + rtl::OUString(), + aPageRangeOpt + ); + + // "Print only selected sheets" isn't needed because of the "Selected Sheets" choice in "Print content" +#if 0 + // create subgroup for sheets + m_aUIProperties[8].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 3 ) ), rtl::OUString() ); + + // create a bool option for selected pages only + m_aUIProperties[9].Value = getBoolControlOpt( rtl::OUString( aStrings.GetString( 4 ) ), + rtl::OUString( aStrings.GetString( 5 ) ), + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IsOnlySelectedSheets" ) ), + i_bSelectedOnly + ); +#endif +} + +void ScPrintUIOptions::SetDefaults() +{ + // re-initialize the default values from print options + + const ScPrintOptions& rPrintOpt = SC_MOD()->GetPrintOptions(); + sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1; + sal_Bool bSuppress = rPrintOpt.GetSkipEmpty(); + + for (sal_Int32 nUIPos=0; nUIPos<m_aUIProperties.getLength(); ++nUIPos) + { + uno::Sequence<beans::PropertyValue> aUIProp; + if ( m_aUIProperties[nUIPos].Value >>= aUIProp ) + { + for (sal_Int32 nPropPos=0; nPropPos<aUIProp.getLength(); ++nPropPos) + { + rtl::OUString aName = aUIProp[nPropPos].Name; + if ( aName.equalsAscii("Property") ) + { + beans::PropertyValue aPropertyValue; + if ( aUIProp[nPropPos].Value >>= aPropertyValue ) + { + if ( aPropertyValue.Name.equalsAscii( "PrintContent" ) ) + { + aPropertyValue.Value <<= nContent; + aUIProp[nPropPos].Value <<= aPropertyValue; + } + else if ( aPropertyValue.Name.equalsAscii( "IsIncludeEmptyPages" ) ) + { + ScUnoHelpFunctions::SetBoolInAny( aPropertyValue.Value, ! bSuppress ); + aUIProp[nPropPos].Value <<= aPropertyValue; + } + } + } + } + m_aUIProperties[nUIPos].Value <<= aUIProp; + } + } +} + // static void ScModelObj::CreateAndSet(ScDocShell* pDocSh) { @@ -218,6 +365,7 @@ ScModelObj::ScModelObj( ScDocShell* pDocSh ) : aPropSet( lcl_GetDocOptPropertyMap() ), pDocShell( pDocSh ), pPrintFuncCache( NULL ), + pPrinterOptions( NULL ), maChangesListeners( m_aMutex ) { // pDocShell may be NULL if this is the base of a ScDocOptionsObj @@ -257,6 +405,7 @@ ScModelObj::~ScModelObj() xNumberAgg->setDelegator(uno::Reference<uno::XInterface>()); delete pPrintFuncCache; + delete pPrinterOptions; } ScDocument* ScModelObj::GetDocument() const @@ -579,20 +728,65 @@ bool lcl_ParseTarget( const String& rTarget, ScRange& rTargetRange, Rectangle& r return bRangeValid; } -BOOL ScModelObj::FillRenderMarkData( const uno::Any& aSelection, ScMarkData& rMark, - ScPrintSelectionStatus& rStatus ) const +BOOL ScModelObj::FillRenderMarkData( const uno::Any& aSelection, + const uno::Sequence< beans::PropertyValue >& rOptions, + ScMarkData& rMark, + ScPrintSelectionStatus& rStatus, String& rPagesStr ) const { DBG_ASSERT( !rMark.IsMarked() && !rMark.IsMultiMarked(), "FillRenderMarkData: MarkData must be empty" ); DBG_ASSERT( pDocShell, "FillRenderMarkData: DocShell must be set" ); BOOL bDone = FALSE; + uno::Reference<frame::XController> xView; + + // defaults when no options are passed: all sheets, include empty pages + sal_Bool bSelectedSheetsOnly = sal_False; + sal_Bool bIncludeEmptyPages = sal_True; + + bool bHasPrintContent = false; + sal_Int32 nPrintContent = 0; // all sheets / selected sheets / selected cells + sal_Int32 nPrintRange = 0; // all pages / pages + rtl::OUString aPageRange; // "pages" edit value + + for( sal_Int32 i = 0, nLen = rOptions.getLength(); i < nLen; i++ ) + { + if( rOptions[i].Name.equalsAscii( "IsOnlySelectedSheets" ) ) + { + rOptions[i].Value >>= bSelectedSheetsOnly; + } + else if( rOptions[i].Name.equalsAscii( "IsIncludeEmptyPages" ) ) + { + rOptions[i].Value >>= bIncludeEmptyPages; + } + else if( rOptions[i].Name.equalsAscii( "PageRange" ) ) + { + rOptions[i].Value >>= aPageRange; + } + else if( rOptions[i].Name.equalsAscii( "PrintRange" ) ) + { + rOptions[i].Value >>= nPrintRange; + } + else if( rOptions[i].Name.equalsAscii( "PrintContent" ) ) + { + bHasPrintContent = true; + rOptions[i].Value >>= nPrintContent; + } + else if( rOptions[i].Name.equalsAscii( "View" ) ) + { + rOptions[i].Value >>= xView; + } + } + + // "Print Content" selection wins over "Selected Sheets" option + if ( bHasPrintContent ) + bSelectedSheetsOnly = ( nPrintContent != 0 ); + uno::Reference<uno::XInterface> xInterface(aSelection, uno::UNO_QUERY); if ( xInterface.is() ) { ScCellRangesBase* pSelObj = ScCellRangesBase::getImplementation( xInterface ); uno::Reference< drawing::XShapes > xShapes( xInterface, uno::UNO_QUERY ); - if ( pSelObj && pSelObj->GetDocShell() == pDocShell ) { BOOL bSheet = ( ScTableSheetObj::getImplementation( xInterface ) != NULL ); @@ -665,12 +859,41 @@ BOOL ScModelObj::FillRenderMarkData( const uno::Any& aSelection, ScMarkData& rMa // other selection types aren't supported } + // restrict to selected sheets if a view is available + if ( bSelectedSheetsOnly && xView.is() ) + { + ScTabViewObj* pViewObj = ScTabViewObj::getImplementation( xView ); + if (pViewObj) + { + ScTabViewShell* pViewSh = pViewObj->GetViewShell(); + if (pViewSh) + { + const ScMarkData& rViewMark = pViewSh->GetViewData()->GetMarkData(); + SCTAB nTabCount = pDocShell->GetDocument()->GetTableCount(); + for (SCTAB nTab = 0; nTab < nTabCount; nTab++) + if (!rViewMark.GetTableSelect(nTab)) + rMark.SelectTable( nTab, FALSE ); + } + } + } + + ScPrintOptions aNewOptions; + aNewOptions.SetSkipEmpty( !bIncludeEmptyPages ); + aNewOptions.SetAllSheets( !bSelectedSheetsOnly ); + rStatus.SetOptions( aNewOptions ); + + // "PrintRange" enables (1) or disables (0) the "PageRange" edit + if ( nPrintRange == 1 ) + rPagesStr = aPageRange; + else + rPagesStr.Erase(); + return bDone; } sal_Int32 SAL_CALL ScModelObj::getRendererCount( const uno::Any& aSelection, - const uno::Sequence<beans::PropertyValue>& /* xOptions */ ) + const uno::Sequence<beans::PropertyValue>& rOptions ) throw (lang::IllegalArgumentException, uno::RuntimeException) { ScUnoGuard aGuard; @@ -679,7 +902,8 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount( const uno::Any& aSelection, ScMarkData aMark; ScPrintSelectionStatus aStatus; - if ( !FillRenderMarkData( aSelection, aMark, aStatus ) ) + String aPagesStr; + if ( !FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr ) ) return 0; // The same ScPrintFuncCache object in pPrintFuncCache is used as long as @@ -691,11 +915,37 @@ sal_Int32 SAL_CALL ScModelObj::getRendererCount( const uno::Any& aSelection, delete pPrintFuncCache; pPrintFuncCache = new ScPrintFuncCache( pDocShell, aMark, aStatus ); } - return pPrintFuncCache->GetPageCount(); + sal_Int32 nPages = pPrintFuncCache->GetPageCount(); + + sal_Int32 nSelectCount = nPages; + if ( aPagesStr.Len() ) + { + MultiSelection aPageRanges( aPagesStr ); + aPageRanges.SetTotalRange( Range( 1, nPages ) ); + nSelectCount = aPageRanges.GetSelectCount(); + } + return nSelectCount; } -uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 nRenderer, - const uno::Any& aSelection, const uno::Sequence<beans::PropertyValue>& /* xOptions */ ) +sal_Int32 lcl_GetRendererNum( sal_Int32 nSelRenderer, const String& rPagesStr, sal_Int32 nTotalPages ) +{ + if ( !rPagesStr.Len() ) + return nSelRenderer; + + MultiSelection aPageRanges( rPagesStr ); + aPageRanges.SetTotalRange( Range( 1, nTotalPages ) ); + + sal_Int32 nSelected = aPageRanges.FirstSelected(); + while ( nSelRenderer > 0 ) + { + nSelected = aPageRanges.NextSelected(); + --nSelRenderer; + } + return nSelected - 1; // selection is 1-based +} + +uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 nSelRenderer, + const uno::Any& aSelection, const uno::Sequence<beans::PropertyValue>& rOptions ) throw (lang::IllegalArgumentException, uno::RuntimeException) { ScUnoGuard aGuard; @@ -704,7 +954,8 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 ScMarkData aMark; ScPrintSelectionStatus aStatus; - if ( !FillRenderMarkData( aSelection, aMark, aStatus ) ) + String aPagesStr; + if ( !FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr ) ) throw lang::IllegalArgumentException(); if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) ) @@ -713,8 +964,33 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 pPrintFuncCache = new ScPrintFuncCache( pDocShell, aMark, aStatus ); } long nTotalPages = pPrintFuncCache->GetPageCount(); + sal_Int32 nRenderer = lcl_GetRendererNum( nSelRenderer, aPagesStr, nTotalPages ); if ( nRenderer >= nTotalPages ) - throw lang::IllegalArgumentException(); + { + if ( nSelRenderer == 0 ) + { + // getRenderer(0) is used to query the settings, so it must always return something + + SCTAB nCurTab = 0; //! use current sheet from view? + ScPrintFunc aDefaultFunc( pDocShell, pDocShell->GetPrinter(), nCurTab ); + Size aTwips = aDefaultFunc.GetPageSize(); + awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( aTwips.Height() ) ); + + uno::Sequence<beans::PropertyValue> aSequence(1); + beans::PropertyValue* pArray = aSequence.getArray(); + pArray[0].Name = rtl::OUString::createFromAscii( SC_UNONAME_PAGESIZE ); + pArray[0].Value <<= aPageSize; + + if( ! pPrinterOptions ) + pPrinterOptions = new ScPrintUIOptions; + else + pPrinterOptions->SetDefaults(); + pPrinterOptions->appendPrintUIOptions( aSequence ); + return aSequence; + } + else + throw lang::IllegalArgumentException(); + } // printer is used as device (just for page layout), draw view is not needed @@ -728,7 +1004,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 pSelRange = &aRange; } ScPrintFunc aFunc( pDocShell, pDocShell->GetPrinter(), nTab, - pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange ); + pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions() ); aFunc.SetRenderFlag( TRUE ); Range aPageRange( nRenderer+1, nRenderer+1 ); @@ -759,10 +1035,21 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScModelObj::getRenderer( sal_Int32 pArray[1].Name = rtl::OUString::createFromAscii( SC_UNONAME_SOURCERANGE ); pArray[1].Value <<= aRangeAddress; } + + #if 0 + const ScPrintOptions& rPrintOpt = + #endif + // FIXME: is this for side effects ? + SC_MOD()->GetPrintOptions(); + if( ! pPrinterOptions ) + pPrinterOptions = new ScPrintUIOptions; + else + pPrinterOptions->SetDefaults(); + pPrinterOptions->appendPrintUIOptions( aSequence ); return aSequence; } -void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelection, +void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelection, const uno::Sequence<beans::PropertyValue>& rOptions ) throw(lang::IllegalArgumentException, uno::RuntimeException) { @@ -772,7 +1059,8 @@ void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelectio ScMarkData aMark; ScPrintSelectionStatus aStatus; - if ( !FillRenderMarkData( aSelection, aMark, aStatus ) ) + String aPagesStr; + if ( !FillRenderMarkData( aSelection, rOptions, aMark, aStatus, aPagesStr ) ) throw lang::IllegalArgumentException(); if ( !pPrintFuncCache || !pPrintFuncCache->IsSameSelection( aStatus ) ) @@ -781,6 +1069,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelectio pPrintFuncCache = new ScPrintFuncCache( pDocShell, aMark, aStatus ); } long nTotalPages = pPrintFuncCache->GetPageCount(); + sal_Int32 nRenderer = lcl_GetRendererNum( nSelRenderer, aPagesStr, nTotalPages ); if ( nRenderer >= nTotalPages ) throw lang::IllegalArgumentException(); @@ -815,7 +1104,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelectio // to increase performance, ScPrintState might be used here for subsequent // pages of the same sheet - ScPrintFunc aFunc( pDev, pDocShell, nTab, pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange ); + ScPrintFunc aFunc( pDev, pDocShell, nTab, pPrintFuncCache->GetFirstAttr(nTab), nTotalPages, pSelRange, &aStatus.GetOptions() ); aFunc.SetDrawView( pDrawView ); aFunc.SetRenderFlag( TRUE ); if( aStatus.GetMode() == SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS ) @@ -829,11 +1118,11 @@ void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelectio long nDisplayStart = pPrintFuncCache->GetDisplayStart( nTab ); long nTabStart = pPrintFuncCache->GetTabStart( nTab ); + vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() ); if ( nRenderer == nTabStart ) { // first page of a sheet: add outline item for the sheet name - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() ); if ( pPDFData && pPDFData->GetIsExportBookmarks() ) { // the sheet starts at the top of the page @@ -846,7 +1135,7 @@ void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelectio } //--->i56629 // add the named destination stuff - if( pPDFData->GetIsExportNamedDestinations() ) + if( pPDFData && pPDFData->GetIsExportNamedDestinations() ) { Rectangle aArea( pDev->PixelToLogic( Rectangle( 0,0,0,0 ) ) ); String aTabName; @@ -861,7 +1150,6 @@ void SAL_CALL ScModelObj::render( sal_Int32 nRenderer, const uno::Any& aSelectio // resolve the hyperlinks for PDF export - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pDev->GetExtOutDevData() ); if ( pPDFData ) { // iterate over the hyperlinks that were output for this page diff --git a/sc/source/ui/view/olkact.cxx b/sc/source/ui/view/olkact.cxx index 31f5297e92fe..3feb69044f43 100644 --- a/sc/source/ui/view/olkact.cxx +++ b/sc/source/ui/view/olkact.cxx @@ -229,7 +229,7 @@ //#define _SVDLAYER_HXX //#define _SVDRAG_HXX #define _SVINCVW_HXX -#define _SV_MULTISEL_HXX +//#define _SV_MULTISEL_HXX #define _SVRTV_HXX #define _SVTABBX_HXX diff --git a/sc/source/ui/view/pfuncache.cxx b/sc/source/ui/view/pfuncache.cxx index 4712b6a3cf85..ef014bd90f79 100644 --- a/sc/source/ui/view/pfuncache.cxx +++ b/sc/source/ui/view/pfuncache.cxx @@ -75,7 +75,7 @@ ScPrintFuncCache::ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark, long nThisTab = 0; if ( rMark.GetTableSelect( nTab ) ) { - ScPrintFunc aFunc( pDocSh, pPrinter, nTab, nAttrPage, 0, pSelRange ); + ScPrintFunc aFunc( pDocSh, pPrinter, nTab, nAttrPage, 0, pSelRange, &aSelection.GetOptions() ); nThisTab = aFunc.GetTotalPages(); nFirstAttr[nTab] = aFunc.GetFirstPageNo(); // from page style or previous sheet } @@ -113,7 +113,7 @@ void ScPrintFuncCache::InitLocations( const ScMarkData& rMark, OutputDevice* pDe { if ( rMark.GetTableSelect( nTab ) ) { - ScPrintFunc aFunc( pDev, pDocSh, nTab, nFirstAttr[nTab], nTotalPages, pSelRange ); + ScPrintFunc aFunc( pDev, pDocSh, nTab, nFirstAttr[nTab], nTotalPages, pSelRange, &aSelection.GetOptions() ); aFunc.SetRenderFlag( TRUE ); long nDisplayStart = GetDisplayStart( nTab ); diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx index 157f4bffa4ec..c5266b166151 100644 --- a/sc/source/ui/view/prevwsh2.cxx +++ b/sc/source/ui/view/prevwsh2.cxx @@ -67,7 +67,7 @@ //#define _FSYS_HXX //#define _STREAM_HXX #define _CACHESTR_HXX -#define _SV_MULTISEL_HXX +//#define _SV_MULTISEL_HXX //SV //#define _CLIP_HXX *** diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index b7b8b9fbadf6..4a122e5529db 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -2043,7 +2043,10 @@ long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, BOOL bDoPrint, ScPr } if ( pPrinter && bDoPrint ) - pPrinter->StartPage(); + { + DBG_ERROR( "StartPage does not exist anymore" ); + // pPrinter->StartPage(); + } if ( bDoPrint || pLocationData ) { @@ -2064,7 +2067,10 @@ long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, BOOL bDoPrint, ScPr long nCount = DoNotes( nNoteStart, bDoPrint, pLocationData ); if ( pPrinter && bDoPrint ) - pPrinter->EndPage(); + { + DBG_ERROR( "EndPage does not exist anymore" ); + // pPrinter->EndPage(); + } return nCount; } @@ -2126,7 +2132,10 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO } if ( pPrinter && bDoPrint ) - pPrinter->StartPage(); + { + DBG_ERROR( "StartPage does not exist anymore" ); + // pPrinter->StartPage(); + } // Kopf- und Fusszeilen (ohne Zentrierung) @@ -2408,7 +2417,10 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO } if ( pPrinter && bDoPrint ) - pPrinter->EndPage(); + { + DBG_ERROR( "EndPage does not exist anymore" ); + // pPrinter->EndPage(); + } aLastSourceRange = ScRange( nX1, nY1, nPrintTab, nX2, nY2, nPrintTab ); bSourceRangeValid = TRUE; diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 9dda9a097395..918d4114fa3b 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -142,7 +142,7 @@ #define _SVDRAG_HXX #define _SVINCVW_HXX -#define _SV_MULTISEL_HXX +//#define _SV_MULTISEL_HXX #define _SVRTV_HXX #define _SVTABBX_HXX #define _SVTREEBOX_HXX |