summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-03-24 09:36:29 +0200
committerNoel Grandin <noel@peralex.com>2015-03-24 09:36:59 +0200
commit799a7878fd5b3a5a01b59d0a4139a2b0908ccc43 (patch)
tree0354bc5656be965467e7e082ca5316168fc74c2d /sfx2
parentfba2d764d88582951f00af8184d481a6647a8564 (diff)
convert SFX_PRINTER constants to enum class
Change-Id: I5dca39f7668be2c03c904c33b6181ba769b70990
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/printhelper.cxx17
-rw-r--r--sfx2/source/doc/printhelper.hxx6
-rw-r--r--sfx2/source/view/viewprn.cxx30
3 files changed, 30 insertions, 23 deletions
diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx
index 27f2e62981f5..c7db58f3b118 100644
--- a/sfx2/source/doc/printhelper.cxx
+++ b/sfx2/source/doc/printhelper.cxx
@@ -312,7 +312,10 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SfxPrintHelper::getPrinter() thro
// XPrintable
-void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter,SfxPrinter*& pPrinter,sal_uInt16& nChangeFlags,SfxViewShell*& pViewSh)
+void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >& rPrinter,
+ SfxPrinter*& pPrinter,
+ SfxPrinterChangeFlags& nChangeFlags,
+ SfxViewShell*& pViewSh)
{
// Get old Printer
@@ -327,7 +330,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
return;
// new Printer-Name available?
- nChangeFlags = 0;
+ nChangeFlags = SfxPrinterChangeFlags::NONE;
sal_Int32 lDummy = 0;
for ( int n = 0; n < rPrinter.getLength(); ++n )
{
@@ -344,7 +347,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
if ( aPrinterName != pPrinter->GetName() )
{
pPrinter = new SfxPrinter( pPrinter->GetOptions().Clone(), aPrinterName );
- nChangeFlags = SFX_PRINTER_PRINTER;
+ nChangeFlags = SfxPrinterChangeFlags::PRINTER;
}
break;
}
@@ -373,7 +376,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
if ( (Orientation) eOrient != pPrinter->GetOrientation() )
{
pPrinter->SetOrientation( (Orientation) eOrient );
- nChangeFlags |= SFX_PRINTER_CHG_ORIENTATION;
+ nChangeFlags |= SfxPrinterChangeFlags::CHG_ORIENTATION;
}
}
@@ -390,7 +393,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
if ( convertToPaper(nPaperFormat) != pPrinter->GetPaper() )
{
pPrinter->SetPaper( convertToPaper(nPaperFormat) );
- nChangeFlags |= SFX_PRINTER_CHG_SIZE;
+ nChangeFlags |= SfxPrinterChangeFlags::CHG_SIZE;
}
}
@@ -437,7 +440,7 @@ void SfxPrintHelper::impl_setPrinter(const uno::Sequence< beans::PropertyValue >
if( aSetPaperSize != pPrinter->GetPaperSizePixel() )
{
pPrinter->SetPaperSizeUser( pPrinter->PixelToLogic( aSetPaperSize ) );
- nChangeFlags |= SFX_PRINTER_CHG_SIZE;
+ nChangeFlags |= SfxPrinterChangeFlags::CHG_SIZE;
}
}
@@ -455,7 +458,7 @@ void SAL_CALL SfxPrintHelper::setPrinter(const uno::Sequence< beans::PropertyVal
SfxViewShell* pViewSh = NULL;
SfxPrinter* pPrinter = NULL;
- sal_uInt16 nChangeFlags = 0;
+ SfxPrinterChangeFlags nChangeFlags = SfxPrinterChangeFlags::NONE;
impl_setPrinter(rPrinter,pPrinter,nChangeFlags,pViewSh);
// set new printer
if ( pViewSh && pPrinter )
diff --git a/sfx2/source/doc/printhelper.hxx b/sfx2/source/doc/printhelper.hxx
index 09f15f808bcf..ef4e31d2bd03 100644
--- a/sfx2/source/doc/printhelper.hxx
+++ b/sfx2/source/doc/printhelper.hxx
@@ -22,6 +22,7 @@
#include <sal/config.h>
#include <sfx2/dllapi.h>
+#include <sfx2/viewsh.hxx>
#include <sal/types.h>
#include <com/sun/star/view/XPrintable.hpp>
@@ -60,7 +61,10 @@ private:
osl::Mutex m_aMutex;
IMPL_PrintListener_DataContainer* m_pData ;
- void impl_setPrinter(const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rPrinter,SfxPrinter*& pPrinter,sal_uInt16& nChangeFlags,SfxViewShell*& pViewSh);
+ void impl_setPrinter(const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rPrinter,
+ SfxPrinter*& pPrinter,
+ SfxPrinterChangeFlags& nChangeFlags,
+ SfxViewShell*& pViewSh);
} ;
#endif
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 21045325bc5f..34716d67aabe 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -386,7 +386,7 @@ void SfxPrinterController::jobFinished( com::sun::star::view::PrintableState nSt
{
SfxPrinter* pNewPrt = new SfxPrinter( pDocPrt->GetOptions().Clone(), getPrinter()->GetName() );
pNewPrt->SetJobSetup( getPrinter()->GetJobSetup() );
- mpViewShell->SetPrinter( pNewPrt, SFX_PRINTER_PRINTER | SFX_PRINTER_JOBSETUP );
+ mpViewShell->SetPrinter( pNewPrt, SfxPrinterChangeFlags::PRINTER | SfxPrinterChangeFlags::JOBSETUP );
}
}
}
@@ -478,8 +478,8 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
sal_uInt16 nWhich = GetPool().GetWhich(SID_PRINTER_CHANGESTODOC);
const SfxFlagItem *pFlagItem = 0;
pDocPrinter->GetOptions().GetItemState( nWhich, false, reinterpret_cast<const SfxPoolItem**>(&pFlagItem) );
- bool bOriToDoc = pFlagItem && (pFlagItem->GetValue() & SFX_PRINTER_CHG_ORIENTATION);
- bool bSizeToDoc = pFlagItem && (pFlagItem->GetValue() & SFX_PRINTER_CHG_SIZE);
+ bool bOriToDoc = pFlagItem && (static_cast<SfxPrinterChangeFlags>(pFlagItem->GetValue()) & SfxPrinterChangeFlags::CHG_ORIENTATION);
+ bool bSizeToDoc = pFlagItem && (static_cast<SfxPrinterChangeFlags>(pFlagItem->GetValue()) & SfxPrinterChangeFlags::CHG_SIZE);
// Determine the previous format and size
Orientation eOldOri = pDocPrinter->GetOrientation();
@@ -499,25 +499,25 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
// Message and Flags for page format, summaries changes
OUString aMsg;
- sal_uInt16 nNewOpt=0;
+ SfxPrinterChangeFlags nNewOpt = SfxPrinterChangeFlags::NONE;
if( bOriChg && bPgSzChg )
{
aMsg = SfxResId(STR_PRINT_NEWORISIZE).toString();
- nNewOpt = SFX_PRINTER_CHG_ORIENTATION | SFX_PRINTER_CHG_SIZE;
+ nNewOpt = SfxPrinterChangeFlags::CHG_ORIENTATION | SfxPrinterChangeFlags::CHG_SIZE;
}
else if (bOriChg )
{
aMsg = SfxResId(STR_PRINT_NEWORI).toString();
- nNewOpt = SFX_PRINTER_CHG_ORIENTATION;
+ nNewOpt = SfxPrinterChangeFlags::CHG_ORIENTATION;
}
else if (bPgSzChg)
{
aMsg = SfxResId(STR_PRINT_NEWSIZE).toString();
- nNewOpt = SFX_PRINTER_CHG_SIZE;
+ nNewOpt = SfxPrinterChangeFlags::CHG_SIZE;
}
// Summaries in this variable what has been changed.
- sal_uInt16 nChangedFlags = 0;
+ SfxPrinterChangeFlags nChangedFlags = SfxPrinterChangeFlags::NONE;
// Ask if possible, if page format should be taken over from printer.
if ( ( bOriChg || bPgSzChg ) &&
@@ -535,7 +535,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
// or the other way around?
if ( (aTempPrtName != aDocPrtName) || (pDocPrinter->IsDefPrinter() != pNewPrinter->IsDefPrinter()) )
{
- nChangedFlags |= SFX_PRINTER_PRINTER|SFX_PRINTER_JOBSETUP;
+ nChangedFlags |= SfxPrinterChangeFlags::PRINTER|SfxPrinterChangeFlags::JOBSETUP;
pDocPrinter = pNewPrinter;
}
else
@@ -545,7 +545,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
{
// Option have changed
pDocPrinter->SetOptions( pNewPrinter->GetOptions() );
- nChangedFlags |= SFX_PRINTER_OPTIONS;
+ nChangedFlags |= SfxPrinterChangeFlags::OPTIONS;
}
// Compare JobSetups
@@ -553,7 +553,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
JobSetup aOldJobSetup = pDocPrinter->GetJobSetup();
if ( aNewJobSetup != aOldJobSetup )
{
- nChangedFlags |= SFX_PRINTER_JOBSETUP;
+ nChangedFlags |= SfxPrinterChangeFlags::JOBSETUP;
}
// Keep old changed Printer.
@@ -561,7 +561,7 @@ SfxPrinter* SfxViewShell::SetPrinter_Impl( SfxPrinter *pNewPrinter )
delete pNewPrinter;
}
- if ( 0 != nChangedFlags )
+ if ( SfxPrinterChangeFlags::NONE != nChangedFlags )
// SetPrinter will delete the old printer if it changes
SetPrinter( pDocPrinter, nChangedFlags );
return pDocPrinter;
@@ -781,7 +781,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
{
// just set a recorded printer name
if ( pPrinter )
- SetPrinter( pPrinter, SFX_PRINTER_PRINTER );
+ SetPrinter( pPrinter, SfxPrinterChangeFlags::PRINTER );
return;
}
@@ -843,7 +843,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
else
{
pPrinter->SetOptions( *pExecutor->GetOptions() );
- SetPrinter( pPrinter, SFX_PRINTER_OPTIONS );
+ SetPrinter( pPrinter, SfxPrinterChangeFlags::OPTIONS );
}
}
@@ -887,7 +887,7 @@ SfxPrinter* SfxViewShell::GetPrinter( bool /*bCreate*/ )
return 0;
}
-sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, sal_uInt16 /*nDiffFlags*/, bool )
+sal_uInt16 SfxViewShell::SetPrinter( SfxPrinter* /*pNewPrinter*/, SfxPrinterChangeFlags /*nDiffFlags*/, bool )
{
return 0;
}