diff options
author | Noel Grandin <noel@peralex.com> | 2015-03-23 15:30:00 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-03-24 09:36:58 +0200 |
commit | b2125ae811c2fc2233026e5218a03bc24210a5c1 (patch) | |
tree | 3945a55c8d008a41645f4c05a8f53d93629710f1 | |
parent | ecec9afe852d3bca019b6b44a40d8be39e0f58f4 (diff) |
convert FILTER_APPLICATION to enum class
Change-Id: I9ad1d1c9a2d9d538a4cc95f0b65f45f631116916
-rw-r--r-- | include/sfx2/templateabstractview.hxx | 12 | ||||
-rw-r--r-- | sfx2/source/control/templateabstractview.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 12 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 37 |
4 files changed, 39 insertions, 38 deletions
diff --git a/include/sfx2/templateabstractview.hxx b/include/sfx2/templateabstractview.hxx index 5e316e10c430..5509374c25b2 100644 --- a/include/sfx2/templateabstractview.hxx +++ b/include/sfx2/templateabstractview.hxx @@ -31,13 +31,13 @@ class SfxDocumentTemplates; -enum FILTER_APPLICATION +enum class FILTER_APPLICATION { - FILTER_APP_NONE, - FILTER_APP_WRITER, - FILTER_APP_CALC, - FILTER_APP_IMPRESS, - FILTER_APP_DRAW + NONE, + WRITER, + CALC, + IMPRESS, + DRAW }; // Display template items depending on the generator application diff --git a/sfx2/source/control/templateabstractview.cxx b/sfx2/source/control/templateabstractview.cxx index d7858a47b50a..51b213d7d7e3 100644 --- a/sfx2/source/control/templateabstractview.cxx +++ b/sfx2/source/control/templateabstractview.cxx @@ -38,19 +38,19 @@ bool ViewFilter_Application::isFilteredExtension(FILTER_APPLICATION filter, cons { bool bRet = true; - if (filter == FILTER_APP_WRITER) + if (filter == FILTER_APPLICATION::WRITER) { bRet = rExt == "ott" || rExt == "stw" || rExt == "oth" || rExt == "dot" || rExt == "dotx" || rExt == "otm"; } - else if (filter == FILTER_APP_CALC) + else if (filter == FILTER_APPLICATION::CALC) { bRet = rExt == "ots" || rExt == "stc" || rExt == "xlt" || rExt == "xltm" || rExt == "xltx"; } - else if (filter == FILTER_APP_IMPRESS) + else if (filter == FILTER_APPLICATION::IMPRESS) { bRet = rExt == "otp" || rExt == "sti" || rExt == "pot" || rExt == "potm" || rExt == "potx"; } - else if (filter == FILTER_APP_DRAW) + else if (filter == FILTER_APPLICATION::DRAW) { bRet = rExt == "otg" || rExt == "std"; } @@ -249,13 +249,13 @@ BitmapEx TemplateAbstractView::getDefaultThumbnail( const OUString& rPath ) INetURLObject aUrl(rPath); OUString aExt = aUrl.getExtension(); - if ( ViewFilter_Application::isFilteredExtension( FILTER_APP_WRITER, aExt) ) + if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::WRITER, aExt) ) aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_TEXT ) ); - else if ( ViewFilter_Application::isFilteredExtension( FILTER_APP_CALC, aExt) ) + else if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::CALC, aExt) ) aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_SHEET ) ); - else if ( ViewFilter_Application::isFilteredExtension( FILTER_APP_IMPRESS, aExt) ) + else if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::IMPRESS, aExt) ) aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_PRESENTATION ) ); - else if ( ViewFilter_Application::isFilteredExtension( FILTER_APP_DRAW, aExt) ) + else if ( ViewFilter_Application::isFilteredExtension( FILTER_APPLICATION::DRAW, aExt) ) aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_DRAWING ) ); return aImg; diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index e0074b55abae..e7162427aab6 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -322,7 +322,7 @@ void BackingWindow::initializeLocalView() mbLocalViewInitialized = true; mpLocalView->Populate(); mpLocalView->showRootRegion(); - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE)); } } @@ -564,7 +564,7 @@ IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton ) { mpAllRecentThumbnails->Hide(); initializeLocalView(); - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE)); mpLocalView->Show(); mpLocalView->reload(); mpLocalView->GrabFocus(); @@ -580,19 +580,19 @@ IMPL_LINK( BackingWindow, MenuSelectHdl, MenuButton*, pButton ) if( sId == "filter_writer" ) { - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_WRITER)); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::WRITER)); } else if( sId == "filter_calc" ) { - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_CALC)); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::CALC)); } else if( sId == "filter_impress" ) { - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_IMPRESS)); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::IMPRESS)); } else if( sId == "filter_draw" ) { - mpLocalView->filterItems(ViewFilter_Application(FILTER_APP_DRAW)); + mpLocalView->filterItems(ViewFilter_Application(FILTER_APPLICATION::DRAW)); } else if( sId == "edit" ) { diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index a584a7d8f296..6b32d1ae58d2 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -136,19 +136,19 @@ public: INetURLObject aUrl(rItem.aPath); OUString aExt = aUrl.getExtension(); - if (meApp == FILTER_APP_WRITER) + if (meApp == FILTER_APPLICATION::WRITER) { bRet = aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx"; } - else if (meApp == FILTER_APP_CALC) + else if (meApp == FILTER_APPLICATION::CALC) { bRet = aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx"; } - else if (meApp == FILTER_APP_IMPRESS) + else if (meApp == FILTER_APPLICATION::IMPRESS) { bRet = aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx"; } - else if (meApp == FILTER_APP_DRAW) + else if (meApp == FILTER_APPLICATION::DRAW) { bRet = aExt == "otg" || aExt == "std"; } @@ -289,7 +289,7 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg(vcl::Window *parent) createDefaultTemplateMenu(); mpLocalView->Populate(); - mpCurView->filterItems(ViewFilter_Application(FILTER_APP_WRITER)); + mpCurView->filterItems(ViewFilter_Application(FILTER_APPLICATION::WRITER)); readSettings(); @@ -330,7 +330,7 @@ void SfxTemplateManagerDlg::setSaveMode() while (mpTabControl->GetPageCount() > 1) mpTabControl->RemovePage(mpTabControl->GetPageId(1)); - mpCurView->filterItems(ViewFilter_Application(FILTER_APP_NONE)); + mpCurView->filterItems(ViewFilter_Application(FILTER_APPLICATION::NONE)); mpViewBar->ShowItem(VIEWBAR_SAVE); mpViewBar->HideItem(VIEWBAR_IMPORT); @@ -356,15 +356,15 @@ FILTER_APPLICATION SfxTemplateManagerDlg::getCurrentFilter() const sal_uInt16 nCurPageId = mpTabControl->GetCurPageId(); if (nCurPageId == mpTabControl->GetPageId(FILTER_DOCS)) - return FILTER_APP_WRITER; + return FILTER_APPLICATION::WRITER; else if (nCurPageId == mpTabControl->GetPageId(FILTER_PRESENTATIONS)) - return FILTER_APP_IMPRESS; + return FILTER_APPLICATION::IMPRESS; else if (nCurPageId == mpTabControl->GetPageId(FILTER_SHEETS)) - return FILTER_APP_CALC; + return FILTER_APPLICATION::CALC; else if (nCurPageId == mpTabControl->GetPageId(FILTER_DRAWINGS)) - return FILTER_APP_DRAW; + return FILTER_APPLICATION::DRAW; - return FILTER_APP_NONE; + return FILTER_APPLICATION::NONE; } IMPL_LINK_NOARG(SfxTemplateManagerDlg,ActivatePageHdl) @@ -386,24 +386,25 @@ void SfxTemplateManagerDlg::readSettings () if ( aViewSettings.Exists() ) { - sal_uInt16 nFilter = 0; + sal_uInt16 nTmp = 0; aViewSettings.GetUserItem(TM_SETTING_LASTFOLDER) >>= aLastFolder; - aViewSettings.GetUserItem(TM_SETTING_FILTER) >>= nFilter; - + aViewSettings.GetUserItem(TM_SETTING_FILTER) >>= nTmp; + FILTER_APPLICATION nFilter = static_cast<FILTER_APPLICATION>(nTmp); switch (nFilter) { - case FILTER_APP_WRITER: + case FILTER_APPLICATION::WRITER: nPageId = mpTabControl->GetPageId(FILTER_DOCS); break; - case FILTER_APP_IMPRESS: + case FILTER_APPLICATION::IMPRESS: nPageId = mpTabControl->GetPageId(FILTER_PRESENTATIONS); break; - case FILTER_APP_CALC: + case FILTER_APPLICATION::CALC: nPageId = mpTabControl->GetPageId(FILTER_SHEETS); break; - case FILTER_APP_DRAW: + case FILTER_APPLICATION::DRAW: nPageId = mpTabControl->GetPageId(FILTER_DRAWINGS); break; + default: break; } } |