diff options
-rw-r--r-- | sc/inc/printopt.hxx | 76 | ||||
-rw-r--r-- | sc/inc/scmod.hxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/documen2.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/documen8.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/tool/makefile.mk | 6 | ||||
-rw-r--r-- | sc/source/core/tool/printopt.cxx | 265 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 41 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 57 | ||||
-rw-r--r-- | sc/source/ui/inc/optdlg.hrc | 12 | ||||
-rw-r--r-- | sc/source/ui/inc/prevwsh.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/printfun.hxx | 16 | ||||
-rw-r--r-- | sc/source/ui/inc/tabvwsh.hxx | 5 | ||||
-rw-r--r-- | sc/source/ui/inc/tpprint.hxx | 47 | ||||
-rw-r--r-- | sc/source/ui/optdlg/makefile.mk | 6 | ||||
-rw-r--r-- | sc/source/ui/optdlg/tpprint.cxx | 135 | ||||
-rw-r--r-- | sc/source/ui/src/optdlg.src | 46 | ||||
-rw-r--r-- | sc/source/ui/unoobj/confuno.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/preview.cxx | 25 | ||||
-rw-r--r-- | sc/source/ui/view/prevwsh.cxx | 16 | ||||
-rw-r--r-- | sc/source/ui/view/prevwsh2.cxx | 5 | ||||
-rw-r--r-- | sc/source/ui/view/printfun.cxx | 27 | ||||
-rw-r--r-- | sc/source/ui/view/tabview2.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/tabvwsh4.cxx | 12 |
23 files changed, 476 insertions, 357 deletions
diff --git a/sc/inc/printopt.hxx b/sc/inc/printopt.hxx index ec4624e0f679..2cc9955dabec 100644 --- a/sc/inc/printopt.hxx +++ b/sc/inc/printopt.hxx @@ -2,9 +2,9 @@ * * $RCSfile: printopt.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:49 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:31:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,8 +62,78 @@ #ifndef SC_PRINTOPT_HXX #define SC_PRINTOPT_HXX -#error printopt.hxx nicht mehr verwenden! +#ifndef _SFXPOOLITEM_HXX +#include <svtools/poolitem.hxx> +#endif + +#ifndef _UTL_CONFIGITEM_HXX_ +#include <unotools/configitem.hxx> +#endif + + +class ScPrintOptions +{ +private: + BOOL bSkipEmpty; + BOOL bAllSheets; + +public: + ScPrintOptions(); + ScPrintOptions( const ScPrintOptions& rCpy ); + ~ScPrintOptions(); + + BOOL GetSkipEmpty() const { return bSkipEmpty; } + void SetSkipEmpty( BOOL bVal ) { bSkipEmpty = bVal; } + BOOL GetAllSheets() const { return bAllSheets; } + void SetAllSheets( BOOL bVal ) { bAllSheets = bVal; } + + void SetDefaults(); + + const ScPrintOptions& operator= ( const ScPrintOptions& rCpy ); + int operator== ( const ScPrintOptions& rOpt ) const; + int operator!= ( const ScPrintOptions& rOpt ) const; +}; + +//================================================================== +// item for the dialog / options page +//================================================================== + +class ScTpPrintItem : public SfxPoolItem +{ +public: + TYPEINFO(); + ScTpPrintItem( USHORT nWhich ); + ScTpPrintItem( USHORT nWhich, + const ScPrintOptions& rOpt ); + ScTpPrintItem( const ScTpPrintItem& rItem ); + ~ScTpPrintItem(); + + virtual String GetValueText() const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + const ScPrintOptions& GetPrintOptions() const { return theOptions; } + +private: + ScPrintOptions theOptions; +}; + +//================================================================== +// config item +//================================================================== + +class ScPrintCfg : public ScPrintOptions, public utl::ConfigItem +{ + com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); + +public: + ScPrintCfg(); + + void SetOptions( const ScPrintOptions& rNew ); + void OptionsChanged(); // after direct access to ScPrintOptions base class + virtual void Commit(); +}; #endif diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 63eb75918d67..76af5ad22d6d 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -2,9 +2,9 @@ * * $RCSfile: scmod.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: nn $ $Date: 2001-05-04 15:38:13 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:31:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -99,10 +99,12 @@ class ScViewCfg; class ScDocCfg; class ScAppCfg; class ScInputCfg; +class ScPrintCfg; class ScViewOptions; class ScDocOptions; class ScAppOptions; class ScInputOptions; +class ScPrintOptions; class ScInputHandler; class ScInputWindow; class ScTabViewShell; @@ -160,6 +162,7 @@ class ScModule: public ScModuleDummy, public SfxListener ScDocCfg* pDocCfg; ScAppCfg* pAppCfg; ScInputCfg* pInputCfg; + ScPrintCfg* pPrintCfg; ScNavipiCfg* pNavipiCfg; SfxErrorHandler* pErrorHdl; SvxErrorHandler* pSvxErrorHdl; @@ -218,10 +221,12 @@ public: const ScDocOptions& GetDocOptions (); const ScAppOptions& GetAppOptions (); const ScInputOptions& GetInputOptions (); + const ScPrintOptions& GetPrintOptions (); void SetViewOptions ( const ScViewOptions& rOpt ); void SetDocOptions ( const ScDocOptions& rOpt ); void SetAppOptions ( const ScAppOptions& rOpt ); void SetInputOptions ( const ScInputOptions& rOpt ); + void SetPrintOptions ( const ScPrintOptions& rOpt ); void InsertEntryToLRUList(USHORT nFIndex); void RecentFunctionsChanged(); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 267827cd5a15..b7f8b64dd6ee 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: documen2.cxx,v $ * - * $Revision: 1.18 $ + * $Revision: 1.19 $ * - * last change: $Author: er $ $Date: 2001-04-21 20:30:51 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:32:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -855,6 +855,7 @@ BOOL ScDocument::Load( SvStream& rStream, ScProgress* pProgress ) SfxItemSet* pSet = new SfxItemSet( *xPoolHelper->GetDocPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, NULL ); SetPrinter( SfxPrinter::Create( rStream, pSet ) ); } diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx index 7f29059cf916..08a06125aa19 100644 --- a/sc/source/core/data/documen8.cxx +++ b/sc/source/core/data/documen8.cxx @@ -2,9 +2,9 @@ * * $RCSfile: documen8.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: dr $ $Date: 2001-04-05 10:46:04 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:32:55 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -205,6 +205,7 @@ SfxPrinter* ScDocument::GetPrinter() new SfxItemSet( *xPoolHelper->GetDocPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, NULL ); SfxMiscCfg* pOffCfg = SFX_APP()->GetMiscConfig(); diff --git a/sc/source/core/tool/makefile.mk b/sc/source/core/tool/makefile.mk index 0252320ae3f1..4bf5ebc398ad 100644 --- a/sc/source/core/tool/makefile.mk +++ b/sc/source/core/tool/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.5 $ +# $Revision: 1.6 $ # -# last change: $Author: er $ $Date: 2001-04-21 20:23:54 $ +# last change: $Author: nn $ $Date: 2001-05-29 19:33:50 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -125,6 +125,7 @@ CXXFILES = \ viewopti.cxx \ inputopt.cxx \ filtopt.cxx \ + printopt.cxx \ optutil.cxx \ zforauto.cxx \ hints.cxx \ @@ -181,6 +182,7 @@ SLOFILES = \ $(SLO)$/viewopti.obj \ $(SLO)$/inputopt.obj \ $(SLO)$/filtopt.obj \ + $(SLO)$/printopt.obj \ $(SLO)$/optutil.obj \ $(SLO)$/zforauto.obj \ $(SLO)$/hints.obj \ diff --git a/sc/source/core/tool/printopt.cxx b/sc/source/core/tool/printopt.cxx index 8b283b8d5f81..5af0138914de 100644 --- a/sc/source/core/tool/printopt.cxx +++ b/sc/source/core/tool/printopt.cxx @@ -2,9 +2,9 @@ * * $RCSfile: printopt.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-19 00:16:18 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:33:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,233 +65,188 @@ #pragma hdrstop -#include <segmentc.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> -#include <tlstream.hxx> -#include "cfgids.hxx" #include "printopt.hxx" -#include "scresid.hxx" -#include "sc.hrc" +#include "miscuno.hxx" -// STATIC DATA ----------------------------------------------------------- +using namespace utl; +using namespace rtl; +using namespace com::sun::star::uno; -#define SC_VERSION ((USHORT)251) +// ----------------------------------------------------------------------- TYPEINIT1(ScTpPrintItem, SfxPoolItem); -SEG_EOFGLOBALS() - -//======================================================================== -// ScPrintOptions - Dokument-Optionen -//======================================================================== -#pragma SEG_FUNCDEF(printopt_01) +// ----------------------------------------------------------------------- ScPrintOptions::ScPrintOptions() { SetDefaults(); } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_02) - -ScPrintOptions::ScPrintOptions( const ScPrintOptions& rCpy ) - : bWarnPrinterNotFound( rCpy.bWarnPrinterNotFound ), - bWarnPageSize( rCpy.bWarnPageSize ), - bWarnOrientation( rCpy.bWarnOrientation ) +ScPrintOptions::ScPrintOptions( const ScPrintOptions& rCpy ) : + bSkipEmpty( rCpy.bSkipEmpty ), + bAllSheets( rCpy.bAllSheets ) { } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_03) - -__EXPORT ScPrintOptions::~ScPrintOptions() +ScPrintOptions::~ScPrintOptions() { } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_04) - -SvStream& operator>>( SvStream& rStream, ScPrintOptions& rOpt ) +void ScPrintOptions::SetDefaults() { - rStream >> rOpt.bWarnPrinterNotFound; - rStream >> rOpt.bWarnPageSize; - rStream >> rOpt.bWarnOrientation; - - return rStream; + bSkipEmpty = FALSE; + bAllSheets = TRUE; } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_05) - -SvStream& operator<<( SvStream& rStream, const ScPrintOptions& rOpt ) +const ScPrintOptions& ScPrintOptions::operator=( const ScPrintOptions& rCpy ) { - rStream << rOpt.bWarnPrinterNotFound; - rStream << rOpt.bWarnPageSize; - rStream << rOpt.bWarnOrientation; - - return rStream; + bSkipEmpty = rCpy.bSkipEmpty; + bAllSheets = rCpy.bAllSheets; + return *this; } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_06) +inline int ScPrintOptions::operator==( const ScPrintOptions& rOpt ) const +{ + return bSkipEmpty == rOpt.bSkipEmpty + && bAllSheets == rOpt.bAllSheets; +} -void ScPrintOptions::SetDefaults() +inline int ScPrintOptions::operator!=( const ScPrintOptions& rOpt ) const { - bWarnPrinterNotFound = TRUE; - bWarnPageSize = FALSE; - bWarnOrientation = FALSE; + return !(operator==(rOpt)); } -//======================================================================== -// ScTpPrintItem - Daten fuer die PrintOptions-TabPage -//======================================================================== -#pragma SEG_FUNCDEF(printopt_07) +// ----------------------------------------------------------------------- ScTpPrintItem::ScTpPrintItem( USHORT nWhich ) : SfxPoolItem( nWhich ) { } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_08) - -ScTpPrintItem::ScTpPrintItem( USHORT nWhich, const ScPrintOptions& rOpt ) - : SfxPoolItem ( nWhich ), - theOptions ( rOpt ) +ScTpPrintItem::ScTpPrintItem( USHORT nWhich, const ScPrintOptions& rOpt ) : + SfxPoolItem ( nWhich ), + theOptions ( rOpt ) { } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_09) - -ScTpPrintItem::ScTpPrintItem( const ScTpPrintItem& rItem ) - : SfxPoolItem ( rItem ), - theOptions ( rItem.theOptions ) +ScTpPrintItem::ScTpPrintItem( const ScTpPrintItem& rItem ) : + SfxPoolItem ( rItem ), + theOptions ( rItem.theOptions ) { } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_0a) - -__EXPORT ScTpPrintItem::~ScTpPrintItem() +ScTpPrintItem::~ScTpPrintItem() { } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_0b) - -String __EXPORT ScTpPrintItem::GetValueText() const +String ScTpPrintItem::GetValueText() const { - return "ScTpPrintItem"; + return String::CreateFromAscii( "ScTpPrintItem" ); } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_0c) - -int __EXPORT ScTpPrintItem::operator==( const SfxPoolItem& rItem ) const +int ScTpPrintItem::operator==( const SfxPoolItem& rItem ) const { DBG_ASSERT( SfxPoolItem::operator==( rItem ), "unequal Which or Type" ); const ScTpPrintItem& rPItem = (const ScTpPrintItem&)rItem; - return ( theOptions == rPItem.theOptions ); } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_0d) - -SfxPoolItem* __EXPORT ScTpPrintItem::Clone( SfxItemPool * ) const +SfxPoolItem* ScTpPrintItem::Clone( SfxItemPool * ) const { return new ScTpPrintItem( *this ); } -//================================================================== -// CfgItem fuer Print-Optionen -//================================================================== -#pragma SEG_FUNCDEF(printopt_12) +// ----------------------------------------------------------------------- -ScPrintCfg::ScPrintCfg() : SfxConfigItem( SCCFG_PRINT ) -{ -} +#define CFGPATH_PRINT "Office.Calc/Print" -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_0e) +#define SCPRINTOPT_EMPTYPAGES 0 +#define SCPRINTOPT_ALLSHEETS 1 +#define SCPRINTOPT_COUNT 2 -int __EXPORT ScPrintCfg::Load( SvStream& rStream ) +Sequence<OUString> ScPrintCfg::GetPropertyNames() { - USHORT nVersion; + static const char* aPropNames[] = + { + "Page/EmptyPages", // SCPRINTOPT_EMPTYPAGES + "Other/AllSheets" // SCPRINTOPT_ALLSHEETS + }; + Sequence<OUString> aNames(SCPRINTOPT_COUNT); + OUString* pNames = aNames.getArray(); + for(int i = 0; i < SCPRINTOPT_COUNT; i++) + pNames[i] = OUString::createFromAscii(aPropNames[i]); - rStream >> nVersion; - rStream >> (ScPrintOptions&)*this; - - SetDefault( FALSE ); + return aNames; +} - return ( nVersion == SC_VERSION ) - ? SfxConfigItem::ERR_OK - : SfxConfigItem::WARNING_VERSION; +ScPrintCfg::ScPrintCfg() : + ConfigItem( OUString::createFromAscii( CFGPATH_PRINT ) ) +{ + Sequence<OUString> aNames = GetPropertyNames(); + Sequence<Any> aValues = GetProperties(aNames); +// EnableNotification(aNames); + const Any* pValues = aValues.getConstArray(); + DBG_ASSERT(aValues.getLength() == aNames.getLength(), "GetProperties failed") + if(aValues.getLength() == aNames.getLength()) + { + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + DBG_ASSERT(pValues[nProp].hasValue(), "property value missing") + if(pValues[nProp].hasValue()) + { + switch(nProp) + { + case SCPRINTOPT_EMPTYPAGES: + // reversed + SetSkipEmpty( !ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + case SCPRINTOPT_ALLSHEETS: + SetAllSheets( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); + break; + } + } + } + } } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_11) -BOOL SEXPORT ScPrintCfg::Store( SvStream& rStream) +void ScPrintCfg::Commit() { - rStream << SC_VERSION; - rStream << *this; + Sequence<OUString> aNames = GetPropertyNames(); + OUString* pNames = aNames.getArray(); + Sequence<Any> aValues(aNames.getLength()); + Any* pValues = aValues.getArray(); - SetDefault( FALSE ); - - return SfxConfigItem::ERR_OK; + const Type& rType = ::getBooleanCppuType(); + for(int nProp = 0; nProp < aNames.getLength(); nProp++) + { + switch(nProp) + { + case SCPRINTOPT_EMPTYPAGES: + // reversed + ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], !GetSkipEmpty() ); + break; + case SCPRINTOPT_ALLSHEETS: + ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetAllSheets() ); + break; + } + } + PutProperties(aNames, aValues); } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_0f) - -void __EXPORT ScPrintCfg::UseDefault() +void ScPrintCfg::SetOptions( const ScPrintOptions& rNew ) { - SetDefaults(); - SetDefault( TRUE ); + *(ScPrintOptions*)this = rNew; + SetModified(); } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(printopt_10) - -String __EXPORT ScPrintCfg::GetName() const +void ScPrintCfg::OptionsChanged() { - return String( ScResId( SCSTR_CFG_PRINT ) ); + SetModified(); } -/*------------------------------------------------------------------------ - - $Log: not supported by cvs2svn $ - Revision 1.8 2000/09/17 14:08:42 willem.vandorp - OpenOffice header added. - - Revision 1.7 2000/08/31 16:38:03 willem.vandorp - Header and footer replaced - - Revision 1.6 1997/11/13 20:05:36 NN - ifndef PCH raus - - - Rev 1.5 13 Nov 1997 21:05:36 NN - ifndef PCH raus - - Rev 1.4 06 Nov 1996 09:48:56 TRI - includes - - Rev 1.3 17 Nov 1995 14:49:44 MO - SetModified entfernt - - Rev 1.2 16 Nov 1995 20:41:44 MO - SetDefault()/SetModified im Load/Save - - Rev 1.1 09 Oct 1995 11:49:02 MO - ResId -> ScResId - - Rev 1.0 18 Sep 1995 17:04:30 MO - Initial revision. - -------------------------------------------------------------------------*/ - -#pragma SEG_EOFMODULE diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 7df4dcc76699..22cb466f8d2c 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2,9 +2,9 @@ * * $RCSfile: scmod.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: er $ $Date: 2001-05-16 10:59:32 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:34:53 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -104,6 +104,7 @@ #include "docoptio.hxx" #include "appoptio.hxx" #include "inputopt.hxx" +#include "printopt.hxx" #include "navicfg.hxx" #include "tabvwsh.hxx" #include "docsh.hxx" @@ -122,6 +123,7 @@ #include "tpview.hxx" #include "tpusrlst.hxx" #include "tpcalc.hxx" +#include "tpprint.hxx" #include "opredlin.hxx" #include "transobj.hxx" @@ -156,6 +158,7 @@ ScModule::ScModule( SfxObjectFactory* pFact ) : pDocCfg( NULL ), pAppCfg( NULL ), pInputCfg( NULL ), + pPrintCfg( NULL ), pNavipiCfg( NULL ), pTeamDlg( NULL ), nCurRefDlgId( 0 ), @@ -231,6 +234,7 @@ void ScModule::DeleteCfg() DELETEZ( pDocCfg ); DELETEZ( pAppCfg ); DELETEZ( pInputCfg ); + DELETEZ( pPrintCfg ); DELETEZ( pNavipiCfg ); } @@ -786,6 +790,22 @@ const ScInputOptions& ScModule::GetInputOptions() return *pInputCfg; } +void ScModule::SetPrintOptions( const ScPrintOptions& rOpt ) +{ + if ( !pPrintCfg ) + pPrintCfg = new ScPrintCfg; + + pPrintCfg->SetOptions( rOpt ); +} + +const ScPrintOptions& ScModule::GetPrintOptions() +{ + if ( !pPrintCfg ) + pPrintCfg = new ScPrintCfg; + + return *pPrintCfg; +} + ScNavipiCfg& ScModule::GetNavipiCfg() { if ( !pNavipiCfg ) @@ -1107,6 +1127,19 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) } } + //============================================ + // PrintOptions + //============================================ + + if ( IS_AVAILABLE(SID_SCPRINTOPTIONS,pItem) ) + { + const ScPrintOptions& rNewOpt = ((const ScTpPrintItem*)pItem)->GetPrintOptions(); + SetPrintOptions( rNewOpt ); + + // broadcast causes all previews to recalc page numbers + SFX_APP()->Broadcast( SfxSimpleHint( SID_SCPRINTOPTIONS ) ); + } + //---------------------------------------------------------- // if ( bSaveSpellCheck ) @@ -1826,6 +1859,9 @@ SfxItemSet* ScModule::CreateItemSet( USHORT nId ) pRet->Put( SfxBoolItem( SID_SC_INPUT_TEXTWYSIWYG, rInpOpt.GetTextWysiwyg() ) ); + // RID_SC_TP_PRINT + pRet->Put( ScTpPrintItem( SID_SCPRINTOPTIONS, GetPrintOptions() ) ); + // TP_GRID SvxGridItem* pSvxGridItem = aViewOpt.CreateGridItem(); pRet->Put( *pSvxGridItem ); @@ -1859,6 +1895,7 @@ SfxTabPage* ScModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItem case SID_SC_TP_USERLISTS: pRet = ScTpUserLists::Create(pParent, rSet); break; case SID_SC_TP_CALC: pRet = ScTpCalcOptions::Create(pParent, rSet); break; case SID_SC_TP_CHANGES: pRet = ScRedlineOptionsTabPage::Create(pParent, rSet); break; + case RID_SC_TP_PRINT: pRet = ScTpPrintOptions::Create(pParent, rSet); break; } DBG_ASSERT(pRet, "Id unbekannt") return pRet; diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index c867147e88b6..6772b8a8b8af 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2,9 +2,9 @@ * * $RCSfile: docsh4.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: nn $ $Date: 2001-05-14 10:06:55 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:36:04 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -143,6 +143,7 @@ #include "undostyl.hxx" #include "rangeseq.hxx" #include "chgtrack.hxx" +#include "printopt.hxx" //------------------------------------------------------------------ @@ -1560,6 +1561,16 @@ void ScDocShell::PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData //! Selection etc. mit Print() zusammenfassen !!! //! Seiten nur einmal zaehlen + // get settings from print options sub-dialog + ScPrintOptions aOptions; + const SfxItemSet& rOptionSet = pPrinter->GetOptions(); + const SfxPoolItem* pItem; + BOOL bHasOptions = ( rOptionSet.GetItemState(SID_SCPRINTOPTIONS, FALSE, &pItem) == SFX_ITEM_SET ); + if (bHasOptions) + aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions(); + else + aOptions = SC_MOD()->GetPrintOptions(); // use configuration + BOOL bAllTabs = TRUE; USHORT nTabCount = aDocument.GetTableCount(); USHORT nTab; @@ -1567,7 +1578,7 @@ void ScDocShell::PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData long aPageArr[MAXTAB+1]; // Seiten pro Tabelle for ( nTab=0; nTab<nTabCount; nTab++ ) // nPages und nTotalPages ermitteln { - ScPrintFunc aPrintFunc( this, pPrinter, nTab ); + ScPrintFunc aPrintFunc( this, pPrinter, nTab, 0,0,NULL, &aOptions ); long nThisTab = aPrintFunc.GetTotalPages(); aPageArr[nTab] = nThisTab; nTotalPages += nThisTab; @@ -1589,13 +1600,17 @@ void ScDocShell::PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData break; } + if ( !aOptions.GetAllSheets() ) // option "only selected sheets" - also for ALL and RANGE + bAllTabs = FALSE; + if (!bAllTabs) // Gesamt-Seitenzahl bei Selektion { nTotalPages = 0; for (nTab=0; nTab<nTabCount; nTab++) if ( !pMarkData || pMarkData->GetTableSelect(nTab) ) nTotalPages += aPageArr[nTab]; - aPageRanges.Select( Range(1,nTotalPages) ); + if ( eDlgOption != PRINTDIALOG_RANGE ) + aPageRanges.Select( Range(1,nTotalPages) ); } BOOL bFound = FALSE; // erste Seite gefunden @@ -1604,8 +1619,6 @@ void ScDocShell::PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData { if ( bAllTabs || !pMarkData || pMarkData->GetTableSelect( nTab ) ) { - ScPrintFunc aPrintFunc( this, pPrinter, nTab ); - long nNext = nTabStart + aPageArr[nTab]; BOOL bSelected = FALSE; for (long nP=nTabStart+1; nP<=nNext; nP++) // 1-basiert @@ -1614,6 +1627,8 @@ void ScDocShell::PreparePrint( PrintDialog* pPrintDialog, ScMarkData* pMarkData if (bSelected) { + ScPrintFunc aPrintFunc( this, pPrinter, nTab ); + aPrintFunc.ApplyPrintSettings(); // dann Settings fuer diese Tabelle bFound = TRUE; } @@ -1673,6 +1688,16 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, ScRange* pMarkedRange = NULL; + // get settings from print options sub-dialog + ScPrintOptions aOptions; + const SfxItemSet& rOptionSet = pPrinter->GetOptions(); + const SfxPoolItem* pItem; + BOOL bHasOptions = ( rOptionSet.GetItemState(SID_SCPRINTOPTIONS, FALSE, &pItem) == SFX_ITEM_SET ); + if (bHasOptions) + aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions(); + else + aOptions = SC_MOD()->GetPrintOptions(); // use configuration + BOOL bAllTabs = TRUE; USHORT nTabCount = aDocument.GetTableCount(); USHORT nTab; @@ -1680,7 +1705,7 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, long aPageArr[MAXTAB+1]; // Seiten pro Tabelle for ( nTab=0; nTab<nTabCount; nTab++ ) // nPages und nTotalPages ermitteln { - ScPrintFunc aPrintFunc( this, pPrinter, nTab ); + ScPrintFunc aPrintFunc( this, pPrinter, nTab, 0,0,NULL, &aOptions ); long nThisTab = aPrintFunc.GetTotalPages(); aPageArr[nTab] = nThisTab; nTotalPages += nThisTab; @@ -1712,13 +1737,17 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, //default: } + if ( !aOptions.GetAllSheets() ) // option "only selected sheets" - also for ALL and RANGE + bAllTabs = FALSE; + if (!bAllTabs) // Gesamt-Seitenzahl bei Selektion { nTotalPages = 0; for (nTab=0; nTab<nTabCount; nTab++) if ( !pMarkData || pMarkData->GetTableSelect(nTab) ) nTotalPages += aPageArr[nTab]; - aPageRanges.Select( Range(1,nTotalPages) ); + if ( eDlgOption != PRINTDIALOG_RANGE ) + aPageRanges.Select( Range(1,nTotalPages) ); } USHORT nCollateCopies = 1; @@ -1783,7 +1812,7 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, pDrawView->SetPrintPreview( TRUE ); } - ScPrintFunc aPrintFunc( this, pPrinter, nTab, nAttrPage, nTotalPages, pMarkedRange ); + ScPrintFunc aPrintFunc( this, pPrinter, nTab, nAttrPage, nTotalPages, pMarkedRange, &aOptions ); aPrintFunc.SetDrawView( pDrawView ); aPrintFunc.DoPrint( aPageRanges, nTabStart, nDisplayStart, &rProgress ); @@ -1818,6 +1847,16 @@ void ScDocShell::Print( SfxProgress& rProgress, PrintDialog* pPrintDialog, pOldJobSetup = NULL; } + if ( bHasOptions ) + { + // remove PrintOptions from printer ItemSet, + // so next time the options from the configuration are used + + SfxItemSet aSet( pPrinter->GetOptions() ); + aSet.ClearItem( SID_SCPRINTOPTIONS ); + pPrinter->SetOptions( aSet ); + } + PostPaintGridAll(); //! nur wenn geaendert } diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc index 5439518cfb52..6d3ce67276cd 100644 --- a/sc/source/ui/inc/optdlg.hrc +++ b/sc/source/ui/inc/optdlg.hrc @@ -2,9 +2,9 @@ * * $RCSfile: optdlg.hrc,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: er $ $Date: 2001-05-16 10:50:04 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:38:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -149,10 +149,10 @@ #define STR_COPYERR 9 // TP_PRINT: -#define BTN_WARNPAPERBIN 1 -#define BTN_WARNPAPERSIZE 2 -#define BTN_WARNPRINTERNOTFOUND 3 -#define GB_WARNINGS 4 +#define FL_PAGES 1 +#define BTN_SKIPEMPTYPAGES 2 +#define FL_SHEETS 2 +#define BTN_SELECTEDSHEETS 4 // TP_LCONTENT diff --git a/sc/source/ui/inc/prevwsh.hxx b/sc/source/ui/inc/prevwsh.hxx index 922e53211394..bb6dba71d176 100644 --- a/sc/source/ui/inc/prevwsh.hxx +++ b/sc/source/ui/inc/prevwsh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: prevwsh.hxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: sab $ $Date: 2001-05-03 10:23:16 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:38:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -152,6 +152,7 @@ public: virtual SfxPrinter* GetPrinter( BOOL bCreate = FALSE ); virtual USHORT SetPrinter( SfxPrinter* pNewPrinter, USHORT nDiffFlags = SFX_PRINTER_ALL ); virtual PrintDialog* CreatePrintDialog( Window* pParent ); + virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); virtual void PreparePrint( PrintDialog* pPrintDialog = NULL ); virtual USHORT Print( SfxProgress& rProgress, PrintDialog* pPrintDialog = NULL ); }; diff --git a/sc/source/ui/inc/printfun.hxx b/sc/source/ui/inc/printfun.hxx index 349e1f21c3de..0d2bdfd2002c 100644 --- a/sc/source/ui/inc/printfun.hxx +++ b/sc/source/ui/inc/printfun.hxx @@ -2,9 +2,9 @@ * * $RCSfile: printfun.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:00 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:38:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -86,6 +86,7 @@ class EditTextObject; class MultiSelection; class ScHeaderEditEngine; class ScPageBreakData; +class ScPrintOptions; class SvxBoxItem; class SvxBrushItem; class SvxShadowItem; @@ -268,14 +269,17 @@ public: ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, USHORT nTab, long nPage = 0, long nDocP = 0, const ScRange* pArea = NULL, + const ScPrintOptions* pOptions = NULL, ScPageBreakData* pData = NULL ); ScPrintFunc( ScDocShell* pShell, Window* pWindow, USHORT nTab, long nPage = 0, long nDocP = 0, - const ScRange* pArea = NULL ); + const ScRange* pArea = NULL, + const ScPrintOptions* pOptions = NULL ); ScPrintFunc( ScDocShell* pShell, Window* pWindow, - const ScPrintState& rState ); + const ScPrintState& rState, + const ScPrintOptions* pOptions ); ~ScPrintFunc(); @@ -317,8 +321,8 @@ public: #ifdef _PRINTFUN_CXX private: - void Construct(); - void InitParam(); + void Construct( const ScPrintOptions* pOptions ); + void InitParam( const ScPrintOptions* pOptions ); void CalcZoom( USHORT nRangeNo ); void CalcPages(); long CountPages(); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 3cc0de8d4ed8..d3660260b874 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tabvwsh.hxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: nn $ $Date: 2001-04-20 18:51:06 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:38:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -381,6 +381,7 @@ public: USHORT nDiffFlags = SFX_PRINTER_ALL ); virtual PrintDialog* CreatePrintDialog( Window* pParent ); + virtual SfxTabPage* CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ); virtual void PreparePrint( PrintDialog* pPrintDialog = NULL ); virtual ErrCode DoPrint( SfxPrinter *pPrinter, PrintDialog *pPrintDialog, diff --git a/sc/source/ui/inc/tpprint.hxx b/sc/source/ui/inc/tpprint.hxx index cd369d2df942..21f7a0fdd1dd 100644 --- a/sc/source/ui/inc/tpprint.hxx +++ b/sc/source/ui/inc/tpprint.hxx @@ -2,9 +2,9 @@ * * $RCSfile: tpprint.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:01 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:38:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -62,46 +62,33 @@ #ifndef SC_TPPRINT_HXX #define SC_TPPRINT_HXX -#ifndef _SFXTABDLG_HXX //autogen +#ifndef _SFXTABDLG_HXX #include <sfx2/tabdlg.hxx> #endif -#ifndef _SV_GROUP_HXX //autogen -#include <vcl/group.hxx> +#ifndef _SV_FIXED_HXX +#include <vcl/fixed.hxx> #endif //=================================================================== -class ScDocOptions; - class ScTpPrintOptions : public SfxTabPage { -public: - static SfxTabPage* Create ( Window* pParent, - const SfxItemSet& rCoreSet ); - static USHORT* GetRanges (); - virtual BOOL FillItemSet ( SfxItemSet& rCoreSet ); - virtual void Reset ( const SfxItemSet& rCoreSet ); - virtual int DeactivatePage ( SfxItemSet* pSet = NULL ); - -private: - ScTpPrintOptions( Window* pParent, - const SfxItemSet& rCoreSet ); - ~ScTpPrintOptions(); - -private: - CheckBox aBtnPrinterNotFound; - CheckBox aBtnPageSize; - CheckBox aBtnOrientation; - GroupBox aGbWarnings; + FixedLine aPagesFL; + CheckBox aSkipEmptyPagesCB; + FixedLine aSheetsFL; + CheckBox aSelectedSheetsCB; - const USHORT nWhichPrint; + ScTpPrintOptions( Window* pParent, const SfxItemSet& rCoreSet ); + ~ScTpPrintOptions(); -#ifdef _TPPRINT_CXX -#endif +public: + static SfxTabPage* Create( Window* pParent, const SfxItemSet& rCoreSet ); + static USHORT* GetRanges(); + virtual BOOL FillItemSet( SfxItemSet& rCoreSet ); + virtual void Reset( const SfxItemSet& rCoreSet ); + virtual int DeactivatePage( SfxItemSet* pSet = NULL ); }; - #endif - diff --git a/sc/source/ui/optdlg/makefile.mk b/sc/source/ui/optdlg/makefile.mk index 8503542a4917..409c3fa97016 100644 --- a/sc/source/ui/optdlg/makefile.mk +++ b/sc/source/ui/optdlg/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.2 $ +# $Revision: 1.3 $ # -# last change: $Author: os $ $Date: 2001-03-28 13:27:35 $ +# last change: $Author: nn $ $Date: 2001-05-29 19:40:15 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -85,12 +85,14 @@ CXXFILES = \ tpusrlst.cxx \ tpview.cxx \ tpcalc.cxx \ + tpprint.cxx \ opredlin.cxx SLOFILES = \ $(SLO)$/tpusrlst.obj \ $(SLO)$/tpview.obj \ $(SLO)$/tpcalc.obj \ + $(SLO)$/tpprint.obj \ $(SLO)$/opredlin.obj # --- Tagets ------------------------------------------------------- diff --git a/sc/source/ui/optdlg/tpprint.cxx b/sc/source/ui/optdlg/tpprint.cxx index b60544b6d5d4..b545d4446852 100644 --- a/sc/source/ui/optdlg/tpprint.cxx +++ b/sc/source/ui/optdlg/tpprint.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tpprint.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:45:03 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:40:15 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,28 +65,14 @@ #pragma hdrstop -#ifndef PCH -#include "scitems.hxx" -#include <sv.hxx> -#include <svtool.hxx> -#include <tools.hxx> -#include <sfx.hxx> -#include <segmentc.hxx> -#endif - +#include "tpprint.hxx" #include "printopt.hxx" -#include "uiitems.hxx" +#include "scmod.hxx" #include "scresid.hxx" - -#include "sc.hrc" // -> Slot-IDs +#include "sc.hrc" #include "optdlg.hrc" -#define _TPPRINT_CXX -#include "tpprint.hxx" -#undef _TPPRINT_CXX - - -// STATIC DATA ----------------------------------------------------------- +// ----------------------------------------------------------------------- static USHORT pPrintOptRanges[] = { @@ -95,52 +81,36 @@ static USHORT pPrintOptRanges[] = 0 }; -SEG_EOFGLOBALS() - -//======================================================================== -#pragma SEG_FUNCDEF(tpprint_01) +// ----------------------------------------------------------------------- ScTpPrintOptions::ScTpPrintOptions( Window* pParent, const SfxItemSet& rCoreAttrs ) : SfxTabPage ( pParent, ScResId( RID_SCPAGE_PRINT ), rCoreAttrs ), - aBtnPrinterNotFound ( this, ScResId( BTN_WARNPRINTERNOTFOUND ) ), - aBtnPageSize ( this, ScResId( BTN_WARNPAPERSIZE ) ), - aBtnOrientation ( this, ScResId( BTN_WARNPAPERBIN ) ), - aGbWarnings ( this, ScResId( GB_WARNINGS ) ), - nWhichPrint ( GetWhich( SID_SCPRINTOPTIONS ) ) + aPagesFL ( this, ResId( FL_PAGES ) ), + aSkipEmptyPagesCB( this, ResId( BTN_SKIPEMPTYPAGES ) ), + aSheetsFL ( this, ResId( FL_SHEETS ) ), + aSelectedSheetsCB( this, ResId( BTN_SELECTEDSHEETS ) ) { FreeResource(); } -//----------------------------------------------------------------------- -#pragma SEG_FUNCDEF(tpprint_02) - -__EXPORT ScTpPrintOptions::~ScTpPrintOptions() +ScTpPrintOptions::~ScTpPrintOptions() { } -//----------------------------------------------------------------------- -#pragma SEG_FUNCDEF(tpprint_03) - -USHORT* __EXPORT ScTpPrintOptions::GetRanges() +USHORT* ScTpPrintOptions::GetRanges() { return pPrintOptRanges; } -//----------------------------------------------------------------------- -#pragma SEG_FUNCDEF(tpprint_04) - -SfxTabPage* __EXPORT ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet ) +SfxTabPage* ScTpPrintOptions::Create( Window* pParent, const SfxItemSet& rAttrSet ) { - return ( new ScTpPrintOptions( pParent, rAttrSet ) ); + return new ScTpPrintOptions( pParent, rAttrSet ); } -//------------------------------------------------------------------------ -#pragma SEG_FUNCDEF(tpprint_06) - -int __EXPORT ScTpPrintOptions::DeactivatePage( SfxItemSet* pSet ) +int ScTpPrintOptions::DeactivatePage( SfxItemSet* pSet ) { if ( pSet ) FillItemSet( *pSet ); @@ -148,39 +118,40 @@ int __EXPORT ScTpPrintOptions::DeactivatePage( SfxItemSet* pSet ) return LEAVE_PAGE; } -//----------------------------------------------------------------------- -#pragma SEG_FUNCDEF(tpprint_07) +// ----------------------------------------------------------------------- -void __EXPORT ScTpPrintOptions::Reset( const SfxItemSet& rCoreAttrs ) +void ScTpPrintOptions::Reset( const SfxItemSet& rCoreSet ) { - const ScPrintOptions& rOpt = ((const ScTpPrintItem&)rCoreAttrs.Get(nWhichPrint)). - GetPrintOptions(); - - aBtnPrinterNotFound .Check( rOpt.GetWarnPrinterNotFound() ); - aBtnPageSize .Check( rOpt.GetWarnPageSize() ); - aBtnOrientation .Check( rOpt.GetWarnOrientation() ); - aBtnPrinterNotFound .SaveValue(); - aBtnPageSize .SaveValue(); - aBtnOrientation .SaveValue(); + ScPrintOptions aOptions; + + const SfxPoolItem* pItem; + if(SFX_ITEM_SET == rCoreSet.GetItemState(SID_SCPRINTOPTIONS, FALSE , &pItem)) + aOptions = ((const ScTpPrintItem*)pItem)->GetPrintOptions(); + else + { + // when called from print dialog and no options set, use configuration + aOptions = SC_MOD()->GetPrintOptions(); + } + + aSkipEmptyPagesCB.Check( aOptions.GetSkipEmpty() ); + aSelectedSheetsCB.Check( !aOptions.GetAllSheets() ); + aSkipEmptyPagesCB.SaveValue(); + aSelectedSheetsCB.SaveValue(); } -//----------------------------------------------------------------------- -#pragma SEG_FUNCDEF(tpprint_08) +// ----------------------------------------------------------------------- -BOOL __EXPORT ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs ) +BOOL ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs ) { - if ( aBtnPrinterNotFound.GetSavedValue() != aBtnPrinterNotFound.IsChecked() - || aBtnPageSize .GetSavedValue() != aBtnPageSize.IsChecked() - || aBtnOrientation .GetSavedValue() != aBtnOrientation.IsChecked() ) + if ( aSkipEmptyPagesCB.GetSavedValue() != aSkipEmptyPagesCB.IsChecked() + || aSelectedSheetsCB.GetSavedValue() != aSelectedSheetsCB.IsChecked() ) { ScPrintOptions aOpt; - aOpt.SetWarnPrinterNotFound ( aBtnPrinterNotFound.IsChecked() ); - aOpt.SetWarnPageSize ( aBtnPageSize.IsChecked() ); - aOpt.SetWarnOrientation ( aBtnOrientation.IsChecked() ); - - rCoreAttrs.Put( ScTpPrintItem( nWhichPrint, aOpt ) ); + aOpt.SetSkipEmpty( aSkipEmptyPagesCB.IsChecked() ); + aOpt.SetAllSheets( !aSelectedSheetsCB.IsChecked() ); + rCoreAttrs.Put( ScTpPrintItem( SID_SCPRINTOPTIONS, aOpt ) ); return TRUE; } else @@ -188,29 +159,3 @@ BOOL __EXPORT ScTpPrintOptions::FillItemSet( SfxItemSet& rCoreAttrs ) } -/*------------------------------------------------------------------------ - - $Log: not supported by cvs2svn $ - Revision 1.5 2000/09/17 14:09:16 willem.vandorp - OpenOffice header added. - - Revision 1.4 2000/08/31 16:38:38 willem.vandorp - Header and footer replaced - - Revision 1.3 1996/10/29 13:07:20 NN - ueberall ScResId statt ResId - - - Rev 1.2 29 Oct 1996 14:07:20 NN - ueberall ScResId statt ResId - - Rev 1.1 28 Nov 1995 19:03:02 MO - 303a: HasExchangeSupport entfernt - - Rev 1.0 18 Sep 1995 17:10:18 MO - Initial revision. - -------------------------------------------------------------------------*/ - -#pragma SEG_EOFMODULE - diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src index ff7e9e16e2d6..4e692e42fd58 100644 --- a/sc/source/ui/src/optdlg.src +++ b/sc/source/ui/src/optdlg.src @@ -2,9 +2,9 @@ * * $RCSfile: optdlg.src,v $ * - * $Revision: 1.34 $ + * $Revision: 1.35 $ * - * last change: $Author: dr $ $Date: 2001-05-28 14:09:50 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:41:39 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2765,4 +2765,46 @@ TabPage RID_SCPAGE_LAYOUT }; }; +/**************************************************************************/ +/* */ +/* */ +/* */ +/**************************************************************************/ + +TabPage RID_SCPAGE_PRINT +{ + HelpId = HID_SCPAGE_PRINT ; + SVLook = TRUE ; + Hide = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedLine FL_PAGES + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text = "Seiten" ; + Text [ ENGLISH ] = "Pages" ; + }; + CheckBox BTN_SKIPEMPTYPAGES + { + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 239 , 10 ) ; + Text = "~Ausgabe leerer Seiten unterdrcken" ; + Text [ ENGLISH ] = "~Suppress output of empty pages" ; + }; + FixedLine FL_SHEETS + { + Pos = MAP_APPFONT ( 6 , 30 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text = "Tabellen" ; + Text [ ENGLISH ] = "Sheets" ; + }; + CheckBox BTN_SELECTEDSHEETS + { + Pos = MAP_APPFONT ( 12 , 41 ) ; + Size = MAP_APPFONT ( 239 , 10 ) ; + Text = "~Nur ausgewhlte Tabellen drucken" ; + Text [ ENGLISH ] = "~Print only selected sheets" ; + }; +}; diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 8598848b12e6..6e281334acef 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -2,9 +2,9 @@ * * $RCSfile: confuno.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: sab $ $Date: 2001-05-11 18:58:43 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:43:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -76,6 +76,7 @@ #ifndef SC_SCDOCPOL_HXX #include "docpool.hxx" #endif +#include "sc.hrc" #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -239,6 +240,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( SfxItemSet* pSet = new SfxItemSet( *pDoc->GetPool(), SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_NOTFOUND_WARN, SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC, + SID_SCPRINTOPTIONS, SID_SCPRINTOPTIONS, NULL ); pDoc->SetPrinter( SfxPrinter::Create( aStream, pSet ) ); } diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index d2dd4b9bd9ae..551aeb3a5c8e 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -2,9 +2,9 @@ * * $RCSfile: preview.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: nn $ $Date: 2000-09-22 18:37:37 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:46:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -80,8 +80,10 @@ #include "prevwsh.hxx" #include "docsh.hxx" #include "printfun.hxx" +#include "printopt.hxx" #include "stlpool.hxx" #include "drwlayer.hxx" +#include "scmod.hxx" #include "globstr.hrc" #include "sc.hrc" // fuer ShellInvalidate @@ -197,9 +199,10 @@ void ScPreview::TestLastPage() nTab = 0; nPageNo = nTabPage = nTabStart = nDisplayStart = 0; aState.nPrintTab = aState.nStartCol = aState.nStartRow = - aState.nEndCol = aState.nEndRow = aState.nZoom = 0; - aState.nPagesX = aState.nPagesY = aState.nTabPages = - aState.nTotalPages = aState.nPageStart = aState.nDocPages = 0; + aState.nEndCol = aState.nEndRow = aState.nZoom = + aState.nPagesX = aState.nPagesY = 0; + aState.nTabPages = aState.nTotalPages = + aState.nPageStart = aState.nDocPages = 0; } } } @@ -222,12 +225,16 @@ void ScPreview::CalcPages( USHORT nToWhichTab ) nTabsTested = 0; } + // PrintOptions is passed to PrintFunc for SkipEmpty flag, + // but always all sheets are used (there is no selected sheet) + ScPrintOptions aOptions = SC_MOD()->GetPrintOptions(); + for (i=nStart; i<nAnz; i++) { long nAttrPage = i ? nFirstAttr[i-1] : 1; long nThisStart = nTotalPages; - ScPrintFunc aPrintFunc( pDocShell, this, i, nAttrPage ); + ScPrintFunc aPrintFunc( pDocShell, this, i, nAttrPage, 0, NULL, &aOptions ); long nThisTab = aPrintFunc.GetTotalPages(); nPages[i] = nThisTab; nTotalPages += nThisTab; @@ -324,11 +331,13 @@ void __EXPORT ScPreview::Paint( const Rectangle& rRect ) Size aPageSize; if ( nPageNo < nTotalPages ) { + ScPrintOptions aOptions = SC_MOD()->GetPrintOptions(); + ScPrintFunc* pPrintFunc; if (bStateValid) - pPrintFunc = new ScPrintFunc( pDocShell, this, aState ); + pPrintFunc = new ScPrintFunc( pDocShell, this, aState, &aOptions ); else - pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages ); + pPrintFunc = new ScPrintFunc( pDocShell, this, nTab, nFirstAttr[nTab], nTotalPages, NULL, &aOptions ); pPrintFunc->SetOffset(aOffset); pPrintFunc->SetManualZoom(nZoom); diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index cb98b1b98838..7e2d184c774f 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -2,9 +2,9 @@ * * $RCSfile: prevwsh.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2001-05-14 10:06:05 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:46:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -95,6 +95,7 @@ #ifndef _SC_VIEWSETTINGSSEQUENCEDEFINES_HXX #include "ViewSettingsSequenceDefines.hxx" #endif +#include "tpprint.hxx" #ifndef _XMLOFF_XMLUCONV_HXX #include <xmloff/xmluconv.hxx> @@ -165,7 +166,7 @@ void ScPreviewShell::Construct( Window* pParent ) ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, const ScPreviewShell& rWin ) : - SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT ), + SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), pDocShell( rWin.pDocShell ), aSourceData( rWin.aSourceData ) { @@ -174,7 +175,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, Window *pParent ) : - SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT ), + SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), pDocShell( (ScDocShell*)pViewFrame->GetObjectShell() ) { Construct( pParent ); @@ -182,7 +183,7 @@ ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, ScPreviewShell::ScPreviewShell( SfxViewFrame* pViewFrame, SfxViewShell* pOldSh ) : - SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT ), + SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), pDocShell( (ScDocShell*)pViewFrame->GetObjectShell() ) { Construct( &pViewFrame->GetWindow() ); @@ -449,6 +450,11 @@ PrintDialog* __EXPORT ScPreviewShell::CreatePrintDialog( Window* pParent ) return pDlg; } +SfxTabPage* ScPreviewShell::CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ) +{ + return ScTpPrintOptions::Create( pParent, rOptions ); +} + void __EXPORT ScPreviewShell::PreparePrint( PrintDialog* pPrintDialog ) { SfxViewShell::PreparePrint( pPrintDialog ); diff --git a/sc/source/ui/view/prevwsh2.cxx b/sc/source/ui/view/prevwsh2.cxx index ff6cca13e473..b4ef2b231e58 100644 --- a/sc/source/ui/view/prevwsh2.cxx +++ b/sc/source/ui/view/prevwsh2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: prevwsh2.cxx,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: nn $ $Date: 2000-09-22 18:37:37 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:46:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -355,6 +355,7 @@ void __EXPORT ScPreviewShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBC switch ( nSlot ) { case FID_DATACHANGED: + case SID_SCPRINTOPTIONS: bDataChanged = TRUE; break; case SC_HINT_DRWLAYER_NEW: diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 426ade952295..ee5fe0e313c2 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -2,9 +2,9 @@ * * $RCSfile: printfun.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: nn $ $Date: 2001-05-08 19:22:44 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:46:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -123,6 +123,7 @@ #include "scresid.hxx" #include "sc.hrc" #include "pagedata.hxx" +#include "printopt.hxx" #define _PRINTFUN_CXX #include "printfun.hxx" @@ -224,7 +225,7 @@ long lcl_LineTotal(const SvxBorderLine* pLine) return pLine ? ( pLine->GetOutWidth() + pLine->GetInWidth() + pLine->GetDistance() ) : 0; } -void ScPrintFunc::Construct() +void ScPrintFunc::Construct( const ScPrintOptions* pOptions ) { pDoc = pDocShell->GetDocument(); @@ -263,13 +264,14 @@ void ScPrintFunc::Construct() nManualZoom = 100; bClearWin = FALSE; - InitParam(); + InitParam(pOptions); pPageData = NULL; // wird nur zur Initialisierung gebraucht } ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, USHORT nTab, long nPage, long nDocP, const ScRange* pArea, + const ScPrintOptions* pOptions, ScPageBreakData* pData ) : pDocShell ( pShell ), pPrinter ( pNewPrinter ), @@ -287,11 +289,12 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, SfxPrinter* pNewPrinter, USHORT nT { pDev = pPrinter; aSrcOffset = pPrinter->PixelToLogic( pPrinter->GetPageOffsetPixel(), MAP_100TH_MM ); - Construct(); + Construct( pOptions ); } ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, USHORT nTab, - long nPage, long nDocP, const ScRange* pArea ) + long nPage, long nDocP, const ScRange* pArea, + const ScPrintOptions* pOptions ) : pDocShell ( pShell ), pPrinter ( NULL ), pDrawView ( NULL ), @@ -307,11 +310,11 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, USHORT nTab, bMultiArea ( FALSE ) { pDev = pWindow; - Construct(); + Construct( pOptions ); } ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, - const ScPrintState& rState ) + const ScPrintState& rState, const ScPrintOptions* pOptions ) : pDocShell ( pShell ), pPrinter ( NULL ), pDrawView ( NULL ), @@ -336,7 +339,7 @@ ScPrintFunc::ScPrintFunc( ScDocShell* pShell, Window* pWindow, nDocPages = rState.nDocPages; bState = TRUE; - Construct(); + Construct( pOptions ); } void ScPrintFunc::GetPrintState( ScPrintState& rState ) @@ -787,7 +790,7 @@ void ScPrintFunc::UpdateHFHeight( ScPrintHFParam& rParam ) } } -void ScPrintFunc::InitParam() +void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) { if (!pParamSet) return; @@ -913,8 +916,8 @@ void ScPrintFunc::InitParam() aTableParam.nScalePageNum = 0; } - aTableParam.bSkipEmpty = FALSE; //! aus Seitenvorlage !!!!!!!! -// aTableParam.bSkipEmpty = TRUE; //! Test !!!!!!!!!!!!!!!! + // skip empty pages only if options with that flag are passed + aTableParam.bSkipEmpty = pOptions && pOptions->GetSkipEmpty(); if ( pPageData ) aTableParam.bSkipEmpty = FALSE; // Wenn pPageData gesetzt ist, interessieren fuer die Umbruch-Vorschau diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index a10f807ffda6..135c1c05620e 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabview2.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: nn $ $Date: 2001-02-28 14:58:13 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:46:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -801,7 +801,7 @@ void ScTabView::UpdatePageBreakData( BOOL bForcePaint ) nCount = 1; pNewData = new ScPageBreakData(nCount); - ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab, 0,0,NULL, pNewData ); + ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab, 0,0,NULL, NULL, pNewData ); // ScPrintFunc fuellt im ctor die PageBreakData if ( nCount > 1 ) { diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index bcf00b50b8ae..45d3b26ccd40 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -2,9 +2,9 @@ * * $RCSfile: tabvwsh4.cxx,v $ * - * $Revision: 1.9 $ + * $Revision: 1.10 $ * - * last change: $Author: nn $ $Date: 2001-05-14 10:06:05 $ + * last change: $Author: nn $ $Date: 2001-05-29 19:46:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -121,6 +121,7 @@ #include "pgbrksh.hxx" #include "dpobject.hxx" #include "prevwsh.hxx" +#include "tpprint.hxx" void ActivateOlk( ScViewData* pViewData ); @@ -1070,6 +1071,11 @@ PrintDialog* __EXPORT ScTabViewShell::CreatePrintDialog( Window *pParent ) return pDlg; } +SfxTabPage* ScTabViewShell::CreatePrintOptionsPage( Window *pParent, const SfxItemSet &rOptions ) +{ + return ScTpPrintOptions::Create( pParent, rOptions ); +} + void __EXPORT ScTabViewShell::PreparePrint( PrintDialog* pPrintDialog ) { ScDocShell* pDocShell = GetViewData()->GetDocShell(); @@ -1438,7 +1444,7 @@ FASTBOOL __EXPORT ScTabViewShell::KeyInput( const KeyEvent &rKeyEvent ) // SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_DISABLE_ACCELS ), #define __INIT_ScTabViewShell \ - SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT ), \ + SfxViewShell( pViewFrame, SFX_VIEW_MAXIMIZE_FIRST | SFX_VIEW_CAN_PRINT | SFX_VIEW_HAS_PRINTOPTIONS ), \ nDrawSfxId(0), \ nCtrlSfxId(USHRT_MAX), \ eCurOST(OST_NONE), \ |