diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 16:21:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 21:56:13 +0200 |
commit | c816cb847da9a3302f23e113171c81fed6b319c0 (patch) | |
tree | 59c68cf6d5008e65dbdd379cbbe6fca5a887ee8b | |
parent | 7354da6ccfd0492a3f38ff07ce65500ec9f727b7 (diff) |
pvs-studio: V571 Recurring check
Change-Id: I1ad7bcfa557b38488adf26b434433e6bae259f43
Reviewed-on: https://gerrit.libreoffice.org/62190
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | basegfx/source/tools/unopolypolygon.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartController_Window.cxx | 8 | ||||
-rw-r--r-- | connectivity/source/commontools/dbtools.cxx | 13 | ||||
-rw-r--r-- | dbaccess/source/core/api/tablecontainer.cxx | 4 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlexprt.cxx | 539 | ||||
-rw-r--r-- | sdext/source/presenter/PresenterSpritePane.cxx | 5 | ||||
-rw-r--r-- | sfx2/source/dialog/mailmodel.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/doc/objstor.cxx | 2 |
8 files changed, 292 insertions, 304 deletions
diff --git a/basegfx/source/tools/unopolypolygon.cxx b/basegfx/source/tools/unopolypolygon.cxx index e0b5b85f079b..2f65873e8577 100644 --- a/basegfx/source/tools/unopolypolygon.cxx +++ b/basegfx/source/tools/unopolypolygon.cxx @@ -389,7 +389,7 @@ namespace unotools // empty polygon - impossible to specify _any_ // legal value except 0 here! - if( !nPolyCount && nPointIndex ) + if( !nPolyCount) throw lang::IndexOutOfBoundsException(); nFirstPoint = nPointIndex; diff --git a/chart2/source/controller/main/ChartController_Window.cxx b/chart2/source/controller/main/ChartController_Window.cxx index 5b3cf24ad57a..104eec4cc067 100644 --- a/chart2/source/controller/main/ChartController_Window.cxx +++ b/chart2/source/controller/main/ChartController_Window.cxx @@ -1312,7 +1312,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) DrawViewWrapper* pDrawViewWrapper = m_pDrawViewWrapper.get(); auto pChartWindow(GetChartWindow()); - if(!pChartWindow || !pDrawViewWrapper) + if (!pChartWindow || !pDrawViewWrapper) return bReturn; // handle accelerators @@ -1433,7 +1433,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) // default 1 mm in each direction double fGrowAmountX = 200.0; double fGrowAmountY = 200.0; - if( bAlternate && pChartWindow ) + if (bAlternate) { // together with Alt-key: 1 px in each direction Size aPixelSize = pChartWindow->PixelToLogic( Size( 2, 2 )); @@ -1460,7 +1460,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) // default 1 mm double fShiftAmountX = 100.0; double fShiftAmountY = 100.0; - if( bAlternate && pChartWindow ) + if (bAlternate) { // together with Alt-key: 1 px Size aPixelSize = pChartWindow->PixelToLogic( Size( 1, 1 )); @@ -1562,7 +1562,7 @@ bool ChartController::execute_KeyInput( const KeyEvent& rKEvt ) bReturn = executeDispatch_Delete(); if( ! bReturn ) { - std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow ? pChartWindow->GetFrameWeld() : nullptr, + std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pChartWindow->GetFrameWeld(), VclMessageType::Info, VclButtonsType::Ok, SchResId(STR_ACTION_NOTPOSSIBLE))); xInfoBox->run(); diff --git a/connectivity/source/commontools/dbtools.cxx b/connectivity/source/commontools/dbtools.cxx index b8b8a4cdd29b..26e2c604a230 100644 --- a/connectivity/source/commontools/dbtools.cxx +++ b/connectivity/source/commontools/dbtools.cxx @@ -591,16 +591,13 @@ Reference< XNameAccess > getFieldsByCommandDescriptor( const Reference< XConnect eState = FAILED; OSL_ENSURE( xObjectCollection.is(), "::dbtools::getFieldsByCommandDescriptor: invalid connection (no sdb.Connection, or no Tables-/QueriesSupplier)!"); - if ( xObjectCollection.is() ) + if ( xObjectCollection.is() && xObjectCollection->hasByName( _rCommand ) ) { - if ( xObjectCollection.is() && xObjectCollection->hasByName( _rCommand ) ) - { - xObjectCollection->getByName( _rCommand ) >>= xSupplyColumns; - // (xSupplyColumns being NULL will be handled in the next state) + xObjectCollection->getByName( _rCommand ) >>= xSupplyColumns; + // (xSupplyColumns being NULL will be handled in the next state) - // next: go for the columns - eState = RETRIEVE_COLUMNS; - } + // next: go for the columns + eState = RETRIEVE_COLUMNS; } break; diff --git a/dbaccess/source/core/api/tablecontainer.cxx b/dbaccess/source/core/api/tablecontainer.cxx index 8e2d0008f8e9..3ffea254068e 100644 --- a/dbaccess/source/core/api/tablecontainer.cxx +++ b/dbaccess/source/core/api/tablecontainer.cxx @@ -347,9 +347,9 @@ void OTableContainer::dropObject(sal_Int32 _nPos, const OUString& _sElementName) Reference<XPropertySet> xTable(getObject(_nPos),UNO_QUERY); if ( xTable.is() && m_xMetaData.is() ) { - if( m_xMetaData.is() && m_xMetaData->supportsCatalogsInTableDefinitions() ) + if (m_xMetaData->supportsCatalogsInTableDefinitions()) xTable->getPropertyValue(PROPERTY_CATALOGNAME) >>= sCatalog; - if( m_xMetaData.is() && m_xMetaData->supportsSchemasInTableDefinitions() ) + if (m_xMetaData->supportsSchemasInTableDefinitions()) xTable->getPropertyValue(PROPERTY_SCHEMANAME) >>= sSchema; xTable->getPropertyValue(PROPERTY_NAME) >>= sTable; diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 7d143a7faec0..bf20e977ffe7 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -4560,302 +4560,299 @@ OUString getDateStringForType(condformat::ScCondFormatDateType eType) void ScXMLExport::ExportConditionalFormat(SCTAB nTab) { ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList(nTab); - if(pCondFormatList) - { - if(pCondFormatList && pCondFormatList->empty()) - return; + if(!pCondFormatList) + return; + + if (pCondFormatList->empty()) + return; - SvXMLElementExport aElementCondFormats(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, true, true); + SvXMLElementExport aElementCondFormats(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, true, true); - if(pCondFormatList) + for(ScConditionalFormatList::const_iterator itr = pCondFormatList->begin(); + itr != pCondFormatList->end(); ++itr) + { + OUString sRanges; + const ScRangeList& rRangeList = (*itr)->GetRange(); + ScRangeStringConverter::GetStringFromRangeList( sRanges, &rRangeList, pDoc, formula::FormulaGrammar::CONV_OOO ); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRanges); + SvXMLElementExport aElementCondFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true); + size_t nEntries = (*itr)->size(); + for(size_t i = 0; i < nEntries; ++i) { - for(ScConditionalFormatList::const_iterator itr = pCondFormatList->begin(); - itr != pCondFormatList->end(); ++itr) + const ScFormatEntry* pFormatEntry = (*itr)->GetEntry(i); + if(pFormatEntry->GetType()==ScFormatEntry::Type::Condition) { - OUString sRanges; - const ScRangeList& rRangeList = (*itr)->GetRange(); - ScRangeStringConverter::GetStringFromRangeList( sRanges, &rRangeList, pDoc, formula::FormulaGrammar::CONV_OOO ); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRanges); - SvXMLElementExport aElementCondFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true); - size_t nEntries = (*itr)->size(); - for(size_t i = 0; i < nEntries; ++i) + const ScCondFormatEntry* pEntry = static_cast<const ScCondFormatEntry*>(pFormatEntry); + OUStringBuffer aCond; + ScAddress aPos = pEntry->GetSrcPos(); + switch(pEntry->GetOperation()) { - const ScFormatEntry* pFormatEntry = (*itr)->GetEntry(i); - if(pFormatEntry->GetType()==ScFormatEntry::Type::Condition) - { - const ScCondFormatEntry* pEntry = static_cast<const ScCondFormatEntry*>(pFormatEntry); - OUStringBuffer aCond; - ScAddress aPos = pEntry->GetSrcPos(); - switch(pEntry->GetOperation()) - { - case ScConditionMode::Equal: - aCond.append('='); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - break; - case ScConditionMode::Less: - aCond.append('<'); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - break; - case ScConditionMode::Greater: - aCond.append('>'); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - break; - case ScConditionMode::EqLess: - aCond.append("<="); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - break; - case ScConditionMode::EqGreater: - aCond.append(">="); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - break; - case ScConditionMode::NotEqual: - aCond.append("!="); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - break; - case ScConditionMode::Between: - aCond.append("between("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(','); - aCond.append(pEntry->GetExpression(aPos, 1, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(')'); - break; - case ScConditionMode::NotBetween: - aCond.append("not-between("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(','); - aCond.append(pEntry->GetExpression(aPos, 1, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(')'); - break; - case ScConditionMode::Duplicate: - aCond.append("duplicate"); - break; - case ScConditionMode::NotDuplicate: - aCond.append("unique"); - break; - case ScConditionMode::Direct: - aCond.append("formula-is("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(')'); - break; - case ScConditionMode::Top10: - aCond.append("top-elements("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::Bottom10: - aCond.append("bottom-elements("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::TopPercent: - aCond.append("top-percent("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::BottomPercent: - aCond.append("bottom-percent("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::AboveAverage: - aCond.append("above-average"); - break; - case ScConditionMode::BelowAverage: - aCond.append("below-average"); - break; - case ScConditionMode::AboveEqualAverage: - aCond.append("above-equal-average"); - break; - case ScConditionMode::BelowEqualAverage: - aCond.append("below-equal-average"); - break; - case ScConditionMode::Error: - aCond.append("is-error"); - break; - case ScConditionMode::NoError: - aCond.append("is-no-error"); - break; - case ScConditionMode::BeginsWith: - aCond.append("begins-with("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::EndsWith: - aCond.append("ends-with("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::ContainsText: - aCond.append("contains-text("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::NotContainsText: - aCond.append("not-contains-text("); - aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); - aCond.append(")"); - break; - case ScConditionMode::NONE: - continue; - default: - SAL_WARN("sc", "unimplemented conditional format export"); - } - OUString sStyle = ScStyleNameConversion::DisplayToProgrammaticName(pEntry->GetStyle(), SfxStyleFamily::Para); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, sStyle); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, aCond.makeStringAndClear()); - - OUString sBaseAddress; - ScRangeStringConverter::GetStringFromAddress( sBaseAddress, aPos, pDoc,formula::FormulaGrammar::CONV_ODF ); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_BASE_CELL_ADDRESS, sBaseAddress); - SvXMLElementExport aElementCondEntry(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITION, true, true); - } - else if(pFormatEntry->GetType() == ScFormatEntry::Type::Colorscale) + case ScConditionMode::Equal: + aCond.append('='); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case ScConditionMode::Less: + aCond.append('<'); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case ScConditionMode::Greater: + aCond.append('>'); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case ScConditionMode::EqLess: + aCond.append("<="); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case ScConditionMode::EqGreater: + aCond.append(">="); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case ScConditionMode::NotEqual: + aCond.append("!="); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + break; + case ScConditionMode::Between: + aCond.append("between("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(','); + aCond.append(pEntry->GetExpression(aPos, 1, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(')'); + break; + case ScConditionMode::NotBetween: + aCond.append("not-between("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(','); + aCond.append(pEntry->GetExpression(aPos, 1, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(')'); + break; + case ScConditionMode::Duplicate: + aCond.append("duplicate"); + break; + case ScConditionMode::NotDuplicate: + aCond.append("unique"); + break; + case ScConditionMode::Direct: + aCond.append("formula-is("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(')'); + break; + case ScConditionMode::Top10: + aCond.append("top-elements("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::Bottom10: + aCond.append("bottom-elements("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::TopPercent: + aCond.append("top-percent("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::BottomPercent: + aCond.append("bottom-percent("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::AboveAverage: + aCond.append("above-average"); + break; + case ScConditionMode::BelowAverage: + aCond.append("below-average"); + break; + case ScConditionMode::AboveEqualAverage: + aCond.append("above-equal-average"); + break; + case ScConditionMode::BelowEqualAverage: + aCond.append("below-equal-average"); + break; + case ScConditionMode::Error: + aCond.append("is-error"); + break; + case ScConditionMode::NoError: + aCond.append("is-no-error"); + break; + case ScConditionMode::BeginsWith: + aCond.append("begins-with("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::EndsWith: + aCond.append("ends-with("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::ContainsText: + aCond.append("contains-text("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::NotContainsText: + aCond.append("not-contains-text("); + aCond.append(pEntry->GetExpression(aPos, 0, 0, formula::FormulaGrammar::GRAM_ODFF)); + aCond.append(")"); + break; + case ScConditionMode::NONE: + continue; + default: + SAL_WARN("sc", "unimplemented conditional format export"); + } + OUString sStyle = ScStyleNameConversion::DisplayToProgrammaticName(pEntry->GetStyle(), SfxStyleFamily::Para); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, sStyle); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, aCond.makeStringAndClear()); + + OUString sBaseAddress; + ScRangeStringConverter::GetStringFromAddress( sBaseAddress, aPos, pDoc,formula::FormulaGrammar::CONV_ODF ); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_BASE_CELL_ADDRESS, sBaseAddress); + SvXMLElementExport aElementCondEntry(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITION, true, true); + } + else if(pFormatEntry->GetType() == ScFormatEntry::Type::Colorscale) + { + SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, true, true); + const ScColorScaleFormat& rColorScale = static_cast<const ScColorScaleFormat&>(*pFormatEntry); + for(ScColorScaleEntries::const_iterator it = rColorScale.begin(); + it != rColorScale.end(); ++it) + { + if(it[0]->GetType() == COLORSCALE_FORMULA) { - SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, true, true); - const ScColorScaleFormat& rColorScale = static_cast<const ScColorScaleFormat&>(*pFormatEntry); - for(ScColorScaleEntries::const_iterator it = rColorScale.begin(); - it != rColorScale.end(); ++it) - { - if(it[0]->GetType() == COLORSCALE_FORMULA) - { - OUString sFormula = it[0]->GetFormula(formula::FormulaGrammar::GRAM_ODFF); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); - } - else - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(it[0]->GetValue())); - - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it[0])); - OUStringBuffer aBuffer; - ::sax::Converter::convertColor(aBuffer, it[0]->GetColor()); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_COLOR, aBuffer.makeStringAndClear()); - SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE_ENTRY, true, true); - } + OUString sFormula = it[0]->GetFormula(formula::FormulaGrammar::GRAM_ODFF); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); } - else if(pFormatEntry->GetType() == ScFormatEntry::Type::Databar) - { - const ScDataBarFormatData* pFormatData = static_cast<const ScDataBarFormat&>(*pFormatEntry).GetDataBarData(); - if(!pFormatData->mbGradient) - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_FALSE); - if(pFormatData->mbOnlyBar) - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_FALSE); + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(it[0]->GetValue())); - if (pFormatData->mnMinLength != 0.0) - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_MIN_LENGTH, OUString::number(pFormatData->mnMinLength)); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it[0])); + OUStringBuffer aBuffer; + ::sax::Converter::convertColor(aBuffer, it[0]->GetColor()); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_COLOR, aBuffer.makeStringAndClear()); + SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE_ENTRY, true, true); + } + } + else if(pFormatEntry->GetType() == ScFormatEntry::Type::Databar) + { + const ScDataBarFormatData* pFormatData = static_cast<const ScDataBarFormat&>(*pFormatEntry).GetDataBarData(); + if(!pFormatData->mbGradient) + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_FALSE); + if(pFormatData->mbOnlyBar) + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_FALSE); - if (pFormatData->mnMaxLength != 0.0) - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_MAX_LENGTH, OUString::number(pFormatData->mnMaxLength)); + if (pFormatData->mnMinLength != 0.0) + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_MIN_LENGTH, OUString::number(pFormatData->mnMinLength)); - if(pFormatData->mbNeg) - { - if(pFormatData->mpNegativeColor) - { - OUStringBuffer aBuffer; - ::sax::Converter::convertColor(aBuffer, *pFormatData->mpNegativeColor); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_NEGATIVE_COLOR, aBuffer.makeStringAndClear()); - } - else - { - OUStringBuffer aBuffer; - ::sax::Converter::convertColor(aBuffer, COL_LIGHTRED); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_NEGATIVE_COLOR, aBuffer.makeStringAndClear()); - } - } - - if(pFormatData->meAxisPosition != databar::AUTOMATIC) - { - if(pFormatData->meAxisPosition == databar::NONE) - { - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, OUString("none")); - } - else - { - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, OUString("middle")); - } - } + if (pFormatData->mnMaxLength != 0.0) + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_MAX_LENGTH, OUString::number(pFormatData->mnMaxLength)); + if(pFormatData->mbNeg) + { + if(pFormatData->mpNegativeColor) + { OUStringBuffer aBuffer; - ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear()); - - aBuffer.truncate(); - ::sax::Converter::convertColor(aBuffer, pFormatData->maAxisColor); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, aBuffer.makeStringAndClear()); - SvXMLElementExport aElementDataBar(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, true, true); - - { - if(pFormatData->mpLowerLimit->GetType() == COLORSCALE_FORMULA) - { - OUString sFormula = pFormatData->mpLowerLimit->GetFormula(formula::FormulaGrammar::GRAM_ODFF); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); - } - else - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(pFormatData->mpLowerLimit->GetValue())); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit)); - SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); - } + ::sax::Converter::convertColor(aBuffer, *pFormatData->mpNegativeColor); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_NEGATIVE_COLOR, aBuffer.makeStringAndClear()); + } + else + { + OUStringBuffer aBuffer; + ::sax::Converter::convertColor(aBuffer, COL_LIGHTRED); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_NEGATIVE_COLOR, aBuffer.makeStringAndClear()); + } + } - { - if(pFormatData->mpUpperLimit->GetType() == COLORSCALE_FORMULA) - { - OUString sFormula = pFormatData->mpUpperLimit->GetFormula(formula::FormulaGrammar::GRAM_ODFF); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); - } - else - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(pFormatData->mpUpperLimit->GetValue())); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit, false)); - SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); - } + if(pFormatData->meAxisPosition != databar::AUTOMATIC) + { + if(pFormatData->meAxisPosition == databar::NONE) + { + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, OUString("none")); } - else if(pFormatEntry->GetType() == ScFormatEntry::Type::Iconset) + else { - const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry); - OUString aIconSetName = OUString::createFromAscii(ScIconSetFormat::getIconSetName(rIconSet.GetIconSetData()->eIconSetType)); - AddAttribute( XML_NAMESPACE_CALC_EXT, XML_ICON_SET_TYPE, aIconSetName ); - if (rIconSet.GetIconSetData()->mbCustom) - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_CUSTOM, OUString::boolean(true)); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, OUString("middle")); + } + } - SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_ICON_SET, true, true); + OUStringBuffer aBuffer; + ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear()); - if (rIconSet.GetIconSetData()->mbCustom) - { - for (std::vector<std::pair<ScIconSetType, sal_Int32> >::const_iterator - it = rIconSet.GetIconSetData()->maCustomVector.begin(); - it != rIconSet.GetIconSetData()->maCustomVector.end(); ++it) - { - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_CUSTOM_ICONSET_NAME, OUString::createFromAscii(ScIconSetFormat::getIconSetName(it->first))); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_CUSTOM_ICONSET_INDEX, OUString::number(it->second)); - SvXMLElementExport aCustomIcon(*this, XML_NAMESPACE_CALC_EXT, XML_CUSTOM_ICONSET, true, true); - } + aBuffer.truncate(); + ::sax::Converter::convertColor(aBuffer, pFormatData->maAxisColor); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, aBuffer.makeStringAndClear()); + SvXMLElementExport aElementDataBar(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, true, true); - } + { + if(pFormatData->mpLowerLimit->GetType() == COLORSCALE_FORMULA) + { + OUString sFormula = pFormatData->mpLowerLimit->GetFormula(formula::FormulaGrammar::GRAM_ODFF); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); + } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(pFormatData->mpLowerLimit->GetValue())); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit)); + SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); + } - if(!rIconSet.GetIconSetData()->mbShowValue) - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_FALSE); - for (auto const& it : rIconSet) - { - if(it->GetType() == COLORSCALE_FORMULA) - { - OUString sFormula = it->GetFormula(formula::FormulaGrammar::GRAM_ODFF); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); - } - else - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(it->GetValue())); + { + if(pFormatData->mpUpperLimit->GetType() == COLORSCALE_FORMULA) + { + OUString sFormula = pFormatData->mpUpperLimit->GetFormula(formula::FormulaGrammar::GRAM_ODFF); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); + } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(pFormatData->mpUpperLimit->GetValue())); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit, false)); + SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); + } + } + else if(pFormatEntry->GetType() == ScFormatEntry::Type::Iconset) + { + const ScIconSetFormat& rIconSet = static_cast<const ScIconSetFormat&>(*pFormatEntry); + OUString aIconSetName = OUString::createFromAscii(ScIconSetFormat::getIconSetName(rIconSet.GetIconSetData()->eIconSetType)); + AddAttribute( XML_NAMESPACE_CALC_EXT, XML_ICON_SET_TYPE, aIconSetName ); + if (rIconSet.GetIconSetData()->mbCustom) + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_CUSTOM, OUString::boolean(true)); - AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it)); - SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); - } + SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_ICON_SET, true, true); + + if (rIconSet.GetIconSetData()->mbCustom) + { + for (std::vector<std::pair<ScIconSetType, sal_Int32> >::const_iterator + it = rIconSet.GetIconSetData()->maCustomVector.begin(); + it != rIconSet.GetIconSetData()->maCustomVector.end(); ++it) + { + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_CUSTOM_ICONSET_NAME, OUString::createFromAscii(ScIconSetFormat::getIconSetName(it->first))); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_CUSTOM_ICONSET_INDEX, OUString::number(it->second)); + SvXMLElementExport aCustomIcon(*this, XML_NAMESPACE_CALC_EXT, XML_CUSTOM_ICONSET, true, true); } - else if(pFormatEntry->GetType() == ScFormatEntry::Type::Date) + + } + + if(!rIconSet.GetIconSetData()->mbShowValue) + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_FALSE); + for (auto const& it : rIconSet) + { + if(it->GetType() == COLORSCALE_FORMULA) { - const ScCondDateFormatEntry& rDateFormat = static_cast<const ScCondDateFormatEntry&>(*pFormatEntry); - OUString aDateType = getDateStringForType(rDateFormat.GetDateType()); - OUString aStyleName = ScStyleNameConversion::DisplayToProgrammaticName(rDateFormat.GetStyleName(), SfxStyleFamily::Para ); - AddAttribute( XML_NAMESPACE_CALC_EXT, XML_STYLE, aStyleName); - AddAttribute( XML_NAMESPACE_CALC_EXT, XML_DATE, aDateType); - SvXMLElementExport aElementDateFormat(*this, XML_NAMESPACE_CALC_EXT, XML_DATE_IS, true, true); + OUString sFormula = it->GetFormula(formula::FormulaGrammar::GRAM_ODFF); + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula); } + else + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, OUString::number(it->GetValue())); + + AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it)); + SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, true, true); } } + else if(pFormatEntry->GetType() == ScFormatEntry::Type::Date) + { + const ScCondDateFormatEntry& rDateFormat = static_cast<const ScCondDateFormatEntry&>(*pFormatEntry); + OUString aDateType = getDateStringForType(rDateFormat.GetDateType()); + OUString aStyleName = ScStyleNameConversion::DisplayToProgrammaticName(rDateFormat.GetStyleName(), SfxStyleFamily::Para ); + AddAttribute( XML_NAMESPACE_CALC_EXT, XML_STYLE, aStyleName); + AddAttribute( XML_NAMESPACE_CALC_EXT, XML_DATE, aDateType); + SvXMLElementExport aElementDateFormat(*this, XML_NAMESPACE_CALC_EXT, XML_DATE_IS, true, true); + } } } } diff --git a/sdext/source/presenter/PresenterSpritePane.cxx b/sdext/source/presenter/PresenterSpritePane.cxx index a5ebf1fce252..2e568d64260f 100644 --- a/sdext/source/presenter/PresenterSpritePane.cxx +++ b/sdext/source/presenter/PresenterSpritePane.cxx @@ -141,10 +141,7 @@ void PresenterSpritePane::UpdateCanvases() { Reference<XComponent> xContentCanvasComponent (mxContentCanvas, UNO_QUERY); if (xContentCanvasComponent.is()) - { - if (xContentCanvasComponent.is()) - xContentCanvasComponent->dispose(); - } + xContentCanvasComponent->dispose(); // The border canvas is the content canvas of the sprite. mxBorderCanvas = mpSprite->GetCanvas(); diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 894496c38a5b..7e2d8f71b666 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -537,20 +537,17 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat( { if( bNeedsPreparation && xPrepareDispatch.is() ) { - if ( xPrepareDispatch.is() ) + try + { + css::uno::Sequence< css::beans::PropertyValue > aDispatchArgs; + xPrepareDispatch->dispatch( aPrepareURL, aDispatchArgs ); + } + catch ( css::uno::RuntimeException& ) + { + throw; + } + catch ( css::uno::Exception& ) { - try - { - css::uno::Sequence< css::beans::PropertyValue > aDispatchArgs; - xPrepareDispatch->dispatch( aPrepareURL, aDispatchArgs ); - } - catch ( css::uno::RuntimeException& ) - { - throw; - } - catch ( css::uno::Exception& ) - { - } } } diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index de3b42c70df3..2d00677ad01a 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1558,7 +1558,7 @@ bool SfxObjectShell::SaveTo_Impl bTryToPreserveScriptSignature = ( SotStorage::GetVersion( rMedium.GetStorage() ) == SOFFICE_FILEFORMAT_60 ); uno::Reference< security::XDocumentDigitalSignatures > xDDSigns; - if ( bOk && bTryToPreserveScriptSignature ) + if (bTryToPreserveScriptSignature) { // if the scripting code was not changed and it is signed the signature should be preserved // unfortunately at this point we have only information whether the basic code has changed or not |