[Libreoffice-commits] core.git: 25 commits - filter/source sd/source sfx2/source store/source svx/source sw/source
Caolán McNamara
caolanm at redhat.com
Wed Oct 14 03:00:11 PDT 2015
filter/source/t602/t602filter.cxx | 3 -
sd/source/ui/func/fuformatpaintbrush.cxx | 2
sfx2/source/doc/objitem.cxx | 6 --
store/source/storpage.cxx | 2
svx/source/form/filtnav.cxx | 27 ++++------
svx/source/svdraw/svdundo.cxx | 6 --
svx/source/unodraw/unoshape.cxx | 35 +++++--------
sw/source/core/layout/frmtool.cxx | 8 +-
sw/source/core/text/txtfly.cxx | 5 -
sw/source/filter/xml/xmlexpit.cxx | 83 ++++++++++++++-----------------
sw/source/filter/xml/xmlimpit.cxx | 77 +++++++++++++---------------
sw/source/uibase/shells/basesh.cxx | 2
sw/source/uibase/uiview/view.cxx | 51 ++++++++-----------
13 files changed, 142 insertions(+), 165 deletions(-)
New commits:
commit e55d2a31260ac1eeb45468c7b8f077de5a93060a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:14:14 2015 +0100
coverity#735849 Unchecked dynamic_cast
Change-Id: Ia8f6b24db5d83337d56599214d0acdb9b144cfc3
diff --git a/sfx2/source/doc/objitem.cxx b/sfx2/source/doc/objitem.cxx
index 1b446c4..20192a9 100644
--- a/sfx2/source/doc/objitem.cxx
+++ b/sfx2/source/doc/objitem.cxx
@@ -88,12 +88,10 @@ SfxObjectItem::SfxObjectItem( sal_uInt16 nWhichId, SfxShell *pSh )
bool SfxObjectItem::operator==( const SfxPoolItem &rItem ) const
{
- const SfxObjectItem *pOther = dynamic_cast<const SfxObjectItem*>( &rItem );
- return pOther->_pSh == _pSh;
+ const SfxObjectItem& rOther = dynamic_cast<const SfxObjectItem&>(rItem);
+ return rOther._pSh == _pSh;
}
-
-
SfxPoolItem* SfxObjectItem::Clone( SfxItemPool *) const
{
return new SfxObjectItem( Which(), _pSh );
commit d9b9b6f74cf8ad7ce617521b479e836997479102
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:13:26 2015 +0100
coverity#735862 Unchecked dynamic_cast
Change-Id: Id23987edcff82621cbe932b4273fec0371bd481b
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 3a021f1..8bb80d3 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -780,7 +780,6 @@ void FmFilterModel::Insert(const ::std::vector<FmFilterData*>::iterator& rPos, F
Broadcast( aInsertedHint );
}
-
void FmFilterModel::Remove(FmFilterData* pData)
{
FmParentData* pParent = pData->GetParent();
@@ -824,27 +823,26 @@ void FmFilterModel::Remove(FmFilterData* pData)
}
else // FormItems can not be deleted
{
- FmFilterItem* pFilterItem = dynamic_cast<FmFilterItem*>( pData );
+ FmFilterItem& rFilterItem = dynamic_cast<FmFilterItem&>(*pData);
// if its the last condition remove the parent
if (rItems.size() == 1)
- Remove(pFilterItem->GetParent());
+ Remove(rFilterItem.GetParent());
else
{
// find the position of the father within his father
::std::vector<FmFilterData*>& rParentParentItems = pData->GetParent()->GetParent()->GetChildren();
- ::std::vector<FmFilterData*>::iterator j = ::std::find(rParentParentItems.begin(), rParentParentItems.end(), pFilterItem->GetParent());
+ ::std::vector<FmFilterData*>::iterator j = ::std::find(rParentParentItems.begin(), rParentParentItems.end(), rFilterItem.GetParent());
DBG_ASSERT(j != rParentParentItems.end(), "FmFilterModel::Remove(): unknown Item");
sal_Int32 nParentPos = j - rParentParentItems.begin();
// EmptyText removes the filter
- FmFilterAdapter::setText(nParentPos, pFilterItem, OUString());
+ FmFilterAdapter::setText(nParentPos, &rFilterItem, OUString());
Remove( i );
}
}
}
-
void FmFilterModel::Remove( const ::std::vector<FmFilterData*>::iterator& rPos )
{
// remove from parent's child list
commit 093c4ee9de478ca2273c1fa6eda1f7a62b823b0a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:11:32 2015 +0100
coverity#735864 Unchecked dynamic_cast
Change-Id: I669ffab93976a61321f471586256fb52c9bd3451
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index 37b37c8..3a021f1 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -424,8 +424,9 @@ void FmFilterAdapter::predicateExpressionChanged( const FilterEvent& _Event ) th
const sal_Int32 nActiveTerm( xFilterController->getActiveTerm() );
- FmFilterItems* pFilter = dynamic_cast<FmFilterItems*>( pFormItem->GetChildren()[ nActiveTerm ] );
- FmFilterItem* pFilterItem = pFilter->Find( _Event.FilterComponent );
+ FmFilterData* pData = pFormItem->GetChildren()[nActiveTerm];
+ FmFilterItems& rFilter = dynamic_cast<FmFilterItems&>(*pData);
+ FmFilterItem* pFilterItem = rFilter.Find( _Event.FilterComponent );
if ( pFilterItem )
{
if ( !_Event.PredicateExpression.isEmpty())
@@ -446,8 +447,8 @@ void FmFilterAdapter::predicateExpressionChanged( const FilterEvent& _Event ) th
// searching the component by field name
OUString aFieldName( lcl_getLabelName_nothrow( xFilterController->getFilterComponent( _Event.FilterComponent ) ) );
- pFilterItem = new FmFilterItem( pFilter, aFieldName, _Event.PredicateExpression, _Event.FilterComponent );
- m_pModel->Insert(pFilter->GetChildren().end(), pFilterItem);
+ pFilterItem = new FmFilterItem(&rFilter, aFieldName, _Event.PredicateExpression, _Event.FilterComponent);
+ m_pModel->Insert(rFilter.GetChildren().end(), pFilterItem);
}
// ensure there's one empty term in the filter, just in case the active term was previously empty
commit 72dff7984a26788d8c90f9dd63a1529931376d7f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:07:30 2015 +0100
coverity#735865 Dereference after null check
Change-Id: I6ebe8a0fb2e63b83406434d5fce0af8994f12458
diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx
index fe2de5c..37b37c8 100644
--- a/svx/source/form/filtnav.cxx
+++ b/svx/source/form/filtnav.cxx
@@ -176,10 +176,10 @@ FmFilterItem* FmFilterItems::Find( const ::sal_Int32 _nFilterComponentIndex ) co
++i
)
{
- FmFilterItem* pCondition = dynamic_cast<FmFilterItem*>( *i );
- DBG_ASSERT( pCondition, "FmFilterItems::Find: Wrong element in container!" );
- if ( _nFilterComponentIndex == pCondition->GetComponentIndex() )
- return pCondition;
+ FmFilterData* pData = *i;
+ FmFilterItem& rCondition = dynamic_cast<FmFilterItem&>(*pData);
+ if ( _nFilterComponentIndex == rCondition.GetComponentIndex() )
+ return &rCondition;
}
return NULL;
}
commit 36e2468151edc4dab1753ed2e41edf2a2867649b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:05:57 2015 +0100
coverity#735877 Dereference after null check
Change-Id: I04da87e895d9b6724dd48fa579008944118f87bc
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 2383688..1c45387 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -430,7 +430,7 @@ void SdrUndoAttrObj::Undo()
void SdrUndoAttrObj::Redo()
{
E3DModifySceneSnapRectUpdater aUpdater(pObj);
- bool bIs3DScene(pObj && dynamic_cast< E3dScene* >(pObj) != nullptr);
+ bool bIs3DScene(dynamic_cast< E3dScene* >(pObj) != nullptr);
if(!pUndoGroup || bIs3DScene)
{
commit 0d58da8ac132754331a7003d583b0181d713786e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:05:39 2015 +0100
coverity#735878 Dereference after null check
Change-Id: I7607cef90750b5a527ff74fd3d793ed7c3a3811c
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 44720da..2383688 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -323,7 +323,7 @@ SdrUndoAttrObj::~SdrUndoAttrObj()
void SdrUndoAttrObj::Undo()
{
E3DModifySceneSnapRectUpdater aUpdater(pObj);
- bool bIs3DScene(pObj && dynamic_cast< E3dScene* >(pObj) != nullptr);
+ bool bIs3DScene(dynamic_cast< E3dScene* >(pObj) != nullptr);
// Trigger PageChangeCall
ImpShowPageOfThisObject();
commit fcb49476b43f67daf24793e3fadb601342064684
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:04:58 2015 +0100
coverity#735879 Dereference after null check
Change-Id: I07661496c70fba3e012a3bb4f9bc592377eb124c
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index 44cf554..44720da 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -792,7 +792,6 @@ void SdrUndoInsertObj::Redo()
// <InsertObject(..)>. Needed for correct Redo in Writer. (#i45952#)
Point aAnchorPos( 0, 0 );
if ( pObjList &&
- pObjList->GetOwnerObj() &&
dynamic_cast<const SdrObjGroup*>(pObjList->GetOwnerObj()) != nullptr )
{
aAnchorPos = pObj->GetAnchorPos();
commit bbc0e62663e198ca9ff247ba4cc348c29523e0b5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:04:37 2015 +0100
coverity#735880 Dereference after null check
Change-Id: Id31bac44391f0319ec31c72b77f1b471c32d0a68
diff --git a/svx/source/svdraw/svdundo.cxx b/svx/source/svdraw/svdundo.cxx
index f903410..44cf554 100644
--- a/svx/source/svdraw/svdundo.cxx
+++ b/svx/source/svdraw/svdundo.cxx
@@ -730,7 +730,6 @@ void SdrUndoRemoveObj::Undo()
Point aOwnerAnchorPos(0, 0);
if(pObjList &&
- pObjList->GetOwnerObj() &&
dynamic_cast<const SdrObjGroup*>(pObjList->GetOwnerObj()) != nullptr)
{
aOwnerAnchorPos = pObjList->GetOwnerObj()->GetAnchorPos();
commit 15e75e05001bae7601d0d47a9eae809b14199392
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:03:05 2015 +0100
coverity#735962 Unchecked dynamic_cast
Change-Id: Ied30c917600d503ebcad2bcab01e38f26f7d30b3
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index d7f758f..637ec9e 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1010,12 +1010,11 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_PAGEDESC:
{
- const SwFormatPageDesc* pPageDesc = dynamic_cast<const SwFormatPageDesc*>( &rItem );
- OSL_ENSURE( pPageDesc != NULL, "Wrong Which-ID" );
+ const SwFormatPageDesc& rPageDesc = dynamic_cast<const SwFormatPageDesc&>(rItem);
if( MID_PAGEDESC_PAGENUMOFFSET==nMemberId )
{
- ::boost::optional<sal_uInt16> oNumOffset = pPageDesc->GetNumOffset();
+ ::boost::optional<sal_uInt16> oNumOffset = rPageDesc.GetNumOffset();
if (oNumOffset && oNumOffset.get() > 0)
{
// #i114163# positiveInteger only!
commit 841a3106c5826cfc834ea18411595f875dba3235
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:02:14 2015 +0100
coverity#735963 Unchecked dynamic_cast
Change-Id: I0ff0a1aeafed4f38772123596b477b8df68ca69a
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 3753d2e..d7f758f 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -897,8 +897,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_BACKGROUND:
{
- const SvxBrushItem* pBrush = dynamic_cast<const SvxBrushItem*>( &rItem );
- OSL_ENSURE( pBrush != NULL, "Wrong Which-ID" );
+ const SvxBrushItem& rBrush = dynamic_cast<const SvxBrushItem&>(rItem);
// note: the graphic is only exported if nMemberId equals
// MID_GRAPHIC..
@@ -907,21 +906,21 @@ bool SvXMLExportItemMapper::QueryXMLValue(
switch( nMemberId )
{
case MID_BACK_COLOR:
- if ( pBrush->GetColor().GetTransparency() )
+ if ( rBrush.GetColor().GetTransparency() )
aOut.append( GetXMLToken(XML_TRANSPARENT) );
else
{
::sax::Converter::convertColor(aOut,
- pBrush->GetColor().GetColor());
+ rBrush.GetColor().GetColor());
}
bOk = true;
break;
case MID_GRAPHIC_LINK:
- if( pBrush->GetGraphicPos() != GPOS_NONE )
+ if (rBrush.GetGraphicPos() != GPOS_NONE)
{
uno::Any aAny;
- pBrush->QueryValue( aAny, MID_GRAPHIC_URL );
+ rBrush.QueryValue( aAny, MID_GRAPHIC_URL );
OUString sTmp;
aAny >>= sTmp;
aOut.append( sTmp );
@@ -930,7 +929,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
break;
case MID_GRAPHIC_POSITION:
- switch( pBrush->GetGraphicPos() )
+ switch (rBrush.GetGraphicPos())
{
case GPOS_LT:
case GPOS_MT:
@@ -958,7 +957,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
{
aOut.append( ' ' );
- switch( pBrush->GetGraphicPos() )
+ switch (rBrush.GetGraphicPos())
{
case GPOS_LT:
case GPOS_LB:
@@ -983,7 +982,7 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case MID_GRAPHIC_REPEAT:
{
- SvxGraphicPosition eGraphicPos = pBrush->GetGraphicPos();
+ SvxGraphicPosition eGraphicPos = rBrush.GetGraphicPos();
if( GPOS_AREA == eGraphicPos )
{
aOut.append( GetXMLToken(XML_BACKGROUND_STRETCH) );
@@ -998,10 +997,10 @@ bool SvXMLExportItemMapper::QueryXMLValue(
break;
case MID_GRAPHIC_FILTER:
- if( pBrush->GetGraphicPos() != GPOS_NONE &&
- !pBrush->GetGraphicFilter().isEmpty() )
+ if (rBrush.GetGraphicPos() != GPOS_NONE &&
+ !rBrush.GetGraphicFilter().isEmpty())
{
- aOut.append( pBrush->GetGraphicFilter() );
+ aOut.append(rBrush.GetGraphicFilter());
bOk = true;
}
break;
commit 6dd3c3558291f8b23e339efd967a1ef76021b1cf
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:01:06 2015 +0100
coverity#735965 Unchecked dynamic_cast
Change-Id: Iaeccbd37ae67a6893690d2cff5897678b81b23a0
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index bc58820..3753d2e 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -1071,33 +1071,32 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_FRM_SIZE:
{
- const SwFormatFrmSize* pFrmSize = dynamic_cast<const SwFormatFrmSize*>( &rItem );
- OSL_ENSURE( pFrmSize != NULL, "Wrong Which-ID" );
+ const SwFormatFrmSize& rFrmSize = dynamic_cast<const SwFormatFrmSize&>(rItem);
bool bOutHeight = false;
switch( nMemberId )
{
case MID_FRMSIZE_REL_WIDTH:
- if( pFrmSize->GetWidthPercent() )
+ if (rFrmSize.GetWidthPercent())
{
::sax::Converter::convertPercent(
- aOut, pFrmSize->GetWidthPercent() );
+ aOut, rFrmSize.GetWidthPercent() );
bOk = true;
}
break;
case MID_FRMSIZE_MIN_HEIGHT:
- if( ATT_MIN_SIZE == pFrmSize->GetHeightSizeType() )
+ if( ATT_MIN_SIZE == rFrmSize.GetHeightSizeType() )
bOutHeight = true;
break;
case MID_FRMSIZE_FIX_HEIGHT:
- if( ATT_FIX_SIZE == pFrmSize->GetHeightSizeType() )
+ if( ATT_FIX_SIZE == rFrmSize.GetHeightSizeType() )
bOutHeight = true;
break;
}
if( bOutHeight )
{
- rUnitConverter.convertMeasureToXML(aOut, pFrmSize->GetHeight());
+ rUnitConverter.convertMeasureToXML(aOut, rFrmSize.GetHeight());
bOk = true;
}
}
commit d7b75ef4ff20318c16ede48b7daa7b8c3240496d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 10:00:22 2015 +0100
coverity#735966 Unchecked dynamic_cast
Change-Id: Ib949aab22c8fe001d15d536abbf6984df86f5a03
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index d541e47..bc58820 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -384,60 +384,59 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_LR_SPACE:
{
- const SvxLRSpaceItem* pLRSpace = dynamic_cast<const SvxLRSpaceItem*>( &rItem );
- OSL_ENSURE( pLRSpace != NULL, "Wrong Which-ID!" );
+ const SvxLRSpaceItem& rLRSpace = dynamic_cast<const SvxLRSpaceItem&>(rItem);
bOk = true;
switch( nMemberId )
{
case MID_L_MARGIN:
- if(pLRSpace->GetPropLeft() != 100)
+ if (rLRSpace.GetPropLeft() != 100)
{
::sax::Converter::convertPercent(
- aOut, pLRSpace->GetPropLeft() );
+ aOut, rLRSpace.GetPropLeft() );
}
else
{
rUnitConverter.convertMeasureToXML(
- aOut, pLRSpace->GetLeft() );
+ aOut, rLRSpace.GetLeft() );
}
break;
case MID_R_MARGIN:
- if(pLRSpace->GetPropRight() != 100)
+ if (rLRSpace.GetPropRight() != 100)
{
::sax::Converter::convertPercent(
- aOut, pLRSpace->GetPropRight() );
+ aOut, rLRSpace.GetPropRight() );
}
else
{
rUnitConverter.convertMeasureToXML(
- aOut, pLRSpace->GetRight() );
+ aOut, rLRSpace.GetRight() );
}
break;
case MID_FIRST_AUTO:
- if( pLRSpace->IsAutoFirst() )
+ if (rLRSpace.IsAutoFirst())
{
::sax::Converter::convertBool(
- aOut, pLRSpace->IsAutoFirst() );
+ aOut, rLRSpace.IsAutoFirst() );
}
else
bOk = false;
break;
case MID_FIRST_LINE_INDENT:
- if( !pLRSpace->IsAutoFirst() )
+ if (!rLRSpace.IsAutoFirst())
{
- if(pLRSpace->GetPropTextFirstLineOfst() != 100)
+ if (rLRSpace.GetPropTextFirstLineOfst() != 100)
{
::sax::Converter::convertPercent(
- aOut, pLRSpace->GetPropTextFirstLineOfst() );
+ aOut, rLRSpace.GetPropTextFirstLineOfst() );
}
else
{
rUnitConverter.convertMeasureToXML(
- aOut, pLRSpace->GetTextFirstLineOfst() );
+ aOut, rLRSpace.GetTextFirstLineOfst() );
}
}
else
commit cbe3b018d2b6878778167c35994cda510226fba7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:58:55 2015 +0100
coverity#735967 Unchecked dynamic_cast
Change-Id: Id092c99e6106ff73f4ea9ebdc2eb39330f894423
diff --git a/sw/source/filter/xml/xmlexpit.cxx b/sw/source/filter/xml/xmlexpit.cxx
index 1e61266..d541e47 100644
--- a/sw/source/filter/xml/xmlexpit.cxx
+++ b/sw/source/filter/xml/xmlexpit.cxx
@@ -454,34 +454,33 @@ bool SvXMLExportItemMapper::QueryXMLValue(
case RES_UL_SPACE:
{
- const SvxULSpaceItem* pULSpace = dynamic_cast<const SvxULSpaceItem*>( &rItem );
- OSL_ENSURE( pULSpace != NULL, "Wrong Which-ID!" );
+ const SvxULSpaceItem& rULSpace = dynamic_cast<const SvxULSpaceItem&>(rItem);
switch( nMemberId )
{
case MID_UP_MARGIN:
- if( pULSpace->GetPropUpper() != 100 )
+ if (rULSpace.GetPropUpper() != 100)
{
::sax::Converter::convertPercent(
- aOut, pULSpace->GetPropUpper() );
+ aOut, rULSpace.GetPropUpper() );
}
else
{
rUnitConverter.convertMeasureToXML(
- aOut, pULSpace->GetUpper() );
+ aOut, rULSpace.GetUpper() );
}
break;
case MID_LO_MARGIN:
- if( pULSpace->GetPropLower() != 100 )
+ if (rULSpace.GetPropLower() != 100)
{
::sax::Converter::convertPercent(
- aOut, pULSpace->GetPropLower() );
+ aOut, rULSpace.GetPropLower() );
}
else
{
rUnitConverter.convertMeasureToXML(
- aOut, pULSpace->GetLower() );
+ aOut, rULSpace.GetLower() );
}
break;
commit 0087fb06dce8e705293434df67409786143c2a59
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:57:55 2015 +0100
coverity#735968 Unchecked dynamic_cast
Change-Id: Idf9b26180f824321bd5e07e9a9360bb9e59472dd
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 38e4ad5..71cede0 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -229,16 +229,16 @@ struct BoxHolder : private boost::noncopyable
SvxBorderLine* pLeft;
SvxBorderLine* pRight;
- explicit BoxHolder(SvxBoxItem* pBox)
+ explicit BoxHolder(SvxBoxItem& rBox)
{
- pTop = pBox->GetTop() == NULL ?
- NULL : new SvxBorderLine( *pBox->GetTop() );
- pBottom = pBox->GetBottom() == NULL ?
- NULL : new SvxBorderLine( *pBox->GetBottom() );
- pLeft = pBox->GetLeft() == NULL ?
- NULL : new SvxBorderLine( *pBox->GetLeft() );
- pRight = pBox->GetRight() == NULL ?
- NULL : new SvxBorderLine( *pBox->GetRight() );
+ pTop = rBox.GetTop() == NULL ?
+ NULL : new SvxBorderLine( *rBox.GetTop() );
+ pBottom = rBox.GetBottom() == NULL ?
+ NULL : new SvxBorderLine( *rBox.GetBottom() );
+ pLeft = rBox.GetLeft() == NULL ?
+ NULL : new SvxBorderLine( *rBox.GetLeft() );
+ pRight = rBox.GetRight() == NULL ?
+ NULL : new SvxBorderLine( *rBox.GetRight() );
}
~BoxHolder()
@@ -433,11 +433,10 @@ bool SvXMLImportItemMapper::PutXMLValue(
case RES_BOX:
{
- SvxBoxItem* pBox = dynamic_cast<SvxBoxItem*>( &rItem );
- OSL_ENSURE( pBox != NULL, "Wrong WHich-ID" );
+ SvxBoxItem& rBox = dynamic_cast<SvxBoxItem&>(rItem);
// copy SvxBorderLines
- BoxHolder aBoxes(pBox);
+ BoxHolder aBoxes(rBox);
sal_Int32 nTemp;
@@ -456,16 +455,16 @@ bool SvXMLImportItemMapper::PutXMLValue(
if( nMemberId == LEFT_BORDER_PADDING ||
nMemberId == ALL_BORDER_PADDING )
- pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::LEFT );
+ rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::LEFT );
if( nMemberId == RIGHT_BORDER_PADDING ||
nMemberId == ALL_BORDER_PADDING )
- pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::RIGHT );
+ rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::RIGHT );
if( nMemberId == TOP_BORDER_PADDING ||
nMemberId == ALL_BORDER_PADDING )
- pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::TOP );
+ rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::TOP );
if( nMemberId == BOTTOM_BORDER_PADDING ||
nMemberId == ALL_BORDER_PADDING )
- pBox->SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::BOTTOM);
+ rBox.SetDistance( (sal_uInt16)nTemp, SvxBoxItemLine::BOTTOM);
break;
case ALL_BORDER:
@@ -578,10 +577,10 @@ bool SvXMLImportItemMapper::PutXMLValue(
break;
}
- pBox->SetLine( aBoxes.pTop, SvxBoxItemLine::TOP );
- pBox->SetLine( aBoxes.pBottom, SvxBoxItemLine::BOTTOM );
- pBox->SetLine( aBoxes.pLeft, SvxBoxItemLine::LEFT );
- pBox->SetLine( aBoxes.pRight, SvxBoxItemLine::RIGHT );
+ rBox.SetLine( aBoxes.pTop, SvxBoxItemLine::TOP );
+ rBox.SetLine( aBoxes.pBottom, SvxBoxItemLine::BOTTOM );
+ rBox.SetLine( aBoxes.pLeft, SvxBoxItemLine::LEFT );
+ rBox.SetLine( aBoxes.pRight, SvxBoxItemLine::RIGHT );
bOk = true;
}
commit b7f9175ec4bb48a420a42f35908ac3e514d36fd5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:56:14 2015 +0100
coverity#735969 Unchecked dynamic_cast
Change-Id: I929352a6c743effee70a2a233fb366edddac2147
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index 513bf07..38e4ad5 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -353,8 +353,7 @@ bool SvXMLImportItemMapper::PutXMLValue(
case RES_SHADOW:
{
- SvxShadowItem* pShadow = dynamic_cast<SvxShadowItem*>( &rItem );
- OSL_ENSURE( pShadow != NULL, "Wrong Which-ID" );
+ SvxShadowItem& rShadow = dynamic_cast<SvxShadowItem&>(rItem);
bool bColorFound = false;
bool bOffsetFound = false;
@@ -362,14 +361,14 @@ bool SvXMLImportItemMapper::PutXMLValue(
SvXMLTokenEnumerator aTokenEnum( rValue );
Color aColor( 128,128, 128 );
- pShadow->SetLocation( SVX_SHADOW_BOTTOMRIGHT );
+ rShadow.SetLocation( SVX_SHADOW_BOTTOMRIGHT );
OUString aToken;
while( aTokenEnum.getNextToken( aToken ) )
{
if( IsXMLToken( aToken, XML_NONE ) )
{
- pShadow->SetLocation( SVX_SHADOW_NONE );
+ rShadow.SetLocation( SVX_SHADOW_NONE );
bOk = true;
}
else if( !bColorFound && aToken.startsWith("#") )
@@ -396,36 +395,36 @@ bool SvXMLImportItemMapper::PutXMLValue(
{
if( nY < 0 )
{
- pShadow->SetLocation( SVX_SHADOW_TOPLEFT );
+ rShadow.SetLocation( SVX_SHADOW_TOPLEFT );
}
else
{
- pShadow->SetLocation( SVX_SHADOW_BOTTOMLEFT );
+ rShadow.SetLocation( SVX_SHADOW_BOTTOMLEFT );
}
}
else
{
if( nY < 0 )
{
- pShadow->SetLocation( SVX_SHADOW_TOPRIGHT );
+ rShadow.SetLocation( SVX_SHADOW_TOPRIGHT );
}
else
{
- pShadow->SetLocation( SVX_SHADOW_BOTTOMRIGHT );
+ rShadow.SetLocation( SVX_SHADOW_BOTTOMRIGHT );
}
}
if( nX < 0 ) nX *= -1;
if( nY < 0 ) nY *= -1;
- pShadow->SetWidth( static_cast< sal_uInt16 >( (nX + nY) >> 1 ) );
+ rShadow.SetWidth( static_cast< sal_uInt16 >( (nX + nY) >> 1 ) );
}
}
}
if( bOk && ( bColorFound || bOffsetFound ) )
{
- pShadow->SetColor( aColor );
+ rShadow.SetColor(aColor);
}
else
bOk = false;
commit 658f218ba71159eb9945d2c69728359637c4da78
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:55:24 2015 +0100
coverity#735970 Unchecked dynamic_cast
Change-Id: I05a9fdd43ba821a9071728ef2be72d3a485a8a09
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index e86068e..513bf07 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -955,17 +955,16 @@ bool SvXMLImportItemMapper::PutXMLValue(
case RES_COLLAPSING_BORDERS:
{
- SfxBoolItem* pBorders = dynamic_cast<SfxBoolItem*>( &rItem );
- OSL_ENSURE( pBorders != NULL, "Wrong Which-ID" );
+ SfxBoolItem& rBorders = dynamic_cast<SfxBoolItem&>(rItem);
if( IsXMLToken( rValue, XML_COLLAPSING ) )
{
- pBorders->SetValue( true );
+ rBorders.SetValue(true);
bOk = true;
}
else if( IsXMLToken( rValue, XML_SEPARATING ) )
{
- pBorders->SetValue( false );
+ rBorders.SetValue(false);
bOk = true;
}
else
commit e8a93a14039801598f0619d34afc84eec01de6d6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:54:46 2015 +0100
coverity#735971 Unchecked dynamic_cast
Change-Id: Iefd64baa09c3f6bfaf1cc43483ae1451e5b2c6ad
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index a905f96..e86068e 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -822,14 +822,13 @@ bool SvXMLImportItemMapper::PutXMLValue(
case RES_HORI_ORIENT:
{
- SwFormatHoriOrient* pHoriOrient = dynamic_cast<SwFormatHoriOrient*>( &rItem );
- OSL_ENSURE( pHoriOrient != NULL, "Wrong Which-ID" );
+ SwFormatHoriOrient& rHoriOrient = dynamic_cast<SwFormatHoriOrient&>(rItem);
sal_uInt16 nValue;
bOk = SvXMLUnitConverter::convertEnum( nValue, rValue,
aXMLTableAlignMap );
if( bOk )
- pHoriOrient->SetHoriOrient( nValue );
+ rHoriOrient.SetHoriOrient( nValue );
}
break;
commit 7c7d42b6ebe477876b56d97069e0f05a9847ff7b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:54:06 2015 +0100
coverity#735972 Unchecked dynamic_cast
Change-Id: I4839b4598216eda9ac2db2ebe2aff3f5baaae9e8
diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx
index d68c979..a905f96 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -835,18 +835,17 @@ bool SvXMLImportItemMapper::PutXMLValue(
case RES_VERT_ORIENT:
{
- SwFormatVertOrient* pVertOrient = dynamic_cast<SwFormatVertOrient*>( &rItem );
- OSL_ENSURE( pVertOrient != NULL, "Wrong Which-ID" );
+ SwFormatVertOrient& rVertOrient = dynamic_cast<SwFormatVertOrient&>(rItem);
sal_uInt16 nValue;
bOk = SvXMLUnitConverter::convertEnum( nValue, rValue,
aXMLTableVAlignMap );
if( bOk )
- pVertOrient->SetVertOrient( nValue );
+ rVertOrient.SetVertOrient( nValue );
//#i8855# text::VertOrientation::NONE is stored as empty string and should be applied here
else if(rValue.isEmpty())
{
- pVertOrient->SetVertOrient( text::VertOrientation::NONE );
+ rVertOrient.SetVertOrient( text::VertOrientation::NONE );
bOk = true;
}
}
commit bbc91b7a0c309c5022a8f34fd7e5310dbc0411a0
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:52:20 2015 +0100
coverity#1326107 Unchecked return value
Change-Id: I6f2dc9c12349a5175ed34e22fa29d875d6b9bd0a
diff --git a/store/source/storpage.cxx b/store/source/storpage.cxx
index f49a894..a501826 100644
--- a/store/source/storpage.cxx
+++ b/store/source/storpage.cxx
@@ -778,7 +778,7 @@ storeError OStorePageManager::remove (const OStorePageKey &rKey)
base::releasePage (aDescr);
// Release and free directory page.
- base::free (aPage.location());
+ (void)base::free (aPage.location());
}
// Remove entry.
commit 750542c704afdad0f36f5bba22dd946bc902292b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:50:25 2015 +0100
coverity#1326119 Constant expression result
Change-Id: Id8e2e21ed5dc77b92b82bbc8000c06dcd660496e
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 0262329..f1ff60c 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1054,7 +1054,7 @@ void SwBaseShell::Execute(SfxRequest &rReq)
case FLY_AT_PARA:
// left, from left, right, top, no wrap, wrap left and right
- if(eSurround != SURROUND_LEFT || eSurround != SURROUND_RIGHT)
+ if (eSurround != SURROUND_LEFT && eSurround != SURROUND_RIGHT)
aSet.Put(SwFormatSurround(SURROUND_LEFT));
if( eVOrient != text::VertOrientation::TOP)
commit 2a8559769ed807eb6384d1ea9ceb275d60924337
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:42:43 2015 +0100
coverity#1326206 Dereference after null check
Change-Id: I187c182a1645cdd38c81bc72b3c836ab21725173
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 1b5e10d..bf38170 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -3098,19 +3098,19 @@ const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos )
return pFrm;
}
-bool Is_Lower_Of( const SwFrm *pCurrFrm, const SdrObject* pObj )
+bool Is_Lower_Of(const SwFrm *pCurrFrm, const SdrObject* pObj)
{
Point aPos;
const SwFrm* pFrm;
- if( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) != nullptr )
+ if (const SwVirtFlyDrawObj *pFlyDrawObj = dynamic_cast<const SwVirtFlyDrawObj*>(pObj))
{
- const SwFlyFrm* pFly = static_cast<const SwVirtFlyDrawObj*>(pObj )->GetFlyFrm();
+ const SwFlyFrm* pFly = pFlyDrawObj->GetFlyFrm();
pFrm = pFly->GetAnchorFrm();
aPos = pFly->Frm().Pos();
}
else
{
- pFrm = static_cast<SwDrawContact*>(GetUserCall(pObj) )->GetAnchorFrm(pObj);
+ pFrm = static_cast<SwDrawContact*>(GetUserCall(pObj))->GetAnchorFrm(pObj);
aPos = pObj->GetCurrentBoundRect().TopLeft();
}
OSL_ENSURE( pFrm, "8-( Fly is lost in Space." );
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index da194ae..ff93cce 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -665,10 +665,9 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj,
// #i26945#
const SdrObject* pNew = _pAnchoredObj->GetDrawObj();
// #102344# Ignore connectors which have one or more connections
- if(pNew && dynamic_cast< const SdrEdgeObj *>( pNew ) != nullptr)
+ if (const SdrEdgeObj* pEdgeObj = dynamic_cast<const SdrEdgeObj*>(pNew))
{
- if(static_cast<const SdrEdgeObj*>(pNew)->GetConnectedNode(true)
- || static_cast<const SdrEdgeObj*>(pNew)->GetConnectedNode(false))
+ if (pEdgeObj->GetConnectedNode(true) || pEdgeObj->GetConnectedNode(false))
{
return false;
}
commit 0aca6eb71c148f1c3a72df9c2f6da6d4364106b8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:38:01 2015 +0100
coverity#1326208 Unchecked dynamic_cast
and
coverity#1326207 Unchecked dynamic_cast
Change-Id: Icaf60592f1be2aeea1d010241965df7f9e76f2c7
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 5161818..dfa2bbf 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -3780,10 +3780,8 @@ uno::Reference< container::XIndexContainer > SAL_CALL SvxShape::getGluePoints()
return xGluePoints;
}
-
-
// XChild
-uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
+uno::Reference<uno::XInterface> SAL_CALL SvxShape::getParent()
throw(uno::RuntimeException, std::exception)
{
::SolarMutexGuard aGuard;
@@ -3792,29 +3790,26 @@ uno::Reference< uno::XInterface > SAL_CALL SvxShape::getParent( )
{
SdrObjList* pObjList = mpObj->GetObjList();
- switch( pObjList->GetListKind() )
+ switch (pObjList->GetListKind())
{
- case SDROBJLIST_GROUPOBJ:
- if(dynamic_cast<const SdrObjGroup*>( pObjList->GetOwnerObj()) != nullptr )
- return dynamic_cast<SdrObjGroup*>( pObjList->GetOwnerObj())->getUnoShape( );
- else if( dynamic_cast<const E3dScene* >(pObjList->GetOwnerObj() ) != nullptr)
- return dynamic_cast< E3dScene* >(pObjList->GetOwnerObj())->getUnoShape();
- break;
- case SDROBJLIST_DRAWPAGE:
- case SDROBJLIST_MASTERPAGE:
- return dynamic_cast<SdrPage*>( pObjList )->getUnoPage( );
- default:
- OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
- break;
+ case SDROBJLIST_GROUPOBJ:
+ if (SdrObjGroup *pGroup = dynamic_cast<SdrObjGroup*>(pObjList->GetOwnerObj()))
+ return pGroup->getUnoShape();
+ else if (E3dScene *pScene = dynamic_cast<E3dScene*>(pObjList->GetOwnerObj()))
+ return pScene->getUnoShape();
+ break;
+ case SDROBJLIST_DRAWPAGE:
+ case SDROBJLIST_MASTERPAGE:
+ return dynamic_cast<SdrPage&>(*pObjList).getUnoPage();
+ default:
+ OSL_FAIL( "SvxShape::getParent( ): unexpected SdrObjListKind" );
+ break;
}
}
- uno::Reference< uno::XInterface > xParent;
- return xParent;
+ return uno::Reference<uno::XInterface>();
}
-
-
void SAL_CALL SvxShape::setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& )
throw(lang::NoSupportException, uno::RuntimeException, std::exception)
{
commit e7515cdae07369ced5eca5b5845bd3679bee10b6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:35:26 2015 +0100
coverity#1326209 Dereference after null check
Change-Id: Ie8a10cb0f92758b45aff456f52331092e8a4e1df
diff --git a/sd/source/ui/func/fuformatpaintbrush.cxx b/sd/source/ui/func/fuformatpaintbrush.cxx
index 8c6ff03..6ffcbbd 100644
--- a/sd/source/ui/func/fuformatpaintbrush.cxx
+++ b/sd/source/ui/func/fuformatpaintbrush.cxx
@@ -204,7 +204,7 @@ bool FuFormatPaintBrush::MouseButtonUp(const MouseEvent& rMEvt)
bool FuFormatPaintBrush::KeyInput(const KeyEvent& rKEvt)
{
- if( (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE) && mpViewShell )
+ if (rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE)
{
implcancel();
return true;
commit 8e7306604d3e5ac883abef1f3518ae04a392431f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:30:02 2015 +0100
coverity#1326215 Dereference after null check
and
coverity#1326214 Dereference after null check
coverity#1326213 Dereference after null check
coverity#1326212 Dereference after null check
Change-Id: I0596ace920dd4134f1a55272fdc60c761fefac16
diff --git a/filter/source/t602/t602filter.cxx b/filter/source/t602/t602filter.cxx
index 8a243fd..a834e64 100644
--- a/filter/source/t602/t602filter.cxx
+++ b/filter/source/t602/t602filter.cxx
@@ -120,7 +120,8 @@ namespace T602ImportFilter {
if (mxHandler.is()) \
{ \
mxHandler->startElement(_nam, mAttrList); \
- mpAttrList->Clear(); \
+ if (mpAttrList) \
+ mpAttrList->Clear(); \
}
#define _End(_nam) \
commit bc1e9eaf6ce041addd094b8f85959d3cccb2476e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Oct 14 09:27:25 2015 +0100
coverity#1326267 Unchecked dynamic_cast
Change-Id: I93e68a9e19ba927a958a7d0b12607ec7bf4a40e1
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 1a52df3..0f5fd71 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -742,18 +742,17 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
m_aTimer.SetTimeout( 120 );
- SwDocShell* pDocSh = dynamic_cast<SwDocShell*>( _pFrame->GetObjectShell() );
- OSL_ENSURE( pDocSh, "view without DocShell." );
- bool bOldModifyFlag = pDocSh->IsEnableSetModified();
- if(bOldModifyFlag)
- pDocSh->EnableSetModified( false );
+ SwDocShell& rDocSh = dynamic_cast<SwDocShell&>(*_pFrame->GetObjectShell());
+ bool bOldModifyFlag = rDocSh.IsEnableSetModified();
+ if (bOldModifyFlag)
+ rDocSh.EnableSetModified( false );
// HACK: SwDocShell has some cached font info, VCL informs about font updates,
// but loading of docs with embedded fonts happens after SwDocShell is created
// but before SwEditWin (which handles the VCL event) is created. So update
// manually.
- if( pDocSh->GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS ))
- pDocSh->UpdateFontList();
- bool bWebDShell = dynamic_cast< const SwWebDocShell *>( pDocSh ) != nullptr;
+ if (rDocSh.GetDoc()->getIDocumentSettingAccess().get( DocumentSettingId::EMBED_FONTS ))
+ rDocSh.UpdateFontList();
+ bool bWebDShell = dynamic_cast<const SwWebDocShell*>(&rDocSh) != nullptr;
const SwMasterUsrPref *pUsrPref = SW_MOD()->GetUsrPref(bWebDShell);
SwViewOption aUsrPref( *pUsrPref);
@@ -785,19 +784,17 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
}
SAL_INFO( "sw.ui", "before create WrtShell" );
- if(dynamic_cast<SwView*>( pExistingSh) )
+ if (SwView *pView = dynamic_cast<SwView*>(pExistingSh))
{
- m_pWrtShell = new SwWrtShell( *static_cast<SwView*>(pExistingSh)->m_pWrtShell,
- m_pEditWin, *this);
+ m_pWrtShell = new SwWrtShell(*pView->m_pWrtShell, m_pEditWin, *this);
}
- else if( dynamic_cast<SwWrtShell*>( pDocSh->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) )
+ else if (SwWrtShell *pWrtShell = dynamic_cast<SwWrtShell*>(rDocSh.GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()))
{
- m_pWrtShell = new SwWrtShell( *static_cast<SwWrtShell*>(pDocSh->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell()),
- m_pEditWin, *this);
+ m_pWrtShell = new SwWrtShell(*pWrtShell, m_pEditWin, *this);
}
else
{
- SwDoc& rDoc = *static_cast<SwDocShell*>(pDocSh)->GetDoc();
+ SwDoc& rDoc = *static_cast<SwDocShell&>(rDocSh).GetDoc();
if( !bOldShellWasSrcView && bWebDShell && !m_bOldShellWasPagePreview )
aUsrPref.setBrowseMode( true );
@@ -810,7 +807,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
aUsrPref.SetZoomType( SvxZoomType::PERCENT );
aUsrPref.SetZoom( 100 );
}
- if(pDocSh->IsPreview())
+ if (rDocSh.IsPreview())
{
aUsrPref.SetZoomType( SvxZoomType::WHOLEPAGE );
aUsrPref.SetViewLayoutBookMode( false );
@@ -859,7 +856,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
// no margin for OLE!
Size aBrwsBorder;
- if( SfxObjectCreateMode::EMBEDDED != pDocSh->GetCreateMode() )
+ if( SfxObjectCreateMode::EMBEDDED != rDocSh.GetCreateMode() )
aBrwsBorder = GetMargin();
m_pWrtShell->SetBrowseBorder( aBrwsBorder );
@@ -879,8 +876,8 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
aUsrPref.SetViewVRuler(false);
}
- StartListening( *pViewFrame, true );
- StartListening( *pDocSh, true );
+ StartListening(*pViewFrame, true);
+ StartListening(rDocSh, true);
// Set Zoom-factor from HRuler
Fraction aZoomFract( aUsrPref.GetZoom(), 100 );
@@ -897,7 +894,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
m_pVRuler->SetLineHeight( 551 ); // default line height
// Set DocShell
- pDocSh->SetView( this );
+ rDocSh.SetView(this);
SW_MOD()->SetView( this );
m_pPostItMgr = new SwPostItMgr(this);
@@ -910,9 +907,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
// Set AttrChangedNotify link
m_pWrtShell->SetChgLnk(LINK(this, SwView, AttrChangedNotify));
- if( pDocSh->GetCreateMode() == SfxObjectCreateMode::EMBEDDED &&
- !pDocSh->GetVisArea(ASPECT_CONTENT).IsEmpty() )
- SetVisArea( pDocSh->GetVisArea(ASPECT_CONTENT),false);
+ if (rDocSh.GetCreateMode() == SfxObjectCreateMode::EMBEDDED &&
+ !rDocSh.GetVisArea(ASPECT_CONTENT).IsEmpty())
+ SetVisArea(rDocSh.GetVisArea(ASPECT_CONTENT),false);
SAL_WARN_IF(
officecfg::Office::Common::Undo::Steps::get() <= 0,
@@ -960,7 +957,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
// No ResetModified, if there is already a view to this doc.
SfxViewFrame* pVFrame = GetViewFrame();
- SfxViewFrame* pFirst = SfxViewFrame::GetFirst(pDocSh);
+ SfxViewFrame* pFirst = SfxViewFrame::GetFirst(&rDocSh);
// Currently(360) the view is registered firstly after the CTOR,
// the following expression is also working if this changes.
// If the modification cannot be canceled by undo, then do NOT set
@@ -977,7 +974,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
g_bNoInterrupt = bOld;
// If a new GlobalDoc will be created, the navigator will also be generated.
- if( dynamic_cast<const SwGlobalDocShell*>(pDocSh) != nullptr &&
+ if( dynamic_cast<const SwGlobalDocShell*>(&rDocSh) != nullptr &&
!pVFrame->GetChildWindow( SID_NAVIGATOR ))
{
SfxBoolItem aNavi(SID_NAVIGATOR, true);
@@ -1004,8 +1001,8 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
m_aTimer.SetTimeoutHdl(LINK(this, SwView, TimeoutHdl));
m_bAttrChgNotified = m_bAttrChgNotifiedWithRegistrations = false;
- if(bOldModifyFlag)
- pDocSh->EnableSetModified();
+ if (bOldModifyFlag)
+ rDocSh.EnableSetModified();
InvalidateBorder();
if( !m_pHScrollbar->IsVisible( true ) )
More information about the Libreoffice-commits
mailing list