loplugin:staticdynamic now with extra salt
because it wasn't quite there yet - now checks for casts with and without const, because const doesn't really matter here. Change-Id: I319025b2095a803fcaad2a7a696d2730b7fd2f81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112098 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -80,6 +80,18 @@ bool StaticDynamic::TraverseCompoundStmt(CompoundStmt* compoundStmt)
|
||||
return ret;
|
||||
}
|
||||
|
||||
const clang::Type* strip(QualType qt)
|
||||
{
|
||||
const clang::Type* varType = qt->getUnqualifiedDesugaredType();
|
||||
if (varType->isPointerType())
|
||||
varType = varType->getPointeeType()->getUnqualifiedDesugaredType();
|
||||
if (varType->isReferenceType())
|
||||
varType = varType->getAs<clang::ReferenceType>()
|
||||
->getPointeeType()
|
||||
->getUnqualifiedDesugaredType();
|
||||
return varType;
|
||||
}
|
||||
|
||||
bool StaticDynamic::VisitCXXStaticCastExpr(CXXStaticCastExpr const* staticCastExpr)
|
||||
{
|
||||
if (ignoreLocation(staticCastExpr))
|
||||
@@ -90,8 +102,8 @@ bool StaticDynamic::VisitCXXStaticCastExpr(CXXStaticCastExpr const* staticCastEx
|
||||
auto varDecl = dyn_cast_or_null<VarDecl>(subExprDecl->getDecl());
|
||||
if (!varDecl)
|
||||
return true;
|
||||
auto it = blockState.dynamicCastVars.find(
|
||||
{ varDecl, staticCastExpr->getTypeAsWritten().getTypePtr() });
|
||||
auto varType = strip(staticCastExpr->getType());
|
||||
auto it = blockState.dynamicCastVars.find({ varDecl, varType });
|
||||
if (it != blockState.dynamicCastVars.end())
|
||||
{
|
||||
StringRef fn = getFilenameOfLocation(
|
||||
@@ -110,8 +122,7 @@ bool StaticDynamic::VisitCXXStaticCastExpr(CXXStaticCastExpr const* staticCastEx
|
||||
report(DiagnosticsEngine::Note, "dynamic_cast here", it->second);
|
||||
return true;
|
||||
}
|
||||
blockState.staticCastVars.insert({ { varDecl, staticCastExpr->getTypeAsWritten().getTypePtr() },
|
||||
compat::getBeginLoc(staticCastExpr) });
|
||||
blockState.staticCastVars.insert({ { varDecl, varType }, compat::getBeginLoc(staticCastExpr) });
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -126,8 +137,8 @@ bool StaticDynamic::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const* dynamicCas
|
||||
auto varDecl = dyn_cast_or_null<VarDecl>(subExprDecl->getDecl());
|
||||
if (!varDecl)
|
||||
return true;
|
||||
auto it = blockState.staticCastVars.find(
|
||||
{ varDecl, dynamicCastExpr->getTypeAsWritten().getTypePtr() });
|
||||
auto varType = strip(dynamicCastExpr->getTypeAsWritten());
|
||||
auto it = blockState.staticCastVars.find({ varDecl, varType });
|
||||
if (it != blockState.staticCastVars.end())
|
||||
{
|
||||
report(DiagnosticsEngine::Warning, "dynamic_cast after static_cast",
|
||||
@@ -145,8 +156,7 @@ bool StaticDynamic::VisitCXXDynamicCastExpr(CXXDynamicCastExpr const* dynamicCas
|
||||
return true;
|
||||
}
|
||||
blockState.dynamicCastVars.insert(
|
||||
{ { varDecl, dynamicCastExpr->getTypeAsWritten().getTypePtr() },
|
||||
compat::getBeginLoc(dynamicCastExpr) });
|
||||
{ { varDecl, varType }, compat::getBeginLoc(dynamicCastExpr) });
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ struct ClassA
|
||||
|
||||
struct ClassB : public ClassA
|
||||
{
|
||||
void foo() {}
|
||||
void foo() const {}
|
||||
};
|
||||
|
||||
void f1(ClassA* p1)
|
||||
@@ -33,4 +33,12 @@ void f2(ClassA* p1)
|
||||
static_cast<ClassB*>(p1)->foo();
|
||||
};
|
||||
|
||||
void f3(ClassA* p1)
|
||||
{
|
||||
// expected-note@+1 {{dynamic_cast here [loplugin:staticdynamic]}}
|
||||
dynamic_cast<const ClassB*>(p1)->foo();
|
||||
// expected-error@+1 {{static_cast after dynamic_cast [loplugin:staticdynamic]}}
|
||||
static_cast<ClassB*>(p1)->foo();
|
||||
};
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
|
||||
@@ -3225,14 +3225,19 @@ void ScInterpreter::ScMacro()
|
||||
}
|
||||
|
||||
SbxVariable* pVar = pRoot ? pRoot->Find(aMacro, SbxClassType::Method) : nullptr;
|
||||
if( !pVar || pVar->GetType() == SbxVOID || dynamic_cast<const SbMethod*>( pVar) == nullptr )
|
||||
if( !pVar || pVar->GetType() == SbxVOID )
|
||||
{
|
||||
PushError( FormulaError::NoMacro );
|
||||
return;
|
||||
}
|
||||
SbMethod* pMethod = dynamic_cast<SbMethod*>(pVar);
|
||||
if( !pMethod )
|
||||
{
|
||||
PushError( FormulaError::NoMacro );
|
||||
return;
|
||||
}
|
||||
|
||||
bool bVolatileMacro = false;
|
||||
SbMethod* pMethod = static_cast<SbMethod*>(pVar);
|
||||
|
||||
SbModule* pModule = pMethod->GetModule();
|
||||
bool bUseVBAObjects = pModule->IsVBACompat();
|
||||
|
||||
@@ -467,9 +467,8 @@ void SmEditWindow::KeyInput(const KeyEvent& rKEvt)
|
||||
{
|
||||
// SFX has maybe called a slot of the view and thus (because of a hack in SFX)
|
||||
// set the focus to the view
|
||||
SfxViewShell* pVShell = GetView();
|
||||
if ( dynamic_cast<const SmViewShell *>(pVShell) &&
|
||||
static_cast<SmViewShell*>(pVShell)->GetGraphicWindow().HasFocus() )
|
||||
SmViewShell* pVShell = GetView();
|
||||
if ( pVShell && pVShell->GetGraphicWindow().HasFocus() )
|
||||
{
|
||||
GrabFocus();
|
||||
}
|
||||
|
||||
@@ -662,7 +662,8 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj)
|
||||
|
||||
void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
|
||||
{
|
||||
if(dynamic_cast<const SdrPathObj*>( pObj) == nullptr)
|
||||
auto pPathObj = dynamic_cast<const SdrPathObj*>( pObj);
|
||||
if(!pPathObj)
|
||||
return;
|
||||
|
||||
const SfxItemSet& rSet = pObj->GetMergedItemSet();
|
||||
@@ -670,7 +671,7 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj)
|
||||
drawing::LineStyle eLineStyle = rSet.Get(XATTR_LINESTYLE).GetValue();
|
||||
drawing::FillStyle eFillStyle = rSet.Get(XATTR_FILLSTYLE).GetValue();
|
||||
|
||||
if(static_cast<SdrPathObj*>(pObj)->IsClosed()
|
||||
if(pPathObj->IsClosed()
|
||||
&& eLineStyle == drawing::LineStyle_SOLID
|
||||
&& !nLineWidth
|
||||
&& eFillStyle != drawing::FillStyle_NONE)
|
||||
|
||||
@@ -76,9 +76,9 @@ void FmFormView::Init()
|
||||
SdrModel* pModel = GetModel();
|
||||
|
||||
DBG_ASSERT( dynamic_cast<const FmFormModel*>( pModel) != nullptr, "Wrong model" );
|
||||
if( dynamic_cast<const FmFormModel*>( pModel) == nullptr ) return;
|
||||
FmFormModel* pFormModel = static_cast<FmFormModel*>(pModel);
|
||||
|
||||
FmFormModel* pFormModel = dynamic_cast<FmFormModel*>(pModel);
|
||||
if( !pFormModel )
|
||||
return;
|
||||
|
||||
// get DesignMode from model
|
||||
bool bInitDesignMode = pFormModel->GetOpenInDesignMode();
|
||||
|
||||
@@ -1602,19 +1602,19 @@ namespace svxform
|
||||
FmEntryData* pCurrent = reinterpret_cast<FmEntryData*>(m_xTreeView->get_id(*rIter).toInt64());
|
||||
|
||||
// a form ?
|
||||
bool bIsForm = dynamic_cast<const FmFormData*>( pCurrent) != nullptr;
|
||||
auto pFormData = dynamic_cast<FmFormData*>(pCurrent);
|
||||
|
||||
// because deletion is done by the view, and i build on its MarkList,
|
||||
// but normally only direct controls, no indirect ones, are marked in a marked form,
|
||||
// I have to do it later
|
||||
if (bIsForm)
|
||||
MarkViewObj(static_cast<FmFormData*>(pCurrent), true/*deep*/);
|
||||
if (pFormData)
|
||||
MarkViewObj(pFormData, true/*deep*/);
|
||||
|
||||
// a hidden control ?
|
||||
bool bIsHidden = IsHiddenControl(pCurrent);
|
||||
|
||||
// keep forms and hidden controls, the rest not
|
||||
if (!bIsForm && !bIsHidden)
|
||||
if (!pFormData && !bIsHidden)
|
||||
{
|
||||
// well, no form and no hidden control -> we can remove it from m_arrCurrentSelection, as it will
|
||||
// be deleted automatically. This is because for every model (except forms and hidden control models)
|
||||
|
||||
@@ -41,8 +41,8 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SC(const SdrMarkL
|
||||
case 1:
|
||||
{
|
||||
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
|
||||
if (dynamic_cast<const SdrTextObj*>(pObj) != nullptr
|
||||
&& static_cast<SdrTextObj*>(pObj)->IsInEditMode())
|
||||
auto pTextObj = dynamic_cast<SdrTextObj*>(pObj);
|
||||
if (pTextObj && pTextObj->IsInEditMode())
|
||||
{
|
||||
eContext = EnumContext::Context::DrawText;
|
||||
}
|
||||
@@ -120,8 +120,8 @@ EnumContext::Context SelectionAnalyzer::GetContextForSelection_SD(const SdrMarkL
|
||||
case 1:
|
||||
{
|
||||
SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj();
|
||||
if (dynamic_cast<const SdrTextObj*>(pObj) != nullptr
|
||||
&& static_cast<SdrTextObj*>(pObj)->IsInEditMode())
|
||||
auto pTextObj = dynamic_cast<SdrTextObj*>(pObj);
|
||||
if (pTextObj && pTextObj->IsInEditMode())
|
||||
{
|
||||
if (pObj->GetObjIdentifier() == OBJ_TABLE)
|
||||
{
|
||||
|
||||
@@ -2133,7 +2133,8 @@ SdrObject* SdrMarkView::CheckSingleSdrObjectHit(const Point& rPnt, sal_uInt16 nT
|
||||
const bool bCheckIfMarkable(nOptions & SdrSearchOptions::TESTMARKABLE);
|
||||
const bool bDeep(nOptions & SdrSearchOptions::DEEP);
|
||||
const bool bOLE(dynamic_cast< const SdrOle2Obj* >(pObj) != nullptr);
|
||||
const bool bTXT(dynamic_cast<const SdrTextObj*>( pObj) != nullptr && static_cast<SdrTextObj*>(pObj)->IsTextFrame());
|
||||
auto pTextObj = dynamic_cast<const SdrTextObj*>( pObj);
|
||||
const bool bTXT(pTextObj && pTextObj->IsTextFrame());
|
||||
SdrObject* pRet=nullptr;
|
||||
tools::Rectangle aRect(pObj->GetCurrentBoundRect());
|
||||
|
||||
|
||||
@@ -844,14 +844,14 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr
|
||||
else if( rSettings.mbScrollText )
|
||||
{
|
||||
SdrObject* pObj = aShapes.front();
|
||||
if( dynamic_cast<const SdrTextObj*>( pObj)
|
||||
&& static_cast<SdrTextObj*>(pObj)->HasText() )
|
||||
auto pTextObj = dynamic_cast<SdrTextObj*>( pObj);
|
||||
if( pTextObj && pTextObj->HasText() )
|
||||
{
|
||||
tools::Rectangle aScrollRectangle;
|
||||
tools::Rectangle aPaintRectangle;
|
||||
|
||||
const std::unique_ptr< GDIMetaFile > pMtf(
|
||||
static_cast<SdrTextObj*>(pObj)->GetTextScrollMetaFileAndRectangle(
|
||||
pTextObj->GetTextScrollMetaFileAndRectangle(
|
||||
aScrollRectangle, aPaintRectangle ) );
|
||||
|
||||
// take the larger one of the two rectangles (that
|
||||
|
||||
@@ -1385,16 +1385,12 @@ bool SwAccessibleContext::Select( SwPaM *pPaM, SdrObject *pObj,
|
||||
if( !pCursorShell )
|
||||
return false;
|
||||
|
||||
SwFEShell* pFEShell = dynamic_cast<const SwFEShell*>( pCursorShell) != nullptr
|
||||
? static_cast<SwFEShell*>( pCursorShell )
|
||||
: nullptr;
|
||||
SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCursorShell);
|
||||
// Get rid of activated OLE object
|
||||
if( pFEShell )
|
||||
pFEShell->FinishOLEObj();
|
||||
|
||||
SwWrtShell* pWrtShell = dynamic_cast<const SwWrtShell*>( pCursorShell) != nullptr
|
||||
? static_cast<SwWrtShell*>( pCursorShell )
|
||||
: nullptr;
|
||||
SwWrtShell* pWrtShell = dynamic_cast<SwWrtShell*>(pCursorShell);
|
||||
|
||||
bool bRet = false;
|
||||
if( pObj )
|
||||
|
||||
@@ -520,9 +520,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes()
|
||||
if( !pCursorShell )
|
||||
return anyAttribute;
|
||||
|
||||
SwFEShell* pFEShell = dynamic_cast<const SwFEShell*>( pCursorShell) != nullptr
|
||||
? static_cast<SwFEShell*>( pCursorShell )
|
||||
: nullptr;
|
||||
SwFEShell* pFEShell = dynamic_cast<SwFEShell*>(pCursorShell);
|
||||
if( pFEShell )
|
||||
{
|
||||
OUString sDisplay;
|
||||
|
||||
@@ -257,8 +257,7 @@ SwPaM* SwAccessibleFrameBase::GetCursor()
|
||||
SwCursorShell* pCursorShell = GetCursorShell();
|
||||
if( pCursorShell != nullptr && !pCursorShell->IsTableMode() )
|
||||
{
|
||||
SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pCursorShell) != nullptr
|
||||
? static_cast< SwFEShell * >( pCursorShell ) : nullptr;
|
||||
SwFEShell *pFESh = dynamic_cast<SwFEShell*>( pCursorShell);
|
||||
if( !pFESh ||
|
||||
!(pFESh->IsFrameSelected() || pFESh->IsObjSelected() > 0) )
|
||||
{
|
||||
|
||||
@@ -193,8 +193,7 @@ SwPaM* SwAccessibleParagraph::GetCursor( const bool _bForSelection )
|
||||
if ( pCursorShell != nullptr &&
|
||||
( _bForSelection || !pCursorShell->IsTableMode() ) )
|
||||
{
|
||||
SwFEShell *pFESh = dynamic_cast<const SwFEShell*>( pCursorShell) != nullptr
|
||||
? static_cast< SwFEShell * >( pCursorShell ) : nullptr;
|
||||
SwFEShell *pFESh = dynamic_cast<SwFEShell*>(pCursorShell);
|
||||
if( !pFESh ||
|
||||
!(pFESh->IsFrameSelected() || pFESh->IsObjSelected() > 0) )
|
||||
{
|
||||
|
||||
@@ -754,9 +754,8 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
|
||||
if ( !pContact )
|
||||
{
|
||||
#if OSL_DEBUG_LEVEL > 0
|
||||
bool bNoUserCallExcepted =
|
||||
dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr &&
|
||||
!static_cast<SwDrawVirtObj*>(pObj)->IsConnected();
|
||||
auto pSwDrawVirtObj = dynamic_cast<SwDrawVirtObj*>( pObj);
|
||||
bool bNoUserCallExcepted = pSwDrawVirtObj && !pSwDrawVirtObj->IsConnected();
|
||||
OSL_ENSURE( bNoUserCallExcepted, "SwDoc::ChgAnchor(..) - no contact at selected drawing object" );
|
||||
#endif
|
||||
continue;
|
||||
@@ -943,8 +942,8 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList,
|
||||
{
|
||||
// #i33313# - consider not connected 'virtual' drawing
|
||||
// objects
|
||||
if ( dynamic_cast<const SwDrawVirtObj*>( pObj) != nullptr &&
|
||||
!static_cast<SwDrawVirtObj*>(pObj)->IsConnected() )
|
||||
auto pSwDrawVirtObj = dynamic_cast<SwDrawVirtObj*>( pObj);
|
||||
if ( pSwDrawVirtObj && !pSwDrawVirtObj->IsConnected() )
|
||||
{
|
||||
SwRect aNewObjRect( aObjRect );
|
||||
static_cast<SwAnchoredDrawObject*>(pContact->GetAnchoredObj( nullptr ))
|
||||
|
||||
@@ -1085,14 +1085,14 @@ static void lcl_UpdateLinksInSect( SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
|
||||
const ::sfx2::SvBaseLinks& rLnks = rDoc.getIDocumentLinksAdministration().GetLinkManager().GetLinks();
|
||||
for( auto n = rLnks.size(); n; )
|
||||
{
|
||||
SwBaseLink* pBLink;
|
||||
|
||||
::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
|
||||
if( pLnk != &rUpdLnk &&
|
||||
sfx2::SvBaseLinkObjectType::ClientFile == pLnk->GetObjType() &&
|
||||
dynamic_cast< const SwBaseLink *>( pLnk ) != nullptr &&
|
||||
( pBLink = static_cast<SwBaseLink*>(pLnk) )->IsInRange( rSectNd.GetIndex(),
|
||||
rSectNd.EndOfSectionIndex() ) )
|
||||
if( pLnk == &rUpdLnk )
|
||||
continue;
|
||||
if( sfx2::SvBaseLinkObjectType::ClientFile != pLnk->GetObjType() )
|
||||
continue;
|
||||
SwBaseLink* pBLink = dynamic_cast<SwBaseLink*>( pLnk );
|
||||
if( pBLink && pBLink->IsInRange( rSectNd.GetIndex(),
|
||||
rSectNd.EndOfSectionIndex() ) )
|
||||
{
|
||||
// It's in the Section, so update. But only if it's not in the same File!
|
||||
OUString sFName;
|
||||
|
||||
@@ -701,9 +701,10 @@ SwFlyNotify::~SwFlyNotify()
|
||||
// OD 2004-05-13 #i28701#
|
||||
// #i45180# - no adjustment of layout process flags and
|
||||
// further notifications/invalidations, if format is called by grow/shrink
|
||||
if ( !(pFly->ConsiderObjWrapInfluenceOnObjPos() &&
|
||||
( dynamic_cast<const SwFlyFreeFrame*>( pFly) == nullptr ||
|
||||
!static_cast<SwFlyFreeFrame*>(pFly)->IsNoMoveOnCheckClip() )) )
|
||||
if ( !pFly->ConsiderObjWrapInfluenceOnObjPos() )
|
||||
return;
|
||||
auto pFlyFreeFrame = dynamic_cast<SwFlyFreeFrame*>(pFly);
|
||||
if (pFlyFreeFrame && pFlyFreeFrame->IsNoMoveOnCheckClip())
|
||||
return;
|
||||
|
||||
// #i54138# - suppress restart of the layout process
|
||||
|
||||
@@ -107,18 +107,18 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrame *p
|
||||
|
||||
for ( size_t i = 0; i < rObjs.size() && !aTmp.empty(); ++i )
|
||||
{
|
||||
SdrObject *pO = rObjs[i]->DrawObj();
|
||||
if ( dynamic_cast< const SwVirtFlyDrawObj *>( pO ) == nullptr )
|
||||
SwVirtFlyDrawObj *pVirtFly = dynamic_cast<SwVirtFlyDrawObj*>(rObjs[i]->DrawObj());
|
||||
if ( !pVirtFly )
|
||||
continue;
|
||||
|
||||
// do not consider invisible objects
|
||||
const IDocumentDrawModelAccess& rIDDMA = pPage->GetFormat()->getIDocumentDrawModelAccess();
|
||||
if ( !rIDDMA.IsVisibleLayerId( pO->GetLayer() ) )
|
||||
if ( !rIDDMA.IsVisibleLayerId( pVirtFly->GetLayer() ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
SwFlyFrame *pFly = static_cast<SwVirtFlyDrawObj*>(pO)->GetFlyFrame();
|
||||
SwFlyFrame *pFly = pVirtFly->GetFlyFrame();
|
||||
|
||||
if ( pFly == pSelfFly || !rRect.IsOver( pFly->getFrameArea() ) )
|
||||
continue;
|
||||
@@ -132,9 +132,9 @@ bool SwLayAction::PaintWithoutFlys( const SwRect &rRect, const SwContentFrame *p
|
||||
if ( pSelfFly )
|
||||
{
|
||||
const SdrObject *pTmp = pSelfFly->GetVirtDrawObj();
|
||||
if ( pO->GetLayer() == pTmp->GetLayer() )
|
||||
if ( pVirtFly->GetLayer() == pTmp->GetLayer() )
|
||||
{
|
||||
if ( pO->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
|
||||
if ( pVirtFly->GetOrdNumDirect() < pTmp->GetOrdNumDirect() )
|
||||
// Only look at things above us, if inside the same layer
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -240,8 +240,9 @@ static SwTwips lcl_GetFootnoteLower( const SwTextFrame* pFrame, SwTwips nLower )
|
||||
{
|
||||
SwRect aRect( pAnchoredObj->GetObjRect() );
|
||||
|
||||
if ( dynamic_cast< const SwFlyFrame *>( pAnchoredObj ) == nullptr ||
|
||||
static_cast<SwFlyFrame*>(pAnchoredObj)->isFrameAreaDefinitionValid() )
|
||||
auto pFlyFrame = dynamic_cast<SwFlyFrame*>( pAnchoredObj );
|
||||
if ( !pFlyFrame ||
|
||||
pFlyFrame->isFrameAreaDefinitionValid() )
|
||||
{
|
||||
const SwTwips nBottom = aRectFnSet.GetBottom(aRect);
|
||||
if ( aRectFnSet.YDiff( nBottom, nFlyLower ) > 0 )
|
||||
|
||||
@@ -473,17 +473,18 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos)
|
||||
if (pSdrView->IsMarkedHit(aDocPos) && !pSdrView->PickHandle(aDocPos) && IsTextTool())
|
||||
pObj = pSdrView->PickObj(aDocPos, pSdrView->getHitTolLog(), pPV, SdrSearchOptions::PICKTEXTEDIT);
|
||||
|
||||
if (pObj &&
|
||||
// To allow SwDrawVirtObj text objects to be activated, allow their type, too.
|
||||
( dynamic_cast< const SdrTextObj *>( pObj ) != nullptr ||
|
||||
( dynamic_cast< const SwDrawVirtObj *>( pObj ) != nullptr &&
|
||||
dynamic_cast< const SdrTextObj *>(&static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj() ) != nullptr ) ) &&
|
||||
|
||||
m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE)
|
||||
if (pObj)
|
||||
{
|
||||
// Refuse to edit editeng text of the shape if it has textbox attached.
|
||||
if (!lcl_isTextBox(pObj))
|
||||
bReturn = BeginTextEdit( pObj, pPV, m_pEditWin );
|
||||
// To allow SwDrawVirtObj text objects to be activated, allow their type, too.
|
||||
auto pVirtObj = dynamic_cast<SwDrawVirtObj*>( pObj );
|
||||
if ( (pVirtObj && dynamic_cast< const SdrTextObj *>(&pVirtObj->GetReferencedObj() ) != nullptr &&
|
||||
m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE) ||
|
||||
dynamic_cast< const SdrTextObj *>( pObj ) != nullptr )
|
||||
{
|
||||
// Refuse to edit editeng text of the shape if it has textbox attached.
|
||||
if (!lcl_isTextBox(pObj))
|
||||
bReturn = BeginTextEdit( pObj, pPV, m_pEditWin );
|
||||
}
|
||||
}
|
||||
|
||||
pSdrView->SetHitTolerancePixel( nOld );
|
||||
|
||||
@@ -273,10 +273,9 @@ void TextUndoInsertChars::Redo()
|
||||
|
||||
bool TextUndoInsertChars::Merge( SfxUndoAction* pNextAction )
|
||||
{
|
||||
if ( nullptr == dynamic_cast< const TextUndoInsertChars*>( pNextAction ) )
|
||||
return false;
|
||||
|
||||
TextUndoInsertChars* pNext = static_cast<TextUndoInsertChars*>(pNextAction);
|
||||
if ( !pNext )
|
||||
return false;
|
||||
|
||||
if ( maTextPaM.GetPara() != pNext->maTextPaM.GetPara() )
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user