diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2013-04-26 20:19:08 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-05-02 17:00:35 +0200 |
commit | 829027abe3d9c7f0419fbf311dffb31b0b72b028 (patch) | |
tree | 87f24f6da34402ee929bf73fb218eefe9b07e534 /xmloff | |
parent | Some code scrubing (diff) | |
download | core-829027abe3d9c7f0419fbf311dffb31b0b72b028.tar.gz core-829027abe3d9c7f0419fbf311dffb31b0b72b028.zip |
ditch explicit char arrays for string literals
Change-Id: I77a4f6d338751c00942f091f4267e5f7d1d1742f
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/style/xmlnume.cxx | 76 | ||||
-rw-r--r-- | xmloff/source/style/xmlnumi.cxx | 96 |
2 files changed, 49 insertions, 123 deletions
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx index 7cbc207cc981..0493325ae578 100644 --- a/xmloff/source/style/xmlnume.cxx +++ b/xmloff/source/style/xmlnume.cxx @@ -59,31 +59,6 @@ using namespace ::com::sun::star::container; using namespace ::com::sun::star::beans; using namespace ::xmloff::token; -static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = "SymbolTextDistance"; -static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = "ParentNumbering"; -static sal_Char const XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = "CharStyleName"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_CHAR[] = "BulletChar"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor"; -static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_BITMAP[] = "GraphicBitmap"; -static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = "GraphicSize"; -static sal_Char const XML_UNO_NAME_NRULE_VERT_ORIENT[] = "VertOrient"; -static sal_Char const XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType"; -static sal_Char const XML_UNO_NAME_NRULE_HEADING_STYLE_NAME[] = "HeadingStyleName"; -static sal_Char const XML_UNO_NAME_NRULE_PREFIX[] = "Prefix"; -static sal_Char const XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix"; -static sal_Char const XML_UNO_NAME_NRULE_ADJUST[] = "Adjust"; -static sal_Char const XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin"; -static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] = "FirstLineOffset"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont"; -static sal_Char const XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL"; -static sal_Char const XML_UNO_NAME_NRULE_START_WITH[] = "StartWith"; -static sal_Char const XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode"; -static sal_Char const XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy"; -static sal_Char const XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition"; -static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent"; -static sal_Char const XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt"; - void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< ::com::sun::star::container::XIndexReplace > & xNumRule, sal_Bool bOutline ) { @@ -137,19 +112,19 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, { const beans::PropertyValue& rProp = pPropArray[i]; - if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_NUMBERINGTYPE, sizeof(XML_UNO_NAME_NRULE_NUMBERINGTYPE)-1 ) ) + if( rProp.Name == "NumberingType" ) { rProp.Value >>= eType; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PREFIX, sizeof(XML_UNO_NAME_NRULE_PREFIX)-1 ) ) + else if( rProp.Name == "Prefix" ) { rProp.Value >>= sPrefix; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SUFFIX, sizeof(XML_UNO_NAME_NRULE_SUFFIX)-1 ) ) + else if( rProp.Name == "Suffix" ) { rProp.Value >>= sSuffix; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_CHAR, sizeof(XML_UNO_NAME_NRULE_BULLET_CHAR)-1 ) ) + else if( rProp.Name == "BulletChar" ) { OUString sValue; rProp.Value >>= sValue; @@ -158,17 +133,17 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, cBullet = (sal_Unicode)sValue[0]; } } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_RELSIZE, sizeof(XML_UNO_NAME_NRULE_BULLET_RELSIZE)-1 ) ) + else if( rProp.Name == "BulletRelSize" ) { rProp.Value >>= nBullRelSize; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_ADJUST, sizeof(XML_UNO_NAME_NRULE_ADJUST)-1 ) ) + else if( rProp.Name == "Adjust" ) { sal_Int16 nValue = 0; rProp.Value >>= nValue; eAdjust = nValue; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_FONT, sizeof(XML_UNO_NAME_NRULE_BULLET_FONT)-1 ) ) + else if( rProp.Name == "BulletFont" ) { awt::FontDescriptor rFDesc; if( rProp.Value >>= rFDesc ) @@ -180,46 +155,46 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, eBulletFontEncoding = (rtl_TextEncoding)rFDesc.CharSet; } } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHICURL, sizeof(XML_UNO_NAME_NRULE_GRAPHICURL)-1 ) ) + else if( rProp.Name == "GraphicURL" ) { rProp.Value >>= sImageURL; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_BITMAP, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_BITMAP)-1 ) ) + else if( rProp.Name == "GraphicBitmap" ) { rProp.Value >>= xBitmap; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_BULLET_COLOR, sizeof(XML_UNO_NAME_NRULE_BULLET_COLOR)-1 ) ) + else if( rProp.Name == "BulletColor" ) { rProp.Value >>= nColor; bHasColor = sal_True; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_START_WITH, sizeof(XML_UNO_NAME_NRULE_START_WITH)-1 ) ) + else if( rProp.Name == "StartWith" ) { rProp.Value >>= nStartValue; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LEFT_MARGIN, sizeof(XML_UNO_NAME_NRULE_LEFT_MARGIN)-1 ) ) + else if( rProp.Name == "LeftMargin" ) { rProp.Value >>= nSpaceBefore; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET, sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET)-1 ) ) + else if( rProp.Name == "FirstLineOffset" ) { rProp.Value >>= nMinLabelWidth; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE, sizeof(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE)-1 ) ) + else if( rProp.Name == "SymbolTextDistance" ) { rProp.Value >>= nMinLabelDist; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_PARENT_NUMBERING, sizeof(XML_UNO_NAME_NRULE_PARENT_NUMBERING)-1 ) ) + else if( rProp.Name == "ParentNumbering" ) { rProp.Value >>= nDisplayLevels; if( nDisplayLevels > nLevel+1 ) nDisplayLevels = static_cast<sal_Int16>( nLevel )+1; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME, sizeof(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME)-1 ) ) + else if( rProp.Name == "CharStyleName" ) { rProp.Value >>= sTextStyleName; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_GRAPHIC_SIZE, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_SIZE)-1 ) ) + else if( rProp.Name == "GraphicSize" ) { awt::Size aSize; if( rProp.Value >>= aSize ) @@ -228,38 +203,33 @@ void SvxXMLNumRuleExport::exportLevelStyle( sal_Int32 nLevel, nImageHeight = aSize.Height; } } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_VERT_ORIENT, sizeof(XML_UNO_NAME_NRULE_VERT_ORIENT)-1 ) ) + else if( rProp.Name == "VertOrient" ) { sal_Int16 nValue = 0; rProp.Value >>= nValue; eImageVertOrient = nValue; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE, - sizeof(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE)-1 ) ) + else if( rProp.Name == "PositionAndSpaceMode" ) { sal_Int16 nValue = 0; rProp.Value >>= nValue; ePosAndSpaceMode = nValue; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY, - sizeof(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY)-1 ) ) + else if( rProp.Name == "LabelFollowedBy" ) { sal_Int16 nValue = 0; rProp.Value >>= nValue; eLabelFollowedBy = nValue; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION, - sizeof(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION)-1 ) ) + else if( rProp.Name == "ListtabStopPosition" ) { rProp.Value >>= nListtabStopPosition; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_FIRST_LINE_INDENT, - sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT)-1 ) ) + else if( rProp.Name == "FirstLineIndent" ) { rProp.Value >>= nFirstLineIndent; } - else if( rProp.Name.equalsAsciiL( XML_UNO_NAME_NRULE_INDENT_AT, - sizeof(XML_UNO_NAME_NRULE_INDENT_AT)-1 ) ) + else if( rProp.Name == "IndentAt" ) { rProp.Value >>= nIndentAt; } diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index ee243bbb9988..af11d3571cce 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -65,35 +65,6 @@ using namespace ::com::sun::star::frame; using namespace ::xmloff::token; using namespace ::com::sun::star::io; -static sal_Char const XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = - "SymbolTextDistance"; -static sal_Char const XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = - "ParentNumbering"; -static sal_Char const XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = - "CharStyleName"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_CHAR[] ="BulletChar"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_RELSIZE[] = "BulletRelSize"; -static sal_Char const XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = - "GraphicSize"; -static sal_Char const XML_UNO_NAME_NRULE_VERT_ORIENT[] ="VertOrient"; - -static sal_Char const XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType"; -static sal_Char const XML_UNO_NAME_NRULE_PREFIX[] = "Prefix"; -static sal_Char const XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix"; -static sal_Char const XML_UNO_NAME_NRULE_ADJUST[] = "Adjust"; -static sal_Char const XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin"; -static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] = - "FirstLineOffset"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont"; -static sal_Char const XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL"; -static sal_Char const XML_UNO_NAME_NRULE_START_WITH[] = "StartWith"; -static sal_Char const XML_UNO_NAME_NRULE_BULLET_COLOR[] = "BulletColor"; -static sal_Char const XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE[] = "PositionAndSpaceMode"; -static sal_Char const XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY[] = "LabelFollowedBy"; -static sal_Char const XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION[] = "ListtabStopPosition"; -static sal_Char const XML_UNO_NAME_NRULE_FIRST_LINE_INDENT[] = "FirstLineIndent"; -static sal_Char const XML_UNO_NAME_NRULE_INDENT_AT[] = "IndentAt"; - // --------------------------------------------------------------------- class SvxXMLListLevelStyleContext_Impl; @@ -493,48 +464,39 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties( { beans::PropertyValue *pProps = aPropSeq.getArray(); sal_Int32 nPos = 0; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_NUMBERINGTYPE ); + pProps[nPos].Name = "NumberingType"; pProps[nPos++].Value <<= (sal_Int16)eType ; - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_PREFIX ); + pProps[nPos].Name = "Prefix"; pProps[nPos++].Value <<= sPrefix; - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_SUFFIX ); + pProps[nPos].Name = "Suffix"; pProps[nPos++].Value <<= sSuffix; - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_ADJUST ); + pProps[nPos].Name = "Adjust"; pProps[nPos++].Value <<= eAdjust; sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_LEFT_MARGIN ); + pProps[nPos].Name = "LeftMargin"; pProps[nPos++].Value <<= (sal_Int32)nLeftMargin; sal_Int32 nFirstLineOffset = -nMinLabelWidth; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET ); + pProps[nPos].Name = "FirstLineOffset"; pProps[nPos++].Value <<= (sal_Int32)nFirstLineOffset; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE); + pProps[nPos].Name = "SymbolTextDistance"; pProps[nPos++].Value <<= (sal_Int16)nMinLabelDist; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_POSITION_AND_SPACE_MODE); + pProps[nPos].Name = "PositionAndSpaceMode"; pProps[nPos++].Value <<= (sal_Int16)ePosAndSpaceMode; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_LABEL_FOLLOWED_BY); + pProps[nPos].Name = "LabelFollowedBy"; pProps[nPos++].Value <<= (sal_Int16)eLabelFollowedBy; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_LISTTAB_STOP_POSITION); + pProps[nPos].Name = "ListtabStopPosition"; pProps[nPos++].Value <<= (sal_Int32)nListtabStopPosition; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_FIRST_LINE_INDENT); + pProps[nPos].Name = "FirstLineIndent"; pProps[nPos++].Value <<= (sal_Int32)nFirstLineIndent; - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_INDENT_AT); + pProps[nPos].Name = "IndentAt"; pProps[nPos++].Value <<= (sal_Int32)nIndentAt; OUString sDisplayTextStyleName = GetImport().GetStyleDisplayName( @@ -542,8 +504,7 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties( OUString sStyleName = sDisplayTextStyleName; if( !sStyleName.isEmpty() && pI18NMap ) sStyleName = pI18NMap->Get( SFX_STYLE_FAMILY_CHAR, sStyleName ); - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME ); + pProps[nPos].Name = "CharStyleName"; pProps[nPos++].Value <<= sDisplayTextStyleName; if( bBullet ) @@ -576,12 +537,11 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties( { OUStringBuffer sTmp(1); sTmp.append( cBullet ); - pProps[nPos].Name = - OUString(XML_UNO_NAME_NRULE_BULLET_CHAR ); + pProps[nPos].Name = "BulletChar"; pProps[nPos++].Value <<= sTmp.makeStringAndClear(); } - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_BULLET_FONT ); + pProps[nPos].Name = "BulletFont"; pProps[nPos++].Value <<= aFDesc; } @@ -601,36 +561,36 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties( if( !sStr.isEmpty() ) { - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_GRAPHICURL ); + pProps[nPos].Name = "GraphicURL"; pProps[nPos++].Value <<= sStr; } awt::Size aSize( nImageWidth, nImageHeight ); - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_GRAPHIC_SIZE ); + pProps[nPos].Name = "GraphicSize"; pProps[nPos++].Value <<= aSize; - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_VERT_ORIENT ); + pProps[nPos].Name = "VertOrient"; pProps[nPos++].Value <<= (sal_Int16)eImageVertOrient; } if( bNum ) { - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_START_WITH ); + pProps[nPos].Name = "StartWith"; pProps[nPos++].Value <<= (sal_Int16)nNumStartValue; - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_PARENT_NUMBERING); + pProps[nPos].Name = "ParentNumbering"; pProps[nPos++].Value <<= (sal_Int16)nNumDisplayLevels; } if( ( bNum || bBullet ) && nRelSize ) { - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_BULLET_RELSIZE ); + pProps[nPos].Name = "BulletRelSize"; pProps[nPos++].Value <<= nRelSize; } if( !bImage && bHasColor ) { - pProps[nPos].Name = OUString(XML_UNO_NAME_NRULE_BULLET_COLOR ); + pProps[nPos].Name = "BulletColor"; pProps[nPos++].Value <<= m_nColor; } @@ -1330,8 +1290,7 @@ void SvxXMLListStyleContext::SetDefaultStyle( Sequence<beans::PropertyValue> aPropSeq( bOrdered ? 1 : 4 ); beans::PropertyValue *pProps = aPropSeq.getArray(); - pProps->Name = - OUString(XML_UNO_NAME_NRULE_NUMBERINGTYPE ); + pProps->Name = "NumberingType"; (pProps++)->Value <<= (sal_Int16)(bOrdered ? NumberingType::ARABIC : NumberingType::CHAR_SPECIAL ); if( !bOrdered ) @@ -1349,17 +1308,14 @@ void SvxXMLListStyleContext::SetDefaultStyle( aFDesc.Pitch = PITCH_DONTKNOW ; aFDesc.CharSet = RTL_TEXTENCODING_SYMBOL ; aFDesc.Weight = WEIGHT_DONTKNOW; - pProps->Name = - OUString(XML_UNO_NAME_NRULE_BULLET_FONT ); + pProps->Name = "BulletFont"; (pProps++)->Value <<= aFDesc; OUStringBuffer sTmp(1); sTmp.append( (sal_Unicode)(0xF000 + 149) ); - pProps->Name = - OUString(XML_UNO_NAME_NRULE_BULLET_CHAR ); + pProps->Name = "BulletChar"; (pProps++)->Value <<= sTmp.makeStringAndClear(); - pProps->Name = - OUString(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME ); + pProps->Name = "CharStyleName"; (pProps++)->Value <<= OUString( "Numbering Symbols" ); } |