// Because the method could be called from outside, check the // rights here again if( nHintId == SfxHintId::BasicDataWanted )
{ if( !CanRead() )
{ return;
}
} if( nHintId == SfxHintId::BasicDataChanged )
{ if( !CanWrite() )
{ return;
}
}
//fdo#86843 Add a ref during the following block to guard against //getting deleted before completing this method
SbxVariableRef aBroadcastGuard(this);
// Avoid further broadcasting
std::unique_ptr<SfxBroadcaster> pSave = std::move(mpBroadcaster);
SbxFlagBits nSaveFlags = GetFlags();
SetFlag( SbxFlagBits::ReadWrite ); if( mpPar.is() )
{ // Register this as element 0, but don't change over the parent!
mpPar->GetRef(0) = this;
}
pSave->Broadcast( SbxHint( nHintId, this ) );
mpBroadcaster = std::move(pSave);
SetFlags( nSaveFlags );
}
const OUString& SbxVariable::GetName( SbxNameType t ) const
{ staticconstchar cSuffixes[] = " %&!#@ $"; if( t == SbxNameType::NONE )
{ return maName;
} if (t == SbxNameType::CaseInsensitive)
{ if (maNameCI.isEmpty() && !maName.isEmpty())
maNameCI = NameToCaseInsensitiveName(maName); return maNameCI;
} // Request parameter-information (not for objects) const_cast<SbxVariable*>(this)->GetInfo(); // Append nothing, if it is a simple property (no empty brackets) if (!pInfo.is() || (pInfo->m_Params.empty() && GetClass() == SbxClassType::Property))
{ return maName;
}
OUStringBuffer aTmp( maName ); if( t == SbxNameType::ShortTypes )
{
sal_Unicode cType = ' '; // short type? Then fetch it, possible this is 0.
SbxDataType et = GetType(); if( et <= SbxSTRING )
{
assert(et >= 0 && size_t(et) < std::size(cSuffixes) - 1);
cType = cSuffixes[ et ];
} if( cType != ' ' )
{
aTmp.append(cType);
}
}
aTmp.append("(");
for (SbxParams::const_iterator iter = pInfo->m_Params.begin(); iter != pInfo->m_Params.end(); ++iter)
{ autoconst& i = *iter; int nt = i->eType & 0x0FFF; if (iter != pInfo->m_Params.begin())
{
aTmp.append(",");
} if( i->nFlags & SbxFlagBits::Optional )
{
aTmp.append( GetSbxRes( StringId::Optional ) );
} if( i->eType & SbxBYREF )
{
aTmp.append( GetSbxRes( StringId::ByRef ) );
}
aTmp.append( i->aName );
sal_Unicode cType = ' '; // short type? Then fetch it, possible this is 0. if( t == SbxNameType::ShortTypes )
{ if( nt <= SbxSTRING )
{
cType = cSuffixes[ nt ];
}
} if( cType != ' ' )
{
aTmp.append(cType); if( i->eType & SbxARRAY )
{
aTmp.append("()");
}
} else
{ if( i->eType & SbxARRAY )
{
aTmp.append("()");
} // long type?
aTmp.append(GetSbxRes( StringId::As )); if( nt < 32 )
{
aTmp.append(GetSbxRes( static_cast<StringId>( static_cast<int>( StringId::Types ) + nt ) ));
} else
{
aTmp.append(GetSbxRes( StringId::Any ));
}
}
}
aTmp.append(")"); const_cast<SbxVariable*>(this)->aToolString = aTmp.makeStringAndClear(); return aToolString;
}
// Operators
SbxVariable& SbxVariable::operator=( const SbxVariable& r )
{ if (this != &r)
{
SbxValue::operator=( r ); // tdf#144353 - copy information about a missing parameter. See SbiRuntime::SetIsMissing. // We cannot unconditionally assign the data about a variable because we would overwrite // the information about parameters (name, type, flags, and ids). For instance, in the case // where a method will be initialized with a literal. if (!pInfo)
pInfo = r.pInfo;
m_aDeclareClassName = r.m_aDeclareClassName;
m_xComListener = r.m_xComListener;
m_pComListenerParentBasic = r.m_pComListenerParentBasic; #if HAVE_FEATURE_SCRIPTING if( m_xComListener.is() )
{
registerComListenerVariableForBasic( this, m_pComListenerParentBasic );
} #endif
} return *this;
}
void SbxVariable::SetModified( bool b )
{ if( IsSet( SbxFlagBits::NoModify ) )
{ return;
}
SbxBase::SetModified( b ); if( pParent && pParent != this ) //??? HotFix: Recursion out here MM
{
pParent->SetModified( b );
}
}
void SbxVariable::SetParent( SbxObject* p )
{ #ifdef DBG_UTIL // Will the parent of a SbxObject be set? if (p && dynamic_cast<SbxObject*>(this))
{ // then this had to be a child of the new parent bool bFound = false;
SbxArray *pChildren = p->GetObjects(); if ( pChildren )
{ for (sal_uInt32 nIdx = 0; !bFound && nIdx < pChildren->Count(); ++nIdx)
{
bFound = (this == pChildren->Get(nIdx));
}
}
SAL_INFO_IF(
!bFound, "basic.sbx", "dangling: [" << GetName() << "].SetParent([" << p->GetName()
<< "])");
} #endif
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.