diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-16 16:57:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-22 13:31:57 +0200 |
commit | 60bc26354763fa3461db49a3e827da552484150d (patch) | |
tree | 5c66cee43f76f556f9a086a67fa8a6e88750c5d5 /xmloff/source/draw/shapeexport.cxx | |
parent | 7867e1f1cdd726cb98a236245e3d08557cc3a313 (diff) |
new loplugin:conststringfield
Look for const string fields which can be static, and
mostly convert them to OUStringLiteral
And add a getLength() method to OUStringLiteral to make
the transition easier.
Remove dead code in XclExpRoot::GenerateDefaultEncryptionData,
default password is never empty.
Change-Id: Iae75514d9dbb87289fd5b016222f640abe755091
Reviewed-on: https://gerrit.libreoffice.org/59204
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff/source/draw/shapeexport.cxx')
-rw-r--r-- | xmloff/source/draw/shapeexport.cxx | 89 |
1 files changed, 45 insertions, 44 deletions
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index 88af6541c444..36342fb1c66b 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -152,6 +152,27 @@ bool supportsText(XmlShapeType eShapeType) } +static const OUStringLiteral gsZIndex( "ZOrder" ); +static const OUStringLiteral gsPrintable( "Printable" ); +static const OUStringLiteral gsVisible( "Visible" ); +static const OUStringLiteral gsModel( "Model" ); +static const OUStringLiteral gsStartShape( "StartShape" ); +static const OUStringLiteral gsEndShape( "EndShape" ); +static const OUStringLiteral gsOnClick( "OnClick" ); +static const OUStringLiteral gsEventType( "EventType" ); +static const OUStringLiteral gsPresentation( "Presentation" ); +static const OUStringLiteral gsMacroName( "MacroName" ); +static const OUStringLiteral gsScript( "Script" ); +static const OUStringLiteral gsLibrary( "Library" ); +static const OUStringLiteral gsClickAction( "ClickAction" ); +static const OUStringLiteral gsBookmark( "Bookmark" ); +static const OUStringLiteral gsEffect( "Effect" ); +static const OUStringLiteral gsPlayFull( "PlayFull" ); +static const OUStringLiteral gsVerb( "Verb" ); +static const OUStringLiteral gsSoundURL( "SoundURL" ); +static const OUStringLiteral gsSpeed( "Speed" ); +static const OUStringLiteral gsStarBasic( "StarBasic" ); + XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, SvXMLExportPropertyMapper *pExtMapper ) : mrExport( rExp ), @@ -159,27 +180,7 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp, maCurrentShapesIter(maShapesInfos.end()), mbExportLayer( false ), // #88546# init to sal_False - mbHandleProgressBar( false ), - msZIndex( "ZOrder" ), - msPrintable( "Printable" ), - msVisible( "Visible" ), - msModel( "Model" ), - msStartShape( "StartShape" ), - msEndShape( "EndShape" ), - msOnClick( "OnClick" ), - msEventType( "EventType" ), - msPresentation( "Presentation" ), - msMacroName( "MacroName" ), - msScript( "Script" ), - msLibrary( "Library" ), - msClickAction( "ClickAction" ), - msBookmark( "Bookmark" ), - msEffect( "Effect" ), - msPlayFull( "PlayFull" ), - msVerb( "Verb" ), - msSoundURL( "SoundURL" ), - msSpeed( "Speed" ), - msStarBasic( "StarBasic" ) + mbHandleProgressBar( false ) { // construct PropertyHandlerFactory mxSdPropHdlFactory = new XMLSdPropHdlFactory( mrExport.GetModel(), rExp ); @@ -274,7 +275,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap sal_Int32 nZIndex = 0; uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY); if( xPropSet.is() ) - xPropSet->getPropertyValue(msZIndex) >>= nZIndex; + xPropSet->getPropertyValue(gsZIndex) >>= nZIndex; ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; @@ -535,11 +536,11 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap uno::Reference< uno::XInterface > xConnection; // create shape ids for export later - xPropSet->getPropertyValue( msStartShape ) >>= xConnection; + xPropSet->getPropertyValue( gsStartShape ) >>= xConnection; if( xConnection.is() ) mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection ); - xPropSet->getPropertyValue( msEndShape ) >>= xConnection; + xPropSet->getPropertyValue( gsEndShape ) >>= xConnection; if( xConnection.is() ) mrExport.getInterfaceToIdentifierMapper().registerReference( xConnection ); break; @@ -549,7 +550,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap { try { - uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); + uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( gsModel ), uno::UNO_QUERY_THROW ); GetShapeTableExport()->collectTableAutoStyles( xRange ); } catch(const uno::Exception&) @@ -626,7 +627,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape (eAction == presentation::ClickAction_BOOKMARK) ) { OUString sURL; - xSet->getPropertyValue(msBookmark) >>= sURL; + xSet->getPropertyValue(gsBookmark) >>= sURL; if( !sURL.isEmpty() ) { @@ -643,7 +644,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape } if( xSet.is() ) - xSet->getPropertyValue(msZIndex) >>= nZIndex; + xSet->getPropertyValue(gsZIndex) >>= nZIndex; ImplXMLShapeExportInfoVector& aShapeInfoVector = (*maCurrentShapesIter).second; @@ -762,8 +763,8 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape bool bVisible = true; bool bPrintable = true; - xSet->getPropertyValue(msVisible) >>= bVisible; - xSet->getPropertyValue(msPrintable) >>= bPrintable; + xSet->getPropertyValue(gsVisible) >>= bVisible; + xSet->getPropertyValue(gsPrintable) >>= bPrintable; XMLTokenEnum eDisplayToken = XML_TOKEN_INVALID; const unsigned short nDisplay = (bVisible ? 2 : 0) | (bPrintable ? 1 : 0); @@ -1614,58 +1615,58 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x OUString aStrBookmark; uno::Sequence< beans::PropertyValue > aClickProperties; - if( xEvents->hasByName( msOnClick ) && (xEvents->getByName( msOnClick ) >>= aClickProperties) ) + if( xEvents->hasByName( gsOnClick ) && (xEvents->getByName( gsOnClick ) >>= aClickProperties) ) { const beans::PropertyValue* pProperty = aClickProperties.getConstArray(); const beans::PropertyValue* pPropertyEnd = pProperty + aClickProperties.getLength(); for( ; pProperty != pPropertyEnd; ++pProperty ) { - if( !( nFound & Found::CLICKEVENTTYPE ) && pProperty->Name == msEventType ) + if( !( nFound & Found::CLICKEVENTTYPE ) && pProperty->Name == gsEventType ) { if( pProperty->Value >>= aClickEventType ) nFound |= Found::CLICKEVENTTYPE; } - else if( !( nFound & Found::CLICKACTION ) && pProperty->Name == msClickAction ) + else if( !( nFound & Found::CLICKACTION ) && pProperty->Name == gsClickAction ) { if( pProperty->Value >>= eClickAction ) nFound |= Found::CLICKACTION; } - else if( !( nFound & Found::MACRO ) && ( pProperty->Name == msMacroName || pProperty->Name == msScript ) ) + else if( !( nFound & Found::MACRO ) && ( pProperty->Name == gsMacroName || pProperty->Name == gsScript ) ) { if( pProperty->Value >>= aStrMacro ) nFound |= Found::MACRO; } - else if( !( nFound & Found::LIBRARY ) && pProperty->Name == msLibrary ) + else if( !( nFound & Found::LIBRARY ) && pProperty->Name == gsLibrary ) { if( pProperty->Value >>= aStrLibrary ) nFound |= Found::LIBRARY; } - else if( !( nFound & Found::EFFECT ) && pProperty->Name == msEffect ) + else if( !( nFound & Found::EFFECT ) && pProperty->Name == gsEffect ) { if( pProperty->Value >>= eEffect ) nFound |= Found::EFFECT; } - else if( !( nFound & Found::BOOKMARK ) && pProperty->Name == msBookmark ) + else if( !( nFound & Found::BOOKMARK ) && pProperty->Name == gsBookmark ) { if( pProperty->Value >>= aStrBookmark ) nFound |= Found::BOOKMARK; } - else if( !( nFound & Found::SPEED ) && pProperty->Name == msSpeed ) + else if( !( nFound & Found::SPEED ) && pProperty->Name == gsSpeed ) { if( pProperty->Value >>= eSpeed ) nFound |= Found::SPEED; } - else if( !( nFound & Found::SOUNDURL ) && pProperty->Name == msSoundURL ) + else if( !( nFound & Found::SOUNDURL ) && pProperty->Name == gsSoundURL ) { if( pProperty->Value >>= aStrSoundURL ) nFound |= Found::SOUNDURL; } - else if( !( nFound & Found::PLAYFULL ) && pProperty->Name == msPlayFull ) + else if( !( nFound & Found::PLAYFULL ) && pProperty->Name == gsPlayFull ) { if( pProperty->Value >>= bPlayFull ) nFound |= Found::PLAYFULL; } - else if( !( nFound & Found::VERB ) && pProperty->Name == msVerb ) + else if( !( nFound & Found::VERB ) && pProperty->Name == gsVerb ) { if( pProperty->Value >>= nVerb ) nFound |= Found::VERB; @@ -1675,7 +1676,7 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x // create the XML elements - if( aClickEventType == msPresentation ) + if( aClickEventType == gsPresentation ) { if( !(nFound & Found::CLICKACTION) || (eClickAction == presentation::ClickAction_NONE) ) return; @@ -1787,7 +1788,7 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x } } } - else if( aClickEventType == msStarBasic ) + else if( aClickEventType == gsStarBasic ) { if( nFound & Found::MACRO ) { @@ -1819,7 +1820,7 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, true, true); } } - else if( aClickEventType == msScript ) + else if( aClickEventType == gsScript ) { if( nFound & Found::MACRO ) { @@ -4880,7 +4881,7 @@ void XMLShapeExport::ImpExportTableShape( const uno::Reference< drawing::XShape } } - uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); + uno::Reference< table::XColumnRowRange > xRange( xPropSet->getPropertyValue( gsModel ), uno::UNO_QUERY_THROW ); GetShapeTableExport()->exportTable( xRange ); } } |