diff options
-rwxr-xr-x | vcl/aqua/inc/aquaprintview.h | 7 | ||||
-rw-r--r-- | vcl/aqua/inc/salprn.h | 4 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/aquaprintaccessoryview.mm | 116 | ||||
-rwxr-xr-x | vcl/aqua/source/gdi/aquaprintview.mm | 6 | ||||
-rw-r--r-- | vcl/aqua/source/gdi/salprn.cxx | 34 | ||||
-rw-r--r-- | vcl/inc/vcl/oldprintadaptor.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vcl/print.hxx | 24 | ||||
-rw-r--r-- | vcl/inc/vcl/prndlg.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/vcl/salprn.hxx | 4 | ||||
-rw-r--r-- | vcl/source/app/salvtables.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/oldprintadaptor.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/print3.cxx | 175 | ||||
-rw-r--r-- | vcl/source/window/printdlg.cxx | 68 |
13 files changed, 236 insertions, 214 deletions
diff --git a/vcl/aqua/inc/aquaprintview.h b/vcl/aqua/inc/aquaprintview.h index a3984333f84e..55a85678cd50 100755 --- a/vcl/aqua/inc/aquaprintview.h +++ b/vcl/aqua/inc/aquaprintview.h @@ -38,7 +38,6 @@ #include "vcl/print.hxx" class AquaSalInfoPrinter; -namespace vcl { class PrinterListener; } struct PrintAccessoryViewState { @@ -51,10 +50,10 @@ struct PrintAccessoryViewState @interface AquaPrintView : NSView { - vcl::PrinterListener* mpListener; + vcl::PrinterController* mpController; AquaSalInfoPrinter* mpInfoPrinter; } --(id)initWithListener: (vcl::PrinterListener*)pListener withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter; +-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter; -(MacOSBOOL)knowsPageRange: (NSRangePointer)range; -(NSRect)rectForPage: (int)page; -(NSPoint)locationOfPrintRect: (NSRect)aRect; @@ -64,7 +63,7 @@ struct PrintAccessoryViewState @interface AquaPrintAccessoryView : NSObject { } -+(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withListener: (vcl::PrinterListener*)pListener withState: (PrintAccessoryViewState*)pState; ++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState; @end diff --git a/vcl/aqua/inc/salprn.h b/vcl/aqua/inc/salprn.h index a22503c22e78..e265f800906d 100644 --- a/vcl/aqua/inc/salprn.h +++ b/vcl/aqua/inc/salprn.h @@ -106,7 +106,7 @@ class AquaSalInfoPrinter : public SalInfoPrinter const String& rJobName, const String& i_rAppName, ImplJobSetup* i_pSetupData, - vcl::PrinterListener& i_rListener, + vcl::PrinterController& i_rController, bool bIsQuickJob ); BOOL EndJob(); BOOL AbortJob(); @@ -149,7 +149,7 @@ class AquaSalPrinter : public SalPrinter const String& rJobName, const String& i_rAppName, ImplJobSetup* i_pSetupData, - vcl::PrinterListener& i_rListener ); + vcl::PrinterController& i_rListener ); virtual BOOL EndJob(); virtual BOOL AbortJob(); diff --git a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm index 30811a1e0219..645de97d7ac3 100644 --- a/vcl/aqua/source/gdi/aquaprintaccessoryview.mm +++ b/vcl/aqua/source/gdi/aquaprintaccessoryview.mm @@ -55,13 +55,13 @@ using namespace com::sun::star::uno; the preview insists on not being present. This is unfortunate. */ -class ListenerProperties; +class ControllerProperties; @interface ControlTarget : NSObject { - ListenerProperties* mpListener; + ControllerProperties* mpController; } --(id)initWithListenerMap: (ListenerProperties*)pListener; +-(id)initWithControllerMap: (ControllerProperties*)pController; -(void)triggered:(id)pSender; -(void)triggeredNumeric:(id)pSender; -(void)triggeredPreview:(id)pSender; @@ -69,9 +69,9 @@ class ListenerProperties; @end -class ListenerProperties +class ControllerProperties { - vcl::PrinterListener* mpListener; + vcl::PrinterController* mpController; std::map< int, rtl::OUString > maTagToPropertyName; std::map< int, sal_Int32 > maTagToValueInt; std::map< NSView*, NSView* > maViewPairMap; @@ -89,14 +89,14 @@ class ListenerProperties NSTextView* mpPagesLabel; public: - ListenerProperties( vcl::PrinterListener* i_pListener, - NSPrintOperation* i_pOp, - NSView* i_pAccessoryView, - NSTabView* i_pTabView, - PrintAccessoryViewState* i_pState ) - : mpListener( i_pListener ), + ControllerProperties( vcl::PrinterController* i_pController, + NSPrintOperation* i_pOp, + NSView* i_pAccessoryView, + NSTabView* i_pTabView, + PrintAccessoryViewState* i_pState ) + : mpController( i_pController ), mnNextTag( 0 ), - mnLastPageCount( i_pListener->getPageCount() ), + mnLastPageCount( i_pController->getPageCount() ), mpState( i_pState ), mpOp( i_pOp ), mpAccessoryView( i_pAccessoryView ), @@ -112,10 +112,10 @@ class ListenerProperties void updatePrintJob() { - // TODO: refresh page count etc from mpListener + // TODO: refresh page count etc from mpController // page range may have changed depending on options - sal_Int32 nPages = mpListener->getPageCount(); + sal_Int32 nPages = mpController->getPageCount(); #if OSL_DEBUG_LEVEL > 1 if( nPages != mnLastPageCount ) fprintf( stderr, "trouble: number of pages changed from %ld to %ld !\n", mnLastPageCount, nPages ); @@ -203,7 +203,7 @@ class ListenerProperties std::map< int, sal_Int32 >::const_iterator value_it = maTagToValueInt.find( i_nTag ); if( name_it != maTagToPropertyName.end() && value_it != maTagToValueInt.end() ) { - PropertyValue* pVal = mpListener->getValue( name_it->second ); + PropertyValue* pVal = mpController->getValue( name_it->second ); if( pVal ) { pVal->Value <<= value_it->second; @@ -217,7 +217,7 @@ class ListenerProperties std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); if( name_it != maTagToPropertyName.end() ) { - PropertyValue* pVal = mpListener->getValue( name_it->second ); + PropertyValue* pVal = mpController->getValue( name_it->second ); if( pVal ) { pVal->Value <<= i_nValue; @@ -231,7 +231,7 @@ class ListenerProperties std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); if( name_it != maTagToPropertyName.end() ) { - PropertyValue* pVal = mpListener->getValue( name_it->second ); + PropertyValue* pVal = mpController->getValue( name_it->second ); if( pVal ) { pVal->Value <<= i_bValue; @@ -245,7 +245,7 @@ class ListenerProperties std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( i_nTag ); if( name_it != maTagToPropertyName.end() ) { - PropertyValue* pVal = mpListener->getValue( name_it->second ); + PropertyValue* pVal = mpController->getValue( name_it->second ); if( pVal ) { pVal->Value <<= i_rValue; @@ -273,7 +273,7 @@ class ListenerProperties std::map< int, rtl::OUString >::const_iterator name_it = maTagToPropertyName.find( nTag ); if( name_it != maTagToPropertyName.end() ) { - MacOSBOOL bEnabled = mpListener->isUIOptionEnabled( name_it->second ) ? YES : NO; + MacOSBOOL bEnabled = mpController->isUIOptionEnabled( name_it->second ) ? YES : NO; if( pCtrl ) { [pCtrl setEnabled: bEnabled]; @@ -290,14 +290,14 @@ class ListenerProperties void updatePreviewImage( sal_Int32 i_nPage ) { - sal_Int32 nPages = mpListener->getFilteredPageCount(); + sal_Int32 nPages = mpController->getFilteredPageCount(); NSRect aViewFrame = [mpPreview frame]; Size aPixelSize( static_cast<long>(aViewFrame.size.width), static_cast<long>(aViewFrame.size.height) ); if( i_nPage >= 0 && nPages > i_nPage ) { GDIMetaFile aMtf; - Size aPageSize( mpListener->getFilteredPageFile( i_nPage, aMtf, false ) ); + Size aPageSize( mpController->getFilteredPageFile( i_nPage, aMtf, false ) ); VirtualDevice aDev; Size aLogicSize( aDev.PixelToLogic( aPixelSize, MapMode( MAP_100TH_MM ) ) ); double fScaleX = double(aLogicSize.Width())/double(aPageSize.Width()); @@ -355,7 +355,7 @@ class ListenerProperties [mpPreviewBox addSubview: [mpPreview autorelease]]; // add a label - sal_Int32 nPages = mpListener->getFilteredPageCount(); + sal_Int32 nPages = mpController->getFilteredPageCount(); rtl::OUStringBuffer aBuf( 16 ); aBuf.appendAscii( "/ " ); aBuf.append( rtl::OUString::valueOf( nPages ) ); @@ -445,11 +445,11 @@ static void filterAccelerator( rtl::OUString& io_rText ) } @implementation ControlTarget --(id)initWithListenerMap: (ListenerProperties*)pListener +-(id)initWithControllerMap: (ControllerProperties*)pController { if( (self = [super init]) ) { - mpListener = pListener; + mpController = pController; } return self; } @@ -462,14 +462,14 @@ static void filterAccelerator( rtl::OUString& io_rText ) if( pSelected ) { int nTag = [pSelected tag]; - mpListener->changePropertyWithIntValue( nTag ); + mpController->changePropertyWithIntValue( nTag ); } } else if( [pSender isMemberOfClass: [NSButton class]] ) { NSButton* pBtn = (NSButton*)pSender; int nTag = [pBtn tag]; - mpListener->changePropertyWithBoolValue( nTag, [pBtn state] == NSOnState ); + mpController->changePropertyWithBoolValue( nTag, [pBtn state] == NSOnState ); } else if( [pSender isMemberOfClass: [NSMatrix class]] ) { @@ -478,7 +478,7 @@ static void filterAccelerator( rtl::OUString& io_rText ) { NSButtonCell* pCell = (NSButtonCell*)pObj; int nTag = [pCell tag]; - mpListener->changePropertyWithIntValue( nTag ); + mpController->changePropertyWithIntValue( nTag ); } } else if( [pSender isMemberOfClass: [NSTextField class]] ) @@ -486,13 +486,13 @@ static void filterAccelerator( rtl::OUString& io_rText ) NSTextField* pField = (NSTextField*)pSender; int nTag = [pField tag]; rtl::OUString aValue = GetOUString( [pSender stringValue] ); - mpListener->changePropertyWithStringValue( nTag, aValue ); + mpController->changePropertyWithStringValue( nTag, aValue ); } else { DBG_ERROR( "unsupported class" ); } - mpListener->updateEnableState(); + mpController->updateEnableState(); } -(void)triggeredNumeric:(id)pSender; { @@ -502,11 +502,11 @@ static void filterAccelerator( rtl::OUString& io_rText ) int nTag = [pField tag]; sal_Int64 nValue = [pField intValue]; - NSView* pOther = mpListener->getPair( pField ); + NSView* pOther = mpController->getPair( pField ); if( pOther ) [(NSControl*)pOther setIntValue: nValue]; - mpListener->changePropertyWithIntValue( nTag, nValue ); + mpController->changePropertyWithIntValue( nTag, nValue ); } else if( [pSender isMemberOfClass: [NSStepper class]] ) { @@ -514,25 +514,25 @@ static void filterAccelerator( rtl::OUString& io_rText ) int nTag = [pStep tag]; sal_Int64 nValue = [pStep intValue]; - NSView* pOther = mpListener->getPair( pStep ); + NSView* pOther = mpController->getPair( pStep ); if( pOther ) [(NSControl*)pOther setIntValue: nValue]; - mpListener->changePropertyWithIntValue( nTag, nValue ); + mpController->changePropertyWithIntValue( nTag, nValue ); } else { DBG_ERROR( "unsupported class" ); } - mpListener->updateEnableState(); + mpController->updateEnableState(); } -(void)triggeredPreview:(id)pSender { - mpListener->changePreview( pSender ); + mpController->changePreview( pSender ); } -(void)dealloc { - delete mpListener; + delete mpController; [super dealloc]; } @end @@ -572,9 +572,9 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) @implementation AquaPrintAccessoryView -+(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withListener: (vcl::PrinterListener*)pListener withState: (PrintAccessoryViewState*)pState; ++(NSObject*)setupPrinterPanel: (NSPrintOperation*)pOp withController: (vcl::PrinterController*)pController withState: (PrintAccessoryViewState*)pState; { - const Sequence< PropertyValue >& rOptions( pListener->getUIOptions() ); + const Sequence< PropertyValue >& rOptions( pController->getUIOptions() ); if( rOptions.getLength() == 0 ) return nil; @@ -590,8 +590,8 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) sal_Bool bIgnoreSubgroup = sal_False; - ListenerProperties* pListenerProperties = new ListenerProperties( pListener, pOp, pAccessoryView, pTabView, pState ); - ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithListenerMap: pListenerProperties]; + ControllerProperties* pControllerProperties = new ControllerProperties( pController, pOp, pAccessoryView, pTabView, pState ); + ControlTarget* pCtrlTarget = [[ControlTarget alloc] initWithControllerMap: pControllerProperties]; for( int i = 0; i < rOptions.getLength(); i++ ) { @@ -723,7 +723,7 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) [pBtn setButtonType: NSSwitchButton]; [pBtn setTitle: pText]; sal_Bool bVal = sal_False; - PropertyValue* pVal = pListener->getValue( aPropertyName ); + PropertyValue* pVal = pController->getValue( aPropertyName ); if( pVal ) pVal->Value >>= bVal; [pBtn setState: bVal ? NSOnState : NSOffState]; @@ -733,8 +733,8 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) // connect target [pBtn setTarget: pCtrlTarget]; [pBtn setAction: @selector(triggered:)]; - int nTag = pListenerProperties->addNameTag( aPropertyName ); - pListenerProperties->addObservedControl( pBtn ); + int nTag = pControllerProperties->addNameTag( aPropertyName ); + pControllerProperties->addObservedControl( pBtn ); [pBtn setTag: nTag]; aCheckRect = [pBtn frame]; @@ -793,7 +793,7 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) numberOfColumns: 1]; // get currently selected value sal_Int32 nSelectVal = 0; - PropertyValue* pVal = pListener->getValue( aPropertyName ); + PropertyValue* pVal = pController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; // set individual titles @@ -807,8 +807,8 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) // connect target and action [pCell setTarget: pCtrlTarget]; [pCell setAction: @selector(triggered:)]; - int nTag = pListenerProperties->addNameAndValueTag( aPropertyName, m ); - pListenerProperties->addObservedControl( pCell ); + int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); + pControllerProperties->addObservedControl( pCell ); [pCell setTag: nTag]; [pTitle release]; // set current selection @@ -870,12 +870,12 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) NSString* pItemText = CreateNSString( aChoices[m] ); [pBtn addItemWithTitle: pItemText]; NSMenuItem* pItem = [pBtn itemWithTitle: pItemText]; - int nTag = pListenerProperties->addNameAndValueTag( aPropertyName, m ); + int nTag = pControllerProperties->addNameAndValueTag( aPropertyName, m ); [pItem setTag: nTag]; [pItemText release]; } - PropertyValue* pVal = pListener->getValue( aPropertyName ); + PropertyValue* pVal = pController->getValue( aPropertyName ); sal_Int32 aSelectVal = 0; if( pVal && pVal->Value.hasValue() ) pVal->Value >>= aSelectVal; @@ -883,8 +883,8 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) // add the button to observed controls for enabled state changes // also add a tag just for this purpose - pListenerProperties->addObservedControl( pBtn ); - [pBtn setTag: pListenerProperties->addNameTag( aPropertyName )]; + pControllerProperties->addObservedControl( pBtn ); + [pBtn setTag: pControllerProperties->addNameTag( aPropertyName )]; [pBtn sizeToFit]; [pCurParent addSubview: [pBtn autorelease]]; @@ -963,17 +963,17 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) // add the field to observed controls for enabled state changes // also add a tag just for this purpose - pListenerProperties->addObservedControl( pFieldView ); - int nTag = pListenerProperties->addNameTag( aPropertyName ); + pControllerProperties->addObservedControl( pFieldView ); + int nTag = pControllerProperties->addNameTag( aPropertyName ); [pFieldView setTag: nTag]; - // pListenerProperties->addNamedView( pFieldView, aPropertyName ); + // pControllerProperties->addNamedView( pFieldView, aPropertyName ); // move to nCurY aFieldRect.origin.y = nCurY - aFieldRect.size.height; [pFieldView setFrame: aFieldRect]; // current value - PropertyValue* pVal = pListener->getValue( aPropertyName ); + PropertyValue* pVal = pController->getValue( aPropertyName ); if( aCtrlType.equalsAscii( "Range" ) ) { // add a stepper control @@ -985,7 +985,7 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) [pStep setValueWraps: NO]; [pStep setTag: nTag]; [pCurParent addSubview: [pStep autorelease]]; - pListenerProperties->addObservedControl( pStep ); + pControllerProperties->addObservedControl( pStep ); [pStep setTarget: pCtrlTarget]; [pStep setAction: @selector(triggered:)]; @@ -1011,7 +1011,7 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) [pFieldView setIntValue: nSelectVal]; [pStep setIntValue: nSelectVal]; - pListenerProperties->addViewPair( pFieldView, pStep ); + pControllerProperties->addViewPair( pFieldView, pStep ); // connect target and action [pFieldView setTarget: pCtrlTarget]; [pFieldView setAction: @selector(triggeredNumeric:)]; @@ -1047,7 +1047,7 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) DBG_ERROR( "Unsupported UI option" ); } } - pListenerProperties->updateEnableState(); + pControllerProperties->updateEnableState(); adjustViewAndChildren( pCurParent, aMaxTabSize ); // find the minimum needed tab size @@ -1060,7 +1060,7 @@ static void adjustViewAndChildren( NSView* pView, NSSize& rMaxSize ) aViewFrame.size.height = aTabCtrlSize.height + aTabViewFrame.origin.y; [pAccessoryView setFrameSize: aViewFrame.size]; - pListenerProperties->setupPreview( pCtrlTarget ); + pControllerProperties->setupPreview( pCtrlTarget ); // set the accessory view [pOp setAccessoryView: [pAccessoryView autorelease]]; diff --git a/vcl/aqua/source/gdi/aquaprintview.mm b/vcl/aqua/source/gdi/aquaprintview.mm index a050d229f033..6519b4981770 100755 --- a/vcl/aqua/source/gdi/aquaprintview.mm +++ b/vcl/aqua/source/gdi/aquaprintview.mm @@ -36,12 +36,12 @@ #include "vcl/print.hxx" @implementation AquaPrintView --(id)initWithListener: (vcl::PrinterListener*)pListener withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter +-(id)initWithController: (vcl::PrinterController*)pController withInfoPrinter: (AquaSalInfoPrinter*)pInfoPrinter { NSRect aRect = { { 0, 0 }, [pInfoPrinter->getPrintInfo() paperSize] }; if( (self = [super initWithFrame: aRect]) != nil ) { - mpListener = pListener; + mpController = pController; mpInfoPrinter = pInfoPrinter; } return self; @@ -77,6 +77,6 @@ // page count is 1 based if( nPage - 1 < (mpInfoPrinter->getCurPageRangeStart() + mpInfoPrinter->getCurPageRangeCount() ) ) - mpListener->printFilteredPage( nPage-1 ); + mpController->printFilteredPage( nPage-1 ); } @end diff --git a/vcl/aqua/source/gdi/salprn.cxx b/vcl/aqua/source/gdi/salprn.cxx index e06e8c48fd8b..89a9d08cef13 100644 --- a/vcl/aqua/source/gdi/salprn.cxx +++ b/vcl/aqua/source/gdi/salprn.cxx @@ -484,10 +484,10 @@ void AquaSalInfoPrinter::GetPageInfo( const ImplJobSetup*, } } -static Size getPageSize( vcl::PrinterListener& i_rListener, sal_Int32 i_nPage ) +static Size getPageSize( vcl::PrinterController& i_rController, sal_Int32 i_nPage ) { Size aPageSize; - Sequence< PropertyValue > aPageParms( i_rListener.getPageParameters( i_nPage ) ); + Sequence< PropertyValue > aPageParms( i_rController.getPageParameters( i_nPage ) ); for( sal_Int32 nProperty = 0, nPropertyCount = aPageParms.getLength(); nProperty < nPropertyCount; ++nProperty ) { if( aPageParms[ nProperty ].Name.equalsAscii( "PageSize" ) ) @@ -506,7 +506,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName, ImplJobSetup* i_pSetupData, - vcl::PrinterListener& i_rListener, + vcl::PrinterController& i_rController, bool bIsQuickJob ) { if( mbJob ) @@ -521,7 +521,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, aAccViewState.bNeedRestart = true; // reset IsLastPage - i_rListener.setLastPage( sal_False ); + i_rController.setLastPage( sal_False ); // update job data if( i_pSetupData ) @@ -529,20 +529,20 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, // do we want a progress panel ? sal_Bool bShowProgressPanel = sal_True; - beans::PropertyValue* pMonitor = i_rListener.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) ); + beans::PropertyValue* pMonitor = i_rController.getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MonitorVisible" ) ) ); if( pMonitor ) pMonitor->Value >>= bShowProgressPanel; // FIXME: jobStarted() should be done after the print dialog has ended (if there is one) // how do I know when that might be ? - i_rListener.jobStarted(); + i_rController.jobStarted(); do { if( aAccViewState.bNeedRestart ) { mnCurPageRangeStart = 0; mnCurPageRangeCount = 0; - nAllPages = i_rListener.getFilteredPageCount(); + nAllPages = i_rController.getFilteredPageCount(); } aAccViewState.bNeedRestart = false; @@ -551,13 +551,13 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, if( nAllPages > 0 ) { mnCurPageRangeCount = 1; - aCurSize = getPageSize( i_rListener, mnCurPageRangeStart ); + aCurSize = getPageSize( i_rController, mnCurPageRangeStart ); Size aNextSize( aCurSize ); // print pages up to a different size while( mnCurPageRangeCount + mnCurPageRangeStart < nAllPages ) { - aNextSize = getPageSize( i_rListener, mnCurPageRangeStart + mnCurPageRangeCount ); + aNextSize = getPageSize( i_rController, mnCurPageRangeStart + mnCurPageRangeCount ); if( aCurSize == aNextSize // same page size || (aCurSize.Width() == aNextSize.Height() && aCurSize.Height() == aNextSize.Width()) // same size, but different orientation @@ -578,7 +578,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, setPaperSize( aCurSize.Width(), aCurSize.Height(), ORIENTATION_PORTRAIT ); // create view - NSView* pPrintView = [[AquaPrintView alloc] initWithListener: &i_rListener withInfoPrinter: this]; + NSView* pPrintView = [[AquaPrintView alloc] initWithController: &i_rController withInfoPrinter: this]; NSMutableDictionary* pPrintDict = [mpPrintInfo dictionary]; @@ -591,7 +591,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, [pPath release]; } - [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rListener.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies]; + [pPrintDict setObject: [[NSNumber numberWithInt: (int)i_rController.getPrinter()->GetCopyCount()] autorelease] forKey: NSPrintCopies]; [pPrintDict setObject: [[NSNumber numberWithBool: YES] autorelease] forKey: NSPrintDetailedErrorReporting]; [pPrintDict setObject: [[NSNumber numberWithInt: 1] autorelease] forKey: NSPrintFirstPage]; [pPrintDict setObject: [[NSNumber numberWithInt: mnCurPageRangeCount] autorelease] forKey: NSPrintLastPage]; @@ -612,7 +612,7 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, [pPrintOperation performSelector: @selector(setJobTitle:) withObject: [CreateNSString( i_rJobName ) autorelease]]; if( bShowPanel && mnCurPageRangeStart == 0 ) // only the first range of pages gets the accesory view - pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withListener: &i_rListener withState: &aAccViewState]; + pReleaseAfterUse = [AquaPrintAccessoryView setupPrinterPanel: pPrintOperation withController: &i_rController withState: &aAccViewState]; bSuccess = TRUE; mbJob = true; @@ -634,14 +634,14 @@ BOOL AquaSalInfoPrinter::StartJob( const String* i_pFileName, // so we need to call XRenderadble::render one last time with IsLastPage = TRUE if( nAllPages > 0 ) { - i_rListener.setLastPage( sal_True ); + i_rController.setLastPage( sal_True ); GDIMetaFile aPageFile; if( mrContext ) SetupPrinterGraphics( mrContext ); - i_rListener.getFilteredPageFile( 0, aPageFile ); + i_rController.getFilteredPageFile( 0, aPageFile ); } - i_rListener.setJobState( bWasAborted + i_rController.setJobState( bWasAborted ? view::PrintableState_JOB_ABORTED : view::PrintableState_JOB_SPOOLED ); @@ -716,7 +716,7 @@ BOOL AquaSalPrinter::StartJob( const String* i_pFileName, const String& i_rJobName, const String& i_rAppName, ImplJobSetup* i_pSetupData, - vcl::PrinterListener& i_rListener ) + vcl::PrinterController& i_rController ) { bool bIsQuickJob = false; std::hash_map< rtl::OUString, rtl::OUString, rtl::OUStringHash >::const_iterator quick_it = @@ -728,7 +728,7 @@ BOOL AquaSalPrinter::StartJob( const String* i_pFileName, bIsQuickJob = true; } - return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rListener, bIsQuickJob ); + return mpInfoPrinter->StartJob( i_pFileName, i_rJobName, i_rAppName, i_pSetupData, i_rController, bIsQuickJob ); } // ----------------------------------------------------------------------- diff --git a/vcl/inc/vcl/oldprintadaptor.hxx b/vcl/inc/vcl/oldprintadaptor.hxx index 9a0cb9a1d083..d8b26433af94 100644 --- a/vcl/inc/vcl/oldprintadaptor.hxx +++ b/vcl/inc/vcl/oldprintadaptor.hxx @@ -33,7 +33,7 @@ namespace vcl { struct ImplOldStyleAdaptorData; - class VCL_DLLPUBLIC OldStylePrintAdaptor : public PrinterListener + class VCL_DLLPUBLIC OldStylePrintAdaptor : public PrinterController { ImplOldStyleAdaptorData* mpData; public: diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx index 4cbd24dc02bd..339dee01d86d 100644 --- a/vcl/inc/vcl/print.hxx +++ b/vcl/inc/vcl/print.hxx @@ -56,7 +56,7 @@ class VirtualDevice; class Window; namespace vcl { - class PrinterListener; + class PrinterController; class PrintDialog; } @@ -264,7 +264,7 @@ private: SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup& ); DECL_DLLPRIVATE_LINK( ImplDestroyPrinterAsync, void* ); - SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterListener>& ); + SAL_DLLPRIVATE bool StartJob( const rtl::OUString& rJobName, boost::shared_ptr<vcl::PrinterController>& ); static SAL_DLLPRIVATE ULONG ImplSalPrinterErrorCodeToVCL( ULONG nError ); @@ -386,26 +386,26 @@ public: starts a print job asynchronously (that is will return */ - static void PrintJob( const boost::shared_ptr<vcl::PrinterListener>& i_pListener, + static void PrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, const JobSetup& i_rInitSetup ); // implementation detail of PrintJob being asynchronous // not exported, not usable outside vcl - static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterListener>& i_pListener, + static void SAL_DLLPRIVATE ImplPrintJob( const boost::shared_ptr<vcl::PrinterController>& i_pController, const JobSetup& i_rInitSetup ); }; namespace vcl { -class ImplPrinterListenerData; +class ImplPrinterControllerData; -class VCL_DLLPUBLIC PrinterListener +class VCL_DLLPUBLIC PrinterController { - ImplPrinterListenerData* mpImplData; + ImplPrinterControllerData* mpImplData; protected: - PrinterListener( const boost::shared_ptr<Printer>& ); + PrinterController( const boost::shared_ptr<Printer>& ); public: struct MultiPageSetup { @@ -432,8 +432,8 @@ public: } }; - PrinterListener(); - virtual ~PrinterListener(); + PrinterController(); + virtual ~PrinterController(); const boost::shared_ptr<Printer>& getPrinter() const; /* for implementations: get current job properties as changed by e.g. print dialog @@ -449,6 +449,8 @@ public: */ com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ); const com::sun::star::beans::PropertyValue* getValue( const rtl::OUString& i_rPropertyName ) const; + // get a sequence of properties + com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > getValues( const com::sun::star::uno::Sequence< rtl::OUString >& ) const; /* set a property value - can also be used to add another UI property */ @@ -483,6 +485,8 @@ public: com::sun::star::view::PrintableState getJobState() const; + void abortJob(); + // implementation details, not usable outside vcl SAL_DLLPRIVATE int getFilteredPageCount(); SAL_DLLPRIVATE Size getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); diff --git a/vcl/inc/vcl/prndlg.hxx b/vcl/inc/vcl/prndlg.hxx index 67f38e45540f..e76d823b447a 100644 --- a/vcl/inc/vcl/prndlg.hxx +++ b/vcl/inc/vcl/prndlg.hxx @@ -112,7 +112,7 @@ namespace vcl void readFromSettings(); void storeToSettings(); - void initFromMultiPageSetup( const vcl::PrinterListener::MultiPageSetup& ); + void initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& ); virtual void Resize(); }; @@ -156,7 +156,7 @@ namespace vcl FixedLine maButtonLine; - boost::shared_ptr< PrinterListener > maPListener; + boost::shared_ptr< PrinterController > maPController; rtl::OUString maPageStr; rtl::OUString maNoPageStr; @@ -206,7 +206,7 @@ namespace vcl DECL_LINK( UIOption_ModifyHdl, Edit* ); public: - PrintDialog( Window*, const boost::shared_ptr< PrinterListener >& ); + PrintDialog( Window*, const boost::shared_ptr< PrinterController >& ); virtual ~PrintDialog(); bool isPrintToFile(); diff --git a/vcl/inc/vcl/salprn.hxx b/vcl/inc/vcl/salprn.hxx index a53adfe3518e..e7fc44f0ab7d 100644 --- a/vcl/inc/vcl/salprn.hxx +++ b/vcl/inc/vcl/salprn.hxx @@ -41,7 +41,7 @@ class SalGraphics; class SalFrame; struct ImplJobSetup; -namespace vcl { class PrinterListener; } +namespace vcl { class PrinterController; } // ----------------------- // - SalPrinterQueueInfo - @@ -125,7 +125,7 @@ public: // public for Sal Implementation const String& rJobName, const String& rAppName, ImplJobSetup* pSetupData, - vcl::PrinterListener& rListener ); + vcl::PrinterController& rController ); virtual BOOL EndJob() = 0; virtual BOOL AbortJob() = 0; diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 7f872d0a9b63..d8ead71c0a4b 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -91,7 +91,7 @@ SalPrinter::~SalPrinter() } BOOL SalPrinter::StartJob( const String*, const String&, const String&, - ImplJobSetup*, vcl::PrinterListener& ) + ImplJobSetup*, vcl::PrinterController& ) { return FALSE; } diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index e0250d2832ba..cffd11daaad6 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -55,7 +55,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::beans; OldStylePrintAdaptor::OldStylePrintAdaptor( const boost::shared_ptr< Printer >& i_pPrinter ) - : PrinterListener( i_pPrinter ) + : PrinterController( i_pPrinter ) , mpData( new ImplOldStyleAdaptorData() ) { } diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index d0ff5814aa51..583ef206df7e 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -130,7 +130,7 @@ public: } }; -class vcl::ImplPrinterListenerData +class vcl::ImplPrinterControllerData { public: struct ControlDependency @@ -154,27 +154,27 @@ public: sal_Bool mbLastPage; view::PrintableState meJobState; - vcl::PrinterListener::MultiPageSetup maMultiPage; + vcl::PrinterController::MultiPageSetup maMultiPage; vcl::PrintProgressDialog* mpProgress; ImplPageCache maPageCache; - ImplPrinterListenerData() : + ImplPrinterControllerData() : mbLastPage( sal_False ), meJobState( view::PrintableState_JOB_STARTED ), mpProgress( NULL ) {} - ~ImplPrinterListenerData() { delete mpProgress; } + ~ImplPrinterControllerData() { delete mpProgress; } }; -PrinterListener::PrinterListener() - : mpImplData( new ImplPrinterListenerData ) +PrinterController::PrinterController() + : mpImplData( new ImplPrinterControllerData ) { } -PrinterListener::PrinterListener( const boost::shared_ptr<Printer>& i_pPrinter ) - : mpImplData( new ImplPrinterListenerData ) +PrinterController::PrinterController( const boost::shared_ptr<Printer>& i_pPrinter ) + : mpImplData( new ImplPrinterControllerData ) { mpImplData->mpPrinter = i_pPrinter; } @@ -238,13 +238,13 @@ static rtl::OUString queryFile( Printer* pPrinter ) struct PrintJobAsync { - boost::shared_ptr<PrinterListener> mpListener; + boost::shared_ptr<PrinterController> mpController; JobSetup maInitSetup; - PrintJobAsync( const boost::shared_ptr<PrinterListener>& i_pListener, + PrintJobAsync( const boost::shared_ptr<PrinterController>& i_pController, const JobSetup& i_rInitSetup ) - : mpListener( i_pListener ), maInitSetup( i_rInitSetup ) + : mpController( i_pController ), maInitSetup( i_rInitSetup ) {} DECL_LINK( ExecJob, void* ); @@ -252,7 +252,7 @@ struct PrintJobAsync IMPL_LINK( PrintJobAsync, ExecJob, void*, EMPTYARG ) { - Printer::ImplPrintJob( mpListener, maInitSetup ); + Printer::ImplPrintJob( mpController, maInitSetup ); // clean up, do not access members after this delete this; @@ -260,41 +260,41 @@ IMPL_LINK( PrintJobAsync, ExecJob, void*, EMPTYARG ) return 0; } -void Printer::PrintJob( const boost::shared_ptr<PrinterListener>& i_pListener, +void Printer::PrintJob( const boost::shared_ptr<PrinterController>& i_pController, const JobSetup& i_rInitSetup ) { sal_Bool bSynchronous = sal_False; - beans::PropertyValue* pVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); + beans::PropertyValue* pVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); if( pVal ) pVal->Value >>= bSynchronous; if( bSynchronous ) - ImplPrintJob( i_pListener, i_rInitSetup ); + ImplPrintJob( i_pController, i_rInitSetup ); else { - PrintJobAsync* pAsync = new PrintJobAsync( i_pListener, i_rInitSetup ); + PrintJobAsync* pAsync = new PrintJobAsync( i_pController, i_rInitSetup ); Application::PostUserEvent( LINK( pAsync, PrintJobAsync, ExecJob ) ); } } -void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListener, +void Printer::ImplPrintJob( const boost::shared_ptr<PrinterController>& i_pController, const JobSetup& i_rInitSetup ) { // setup printer - boost::shared_ptr<PrinterListener> pListener( i_pListener ); + boost::shared_ptr<PrinterController> pController( i_pController ); // if no specific printer is already set, create one - if( ! pListener->getPrinter() ) + if( ! pController->getPrinter() ) { boost::shared_ptr<Printer> pPrinter( new Printer( i_rInitSetup.GetPrinterName() ) ); - pListener->setPrinter( pPrinter ); + pController->setPrinter( pPrinter ); } // reset last page property - i_pListener->setLastPage( sal_False ); + i_pController->setLastPage( sal_False ); - beans::PropertyValue* pPagesVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ); + beans::PropertyValue* pPagesVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Pages" ) ) ); if( pPagesVal ) { rtl::OUString aPagesVal; @@ -304,13 +304,13 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListene // "Pages" attribute from API is now equivalent to "PageRange" // AND "PrintContent" = 1 except calc where it is "PrintRange" = 1 // Argh ! That sure needs cleaning up - beans::PropertyValue* pVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); + beans::PropertyValue* pVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) ) ); if( ! pVal ) - pVal = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); + pVal = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) ) ); if( pVal ) { pVal->Value = makeAny( sal_Int32( 1 ) ); - i_pListener->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), pPagesVal->Value ); + i_pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ), pPagesVal->Value ); } } } @@ -319,25 +319,25 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListene // in that case leave the work to that dialog const String& rQuick( i_rInitSetup.GetValue( String( RTL_CONSTASCII_USTRINGPARAM( "IsQuickJob" ) ) ) ); bool bIsQuick = rQuick.Len() && rQuick.EqualsIgnoreCaseAscii( "true" ); - if( ! pListener->getPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) && ! bIsQuick ) + if( ! pController->getPrinter()->GetCapabilities( PRINTER_CAPABILITIES_EXTERNALDIALOG ) && ! bIsQuick ) { try { - PrintDialog aDlg( NULL, i_pListener ); + PrintDialog aDlg( NULL, i_pController ); if( ! aDlg.Execute() ) { GDIMetaFile aPageFile; - i_pListener->setLastPage( sal_True ); - if( i_pListener->getPageCount() > 0 ) - i_pListener->getFilteredPageFile( 0, aPageFile ); + i_pController->setLastPage( sal_True ); + if( i_pController->getPageCount() > 0 ) + i_pController->getFilteredPageFile( 0, aPageFile ); return; } if( aDlg.isPrintToFile() ) { - rtl::OUString aFile = queryFile( pListener->getPrinter().get() ); + rtl::OUString aFile = queryFile( pController->getPrinter().get() ); if( ! aFile.getLength() ) return; - pListener->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ), + pController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ), makeAny( aFile ) ); } } @@ -346,19 +346,19 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListene } } - pListener->pushPropertiesToPrinter(); + pController->pushPropertiesToPrinter(); rtl::OUString aJobName; - beans::PropertyValue* pJobNameVal = pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ) ); + beans::PropertyValue* pJobNameVal = pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobName" ) ) ); if( pJobNameVal ) pJobNameVal->Value >>= aJobName; - pListener->getPrinter()->StartJob( String( aJobName ), pListener ); + pController->getPrinter()->StartJob( String( aJobName ), pController ); - pListener->jobFinished( pListener->getJobState() ); + pController->jobFinished( pController->getJobState() ); } -bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::PrinterListener>& i_pListener ) +bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl::PrinterController>& i_pController ) { mnError = PRINTER_OK; @@ -403,7 +403,7 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: // SetPrintFileName to redirect printout into file // it can be argued that those methods should be removed in favor // of only using the LocalFileName property - beans::PropertyValue* pFileValue = i_pListener->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ) ); + beans::PropertyValue* pFileValue = i_pController->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LocalFileName" ) ) ); if( pFileValue ) { rtl::OUString aFile; @@ -429,12 +429,12 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: // sallayer does all necessary page printing // and also handles showing a dialog // that also means it must call jobStarted when the dialog is finished - // it also must set the JobState of the listener + // it also must set the JobState of the Controller if( mpPrinter->StartJob( pPrintFile, i_rJobName, Application::GetDisplayName(), maJobSetup.ImplGetConstData(), - *i_pListener ) ) + *i_pController ) ) { EndJob(); } @@ -456,8 +456,8 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: { // possibly a dialog has been shown // now the real job starts - i_pListener->setJobState( view::PrintableState_JOB_STARTED ); - i_pListener->jobStarted(); + i_pController->setJobState( view::PrintableState_JOB_STARTED ); + i_pController->jobStarted(); if( mpPrinter->StartJob( pPrintFile, i_rJobName, @@ -466,22 +466,22 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: maJobSetup.ImplGetConstData() ) ) { mbJobActive = TRUE; - i_pListener->createProgressDialog(); - int nPages = i_pListener->getFilteredPageCount(); + i_pController->createProgressDialog(); + int nPages = i_pController->getFilteredPageCount(); for( int nPage = 0; nPage < nPages; nPage++ ) { if( nPage == nPages-1 ) - i_pListener->setLastPage( sal_True ); - i_pListener->printFilteredPage( nPage ); + i_pController->setLastPage( sal_True ); + i_pController->printFilteredPage( nPage ); } EndJob(); - if( i_pListener->getJobState() == view::PrintableState_JOB_STARTED ) - i_pListener->setJobState( view::PrintableState_JOB_SPOOLED ); + if( i_pController->getJobState() == view::PrintableState_JOB_STARTED ) + i_pController->setJobState( view::PrintableState_JOB_SPOOLED ); } else { - i_pListener->setJobState( view::PrintableState_JOB_FAILED ); + i_pController->setJobState( view::PrintableState_JOB_FAILED ); mnError = ImplSalPrinterErrorCodeToVCL( mpPrinter->GetErrorCode() ); if ( !mnError ) @@ -499,27 +499,27 @@ bool Printer::StartJob( const rtl::OUString& i_rJobName, boost::shared_ptr<vcl:: return true; } -PrinterListener::~PrinterListener() +PrinterController::~PrinterController() { delete mpImplData; } -view::PrintableState PrinterListener::getJobState() const +view::PrintableState PrinterController::getJobState() const { return mpImplData->meJobState; } -void PrinterListener::setJobState( view::PrintableState i_eState ) +void PrinterController::setJobState( view::PrintableState i_eState ) { mpImplData->meJobState = i_eState; } -const boost::shared_ptr<Printer>& PrinterListener::getPrinter() const +const boost::shared_ptr<Printer>& PrinterController::getPrinter() const { return mpImplData->mpPrinter; } -void PrinterListener::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter ) +void PrinterController::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter ) { mpImplData->mpPrinter = i_rPrinter; Size aPaperSize( i_rPrinter->PixelToLogic( i_rPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); @@ -547,7 +547,7 @@ static Size modifyJobSetup( Printer* pPrinter, const Sequence< PropertyValue >& return aPageSize; } -Size PrinterListener::getPageFile( int i_nUnfilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) +Size PrinterController::getPageFile( int i_nUnfilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) { // update progress if necessary if( mpImplData->mpProgress ) @@ -635,7 +635,7 @@ static void appendSubPage( GDIMetaFile& o_rMtf, const Rectangle& i_rClipRect, GD o_rMtf.AddAction( new MetaPopAction() ); } -Size PrinterListener::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) +Size PrinterController::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache ) { const MultiPageSetup& rMPS( mpImplData->maMultiPage ); int nSubPages = rMPS.nRows * rMPS.nColumns; @@ -713,7 +713,7 @@ Size PrinterListener::getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_r return aPaperSize; } -int PrinterListener::getFilteredPageCount() +int PrinterController::getFilteredPageCount() { int nDiv = mpImplData->maMultiPage.nRows * mpImplData->maMultiPage.nColumns; if( nDiv < 1 ) @@ -721,7 +721,7 @@ int PrinterListener::getFilteredPageCount() return (getPageCount() * mpImplData->maMultiPage.nRepeat + (nDiv-1)) / nDiv; } -void PrinterListener::printFilteredPage( int i_nPage ) +void PrinterController::printFilteredPage( int i_nPage ) { if( mpImplData->meJobState != view::PrintableState_JOB_STARTED ) return; @@ -811,20 +811,25 @@ void PrinterListener::printFilteredPage( int i_nPage ) mpImplData->mpPrinter->SetDrawMode( nRestoreDrawMode ); } -void PrinterListener::jobStarted() +void PrinterController::jobStarted() { } -void PrinterListener::jobFinished( view::PrintableState ) +void PrinterController::jobFinished( view::PrintableState ) { } -void PrinterListener::setLastPage( sal_Bool i_bLastPage ) +void PrinterController::abortJob() +{ + setJobState( view::PrintableState_JOB_ABORTED ); +} + +void PrinterController::setLastPage( sal_Bool i_bLastPage ) { mpImplData->mbLastPage = i_bLastPage; } -Sequence< PropertyValue > PrinterListener::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const +Sequence< PropertyValue > PrinterController::getJobProperties( const Sequence< PropertyValue >& i_rMergeList ) const { std::hash_set< rtl::OUString, rtl::OUStringHash > aMergeSet; size_t nResultLen = size_t(i_rMergeList.getLength()) + mpImplData->maUIProperties.size() + 3; @@ -860,26 +865,40 @@ Sequence< PropertyValue > PrinterListener::getJobProperties( const Sequence< Pro return aResult; } -const Sequence< beans::PropertyValue >& PrinterListener::getUIOptions() const +const Sequence< beans::PropertyValue >& PrinterController::getUIOptions() const { return mpImplData->maUIOptions; } -com::sun::star::beans::PropertyValue* PrinterListener::getValue( const rtl::OUString& i_rProperty ) +beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) { std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; } -const com::sun::star::beans::PropertyValue* PrinterListener::getValue( const rtl::OUString& i_rProperty ) const +const beans::PropertyValue* PrinterController::getValue( const rtl::OUString& i_rProperty ) const { std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); return it != mpImplData->maPropertyToIndex.end() ? &mpImplData->maUIProperties[it->second] : NULL; } -void PrinterListener::setValue( const rtl::OUString& i_rName, const Any& i_rValue ) +Sequence< beans::PropertyValue > PrinterController::getValues( const Sequence< rtl::OUString >& i_rNames ) const +{ + Sequence< beans::PropertyValue > aRet( i_rNames.getLength() ); + sal_Int32 nFound = 0; + for( sal_Int32 i = 0; i < i_rNames.getLength(); i++ ) + { + const beans::PropertyValue* pVal = getValue( i_rNames[i] ); + if( pVal ) + aRet[ nFound++ ] = *pVal; + } + aRet.realloc( nFound ); + return aRet; +} + +void PrinterController::setValue( const rtl::OUString& i_rName, const Any& i_rValue ) { beans::PropertyValue aVal; aVal.Name = i_rName; @@ -888,7 +907,7 @@ void PrinterListener::setValue( const rtl::OUString& i_rName, const Any& i_rValu setValue( aVal ); } -void PrinterListener::setValue( const beans::PropertyValue& i_rValue ) +void PrinterController::setValue( const beans::PropertyValue& i_rValue ) { std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rValue.Name ); @@ -903,7 +922,7 @@ void PrinterListener::setValue( const beans::PropertyValue& i_rValue ) } } -void PrinterListener::setUIOptions( const Sequence< beans::PropertyValue >& i_rOptions ) +void PrinterController::setUIOptions( const Sequence< beans::PropertyValue >& i_rOptions ) { DBG_ASSERT( mpImplData->maUIOptions.getLength() == 0, "setUIOptions called twice !" ); @@ -916,7 +935,7 @@ void PrinterListener::setUIOptions( const Sequence< beans::PropertyValue >& i_rO bool bIsEnabled = true; bool bHaveProperty = false; rtl::OUString aPropName; - vcl::ImplPrinterListenerData::ControlDependency aDep; + vcl::ImplPrinterControllerData::ControlDependency aDep; for( int n = 0; n < aOptProp.getLength(); n++ ) { const beans::PropertyValue& rEntry( aOptProp[ n ] ); @@ -947,7 +966,7 @@ void PrinterListener::setUIOptions( const Sequence< beans::PropertyValue >& i_rO } if( bHaveProperty ) { - vcl::ImplPrinterListenerData::PropertyToIndexMap::const_iterator it = + vcl::ImplPrinterControllerData::PropertyToIndexMap::const_iterator it = mpImplData->maPropertyToIndex.find( aPropName ); // sanity check if( it != mpImplData->maPropertyToIndex.end() ) @@ -960,7 +979,7 @@ void PrinterListener::setUIOptions( const Sequence< beans::PropertyValue >& i_rO } } -void PrinterListener::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable ) +void PrinterController::enableUIOption( const rtl::OUString& i_rProperty, bool i_bEnable ) { std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator it = mpImplData->maPropertyToIndex.find( i_rProperty ); @@ -977,7 +996,7 @@ void PrinterListener::enableUIOption( const rtl::OUString& i_rProperty, bool i_b } } -bool PrinterListener::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const +bool PrinterController::isUIOptionEnabled( const rtl::OUString& i_rProperty ) const { bool bEnabled = false; std::hash_map< rtl::OUString, size_t, rtl::OUStringHash >::const_iterator prop_it = @@ -989,7 +1008,7 @@ bool PrinterListener::isUIOptionEnabled( const rtl::OUString& i_rProperty ) cons if( bEnabled ) { // check control dependencies - vcl::ImplPrinterListenerData::ControlDependencyMap::const_iterator it = + vcl::ImplPrinterControllerData::ControlDependencyMap::const_iterator it = mpImplData->maControlDependencies.find( i_rProperty ); if( it != mpImplData->maControlDependencies.end() ) { @@ -1031,12 +1050,12 @@ bool PrinterListener::isUIOptionEnabled( const rtl::OUString& i_rProperty ) cons return bEnabled; } -void PrinterListener::setOptionChangeHdl( const Link& i_rHdl ) +void PrinterController::setOptionChangeHdl( const Link& i_rHdl ) { mpImplData->maOptionChangeHdl = i_rHdl; } -void PrinterListener::createProgressDialog() +void PrinterController::createProgressDialog() { if( ! mpImplData->mpProgress ) { @@ -1053,17 +1072,17 @@ void PrinterListener::createProgressDialog() } } -void PrinterListener::setMultipage( const MultiPageSetup& i_rMPS ) +void PrinterController::setMultipage( const MultiPageSetup& i_rMPS ) { mpImplData->maMultiPage = i_rMPS; } -const PrinterListener::MultiPageSetup& PrinterListener::getMultipage() const +const PrinterController::MultiPageSetup& PrinterController::getMultipage() const { return mpImplData->maMultiPage; } -void PrinterListener::pushPropertiesToPrinter() +void PrinterController::pushPropertiesToPrinter() { sal_Int32 nCopyCount = 1; // set copycount and collate diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx index 138c75427d6d..5f8d08ec28a7 100644 --- a/vcl/source/window/printdlg.cxx +++ b/vcl/source/window/printdlg.cxx @@ -251,7 +251,7 @@ void PrintDialog::NUpTabPage::Resize() aPage->setManagedArea( Rectangle( Point(), GetOutputSizePixel() ) ); } -void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterListener::MultiPageSetup& i_rMPS ) +void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS ) { maLeftMarginEdt.SetValue( maLeftMarginEdt.Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM ); maTopMarginEdt.SetValue( maTopMarginEdt.Normalize( i_rMPS.nTopMargin ), FUNIT_100TH_MM ); @@ -373,7 +373,7 @@ void PrintDialog::JobTabPage::storeToSettings() rtl::OUString::createFromAscii( maCollateBox.IsChecked() ? "true" : "false" ) ); } -PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterListener>& i_rListener ) +PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController ) : ModalDialog( i_pParent, VclResId( SV_DLG_PRINT ) ) , maOKButton( this, VclResId( SV_PRINT_OK ) ) , maCancelButton( this, VclResId( SV_PRINT_CANCEL ) ) @@ -386,7 +386,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList , maNUpPage( &maTabCtrl, VclResId( SV_PRINT_TAB_NUP ) ) , maJobPage( &maTabCtrl, VclResId( SV_PRINT_TAB_JOB ) ) , maButtonLine( this, VclResId( SV_PRINT_BUTTONLINE ) ) - , maPListener( i_rListener ) + , maPController( i_rController ) , maNoPageStr( String( VclResId( SV_PRINT_NOPAGES ) ) ) , mnCurPage( 0 ) , mnCachedPages( 0 ) @@ -434,9 +434,9 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList maJobPage.maPrinters.InsertEntry( *it ); } // select current printer - if( maJobPage.maPrinters.GetEntryPos( maPListener->getPrinter()->GetName() ) != LISTBOX_ENTRY_NOTFOUND ) + if( maJobPage.maPrinters.GetEntryPos( maPController->getPrinter()->GetName() ) != LISTBOX_ENTRY_NOTFOUND ) { - maJobPage.maPrinters.SelectEntry( maPListener->getPrinter()->GetName() ); + maJobPage.maPrinters.SelectEntry( maPController->getPrinter()->GetName() ); } else { @@ -447,13 +447,13 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList if( maJobPage.maPrinters.GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND ) { maJobPage.maPrinters.SelectEntry( aValue ); - maPListener->setPrinter( boost::shared_ptr<Printer>( new Printer( aValue ) ) ); + maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aValue ) ) ); } else { // fall back to default printer maJobPage.maPrinters.SelectEntry( Printer::GetDefaultPrinterName() ); - maPListener->setPrinter( boost::shared_ptr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) ); + maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) ); } } // update the text fields for the printer @@ -463,9 +463,9 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList maJobPage.maPrinters.SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) ); // setup sizes for N-Up - Size aNupSize( maPListener->getPrinter()->PixelToLogic( - maPListener->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); - if( maPListener->getPrinter()->GetOrientation() == ORIENTATION_LANDSCAPE ) + Size aNupSize( maPController->getPrinter()->PixelToLogic( + maPController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) ); + if( maPController->getPrinter()->GetOrientation() == ORIENTATION_LANDSCAPE ) { maNupLandscapeSize = aNupSize; maNupPortraitSize = Size( aNupSize.Height(), aNupSize.Width() ); @@ -477,7 +477,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList maNupLandscapeSize = Size( aNupSize.Height(), aNupSize.Width() ); maNUpPage.maNupPortrait.Check(); } - maNUpPage.initFromMultiPageSetup( maPListener->getMultipage() ); + maNUpPage.initFromMultiPageSetup( maPController->getMultipage() ); // setup click handler on the various buttons @@ -510,7 +510,7 @@ PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterList setupOptionalUI(); // set change handler for UI options - maPListener->setOptionChangeHdl( LINK( this, PrintDialog, UIOptionsChanged ) ); + maPController->setOptionChangeHdl( LINK( this, PrintDialog, UIOptionsChanged ) ); // set min size pixel to current size SetMinOutputSizePixel( GetOutputSizePixel() ); @@ -639,7 +639,7 @@ void PrintDialog::setupOptionalUI() std::multimap< rtl::OUString, vcl::RowOrColumn* > aPropertyToDependencyRowMap; - const Sequence< PropertyValue >& rOptions( maPListener->getUIOptions() ); + const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() ); for( int i = 0; i < rOptions.getLength(); i++ ) { Sequence< beans::PropertyValue > aOptProp; @@ -822,11 +822,11 @@ void PrintDialog::setupOptionalUI() pNewBox->Show(); sal_Bool bVal = sal_False; - PropertyValue* pVal = maPListener->getValue( aPropertyName ); + PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal ) pVal->Value >>= bVal; pNewBox->Check( bVal ); - pNewBox->Enable( maPListener->isUIOptionEnabled( aPropertyName ) && pVal != NULL ); + pNewBox->Enable( maPController->isUIOptionEnabled( aPropertyName ) && pVal != NULL ); pNewBox->SetToggleHdl( LINK( this, PrintDialog, UIOption_CheckHdl ) ); maPropertyToWindowMap.insert( std::pair< rtl::OUString, Window* >( aPropertyName, pNewBox ) ); @@ -870,7 +870,7 @@ void PrintDialog::setupOptionalUI() } // iterate options sal_Int32 nSelectVal = 0; - PropertyValue* pVal = maPListener->getValue( aPropertyName ); + PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; for( sal_Int32 m = 0; m < aChoices.getLength(); m++ ) @@ -883,7 +883,7 @@ void PrintDialog::setupOptionalUI() maControls.push_front( pBtn ); pBtn->SetText( aChoices[m] ); pBtn->Check( m == nSelectVal ); - pBtn->Enable( maPListener->isUIOptionEnabled( aPropertyName ) ); + pBtn->Enable( maPController->isUIOptionEnabled( aPropertyName ) ); pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) ); pBtn->Show(); maPropertyToWindowMap.insert( std::pair< rtl::OUString, Window* >( aPropertyName, pBtn ) ); @@ -934,11 +934,11 @@ void PrintDialog::setupOptionalUI() pList->InsertEntry( aChoices[m] ); } sal_Int32 nSelectVal = 0; - PropertyValue* pVal = maPListener->getValue( aPropertyName ); + PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nSelectVal; pList->SelectEntryPos( static_cast<USHORT>(nSelectVal) ); - pList->Enable( maPListener->isUIOptionEnabled( aPropertyName ) ); + pList->Enable( maPController->isUIOptionEnabled( aPropertyName ) ); pList->SetSelectHdl( LINK( this, PrintDialog, UIOption_SelectHdl ) ); pList->SetDropDownLineCount( static_cast<USHORT>(aChoices.getLength()) ); pList->Show(); @@ -966,12 +966,12 @@ void PrintDialog::setupOptionalUI() pField->SetMax( nMaxValue ); } sal_Int64 nCurVal = 0; - PropertyValue* pVal = maPListener->getValue( aPropertyName ); + PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= nCurVal; pField->SetValue( nCurVal ); - pField->Enable( maPListener->isUIOptionEnabled( aPropertyName ) ); + pField->Enable( maPController->isUIOptionEnabled( aPropertyName ) ); pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) ); pField->Show(); @@ -992,11 +992,11 @@ void PrintDialog::setupOptionalUI() maControls.push_front( pField ); rtl::OUString aCurVal; - PropertyValue* pVal = maPListener->getValue( aPropertyName ); + PropertyValue* pVal = maPController->getValue( aPropertyName ); if( pVal && pVal->Value.hasValue() ) pVal->Value >>= aCurVal; pField->SetText( aCurVal ); - pField->Enable( maPListener->isUIOptionEnabled( aPropertyName ) ); + pField->Enable( maPController->isUIOptionEnabled( aPropertyName ) ); pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) ); pField->Show(); @@ -1089,7 +1089,7 @@ void PrintDialog::checkControlDependencies() maJobPage.maCollateImage.SetImage( aImg ); // enable setup button only for printers that can be setup - bool bHaveSetup = maPListener->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG ); + bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG ); maJobPage.maSetupButton.Enable( bHaveSetup ); if( bHaveSetup ) { @@ -1123,7 +1123,7 @@ void PrintDialog::checkOptionalControlDependencies() for( std::map< Window*, rtl::OUString >::iterator it = maControlToPropertyMap.begin(); it != maControlToPropertyMap.end(); ++it ) { - bool bShouldbeEnabled = maPListener->isUIOptionEnabled( it->second ); + bool bShouldbeEnabled = maPController->isUIOptionEnabled( it->second ); bool bIsEnabled = it->first->IsEnabled(); // Enable does not do a change check first, so can be less cheap than expected if( bShouldbeEnabled != bIsEnabled ) @@ -1176,7 +1176,7 @@ void PrintDialog::setPreviewText( sal_Int32 ) void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) { // page range may have changed depending on options - sal_Int32 nPages = maPListener->getFilteredPageCount(); + sal_Int32 nPages = maPController->getFilteredPageCount(); mnCachedPages = nPages; if( mnCurPage >= nPages ) @@ -1189,7 +1189,7 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) maPageEdit.SetMin( 1 ); maPageEdit.SetMax( nPages ); - boost::shared_ptr<Printer> aPrt( maPListener->getPrinter() ); + boost::shared_ptr<Printer> aPrt( maPController->getPrinter() ); if( i_bNewPage ) @@ -1197,7 +1197,7 @@ void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache ) const MapMode aMapMode( MAP_100TH_MM ); GDIMetaFile aMtf; if( nPages > 0 ) - maCurPageSize = maPListener->getFilteredPageFile( mnCurPage, aMtf, i_bMayUseCache ); + maCurPageSize = maPController->getFilteredPageFile( mnCurPage, aMtf, i_bMayUseCache ); maPreviewWindow.setPreview( aMtf ); } @@ -1232,7 +1232,7 @@ void PrintDialog::updateNup() int nCols = int(maNUpPage.maNupColEdt.GetValue()); int nRepeat = int(maNUpPage.maNupRepEdt.GetValue()); - PrinterListener::MultiPageSetup aMPS; + PrinterController::MultiPageSetup aMPS; aMPS.nRows = nRows; aMPS.nColumns = nCols; aMPS.nRepeat = nRepeat; @@ -1248,7 +1248,7 @@ void PrintDialog::updateNup() aMPS.bDrawBorder = maNUpPage.maBorderCB.IsChecked(); - maPListener->setMultipage( aMPS ); + maPController->setMultipage( aMPS ); preparePreview( true, true ); } @@ -1260,7 +1260,7 @@ IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox ) String aNewPrinter( pBox->GetSelectEntry() ); maJobPage.maPrinters.SelectEntry( aNewPrinter ); // set new printer - maPListener->setPrinter( boost::shared_ptr<Printer>( new Printer( aNewPrinter ) ) ); + maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aNewPrinter ) ) ); // update text fields updatePrinterText(); } @@ -1286,7 +1286,7 @@ IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton ) { if( pButton == &maJobPage.maSetupButton ) { - maPListener->getPrinter()->Setup( this ); + maPController->getPrinter()->Setup( this ); } checkControlDependencies(); if( pButton == &maNUpPage.maNupPortrait || pButton == &maNUpPage.maNupLandscape || pButton == &maNUpPage.maBorderCB ) @@ -1313,7 +1313,7 @@ IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit ) } else if( pEdit == &maJobPage.maCopyCountField ) { - maPListener->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ), + maPController->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ), makeAny( sal_Int32(maJobPage.maCopyCountField.GetValue()) ) ); } return 0; @@ -1331,7 +1331,7 @@ PropertyValue* PrintDialog::getValueForWindow( Window* i_pWindow ) const std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow ); if( it != maControlToPropertyMap.end() ) { - pVal = maPListener->getValue( it->second ); + pVal = maPController->getValue( it->second ); DBG_ASSERT( pVal, "property value not found" ); } else |