diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-01 13:10:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2016-11-01 13:25:08 +0000 |
commit | 9bdec0831afc45af45ea6d9350ef3372188b45cb (patch) | |
tree | 9f761fe2589569a7cd0fbafd6e5fcc4d350d4d64 /sd/source | |
parent | 49c7bc5af291dbf6b34bcea82c9c0513f65b308b (diff) |
loplugin:oncevar in sd..svgio
Change-Id: I58565460fcc3279c9771c6e1272d0af540b2c87c
Reviewed-on: https://gerrit.libreoffice.org/30459
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source')
-rw-r--r-- | sd/source/filter/eppt/epptso.cxx | 23 | ||||
-rw-r--r-- | sd/source/filter/xml/sdxmlwrp.cxx | 13 | ||||
-rw-r--r-- | sd/source/ui/dlg/TemplateScanner.cxx | 28 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx | 12 | ||||
-rw-r--r-- | sd/source/ui/slidesorter/controller/SlsListener.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/unoidl/unomodel.cxx | 6 |
6 files changed, 29 insertions, 60 deletions
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index 01613759ad2c..3a320e1285b5 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -3033,12 +3033,8 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc { try { - static const char sModel[] = "Model"; - static const char sWidth[] = "Width"; - static const char sHeight[] = "Height"; - uno::Reference< table::XTable > xTable; - if ( mXPropSet->getPropertyValue( sModel ) >>= xTable ) + if ( mXPropSet->getPropertyValue( "Model" ) >>= xTable ) { uno::Reference< table::XColumnRowRange > xColumnRowRange( xTable, uno::UNO_QUERY_THROW ); uno::Reference< container::XIndexAccess > xColumns( xColumnRowRange->getColumns(), uno::UNO_QUERY_THROW ); @@ -3055,7 +3051,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc { uno::Reference< beans::XPropertySet > xPropSet( xColumns->getByIndex( x ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); - xPropSet->getPropertyValue( sWidth ) >>= aS.Width; + xPropSet->getPropertyValue( "Width" ) >>= aS.Width; awt::Size aM( MapSize( aS ) ); aColumns.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Width ) ); nPosition += aM.Width; @@ -3068,7 +3064,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc { uno::Reference< beans::XPropertySet > xPropSet( xRows->getByIndex( y ), uno::UNO_QUERY_THROW ); awt::Size aS( 0, 0 ); - xPropSet->getPropertyValue( sHeight ) >>= aS.Height; + xPropSet->getPropertyValue( "Height" ) >>= aS.Height; awt::Size aM( MapSize( aS ) ); aRows.push_back( std::pair< sal_Int32, sal_Int32 >( nPosition, aM.Height ) ); nPosition += aM.Height; @@ -3174,11 +3170,6 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc } } - static const char sTopBorder[] = "TopBorder"; - static const char sBottomBorder[] = "BottomBorder"; - static const char sLeftBorder[] = "LeftBorder"; - static const char sRightBorder[] = "RightBorder"; - // creating horz lines for( sal_Int32 nLine = 0; nLine < ( xRows->getCount() + 1 ); nLine++ ) { @@ -3196,7 +3187,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc { uno::Reference< beans::XPropertySet > xPropSet2( xCell, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; - if ( xPropSet2->getPropertyValue( sTopBorder ) >>= aBorderLine ) + if ( xPropSet2->getPropertyValue( "TopBorder" ) >>= aBorderLine ) aCellBorder.maCellBorder = aBorderLine; sal_Int32 nRight = GetCellRight( nColumn, maRect,aColumns,xCell ); bTop = ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos, @@ -3222,7 +3213,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn, nRow - 1 ), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xPropSet2( xCellOwn, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; - if ( xPropSet2->getPropertyValue( sBottomBorder ) >>= aBorderLine ) + if ( xPropSet2->getPropertyValue( "BottomBorder" ) >>= aBorderLine ) aCellBorder.maCellBorder = aBorderLine; ImplCreateCellBorder( &aCellBorder, aCellBorder.mnPos, nBottom, nRight, nBottom); @@ -3253,7 +3244,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc { uno::Reference< beans::XPropertySet > xCellSet( xCell, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; - if ( xCellSet->getPropertyValue( sLeftBorder ) >>= aBorderLine ) + if ( xCellSet->getPropertyValue( "LeftBorder" ) >>= aBorderLine ) aCellBorder.maCellBorder = aBorderLine; sal_Int32 nBottom = GetCellBottom( nRow, maRect, aRows,xCell ); bLeft = ImplCreateCellBorder( &aCellBorder, aColumns[nLine].first, aCellBorder.mnPos, @@ -3275,7 +3266,7 @@ void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape >& rXShape, Esc uno::Reference< table::XMergeableCell > xCellOwn( xCellRange->getCellByPosition( nColumn - 1, nRow ), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xCellSet( xCellOwn, uno::UNO_QUERY_THROW ); table::BorderLine aBorderLine; - if ( xCellSet->getPropertyValue( sRightBorder ) >>= aBorderLine ) + if ( xCellSet->getPropertyValue( "RightBorder" ) >>= aBorderLine ) aCellBorder.maCellBorder = aBorderLine; ImplCreateCellBorder( &aCellBorder, nRight, aCellBorder.mnPos, nRight, nBottom ); diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index 6f260913ddc8..7d5eba3afce6 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -78,11 +78,6 @@ using namespace comphelper; #define SD_XML_READERROR 1234 -char const sXML_metaStreamName[] = "meta.xml"; -char const sXML_styleStreamName[] = "styles.xml"; -char const sXML_contentStreamName[] = "content.xml"; -char const sXML_settingsStreamName[] = "settings.xml"; - char const sXML_export_impress_meta_oasis_service[] = "com.sun.star.comp.Impress.XMLOasisMetaExporter"; char const sXML_export_impress_styles_oasis_service[] = "com.sun.star.comp.Impress.XMLOasisStylesExporter"; char const sXML_export_impress_content_oasis_service[] = "com.sun.star.comp.Impress.XMLOasisContentExporter"; @@ -918,18 +913,18 @@ bool SdXMLFilter::Export() XML_SERVICEMAP aServices[5]; sal_uInt16 i = 0; aServices[i ].mpService = pServiceNames->mpStyles; - aServices[i++].mpStream = sXML_styleStreamName; + aServices[i++].mpStream = "styles.xml"; aServices[i ].mpService = pServiceNames->mpContent; - aServices[i++].mpStream = sXML_contentStreamName; + aServices[i++].mpStream = "content.xml"; aServices[i ].mpService = pServiceNames->mpSettings; - aServices[i++].mpStream = sXML_settingsStreamName; + aServices[i++].mpStream = "settings.xml"; if( mrDocShell.GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) { aServices[i ].mpService = pServiceNames->mpMeta; - aServices[i++].mpStream = sXML_metaStreamName; + aServices[i++].mpStream = "meta.xml"; }; aServices[i].mpService = nullptr; diff --git a/sd/source/ui/dlg/TemplateScanner.cxx b/sd/source/ui/dlg/TemplateScanner.cxx index 0f6723d503b6..ab816b504af2 100644 --- a/sd/source/ui/dlg/TemplateScanner.cxx +++ b/sd/source/ui/dlg/TemplateScanner.cxx @@ -44,17 +44,6 @@ using namespace ::com::sun::star::uno; namespace { const char TITLE[] = "Title"; -const char TARGET_DIR_URL[] = "TargetDirURL"; -const char DESCRIPTION[] = "TypeDescription"; -const char TARGET_URL[] = "TargetURL"; - -// These strings are used to find impress templates in the tree of -// template files. Should probably be determined dynamically. -const char IMPRESS_BIN_TEMPLATE[] = "application/vnd.stardivision.impress"; -const char IMPRESS_XML_TEMPLATE[] = MIMETYPE_VND_SUN_XML_IMPRESS_ASCII; -// The following id comes from the bugdoc in #i2764#. -const char IMPRESS_XML_TEMPLATE_B[] = "Impress 2.0"; -const char IMPRESS_XML_TEMPLATE_OASIS[] = MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII; class FolderDescriptor { @@ -211,8 +200,8 @@ TemplateScanner::State TemplateScanner::InitializeEntryScanning() // its URL, and its content type. Sequence<OUString> aProps (3); aProps[0] = TITLE; - aProps[1] = TARGET_URL; - aProps[2] = DESCRIPTION; + aProps[1] = "TargetURL"; + aProps[2] = "TypeDescription"; // Create a cursor to iterate over the templates in this folders. ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_DOCUMENTS_ONLY; @@ -246,11 +235,14 @@ TemplateScanner::State TemplateScanner::ScanEntry() // Check whether the entry is an impress template. If so // add a new entry to the resulting list (which is created // first if necessary). + // These strings are used to find impress templates in the tree of + // template files. Should probably be determined dynamically. if ( (sContentType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_TEMPLATE_ASCII) - || (sContentType == IMPRESS_XML_TEMPLATE_OASIS) - || (sContentType == IMPRESS_BIN_TEMPLATE) - || (sContentType == IMPRESS_XML_TEMPLATE) - || (sContentType == IMPRESS_XML_TEMPLATE_B)) + || (sContentType == MIMETYPE_OASIS_OPENDOCUMENT_PRESENTATION_ASCII) + || (sContentType == "application/vnd.stardivision.impress") + || (sContentType == MIMETYPE_VND_SUN_XML_IMPRESS_ASCII) + // The following id comes from the bugdoc in #i2764#. + || (sContentType == "Impress 2.0")) { OUString sLocalisedTitle = SfxDocumentTemplates::ConvertResourceString( STR_TEMPLATE_NAME1_DEF, STR_TEMPLATE_NAME1, NUM_TEMPLATE_NAMES, sTitle ); @@ -298,7 +290,7 @@ TemplateScanner::State TemplateScanner::InitializeFolderScanning() // Define the list of properties we are interested in. Sequence<OUString> aProps (2); aProps[0] = TITLE; - aProps[1] = TARGET_DIR_URL; + aProps[1] = "TargetDirURL"; // Create an cursor to iterate over the template folders. ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_ONLY; diff --git a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx index 694da4fc5b62..6e318c077a74 100644 --- a/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx +++ b/sd/source/ui/slidesorter/cache/SlsCacheCompactor.cxx @@ -82,27 +82,23 @@ namespace sd { namespace slidesorter { namespace cache { sal_Int32 nMaximalCacheSize) { static const char sNone[] = "None"; - static const char sCompress[] = "Compress"; - static const char sErase[] = "Erase"; - static const char sResolution[] = "ResolutionReduction"; - static const char sPNGCompression[] = "PNGCompression"; std::shared_ptr<BitmapCompressor> pCompressor; - OUString sCompressionPolicy(sPNGCompression); + OUString sCompressionPolicy("PNGCompression"); Any aCompressionPolicy (CacheConfiguration::Instance()->GetValue("CompressionPolicy")); if (aCompressionPolicy.has<OUString>()) aCompressionPolicy >>= sCompressionPolicy; if (sCompressionPolicy == sNone) pCompressor.reset(new NoBitmapCompression()); - else if (sCompressionPolicy == sErase) + else if (sCompressionPolicy == "Erase") pCompressor.reset(new CompressionByDeletion()); - else if (sCompressionPolicy == sResolution) + else if (sCompressionPolicy == "ResolutionReduction") pCompressor.reset(new ResolutionReduction()); else pCompressor.reset(new PngCompression()); ::std::unique_ptr<CacheCompactor> pCompactor; - OUString sCompactionPolicy(sCompress); + OUString sCompactionPolicy("Compress"); Any aCompactionPolicy (CacheConfiguration::Instance()->GetValue("CompactionPolicy")); if (aCompactionPolicy.has<OUString>()) aCompactionPolicy >>= sCompactionPolicy; diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index cbcd84241338..4e7ed4167752 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -451,10 +451,7 @@ void SAL_CALL Listener::propertyChange ( static_cast<uno::XWeak*>(this)); } - static const char sCurrentPagePropertyName[] = "CurrentPage"; - static const char sEditModePropertyName[] = "IsMasterPageMode"; - - if (rEvent.PropertyName == sCurrentPagePropertyName) + if (rEvent.PropertyName == "CurrentPage") { Any aCurrentPage = rEvent.NewValue; Reference<beans::XPropertySet> xPageSet (aCurrentPage, UNO_QUERY); @@ -483,7 +480,7 @@ void SAL_CALL Listener::propertyChange ( } } } - else if (rEvent.PropertyName == sEditModePropertyName) + else if (rEvent.PropertyName == "IsMasterPageMode") { bool bIsMasterPageMode = false; rEvent.NewValue >>= bIsMasterPageMode; diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index f67ef5911d9d..a648abf91e9a 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -2947,7 +2947,6 @@ void SAL_CALL SdDrawPagesAccess::remove( const uno::Reference< drawing::XDrawPag } // XServiceInfo -const char pSdDrawPagesAccessService[] = "com.sun.star.drawing.DrawPages"; OUString SAL_CALL SdDrawPagesAccess::getImplementationName( ) throw(uno::RuntimeException, std::exception) { @@ -2961,7 +2960,7 @@ sal_Bool SAL_CALL SdDrawPagesAccess::supportsService( const OUString& ServiceNam uno::Sequence< OUString > SAL_CALL SdDrawPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception) { - OUString aService( pSdDrawPagesAccessService ); + OUString aService( "com.sun.star.drawing.DrawPages" ); uno::Sequence< OUString > aSeq( &aService, 1 ); return aSeq; } @@ -3213,7 +3212,6 @@ void SAL_CALL SdMasterPagesAccess::remove( const uno::Reference< drawing::XDrawP } // XServiceInfo -const char pSdMasterPagesAccessService[] = "com.sun.star.drawing.MasterPages"; OUString SAL_CALL SdMasterPagesAccess::getImplementationName( ) throw(uno::RuntimeException, std::exception) { @@ -3227,7 +3225,7 @@ sal_Bool SAL_CALL SdMasterPagesAccess::supportsService( const OUString& ServiceN uno::Sequence< OUString > SAL_CALL SdMasterPagesAccess::getSupportedServiceNames( ) throw(uno::RuntimeException, std::exception) { - OUString aService( pSdMasterPagesAccessService ); + OUString aService( "com.sun.star.drawing.MasterPages" ); uno::Sequence< OUString > aSeq( &aService, 1 ); return aSeq; } |