diff options
author | Caolán McNamara <caolanm@redhat.com> | 2010-12-20 17:10:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2010-12-20 17:10:42 +0000 |
commit | b3332728cf16af9ac1fcb9d604f383b29fd7d023 (patch) | |
tree | e413cbe98777fb7f25f20d2ee22081f7874e0bf4 /sw/source/ui/utlui/initui.cxx | |
parent | 25a8024703ce8aae4935dd59162104f224a0664d (diff) |
Ensure that only the three valid options are possible to use
Originally four cryptic possibilties, only three of which would
correctly give unique values. So refactor into three possibilties,
make self-documenting and lock it down with a cppunit test
Diffstat (limited to 'sw/source/ui/utlui/initui.cxx')
-rw-r--r-- | sw/source/ui/utlui/initui.cxx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx index dea456662b8e..30cc96423d59 100644 --- a/sw/source/ui/utlui/initui.cxx +++ b/sw/source/ui/utlui/initui.cxx @@ -198,11 +198,24 @@ ShellResource::~ShellResource() delete pAutoFmtNameLst, pAutoFmtNameLst = 0; } -String ShellResource::GetPageDescName( USHORT nNo, BOOL bIsFirst, BOOL bFollow ) +String ShellResource::GetPageDescName( USHORT nNo, PageNameMode eMode ) { - String sRet( bIsFirst ? sPageDescFirstName - : bFollow ? sPageDescFollowName - : sPageDescName ); + String sRet; + + switch (eMode) + { + case NORMAL_PAGE: + sRet = sPageDescName; + break; + break; + case FIRST_PAGE: + sRet = sPageDescFirstName; + break; + case FOLLOW_PAGE: + sRet = sPageDescFollowName; + break; + } + sRet.SearchAndReplaceAscii( "$(ARG1)", String::CreateFromInt32( nNo )); return sRet; } |