sw/source/core/access/acccell.cxx | 3 +-- sw/source/core/access/accfootnote.cxx | 6 ++---- sw/source/core/access/accpage.cxx | 3 +-- sw/source/core/doc/docnew.cxx | 19 ++++++------------- sw/source/core/unocore/unofield.cxx | 6 ++---- sw/source/core/unocore/unoidx.cxx | 19 ++++++------------- sw/source/filter/html/htmlplug.cxx | 7 +------ sw/source/filter/xml/xmltble.cxx | 7 ++----- sw/source/ui/vba/vbalisthelper.cxx | 10 +++------- sw/source/uibase/config/viewopt.cxx | 4 +--- sw/source/uibase/dbui/dbmgr.cxx | 19 ++++++------------- sw/source/uibase/uiview/view2.cxx | 3 +-- sw/source/uibase/utlui/attrdesc.cxx | 4 +--- sw/source/uibase/utlui/unotools.cxx | 3 +-- 14 files changed, 34 insertions(+), 79 deletions(-)
New commits: commit c8b09c0024cc8fb5444ca422d2ddf729a5117d1d Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Mon Oct 31 12:39:06 2016 +0200 loplugin:oncevar in sw Change-Id: I81cd59b2a24bca533a27cc4138f1ac3acff65090 Reviewed-on: https://gerrit.libreoffice.org/30437 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index ca4ce14..694a560 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -50,7 +50,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using namespace sw::access; -const sal_Char sServiceName[] = "com.sun.star.table.AccessibleCellView"; const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleCellView"; bool SwAccessibleCell::IsSelected() @@ -258,7 +257,7 @@ uno::Sequence< OUString > SAL_CALL SwAccessibleCell::getSupportedServiceNames() { uno::Sequence< OUString > aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = sServiceName; + pArray[0] = "com.sun.star.table.AccessibleCellView"; pArray[1] = sAccessibleServiceName; return aRet; } diff --git a/sw/source/core/access/accfootnote.cxx b/sw/source/core/access/accfootnote.cxx index e64b030..7c16cab 100644 --- a/sw/source/core/access/accfootnote.cxx +++ b/sw/source/core/access/accfootnote.cxx @@ -37,8 +37,6 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::accessibility; -const sal_Char sServiceNameFootnote[] = "com.sun.star.text.AccessibleFootnoteView"; -const sal_Char sServiceNameEndnote[] = "com.sun.star.text.AccessibleEndnoteView"; const sal_Char sImplementationNameFootnote[] = "com.sun.star.comp.Writer.SwAccessibleFootnoteView"; const sal_Char sImplementationNameEndnote[] = "com.sun.star.comp.Writer.SwAccessibleEndnoteView"; @@ -115,9 +113,9 @@ Sequence< OUString > SAL_CALL SwAccessibleFootnote::getSupportedServiceNames() Sequence< OUString > aRet(2); OUString* pArray = aRet.getArray(); if( AccessibleRole::END_NOTE == GetRole() ) - pArray[0] = sServiceNameEndnote; + pArray[0] = "com.sun.star.text.AccessibleEndnoteView"; else - pArray[0] = sServiceNameFootnote; + pArray[0] = "com.sun.star.text.AccessibleFootnoteView"; pArray[1] = sAccessibleServiceName; return aRet; } diff --git a/sw/source/core/access/accpage.cxx b/sw/source/core/access/accpage.cxx index 342aac8..0bf30f7 100644 --- a/sw/source/core/access/accpage.cxx +++ b/sw/source/core/access/accpage.cxx @@ -35,7 +35,6 @@ using namespace ::com::sun::star::accessibility; using uno::RuntimeException; using uno::Sequence; -const sal_Char sServiceName[] = "com.sun.star.text.AccessiblePageView"; const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessiblePageView"; bool SwAccessiblePage::IsSelected() @@ -152,7 +151,7 @@ Sequence<OUString> SwAccessiblePage::getSupportedServiceNames( ) { Sequence< OUString > aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = sServiceName; + pArray[0] = "com.sun.star.text.AccessiblePageView"; pArray[1] = sAccessibleServiceName; return aRet; } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 37cb122..5396f96 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -126,13 +126,6 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::document; -const sal_Char sFrameFormatStr[] = "Frameformat"; -const sal_Char sEmptyPageStr[] = "Empty Page"; -const sal_Char sColumnCntStr[] = "Columncontainer"; -const sal_Char sCharFormatStr[] = "Character style"; -const sal_Char sTextCollStr[] = "Paragraph style"; -const sal_Char sGrfCollStr[] = "Graphikformatvorlage"; - /* * global functions... */ @@ -226,12 +219,12 @@ SwDoc::SwDoc() m_pDocumentLayoutManager( new ::sw::DocumentLayoutManager( *this ) ), m_pDocumentStylePoolManager( new ::sw::DocumentStylePoolManager( *this ) ), m_pDocumentExternalDataManager( new ::sw::DocumentExternalDataManager() ), - mpDfltFrameFormat( new SwFrameFormat( GetAttrPool(), sFrameFormatStr, nullptr ) ), - mpEmptyPageFormat( new SwFrameFormat( GetAttrPool(), sEmptyPageStr, mpDfltFrameFormat ) ), - mpColumnContFormat( new SwFrameFormat( GetAttrPool(), sColumnCntStr, mpDfltFrameFormat ) ), - mpDfltCharFormat( new SwCharFormat( GetAttrPool(), sCharFormatStr, nullptr ) ), - mpDfltTextFormatColl( new SwTextFormatColl( GetAttrPool(), sTextCollStr ) ), - mpDfltGrfFormatColl( new SwGrfFormatColl( GetAttrPool(), sGrfCollStr ) ), + mpDfltFrameFormat( new SwFrameFormat( GetAttrPool(), "Frameformat", nullptr ) ), + mpEmptyPageFormat( new SwFrameFormat( GetAttrPool(), "Empty Page", mpDfltFrameFormat ) ), + mpColumnContFormat( new SwFrameFormat( GetAttrPool(), "Columncontainer", mpDfltFrameFormat ) ), + mpDfltCharFormat( new SwCharFormat( GetAttrPool(), "Character style", nullptr ) ), + mpDfltTextFormatColl( new SwTextFormatColl( GetAttrPool(), "Paragraph style" ) ), + mpDfltGrfFormatColl( new SwGrfFormatColl( GetAttrPool(), "Graphikformatvorlage" ) ), mpFrameFormatTable( new SwFrameFormats() ), mpCharFormatTable( new SwCharFormats() ), mpSpzFrameFormatTable( new SwFrameFormats() ), diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index d29b685..fb70784 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -2576,15 +2576,13 @@ static OUString OldNameToNewName_Impl( const OUString &rOld ) { static const char aOldNamePart1[] = ".TextField.DocInfo."; static const char aOldNamePart2[] = ".TextField."; - static const char aNewNamePart1[] = ".textfield.docinfo."; - static const char aNewNamePart2[] = ".textfield."; OUString sServiceNameCC( rOld ); sal_Int32 nIdx = sServiceNameCC.indexOf( aOldNamePart1 ); if (nIdx >= 0) - sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart1), aNewNamePart1 ); + sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart1), ".textfield.docinfo." ); nIdx = sServiceNameCC.indexOf( aOldNamePart2 ); if (nIdx >= 0) - sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart2), aNewNamePart2 ); + sServiceNameCC = sServiceNameCC.replaceAt( nIdx, strlen(aOldNamePart2), ".textfield." ); return sServiceNameCC; } diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index 62d4b88..453f0eb 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -1717,13 +1717,6 @@ throw (uno::RuntimeException, std::exception) return ::sw::UnoTunnelImpl<SwXDocumentIndexMark>(rId, this); } -static const sal_Char cBaseMark[] = "com.sun.star.text.BaseIndexMark"; -static const sal_Char cContentMark[] = "com.sun.star.text.ContentIndexMark"; -static const sal_Char cIdxMark[] = "com.sun.star.text.DocumentIndexMark"; -static const sal_Char cIdxMarkAsian[] = "com.sun.star.text.DocumentIndexMarkAsian"; -static const sal_Char cUserMark[] = "com.sun.star.text.UserIndexMark"; -static const sal_Char cTextContent[] = "com.sun.star.text.TextContent"; - OUString SAL_CALL SwXDocumentIndexMark::getImplementationName() throw (uno::RuntimeException, std::exception) { @@ -1744,19 +1737,19 @@ SwXDocumentIndexMark::getSupportedServiceNames() throw (uno::RuntimeException, s const sal_Int32 nCnt = (m_pImpl->m_eTOXType == TOX_INDEX) ? 4 : 3; uno::Sequence< OUString > aRet(nCnt); OUString* pArray = aRet.getArray(); - pArray[0] = cBaseMark; - pArray[1] = cTextContent; + pArray[0] = "com.sun.star.text.BaseIndexMark"; + pArray[1] = "com.sun.star.text.TextContent"; switch (m_pImpl->m_eTOXType) { case TOX_USER: - pArray[2] = cUserMark; + pArray[2] = "com.sun.star.text.UserIndexMark"; break; case TOX_CONTENT: - pArray[2] = cContentMark; + pArray[2] = "com.sun.star.text.ContentIndexMark"; break; case TOX_INDEX: - pArray[2] = cIdxMark; - pArray[3] = cIdxMarkAsian; + pArray[2] = "com.sun.star.text.DocumentIndexMark"; + pArray[3] = "com.sun.star.text.DocumentIndexMarkAsian"; break; default: diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index a4a24b3..c624ff5 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -71,11 +71,6 @@ using namespace com::sun::star; #define HTML_DFLT_APPLET_WIDTH ((MM50*5)/2) #define HTML_DFLT_APPLET_HEIGHT ((MM50*5)/2) -namespace { - -static char const sHTML_O_Hidden_False[] = "FALSE"; - -} const sal_uLong HTML_FRMOPTS_EMBED_ALL = HTML_FRMOPT_ALT | @@ -370,7 +365,7 @@ void SwHTMLParser::InsertEmbed() OOO_STRING_SW_HTML_O_Hidden)) { bHidden = !rOption.GetString().equalsIgnoreAsciiCase( - sHTML_O_Hidden_False); + "FALSE"); } break; } diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index fcea0f4..41eee95 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -64,9 +64,6 @@ using table::XCell; using std::vector; using std::advance; -// string constants for table cell export -static const char g_sNumberFormat[] = "NumberFormat"; -static const char g_sIsProtected[] = "IsProtected"; class SwXMLTableColumn_Impl : public SwWriteTableCol { @@ -823,7 +820,7 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox, if (xCellPropertySet.is()) { sal_Int32 nNumberFormat = 0; - Any aAny = xCellPropertySet->getPropertyValue(g_sNumberFormat); + Any aAny = xCellPropertySet->getPropertyValue("NumberFormat"); aAny >>= nNumberFormat; if (css::util::NumberFormat::TEXT == nNumberFormat) @@ -843,7 +840,7 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox, // else: invalid key; ignore // cell protection - aAny = xCellPropertySet->getPropertyValue(g_sIsProtected); + aAny = xCellPropertySet->getPropertyValue("IsProtected"); if (*o3tl::doAccess<bool>(aAny)) { AddAttribute( XML_NAMESPACE_TABLE, XML_PROTECTED, diff --git a/sw/source/ui/vba/vbalisthelper.cxx b/sw/source/ui/vba/vbalisthelper.cxx index bc74abc..051282fe 100644 --- a/sw/source/ui/vba/vbalisthelper.cxx +++ b/sw/source/ui/vba/vbalisthelper.cxx @@ -30,10 +30,6 @@ using namespace ::com::sun::star; static const sal_Int32 LIST_LEVEL_COUNT = 9; -static const char WORD_BULLET_GALLERY[] = "WdBullet"; -static const char WORD_NUMBER_GALLERY[] = "WdNumber"; -static const char WORD_OUTLINE_NUMBER_GALLERY[] = "WdOutlineNumber"; - static const char UNO_NAME_PARENT_NUMBERING[] = "ParentNumbering"; static const char UNO_NAME_PREFIX[] = "Prefix"; static const char UNO_NAME_SUFFIX[] = "Suffix"; @@ -62,17 +58,17 @@ void SwVbaListHelper::Init() throw( css::uno::RuntimeException ) { case word::WdListGalleryType::wdBulletGallery: { - msStyleName = WORD_BULLET_GALLERY; + msStyleName = "WdBullet"; break; } case word::WdListGalleryType::wdNumberGallery: { - msStyleName = WORD_NUMBER_GALLERY; + msStyleName = "WdNumber"; break; } case word::WdListGalleryType::wdOutlineNumberGallery: { - msStyleName = WORD_OUTLINE_NUMBER_GALLERY; + msStyleName = "WdOutlineNumber"; break; } default: diff --git a/sw/source/uibase/config/viewopt.cxx b/sw/source/uibase/config/viewopt.cxx index 0523a01..0be3a79 100644 --- a/sw/source/uibase/config/viewopt.cxx +++ b/sw/source/uibase/config/viewopt.cxx @@ -67,8 +67,6 @@ Color SwViewOption::m_aHeaderFooterMarkColor(COL_BLUE); ViewOptFlags SwViewOption::m_nAppearanceFlags = ViewOptFlags::DocBoundaries|ViewOptFlags::ObjectBoundaries; sal_uInt16 SwViewOption::m_nPixelTwips = 0; // one pixel on the screen -static const char aPostItStr[] = " "; - bool SwViewOption::IsEqualFlags( const SwViewOption &rOpt ) const { return m_nCoreOptions == rOpt.m_nCoreOptions @@ -131,7 +129,7 @@ void SwViewOption::DrawRectPrinter( OutputDevice *pOut, sal_uInt16 SwViewOption::GetPostItsWidth( const OutputDevice *pOut ) { assert(pOut && "no Outdev"); - return sal_uInt16(pOut->GetTextWidth( aPostItStr)); + return sal_uInt16(pOut->GetTextWidth(" ")); } void SwViewOption::PaintPostIts( OutputDevice *pOut, const SwRect &rRect, bool bIsScript ) diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index f21039e..e9e46a0 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -148,13 +148,6 @@ using namespace ::com::sun::star; #define DB_SEP_RETURN 2 #define DB_SEP_NEWLINE 3 -const sal_Char cCursor[] = "Cursor"; -const sal_Char cCommand[] = "Command"; -const sal_Char cCommandType[] = "CommandType"; -const sal_Char cDataSourceName[] = "DataSourceName"; -const sal_Char cSelection[] = "Selection"; -const sal_Char cActiveConnection[] = "ActiveConnection"; - namespace { void rescheduleGui() { @@ -2924,17 +2917,17 @@ void SwDBManager::InsertText(SwWrtShell& rSh, uno::Reference< sdbc::XConnection> xConnection; for(sal_Int32 nPos = 0; nPos < rProperties.getLength(); nPos++) { - if ( pValues[nPos].Name == cDataSourceName ) + if ( pValues[nPos].Name == "DataSourceName" ) pValues[nPos].Value >>= sDataSource; - else if ( pValues[nPos].Name == cCommand ) + else if ( pValues[nPos].Name == "Command" ) pValues[nPos].Value >>= sDataTableOrQuery; - else if ( pValues[nPos].Name == cCursor ) + else if ( pValues[nPos].Name == "Cursor" ) pValues[nPos].Value >>= xResSet; - else if ( pValues[nPos].Name == cSelection ) + else if ( pValues[nPos].Name == "Selection" ) pValues[nPos].Value >>= aSelection; - else if ( pValues[nPos].Name == cCommandType ) + else if ( pValues[nPos].Name == "CommandType" ) pValues[nPos].Value >>= nCmdType; - else if ( pValues[nPos].Name == cActiveConnection ) + else if ( pValues[nPos].Name == "ActiveConnection" ) pValues[nPos].Value >>= xConnection; } if(sDataSource.isEmpty() || sDataTableOrQuery.isEmpty() || !xResSet.is()) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 4620da0..9cd0adc 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -151,7 +151,6 @@ #include <memory> const char sStatusDelim[] = " : "; -const char sStatusComma[] = " , "; using namespace sfx2; using namespace ::com::sun::star; @@ -1576,7 +1575,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet) if( nOutlineLevel != 0 ) { if (!sStr.isEmpty()) - sStr += sStatusComma; + sStr += " , "; if( bOutlineNum ) { sStr += SW_RESSTR(STR_OUTLINE_NUMBERING); diff --git a/sw/source/uibase/utlui/attrdesc.cxx b/sw/source/uibase/utlui/attrdesc.cxx index ad3b9eb..3fee54c 100644 --- a/sw/source/uibase/utlui/attrdesc.cxx +++ b/sw/source/uibase/utlui/attrdesc.cxx @@ -67,8 +67,6 @@ void SwAttrSet::GetPresentation( MapUnit ePresMetric, OUString &rText ) const { - static sal_Char const sComma[] = ", "; - rText.clear(); OUString aStr; if( Count() ) @@ -82,7 +80,7 @@ void SwAttrSet::GetPresentation( ePresMetric, aStr, &rInt ); if( rText.getLength() && aStr.getLength() ) - rText += sComma; + rText += ", "; rText += aStr; if( aIter.IsAtEnd() ) break; diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx index 9dec8ec..2d6a10c 100644 --- a/sw/source/uibase/utlui/unotools.cxx +++ b/sw/source/uibase/utlui/unotools.cxx @@ -57,7 +57,6 @@ using namespace ::com::sun::star; -const sal_Char cFrameControl[] = "com.sun.star.frame.FrameControl"; const sal_Char cFactory[] = "private:factory/swriter"; bool SwOneExampleFrame::bShowServiceNotAvailableMessage = true; @@ -96,7 +95,7 @@ void SwOneExampleFrame::CreateErrorMessage() if(SwOneExampleFrame::bShowServiceNotAvailableMessage) { OUString sInfo(SW_RES(STR_SERVICE_UNAVAILABLE)); - sInfo += cFrameControl; + sInfo += "com.sun.star.frame.FrameControl"; ScopedVclPtrInstance<InfoBox>(nullptr, sInfo)->Execute(); SwOneExampleFrame::bShowServiceNotAvailableMessage = false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits