From 58ae5fb5ff69a5581cffa583a57ad9381140fa9a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 22 Jun 2017 16:05:11 +0200 Subject: loplugin:oncevar in cppcanvas..drawinglayer Change-Id: I5456aad61fb0dfe6830eae62b91d1a6399d6343f Reviewed-on: https://gerrit.libreoffice.org/39128 Tested-by: Jenkins Reviewed-by: Noel Grandin --- cppcanvas/source/mtfrenderer/implrenderer.cxx | 4 +- dbaccess/source/core/api/RowSet.cxx | 8 +- dbaccess/source/core/dataaccess/connection.cxx | 3 +- .../source/core/dataaccess/databasedocument.cxx | 3 +- .../core/dataaccess/databaseregistrations.cxx | 20 +-- dbaccess/source/ui/app/AppController.cxx | 5 +- dbaccess/source/ui/app/AppDetailView.cxx | 3 +- dbaccess/source/ui/browser/unodatbr.cxx | 3 +- dbaccess/source/ui/control/TableGrantCtrl.cxx | 4 +- dbaccess/source/ui/control/dbtreelistbox.cxx | 3 +- dbaccess/source/ui/dlg/CollectionView.cxx | 7 +- dbaccess/source/ui/dlg/DriverSettings.cxx | 14 -- dbaccess/source/ui/dlg/TextConnectionHelper.cxx | 2 +- dbaccess/source/ui/dlg/dbfindex.cxx | 4 +- dbaccess/source/ui/dlg/textconnectionsettings.cxx | 3 +- dbaccess/source/ui/misc/UITools.cxx | 3 +- dbaccess/source/ui/misc/WCopyTable.cxx | 4 +- .../source/ui/querydesign/SelectionBrowseBox.cxx | 4 +- .../source/ui/querydesign/querycontainerwindow.cxx | 3 +- dbaccess/source/ui/tabledesign/TableController.cxx | 2 +- .../source/ui/tabledesign/TableDesignControl.cxx | 4 +- dbaccess/source/ui/tabledesign/TableDesignView.cxx | 3 +- .../source/ui/tabledesign/TableFieldDescWin.cxx | 3 +- dbaccess/source/ui/uno/ColumnPeer.cxx | 2 +- desktop/qa/desktop_lib/test_desktop_lib.cxx | 13 +- desktop/source/app/app.cxx | 12 +- desktop/source/app/check_ext_deps.cxx | 5 +- desktop/source/app/dispatchwatcher.cxx | 9 +- desktop/source/deployment/dp_persmap.cxx | 2 +- .../deployment/manager/dp_commandenvironments.cxx | 9 +- .../source/deployment/registry/help/dp_help.cxx | 6 +- desktop/source/migration/migration.cxx | 5 +- desktop/unx/source/splashx.c | 6 +- drawinglayer/qa/unit/border.cxx | 32 ++--- .../source/processor2d/vclmetafileprocessor2d.cxx | 144 +++++++++------------ 35 files changed, 142 insertions(+), 215 deletions(-) diff --git a/cppcanvas/source/mtfrenderer/implrenderer.cxx b/cppcanvas/source/mtfrenderer/implrenderer.cxx index 10c8d875d22e..95b431e09322 100644 --- a/cppcanvas/source/mtfrenderer/implrenderer.cxx +++ b/cppcanvas/source/mtfrenderer/implrenderer.cxx @@ -1004,8 +1004,6 @@ namespace cppcanvas pStrikeoutCharWidths[ i ] += pStrikeoutCharWidths[ i-1 ]; } - sal_Int32 nStartPos = 0; - pStrikeoutTextAction = TextActionFactory::createTextAction( rStartPoint, @@ -1014,7 +1012,7 @@ namespace cppcanvas aShadowOffset, aShadowColor, aStrikeoutText, - nStartPos, + 0/*nStartPos*/, aStrikeoutText.getLength(), pStrikeoutCharWidths, rParms.mrVDev, diff --git a/dbaccess/source/core/api/RowSet.cxx b/dbaccess/source/core/api/RowSet.cxx index 573f9cf14157..2d23d0c19e8f 100644 --- a/dbaccess/source/core/api/RowSet.cxx +++ b/dbaccess/source/core/api/RowSet.cxx @@ -166,9 +166,9 @@ ORowSet::ORowSet( const Reference< css::uno::XComponentContext >& _rxContext ) m_pMySelf = this; m_aActiveConnection <<= m_xActiveConnection; - sal_Int32 nRBT = PropertyAttribute::READONLY | PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT; - sal_Int32 nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; - sal_Int32 nBT = PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT; + sal_Int32 const nRBT = PropertyAttribute::READONLY | PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT; + sal_Int32 const nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; + sal_Int32 const nBT = PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT; m_aPrematureParamValues->get().resize( 0 ); @@ -2850,7 +2850,7 @@ ORowSetClone::ORowSetClone( const Reference& _rContext, ORowS m_pColumns = new ORowSetDataColumns(xMeta.is() && xMeta->supportsMixedCaseQuotedIdentifiers(), aColumns,*this,m_aMutex,aNames); - sal_Int32 nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; + sal_Int32 const nRT = PropertyAttribute::READONLY | PropertyAttribute::TRANSIENT; // sdb.RowSet Properties registerMayBeVoidProperty(PROPERTY_ACTIVE_CONNECTION,PROPERTY_ID_ACTIVE_CONNECTION, PropertyAttribute::MAYBEVOID|PropertyAttribute::READONLY, &rParent.m_aActiveConnection, cppu::UnoType::get()); diff --git a/dbaccess/source/core/dataaccess/connection.cxx b/dbaccess/source/core/dataaccess/connection.cxx index accc80ac7e56..95a53242d9b2 100644 --- a/dbaccess/source/core/dataaccess/connection.cxx +++ b/dbaccess/source/core/dataaccess/connection.cxx @@ -319,12 +319,11 @@ OConnection::OConnection(ODatabaseSource& _rDB Reference xRes = xMeta->getTableTypes(); if(xRes.is()) { - OUString sView("VIEW"); Reference xRow(xRes,UNO_QUERY); while(xRes->next()) { OUString sValue = xRow->getString(1); - if( !xRow->wasNull() && sValue == sView) + if( !xRow->wasNull() && sValue == "VIEW") { m_bSupportsViews = true; break; diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index cb2bbea06c2a..ee3109b5e2b4 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -1742,13 +1742,12 @@ Reference< XUIConfigurationManager2 > const & ODatabaseDocument::getUIConfigurat xConfigStorage = getDocumentSubStorage( aUIConfigFolderName, ElementModes::READWRITE ); if ( xConfigStorage.is() ) { - OUString aUIConfigMediaType( "application/vnd.sun.xml.ui.configuration" ); OUString aMediaType; Reference< XPropertySet > xPropSet( xConfigStorage, UNO_QUERY ); Any a = xPropSet->getPropertyValue( INFO_MEDIATYPE ); if ( !( a >>= aMediaType ) || aMediaType.isEmpty() ) { - a <<= aUIConfigMediaType; + a <<= OUString("application/vnd.sun.xml.ui.configuration"); xPropSet->setPropertyValue( INFO_MEDIATYPE, a ); } } diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx index 2ce22ba32448..6734c2e7dc57 100644 --- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx +++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx @@ -184,23 +184,11 @@ namespace dbaccess if (aNodeForName.isValid()) throw ElementExistException( _rName, *this ); - OUString sNewNodeName; + // make unique + OUString sNewNodeName = "org.openoffice." + _rName; + while ( m_aConfigurationRoot.hasByName( sNewNodeName ) ) { - OUStringBuffer aNewNodeName; - aNewNodeName.append( "org.openoffice." ); - aNewNodeName.append( _rName ); - - // make unique - OUStringBuffer aReset( aNewNodeName ); - sNewNodeName = aNewNodeName.makeStringAndClear(); - sal_Int32 i=2; - while ( m_aConfigurationRoot.hasByName( sNewNodeName ) ) - { - aNewNodeName = aReset; - aNewNodeName.append( " " ); - aNewNodeName.append( i ); - sNewNodeName = aNewNodeName.makeStringAndClear(); - } + sNewNodeName = "org.openoffice." + _rName + " 2"; } ::utl::OConfigurationNode aNewNode( m_aConfigurationRoot.createNode( sNewNodeName ) ); diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index b271d29ddcff..9532e54bd133 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -2134,9 +2134,8 @@ void OApplicationController::renameEntry() } catch(const ElementExistException& e) { - OUString sStatus("S1000"); - OUString sMsg = OUString( ModuleRes( STR_NAME_ALREADY_EXISTS ) ); - showError(SQLExceptionInfo(SQLException(sMsg.replaceAll("#", e.Message), e.Context, sStatus, 0, Any()))); + OUString sMsg( ModuleRes( STR_NAME_ALREADY_EXISTS ) ); + showError(SQLExceptionInfo(SQLException(sMsg.replaceAll("#", e.Message), e.Context, "S1000", 0, Any()))); } catch(const Exception& ) { diff --git a/dbaccess/source/ui/app/AppDetailView.cxx b/dbaccess/source/ui/app/AppDetailView.cxx index 08af0e8e7fd4..eecaa2a59cdd 100644 --- a/dbaccess/source/ui/app/AppDetailView.cxx +++ b/dbaccess/source/ui/app/AppDetailView.cxx @@ -76,8 +76,7 @@ OCreationList::OCreationList( OTasksWindow& _rParent ) ,m_pMouseDownEntry( nullptr ) ,m_pLastActiveEntry( nullptr ) { - sal_uInt16 nSize = SPACEBETWEENENTRIES; - SetSpaceBetweenEntries(nSize); + SetSpaceBetweenEntries(SPACEBETWEENENTRIES); SetSelectionMode( SelectionMode::NONE ); SetExtendedWinBits( EWB_NO_AUTO_CURENTRY ); SetNodeDefaultImages( ); diff --git a/dbaccess/source/ui/browser/unodatbr.cxx b/dbaccess/source/ui/browser/unodatbr.cxx index 0517b4382832..241fa9aa19ad 100644 --- a/dbaccess/source/ui/browser/unodatbr.cxx +++ b/dbaccess/source/ui/browser/unodatbr.cxx @@ -3413,7 +3413,6 @@ void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo ) try { // get the desktop object - sal_Int32 nFrameSearchFlag = FrameSearchFlag::ALL | FrameSearchFlag::GLOBAL ; Reference< XDesktop2 > xFrameLoader = Desktop::create( getORB() ); // the initial selection @@ -3443,7 +3442,7 @@ void SbaTableQueryBrowser::implAdministrate( SvTreeListEntry* _pApplyTo ) xFrameLoader->loadComponentFromURL( xDocumentModel->getURL(), "_default", - nFrameSearchFlag, + FrameSearchFlag::ALL | FrameSearchFlag::GLOBAL, aLoadArgPV ); } diff --git a/dbaccess/source/ui/control/TableGrantCtrl.cxx b/dbaccess/source/ui/control/TableGrantCtrl.cxx index 08a16e8761e5..91cd2b3c64b3 100644 --- a/dbaccess/source/ui/control/TableGrantCtrl.cxx +++ b/dbaccess/source/ui/control/TableGrantCtrl.cxx @@ -137,8 +137,8 @@ void OTableGrantControl::Init() UpdateTables(); // set browser mode - BrowserMode nMode = BrowserMode::COLUMNSELECTION | BrowserMode::HLINES | BrowserMode::VLINES | - BrowserMode::HIDECURSOR | BrowserMode::HIDESELECT; + BrowserMode const nMode = BrowserMode::COLUMNSELECTION | BrowserMode::HLINES | BrowserMode::VLINES | + BrowserMode::HIDECURSOR | BrowserMode::HIDESELECT; SetMode(nMode); } diff --git a/dbaccess/source/ui/control/dbtreelistbox.cxx b/dbaccess/source/ui/control/dbtreelistbox.cxx index 8b768662079f..07fcb331ce65 100644 --- a/dbaccess/source/ui/control/dbtreelistbox.cxx +++ b/dbaccess/source/ui/control/dbtreelistbox.cxx @@ -65,8 +65,7 @@ DBTreeListBox::DBTreeListBox( vcl::Window* pParent, WinBits nWinStyle ) void DBTreeListBox::init() { - sal_uInt16 nSize = SPACEBETWEENENTRIES; - SetSpaceBetweenEntries(nSize); + SetSpaceBetweenEntries(SPACEBETWEENENTRIES); m_aTimer.SetTimeout(900); m_aTimer.SetInvokeHandler(LINK(this, DBTreeListBox, OnTimeOut)); diff --git a/dbaccess/source/ui/dlg/CollectionView.cxx b/dbaccess/source/ui/dlg/CollectionView.cxx index 7084019c5d5d..019cb59cabf7 100644 --- a/dbaccess/source/ui/dlg/CollectionView.cxx +++ b/dbaccess/source/ui/dlg/CollectionView.cxx @@ -157,10 +157,9 @@ IMPL_LINK_NOARG(OCollectionView, Save_Click, Button*, void) aValue.Value <<= OUString("folder"); aValues[1] <<= aValue; - InteractionClassification eClass = InteractionClassification_ERROR; - css::ucb::IOErrorCode eError = IOErrorCode_NOT_EXISTING_PATH; - OUString sTemp; - InteractiveAugmentedIOException aException(sTemp,Reference(),eClass,eError,aValues); + InteractiveAugmentedIOException aException(OUString(),Reference(), + InteractionClassification_ERROR, + IOErrorCode_NOT_EXISTING_PATH,aValues); Reference xHandler( InteractionHandler::createWithParent(m_xContext, VCLUnoHelper::GetInterface( this ))); diff --git a/dbaccess/source/ui/dlg/DriverSettings.cxx b/dbaccess/source/ui/dlg/DriverSettings.cxx index b553697a88f0..549ec62b9b9c 100644 --- a/dbaccess/source/ui/dlg/DriverSettings.cxx +++ b/dbaccess/source/ui/dlg/DriverSettings.cxx @@ -53,20 +53,6 @@ void ODriversSettings::getSupportedIndirectSettings( const OUString& _sURLPrefix ::connectivity::DriversConfig aDriverConfig(_xContext); const ::comphelper::NamedValueCollection& aProperties = aDriverConfig.getProperties(_sURLPrefix); -#if OSL_DEBUG_LEVEL > 0 - { - Sequence< NamedValue > aNamedValues; - aProperties >>= aNamedValues; - for ( const NamedValue* loop = aNamedValues.getConstArray(); - loop != aNamedValues.getConstArray() + aNamedValues.getLength(); - ++loop - ) - { - int dummy = 0; - (void)dummy; - } - } -#endif typedef std::pair TProperties; TProperties aProps[] = { TProperties(DSID_SHOWDELETEDROWS,OUString("ShowDeleted")) ,TProperties(DSID_CHARSET,OUString("CharSet")) diff --git a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx index 6e8316400133..88a777396536 100644 --- a/dbaccess/source/ui/dlg/TextConnectionHelper.cxx +++ b/dbaccess/source/ui/dlg/TextConnectionHelper.cxx @@ -401,7 +401,7 @@ namespace dbaui OUString OTextConnectionHelper::GetSeparator( const ComboBox& rBox, const OUString& rList ) { - sal_Unicode nTok = '\t'; + sal_Unicode const nTok = '\t'; sal_Int32 nPos(rBox.GetEntryPos( rBox.GetText() )); if( nPos == COMBOBOX_ENTRY_NOTFOUND ) diff --git a/dbaccess/source/ui/dlg/dbfindex.cxx b/dbaccess/source/ui/dlg/dbfindex.cxx index 79f10f3ca6fa..76c7160d5ac5 100644 --- a/dbaccess/source/ui/dlg/dbfindex.cxx +++ b/dbaccess/source/ui/dlg/dbfindex.cxx @@ -297,8 +297,8 @@ void ODbaseIndexDialog::Init() Sequence< OUString> aFolderContent( ::utl::LocalFileHelper::GetFolderContents(m_aDSN,bFolder)); - OUString aIndexExt("ndx"); - OUString aTableExt("dbf"); + OUString const aIndexExt("ndx"); + OUString const aTableExt("dbf"); std::vector< OUString > aUsedIndexes; diff --git a/dbaccess/source/ui/dlg/textconnectionsettings.cxx b/dbaccess/source/ui/dlg/textconnectionsettings.cxx index af6d70529a5e..6c741ad71424 100644 --- a/dbaccess/source/ui/dlg/textconnectionsettings.cxx +++ b/dbaccess/source/ui/dlg/textconnectionsettings.cxx @@ -71,8 +71,7 @@ namespace dbaui { if ( m_pTextConnectionHelper->prepareLeave() ) { - bool bUnused = false; - m_pTextConnectionHelper->FillItemSet( m_rItems, bUnused ); + m_pTextConnectionHelper->FillItemSet( m_rItems, false/*bUnused*/ ); EndDialog( RET_OK ); } } diff --git a/dbaccess/source/ui/misc/UITools.cxx b/dbaccess/source/ui/misc/UITools.cxx index da48f4bcb9fc..5e3861764afe 100644 --- a/dbaccess/source/ui/misc/UITools.cxx +++ b/dbaccess/source/ui/misc/UITools.cxx @@ -843,8 +843,7 @@ bool callColumnFormatDialog(vcl::Window* _pParent, if (!bText) { - double dPreviewVal = 1234.56789; - SvxNumberInfoItem aFormatter(_pFormatter, dPreviewVal, SID_ATTR_NUMBERFORMAT_INFO); + SvxNumberInfoItem aFormatter(_pFormatter, 1234.56789, SID_ATTR_NUMBERFORMAT_INFO); pFormatDescriptor->Put(aFormatter); } diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 1457bea1227c..d66e4c7bd02c 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -1035,7 +1035,7 @@ void OCopyTableWizard::loadData( const ICopyTableSourceObject& _rSourceObject, _rColumns.clear(); OFieldDescription* pActFieldDescr = nullptr; - OUString sCreateParam("x"); + OUString const sCreateParam("x"); // ReadOnly-Flag // On drop no line must be editable. // On add only empty lines must be editable. @@ -1509,7 +1509,7 @@ TOTypeInfoSP OCopyTableWizard::convertType(const TOTypeInfoSP& _pType, bool& _bN if ( !pType.get() ) { _bNotConvert = false; - OUString sCreate("x"); + OUString const sCreate("x"); pType = ::dbaui::getTypeInfoFromType(m_aDestTypeInfo,DataType::VARCHAR,_pType->aTypeName,sCreate,50,0,false,bForce); if ( !pType.get() ) pType = m_pTypeInfo; diff --git a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx index 80e8cd603343..9b25e3f9bd95 100644 --- a/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx +++ b/dbaccess/source/ui/querydesign/SelectionBrowseBox.cxx @@ -2080,7 +2080,7 @@ sal_Int32 OSelectionBrowseBox::GetNoneVisibleRows() const { sal_Int32 nErg(0); // only the first 11 row are interesting - sal_Int32 nSize = SAL_N_ELEMENTS(nVisibleRowMask); + sal_Int32 const nSize = SAL_N_ELEMENTS(nVisibleRowMask); for(sal_Int32 i=0;igetDesignView()->getController(); @@ -165,7 +164,7 @@ namespace dbaui rController.InvalidateFeature(SID_COPY); rController.InvalidateFeature(SID_PASTE); } - return bHandled || ODataView::PreNotify(rNEvt); + return ODataView::PreNotify(rNEvt); } void OQueryContainerWindow::showPreview(const Reference& _xFrame) { diff --git a/dbaccess/source/ui/tabledesign/TableController.cxx b/dbaccess/source/ui/tabledesign/TableController.cxx index a3264d3cb609..b300210f2d18 100644 --- a/dbaccess/source/ui/tabledesign/TableController.cxx +++ b/dbaccess/source/ui/tabledesign/TableController.cxx @@ -825,7 +825,7 @@ void OTableController::loadData() pTabEdRow->SetReadOnly(!bIsAlterAllowed); // search for type bool bForce; - OUString sCreate("x"); + OUString const sCreate("x"); TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(m_aTypeInfo,nType,sTypeName,sCreate,nPrecision,nScale,bIsAutoIncrement,bForce); if ( !pTypeInfo.get() ) pTypeInfo = m_pTypeInfo; diff --git a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx index 7478afbab513..604314e1a6f2 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignControl.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignControl.cxx @@ -64,8 +64,8 @@ void OTableRowView::Init() // set up HandleColumn for at maximum 5 digits InsertHandleColumn(static_cast(GetTextWidth(OUString('0')) * 4)/*, sal_True */); - BrowserMode nMode = BrowserMode::COLUMNSELECTION | BrowserMode::MULTISELECTION | BrowserMode::KEEPHIGHLIGHT | - BrowserMode::HLINES | BrowserMode::VLINES | BrowserMode::AUTOSIZE_LASTCOL; + BrowserMode const nMode = BrowserMode::COLUMNSELECTION | BrowserMode::MULTISELECTION | BrowserMode::KEEPHIGHLIGHT | + BrowserMode::HLINES | BrowserMode::VLINES | BrowserMode::AUTOSIZE_LASTCOL; SetMode(nMode); } diff --git a/dbaccess/source/ui/tabledesign/TableDesignView.cxx b/dbaccess/source/ui/tabledesign/TableDesignView.cxx index 19c48c2b457d..f6a7953214b2 100644 --- a/dbaccess/source/ui/tabledesign/TableDesignView.cxx +++ b/dbaccess/source/ui/tabledesign/TableDesignView.cxx @@ -213,7 +213,6 @@ void OTableDesignView::resizeDocumentView(tools::Rectangle& _rPlayground) bool OTableDesignView::PreNotify( NotifyEvent& rNEvt ) { - bool bHandled = false; if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS) { if( GetDescWin() && GetDescWin()->HasChildPathFocus() ) @@ -224,7 +223,7 @@ bool OTableDesignView::PreNotify( NotifyEvent& rNEvt ) m_eChildFocus = NONE; } - return bHandled || ODataView::PreNotify(rNEvt); + return ODataView::PreNotify(rNEvt); } IClipboardTest* OTableDesignView::getActiveChild() const diff --git a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx index cce951ac698b..2b674638efd4 100644 --- a/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx +++ b/dbaccess/source/ui/tabledesign/TableFieldDescWin.cxx @@ -262,7 +262,6 @@ void OTableFieldDescWin::LoseFocus() bool OTableFieldDescWin::PreNotify( NotifyEvent& rNEvt ) { - bool bHandled = false; if (rNEvt.GetType() == MouseNotifyEvent::GETFOCUS) { if( getGenPage() && getGenPage()->HasChildPathFocus() ) @@ -270,7 +269,7 @@ bool OTableFieldDescWin::PreNotify( NotifyEvent& rNEvt ) else m_eChildFocus = HELP; } - return bHandled || TabPage::PreNotify(rNEvt); + return TabPage::PreNotify(rNEvt); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/dbaccess/source/ui/uno/ColumnPeer.cxx b/dbaccess/source/ui/uno/ColumnPeer.cxx index 3700aa5d7637..1e7bae1ca536 100644 --- a/dbaccess/source/ui/uno/ColumnPeer.cxx +++ b/dbaccess/source/ui/uno/ColumnPeer.cxx @@ -86,7 +86,7 @@ void OColumnPeer::setColumn(const Reference< XPropertySet>& _xColumn) m_pActFieldDescr = new OFieldDescription(_xColumn,true); // search for type - OUString sCreateParam("x"); + OUString const sCreateParam("x"); bool bForce; TOTypeInfoSP pTypeInfo = ::dbaui::getTypeInfoFromType(*pFieldControl->getTypeInfo(),nType,sTypeName,sCreateParam,nPrecision,nScale,bAutoIncrement,bForce); if ( !pTypeInfo.get() ) diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index b7b32544878d..0152bfa4aa05 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -688,8 +688,8 @@ void DesktopLOKTest::testHiddenRowHeaders() pDocument->pClass->initializeForRendering(pDocument, nullptr); - long nX = 0; - long nY = 0; + long const nX = 0; + long const nY = 0; long nWidth = 0; long nHeight = 0; pDocument->m_pDocumentClass->getDocumentSize(pDocument, &nWidth, &nHeight); @@ -881,8 +881,8 @@ void DesktopLOKTest::testSheetSelections() // Values in twips int row5 = 1150; int col1 = 1100; - int col2 = 2200; - int col3 = 3300; + int const col2 = 2200; + int const col3 = 3300; int col4 = 4400; int col5 = 5500; @@ -932,7 +932,7 @@ void DesktopLOKTest::testSheetSelections() /* * Check if clicking inside the selection deselects the whole selection */ - int row10 = 2400; + int const row10 = 2400; // Select starting from row5, col1 to row10, col5 pDocument->pClass->postMouseEvent(pDocument, LOK_MOUSEEVENT_MOUSEBUTTONDOWN, @@ -1845,8 +1845,7 @@ void DesktopLOKTest::testGetFontSubset() rtl_UriEncodeKeepEscapes, RTL_TEXTENCODING_UTF8 ); - OUString aUnoFontSubset(".uno:FontSubset&name="); - OString aCommand = OUStringToOString(aUnoFontSubset + aFontName, RTL_TEXTENCODING_UTF8); + OString aCommand = OUStringToOString(".uno:FontSubset&name=" + aFontName, RTL_TEXTENCODING_UTF8); boost::property_tree::ptree aTree; char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aCommand.getStr()); std::stringstream aStream(pJSON); diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 0e7f37fe0c48..bbf8ccdd0e86 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1537,9 +1537,8 @@ int Desktop::Main() #ifdef DBG_UTIL //include buildid in non product builds - OUString aDefault("development"); aTitle += " ["; - aTitle += utl::Bootstrap::getBuildIdData(aDefault); + aTitle += utl::Bootstrap::getBuildIdData("development"); aTitle += "]"; #endif @@ -1672,7 +1671,6 @@ int Desktop::Main() if ( !pExecGlobals->bRestartRequested ) { Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) ); - bool bTerminateRequested = false; // Preload function depends on an initialized sfx application! SetSplashScreenProgress(75); @@ -1682,7 +1680,7 @@ int Desktop::Main() SetSplashScreenProgress(80); - if ( !bTerminateRequested && !rCmdLineArgs.IsInvisible() && + if ( !rCmdLineArgs.IsInvisible() && !rCmdLineArgs.IsNoQuickstart() ) InitializeQuickstartMode( xContext ); @@ -2072,8 +2070,7 @@ IMPL_LINK_NOARG(Desktop, OpenClients_Impl, void*, void) if (pExitPostStartup && *pExitPostStartup) new ExitTimer(); } catch (const css::uno::Exception &e) { - OUString a( "UNO exception during client open:\n" ); - Application::Abort( a + e.Message ); + Application::Abort( "UNO exception during client open: " + e.Message ); } } @@ -2598,9 +2595,8 @@ void Desktop::OpenSplashScreen() if ( rCmdLine.HasSplashPipe() ) aSplashService = "com.sun.star.office.PipeSplashScreen"; - bool bVisible = true; Sequence< Any > aSeq( 2 ); - aSeq[0] <<= bVisible; + aSeq[0] <<= true; // bVisible aSeq[1] <<= aAppName; css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); m_rSplashScreen.set( diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index 9c7a300f01eb..6440786317e1 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -258,9 +258,10 @@ static bool impl_checkDependencies( const uno::Reference< uno::XComponentContext throw uno::RuntimeException( e.Message, e.Context ); } - sal_Int32 nMax = 2; #ifdef DEBUG - nMax = 3; + sal_Int32 const nMax = 3; +#else + sal_Int32 const nMax = 2; #endif for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i ) diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index 242e73a625fc..7d7f8fac8401 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -288,7 +288,6 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() ); std::vector< DispatchHolder > aDispatches; - OUString aAsTemplateArg( "AsTemplate" ); bool bSetInputFilter = false; OUString aForcedInputFilter; @@ -343,13 +342,11 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector>= verExc) || (request >>= licExc) @@ -159,7 +158,7 @@ void TmpRepositoryCommandEnv::handle( approve = true; } - handle_(approve, abort, xRequest); + handle_(approve, false/*abort*/, xRequest); } @@ -181,7 +180,6 @@ void LicenseCommandEnv::handle( deployment::LicenseException licExc; bool approve = false; - bool abort = false; if (request >>= licExc) { @@ -197,7 +195,7 @@ void LicenseCommandEnv::handle( } } - handle_(approve, abort, xRequest); + handle_(approve, false/*abort*/, xRequest); } @@ -216,13 +214,12 @@ void NoLicenseCommandEnv::handle( deployment::LicenseException licExc; bool approve = false; - bool abort = false; if (request >>= licExc) { approve = true; } - handle_(approve, abort, xRequest); + handle_(approve, false/*abort*/, xRequest); } SilentCheckPrerequisitesCommandEnv::SilentCheckPrerequisitesCommandEnv() diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 0a1b81dc4ed6..6ccdd07b07c3 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -473,9 +473,7 @@ void BackendImpl::implProcessHelp( else aLang = "en"; - OUString aMod("help"); - - HelpIndexer aIndexer(aLang, aMod, langFolderDestExpanded, langFolderDestExpanded); + HelpIndexer aIndexer(aLang, "help", langFolderDestExpanded, langFolderDestExpanded); aIndexer.indexDocuments(); } @@ -496,7 +494,7 @@ void BackendImpl::implProcessHelp( // Remove CR/LF OUString aErrMsg( aErrorInfo.m_aErrorMsg ); - sal_Unicode nCR = 13, nLF = 10; + sal_Unicode const nCR = 13, nLF = 10; sal_Int32 nSearchCR = aErrMsg.indexOf( nCR ); sal_Int32 nSearchLF = aErrMsg.indexOf( nLF ); sal_Int32 nCopy; diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index d0291d73290b..56fcbd58d481 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -164,7 +164,7 @@ OUString mapModuleShortNameToIdentifier(const OUString& sShortName) bool MigrationImpl::alreadyMigrated() { - OUString MIGRATION_STAMP_NAME("/MIGRATED4"); + OUString const MIGRATION_STAMP_NAME("/MIGRATED4"); OUString aStr = m_aInfo.userdata + MIGRATION_STAMP_NAME; File aFile(aStr); // create migration stamp, and/or check its existence @@ -391,8 +391,7 @@ migrations_vr MigrationImpl::readMigrationSteps(const OUString& rMigrationName) // get migration description from org.openoffice.Setup/Migration // and build vector of migration steps - OUString aMigrationSteps( "MigrationSteps" ); - uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName(aMigrationSteps), uno::UNO_QUERY_THROW); + uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName("MigrationSteps"), uno::UNO_QUERY_THROW); uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames(); uno::Reference< XNameAccess > tmpAccess; uno::Sequence< OUString > tmpSeq; diff --git a/desktop/unx/source/splashx.c b/desktop/unx/source/splashx.c index 74c071157f00..aa01d44b6c61 100644 --- a/desktop/unx/source/splashx.c +++ b/desktop/unx/source/splashx.c @@ -216,7 +216,6 @@ static void create_pixmap(struct splash* splash) { Pixmap pixmap; GC pixmap_gc; - unsigned long value_mask = 0; XGCValues values; if ( !splash->bitmap_rows ) @@ -225,7 +224,7 @@ static void create_pixmap(struct splash* splash) } pixmap = XCreatePixmap( splash->display, splash->win, splash->width, splash->height, splash->depth ); - pixmap_gc = XCreateGC( splash->display, pixmap, value_mask, &values ); + pixmap_gc = XCreateGC( splash->display, pixmap, 0/*value_mask*/, &values ); if ( splash->visual->class == TrueColor ) { @@ -469,7 +468,6 @@ static int splash_init_display( struct splash* splash, int argc, char** argv ) static int splash_create_window(struct splash* splash) { Window root_win; - unsigned long value_mask = 0; XGCValues values; const char* name = "LibreOffice"; const char* icon = "icon"; // FIXME @@ -495,7 +493,7 @@ static int splash_create_window(struct splash* splash) XAllocColor( splash->display, splash->color_map, &(splash->framecolor) ); // not resizable, no decorations, etc. - splash->gc = XCreateGC( splash->display, splash->win, value_mask, &values ); + splash->gc = XCreateGC( splash->display, splash->win, 0/*value_mask*/, &values ); size_hints.flags = PPosition | PSize | PMinSize | PMaxSize; size_hints.x = splash->display_x_pos; diff --git a/drawinglayer/qa/unit/border.cxx b/drawinglayer/qa/unit/border.cxx index 9df6f23d57df..25264c46ee51 100644 --- a/drawinglayer/qa/unit/border.cxx +++ b/drawinglayer/qa/unit/border.cxx @@ -49,17 +49,17 @@ void DrawinglayerBorderTest::testDoubleDecompositionSolid() basegfx::B2DPoint aStart(0, 20); basegfx::B2DPoint aEnd(100, 20); double fLeftWidth = 1.47; - double fDistance = 1.47; - double fRightWidth = 1.47; - double fExtendLeftStart = 0; - double fExtendLeftEnd = 0; - double fExtendRightStart = 0; - double fExtendRightEnd = 0; + double const fDistance = 1.47; + double const fRightWidth = 1.47; + double const fExtendLeftStart = 0; + double const fExtendLeftEnd = 0; + double const fExtendRightStart = 0; + double const fExtendRightEnd = 0; basegfx::BColor aColorRight; basegfx::BColor aColorLeft; basegfx::BColor aColorGap; - bool bHasGapColor = false; - SvxBorderLineStyle nStyle = SvxBorderLineStyle::DOUBLE; + bool const bHasGapColor = false; + SvxBorderLineStyle const nStyle = SvxBorderLineStyle::DOUBLE; rtl::Reference aBorder(new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, fLeftWidth, fDistance, fRightWidth, fExtendLeftStart, fExtendLeftEnd, fExtendRightStart, fExtendRightEnd, aColorRight, aColorLeft, aColorGap, bHasGapColor, nStyle)); // Decompose it into polygons. @@ -98,18 +98,18 @@ void DrawinglayerBorderTest::testDoublePixelProcessing() // 1.47 pixels is 0.03cm at 130% zoom and 96 DPI. basegfx::B2DPoint aStart(0, 20); basegfx::B2DPoint aEnd(100, 20); - double fLeftWidth = 1.47; - double fDistance = 1.47; + double const fLeftWidth = 1.47; + double const fDistance = 1.47; double fRightWidth = 1.47; - double fExtendLeftStart = 0; - double fExtendLeftEnd = 0; - double fExtendRightStart = 0; - double fExtendRightEnd = 0; + double const fExtendLeftStart = 0; + double const fExtendLeftEnd = 0; + double const fExtendRightStart = 0; + double const fExtendRightEnd = 0; basegfx::BColor aColorRight; basegfx::BColor aColorLeft; basegfx::BColor aColorGap; - bool bHasGapColor = false; - SvxBorderLineStyle nStyle = SvxBorderLineStyle::DOUBLE; + bool const bHasGapColor = false; + SvxBorderLineStyle const nStyle = SvxBorderLineStyle::DOUBLE; rtl::Reference xBorder(new drawinglayer::primitive2d::BorderLinePrimitive2D(aStart, aEnd, fLeftWidth, fDistance, fRightWidth, fExtendLeftStart, fExtendLeftEnd, fExtendRightStart, fExtendRightEnd, aColorRight, aColorLeft, aColorGap, bHasGapColor, nStyle)); drawinglayer::primitive2d::Primitive2DContainer aPrimitives; aPrimitives.push_back(drawinglayer::primitive2d::Primitive2DReference(xBorder.get())); diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index 99d9e700e390..38c196f53b8f 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -118,9 +118,8 @@ namespace } // #112245# helper to evtl. split filled polygons to maximum metafile point count - bool fillPolyPolygonNeededToBeSplit(basegfx::B2DPolyPolygon& rPolyPolygon) + void fillPolyPolygonNeededToBeSplit(basegfx::B2DPolyPolygon& rPolyPolygon) { - bool bRetval(false); const sal_uInt32 nPolyCount(rPolyPolygon.count()); if(nPolyCount) @@ -204,8 +203,6 @@ namespace rPolyPolygon = aSplitted; } } - - return bRetval; } /** Filter input polypolygon for effectively empty sub-fills @@ -1365,81 +1362,70 @@ namespace drawinglayer const primitive2d::PolyPolygonGraphicPrimitive2D& rBitmapCandidate = static_cast< const primitive2d::PolyPolygonGraphicPrimitive2D& >(rCandidate); basegfx::B2DPolyPolygon aLocalPolyPolygon(rBitmapCandidate.getB2DPolyPolygon()); - if(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) - { - // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points - // per polygon. If there are more use the splitted polygon and call recursively - rtl::Reference< primitive2d::PolyPolygonGraphicPrimitive2D > xSplitted(new primitive2d::PolyPolygonGraphicPrimitive2D( - aLocalPolyPolygon, - rBitmapCandidate.getFillGraphic())); + fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon); - processBasePrimitive2D(*xSplitted.get()); - } - else + SvtGraphicFill* pSvtGraphicFill = nullptr; + + if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) { - SvtGraphicFill* pSvtGraphicFill = nullptr; + // #121194# Changed implementation and checked usages fo convert to metafile, + // presentation start (uses SvtGraphicFill) and printing. - if(!mnSvtGraphicFillCount && aLocalPolyPolygon.count()) - { - // #121194# Changed implementation and checked usages fo convert to metafile, - // presentation start (uses SvtGraphicFill) and printing. - - // calculate transformation. Get real object size, all values in FillGraphicAttribute - // are relative to the unified object - aLocalPolyPolygon.transform(maCurrentTransformation); - const basegfx::B2DVector aOutlineSize(aLocalPolyPolygon.getB2DRange().getRange()); - - // the scaling needs scale from pixel to logic coordinate system - const attribute::FillGraphicAttribute& rFillGraphicAttribute = rBitmapCandidate.getFillGraphic(); - const Size aBmpSizePixel(rFillGraphicAttribute.getGraphic().GetSizePixel()); - - // setup transformation like in impgrfll. Multiply with aOutlineSize - // to get from unit coordinates in rFillGraphicAttribute.getGraphicRange() - // to object coordinates with object's top left being at (0,0). Divide - // by pixel size so that scale from pixel to logic will work in SvtGraphicFill. - const basegfx::B2DVector aTransformScale( - rFillGraphicAttribute.getGraphicRange().getRange() / - basegfx::B2DVector( - std::max(1.0, double(aBmpSizePixel.Width())), - std::max(1.0, double(aBmpSizePixel.Height()))) * - aOutlineSize); - const basegfx::B2DPoint aTransformPosition( - rFillGraphicAttribute.getGraphicRange().getMinimum() * aOutlineSize); - - // setup transformation like in impgrfll - SvtGraphicFill::Transform aTransform; - - // scale values are divided by bitmap pixel sizes - aTransform.matrix[0] = aTransformScale.getX(); - aTransform.matrix[4] = aTransformScale.getY(); - - // translates are absolute - aTransform.matrix[2] = aTransformPosition.getX(); - aTransform.matrix[5] = aTransformPosition.getY(); - - pSvtGraphicFill = new SvtGraphicFill( - getFillPolyPolygon(aLocalPolyPolygon), - Color(), - 0.0, - SvtGraphicFill::fillEvenOdd, - SvtGraphicFill::fillTexture, - aTransform, - rFillGraphicAttribute.getTiling(), - SvtGraphicFill::hatchSingle, - Color(), - SvtGraphicFill::GradientType::Linear, - Color(), - Color(), - 0, - rFillGraphicAttribute.getGraphic()); - } + // calculate transformation. Get real object size, all values in FillGraphicAttribute + // are relative to the unified object + aLocalPolyPolygon.transform(maCurrentTransformation); + const basegfx::B2DVector aOutlineSize(aLocalPolyPolygon.getB2DRange().getRange()); + + // the scaling needs scale from pixel to logic coordinate system + const attribute::FillGraphicAttribute& rFillGraphicAttribute = rBitmapCandidate.getFillGraphic(); + const Size aBmpSizePixel(rFillGraphicAttribute.getGraphic().GetSizePixel()); + + // setup transformation like in impgrfll. Multiply with aOutlineSize + // to get from unit coordinates in rFillGraphicAttribute.getGraphicRange() + // to object coordinates with object's top left being at (0,0). Divide + // by pixel size so that scale from pixel to logic will work in SvtGraphicFill. + const basegfx::B2DVector aTransformScale( + rFillGraphicAttribute.getGraphicRange().getRange() / + basegfx::B2DVector( + std::max(1.0, double(aBmpSizePixel.Width())), + std::max(1.0, double(aBmpSizePixel.Height()))) * + aOutlineSize); + const basegfx::B2DPoint aTransformPosition( + rFillGraphicAttribute.getGraphicRange().getMinimum() * aOutlineSize); + + // setup transformation like in impgrfll + SvtGraphicFill::Transform aTransform; - // Do use decomposition; encapsulate with SvtGraphicFill - impStartSvtGraphicFill(pSvtGraphicFill); - process(rCandidate); - impEndSvtGraphicFill(pSvtGraphicFill); + // scale values are divided by bitmap pixel sizes + aTransform.matrix[0] = aTransformScale.getX(); + aTransform.matrix[4] = aTransformScale.getY(); + + // translates are absolute + aTransform.matrix[2] = aTransformPosition.getX(); + aTransform.matrix[5] = aTransformPosition.getY(); + + pSvtGraphicFill = new SvtGraphicFill( + getFillPolyPolygon(aLocalPolyPolygon), + Color(), + 0.0, + SvtGraphicFill::fillEvenOdd, + SvtGraphicFill::fillTexture, + aTransform, + rFillGraphicAttribute.getTiling(), + SvtGraphicFill::hatchSingle, + Color(), + SvtGraphicFill::GradientType::Linear, + Color(), + Color(), + 0, + rFillGraphicAttribute.getGraphic()); } + // Do use decomposition; encapsulate with SvtGraphicFill + impStartSvtGraphicFill(pSvtGraphicFill); + process(rCandidate); + impEndSvtGraphicFill(pSvtGraphicFill); + break; } case PRIMITIVE2D_ID_POLYPOLYGONHATCHPRIMITIVE2D : @@ -1460,8 +1446,7 @@ namespace drawinglayer // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points // per polygon. Split polygon until there are less than that - while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) - ; + fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon); if(rFillHatchAttribute.isFillBackground()) { @@ -1597,8 +1582,7 @@ namespace drawinglayer // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points // per polygon. Split polygon until there are less than that - while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) - ; + fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon); // for support of MetaCommentActions of the form XGRAD_SEQ_BEGIN, XGRAD_SEQ_END // it is safest to use the VCL OutputDevice::DrawGradient method which creates those. @@ -1672,8 +1656,7 @@ namespace drawinglayer // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points // per polygon. Split polygon until there are less than that - while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) - ; + fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon); const basegfx::BColor aPolygonColor(maBColorModifierStack.getModifiedColor(rPolygonCandidate.getBColor())); aLocalPolyPolygon.transform(maCurrentTransformation); @@ -1850,8 +1833,7 @@ namespace drawinglayer // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points // per polygon. Split polygon until there are less than that - while(fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon)) - ; + fillPolyPolygonNeededToBeSplit(aLocalPolyPolygon); // now transform aLocalPolyPolygon.transform(maCurrentTransformation); -- cgit v1.2.3