summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2009-06-24 17:37:07 +0000
committerPhilipp Lohmann <pl@openoffice.org>2009-06-24 17:37:07 +0000
commitd3afbfc954cd9e3f99e3bd77fa87d70055447e03 (patch)
treee6568d09b8a400495f74f295430dab98249a8958
parenta22cd6b9c89f9d1bac898596942af3e889ee94d6 (diff)
prepare for more properties from the outside (e.g. API printing)
-rw-r--r--vcl/inc/vcl/print.hxx21
-rw-r--r--vcl/source/gdi/print3.cxx19
-rw-r--r--vcl/source/window/printdlg.cxx9
3 files changed, 36 insertions, 13 deletions
diff --git a/vcl/inc/vcl/print.hxx b/vcl/inc/vcl/print.hxx
index ca3c6030f4e4..941feb97b8e3 100644
--- a/vcl/inc/vcl/print.hxx
+++ b/vcl/inc/vcl/print.hxx
@@ -480,16 +480,17 @@ public:
virtual void jobFinished(); // optionally release resources bound to the job
// implementation details, not usable outside vcl
- int SAL_DLLPRIVATE getFilteredPageCount();
- Size SAL_DLLPRIVATE getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
- Size SAL_DLLPRIVATE getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
- void SAL_DLLPRIVATE printFilteredPage( int i_nPage );
- void SAL_DLLPRIVATE setPrinter( const boost::shared_ptr<Printer>& );
- void SAL_DLLPRIVATE setOptionChangeHdl( const Link& );
- void SAL_DLLPRIVATE createProgressDialog();
- void SAL_DLLPRIVATE setMultipage( const MultiPageSetup& );
- const MultiPageSetup& getMultipage() const;
- void SAL_DLLPRIVATE setLastPage( sal_Bool i_bLastPage );
+ SAL_DLLPRIVATE int getFilteredPageCount();
+ SAL_DLLPRIVATE Size getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false );
+ SAL_DLLPRIVATE Size getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false );
+ SAL_DLLPRIVATE void printFilteredPage( int i_nPage );
+ SAL_DLLPRIVATE void setPrinter( const boost::shared_ptr<Printer>& );
+ SAL_DLLPRIVATE void setOptionChangeHdl( const Link& );
+ SAL_DLLPRIVATE void createProgressDialog();
+ SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& );
+ SAL_DLLPRIVATE const MultiPageSetup& getMultipage() const;
+ SAL_DLLPRIVATE void setLastPage( sal_Bool i_bLastPage );
+ SAL_DLLPRIVATE void pushPropertiesToPrinter();
};
class VCL_DLLPUBLIC PrinterOptionsHelper
diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx
index 24618e6162e3..6ab34439b5e4 100644
--- a/vcl/source/gdi/print3.cxx
+++ b/vcl/source/gdi/print3.cxx
@@ -307,13 +307,14 @@ void Printer::ImplPrintJob( const boost::shared_ptr<PrinterListener>& i_pListene
pListener->getPrinter()->EnablePrintFile( TRUE );
pListener->getPrinter()->SetPrintFile( aFile );
}
- pListener->getPrinter()->SetCopyCount( static_cast<USHORT>(aDlg.getCopyCount()), aDlg.isCollate() );
}
catch( std::bad_alloc& )
{
}
}
+ pListener->pushPropertiesToPrinter();
+
pListener->getPrinter()->StartJob( String( RTL_CONSTASCII_USTRINGPARAM( "FIXME: no job name" ) ),
pListener );
@@ -447,6 +448,8 @@ void PrinterListener::setPrinter( const boost::shared_ptr<Printer>& i_rPrinter )
{
mpImplData->mpPrinter = i_rPrinter;
Size aPaperSize( i_rPrinter->PixelToLogic( i_rPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
+ makeAny( rtl::OUString( i_rPrinter->GetName() ) ) );
}
static Size modifyJobSetup( Printer* pPrinter, const Sequence< PropertyValue >& i_rProps )
@@ -967,6 +970,20 @@ const PrinterListener::MultiPageSetup& PrinterListener::getMultipage() const
return mpImplData->maMultiPage;
}
+void PrinterListener::pushPropertiesToPrinter()
+{
+ sal_Int32 nCopyCount = 1;
+ // set copycount and collate
+ const beans::PropertyValue* pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) );
+ if( pVal )
+ pVal->Value >>= nCopyCount;
+ sal_Bool bCollate = sal_False;
+ pVal = getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) );
+ if( pVal )
+ pVal->Value >>= bCollate;
+ mpImplData->mpPrinter->SetCopyCount( static_cast<USHORT>(nCopyCount), bCollate );
+}
+
/*
* PrinterOptionsHelper
**/
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index fd6a2422defc..138c75427d6d 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -349,7 +349,7 @@ void PrintDialog::JobTabPage::readFromSettings()
// do not actually make copy count persistent
// the assumption is that this would lead to a lot of unwanted copies
aValue = pItem->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog_JobPage" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Copies" ) ) );
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ) );
sal_Int32 nVal = aValue.toInt32();
maCopyCountField.SetValue( sal_Int64(nVal > 1 ? nVal : 1) );
#endif
@@ -366,7 +366,7 @@ void PrintDialog::JobTabPage::storeToSettings()
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToFile" ) ),
rtl::OUString::createFromAscii( maToFileBox.IsChecked() ? "true" : "false" ) );
pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog_JobPage" ) ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Copies" ) ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ),
maCopyCountField.GetText() );
pItem->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintDialog_JobPage" ) ),
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Collate" ) ),
@@ -1311,6 +1311,11 @@ IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit )
mnCurPage = sal_Int32( maPageEdit.GetValue() - 1 );
preparePreview( true, true );
}
+ else if( pEdit == &maJobPage.maCopyCountField )
+ {
+ maPListener->setValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CopyCount" ) ),
+ makeAny( sal_Int32(maJobPage.maCopyCountField.GetValue()) ) );
+ }
return 0;
}