sw a11y: Return ref in SwAccessibleContext::GetShell
Return a ref instad of a pointer in
SwAccessibleContext::GetShell and also
switch the SwViewShell param for LoadURL
to a reference.
This also allows to drop the
// The shell could be 0 also!!!!!
comment in that method.
Change-Id: I9a817fb33f79a10f1baccb8c6264dafd9677731a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/184231
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ namespace o3tl {
|
||||
|
||||
bool LoadURL( SwWrtShell& rSh, const OUString& rName,
|
||||
LoadUrlFlags nFilter, const OUString& rTargetFrameName );
|
||||
bool LoadURL( SwViewShell* rSh, const OUString& rName,
|
||||
bool LoadURL( SwViewShell& rSh, const OUString& rName,
|
||||
LoadUrlFlags nFilter, const OUString& rTargetFrameName );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -123,7 +123,7 @@ void SwAccessibleContext::ChildrenScrolled( const SwFrame *pFrame,
|
||||
{
|
||||
const SwAccessibleChild& rLower = *aIter;
|
||||
const SwRect aBox( rLower.GetBox( *(GetMap()) ) );
|
||||
if( rLower.IsAccessible( GetShell()->IsPreview() ) )
|
||||
if (rLower.IsAccessible(GetShell().IsPreview()))
|
||||
{
|
||||
Action eAction = Action::NONE;
|
||||
if( aBox.Overlaps( rNewVisArea ) )
|
||||
@@ -347,7 +347,7 @@ void SwAccessibleContext::InvalidateChildrenStates( const SwFrame* _pFrame,
|
||||
if( pLower )
|
||||
{
|
||||
::rtl::Reference< SwAccessibleContext > xAccImpl;
|
||||
if( rLower.IsAccessible( GetShell()->IsPreview() ) )
|
||||
if (rLower.IsAccessible(GetShell().IsPreview()))
|
||||
xAccImpl = GetMap()->GetContextImpl( pLower, false );
|
||||
if( xAccImpl.is() )
|
||||
xAccImpl->InvalidateStates( _nStates );
|
||||
@@ -884,8 +884,8 @@ awt::Rectangle SwAccessibleContext::getBoundsImpl(bool bRelative)
|
||||
if( GetFrame()->IsPageFrame() &&
|
||||
static_cast < const SwPageFrame * >( GetFrame() )->IsEmptyPage() )
|
||||
{
|
||||
OSL_ENSURE( GetShell()->IsPreview(), "empty page accessible?" );
|
||||
if( GetShell()->IsPreview() )
|
||||
OSL_ENSURE(GetShell().IsPreview(), "empty page accessible?");
|
||||
if (GetShell().IsPreview())
|
||||
{
|
||||
// adjust method call <GetMap()->GetPreviewPageSize()>
|
||||
sal_uInt16 nPageNum =
|
||||
|
||||
@@ -111,13 +111,13 @@ protected:
|
||||
const SwAccessibleMap *GetMap() const { return m_pMap; }
|
||||
|
||||
/** convenience method to get the SwViewShell through accessibility map */
|
||||
SwViewShell* GetShell()
|
||||
SwViewShell& GetShell()
|
||||
{
|
||||
return &GetMap()->GetShell();
|
||||
return GetMap()->GetShell();
|
||||
}
|
||||
const SwViewShell* GetShell() const
|
||||
const SwViewShell& GetShell() const
|
||||
{
|
||||
return &GetMap()->GetShell();
|
||||
return GetMap()->GetShell();
|
||||
}
|
||||
|
||||
/** convenience method to get SwCursorShell through accessibility map
|
||||
|
||||
@@ -191,7 +191,7 @@ OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName()
|
||||
SolarMutexGuard g;
|
||||
|
||||
OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING );
|
||||
SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : nullptr;
|
||||
SwDoc* pDoc = GetMap() ? GetShell().GetDoc() : nullptr;
|
||||
if ( pDoc )
|
||||
{
|
||||
OUString sFileName = pDoc->getDocAccTitle();
|
||||
@@ -471,7 +471,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes()
|
||||
SolarMutexGuard g;
|
||||
|
||||
uno::Any anyAttribute;
|
||||
SwDoc *pDoc = GetMap() ? GetShell()->GetDoc() : nullptr;
|
||||
SwDoc* pDoc = GetMap() ? GetShell().GetDoc() : nullptr;
|
||||
|
||||
if (!pDoc)
|
||||
return anyAttribute;
|
||||
|
||||
@@ -49,7 +49,7 @@ SwAccessibleFootnote::SwAccessibleFootnote(
|
||||
static_cast< const SwFootnoteFrame *>( GetFrame() )->GetAttr();
|
||||
if( pTextFootnote )
|
||||
{
|
||||
const SwDoc *pDoc = GetShell()->GetDoc();
|
||||
const SwDoc* pDoc = GetShell().GetDoc();
|
||||
sArg = pTextFootnote->GetFootnote().GetViewNumStr(*pDoc, pFootnoteFrame->getRootFrame());
|
||||
}
|
||||
|
||||
|
||||
@@ -625,11 +625,10 @@ bool LoadURL( SwWrtShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
|
||||
return ::LoadURL(rVSh.GetView(), rURL, nFilter, rTargetFrameName);
|
||||
}
|
||||
|
||||
bool LoadURL( SwViewShell* pVSh, const OUString& rURL, LoadUrlFlags nFilter,
|
||||
bool LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter,
|
||||
const OUString& rTargetFrameName )
|
||||
{
|
||||
// The shell could be 0 also!!!!!
|
||||
if (auto pSh = dynamic_cast<SwWrtShell*>(pVSh))
|
||||
if (auto pSh = dynamic_cast<SwWrtShell*>(&rVSh))
|
||||
return ::LoadURL(*pSh, rURL, nFilter, rTargetFrameName);
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user