Kaydet (Commit) 26c82e22 authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:oncevar in ucb..vbahelper

Change-Id: I1fc7c7505a42b3bf9d4a5ab22961930b9831d4ae
Reviewed-on: https://gerrit.libreoffice.org/39327Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ef531e85
......@@ -736,10 +736,10 @@ void PropertySetRegistry::renamePropertySet( const OUString& rOldKey,
aOldValuesKey += "/";
OUString aHandleKey("/Handle");
OUString aValueKey("/Value");
OUString aStateKey("/State");
OUString aAttrKey("/Attributes");
OUString const aHandleKey("/Handle");
OUString const aValueKey("/Value");
OUString const aStateKey("/State");
OUString const aAttrKey("/Attributes");
for ( sal_Int32 n = 0; n < nCount; ++n )
{
......@@ -763,32 +763,28 @@ void PropertySetRegistry::renamePropertySet( const OUString& rOldKey,
aKey += makeHierarchalNameSegment( rPropName );
// ... handle
OUString aNewKey1 = aKey;
aNewKey1 += aHandleKey;
OUString aNewKey1 = aKey + aHandleKey;
Any aAny =
xRootHierNameAccess->getByHierarchicalName(
aNewKey1 );
xNewPropNameReplace->replaceByName( "Handle", aAny );
// ... value
aNewKey1 = aKey;
aNewKey1 += aValueKey;
aNewKey1 = aKey + aValueKey;
aAny =
xRootHierNameAccess->getByHierarchicalName(
aNewKey1 );
xNewPropNameReplace->replaceByName( "Value", aAny );
// ... state
aNewKey1 = aKey;
aNewKey1 += aStateKey;
aNewKey1 = aKey + aStateKey;
aAny =
xRootHierNameAccess->getByHierarchicalName(
aNewKey1 );
xNewPropNameReplace->replaceByName( "State", aAny );
// ... attributes
aNewKey1 = aKey;
aNewKey1 += aAttrKey;
aNewKey1 = aKey + aAttrKey;
aAny =
xRootHierNameAccess->getByHierarchicalName(
aNewKey1 );
......
......@@ -126,7 +126,6 @@ namespace cmis
const char* /*password*/ )
{
OUString instructions = "PIN:";
OUString url_oustr( "" );
const css::uno::Reference<
css::ucb::XCommandEnvironment> xEnv = getXEnv( );
......@@ -139,7 +138,7 @@ namespace cmis
{
rtl::Reference< ucbhelper::AuthenticationFallbackRequest > xRequest
= new ucbhelper::AuthenticationFallbackRequest (
instructions, url_oustr );
instructions, "" );
xIH->handle( xRequest.get() );
......
......@@ -528,10 +528,8 @@ namespace ucb { namespace ucp { namespace ext
Sequence< CommandInfo > Content::getCommands( const Reference< XCommandEnvironment > & /*xEnv*/ )
{
sal_uInt32 nCommandCount = 5;
static const CommandInfo aCommandInfoTable[] =
{
// Mandatory commands
CommandInfo(
......@@ -564,7 +562,7 @@ namespace ucb { namespace ucp { namespace ext
)
};
return Sequence< CommandInfo >( aCommandInfoTable, nCommandCount );
return Sequence< CommandInfo >( aCommandInfoTable, SAL_N_ELEMENTS(aCommandInfoTable) );
}
......
......@@ -186,8 +186,7 @@ namespace fileaccess {
OUString getTitle( const OUString& aPath )
{
sal_Unicode slash = '/';
sal_Int32 lastIndex = aPath.lastIndexOf( slash );
sal_Int32 lastIndex = aPath.lastIndexOf( '/' );
return aPath.copy( lastIndex + 1 );
}
......
......@@ -190,10 +190,8 @@ void XResultSet_impl::isFinalChanged()
aEv.PropertyName = "IsRowCountFinal";
aEv.Further = false;
aEv.PropertyHandle = -1;
bool fval = false;
bool tval = true;
aEv.OldValue <<= fval;
aEv.NewValue <<= tval;
aEv.OldValue <<= false;
aEv.NewValue <<= true;
for( const auto& r : seq )
{
uno::Reference< beans::XPropertyChangeListener > listener(
......@@ -609,12 +607,10 @@ XResultSet_impl::getMetaData()
{
if ( m_sProperty.getConstArray()[ n ].Name == "Title" )
{
// @@@ #82177# - Determine correct value!
bool bCaseSensitiveChildren = false;
std::vector< ::ucbhelper::ResultSetColumnData >
aColumnData( m_sProperty.getLength() );
aColumnData[ n ].isCaseSensitive = bCaseSensitiveChildren;
// @@@ #82177# - Determine correct value!
aColumnData[ n ].isCaseSensitive = false;
::ucbhelper::ResultSetMetaData* p =
new ::ucbhelper::ResultSetMetaData(
......
......@@ -978,12 +978,11 @@ TaskManager::setv( const OUString& aUnqPath,
"Uri", -1,
uno::makeAny(aUnqPath),
beans::PropertyState_DIRECT_VALUE);
IOErrorCode ioError(IOErrorCode_GENERAL);
ret[i] <<= InteractiveAugmentedIOException(
OUString(),
nullptr,
task::InteractionClassification_ERROR,
ioError,
IOErrorCode_GENERAL,
names );
}
}
......@@ -2069,7 +2068,7 @@ TaskManager::copy_recursive( const OUString& srcUnqPath,
osl::FileBase::RC next = err;
if( err == osl::FileBase::E_None )
{
sal_Int32 n_Mask = osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type;
sal_Int32 const n_Mask = osl_FileStatus_Mask_FileURL | osl_FileStatus_Mask_FileName | osl_FileStatus_Mask_Type;
osl::DirectoryItem aDirItem;
......
......@@ -456,7 +456,7 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage(
{
try
{
sal_Int32 nOpenMode = embed::ElementModes::READ
sal_Int32 const nOpenMode = embed::ElementModes::READ
| embed::ElementModes::NOCREATE;
xStorage
= xParentStorage->openStorageElement( rName, nOpenMode );
......
......@@ -197,17 +197,13 @@ bool LinkSequence::toXML( const uno::Sequence< ucb::Link > & rInData,
sal_Int32 nCount = rInData.getLength();
if ( nCount )
{
OUString aPre( "<link><src>" );
OUString aMid( "</src><dst>" );
OUString aEnd( "</dst></link>" );
for ( sal_Int32 n = 0; n < nCount; ++n )
{
rOutData += aPre;
rOutData += "<link><src>";
rOutData += rInData[ n ].Source;
rOutData += aMid;
rOutData += "</src><dst>";
rOutData += rInData[ n ].Destination;
rOutData += aEnd;
rOutData += "</dst></link>";
}
return true;
}
......
......@@ -83,13 +83,11 @@ AccessibleRelation AccessibleRelationSetHelperImpl::getRelationByType( sal_Int16
{
sal_Int32 nCount(getRelationCount());
sal_Int32 i(0);
bool bFound(false);
while ((i < nCount) && !bFound)
while (i < nCount)
{
if (maRelations[i].RelationType == aRelationType)
return maRelations[i];
else
i++;
i++;
}
return AccessibleRelation();
}
......
......@@ -1020,13 +1020,13 @@ void FontSubstConfiguration::readLocaleSubst( const OUString& rBcp47 ) const
it->second.aSubstAttributes.reserve( nFonts );
// strings for subst retrieval, construct only once
OUString aSubstFontsStr ( "SubstFonts" );
OUString aSubstFontsMSStr ( "SubstFontsMS" );
OUString aSubstFontsPSStr ( "SubstFontsPS" );
OUString aSubstFontsHTMLStr ( "SubstFontsHTML" );
OUString aSubstWeightStr ( "FontWeight" );
OUString aSubstWidthStr ( "FontWidth" );
OUString aSubstTypeStr ( "FontType" );
OUString const aSubstFontsStr ( "SubstFonts" );
OUString const aSubstFontsMSStr ( "SubstFontsMS" );
OUString const aSubstFontsPSStr ( "SubstFontsPS" );
OUString const aSubstFontsHTMLStr ( "SubstFontsHTML" );
OUString const aSubstWeightStr ( "FontWeight" );
OUString const aSubstWidthStr ( "FontWidth" );
OUString const aSubstTypeStr ( "FontType" );
for( int i = 0; i < nFonts; i++ )
{
Reference< XNameAccess > xFont;
......
......@@ -1158,8 +1158,7 @@ OUString SvtLinguConfig::GetSynonymsContextImage(
OUString aRes;
if (!rServiceImplName.isEmpty())
{
OUString aImageName( "SynonymsContextMenuImage" );
OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, aImageName ) );
OUString aPath( GetVendorImageUrl_Impl( rServiceImplName, "SynonymsContextMenuImage" ) );
aRes = aPath;
}
return aRes;
......
......@@ -87,8 +87,7 @@ ZipPackageHelper::ZipPackageHelper(
mxFactory = xFactory;
// get root zip folder
OUString szRootFolder("/");
mxHNameAccess->getByHierarchicalName( szRootFolder ) >>= mxRootFolder;
mxHNameAccess->getByHierarchicalName( "/" ) >>= mxRootFolder;
}
static OUString encodeZipUri( const OUString& rURI )
......
......@@ -1348,8 +1348,7 @@ const ConvertChar* ConvertChar::GetRecodeData( const OUString& rOrgFontName, con
if( aMapName == "starsymbol"
|| aMapName == "opensymbol" )
{
int nEntries = SAL_N_ELEMENTS(aStarSymbolRecodeTable);
for( int i = 0; i < nEntries; ++i)
for( int i = 0; i < int(SAL_N_ELEMENTS(aStarSymbolRecodeTable)); ++i)
{
const RecodeTable& r = aStarSymbolRecodeTable[i];
if( aOrgName.equalsAscii( r.pOrgName ) )
......@@ -1364,8 +1363,7 @@ const ConvertChar* ConvertChar::GetRecodeData( const OUString& rOrgFontName, con
//adobe-symbol to unicode conversion in rtl instead
else if( aMapName == "applesymbol" )
{
int nEntries = SAL_N_ELEMENTS(aAppleSymbolRecodeTable);
for( int i = 0; i < nEntries; ++i)
for( int i = 0; i < int(SAL_N_ELEMENTS(aAppleSymbolRecodeTable)); ++i)
{
const RecodeTable& r = aAppleSymbolRecodeTable[i];
if( aOrgName.equalsAscii( r.pOrgName ) )
......
......@@ -575,8 +575,7 @@ bool MediaDescriptor::impl_openStreamWithPostData( const css::uno::Reference< cs
aPostArgument.MediaType = sMediaType;
aPostArgument.Referer = getUnpackedValueOrDefault( PROP_REFERRER(), OUString() );
OUString sCommandName( "post" );
aContent.executeCommand( sCommandName, css::uno::makeAny( aPostArgument ) );
aContent.executeCommand( "post", css::uno::makeAny( aPostArgument ) );
// get result
xResultStream = xSink->getInputStream();
......
......@@ -194,8 +194,7 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc
OUString aUrl;
if (evt.NewValue >>= aUrl)
{
OUString aBad ("private:");
if (!aUrl.startsWith(aBad))
if (!aUrl.startsWith("private:"))
{
// URL changed (Redirection).
m_xLockBytes->SetRealURL_Impl( aUrl );
......
......@@ -95,8 +95,7 @@ namespace DOM
assert(xTarget.is());
if (!xTarget.is())
return;
bool capture = false;
xTarget->removeEventListener("DOMSubtreeModified", m_xEventListener, capture);
xTarget->removeEventListener("DOMSubtreeModified", m_xEventListener, false/*capture*/);
}
}
......@@ -105,10 +104,8 @@ namespace DOM
try {
Reference< XEventTarget > const xTarget(
static_cast<XElement*>(& rElement), UNO_QUERY_THROW);
bool capture = false;
m_xEventListener = new WeakEventListener(this);
xTarget->addEventListener("DOMSubtreeModified",
m_xEventListener, capture);
xTarget->addEventListener("DOMSubtreeModified", m_xEventListener, false/*capture*/);
} catch (const Exception &e){
SAL_WARN( "unoxml", "Exception caught while registering NodeList as listener: "
<< e.Message);
......
......@@ -403,7 +403,6 @@ UUIInteractionHelper::handleRequest_impl(
script::ModuleSizeExceededRequest aModSizeException;
if (aAnyRequest >>= aModSizeException )
{
ErrCode nErrorCode = ERRCODE_UUI_IO_MODULESIZEEXCEEDED;
std::vector< OUString > aArguments;
uno::Sequence< OUString > sModules
= aModSizeException.Names;
......@@ -420,7 +419,7 @@ UUIInteractionHelper::handleRequest_impl(
aArguments.push_back( aName );
}
handleErrorHandlerRequest( task::InteractionClassification_WARNING,
nErrorCode,
ERRCODE_UUI_IO_MODULESIZEEXCEEDED,
aArguments,
rRequest->getContinuations(),
bObtainErrorStringOnly,
......@@ -454,7 +453,6 @@ UUIInteractionHelper::handleRequest_impl(
ucb::UnsupportedNameClashException aUORequest;
if (aAnyRequest >>= aUORequest)
{
ErrCode nErrorCode = ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE;
std::vector< OUString > aArguments;
uno::Reference< task::XInteractionApprove > xApprove;
......@@ -465,7 +463,7 @@ UUIInteractionHelper::handleRequest_impl(
if ( xApprove.is() && xDisapprove.is() )
{
handleErrorHandlerRequest( task::InteractionClassification_QUERY,
nErrorCode,
ERRCODE_UUI_IO_UNSUPPORTEDOVERWRITE,
aArguments,
rRequest->getContinuations(),
bObtainErrorStringOnly,
......@@ -675,12 +673,11 @@ UUIInteractionHelper::handleRequest_impl(
ucb::InteractiveLockingNotLockedException aLNLException;
if (aAnyRequest >>= aLNLException)
{
ErrCode nErrorCode = ERRCODE_UUI_LOCKING_NOT_LOCKED;
std::vector< OUString > aArguments;
aArguments.push_back( aLNLException.Url );
handleErrorHandlerRequest( aLNLException.Classification,
nErrorCode,
ERRCODE_UUI_LOCKING_NOT_LOCKED,
aArguments,
rRequest->getContinuations(),
bObtainErrorStringOnly,
......@@ -692,12 +689,11 @@ UUIInteractionHelper::handleRequest_impl(
ucb::InteractiveLockingLockExpiredException aLLEException;
if (aAnyRequest >>= aLLEException)
{
ErrCode nErrorCode = ERRCODE_UUI_LOCKING_LOCK_EXPIRED;
std::vector< OUString > aArguments;
aArguments.push_back( aLLEException.Url );
handleErrorHandlerRequest( aLLEException.Classification,
nErrorCode,
ERRCODE_UUI_LOCKING_LOCK_EXPIRED,
aArguments,
rRequest->getContinuations(),
bObtainErrorStringOnly,
......@@ -747,12 +743,11 @@ UUIInteractionHelper::handleRequest_impl(
loader::CannotActivateFactoryException aCannotActivateFactoryException;
if (aAnyRequest >>= aCannotActivateFactoryException)
{
ErrCode nErrorCode = ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY;
std::vector< OUString > aArguments;
aArguments.push_back( aCannotActivateFactoryException.Message );
handleErrorHandlerRequest( task::InteractionClassification_ERROR,
nErrorCode,
ERRCODE_UUI_CANNOT_ACTIVATE_FACTORY,
aArguments,
rRequest->getContinuations(),
bObtainErrorStringOnly,
......
......@@ -229,9 +229,7 @@ void MacroWarning::SetCertificate( const css::uno::Reference< css::security::XCe
mxCert = _rxCert;
if( mxCert.is() )
{
OUString aCN_Id("CN");
OUString s;
s = GetContentPart( mxCert->getSubjectName(), aCN_Id );
OUString s = GetContentPart( mxCert->getSubjectName(), "CN" );
mpSignsFI->SetText( s );
mpViewSignsBtn->Enable();
}
......
......@@ -460,7 +460,7 @@ PointerStyles const styles[] = {
static long lcl_loPointerToMsoPointer( PointerStyle eType )
{
long nRet = msforms::fmMousePointer::fmMousePointerDefault;
for ( int i = 0, nElems = SAL_N_ELEMENTS( styles ); i < nElems; ++i )
for ( int i = 0; i < int(SAL_N_ELEMENTS( styles )); ++i )
{
if ( styles[ i ].loPointStyle == eType )
{
......@@ -474,7 +474,7 @@ static long lcl_loPointerToMsoPointer( PointerStyle eType )
static Pointer lcl_msoPointerToLOPointer( long msoPointerStyle )
{
Pointer aPointer( PointerStyle::Arrow );
for ( int i = 0, nElems = SAL_N_ELEMENTS( styles ); i < nElems; ++i )
for ( int i = 0; i < int(SAL_N_ELEMENTS( styles )); ++i )
{
if ( styles[ i ].msoPointerStyle == msoPointerStyle )
{
......
......@@ -205,8 +205,7 @@ VbaApplicationBase::getDisplayStatusBar()
if( xProps.is() ){
uno::Reference< frame::XLayoutManager > xLayoutManager( xProps->getPropertyValue( "LayoutManager"), uno::UNO_QUERY_THROW );
OUString url( "private:resource/statusbar/statusbar" );
if( xLayoutManager.is() && xLayoutManager->isElementVisible( url ) ){
if( xLayoutManager.is() && xLayoutManager->isElementVisible( "private:resource/statusbar/statusbar" ) ){
return true;
}
}
......
......@@ -210,9 +210,7 @@ ScVbaCommandBarControls::Add( const uno::Any& Type, const uno::Any& Id, const un
}
else
{
bool isVisible = true;
sal_Int32 nStyle = 0;
aProps = CreateToolbarItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu, isVisible, nStyle );
aProps = CreateToolbarItemData( sCommandUrl, sHelpUrl, sLabel, nItemType, aSubMenu, true/*isVisible*/, 0/*nStyle*/ );
}
......
......@@ -249,9 +249,8 @@ VbaDocumentBase::getSaved()
void
VbaDocumentBase::Save()
{
OUString url(".uno:Save");
uno::Reference< frame::XModel > xModel = getModel();
dispatchRequests(xModel,url);
dispatchRequests(xModel,".uno:Save");
}
void
......
......@@ -219,13 +219,12 @@ ScVbaShapes::createShape( const OUString& service )
uno::Any
ScVbaShapes::AddRectangle(sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, const uno::Any& rRange)
{
OUString sCreateShapeName( "com.sun.star.drawing.RectangleShape" );
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
uno::Reference< drawing::XShape > xShape( createShape( "com.sun.star.drawing.RectangleShape" ), uno::UNO_QUERY_THROW );
m_xShapes->add( xShape );
OUString sName(createName( "Rectangle" ));
......@@ -251,13 +250,12 @@ ScVbaShapes::AddRectangle(sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWid
uno::Any
ScVbaShapes::AddEllipse(sal_Int32 startX, sal_Int32 startY, sal_Int32 nLineWidth, sal_Int32 nLineHeight, const uno::Any& rRange)
{
OUString sCreateShapeName( "com.sun.star.drawing.EllipseShape" );
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( startX );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( startY );
sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( nLineWidth );
sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( nLineHeight );
uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
uno::Reference< drawing::XShape > xShape( createShape( "com.sun.star.drawing.EllipseShape" ), uno::UNO_QUERY_THROW );
m_xShapes->add( xShape );
awt::Point aMovePositionIfRange( 0, 0 );
......@@ -356,13 +354,12 @@ ScVbaShapes::AddTextbox( sal_Int32 /*_nOrientation*/, sal_Int32 _nLeft, sal_Int3
uno::Any
ScVbaShapes::AddTextboxInWriter( sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _nWidth, sal_Int32 _nHeight )
{
OUString sCreateShapeName( "com.sun.star.drawing.TextShape" );
sal_Int32 nXPos = Millimeter::getInHundredthsOfOneMillimeter( _nLeft );
sal_Int32 nYPos = Millimeter::getInHundredthsOfOneMillimeter( _nTop );
sal_Int32 nWidth = Millimeter::getInHundredthsOfOneMillimeter( _nWidth );
sal_Int32 nHeight = Millimeter::getInHundredthsOfOneMillimeter( _nHeight );
uno::Reference< drawing::XShape > xShape( createShape( sCreateShapeName ), uno::UNO_QUERY_THROW );
uno::Reference< drawing::XShape > xShape( createShape( "com.sun.star.drawing.TextShape" ), uno::UNO_QUERY_THROW );
m_xShapes->add( xShape );
setDefaultShapeProperties(xShape);
......@@ -386,13 +383,10 @@ ScVbaShapes::AddTextboxInWriter( sal_Int32 _nLeft, sal_Int32 _nTop, sal_Int32 _n
xShapeProps->setPropertyValue( "VertOrientPosition", uno::makeAny( nYPos ) );
// set to visible
drawing::LineStyle aLineStyle = drawing::LineStyle_SOLID;
xShapeProps->setPropertyValue( "LineStyle", uno::makeAny( aLineStyle ) );
xShapeProps->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_SOLID ) );
// set to font
sal_Int16 nLayerId = 1;
OUString sLayerName("Heaven");
xShapeProps->setPropertyValue( "LayerID", uno::makeAny( nLayerId ) );
xShapeProps->setPropertyValue( "LayerName", uno::makeAny( sLayerName ) );
xShapeProps->setPropertyValue( "LayerID", uno::makeAny( sal_Int16(1) ) );
xShapeProps->setPropertyValue( "LayerName", uno::makeAny( OUString("Heaven") ) );
ScVbaShape *pScVbaShape = new ScVbaShape( getParent(), mxContext, xShape, m_xShapes, m_xModel, ScVbaShape::getType( xShape ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment