Kaydet (Commit) 7327260d authored tarafından Mike Kaganski's avatar Mike Kaganski Kaydeden (comit) Stephan Bergmann

tdf#120703: partially revert commit 85456fae

... to take into account possible differences of results of dynamic_cast
vs static_cast; the change casts dynamically, as before the commit, and
only adds asserts on the result of the cast.

Thanks to sberg for pointing my mistake out!

Change-Id: Ib77d443e5a858e744f369f58542de603f948fd1c
Reviewed-on: https://gerrit.libreoffice.org/70274
Tested-by: Jenkins
Reviewed-by: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 5d0700bd
......@@ -396,8 +396,8 @@ void SAL_CALL ChartController::attachFrame(
uno::Reference<ui::XSidebar> xSidebar = getSidebarFromModel(getModel());
if (xSidebar.is())
{
assert(dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get()));
auto pSidebar = static_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
auto pSidebar = dynamic_cast<sfx2::sidebar::SidebarController*>(xSidebar.get());
assert(pSidebar);
sfx2::sidebar::SidebarController::registerSidebarForFrame(pSidebar, this);
pSidebar->updateModel(getModel());
css::lang::EventObject aEvent;
......
......@@ -852,8 +852,8 @@ void ChartController::execute_MouseButtonUp( const MouseEvent& rMEvt )
m_xUndoManager );
bool bChanged = false;
assert(dynamic_cast<ChartModel*>(getModel().get()));
ChartModel* pModel = static_cast<ChartModel*>(getModel().get());
ChartModel* pModel = dynamic_cast<ChartModel*>(getModel().get());
assert(pModel);
if ( eObjectType == OBJECTTYPE_LEGEND )
bChanged = DiagramHelper::switchDiagramPositioningToExcludingPositioning( *pModel, false , true );
......
......@@ -527,9 +527,8 @@ void CppuType::dumpInitializer(
out << "0";
break;
case codemaker::UnoType::Sort::Enum:
assert(dynamic_cast<unoidl::EnumTypeEntity*>(ent.get()));
out << codemaker::cpp::scopedCppName(n.toUtf8()) << "_"
<< (static_cast<unoidl::EnumTypeEntity*>(ent.get())->
<< (dynamic_cast<unoidl::EnumTypeEntity&>(*ent.get()).
getMembers()[0].name);
break;
case codemaker::UnoType::Sort::String:
......
......@@ -4483,9 +4483,8 @@ ScChangeTrack* ScChangeTrack::Clone( ScDocument* pDocument ) const
break;
case SC_CAT_MOVE:
{
assert(dynamic_cast<const ScChangeActionMove*>(pAction)
&& "ScChangeTrack::Clone: pMove is null!");
auto pMove = static_cast<const ScChangeActionMove*>(pAction);
auto pMove = dynamic_cast<const ScChangeActionMove*>(pAction);
assert(pMove && "ScChangeTrack::Clone: pMove is null!");
pClonedAction = new ScChangeActionMove(
pAction->GetActionNumber(),
......
......@@ -124,9 +124,8 @@ ScPrintAreasDlg::ScPrintAreasDlg( SfxBindings* pB, SfxChildWindow* pCW, vcl::Win
get(pBtnCancel,"cancel");
ScTabViewShell* pScViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
SfxObjectShell* pSfxObjSh = SfxObjectShell::Current();
assert(dynamic_cast<ScDocShell*>(pSfxObjSh) && "Current DocumentShell not found :-(");
ScDocShell* pScDocSh = static_cast<ScDocShell*>(pSfxObjSh);
ScDocShell* pScDocSh = dynamic_cast<ScDocShell*>(SfxObjectShell::Current());
assert(pScDocSh && "Current DocumentShell not found :-(");
pDoc = &pScDocSh->GetDocument();
......
......@@ -56,9 +56,9 @@ namespace sw { namespace mark
SwTextField *const pTextField = pTextNode->GetFieldTextAttrAt(
GetMarkEnd().nContent.GetIndex()-1, true);
assert(pTextField != nullptr);
const SwField* pField = pTextField->GetFormatField().GetField();
assert(dynamic_cast<const SwPostItField*>(pField));
const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
auto pPostItField
= dynamic_cast<const SwPostItField*>(pTextField->GetFormatField().GetField());
assert(pPostItField);
// use the annotation mark's name as the annotation name, if
// - the annotation field has an empty annotation name or
// - the annotation mark's name differs (on mark creation a name clash had been detected)
......
......@@ -582,9 +582,8 @@ void SwTextInputField::UpdateFieldContent()
const sal_Int32 nLen = static_cast<sal_Int32>(std::max<sal_Int32>( 0, ( (*End()) - 1 - nIdx ) ));
const OUString aNewFieldContent = GetTextNode().GetExpandText(nullptr, nIdx, nLen);
const SwField* pField = GetFormatField().GetField();
assert(dynamic_cast<const SwInputField*>(pField));
const SwInputField* pInputField = static_cast<const SwInputField*>(pField);
auto pInputField = dynamic_cast<const SwInputField*>(GetFormatField().GetField());
assert(pInputField);
const_cast<SwInputField*>(pInputField)->applyFieldContent( aNewFieldContent );
// trigger update of fields for scenarios in which the Input Field's content is part of e.g. a table formula
GetTextNode().GetDoc()->getIDocumentFieldsAccess().GetUpdateFields().SetFieldsDirty(true);
......@@ -624,9 +623,8 @@ SwTextAnnotationField::~SwTextAnnotationField()
::sw::mark::IMark* SwTextAnnotationField::GetAnnotationMark() const
{
const SwField* pField = GetFormatField().GetField();
assert(dynamic_cast<const SwPostItField*>(pField));
const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
auto pPostItField = dynamic_cast<const SwPostItField*>(GetFormatField().GetField());
assert(pPostItField);
SwDoc* pDoc = static_cast<const SwPostItFieldType*>(pPostItField->GetTyp())->GetDoc();
assert(pDoc != nullptr);
......
......@@ -64,10 +64,10 @@ static void printType(
if (defaultvalue && referenceType == 16) {
if (sort == codemaker::UnoType::Sort::Enum) {
assert(dynamic_cast<unoidl::EnumTypeEntity *>(entity.get()));
auto pEnumTypeEntity(dynamic_cast<unoidl::EnumTypeEntity *>(entity.get()));
assert(pEnumTypeEntity);
o << nucleus.copy(nucleus.lastIndexOf('.') + 1) << "_"
<< static_cast<unoidl::EnumTypeEntity*>(entity.get())->
getMembers()[0].name;
<< pEnumTypeEntity->getMembers()[0].name;
}
return;
}
......@@ -927,11 +927,11 @@ void generateDocumentation(std::ostream & o,
o << "; construction methods:\n";
printConstructors(o, options, manager, nucleus);
}
assert(dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity*>(entity.get()));
generateDocumentation(
o, options, manager,
static_cast<unoidl::SingleInterfaceBasedServiceEntity*>(
entity.get())->getBase().toUtf8(),
dynamic_cast<unoidl::SingleInterfaceBasedServiceEntity&>(*entity.get())
.getBase()
.toUtf8(),
delegate);
break;
......
......@@ -85,8 +85,8 @@ void AccFrameEventListener::HandleChildChangedEvent(Any oldValue, Any newValue)
{
XAccessible* pAcc = xChild.get();
assert(dynamic_cast<VCLXWindow*>(m_xAccessible.get()));
VCLXWindow* pvclwindow = static_cast<VCLXWindow*>(m_xAccessible.get());
VCLXWindow* pvclwindow = dynamic_cast<VCLXWindow*>(m_xAccessible.get());
assert(pvclwindow);
const SystemEnvData* systemdata
= pvclwindow->GetWindow()->GetSystemData();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment