Simplify SmFontStyles::GetStyleName

Change-Id: I2df721af0eb60e28cd9882195f68a034a5fa802e
This commit is contained in:
Stephan Bergmann
2015-08-28 09:40:36 +02:00
parent 625c93a8da
commit a206b04ceb

View File

@@ -17,6 +17,10 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <sal/config.h>
#include <cassert>
#include "tools/rcid.h" #include "tools/rcid.h"
#include <comphelper/string.hxx> #include <comphelper/string.hxx>
#include <svl/eitem.hxx> #include <svl/eitem.hxx>
@@ -77,7 +81,6 @@ class SmFontStyles
OUString aBold; OUString aBold;
OUString aItalic; OUString aItalic;
OUString aBoldItalic; OUString aBoldItalic;
OUString aEmpty;
public: public:
SmFontStyles(); SmFontStyles();
@@ -118,17 +121,14 @@ const OUString& SmFontStyles::GetStyleName( sal_uInt16 nIdx ) const
// 0 = "normal", 1 = "italic", // 0 = "normal", 1 = "italic",
// 2 = "bold", 3 = "bold italic" // 2 = "bold", 3 = "bold italic"
#if OSL_DEBUG_LEVEL > 1 assert( nIdx < GetCount() );
OSL_ENSURE( nIdx < GetCount(), "index out of range" );
#endif
switch (nIdx) switch (nIdx)
{ {
case 0 : return aNormal; case 0 : return aNormal;
case 1 : return aItalic; case 1 : return aItalic;
case 2 : return aBold; case 2 : return aBold;
case 3 : return aBoldItalic; default: /*case 3:*/ return aBoldItalic;
} }
return aEmpty;
} }
const SmFontStyles & GetFontStyles() const SmFontStyles & GetFontStyles()