[Libreoffice-commits] core.git: accessibility/source basic/source chart2/source cui/source editeng/source extensions/source filter/source i18npool/source jvmfwk/plugins reportdesign/source sc/source sd/source svgio/source svx/source sw/source vcl/source writerfilter/source xmloff/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Nov 10 11:24:04 UTC 2018
accessibility/source/standard/vclxaccessiblebox.cxx | 5
basic/source/runtime/runtime.cxx | 9
chart2/source/view/axes/Tickmarks_Equidistant.cxx | 7
chart2/source/view/axes/VCartesianAxis.cxx | 16
chart2/source/view/main/ShapeFactory.cxx | 9
cui/source/dialogs/srchxtra.cxx | 3
cui/source/tabpages/textanim.cxx | 155 +--
cui/source/tabpages/textattr.cxx | 37
editeng/source/misc/svxacorr.cxx | 92 -
editeng/source/uno/unoipset.cxx | 38
editeng/source/uno/unotext.cxx | 4
extensions/source/ole/unoconversionutilities.hxx | 5
extensions/source/propctrlr/stringrepresentation.cxx | 10
filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 35
i18npool/source/textconversion/textconversion_ko.cxx | 3
jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx | 3
reportdesign/source/core/api/ReportDefinition.cxx | 53 -
reportdesign/source/ui/report/propbrw.cxx | 7
sc/source/core/data/table2.cxx | 29
sc/source/filter/excel/xepivotxml.cxx | 6
sc/source/filter/excel/xestream.cxx | 14
sc/source/filter/qpro/qproform.cxx | 3
sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx | 108 +-
sc/source/filter/xml/xmlexprt.cxx | 11
sc/source/ui/app/transobj.cxx | 7
sc/source/ui/view/tabvwsh2.cxx | 17
sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 26
sd/source/ui/unoidl/unomodel.cxx | 15
sd/source/ui/unoidl/unopback.cxx | 21
sd/source/ui/unoidl/unosrch.cxx | 7
sd/source/ui/view/sdview3.cxx | 12
sd/source/ui/view/viewshel.cxx | 11
svgio/source/svgreader/svgsvgnode.cxx | 20
svx/source/accessibility/ShapeTypeHandler.cxx | 31
svx/source/svdraw/svddrgmt.cxx | 5
svx/source/svdraw/svdhdl.cxx | 6
svx/source/svdraw/svdpagv.cxx | 26
svx/source/table/svdotable.cxx | 82 -
svx/source/table/tablemodel.cxx | 4
svx/source/unodraw/unoshap3.cxx | 4
svx/source/unodraw/unoshtxt.cxx | 9
svx/source/xoutdev/xattr.cxx | 162 +--
svx/source/xoutdev/xattr2.cxx | 7
sw/source/core/attr/swatrset.cxx | 3
sw/source/core/undo/unins.cxx | 2
sw/source/core/unocore/unochart.cxx | 464 ++++------
sw/source/core/unocore/unodraw.cxx | 37
sw/source/core/unocore/unoport.cxx | 263 ++---
sw/source/core/unocore/unostyle.cxx | 6
sw/source/core/unocore/unotext.cxx | 3
sw/source/filter/ww8/wrtw8nds.cxx | 84 -
sw/source/filter/ww8/wrtw8sty.cxx | 6
sw/source/filter/ww8/wrtww8gr.cxx | 14
sw/source/filter/ww8/ww8atr.cxx | 73 -
sw/source/filter/ww8/ww8par2.cxx | 4
sw/source/filter/ww8/ww8par3.cxx | 51 -
sw/source/filter/ww8/ww8par6.cxx | 5
sw/source/filter/ww8/ww8scan.cxx | 28
sw/source/uibase/uiview/viewtab.cxx | 25
sw/source/uibase/uno/unotxdoc.cxx | 25
sw/source/uibase/utlui/uitool.cxx | 11
vcl/source/edit/texteng.cxx | 26
vcl/source/treelist/svimpbox.cxx | 84 -
vcl/source/treelist/treelistbox.cxx | 18
writerfilter/source/dmapper/PropertyMap.cxx | 7
writerfilter/source/rtftok/rtfdispatchflag.cxx | 2
writerfilter/source/rtftok/rtfsdrimport.cxx | 32
xmloff/source/style/xmlnumfe.cxx | 13
68 files changed, 1026 insertions(+), 1394 deletions(-)
New commits:
commit 065edb4c8e91170017df482843d0c3eb8d4db114
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue Nov 6 10:12:29 2018 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Nov 10 12:23:42 2018 +0100
tdf#120703 PVS: V547 Expression is always true/false
Change-Id: I0b3c407331bfa1fa0c5003250d327d4f26de3643
Reviewed-on: https://gerrit.libreoffice.org/63235
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index c43245428253..df87e4d7e350 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -411,10 +411,7 @@ OUString SAL_CALL VCLXAccessibleBox::getAccessibleActionDescription (sal_Int32 n
if (nIndex!=0 || !m_bIsDropDownBox)
throw css::lang::IndexOutOfBoundsException();
- if (m_bIsDropDownBox)
- return OUString(RID_STR_ACC_ACTION_TOGGLEPOPUP);
-
- return OUString();
+ return OUString(RID_STR_ACC_ACTION_TOGGLEPOPUP);
}
Reference< XAccessibleKeyBinding > VCLXAccessibleBox::getAccessibleActionKeyBinding( sal_Int32 nIndex )
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 69dae820aad8..c8131460accf 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -3219,12 +3219,9 @@ bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
}
else
{
- if ( !bVBAEnabled )
- {
- if( bRaiseErrors )
- Error( ERRCODE_BASIC_NEEDS_OBJECT );
- bOk = false;
- }
+ if( bRaiseErrors )
+ Error( ERRCODE_BASIC_NEEDS_OBJECT );
+ bOk = false;
}
return bOk;
}
diff --git a/chart2/source/view/axes/Tickmarks_Equidistant.cxx b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
index 7b319974bbb5..85a6a4915a3c 100644
--- a/chart2/source/view/axes/Tickmarks_Equidistant.cxx
+++ b/chart2/source/view/axes/Tickmarks_Equidistant.cxx
@@ -311,8 +311,8 @@ bool EquidistantTickFactory::isVisible( double fScaledValue ) const
void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) const
{
//create point sequences for each tick depth
- sal_Int32 nDepthCount = getTickDepth();
- sal_Int32 nMaxMajorTickCount = getMaxTickCount(0);
+ const sal_Int32 nDepthCount = getTickDepth();
+ const sal_Int32 nMaxMajorTickCount = getMaxTickCount(0);
if (nDepthCount <= 0 || nMaxMajorTickCount <= 0)
return;
@@ -333,8 +333,7 @@ void EquidistantTickFactory::getAllTicks( TickInfoArraysType& rAllTickInfos ) co
return;
aAllTicks[0].realloc(nRealMajorTickCount);
- if(nDepthCount>0)
- addSubTicks( 1, aAllTicks );
+ addSubTicks(1, aAllTicks);
//so far we have added all ticks between the outer major tick marks
//this was necessary to create sub ticks correctly
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index 85da43f53daf..0b488abaa5e1 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -1589,10 +1589,8 @@ void VCartesianAxis::createLabels()
if (!m_aAxisProperties.m_bDisplayLabels)
return;
- std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
+ std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
TickFactory2D* pTickFactory2D = apTickFactory2D.get();
- if( !pTickFactory2D )
- return;
//get the transformed screen values for all tickmarks in aAllTickInfos
pTickFactory2D->updateScreenValues( m_aAllTickInfos );
@@ -1644,10 +1642,8 @@ void VCartesianAxis::createMaximumLabels()
if (!m_aAxisProperties.m_bDisplayLabels)
return;
- std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
+ std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
TickFactory2D* pTickFactory2D = apTickFactory2D.get();
- if( !pTickFactory2D )
- return;
//get the transformed screen values for all tickmarks in aAllTickInfos
pTickFactory2D->updateScreenValues( m_aAllTickInfos );
@@ -1682,10 +1678,8 @@ void VCartesianAxis::updatePositions()
if (!m_aAxisProperties.m_bDisplayLabels)
return;
- std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
+ std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
TickFactory2D* pTickFactory2D = apTickFactory2D.get();
- if( !pTickFactory2D )
- return;
//update positions of all existing text shapes
pTickFactory2D->updateScreenValues( m_aAllTickInfos );
@@ -1778,10 +1772,8 @@ void VCartesianAxis::createShapes()
if( !prepareShapeCreation() )
return;
- std::unique_ptr< TickFactory2D > apTickFactory2D( createTickFactory2D() );
+ std::unique_ptr<TickFactory2D> apTickFactory2D(createTickFactory2D()); // throws on failure
TickFactory2D* pTickFactory2D = apTickFactory2D.get();
- if( !pTickFactory2D )
- return;
//create line shapes
if(m_nDimension==2)
diff --git a/chart2/source/view/main/ShapeFactory.cxx b/chart2/source/view/main/ShapeFactory.cxx
index e9a9e6d5df11..548ecef28ccf 100644
--- a/chart2/source/view/main/ShapeFactory.cxx
+++ b/chart2/source/view/main/ShapeFactory.cxx
@@ -2517,14 +2517,7 @@ uno::Reference< drawing::XShape >
ShapeFactory* ShapeFactory::getOrCreateShapeFactory(const uno::Reference< lang::XMultiServiceFactory>& xFactory)
{
- static ShapeFactory* pShapeFactory = nullptr;
-
- if (pShapeFactory)
- return pShapeFactory;
-
- if (!pShapeFactory)
- pShapeFactory = new ShapeFactory(xFactory);
-
+ static ShapeFactory* pShapeFactory = new ShapeFactory(xFactory);
return pShapeFactory;
}
diff --git a/cui/source/dialogs/srchxtra.cxx b/cui/source/dialogs/srchxtra.cxx
index 08a403dd063d..a63691256f19 100644
--- a/cui/source/dialogs/srchxtra.cxx
+++ b/cui/source/dialogs/srchxtra.cxx
@@ -82,8 +82,7 @@ void SvxSearchFormatDialog::PageCreated(const OString& rId, SfxTabPage& rPage)
pList = m_pFontList.get();
}
- if ( pList )
- static_cast<SvxCharNamePage&>(rPage).
+ static_cast<SvxCharNamePage&>(rPage).
SetFontList( SvxFontListItem( pList, SID_ATTR_CHAR_FONTLIST ) );
static_cast<SvxCharNamePage&>(rPage).EnableSearchMode();
}
diff --git a/cui/source/tabpages/textanim.cxx b/cui/source/tabpages/textanim.cxx
index d5e27cfc2113..7a73a7d91ead 100644
--- a/cui/source/tabpages/textanim.cxx
+++ b/cui/source/tabpages/textanim.cxx
@@ -143,31 +143,17 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIKIND );
- if( pItem )
- {
- eAniKind = static_cast<const SdrTextAniKindItem*>(pItem)->GetValue();
- m_xLbEffect->set_active( sal::static_int_cast< sal_Int32 >(eAniKind) );
- }
- else
- m_xLbEffect->set_active(-1);
+
+ eAniKind = static_cast<const SdrTextAniKindItem*>(pItem)->GetValue();
+ m_xLbEffect->set_active(sal::static_int_cast<sal_Int32>(eAniKind));
m_xLbEffect->save_value();
// animation direction
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIDIRECTION );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDIRECTION );
- if( pItem )
- {
- SdrTextAniDirection eValue = static_cast<const SdrTextAniDirectionItem*>(pItem)->GetValue();
- SelectDirection( eValue );
- }
- else
- {
- m_xBtnUp->set_active( false );
- m_xBtnLeft->set_active( false );
- m_xBtnRight->set_active( false );
- m_xBtnDown->set_active( false );
- }
+
+ SelectDirection(static_cast<const SdrTextAniDirectionItem*>(pItem)->GetValue());
m_aUpState = m_xBtnUp->get_state();
m_aLeftState = m_xBtnLeft->get_state();
m_aRightState = m_xBtnRight->get_state();
@@ -177,66 +163,46 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANISTARTINSIDE );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTARTINSIDE );
- if( pItem )
- {
- m_xTsbStartInside->set_inconsistent(false);
- bool bValue = static_cast<const SdrTextAniStartInsideItem*>(pItem)->GetValue();
- if( bValue )
- m_xTsbStartInside->set_state( TRISTATE_TRUE );
- else
- m_xTsbStartInside->set_state( TRISTATE_FALSE );
- }
+
+ if (static_cast<const SdrTextAniStartInsideItem*>(pItem)->GetValue())
+ m_xTsbStartInside->set_state(TRISTATE_TRUE);
else
- m_xTsbStartInside->set_state( TRISTATE_INDET );
+ m_xTsbStartInside->set_state(TRISTATE_FALSE);
m_xTsbStartInside->save_state();
// Stop inside
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANISTOPINSIDE );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANISTOPINSIDE );
- if( pItem )
- {
- m_xTsbStopInside->set_inconsistent(false);
- bool bValue = static_cast<const SdrTextAniStopInsideItem*>(pItem)->GetValue();
- if( bValue )
- m_xTsbStopInside->set_state( TRISTATE_TRUE );
- else
- m_xTsbStopInside->set_state( TRISTATE_FALSE );
- }
+
+ if (static_cast<const SdrTextAniStopInsideItem*>(pItem)->GetValue())
+ m_xTsbStopInside->set_state(TRISTATE_TRUE);
else
- m_xTsbStopInside->set_state( TRISTATE_INDET );
+ m_xTsbStopInside->set_state(TRISTATE_FALSE);
m_xTsbStopInside->save_state();
// quantity
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANICOUNT );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANICOUNT );
- if( pItem )
+
+ long nValue = static_cast<long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
+ m_xNumFldCount->set_value(nValue);
+ if (nValue == 0)
{
- m_xTsbEndless->set_inconsistent(false);
- long nValue = static_cast<long>(static_cast<const SdrTextAniCountItem*>(pItem)->GetValue());
- m_xNumFldCount->set_value(nValue);
- if( nValue == 0 )
+ if (eAniKind == SdrTextAniKind::Slide)
{
- if( eAniKind == SdrTextAniKind::Slide )
- {
- m_xTsbEndless->set_state( TRISTATE_FALSE );
- m_xTsbEndless->set_sensitive(false);
- }
- else
- {
- m_xTsbEndless->set_state( TRISTATE_TRUE );
- m_xNumFldCount->set_text("");
- }
+ m_xTsbEndless->set_state(TRISTATE_FALSE);
+ m_xTsbEndless->set_sensitive(false);
}
else
- m_xTsbEndless->set_state( TRISTATE_FALSE );
+ {
+ m_xTsbEndless->set_state(TRISTATE_TRUE);
+ m_xNumFldCount->set_text("");
+ }
}
else
- {
- m_xNumFldCount->set_text("");
- m_xTsbEndless->set_state( TRISTATE_INDET );
- }
+ m_xTsbEndless->set_state(TRISTATE_FALSE);
m_xTsbEndless->save_state();
m_xNumFldCount->save_value();
@@ -244,24 +210,16 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIDELAY );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIDELAY );
- if( pItem )
- {
- m_xTsbAuto->set_inconsistent(false);
- long nValue = static_cast<long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
- m_xMtrFldDelay->set_value(nValue, FieldUnit::NONE);
- if( nValue == 0 )
- {
- m_xTsbAuto->set_state( TRISTATE_TRUE );
- m_xMtrFldDelay->set_text("");
- }
- else
- m_xTsbAuto->set_state( TRISTATE_FALSE );
- }
- else
+
+ nValue = static_cast<long>(static_cast<const SdrTextAniDelayItem*>(pItem)->GetValue());
+ m_xMtrFldDelay->set_value(nValue, FieldUnit::NONE);
+ if (nValue == 0)
{
+ m_xTsbAuto->set_state(TRISTATE_TRUE);
m_xMtrFldDelay->set_text("");
- m_xTsbAuto->set_state( TRISTATE_INDET );
}
+ else
+ m_xTsbAuto->set_state(TRISTATE_FALSE);
m_xTsbAuto->save_state();
m_xMtrFldDelay->save_value();
@@ -269,40 +227,31 @@ void SvxTextAnimationPage::Reset( const SfxItemSet* rAttrs )
pItem = GetItem( *rAttrs, SDRATTR_TEXT_ANIAMOUNT );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_ANIAMOUNT );
- if( pItem )
- {
- m_xTsbPixel->set_inconsistent(false);
- long nValue = static_cast<long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
- if( nValue <= 0 )
- {
- m_xTsbPixel->set_state( TRISTATE_TRUE );
- nValue = -nValue;
- if( nValue == 0 )
- nValue++;
- m_xMtrFldAmount->set_unit( FieldUnit::CUSTOM );
- m_xMtrFldAmount->set_digits(0);
-
- m_xMtrFldAmount->set_increments(1, 10, FieldUnit::NONE);
- m_xMtrFldAmount->set_range(1, 100, FieldUnit::NONE);
- m_xMtrFldAmount->set_value(nValue, FieldUnit::NONE);
- }
- else
- {
- m_xTsbPixel->set_state( TRISTATE_FALSE );
- m_xMtrFldAmount->set_unit( eFUnit );
- m_xMtrFldAmount->set_digits(2);
- m_xMtrFldAmount->set_increments(10, 100, FieldUnit::NONE);
- m_xMtrFldAmount->set_range(1, 10000, FieldUnit::NONE);
+ nValue = static_cast<long>(static_cast<const SdrTextAniAmountItem*>(pItem)->GetValue());
+ if (nValue <= 0)
+ {
+ m_xTsbPixel->set_state(TRISTATE_TRUE);
+ nValue = -nValue;
+ if (nValue == 0)
+ nValue++;
+ m_xMtrFldAmount->set_unit(FieldUnit::CUSTOM);
+ m_xMtrFldAmount->set_digits(0);
- SetMetricValue( *m_xMtrFldAmount, nValue, eUnit );
- }
+ m_xMtrFldAmount->set_increments(1, 10, FieldUnit::NONE);
+ m_xMtrFldAmount->set_range(1, 100, FieldUnit::NONE);
+ m_xMtrFldAmount->set_value(nValue, FieldUnit::NONE);
}
else
{
- m_xMtrFldAmount->set_sensitive(false);
- m_xMtrFldAmount->set_text("");
- m_xTsbPixel->set_state( TRISTATE_INDET );
+ m_xTsbPixel->set_state(TRISTATE_FALSE);
+ m_xMtrFldAmount->set_unit(eFUnit);
+ m_xMtrFldAmount->set_digits(2);
+
+ m_xMtrFldAmount->set_increments(10, 100, FieldUnit::NONE);
+ m_xMtrFldAmount->set_range(1, 10000, FieldUnit::NONE);
+
+ SetMetricValue(*m_xMtrFldAmount, nValue, eUnit);
}
m_xTsbPixel->save_state();
m_xMtrFldAmount->save_value();
diff --git a/cui/source/tabpages/textattr.cxx b/cui/source/tabpages/textattr.cxx
index b80cfd38fd7c..0a6d3696ebc0 100644
--- a/cui/source/tabpages/textattr.cxx
+++ b/cui/source/tabpages/textattr.cxx
@@ -116,52 +116,31 @@ void SvxTextAttrPage::Reset( const SfxItemSet* rAttrs )
MapUnit eUnit = pPool->GetMetric( SDRATTR_TEXT_LEFTDIST );
const SfxPoolItem* pItem = GetItem( *rAttrs, SDRATTR_TEXT_LEFTDIST );
-
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LEFTDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue( *m_xMtrFldLeft, nValue, eUnit );
- }
- else
- m_xMtrFldLeft->set_text("");
+
+ SetMetricValue(*m_xMtrFldLeft, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldLeft->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_RIGHTDIST );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_RIGHTDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue( *m_xMtrFldRight, nValue, eUnit );
- }
- else
- m_xMtrFldRight->set_text("");
+
+ SetMetricValue(*m_xMtrFldRight, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldRight->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_UPPERDIST );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_UPPERDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>( pItem )->GetValue();
- SetMetricValue( *m_xMtrFldTop, nValue, eUnit );
- }
- else
- m_xMtrFldTop->set_text("");
+
+ SetMetricValue(*m_xMtrFldTop, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldTop->save_value();
pItem = GetItem( *rAttrs, SDRATTR_TEXT_LOWERDIST );
if( !pItem )
pItem = &pPool->GetDefaultItem( SDRATTR_TEXT_LOWERDIST );
- if( pItem )
- {
- long nValue = static_cast<const SdrMetricItem*>(pItem)->GetValue();
- SetMetricValue( *m_xMtrFldBottom, nValue, eUnit );
- }
- else
- m_xMtrFldBottom->set_text("");
+
+ SetMetricValue(*m_xMtrFldBottom, static_cast<const SdrMetricItem*>(pItem)->GetValue(), eUnit);
m_xMtrFldBottom->save_value();
// adjust to height and autogrowsize
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index ab2ba01378db..f84fba00dfff 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -932,65 +932,63 @@ void SvxAutoCorrect::FnCapitalStartSentence( SvxAutoCorrDoc& rDoc,
// Found [ \t]+[A-Z0-9]+ until here. Test now on the paragraph separator.
// all three can happen, but not more than once!
const sal_Unicode* pExceptStt = nullptr;
- if( !bAtStart )
+ bool bContinue = true;
+ Flags nFlag = Flags::NONE;
+ do
{
- bool bContinue = true;
- Flags nFlag = Flags::NONE;
- do {
- switch( *pStr )
- {
+ switch (*pStr)
+ {
// Western and Asian full stop
case '.':
- case 0x3002 :
- case 0xFF0E :
+ case 0x3002:
+ case 0xFF0E:
+ {
+ if (pStr >= pStart + 2 && *(pStr - 2) == '.')
{
- if (pStr >= pStart + 2 && *(pStr-2) == '.')
- {
- //e.g. text "f.o.o. word": Now currently considering
- //capitalizing word but second last character of
- //previous word is a . So probably last word is an
- //anagram that ends in . and not truly the end of a
- //previous sentence, so don't autocapitalize this word
- return;
- }
- if( nFlag & Flags::FullStop )
- return; // no valid separator -> no replacement
- nFlag |= Flags::FullStop;
- pExceptStt = pStr;
+ //e.g. text "f.o.o. word": Now currently considering
+ //capitalizing word but second last character of
+ //previous word is a . So probably last word is an
+ //anagram that ends in . and not truly the end of a
+ //previous sentence, so don't autocapitalize this word
+ return;
}
- break;
+ if (nFlag & Flags::FullStop)
+ return; // no valid separator -> no replacement
+ nFlag |= Flags::FullStop;
+ pExceptStt = pStr;
+ }
+ break;
case '!':
- case 0xFF01 :
- {
- if( nFlag & Flags::ExclamationMark )
- return; // no valid separator -> no replacement
- nFlag |= Flags::ExclamationMark;
- }
- break;
+ case 0xFF01:
+ {
+ if (nFlag & Flags::ExclamationMark)
+ return; // no valid separator -> no replacement
+ nFlag |= Flags::ExclamationMark;
+ }
+ break;
case '?':
- case 0xFF1F :
- {
- if( nFlag & Flags::QuestionMark)
- return; // no valid separator -> no replacement
- nFlag |= Flags::QuestionMark;
- }
- break;
+ case 0xFF1F:
+ {
+ if (nFlag & Flags::QuestionMark)
+ return; // no valid separator -> no replacement
+ nFlag |= Flags::QuestionMark;
+ }
+ break;
default:
- if( nFlag == Flags::NONE )
- return; // no valid separator -> no replacement
+ if (nFlag == Flags::NONE)
+ return; // no valid separator -> no replacement
else
bContinue = false;
break;
- }
+ }
- if( bContinue && pStr-- == pStart )
- {
- return; // no valid separator -> no replacement
- }
- } while( bContinue );
- if( Flags::FullStop != nFlag )
- pExceptStt = nullptr;
- }
+ if (bContinue && pStr-- == pStart)
+ {
+ return; // no valid separator -> no replacement
+ }
+ } while (bContinue);
+ if (Flags::FullStop != nFlag)
+ pExceptStt = nullptr;
if( 2 > ( pStr - pStart ) )
return;
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 71afb18871e3..27281c3ade9b 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -157,32 +157,28 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa
pItem = &pPool->GetDefaultItem( pMap->nWID );
}
- DBG_ASSERT( pItem, "Got no default for item!" );
- if( pItem )
- {
- uno::Any aValue( rVal );
+ uno::Any aValue(rVal);
- const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM;
+ const MapUnit eMapUnit = pPool ? pPool->GetMetric(pMap->nWID) : MapUnit::Map100thMM;
- // check for needed metric translation
- if( (pMap->nMoreFlags & PropertyMoreFlags::METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM )
- {
- if ( !bDontConvertNegativeValues || SvxUnoCheckForPositiveValue( aValue ) )
- SvxUnoConvertFromMM( eMapUnit, aValue );
- }
+ // check for needed metric translation
+ if ((pMap->nMoreFlags & PropertyMoreFlags::METRIC_ITEM) && eMapUnit != MapUnit::Map100thMM)
+ {
+ if (!bDontConvertNegativeValues || SvxUnoCheckForPositiveValue(aValue))
+ SvxUnoConvertFromMM(eMapUnit, aValue);
+ }
- std::unique_ptr<SfxPoolItem> pNewItem( pItem->Clone() );
+ std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
- sal_uInt8 nMemberId = pMap->nMemberId;
- if( eMapUnit == MapUnit::Map100thMM )
- nMemberId &= (~CONVERT_TWIPS);
+ sal_uInt8 nMemberId = pMap->nMemberId;
+ if (eMapUnit == MapUnit::Map100thMM)
+ nMemberId &= (~CONVERT_TWIPS);
- if( pNewItem->PutValue( aValue, nMemberId ) )
- {
- // Set new item in item set
- pNewItem->SetWhich( pMap->nWID );
- rSet.Put( *pNewItem );
- }
+ if (pNewItem->PutValue(aValue, nMemberId))
+ {
+ // Set new item in item set
+ pNewItem->SetWhich(pMap->nWID);
+ rSet.Put(*pNewItem);
}
}
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index f1b48747669b..68858043cca3 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1124,7 +1124,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf
}
if( bUnknownPropertyFound )
- return !bUnknownPropertyFound;
+ return false;
if( nWID != 0 )
eItemState = pSet->GetItemState( nWID, false );
@@ -1145,7 +1145,7 @@ bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const Sf
rState = beans::PropertyState_AMBIGUOUS_VALUE;
}
}
- return !bUnknownPropertyFound;
+ return true;
}
void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
diff --git a/extensions/source/ole/unoconversionutilities.hxx b/extensions/source/ole/unoconversionutilities.hxx
index f04466efe73c..ec8c46d80016 100644
--- a/extensions/source/ole/unoconversionutilities.hxx
+++ b/extensions/source/ole/unoconversionutilities.hxx
@@ -1927,7 +1927,6 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
{
try
{
- bool bFail = false;
if( pvar->vt != VT_DISPATCH)
throw BridgeRuntimeError("[automation bridge] UnoConversionUtilities<T>::dispatchExObject2Sequence \n"
"Conversion of dispatch object to Sequence failed!");
@@ -2038,10 +2037,6 @@ void UnoConversionUtilities<T>::dispatchExObject2Sequence( const VARIANTARG* pva
anySeq.setValue( &p_uno_Seq, pDesc);
uno_destructData( &p_uno_Seq, pDesc, cpp_release);
typelib_typedescription_release( pDesc);
-
- if (bFail)
- throw BridgeRuntimeError(
- "[automation bridge] Conversion of ValueObject failed ");
}
catch (const BridgeRuntimeError &)
{
diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx
index bdca73fe13fc..b28df28c0e0e 100644
--- a/extensions/source/propctrlr/stringrepresentation.cxx
+++ b/extensions/source/propctrlr/stringrepresentation.cxx
@@ -338,14 +338,12 @@ namespace
// loop through the elements and concatenate the string representations of the integers
// (separated by a line break)
- const ElementType* pElements = _rElements.getConstArray();
- const ElementType* pElementsEnd = pElements + _rElements.getLength();
- for ( ; pElements != pElementsEnd; ++pElements )
+ for (const auto& rElement : _rElements)
{
- sCompose.append( OUString( _rTransformer( *pElements ) ) );
- if ( pElements != pElementsEnd )
- sCompose.append("\n");
+ sCompose.append(OUString(_rTransformer(rElement)));
+ sCompose.append("\n");
}
+ sCompose.stripEnd('\n');
return sCompose.makeStringAndClear();
}
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 7617eafeef1f..fb91a7b09d17 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -650,33 +650,30 @@ bool XMLFilterSettingsDialog::insertOrEdit( filter_info_impl* pNewInfo, const fi
bOk = false;
}
}
- else
+ else // bOk
{
- if( bOk )
+ try
+ {
+ Reference< XFlushable > xFlushable( mxFilterContainer, UNO_QUERY );
+ if( xFlushable.is() )
+ xFlushable->flush();
+ }
+ catch( const Exception& )
+ {
+ OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception caught!" );
+ bOk = false;
+ }
+
+ if( !bOk )
{
+ // we failed to add the filter, so lets remove the type
try
{
- Reference< XFlushable > xFlushable( mxFilterContainer, UNO_QUERY );
- if( xFlushable.is() )
- xFlushable->flush();
+ mxTypeDetection->removeByName( pFilterEntry->maType );
}
catch( const Exception& )
{
OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception caught!" );
- bOk = false;
- }
-
- if( !bOk )
- {
- // we failed to add the filter, so lets remove the type
- try
- {
- mxTypeDetection->removeByName( pFilterEntry->maType );
- }
- catch( const Exception& )
- {
- OSL_FAIL( "XMLFilterSettingsDialog::insertOrEdit exception caught!" );
- }
}
}
diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx
index f09aa509e909..0e0a9bdcd6fa 100644
--- a/i18npool/source/textconversion/textconversion_ko.cxx
+++ b/i18npool/source/textconversion/textconversion_ko.cxx
@@ -325,8 +325,7 @@ TextConversion_ko::getConversion( const OUString& aText, sal_Int32 nStartPos, sa
aBuf.append(str + start, result.Boundary.startPos - start); // append skip portion
aBuf.append(result.Candidates[0]); // append converted portion
} else {
- if (length + nStartPos > start)
- aBuf.append(str + start, length + nStartPos - start); // append last portion
+ aBuf.append(str + start, length + nStartPos - start); // append last portion
break;
}
}
diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
index a9d84556e158..7711a9e79907 100644
--- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
+++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx
@@ -79,8 +79,7 @@ bool SunVersion::init(const char *szVersion)
{
if (pCur < pEnd && rtl::isAsciiDigit(static_cast<unsigned char>(*pCur)))
{
- if (pCur < pEnd)
- pCur ++;
+ pCur ++;
nPartPos ++;
}
//if correct separator then form integer
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index 3469fda997fa..c048d2ecb8b4 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1299,8 +1299,6 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
uno::Sequence < beans::PropertyValue > aProps;
// export sub streams for package, else full stream into a file
- bool bErr = false;
-
uno::Reference< beans::XPropertySet> xProp(_xStorageToSaveTo,uno::UNO_QUERY);
if ( xProp.is() )
{
@@ -1349,44 +1347,23 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
aDelegatorArguments[nArgsLen++] <<= xObjectResolver;
uno::Reference<XComponent> xCom(static_cast<OWeakObject*>(this),uno::UNO_QUERY);
- if( !bErr )
- {
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
- WriteThroughComponent(
- xCom, "settings.xml",
- "com.sun.star.comp.report.XMLSettingsExporter",
- aDelegatorArguments, aProps, _xStorageToSaveTo );
- }
+ // Try to write to settings.xml, meta.xml, and styles.xml; only really care about success of
+ // write to content.xml (keeping logic of commit 94ccba3eebc83b58e74e18f0e028c6a995ce6aa6)
+ xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("settings.xml")));
+ WriteThroughComponent(xCom, "settings.xml", "com.sun.star.comp.report.XMLSettingsExporter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
- if( !bErr )
- {
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("meta.xml")));
- WriteThroughComponent(
- xCom, "meta.xml",
- "com.sun.star.comp.report.XMLMetaExporter",
- aDelegatorArguments, aProps, _xStorageToSaveTo );
- }
+ xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("meta.xml")));
+ WriteThroughComponent(xCom, "meta.xml", "com.sun.star.comp.report.XMLMetaExporter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
- if( !bErr )
- {
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("styles.xml")));
- WriteThroughComponent(
- xCom, "styles.xml",
- "com.sun.star.comp.report.XMLStylesExporter",
- aDelegatorArguments, aProps, _xStorageToSaveTo );
- }
+ xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("styles.xml")));
+ WriteThroughComponent(xCom, "styles.xml", "com.sun.star.comp.report.XMLStylesExporter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
- if ( !bErr )
- {
- xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
- if( !WriteThroughComponent(
- xCom, "content.xml",
- "com.sun.star.comp.report.ExportFilter",
- aDelegatorArguments, aProps, _xStorageToSaveTo ) )
- {
- bErr = true;
- }
- }
+ xInfoSet->setPropertyValue("StreamName", uno::makeAny(OUString("content.xml")));
+ bool bOk = WriteThroughComponent(xCom, "content.xml", "com.sun.star.comp.report.ExportFilter",
+ aDelegatorArguments, aProps, _xStorageToSaveTo);
uno::Any aImage;
uno::Reference< embed::XVisualObject > xCurrentController(getCurrentController(),uno::UNO_QUERY);
@@ -1403,7 +1380,7 @@ void SAL_CALL OReportDefinition::storeToStorage( const uno::Reference< embed::XS
m_pImpl->m_pObjectContainer->InsertGraphicStreamDirectly(xStream, "report", "image/png");
}
- if ( !bErr )
+ if (bOk)
{
bool bPersist = false;
if ( _xStorageToSaveTo == m_pImpl->m_xStorage )
diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx
index 008792b2cb3f..a50d13d7a8db 100644
--- a/reportdesign/source/ui/report/propbrw.cxx
+++ b/reportdesign/source/ui/report/propbrw.cxx
@@ -340,7 +340,7 @@ OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterfac
Reference< lang::XServiceInfo > xServiceInfo( xNameCont->getByName("ReportComponent"), UNO_QUERY );
if ( xServiceInfo.is() )
{
- const char* pResId = nullptr;
+ const char* pResId;
if ( xServiceInfo->supportsService( SERVICE_FIXEDTEXT ) )
{
pResId = RID_STR_PROPTITLE_FIXEDTEXT;
@@ -384,10 +384,7 @@ OUString PropBrw::GetHeadlineName( const uno::Sequence< Reference<uno::XInterfac
return aName;
}
- if (pResId)
- {
- aName += RptResId(pResId);
- }
+ aName += RptResId(pResId);
}
}
else // multiselection
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 41cf8caf0d18..6608876a6ff4 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2932,30 +2932,19 @@ bool ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNew
bSingle = false; // no difference in this range
}
}
- if (bSingle)
- {
- if (nEndRow-nStartRow < 20)
- {
- if (!bChanged)
- bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);
- mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
- }
- else
- {
- SCROW nMid = (nStartRow+nEndRow) / 2;
- if (SetRowHeightRange( nStartRow, nMid, nNewHeight, 1.0 ))
- bChanged = true;
- if (SetRowHeightRange( nMid+1, nEndRow, nNewHeight, 1.0 ))
- bChanged = true;
- }
+ if (!bSingle || nEndRow - nStartRow < 20)
+ {
+ bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);
+ mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
}
else
{
- if (!bChanged)
- bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);
-
- mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
+ SCROW nMid = (nStartRow + nEndRow) / 2;
+ if (SetRowHeightRange(nStartRow, nMid, nNewHeight, 1.0))
+ bChanged = true;
+ if (SetRowHeightRange(nMid + 1, nEndRow, nNewHeight, 1.0))
+ bChanged = true;
}
if (bChanged)
diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx
index 9a3953ae0ab3..b7e790eca6da 100644
--- a/sc/source/filter/excel/xepivotxml.cxx
+++ b/sc/source/filter/excel/xepivotxml.cxx
@@ -286,7 +286,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList();
// TODO In same cases, disable listing of items, as it is done in MS Excel.
// Exporting savePivotCacheRecordsXml method needs to be updated accordingly
- bool bListItems = true;
+ //bool bListItems = true;
std::set<ScDPItemData::Type> aDPTypesWithoutBlank = aDPTypes;
aDPTypesWithoutBlank.erase(ScDPItemData::Empty);
@@ -352,7 +352,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
pAttList->add(XML_maxDate, XclXmlUtils::ToOString(GetExcelFormattedDate(fMax, GetFormatter())));
}
- if (bListItems)
+ //if (bListItems) // see TODO above
{
pAttList->add(XML_count, OString::number(static_cast<long>(rFieldItems.size())));
}
@@ -360,7 +360,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr
pDefStrm->startElement(XML_sharedItems, xAttributeList);
- if (bListItems)
+ //if (bListItems) // see TODO above
{
it = rFieldItems.begin();
for (; it != itEnd; ++it)
diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx
index b70086e9f364..46bf1536ebb6 100644
--- a/sc/source/filter/excel/xestream.cxx
+++ b/sc/source/filter/excel/xestream.cxx
@@ -890,15 +890,15 @@ sax_fastparser::FSHelperPtr XclXmlUtils::WriteFontData( sax_fastparser::FSHelper
const char* pUnderline = lcl_GetUnderlineStyle( rFontData.GetScUnderline(), bHaveUnderline );
const char* pVertAlign = lcl_ToVerticalAlignmentRun( rFontData.GetScEscapement(), bHaveVertAlign );
- lcl_WriteValue( pStream, XML_b, rFontData.mnWeight > 400 ? ToPsz( rFontData.mnWeight > 400 ) : nullptr );
- lcl_WriteValue( pStream, XML_i, rFontData.mbItalic ? ToPsz( rFontData.mbItalic ) : nullptr );
- lcl_WriteValue( pStream, XML_strike, rFontData.mbStrikeout ? ToPsz( rFontData.mbStrikeout ) : nullptr );
+ lcl_WriteValue( pStream, XML_b, rFontData.mnWeight > 400 ? ToPsz( true ) : nullptr );
+ lcl_WriteValue( pStream, XML_i, rFontData.mbItalic ? ToPsz( true ) : nullptr );
+ lcl_WriteValue( pStream, XML_strike, rFontData.mbStrikeout ? ToPsz( true ) : nullptr );
// OOXTODO: lcl_WriteValue( rStream, XML_condense, ); // mac compatibility setting
// OOXTODO: lcl_WriteValue( rStream, XML_extend, ); // compatibility setting
- lcl_WriteValue( pStream, XML_outline, rFontData.mbOutline ? ToPsz( rFontData.mbOutline ) : nullptr );
- lcl_WriteValue( pStream, XML_shadow, rFontData.mbShadow ? ToPsz( rFontData.mbShadow ) : nullptr );
- lcl_WriteValue( pStream, XML_u, bHaveUnderline ? pUnderline : nullptr );
- lcl_WriteValue( pStream, XML_vertAlign, bHaveVertAlign ? pVertAlign : nullptr );
+ lcl_WriteValue( pStream, XML_outline, rFontData.mbOutline ? ToPsz( true ) : nullptr );
+ lcl_WriteValue( pStream, XML_shadow, rFontData.mbShadow ? ToPsz( true ) : nullptr );
+ lcl_WriteValue( pStream, XML_u, bHaveUnderline ? pUnderline : nullptr );
+ lcl_WriteValue( pStream, XML_vertAlign, bHaveVertAlign ? pVertAlign : nullptr );
lcl_WriteValue( pStream, XML_sz, OString::number( rFontData.mnHeight / 20.0 ).getStr() ); // Twips->Pt
if( rFontData.maColor != Color( 0xFF, 0xFF, 0xFF, 0xFF ) )
pStream->singleElement( XML_color,
diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx
index 14c84e8510b9..73a51c2db404 100644
--- a/sc/source/filter/qpro/qproform.cxx
+++ b/sc/source/filter/qpro/qproform.cxx
@@ -158,8 +158,7 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr
aPool << eParam[ nLast ];
for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- )
{
- if( nCount != -1 )
- aPool << ocSep << eParam[ nCount ];
+ aPool << ocSep << eParam[ nCount ];
}
}
diff --git a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
index c9844926688f..49e7b5850a74 100644
--- a/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
+++ b/sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx
@@ -659,73 +659,71 @@ void ScXMLChangeTrackingImportHelper::SetNewCell(const ScMyContentAction* pActio
ScChangeAction* pChangeAction = pTrack->GetAction(pAction->nActionNumber);
if (pChangeAction)
{
+ assert(dynamic_cast<ScChangeActionContent*>(pChangeAction));
ScChangeActionContent* pChangeActionContent = static_cast<ScChangeActionContent*>(pChangeAction);
- if (pChangeActionContent)
+ if (pChangeActionContent->IsTopContent() && !pChangeActionContent->IsDeletedIn())
{
- if (pChangeActionContent->IsTopContent() && !pChangeActionContent->IsDeletedIn())
+ sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
+ pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2);
+ if ((nCol >= 0) && (nCol <= MAXCOL) &&
+ (nRow >= 0) && (nRow <= MAXROW) &&
+ (nTab >= 0) && (nTab <= MAXTAB))
{
- sal_Int32 nCol, nRow, nTab, nCol2, nRow2, nTab2;
- pAction->aBigRange.GetVars(nCol, nRow, nTab, nCol2, nRow2, nTab2);
- if ((nCol >= 0) && (nCol <= MAXCOL) &&
- (nRow >= 0) && (nRow <= MAXROW) &&
- (nTab >= 0) && (nTab <= MAXTAB))
+ ScAddress aAddress (static_cast<SCCOL>(nCol),
+ static_cast<SCROW>(nRow),
+ static_cast<SCTAB>(nTab));
+ ScCellValue aCell;
+ aCell.assign(*pDoc, aAddress);
+ if (!aCell.isEmpty())
{
- ScAddress aAddress (static_cast<SCCOL>(nCol),
- static_cast<SCROW>(nRow),
- static_cast<SCTAB>(nTab));
- ScCellValue aCell;
- aCell.assign(*pDoc, aAddress);
- if (!aCell.isEmpty())
+ ScCellValue aNewCell;
+ if (aCell.meType != CELLTYPE_FORMULA)
+ {
+ aNewCell = aCell;
+ pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
+ pChangeActionContent->SetNewValue(aCell, pDoc);
+ }
+ else
{
- ScCellValue aNewCell;
- if (aCell.meType != CELLTYPE_FORMULA)
+ ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
+ OUString sFormula;
+ // With GRAM_ODFF reference detection is faster on compilation.
+ /* FIXME: new cell should be created with a clone
+ * of the token array instead. Any reason why this
+ * wasn't done? */
+ aCell.mpFormula->GetFormula(sFormula, formula::FormulaGrammar::GRAM_ODFF);
+
+ // #i87826# [Collaboration] Rejected move destroys formulas
+ // FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
+ // is returned and no further string handling is necessary
+ OUString sFormula2;
+ if ( nMatrixFlag != ScMatrixMode::NONE )
{
- aNewCell = aCell;
- pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
- pChangeActionContent->SetNewValue(aCell, pDoc);
+ sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
}
else
{
- ScMatrixMode nMatrixFlag = aCell.mpFormula->GetMatrixFlag();
- OUString sFormula;
- // With GRAM_ODFF reference detection is faster on compilation.
- /* FIXME: new cell should be created with a clone
- * of the token array instead. Any reason why this
- * wasn't done? */
- aCell.mpFormula->GetFormula(sFormula, formula::FormulaGrammar::GRAM_ODFF);
-
- // #i87826# [Collaboration] Rejected move destroys formulas
- // FIXME: adjust ScFormulaCell::GetFormula(), so that the right formula string
- // is returned and no further string handling is necessary
- OUString sFormula2;
- if ( nMatrixFlag != ScMatrixMode::NONE )
- {
- sFormula2 = sFormula.copy( 2, sFormula.getLength() - 3 );
- }
- else
- {
- sFormula2 = sFormula.copy( 1 );
- }
-
- aNewCell.meType = CELLTYPE_FORMULA;
- aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
- if (nMatrixFlag == ScMatrixMode::Formula)
- {
- SCCOL nCols;
- SCROW nRows;
- aCell.mpFormula->GetMatColsRows(nCols, nRows);
- aNewCell.mpFormula->SetMatColsRows(nCols, nRows);
- }
- aNewCell.mpFormula->SetInChangeTrack(true);
- pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
- // #i40704# don't overwrite the formula string via SetNewValue()
+ sFormula2 = sFormula.copy( 1 );
+ }
+
+ aNewCell.meType = CELLTYPE_FORMULA;
+ aNewCell.mpFormula = new ScFormulaCell(pDoc, aAddress, sFormula2,formula::FormulaGrammar::GRAM_ODFF, nMatrixFlag);
+ if (nMatrixFlag == ScMatrixMode::Formula)
+ {
+ SCCOL nCols;
+ SCROW nRows;
+ aCell.mpFormula->GetMatColsRows(nCols, nRows);
+ aNewCell.mpFormula->SetMatColsRows(nCols, nRows);
}
+ aNewCell.mpFormula->SetInChangeTrack(true);
+ pChangeActionContent->SetNewCell(aNewCell, pDoc, EMPTY_OUSTRING);
+ // #i40704# don't overwrite the formula string via SetNewValue()
}
}
- else
- {
- OSL_FAIL("wrong cell position");
- }
+ }
+ else
+ {
+ OSL_FAIL("wrong cell position");
}
}
}
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 963401915f0a..f2ce09406dc5 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -1478,14 +1478,9 @@ void ScXMLExport::OpenRow(const sal_Int32 nTable, const sal_Int32 nStartRow, con
else
{
assert(nPrevIndex >= 0 && "coverity#1438402");
- if (nRow < nEndRow)
- {
- ScRowFormatRanges* pTempRowFormatRanges = new ScRowFormatRanges(pRowFormatRanges.get());
- OpenAndCloseRow(nPrevIndex, nRow - nEqualRows, nEqualRows, bPrevHidden, bPrevFiltered);
- pRowFormatRanges.reset(pTempRowFormatRanges);
- }
- else
- OpenAndCloseRow(nPrevIndex, nRow - nEqualRows, nEqualRows, bPrevHidden, bPrevFiltered);
+ ScRowFormatRanges* pTempRowFormatRanges = new ScRowFormatRanges(pRowFormatRanges.get());
+ OpenAndCloseRow(nPrevIndex, nRow - nEqualRows, nEqualRows, bPrevHidden, bPrevFiltered);
+ pRowFormatRanges.reset(pTempRowFormatRanges);
nEqualRows = 1;
nPrevIndex = nIndex;
bPrevHidden = bHidden;
diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx
index c7807cef178f..583c89c32823 100644
--- a/sc/source/ui/app/transobj.cxx
+++ b/sc/source/ui/app/transobj.cxx
@@ -495,11 +495,8 @@ bool ScTransferObj::WriteObject( tools::SvRef<SotStorageStream>& rxOStm, void* p
case SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT:
{
ScTabEditEngine* pEngine = static_cast<ScTabEditEngine*>(pUserObject);
- if ( nUserObjectId == SCTRANS_TYPE_EDIT_ODF_TEXT_FLAT )
- {
- pEngine->Write( *rxOStm, EETextFormat::Xml );
- bRet = ( rxOStm->GetError() == ERRCODE_NONE );
- }
+ pEngine->Write(*rxOStm, EETextFormat::Xml);
+ bRet = (rxOStm->GetError() == ERRCODE_NONE);
}
break;
diff --git a/sc/source/ui/view/tabvwsh2.cxx b/sc/source/ui/view/tabvwsh2.cxx
index 6b33a0921753..ea962224f9a8 100644
--- a/sc/source/ui/view/tabvwsh2.cxx
+++ b/sc/source/ui/view/tabvwsh2.cxx
@@ -184,18 +184,15 @@ void ScTabViewShell::ExecDraw(SfxRequest& rReq)
nDrawSfxId = nNewId;
sDrawCustom.clear(); // value is set below for custom shapes
- if ( nNewId != SID_DRAW_CHART ) // chart not with DrawShell
+ if (nNewId == SID_DRAW_TEXT || nNewId == SID_DRAW_TEXT_VERTICAL
+ || nNewId == SID_DRAW_TEXT_MARQUEE || nNewId == SID_DRAW_NOTEEDIT)
+ SetDrawTextShell(true);
+ else
{
- if ( nNewId == SID_DRAW_TEXT || nNewId == SID_DRAW_TEXT_VERTICAL ||
- nNewId == SID_DRAW_TEXT_MARQUEE || nNewId == SID_DRAW_NOTEEDIT )
- SetDrawTextShell( true );
+ if (bEx || pView->GetMarkedObjectList().GetMarkCount() != 0)
+ SetDrawShellOrSub();
else
- {
- if ( bEx || pView->GetMarkedObjectList().GetMarkCount() != 0 )
- SetDrawShellOrSub();
- else
- SetDrawShell( false );
- }
+ SetDrawShell(false);
}
if (pTabView->GetDrawFuncPtr())
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
index 207d288c29f3..6d9bf0bd1de3 100644
--- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
+++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx
@@ -368,22 +368,18 @@ bool SlideSorterController::Command (
}
}
- if (pViewShell != nullptr)
+ if (SfxDispatcher* pDispatcher = pViewShell->GetDispatcher())
{
- SfxDispatcher* pDispatcher = pViewShell->GetDispatcher();
- if (pDispatcher != nullptr)
- {
- mbContextMenuOpen = true;
- if (!rEvent.IsMouseEvent())
- pDispatcher->ExecutePopup(aPopupId, pWindow, &aMenuLocation);
- else
- pDispatcher->ExecutePopup(aPopupId);
- mbContextMenuOpen = false;
- mrSlideSorter.GetView().UpdatePageUnderMouse();
- ::rtl::Reference<SelectionFunction> pFunction(GetCurrentSelectionFunction());
- if (pFunction.is())
- pFunction->ResetMouseAnchor();
- }
+ mbContextMenuOpen = true;
+ if (!rEvent.IsMouseEvent())
+ pDispatcher->ExecutePopup(aPopupId, pWindow, &aMenuLocation);
+ else
+ pDispatcher->ExecutePopup(aPopupId);
+ mbContextMenuOpen = false;
+ mrSlideSorter.GetView().UpdatePageUnderMouse();
+ ::rtl::Reference<SelectionFunction> pFunction(GetCurrentSelectionFunction());
+ if (pFunction.is())
+ pFunction->ResetMouseAnchor();
}
if (pPage == nullptr)
{
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index bdd61533eb38..c7b8b6b4950a 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -797,13 +797,10 @@ uno::Reference< drawing::XDrawPage > SAL_CALL SdXImpressDocument::getHandoutMast
uno::Reference< drawing::XDrawPage > xPage;
- if( mpDoc )
- {
- initializeDocument();
- SdPage* pPage = mpDoc->GetMasterSdPage( 0, PageKind::Handout );
- if( pPage )
- xPage.set( pPage->getUnoPage(), uno::UNO_QUERY );
- }
+ initializeDocument();
+ SdPage* pPage = mpDoc->GetMasterSdPage(0, PageKind::Handout);
+ if (pPage)
+ xPage.set(pPage->getUnoPage(), uno::UNO_QUERY);
return xPage;
}
@@ -956,7 +953,7 @@ css::uno::Reference<css::uno::XInterface> SdXImpressDocument::create(
if( aServiceSpecifier == "com.sun.star.document.ExportEmbeddedObjectResolver" )
{
- ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : nullptr;
+ comphelper::IEmbeddedHelper* pPersist = mpDoc->GetPersist();
if( nullptr == pPersist )
throw lang::DisposedException();
@@ -965,7 +962,7 @@ css::uno::Reference<css::uno::XInterface> SdXImpressDocument::create(
if( aServiceSpecifier == "com.sun.star.document.ImportEmbeddedObjectResolver" )
{
- ::comphelper::IEmbeddedHelper *pPersist = mpDoc ? mpDoc->GetPersist() : nullptr;
+ comphelper::IEmbeddedHelper* pPersist = mpDoc->GetPersist();
if( nullptr == pPersist )
throw lang::DisposedException();
diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx
index 1f0a1a0cb16e..aed0fb2eec6b 100644
--- a/sd/source/ui/unoidl/unopback.cxx
+++ b/sd/source/ui/unoidl/unopback.cxx
@@ -402,20 +402,17 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aProp
throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this));
uno::Any aAny;
- if( mpSet )
+ if (pEntry->nWID == OWN_ATTR_FILLBMP_MODE)
{
- if( pEntry->nWID == OWN_ATTR_FILLBMP_MODE )
- {
- aAny <<= drawing::BitmapMode_REPEAT;
- }
- else
- {
- SfxItemPool& rPool = *mpSet->GetPool();
- SfxItemSet aSet( rPool, {{pEntry->nWID, pEntry->nWID}});
- aSet.Put( rPool.GetDefaultItem( pEntry->nWID ) );
+ aAny <<= drawing::BitmapMode_REPEAT;
+ }
+ else
+ {
+ SfxItemPool& rPool = *mpSet->GetPool();
+ SfxItemSet aSet(rPool, { { pEntry->nWID, pEntry->nWID } });
+ aSet.Put(rPool.GetDefaultItem(pEntry->nWID));
- aAny = SvxItemPropertySet_getPropertyValue( pEntry, aSet );
- }
+ aAny = SvxItemPropertySet_getPropertyValue(pEntry, aSet);
}
return aAny;
}
diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx
index d4c65435fd1a..7be7281816bf 100644
--- a/sd/source/ui/unoidl/unosrch.cxx
+++ b/sd/source/ui/unoidl/unosrch.cxx
@@ -789,14 +789,11 @@ sal_Int32 SAL_CALL SdUnoFindAllAccess::getCount()
uno::Any SAL_CALL SdUnoFindAllAccess::getByIndex( sal_Int32 Index )
{
- uno::Any aAny;
-
if( Index < 0 || Index >= getCount() )
throw lang::IndexOutOfBoundsException();
- const uno::Reference< uno::XInterface > *pRefs = maSequence.getConstArray();
- if(pRefs)
- aAny <<= pRefs[ Index ];
+ uno::Any aAny;
+ aAny <<= maSequence[Index];
return aAny;
}
diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx
index ccf09ff1db67..d9fe8fb46367 100644
--- a/sd/source/ui/view/sdview3.cxx
+++ b/sd/source/ui/view/sdview3.cxx
@@ -935,18 +935,6 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper,
{
svt::EmbeddedObjectRef aObjRef( xObj, aObjDesc.mnViewAspect );
- // try to get the replacement image from the clipboard
- Graphic aGraphic;
- SotClipboardFormatId nGrFormat = SotClipboardFormatId::NONE;
-
- // insert replacement image ( if there is one ) into the object helper
- if ( nGrFormat != SotClipboardFormatId::NONE )
- {
- datatransfer::DataFlavor aDataFlavor;
- SotExchange::GetFormatDataFlavor( nGrFormat, aDataFlavor );
- aObjRef.SetGraphic( aGraphic, aDataFlavor.MimeType );
- }
-
Size aSize;
if ( aObjDesc.mnViewAspect == embed::Aspects::MSOLE_ICON )
{
diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx
index 0398ff0488f5..5b4bc878393a 100644
--- a/sd/source/ui/view/viewshel.cxx
+++ b/sd/source/ui/view/viewshel.cxx
@@ -399,13 +399,10 @@ bool ViewShell::KeyInput(const KeyEvent& rKEvt, ::sd::Window* pWin)
if(pWin)
SetActiveWindow(pWin);
- if(!bReturn)
- {
- // give key input first to SfxViewShell to give CTRL+Key
- // (e.g. CTRL+SHIFT+'+', to front) priority.
- OSL_ASSERT (GetViewShell()!=nullptr);
- bReturn = GetViewShell()->KeyInput(rKEvt);
- }
+ // give key input first to SfxViewShell to give CTRL+Key
+ // (e.g. CTRL+SHIFT+'+', to front) priority.
+ OSL_ASSERT(GetViewShell() != nullptr);
+ bReturn = GetViewShell()->KeyInput(rKEvt);
const size_t OriCount = GetView()->GetMarkedObjectList().GetMarkCount();
if(!bReturn)
diff --git a/svgio/source/svgreader/svgsvgnode.cxx b/svgio/source/svgreader/svgsvgnode.cxx
index c588b2c37038..0d42099eff3b 100644
--- a/svgio/source/svgreader/svgsvgnode.cxx
+++ b/svgio/source/svgreader/svgsvgnode.cxx
@@ -501,12 +501,12 @@ namespace svgio
basegfx::B2DRange aSvgCanvasRange; // viewport
double fW = 0.0; // dummy values
double fH = 0.0;
- if(getViewBox())
+ if (const basegfx::B2DRange* pBox = getViewBox())
{
// SVG 1.1 defines in section 7.7 that a negative value for width or height
// in viewBox is an error and that 0.0 disables rendering
- const double fViewBoxWidth = getViewBox()->getWidth();
- const double fViewBoxHeight = getViewBox()->getHeight();
+ const double fViewBoxWidth = pBox->getWidth();
+ const double fViewBoxHeight = pBox->getHeight();
if(basegfx::fTools::more(fViewBoxWidth,0.0) && basegfx::fTools::more(fViewBoxHeight,0.0))
{
// The intrinsic aspect ratio of the svg element is given by absolute values of svg width and svg height
@@ -542,14 +542,10 @@ namespace svgio
// We get viewport >= content, therefore no clipping.
bNeedsMapping = false;
- const basegfx::B2DRange aChildRange(
- aSequence.getB2DRange(
- drawinglayer::geometry::ViewInformation2D()));
-
- const double fChildWidth(getViewBox() ? getViewBox()->getWidth() : aChildRange.getWidth());
- const double fChildHeight(getViewBox() ? getViewBox()->getHeight() : aChildRange.getHeight());
- const double fLeft(getViewBox() ? getViewBox()->getMinX() : aChildRange.getMinX());
- const double fTop (getViewBox() ? getViewBox()->getMinY() : aChildRange.getMinY());
+ const double fChildWidth(pBox->getWidth());
+ const double fChildHeight(pBox->getHeight());
+ const double fLeft(pBox->getMinX());
+ const double fTop(pBox->getMinY());
if ( fChildWidth / fViewBoxWidth > fChildHeight / fViewBoxHeight )
{ // expand y
fW = fChildWidth;
@@ -572,7 +568,7 @@ namespace svgio
const SvgAspectRatio& rRatio = getSvgAspectRatio().isSet()? getSvgAspectRatio() : aRatioDefault;
basegfx::B2DHomMatrix aViewBoxMapping;
- aViewBoxMapping = rRatio.createMapping(aSvgCanvasRange, *getViewBox());
+ aViewBoxMapping = rRatio.createMapping(aSvgCanvasRange, *pBox);
// no need to check ratio here for slice, the outermost Svg will
// be clipped anyways (see below)
diff --git a/svx/source/accessibility/ShapeTypeHandler.cxx b/svx/source/accessibility/ShapeTypeHandler.cxx
index c569700ed0bc..e6454389c30f 100644
--- a/svx/source/accessibility/ShapeTypeHandler.cxx
+++ b/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -269,33 +269,22 @@ OUString ShapeTypeHandler::CreateAccessibleBaseName (const uno::Reference<drawin
pResourceId = STR_ObjNameSingulRECT;
break;
case DRAWING_CUSTOM:
- {
- pResourceId = STR_ObjNameSingulCUSTOMSHAPE;
+ pResourceId = STR_ObjNameSingulCUSTOMSHAPE;
- SvxShape* pShape = SvxShape::getImplementation( rxShape );
- if (pShape)
+ if (SvxShape* pShape = SvxShape::getImplementation(rxShape))
+ {
+ if (auto pCustomShape = dynamic_cast<SdrObjCustomShape*>(pShape->GetSdrObject()))
{
- SdrObject *pSdrObj = pShape->GetSdrObject();
- if (pSdrObj)
+ if (pCustomShape->IsTextPath())
+ pResourceId = STR_ObjNameSingulFONTWORK;
+ else
{
- if(dynamic_cast<const SdrObjCustomShape*>( pSdrObj) != nullptr)
- {
- SdrObjCustomShape* pCustomShape = static_cast<SdrObjCustomShape*>(pSdrObj);
- if(pCustomShape)
- {
- if (pCustomShape->IsTextPath())
- pResourceId = STR_ObjNameSingulFONTWORK;
- else
- {
- pResourceId = nullptr;
- sName = pCustomShape->GetCustomShapeName();
- }
- }
- }
+ pResourceId = nullptr;
+ sName = pCustomShape->GetCustomShapeName();
}
}
- break;
}
+ break;
case DRAWING_TEXT:
pResourceId = STR_ObjNameSingulTEXT;
break;
diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx
index 6d099d6efb77..cb0c3d1fa2c5 100644
--- a/svx/source/svdraw/svddrgmt.cxx
+++ b/svx/source/svdraw/svddrgmt.cxx
@@ -168,10 +168,7 @@ void SdrDragEntrySdrObject::prepareCurrentState(SdrDragMethod& rDragMethod)
if(mbModify)
{
- if(!mpClone)
- {
- mpClone = maOriginal.getFullDragClone();
- }
+ mpClone = maOriginal.getFullDragClone();
// apply original transformation, implemented at the DragMethods
rDragMethod.applyCurrentTransformationToSdrObject(*mpClone);
diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx
index 7dc05bc1a086..a53725c6ee1e 100644
--- a/svx/source/svdraw/svdhdl.cxx
+++ b/svx/source/svdraw/svdhdl.cxx
@@ -2098,11 +2098,7 @@ void SdrHdlList::SetFocusHdl(SdrHdl* pNew)
pActual->Touch();
}
- if(pNew)
- {
- pNew->Touch();
- }
-
+ pNew->Touch();
}
}
}
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index 41158c70c2e5..6f2720601d77 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -788,7 +788,8 @@ bool SdrPageView::EnterGroup(SdrObject* pObj)
void SdrPageView::LeaveOneGroup()
{
- if(!GetCurrentGroup())
+ SdrObject* pLastGroup = GetCurrentGroup();
+ if (!pLastGroup)
return;
bool bGlueInvalidate = GetView().ImpIsGlueVisible();
@@ -796,8 +797,7 @@ void SdrPageView::LeaveOneGroup()
if(bGlueInvalidate)
GetView().GlueInvalidate();
- SdrObject* pLastGroup = GetCurrentGroup();
- SdrObject* pParentGroup = GetCurrentGroup()->getParentSdrObjectFromSdrObject();
+ SdrObject* pParentGroup = pLastGroup->getParentSdrObjectFromSdrObject();
SdrObjList* pParentList = GetPage();
if(pParentGroup)
@@ -810,9 +810,8 @@ void SdrPageView::LeaveOneGroup()
SetCurrentGroupAndList(pParentGroup, pParentList);
// select the group we just left
- if(pLastGroup)
- if(GetView().GetSdrPageView())
- GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
+ if (GetView().GetSdrPageView())
+ GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
GetView().AdjustMarkHdl();
@@ -825,15 +824,13 @@ void SdrPageView::LeaveOneGroup()
void SdrPageView::LeaveAllGroup()
{
- if(GetCurrentGroup())
+ if (SdrObject* pLastGroup = GetCurrentGroup())
{
bool bGlueInvalidate = GetView().ImpIsGlueVisible();
if(bGlueInvalidate)
GetView().GlueInvalidate();
- SdrObject* pLastGroup = GetCurrentGroup();
-
// deselect everything
GetView().UnmarkAll();
@@ -841,14 +838,11 @@ void SdrPageView::LeaveAllGroup()
SetCurrentGroupAndList(nullptr, GetPage());
// find and select uppermost group
- if(pLastGroup)
- {
- while(pLastGroup->getParentSdrObjectFromSdrObject())
- pLastGroup = pLastGroup->getParentSdrObjectFromSdrObject();
+ while (pLastGroup->getParentSdrObjectFromSdrObject())
+ pLastGroup = pLastGroup->getParentSdrObjectFromSdrObject();
- if(GetView().GetSdrPageView())
- GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
- }
+ if (GetView().GetSdrPageView())
+ GetView().MarkObj(pLastGroup, GetView().GetSdrPageView());
GetView().AdjustMarkHdl();
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 187f52af7a69..b800c7a06181 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -1169,46 +1169,43 @@ TableHitKind SdrTableObj::CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_
// get vertical edge number and check for a hit
const bool bRTL = (GetWritingMode() == WritingMode_RL_TB);
bool bVrtHit = false;
- if( nX >= 0 )
+ if( !bRTL )
{
- if( !bRTL )
+ while( rnX <= nColCount )
{
- while( rnX <= nColCount )
+ if( nX - aTol <= 0 )
{
- if( nX - aTol <= 0 )
- {
- bVrtHit = true;
- break;
- }
+ bVrtHit = true;
+ break;
+ }
- if( rnX == nColCount )
- break;
+ if( rnX == nColCount )
+ break;
- nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
- if( nX < 0 )
- break;
- rnX++;
- }
+ nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
+ if( nX < 0 )
+ break;
+ rnX++;
}
- else
+ }
+ else
+ {
+ rnX = nColCount;
+ while( rnX >= 0 )
{
- rnX = nColCount;
- while( rnX >= 0 )
+ if( nX - aTol <= 0 )
{
- if( nX - aTol <= 0 )
- {
- bVrtHit = true;
- break;
- }
+ bVrtHit = true;
+ break;
+ }
- if( rnX == 0 )
- break;
+ if( rnX == 0 )
+ break;
- rnX--;
- nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
- if( nX < 0 )
- break;
- }
+ rnX--;
+ nX -= mpImpl->mpLayouter->getColumnWidth( rnX );
+ if( nX < 0 )
+ break;
}
}
@@ -1216,24 +1213,21 @@ TableHitKind SdrTableObj::CheckTableHit( const Point& rPos, sal_Int32& rnX, sal_
// get vertical edge number and check for a hit
bool bHrzHit = false;
- if( nY >= 0 )
+ while( rnY <= nRowCount )
{
- while( rnY <= nRowCount )
+ if( nY - aTol <= 0 )
{
- if( nY - aTol <= 0 )
- {
- bHrzHit = true;
- break;
- }
+ bHrzHit = true;
+ break;
+ }
- if( rnY == nRowCount )
- break;
+ if( rnY == nRowCount )
+ break;
- nY -= mpImpl->mpLayouter->getRowHeight(rnY);
- if( nY < 0 )
- break;
- rnY++;
- }
+ nY -= mpImpl->mpLayouter->getRowHeight(rnY);
+ if( nY < 0 )
+ break;
+ rnY++;
}
// rnY is now the edge number above the pointer, if it was hit bVrtHit is also true
diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx
index c35463b0c297..1b934d7731b1 100644
--- a/svx/source/table/tablemodel.cxx
+++ b/svx/source/table/tablemodel.cxx
@@ -979,7 +979,7 @@ void TableModel::optimize()
if( bEmpty )
{
- if( nCol > 0 ) try
+ try
{
const OUString sWidth("Width");
sal_Int32 nWidth1 = 0, nWidth2 = 0;
@@ -1016,7 +1016,7 @@ void TableModel::optimize()
if( bEmpty )
{
- if( nRow > 0 ) try
+ try
{
const OUString sHeight("Height");
sal_Int32 nHeight1 = 0, nHeight2 = 0;
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 2d5871e00c1f..571a1d74ffb5 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -126,9 +126,7 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
if( dynamic_cast<const E3dObject* >(pSdrShape) != nullptr )
{
GetSdrObject()->GetSubList()->NbcInsertObject( pSdrShape );
-
- if(pShape)
- pShape->Create( pSdrShape, mxPage.get() );
+ pShape->Create(pSdrShape, mxPage.get());
}
else
{
diff --git a/svx/source/unodraw/unoshtxt.cxx b/svx/source/unodraw/unoshtxt.cxx
index 4dffab0d5906..287d2bd18b42 100644
--- a/svx/source/unodraw/unoshtxt.cxx
+++ b/svx/source/unodraw/unoshtxt.cxx
@@ -206,12 +206,9 @@ SvxTextEditSourceImpl::SvxTextEditSourceImpl( SdrObject& rObject, SdrText* pText
mpText = pTextObj->getText( 0 );
}
- if( mpModel )
- StartListening( *mpModel );
- if( mpView )
- StartListening( *mpView );
- if( mpObject )
- mpObject->AddObjectUser( *this );
+ StartListening( *mpModel );
+ StartListening( *mpView );
+ mpObject->AddObjectUser( *this );
// Init edit mode state from shape info (IsTextEditActive())
mbShapeIsEditMode = IsEditMode();
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 74912a9ded57..cafbe882ff37 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -1099,14 +1099,14 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
sal_uInt32 nCount, nSurrogate;
- const SfxItemPool* pPool1 = &pModel->GetItemPool();
- if( !aUniqueName.isEmpty() && pPool1 )
+ const SfxItemPool& rPool1 = pModel->GetItemPool();
+ if (!aUniqueName.isEmpty())
{
- nCount = pPool1->GetItemCount2( XATTR_LINESTART );
+ nCount = rPool1.GetItemCount2(XATTR_LINESTART);
for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
{
- const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
+ const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate);
if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
{
@@ -1124,11 +1124,11 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
if( !bForceNew )
{
- nCount = pPool1->GetItemCount2( XATTR_LINEEND );
+ nCount = rPool1.GetItemCount2(XATTR_LINEEND);
for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
{
- const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
+ const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate);
if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
{
@@ -1200,53 +1200,50 @@ XLineStartItem* XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
sal_Int32 nUserIndex = 1;
const OUString aUser(SvxResId(RID_SVXSTR_LINEEND));
- if( pPool1 )
+ nCount = rPool1.GetItemCount2(XATTR_LINESTART);
+ sal_uInt32 nSurrogate2;
+
+ for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
{
- nCount = pPool1->GetItemCount2( XATTR_LINESTART );
- sal_uInt32 nSurrogate2;
+ const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate2);
- for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
+ if (pItem && !pItem->GetName().isEmpty())
{
- const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
-
- if( pItem && !pItem->GetName().isEmpty() )
+ if (!bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue())
{
- if( !bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue() )
- {
- aUniqueName = pItem->GetName();
- bFoundExisting = true;
- break;
- }
+ aUniqueName = pItem->GetName();
+ bFoundExisting = true;
+ break;
+ }
- if( pItem->GetName().startsWith( aUser ) )
- {
- sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
- if( nThisIndex >= nUserIndex )
- nUserIndex = nThisIndex + 1;
- }
+ if (pItem->GetName().startsWith(aUser))
+ {
+ sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
+ if (nThisIndex >= nUserIndex)
+ nUserIndex = nThisIndex + 1;
}
}
+ }
- nCount = pPool1->GetItemCount2( XATTR_LINEEND );
- for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
- {
- const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
+ nCount = rPool1.GetItemCount2(XATTR_LINEEND);
+ for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
+ {
+ const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate2);
- if( pItem && !pItem->GetName().isEmpty() )
+ if (pItem && !pItem->GetName().isEmpty())
+ {
+ if (!bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue())
{
- if( !bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue() )
- {
- aUniqueName = pItem->GetName();
- bFoundExisting = true;
- break;
- }
+ aUniqueName = pItem->GetName();
+ bFoundExisting = true;
+ break;
+ }
- if( pItem->GetName().startsWith( aUser ) )
- {
- sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
- if( nThisIndex >= nUserIndex )
- nUserIndex = nThisIndex + 1;
- }
+ if (pItem->GetName().startsWith(aUser))
+ {
+ sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
+ if (nThisIndex >= nUserIndex)
+ nUserIndex = nThisIndex + 1;
}
}
}
@@ -1353,14 +1350,14 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
sal_uInt16 nCount, nSurrogate;
- const SfxItemPool* pPool1 = &pModel->GetItemPool();
- if( !aUniqueName.isEmpty() && pPool1 )
+ const SfxItemPool& rPool1 = pModel->GetItemPool();
+ if (!aUniqueName.isEmpty())
{
- nCount = pPool1->GetItemCount2( XATTR_LINESTART );
+ nCount = rPool1.GetItemCount2(XATTR_LINESTART);
for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
{
- const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate );
+ const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate);
if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
{
@@ -1378,11 +1375,11 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
if( !bForceNew )
{
- nCount = pPool1->GetItemCount2( XATTR_LINEEND );
+ nCount = rPool1.GetItemCount2(XATTR_LINEEND);
for( nSurrogate = 0; nSurrogate < nCount; nSurrogate++ )
{
- const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate );
+ const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate);
if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
{
@@ -1454,53 +1451,50 @@ XLineEndItem* XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
sal_Int32 nUserIndex = 1;
const OUString aUser(SvxResId(RID_SVXSTR_LINEEND));
- if( pPool1 )
+ nCount = rPool1.GetItemCount2(XATTR_LINESTART);
+ sal_uInt32 nSurrogate2;
+
+ for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
{
- nCount = pPool1->GetItemCount2( XATTR_LINESTART );
- sal_uInt32 nSurrogate2;
+ const XLineStartItem* pItem = rPool1.GetItem2(XATTR_LINESTART, nSurrogate2);
- for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
+ if (pItem && !pItem->GetName().isEmpty())
{
- const XLineStartItem* pItem = pPool1->GetItem2( XATTR_LINESTART, nSurrogate2 );
-
- if( pItem && !pItem->GetName().isEmpty() )
+ if (!bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue())
{
- if( !bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue() )
- {
- aUniqueName = pItem->GetName();
- bFoundExisting = true;
- break;
- }
+ aUniqueName = pItem->GetName();
+ bFoundExisting = true;
+ break;
+ }
- if( pItem->GetName().startsWith( aUser ) )
- {
- sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
- if( nThisIndex >= nUserIndex )
- nUserIndex = nThisIndex + 1;
- }
+ if (pItem->GetName().startsWith(aUser))
+ {
+ sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
+ if (nThisIndex >= nUserIndex)
+ nUserIndex = nThisIndex + 1;
}
}
+ }
- nCount = pPool1->GetItemCount2( XATTR_LINEEND );
- for( nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++ )
- {
- const XLineEndItem* pItem = pPool1->GetItem2( XATTR_LINEEND, nSurrogate2 );
+ nCount = rPool1.GetItemCount2(XATTR_LINEEND);
+ for (nSurrogate2 = 0; nSurrogate2 < nCount; nSurrogate2++)
+ {
+ const XLineEndItem* pItem = rPool1.GetItem2(XATTR_LINEEND, nSurrogate2);
- if( pItem && !pItem->GetName().isEmpty() )
+ if (pItem && !pItem->GetName().isEmpty())
+ {
+ if (!bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue())
{
- if( !bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue() )
- {
- aUniqueName = pItem->GetName();
- bFoundExisting = true;
- break;
- }
+ aUniqueName = pItem->GetName();
+ bFoundExisting = true;
+ break;
+ }
- if( pItem->GetName().startsWith( aUser ) )
- {
- sal_Int32 nThisIndex = pItem->GetName().copy( aUser.getLength() ).toInt32();
- if( nThisIndex >= nUserIndex )
- nUserIndex = nThisIndex + 1;
- }
+ if (pItem->GetName().startsWith(aUser))
+ {
+ sal_Int32 nThisIndex = pItem->GetName().copy(aUser.getLength()).toInt32();
+ if (nThisIndex >= nUserIndex)
+ nUserIndex = nThisIndex + 1;
}
}
}
diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx
index c8dc42be2a1c..3bf103d9469e 100644
--- a/svx/source/xoutdev/xattr2.cxx
+++ b/svx/source/xoutdev/xattr2.cxx
@@ -252,9 +252,7 @@ SfxPoolItem* XLineCapItem::Clone(SfxItemPool* /*pPool*/) const
bool XLineCapItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCoreUnit*/,
MapUnit /*ePresUnit*/, OUString& rText, const IntlWrapper&) const
{
- rText.clear();
-
- const char* pId = nullptr;
+ const char* pId;
switch( GetValue() )
{
@@ -271,8 +269,7 @@ bool XLineCapItem::GetPresentation( SfxItemPresentation /*ePres*/, MapUnit /*eCo
break;
}
- if (pId)
- rText = SvxResId(pId);
+ rText = SvxResId(pId);
return true;
}
diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx
index ae0ff382b9e7..865907a172a9 100644
--- a/sw/source/core/attr/swatrset.cxx
+++ b/sw/source/core/attr/swatrset.cxx
@@ -377,8 +377,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const
RES_PAGEDESC, false, &pItem ) &&
nullptr != ( pPgDesc = static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc()) )
{
- if( !tmpSet )
- tmpSet.reset( new SfxItemSet( *this ));
+ tmpSet.reset(new SfxItemSet(*this));
SwPageDesc* pDstPgDesc = pDstDoc->FindPageDesc(pPgDesc->GetName());
if( !pDstPgDesc )
diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx
index 4b7fef996f36..1103e507d8c4 100644
--- a/sw/source/core/undo/unins.cxx
+++ b/sw/source/core/undo/unins.cxx
@@ -843,7 +843,7 @@ void SwUndoReRead::SaveGraphicData( const SwGrfNode& rGrfNd )
{
maNm = OUString();
maFltr = OUString();
- rGrfNd.GetFileFilterNms( maNm ? &*maNm : nullptr, maFltr ? &*maFltr : nullptr );
+ rGrfNd.GetFileFilterNms(&*maNm, &*maFltr);
pGrf.reset();
}
else
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 87584578da2c..0b2064cfa53b 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -652,274 +652,264 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData
if (!pTableFormat || !pUnoCursor)
throw lang::IllegalArgumentException();
- if(pTableFormat)
+ SwTable* pTable = SwTable::FindTable(pTableFormat);
+ if (pTable->IsTableComplex())
+ return xRes; // we can't handle this thus returning an empty references
+
+ // get a character map in the size of the table to mark
+ // all the ranges to use in
+ sal_Int32 nRows = pTable->GetTabLines().size();
+ sal_Int32 nCols = pTable->GetTabLines().front()->GetTabBoxes().size();
+ std::vector<std::vector<sal_Char>> aMap(nRows);
+ for (sal_Int32 i = 0; i < nRows; ++i)
+ aMap[i].resize(nCols);
+
+ // iterate over subranges and mark used cells in above map
+ //!! by proceeding this way we automatically get rid of
+ //!! multiple listed or overlapping cell ranges which should
+ //!! just be ignored silently
+ sal_Int32 nSubRanges = aSubRanges.getLength();
+ for (sal_Int32 i = 0; i < nSubRanges; ++i)
{
- SwTable* pTable = SwTable::FindTable( pTableFormat );
- if(pTable->IsTableComplex())
- return xRes; // we can't handle this thus returning an empty references
- else
+ OUString aTableName, aStartCell, aEndCell;
+ bool bOk2 = GetTableAndCellsFromRangeRep(
+ pSubRanges[i], aTableName, aStartCell, aEndCell );
+ OSL_ENSURE(bOk2, "failed to get table and start/end cells");
+
+ sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
+ SwXTextTable::GetCellPosition(aStartCell, nStartCol, nStartRow);
+ SwXTextTable::GetCellPosition(aEndCell, nEndCol, nEndRow);
+ OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
+ "cell range not normalized");
+
+ // test if the ranges span more than the available cells
+ if( nStartRow < 0 || nEndRow >= nRows ||
+ nStartCol < 0 || nEndCol >= nCols )
{
- // get a character map in the size of the table to mark
- // all the ranges to use in
- sal_Int32 nRows = pTable->GetTabLines().size();
- sal_Int32 nCols = pTable->GetTabLines().front()->GetTabBoxes().size();
- std::vector< std::vector< sal_Char > > aMap( nRows );
- for (sal_Int32 i = 0; i < nRows; ++i)
- aMap[i].resize( nCols );
-
- // iterate over subranges and mark used cells in above map
- //!! by proceeding this way we automatically get rid of
- //!! multiple listed or overlapping cell ranges which should
- //!! just be ignored silently
- sal_Int32 nSubRanges = aSubRanges.getLength();
- for (sal_Int32 i = 0; i < nSubRanges; ++i)
- {
- OUString aTableName, aStartCell, aEndCell;
- bool bOk2 = GetTableAndCellsFromRangeRep(
- pSubRanges[i], aTableName, aStartCell, aEndCell );
- OSL_ENSURE( bOk2, "failed to get table and start/end cells" );
-
- sal_Int32 nStartRow, nStartCol, nEndRow, nEndCol;
- SwXTextTable::GetCellPosition( aStartCell, nStartCol, nStartRow );
- SwXTextTable::GetCellPosition( aEndCell, nEndCol, nEndRow );
- OSL_ENSURE( nStartRow <= nEndRow && nStartCol <= nEndCol,
- "cell range not normalized");
-
- // test if the ranges span more than the available cells
- if( nStartRow < 0 || nEndRow >= nRows ||
- nStartCol < 0 || nEndCol >= nCols )
- {
- throw lang::IllegalArgumentException();
- }
- for (sal_Int32 k1 = nStartRow; k1 <= nEndRow; ++k1)
- {
- for (sal_Int32 k2 = nStartCol; k2 <= nEndCol; ++k2)
- aMap[k1][k2] = 'x';
- }
- }
+ throw lang::IllegalArgumentException();
+ }
+ for (sal_Int32 k1 = nStartRow; k1 <= nEndRow; ++k1)
+ {
+ for (sal_Int32 k2 = nStartCol; k2 <= nEndCol; ++k2)
+ aMap[k1][k2] = 'x';
+ }
+ }
+
+ // find label and data sequences to use
- // find label and data sequences to use
+ sal_Int32 oi; // outer index (slower changing index)
+ sal_Int32 ii; // inner index (faster changing index)
+ sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
+ sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
+ std::vector<sal_Int32> aLabelIdx(oiEnd);
+ std::vector<sal_Int32> aDataStartIdx(oiEnd);
+ std::vector<sal_Int32> aDataLen(oiEnd);
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ aLabelIdx[oi] = -1;
+ aDataStartIdx[oi] = -1;
+ aDataLen[oi] = 0;
+ }
+
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ ii = 0;
+ while (ii < iiEnd)
+ {
+ sal_Char &rChar = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii];
- sal_Int32 oi; // outer index (slower changing index)
- sal_Int32 ii; // inner index (faster changing index)
- sal_Int32 oiEnd = bDtaSrcIsColumns ? nCols : nRows;
- sal_Int32 iiEnd = bDtaSrcIsColumns ? nRows : nCols;
- std::vector< sal_Int32 > aLabelIdx( oiEnd );
- std::vector< sal_Int32 > aDataStartIdx( oiEnd );
- std::vector< sal_Int32 > aDataLen( oiEnd );
- for (oi = 0; oi < oiEnd; ++oi)
+ // label should be used but is not yet found?
+ if (rChar == 'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
{
- aLabelIdx[oi] = -1;
- aDataStartIdx[oi] = -1;
- aDataLen[oi] = 0;
+ aLabelIdx[oi] = ii;
+ rChar = 'L'; // setting a different char for labels here
+ // makes the test for the data sequence below
+ // easier
}
- for (oi = 0; oi < oiEnd; ++oi)
+ // find data sequence
+ if (rChar == 'x' && aDataStartIdx[oi] == -1)
{
- ii = 0;
- while (ii < iiEnd)
- {
- sal_Char &rChar = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii];
-
- // label should be used but is not yet found?
- if (rChar == 'x' && bFirstIsLabel && aLabelIdx[oi] == -1)
- {
- aLabelIdx[oi] = ii;
- rChar = 'L'; // setting a different char for labels here
- // makes the test for the data sequence below
- // easier
- }
-
- // find data sequence
- if (rChar == 'x' && aDataStartIdx[oi] == -1)
- {
- aDataStartIdx[oi] = ii;
+ aDataStartIdx[oi] = ii;
- // get length of data sequence
- sal_Int32 nL = 0;
- sal_Char c;
- while (ii< iiEnd && 'x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
- {
- ++nL; ++ii;
- }
- aDataLen[oi] = nL;
-
- // check that there is no other separate sequence of data
- // to be found because that is not supported
- while (ii < iiEnd)
- {
- if ('x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
- throw lang::IllegalArgumentException();
- ++ii;
- }
- }
- else
- ++ii;
+ // get length of data sequence
+ sal_Int32 nL = 0;
+ sal_Char c;
+ while (ii< iiEnd && 'x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
+ {
+ ++nL; ++ii;
}
- }
+ aDataLen[oi] = nL;
- // make some other consistency checks while calculating
- // the number of XLabeledDataSequence to build:
- // - labels should always be used or not at all
- // - the data sequences should have equal non-zero length
- sal_Int32 nNumLDS = 0;
- if (oiEnd > 0)
- {
- sal_Int32 nFirstSeqLen = 0;
- sal_Int32 nFirstSeqLabelIdx = -1;
- bool bFirstFound = false;
- for (oi = 0; oi < oiEnd; ++oi)
+ // check that there is no other separate sequence of data
+ // to be found because that is not supported
+ while (ii < iiEnd)
{
- // row/col used at all?
- if (aDataStartIdx[oi] != -1 &&
- (!bFirstIsLabel || aLabelIdx[oi] != -1))
- {
- ++nNumLDS;
- if (!bFirstFound)
- {
- nFirstSeqLen = aDataLen[oi];
- nFirstSeqLabelIdx = aLabelIdx[oi];
- bFirstFound = true;
- }
- else
- {
- if (nFirstSeqLen != aDataLen[oi] ||
- nFirstSeqLabelIdx != aLabelIdx[oi])
- throw lang::IllegalArgumentException();
- }
- }
+ if ('x' == (c = bDtaSrcIsColumns ? aMap[ii][oi] : aMap[oi][ii]))
+ throw lang::IllegalArgumentException();
+ ++ii;
}
}
- if (nNumLDS == 0)
- throw lang::IllegalArgumentException();
+ else
+ ++ii;
+ }
+ }
- // now we should have all necessary data to build a proper DataSource
- // thus if we came this far there should be no further problem
- if (bTestOnly)
- return xRes; // have createDataSourcePossible return true
-
- // create data source from found label and data sequences
- uno::Sequence< uno::Reference< chart2::data::XDataSequence > > aLabelSeqs( nNumLDS );
- uno::Reference< chart2::data::XDataSequence > *pLabelSeqs = aLabelSeqs.getArray();
- uno::Sequence< uno::Reference< chart2::data::XDataSequence > > aDataSeqs( nNumLDS );
- uno::Reference< chart2::data::XDataSequence > *pDataSeqs = aDataSeqs.getArray();
- sal_Int32 nSeqsIdx = 0;
- for (oi = 0; oi < oiEnd; ++oi)
+ // make some other consistency checks while calculating
+ // the number of XLabeledDataSequence to build:
+ // - labels should always be used or not at all
+ // - the data sequences should have equal non-zero length
+ sal_Int32 nNumLDS = 0;
+ if (oiEnd > 0)
+ {
+ sal_Int32 nFirstSeqLen = 0;
+ sal_Int32 nFirstSeqLabelIdx = -1;
+ bool bFirstFound = false;
+ for (oi = 0; oi < oiEnd; ++oi)
+ {
+ // row/col used at all?
+ if (aDataStartIdx[oi] != -1 &&
+ (!bFirstIsLabel || aLabelIdx[oi] != -1))
{
- // row/col not used? (see if-statement above where nNumLDS was counted)
- if (!(aDataStartIdx[oi] != -1 &&
- (!bFirstIsLabel || aLabelIdx[oi] != -1)))
- continue;
-
- // get cell ranges for label and data
-
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list