diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-28 23:51:21 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-10-29 05:59:15 +0100 |
commit | 951a65923c088a1e19a4073f3c26a3b564a0a922 (patch) | |
tree | 5e7191cc0783df304e5f7f28616dd31ee950a405 /sw | |
parent | cb7500ddb8de6c41fca84a0009ffe22240bb1845 (diff) |
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I0516dc68cf7d451eafc044be8e50a66d2bddf15f
Reviewed-on: https://gerrit.libreoffice.org/62484
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/fields/usrfld.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlexp.cxx | 36 | ||||
-rw-r--r-- | sw/source/uibase/shells/textsh.cxx | 3 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/ThemePanel.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/wrtsh/wrtsh2.cxx | 10 |
5 files changed, 21 insertions, 41 deletions
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index cb39faeb6eba..4ffd7622f835 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -186,8 +186,7 @@ SwUserFieldType::SwUserFieldType( SwDoc* pDocPtr, const OUString& aNam ) bValidValue = bDeleted = false; aName = aNam; - if (nType & nsSwGetSetExpType::GSE_STRING) - EnableFormat(false); // Do not use a Numberformatter + EnableFormat(false); // Do not use a Numberformatter for nsSwGetSetExpType::GSE_STRING } OUString SwUserFieldType::Expand(sal_uInt32 nFormat, sal_uInt16 nSubType, LanguageType nLng) diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 24073bd25a03..fae13fa81339 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -340,17 +340,15 @@ void SwXMLExport::ExportFontDecls_() SvXMLExport::ExportFontDecls_(); } -#define NUM_EXPORTED_VIEW_SETTINGS 11 void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) { - aProps.realloc( NUM_EXPORTED_VIEW_SETTINGS ); + aProps.realloc(7); // Currently exporting 9 properties PropertyValue *pValue = aProps.getArray(); - sal_Int32 nIndex = 0; Reference < XIndexContainer > xBox = IndexedPropertyValues::create( comphelper::getProcessComponentContext() ); - pValue[nIndex].Name = "Views"; - pValue[nIndex++].Value <<= xBox; + pValue[0].Name = "Views"; + pValue[0].Value <<= xBox; SwDoc *pDoc = getDoc(); const tools::Rectangle rRect = @@ -359,17 +357,17 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) OSL_ENSURE( bTwip, "Map unit for visible area is not in TWIPS!" ); - pValue[nIndex].Name = "ViewAreaTop"; - pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.Top() ) : rRect.Top(); + pValue[1].Name = "ViewAreaTop"; + pValue[1].Value <<= bTwip ? convertTwipToMm100 ( rRect.Top() ) : rRect.Top(); - pValue[nIndex].Name = "ViewAreaLeft"; - pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.Left() ) : rRect.Left(); + pValue[2].Name = "ViewAreaLeft"; + pValue[2].Value <<= bTwip ? convertTwipToMm100 ( rRect.Left() ) : rRect.Left(); - pValue[nIndex].Name = "ViewAreaWidth"; - pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.GetWidth() ) : rRect.GetWidth(); + pValue[3].Name = "ViewAreaWidth"; + pValue[3].Value <<= bTwip ? convertTwipToMm100 ( rRect.GetWidth() ) : rRect.GetWidth(); - pValue[nIndex].Name = "ViewAreaHeight"; - pValue[nIndex++].Value <<= bTwip ? convertTwipToMm100 ( rRect.GetHeight() ) : rRect.GetHeight(); + pValue[4].Name = "ViewAreaHeight"; + pValue[4].Value <<= bTwip ? convertTwipToMm100 ( rRect.GetHeight() ) : rRect.GetHeight(); // "show redline mode" cannot simply be read from the document // since it gets changed during execution. If it's in the info @@ -386,16 +384,12 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps) } } - pValue[nIndex].Name = "ShowRedlineChanges"; - pValue[nIndex++].Value <<= bShowRedlineChanges; + pValue[5].Name = "ShowRedlineChanges"; + pValue[5].Value <<= bShowRedlineChanges; - pValue[nIndex].Name = "InBrowseMode"; - pValue[nIndex++].Value <<= pDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE); - - if ( nIndex < NUM_EXPORTED_VIEW_SETTINGS ) - aProps.realloc(nIndex); + pValue[6].Name = "InBrowseMode"; + pValue[6].Value <<= pDoc->getIDocumentSettingAccess().get(DocumentSettingId::BROWSE_MODE); } -#undef NUM_EXPORTED_VIEW_SETTINGS void SwXMLExport::GetConfigurationSettings( Sequence < PropertyValue >& rProps) { diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 8d7681adde1e..b786ecb5a88d 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -277,8 +277,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) if ( pMarginItem ) aMargin = pMarginItem->GetSize(); - if ( pURLItem ) - xSet->setPropertyValue("FrameURL", uno::makeAny( pURLItem->GetValue() ) ); + xSet->setPropertyValue("FrameURL", uno::makeAny( pURLItem->GetValue() ) ); if ( pNameItem ) xSet->setPropertyValue("FrameName", uno::makeAny( pNameItem->GetValue() ) ); diff --git a/sw/source/uibase/sidebar/ThemePanel.cxx b/sw/source/uibase/sidebar/ThemePanel.cxx index d11f9d9e6f7a..b0073017e810 100644 --- a/sw/source/uibase/sidebar/ThemePanel.cxx +++ b/sw/source/uibase/sidebar/ThemePanel.cxx @@ -194,8 +194,6 @@ StyleSet setupThemes() void changeFont(SwFormat* pFormat, SwDocStyleSheet const * pStyle, FontSet const & rFontSet) { - bool bChanged = false; - if (pStyle->GetName() != "Default Style" && pFormat->GetAttrSet().GetItem(RES_CHRATR_FONT, false) == nullptr) { return; @@ -208,26 +206,20 @@ void changeFont(SwFormat* pFormat, SwDocStyleSheet const * pStyle, FontSet const if (ePitch == PITCH_FIXED) { aFontItem.SetFamilyName(rFontSet.msMonoFont); - bChanged = true; } else { if (pStyle->GetName() == "Heading") { aFontItem.SetFamilyName(rFontSet.msHeadingFont); - bChanged = true; } else { aFontItem.SetFamilyName(rFontSet.msBaseFont); - bChanged = true; } } - if (bChanged) - { - pFormat->SetFormatAttr(aFontItem); - } + pFormat->SetFormatAttr(aFontItem); } /*void changeBorder(SwTextFormatColl* pCollection, SwDocStyleSheet* pStyle, StyleSet& rStyleSet) diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index a00686c468da..8d1707761ab6 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -470,13 +470,9 @@ bool SwWrtShell::ClickToINetGrf( const Point& rDocPt, LoadUrlFlags nFilter ) { bRet = true; // At first run the possibly set ObjectSelect Macro - const SvxMacro* pMac = &pFnd->GetMacro().GetMacro( SvMacroItemId::OnClick ); - if( pMac ) - { - SwCallMouseEvent aCallEvent; - aCallEvent.Set( EVENT_OBJECT_URLITEM, pFnd ); - GetDoc()->CallEvent( SvMacroItemId::OnClick, aCallEvent ); - } + SwCallMouseEvent aCallEvent; + aCallEvent.Set(EVENT_OBJECT_URLITEM, pFnd); + GetDoc()->CallEvent(SvMacroItemId::OnClick, aCallEvent); ::LoadURL(*this, sURL, nFilter, sTargetFrameName); } |