diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-06-07 21:20:16 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-15 13:16:30 +0200 |
commit | 943f4b4ff1c524c514584c459b899ba3e9dfb71f (patch) | |
tree | 6f67c5954e6c78203cd714db5df96a80491fafdd | |
parent | b01c8a2d1bfcb79dedd4e0d093965d35c68ee937 (diff) |
convert POSTITS_ to scoped enum
Change-Id: Ib6fdfc22ce6cdf757066b422624b631b3f26e170
-rw-r--r-- | sw/inc/printdata.hxx | 30 | ||||
-rw-r--r-- | sw/source/core/doc/doc.cxx | 20 | ||||
-rw-r--r-- | sw/source/core/text/EnhancedPDFExportHelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/view/printdata.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/view/vprint.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/config/optpage.cxx | 20 | ||||
-rw-r--r-- | sw/source/uibase/config/prtopt.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/inc/cfgitems.hxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uno/unomod.cxx | 7 | ||||
-rw-r--r-- | sw/source/uibase/uno/unotxdoc.cxx | 6 |
10 files changed, 53 insertions, 48 deletions
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx index 5f7b7cb0a9c0..54f008454af2 100644 --- a/sw/inc/printdata.hxx +++ b/sw/inc/printdata.hxx @@ -44,6 +44,17 @@ class SfxViewShell; class SwPrintUIOptions; class SwRenderData; +/** this must match the definitions in css::text::NotePrintMode */ +enum class SwPostItMode +{ + NONE = 0, + Only = 1, + EndDoc = 2, + EndPage = 3, + InMargins = 4 +}; + + class SwPrintData { const SwPrintUIOptions * m_pPrintUIOptions; // not owner @@ -65,7 +76,7 @@ public: bUpdateFieldsInPrinting, bModified; - sal_Int16 nPrintPostIts; + SwPostItMode nPrintPostIts; OUString sFaxName; SwPrintData() @@ -93,7 +104,7 @@ public: bPrintHiddenText = bPrintTextPlaceholder = false; - nPrintPostIts = 0; + nPrintPostIts = SwPostItMode::NONE; } virtual ~SwPrintData() {} @@ -143,7 +154,7 @@ public: bool IsPrintPageBackground() const { return bPrintPageBackground; } bool IsPrintBlackFont() const { return bPrintBlackFont; } bool IsPrintSingleJobs() const { return bPrintSingleJobs; } - sal_Int16 GetPrintPostIts() const { return nPrintPostIts; } + SwPostItMode GetPrintPostIts() const { return nPrintPostIts; } const OUString GetFaxName() const { return sFaxName; } bool IsPrintHiddenText() const { return bPrintHiddenText; } bool IsPrintTextPlaceholder() const { return bPrintTextPlaceholder; } @@ -157,13 +168,13 @@ public: void SetPrintReverse( bool b ) { doSetModified(); bPrintReverse = b; } void SetPaperFromSetup( bool b ) { doSetModified(); bPaperFromSetup = b; } void SetPrintEmptyPages( bool b ) { doSetModified(); bPrintEmptyPages = b; } - void SetPrintPostIts( sal_Int16 n ) { doSetModified(); nPrintPostIts = n; } + void SetPrintPostIts( SwPostItMode n ) { doSetModified(); nPrintPostIts = n; } void SetPrintProspect( bool b ) { doSetModified(); bPrintProspect = b; } void SetPrintProspect_RTL( bool b ) { doSetModified(); bPrintProspectRTL = b; } void SetPrintPageBackground( bool b ) { doSetModified(); bPrintPageBackground = b; } void SetPrintBlackFont( bool b ) { doSetModified(); bPrintBlackFont = b; } void SetPrintSingleJobs( bool b ) { doSetModified(); bPrintSingleJobs = b; } - void SetFaxName( const OUString& rSet ) { sFaxName = rSet; } + void SetFaxName( const OUString& rSet ) { sFaxName = rSet; } void SetPrintHiddenText( bool b ) { doSetModified(); bPrintHiddenText = b; } void SetPrintTextPlaceholder( bool b ) { doSetModified(); bPrintTextPlaceholder = b; } @@ -188,7 +199,7 @@ public: bool IsPrintTextPlaceholders() const { return getBoolValue( "PrintTextPlaceholder", m_rDefaultPrintData.bPrintTextPlaceholder ); } bool IsPrintHiddenText() const { return getBoolValue( "PrintHiddenText", m_rDefaultPrintData.bPrintHiddenText ); } bool IsPrintWithBlackTextColor() const { return getBoolValue( "PrintBlackFonts", m_rDefaultPrintData.bPrintBlackFont ); } - sal_Int16 GetPrintPostItsType() const { return static_cast< sal_Int16 >(getIntValue( "PrintAnnotationMode", m_rDefaultPrintData.nPrintPostIts )); } + SwPostItMode GetPrintPostItsType() const { return static_cast< SwPostItMode >(getIntValue( "PrintAnnotationMode", static_cast<sal_uInt16>(m_rDefaultPrintData.nPrintPostIts) )); } bool IsPaperFromSetup() const { return getBoolValue( "PrintPaperFromSetup", m_rDefaultPrintData.bPaperFromSetup ); } bool IsPrintLeftPages() const; @@ -285,13 +296,6 @@ public: void SetPageRange( const OUString &rRange ) { m_aPageRange = rRange; } }; -/// last remnants of swprtopt.hxx: -#define POSTITS_NONE 0 -#define POSTITS_ONLY 1 -#define POSTITS_ENDDOC 2 -#define POSTITS_ENDPAGE 3 -#define POSTITS_INMARGINS 4 - namespace sw { void InitPrintOptionsFromApplication(SwPrintData & o_rData, bool const bWeb); diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 2d3866147018..75e1b3255929 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -736,12 +736,12 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( sal_Int32 nDocPageCount ) { - sal_Int16 nPostItMode = (sal_Int16) rOptions.getIntValue( "PrintAnnotationMode", 0 ); - OSL_ENSURE(nPostItMode == POSTITS_NONE || rData.HasPostItData(), + SwPostItMode nPostItMode = static_cast<SwPostItMode>( rOptions.getIntValue( "PrintAnnotationMode", 0 ) ); + OSL_ENSURE(nPostItMode == SwPostItMode::NONE || rData.HasPostItData(), "print post-its without post-it data?" ); const _SetGetExpFields::size_type nPostItCount = rData.HasPostItData() ? rData.m_pPostItFields->size() : 0; - if (nPostItMode != POSTITS_NONE && nPostItCount > 0) + if (nPostItMode != SwPostItMode::NONE && nPostItCount > 0) { SET_CURR_SHELL( rData.m_pPostItShell.get() ); @@ -755,7 +755,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 ); - // For mode POSTITS_ENDPAGE: + // For mode SwPostItMode::EndPage: // maps a physical page number to the page number in post-it document that holds // the first post-it for that physical page . Needed to relate the correct start frames // from the post-it doc to the physical page of the document @@ -776,16 +776,16 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( if (nPhyPageNum) { // need to insert a page break? - // In POSTITS_ENDPAGE mode for each document page the following + // In SwPostItMode::EndPage mode for each document page the following // post-it page needs to start on a new page - const bool bNewPage = nPostItMode == POSTITS_ENDPAGE && + const bool bNewPage = nPostItMode == SwPostItMode::EndPage && !bIsFirstPostIt && nPhyPageNum != nLastPageNum; lcl_FormatPostIt( &rData.m_pPostItShell->GetDoc()->getIDocumentContentOperations(), aPam, rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo ); bIsFirstPostIt = false; - if (nPostItMode == POSTITS_ENDPAGE) + if (nPostItMode == SwPostItMode::EndPage) { // get the correct number of current pages for the post-it document rData.m_pPostItShell->CalcLayout(); @@ -799,12 +799,12 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( rData.m_pPostItShell->CalcLayout(); const sal_Int32 nPostItDocPageCount = rData.m_pPostItShell->GetPageCount(); - if (nPostItMode == POSTITS_ONLY || nPostItMode == POSTITS_ENDDOC) + if (nPostItMode == SwPostItMode::Only || nPostItMode == SwPostItMode::EndDoc) { // now add those post-it pages to the vector of pages to print // or replace them if only post-its should be printed - if (nPostItMode == POSTITS_ONLY) + if (nPostItMode == SwPostItMode::Only) { // no document page to be printed rData.GetPagesToPrint().clear(); @@ -825,7 +825,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData( } OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" ); } - else if (nPostItMode == POSTITS_ENDPAGE) + else if (nPostItMode == SwPostItMode::EndPage) { // the next step is to find all the pages from the post-it // document that should be printed for a given physical page diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index fdc6d6ff24ca..36e94e2dc768 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1510,8 +1510,8 @@ SwEnhancedPDFExportHelper::~SwEnhancedPDFExportHelper() Rectangle SwEnhancedPDFExportHelper::SwRectToPDFRect(const SwPageFrm* pCurrPage, const Rectangle& rRectangle) const { - sal_Int16 nPostItMode = mrPrintData.GetPrintPostIts(); - if (nPostItMode != POSTITS_INMARGINS) + SwPostItMode nPostItMode = mrPrintData.GetPrintPostIts(); + if (nPostItMode != SwPostItMode::InMargins) return rRectangle; //the page has been scaled by 75% and vertically centered, so adjust these //rectangles equivalently diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx index 73363ae8e46d..665d26e133ac 100644 --- a/sw/source/core/view/printdata.cxx +++ b/sw/source/core/view/printdata.cxx @@ -312,7 +312,7 @@ SwPrintUIOptions::SwPrintUIOptions( aLocalizedStrings.GetString(12), OUString(), aContentsOpt); // create a list box for notes content - const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); + const SwPostItMode nPrintPostIts = rDefaultPrintData.GetPrintPostIts(); aChoices.realloc( 5 ); aChoices[0] = aLocalizedStrings.GetString( 13 ); aChoices[1] = aLocalizedStrings.GetString( 14 ); @@ -329,7 +329,7 @@ SwPrintUIOptions::SwPrintUIOptions( aHelpIds, "PrintAnnotationMode", aChoices, - nPrintPostIts, + static_cast<sal_uInt16>(nPrintPostIts), uno::Sequence< sal_Bool >(), aAnnotOpt); diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 109644860287..68670251d538 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -465,8 +465,8 @@ bool SwViewShell::PrintOrPDFExport( // output to the real outputdevice GDIMetaFile *pOrigRecorder(NULL); GDIMetaFile *pMetaFile(NULL); - sal_Int16 nPostItMode = rPrintData.GetPrintPostIts(); - if (nPostItMode == POSTITS_INMARGINS) + SwPostItMode nPostItMode = rPrintData.GetPrintPostIts(); + if (nPostItMode == SwPostItMode::InMargins) { //get and disable the existing recorder pOrigRecorder = pOutDev->GetConnectMetaFile(); @@ -537,7 +537,7 @@ bool SwViewShell::PrintOrPDFExport( SwPaintQueue::Repaint(); - SwPostItMgr *pPostItManager = (nPostItMode == POSTITS_INMARGINS) ? + SwPostItMgr *pPostItManager = (nPostItMode == SwPostItMode::InMargins) ? pShell->GetPostItMgr() : NULL; if (pPostItManager) { diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 81a7d49a5643..a01a055081ee 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -457,15 +457,15 @@ bool SwAddPrinterTabPage::FillItemSet( SfxItemSet* rCoreSet ) aAddPrinterAttr.bPrintSingleJobs = true; // handled by vcl in new print dialog since CWS printerpullpages /*aSingleJobsCB.IsChecked()*/; if (m_pNoRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = - POSTITS_NONE; + SwPostItMode::NONE; if (m_pOnlyRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = - POSTITS_ONLY; + SwPostItMode::Only; if (m_pEndRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = - POSTITS_ENDDOC; + SwPostItMode::EndDoc; if (m_pEndPageRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = - POSTITS_ENDPAGE; + SwPostItMode::EndPage; if (m_pInMarginsRB->IsChecked()) aAddPrinterAttr.nPrintPostIts = - POSTITS_INMARGINS; + SwPostItMode::InMargins; const OUString sFax = m_pFaxLB->GetSelectEntry(); aAddPrinterAttr.sFaxName = sNone == sFax ? aEmptyOUStr : sFax; @@ -495,11 +495,11 @@ void SwAddPrinterTabPage::Reset( const SfxItemSet* ) m_pProspectCB->Check( pAddPrinterAttr->bPrintProspect); m_pProspectCB_RTL->Check( pAddPrinterAttr->bPrintProspectRTL); - m_pNoRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_NONE ) ; - m_pOnlyRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ONLY ) ; - m_pEndRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDDOC ) ; - m_pEndPageRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_ENDPAGE ) ; - m_pInMarginsRB->Check (pAddPrinterAttr->nPrintPostIts== POSTITS_INMARGINS ) ; + m_pNoRB->Check (pAddPrinterAttr->nPrintPostIts== SwPostItMode::NONE ) ; + m_pOnlyRB->Check (pAddPrinterAttr->nPrintPostIts== SwPostItMode::Only ) ; + m_pEndRB->Check (pAddPrinterAttr->nPrintPostIts== SwPostItMode::EndDoc ) ; + m_pEndPageRB->Check (pAddPrinterAttr->nPrintPostIts== SwPostItMode::EndPage ) ; + m_pInMarginsRB->Check (pAddPrinterAttr->nPrintPostIts== SwPostItMode::InMargins ) ; m_pFaxLB->SelectEntry( pAddPrinterAttr->sFaxName ); } if (m_pProspectCB->IsChecked()) diff --git a/sw/source/uibase/config/prtopt.cxx b/sw/source/uibase/config/prtopt.cxx index 8899ad2ea63a..d772d5eeaaa8 100644 --- a/sw/source/uibase/config/prtopt.cxx +++ b/sw/source/uibase/config/prtopt.cxx @@ -94,7 +94,7 @@ SwPrintOptions::SwPrintOptions(bool bWeb) : { sal_Int32 nTmp = 0; pValues[nProp] >>= nTmp; - nPrintPostIts = (sal_Int16)nTmp; + nPrintPostIts = static_cast<SwPostItMode>(nTmp); } break; case 6: bPrintReverse = *static_cast<sal_Bool const *>(pValues[nProp].getValue()); break; diff --git a/sw/source/uibase/inc/cfgitems.hxx b/sw/source/uibase/inc/cfgitems.hxx index 4eb1966ffc8d..3aee28d4de77 100644 --- a/sw/source/uibase/inc/cfgitems.hxx +++ b/sw/source/uibase/inc/cfgitems.hxx @@ -151,7 +151,7 @@ public: bool IsPrintTextPlaceholder() const { return bPrintTextPlaceholder; } bool IsPrintSingleJobs() const { return bPrintSingleJobs; } - sal_uLong GetPrintPostIts () const { return nPrintPostIts; } + SwPostItMode GetPrintPostIts () const { return nPrintPostIts; } }; diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx index 483c2a40e5f5..9114ad8d8d17 100644 --- a/sw/source/uibase/uno/unomod.cxx +++ b/sw/source/uibase/uno/unomod.cxx @@ -365,9 +365,10 @@ void SwXPrintSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, break; case HANDLE_PRINTSET_ANNOTATION_MODE: { - sal_Int16 nVal = 0; - rValue >>= nVal; - if(nVal <= text::NotePrintMode_PAGE_END) + sal_Int16 nTmp = 0; + rValue >>= nTmp; + SwPostItMode nVal = static_cast<SwPostItMode>(nTmp); + if(nVal <= SwPostItMode::EndPage) mpPrtOpt->SetPrintPostIts(nVal); else throw lang::IllegalArgumentException(); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 4f7731a6a6fb..20718d273a03 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2628,8 +2628,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( } else { - const sal_Int16 nPostItMode = (sal_Int16) m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ); - if (nPostItMode != POSTITS_NONE) + const SwPostItMode nPostItMode = static_cast<SwPostItMode>( m_pPrintUIOptions->getIntValue( "PrintAnnotationMode", 0 ) ); + if (nPostItMode != SwPostItMode::NONE) { VclPtr< OutputDevice > pOutDev = lcl_GetOutputDevice( *m_pPrintUIOptions ); m_pRenderData->CreatePostItData( pDoc, pViewShell->GetViewOptions(), pOutDev ); @@ -2639,7 +2639,7 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( // and their start frames SwDoc::CalculatePagesForPrinting( *pViewShell->GetLayout(), *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); - if (nPostItMode != POSTITS_NONE) + if (nPostItMode != SwPostItMode::NONE) { SwDoc::UpdatePagesForPrintingWithPostItData( *m_pRenderData, *m_pPrintUIOptions, bIsPDFExport, nPageCount ); |