loplugin:flatten in accessibility..basic
Change-Id: If2cc282c2b135d634daf393a082c29049b10a677 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127223 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
@@ -409,30 +409,29 @@ namespace accessibility
|
||||
::osl::MutexGuard aGuard( m_aMutex );
|
||||
|
||||
SvTreeListBox* pBox = m_pTreeListBox;
|
||||
if(pBox)
|
||||
if(!pBox)
|
||||
return AccessibleRole::UNKNOWN;
|
||||
|
||||
SvTreeFlags treeFlag = pBox->GetTreeFlags();
|
||||
if(treeFlag & SvTreeFlags::CHKBTN )
|
||||
{
|
||||
SvTreeFlags treeFlag = pBox->GetTreeFlags();
|
||||
if(treeFlag & SvTreeFlags::CHKBTN )
|
||||
SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
|
||||
SvButtonState eState = pBox->GetCheckButtonState( pEntry );
|
||||
switch( eState )
|
||||
{
|
||||
SvTreeListEntry* pEntry = pBox->GetEntryFromPath( m_aEntryPath );
|
||||
SvButtonState eState = pBox->GetCheckButtonState( pEntry );
|
||||
switch( eState )
|
||||
{
|
||||
case SvButtonState::Checked:
|
||||
case SvButtonState::Unchecked:
|
||||
return AccessibleRole::CHECK_BOX;
|
||||
case SvButtonState::Tristate:
|
||||
default:
|
||||
return AccessibleRole::LABEL;
|
||||
}
|
||||
case SvButtonState::Checked:
|
||||
case SvButtonState::Unchecked:
|
||||
return AccessibleRole::CHECK_BOX;
|
||||
case SvButtonState::Tristate:
|
||||
default:
|
||||
return AccessibleRole::LABEL;
|
||||
}
|
||||
if (GetRoleType() == 0)
|
||||
return AccessibleRole::LIST_ITEM;
|
||||
else
|
||||
//o is: return AccessibleRole::LABEL;
|
||||
return AccessibleRole::TREE_ITEM;
|
||||
}
|
||||
return AccessibleRole::UNKNOWN;
|
||||
if (GetRoleType() == 0)
|
||||
return AccessibleRole::LIST_ITEM;
|
||||
else
|
||||
//o is: return AccessibleRole::LABEL;
|
||||
return AccessibleRole::TREE_ITEM;
|
||||
}
|
||||
|
||||
OUString SAL_CALL AccessibleListBoxEntry::getAccessibleDescription( )
|
||||
|
@@ -300,45 +300,45 @@ bool MediaWindow::isMediaURL( const OUString& rURL, const OUString& rReferer, bo
|
||||
{
|
||||
const INetURLObject aURL( rURL );
|
||||
|
||||
if( aURL.GetProtocol() != INetProtocol::NotValid )
|
||||
if( aURL.GetProtocol() == INetProtocol::NotValid )
|
||||
return false;
|
||||
|
||||
if( bDeep || pPreferredSizePixel )
|
||||
{
|
||||
if( bDeep || pPreferredSizePixel )
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer(
|
||||
aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ),
|
||||
rReferer, nullptr ) );
|
||||
uno::Reference< media::XPlayer > xPlayer( priv::MediaWindowImpl::createPlayer(
|
||||
aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ),
|
||||
rReferer, nullptr ) );
|
||||
|
||||
if( xPlayer.is() )
|
||||
if( xPlayer.is() )
|
||||
{
|
||||
if( pPreferredSizePixel )
|
||||
{
|
||||
if( pPreferredSizePixel )
|
||||
{
|
||||
const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() );
|
||||
const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() );
|
||||
|
||||
pPreferredSizePixel->setWidth( aAwtSize.Width );
|
||||
pPreferredSizePixel->setHeight( aAwtSize.Height );
|
||||
}
|
||||
|
||||
return true;
|
||||
pPreferredSizePixel->setWidth( aAwtSize.Width );
|
||||
pPreferredSizePixel->setHeight( aAwtSize.Height );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch( ... )
|
||||
{
|
||||
FilterNameVector aFilters = getMediaFilters();
|
||||
const OUString aExt( aURL.getExtension() );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FilterNameVector aFilters = getMediaFilters();
|
||||
const OUString aExt( aURL.getExtension() );
|
||||
|
||||
for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i )
|
||||
for( FilterNameVector::size_type i = 0; i < aFilters.size(); ++i )
|
||||
{
|
||||
for( sal_Int32 nIndex = 0; nIndex >= 0; )
|
||||
{
|
||||
for( sal_Int32 nIndex = 0; nIndex >= 0; )
|
||||
{
|
||||
if( aExt.equalsIgnoreAsciiCase( aFilters[ i ].second.getToken( 0, ';', nIndex ) ) )
|
||||
return true;
|
||||
}
|
||||
if( aExt.equalsIgnoreAsciiCase( aFilters[ i ].second.getToken( 0, ';', nIndex ) ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -160,27 +160,28 @@ bool RenameModule (
|
||||
if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) )
|
||||
return false;
|
||||
|
||||
if (Shell* pShell = GetShell())
|
||||
Shell* pShell = GetShell();
|
||||
if (!pShell)
|
||||
return true;
|
||||
VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true);
|
||||
if (!pWin)
|
||||
return true;
|
||||
|
||||
// set new name in window
|
||||
pWin->SetName( rNewName );
|
||||
|
||||
// set new module in module window
|
||||
pWin->SetSbModule( pWin->GetBasic()->FindModule( rNewName ) );
|
||||
|
||||
// update tabwriter
|
||||
sal_uInt16 nId = pShell->GetWindowId( pWin );
|
||||
SAL_WARN_IF( nId == 0 , "basctl.basicide", "No entry in Tabbar!");
|
||||
if ( nId )
|
||||
{
|
||||
if (VclPtr<ModulWindow> pWin = pShell->FindBasWin(rDocument, rLibName, rNewName, false, true))
|
||||
{
|
||||
// set new name in window
|
||||
pWin->SetName( rNewName );
|
||||
|
||||
// set new module in module window
|
||||
pWin->SetSbModule( pWin->GetBasic()->FindModule( rNewName ) );
|
||||
|
||||
// update tabwriter
|
||||
sal_uInt16 nId = pShell->GetWindowId( pWin );
|
||||
SAL_WARN_IF( nId == 0 , "basctl.basicide", "No entry in Tabbar!");
|
||||
if ( nId )
|
||||
{
|
||||
TabBar& rTabBar = pShell->GetTabBar();
|
||||
rTabBar.SetPageText(nId, rNewName);
|
||||
rTabBar.Sort();
|
||||
rTabBar.MakeVisible(rTabBar.GetCurPageId());
|
||||
}
|
||||
}
|
||||
TabBar& rTabBar = pShell->GetTabBar();
|
||||
rTabBar.SetPageText(nId, rNewName);
|
||||
rTabBar.Sort();
|
||||
rTabBar.MakeVisible(rTabBar.GetCurPageId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -180,24 +180,24 @@ bool RenameDialog (
|
||||
if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) )
|
||||
return false;
|
||||
|
||||
if (pWin && pShell)
|
||||
if (!pWin || !pShell)
|
||||
return true;
|
||||
|
||||
// set new name in window
|
||||
pWin->SetName( rNewName );
|
||||
|
||||
// update property browser
|
||||
pWin->UpdateBrowser();
|
||||
|
||||
// update tabwriter
|
||||
sal_uInt16 nId = pShell->GetWindowId( pWin );
|
||||
DBG_ASSERT( nId, "No entry in Tabbar!" );
|
||||
if ( nId )
|
||||
{
|
||||
// set new name in window
|
||||
pWin->SetName( rNewName );
|
||||
|
||||
// update property browser
|
||||
pWin->UpdateBrowser();
|
||||
|
||||
// update tabwriter
|
||||
sal_uInt16 nId = pShell->GetWindowId( pWin );
|
||||
DBG_ASSERT( nId, "No entry in Tabbar!" );
|
||||
if ( nId )
|
||||
{
|
||||
TabBar& rTabBar = pShell->GetTabBar();
|
||||
rTabBar.SetPageText( nId, rNewName );
|
||||
rTabBar.Sort();
|
||||
rTabBar.MakeVisible( rTabBar.GetCurPageId() );
|
||||
}
|
||||
TabBar& rTabBar = pShell->GetTabBar();
|
||||
rTabBar.SetPageText( nId, rNewName );
|
||||
rTabBar.Sort();
|
||||
rTabBar.MakeVisible( rTabBar.GetCurPageId() );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -509,25 +509,24 @@ namespace basctl
|
||||
bool ScriptDocument::Impl::removeModuleOrDialog( LibraryContainerType _eType, const OUString& _rLibName, const OUString& _rModuleName )
|
||||
{
|
||||
OSL_ENSURE( isValid(), "ScriptDocument::Impl::removeModuleOrDialog: invalid!" );
|
||||
if ( isValid() )
|
||||
if ( !isValid() )
|
||||
return false;
|
||||
try
|
||||
{
|
||||
try
|
||||
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) );
|
||||
if ( xLib.is() )
|
||||
{
|
||||
Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) );
|
||||
if ( xLib.is() )
|
||||
{
|
||||
xLib->removeByName( _rModuleName );
|
||||
Reference< XVBAModuleInfo > xVBAModuleInfo(xLib, UNO_QUERY);
|
||||
if(xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo(_rModuleName))
|
||||
xVBAModuleInfo->removeModuleInfo(_rModuleName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
DBG_UNHANDLED_EXCEPTION("basctl.basicide");
|
||||
xLib->removeByName( _rModuleName );
|
||||
Reference< XVBAModuleInfo > xVBAModuleInfo(xLib, UNO_QUERY);
|
||||
if(xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo(_rModuleName))
|
||||
xVBAModuleInfo->removeModuleInfo(_rModuleName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch( const Exception& )
|
||||
{
|
||||
DBG_UNHANDLED_EXCEPTION("basctl.basicide");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -174,25 +174,25 @@ namespace basegfx::internal
|
||||
|
||||
void testLastLine()
|
||||
{
|
||||
if(mpLine)
|
||||
if(!mpLine)
|
||||
return;
|
||||
|
||||
bool bNecessary(false);
|
||||
|
||||
for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++)
|
||||
{
|
||||
bool bNecessary(false);
|
||||
const double fDefault(implGetDefaultValue((RowSize - 1), a));
|
||||
const double fLineValue(mpLine->get(a));
|
||||
|
||||
for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++)
|
||||
if(!::basegfx::fTools::equal(fDefault, fLineValue))
|
||||
{
|
||||
const double fDefault(implGetDefaultValue((RowSize - 1), a));
|
||||
const double fLineValue(mpLine->get(a));
|
||||
|
||||
if(!::basegfx::fTools::equal(fDefault, fLineValue))
|
||||
{
|
||||
bNecessary = true;
|
||||
}
|
||||
bNecessary = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!bNecessary)
|
||||
{
|
||||
mpLine.reset();
|
||||
}
|
||||
if(!bNecessary)
|
||||
{
|
||||
mpLine.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -664,41 +664,34 @@ public:
|
||||
|
||||
bool operator==(const ImplB2DPolygon& rCandidate) const
|
||||
{
|
||||
if(mbIsClosed == rCandidate.mbIsClosed)
|
||||
if(mbIsClosed != rCandidate.mbIsClosed)
|
||||
return false;
|
||||
if(!(maPoints == rCandidate.maPoints))
|
||||
return false;
|
||||
bool bControlVectorsAreEqual(true);
|
||||
|
||||
if(moControlVector)
|
||||
{
|
||||
if(maPoints == rCandidate.maPoints)
|
||||
if(rCandidate.moControlVector)
|
||||
{
|
||||
bool bControlVectorsAreEqual(true);
|
||||
|
||||
if(moControlVector)
|
||||
{
|
||||
if(rCandidate.moControlVector)
|
||||
{
|
||||
bControlVectorsAreEqual = ((*moControlVector) == (*rCandidate.moControlVector));
|
||||
}
|
||||
else
|
||||
{
|
||||
// candidate has no control vector, so it's assumed all unused.
|
||||
bControlVectorsAreEqual = !moControlVector->isUsed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rCandidate.moControlVector)
|
||||
{
|
||||
// we have no control vector, so it's assumed all unused.
|
||||
bControlVectorsAreEqual = !rCandidate.moControlVector->isUsed();
|
||||
}
|
||||
}
|
||||
|
||||
if(bControlVectorsAreEqual)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bControlVectorsAreEqual = ((*moControlVector) == (*rCandidate.moControlVector));
|
||||
}
|
||||
else
|
||||
{
|
||||
// candidate has no control vector, so it's assumed all unused.
|
||||
bControlVectorsAreEqual = !moControlVector->isUsed();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(rCandidate.moControlVector)
|
||||
{
|
||||
// we have no control vector, so it's assumed all unused.
|
||||
bControlVectorsAreEqual = !rCandidate.moControlVector->isUsed();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return bControlVectorsAreEqual;
|
||||
}
|
||||
|
||||
const basegfx::B2DPoint& getPoint(sal_uInt32 nIndex) const
|
||||
|
@@ -1530,36 +1530,36 @@ namespace basegfx::utils
|
||||
const B2DPolygon& aCandidate(rCandidate.getDefaultAdaptiveSubdivision());
|
||||
const sal_uInt32 nPointCount(aCandidate.count());
|
||||
|
||||
if(nPointCount)
|
||||
if(!nPointCount)
|
||||
return false;
|
||||
|
||||
const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount : nPointCount - 1);
|
||||
B2DPoint aCurrent(aCandidate.getB2DPoint(0));
|
||||
|
||||
if(nEdgeCount)
|
||||
{
|
||||
const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount : nPointCount - 1);
|
||||
B2DPoint aCurrent(aCandidate.getB2DPoint(0));
|
||||
|
||||
if(nEdgeCount)
|
||||
// edges
|
||||
for(sal_uInt32 a(0); a < nEdgeCount; a++)
|
||||
{
|
||||
// edges
|
||||
for(sal_uInt32 a(0); a < nEdgeCount; a++)
|
||||
{
|
||||
const sal_uInt32 nNextIndex((a + 1) % nPointCount);
|
||||
const B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex));
|
||||
const sal_uInt32 nNextIndex((a + 1) % nPointCount);
|
||||
const B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex));
|
||||
|
||||
if(isInEpsilonRange(aCurrent, aNext, rTestPosition, fDistance))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// prepare next step
|
||||
aCurrent = aNext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no edges, but points -> not closed. Check single point. Just
|
||||
// use isInEpsilonRange with twice the same point, it handles those well
|
||||
if(isInEpsilonRange(aCurrent, aCurrent, rTestPosition, fDistance))
|
||||
if(isInEpsilonRange(aCurrent, aNext, rTestPosition, fDistance))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// prepare next step
|
||||
aCurrent = aNext;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no edges, but points -> not closed. Check single point. Just
|
||||
// use isInEpsilonRange with twice the same point, it handles those well
|
||||
if(isInEpsilonRange(aCurrent, aCurrent, rTestPosition, fDistance))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1933,29 +1933,29 @@ namespace basegfx::utils
|
||||
OSL_ENSURE(!rCandidate.areControlPointsUsed(), "hasNeutralPoints: ATM works not for curves (!)");
|
||||
const sal_uInt32 nPointCount(rCandidate.count());
|
||||
|
||||
if(nPointCount > 2)
|
||||
if(nPointCount <= 2)
|
||||
return false;
|
||||
|
||||
B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1));
|
||||
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0));
|
||||
|
||||
for(sal_uInt32 a(0); a < nPointCount; a++)
|
||||
{
|
||||
B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1));
|
||||
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0));
|
||||
const B2DPoint aNextPoint(rCandidate.getB2DPoint((a + 1) % nPointCount));
|
||||
const B2DVector aPrevVec(aPrevPoint - aCurrPoint);
|
||||
const B2DVector aNextVec(aNextPoint - aCurrPoint);
|
||||
const B2VectorOrientation aOrientation(getOrientation(aNextVec, aPrevVec));
|
||||
|
||||
for(sal_uInt32 a(0); a < nPointCount; a++)
|
||||
if(aOrientation == B2VectorOrientation::Neutral)
|
||||
{
|
||||
const B2DPoint aNextPoint(rCandidate.getB2DPoint((a + 1) % nPointCount));
|
||||
const B2DVector aPrevVec(aPrevPoint - aCurrPoint);
|
||||
const B2DVector aNextVec(aNextPoint - aCurrPoint);
|
||||
const B2VectorOrientation aOrientation(getOrientation(aNextVec, aPrevVec));
|
||||
|
||||
if(aOrientation == B2VectorOrientation::Neutral)
|
||||
{
|
||||
// current has neutral orientation
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// prepare next
|
||||
aPrevPoint = aCurrPoint;
|
||||
aCurrPoint = aNextPoint;
|
||||
}
|
||||
// current has neutral orientation
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// prepare next
|
||||
aPrevPoint = aCurrPoint;
|
||||
aCurrPoint = aNextPoint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2015,37 +2015,37 @@ namespace basegfx::utils
|
||||
OSL_ENSURE(!rCandidate.areControlPointsUsed(), "isConvex: ATM works not for curves (!)");
|
||||
const sal_uInt32 nPointCount(rCandidate.count());
|
||||
|
||||
if(nPointCount > 2)
|
||||
if(nPointCount <= 2)
|
||||
return true;
|
||||
|
||||
const B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1));
|
||||
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0));
|
||||
B2DVector aCurrVec(aPrevPoint - aCurrPoint);
|
||||
B2VectorOrientation aOrientation(B2VectorOrientation::Neutral);
|
||||
|
||||
for(sal_uInt32 a(0); a < nPointCount; a++)
|
||||
{
|
||||
const B2DPoint aPrevPoint(rCandidate.getB2DPoint(nPointCount - 1));
|
||||
B2DPoint aCurrPoint(rCandidate.getB2DPoint(0));
|
||||
B2DVector aCurrVec(aPrevPoint - aCurrPoint);
|
||||
B2VectorOrientation aOrientation(B2VectorOrientation::Neutral);
|
||||
const B2DPoint aNextPoint(rCandidate.getB2DPoint((a + 1) % nPointCount));
|
||||
const B2DVector aNextVec(aNextPoint - aCurrPoint);
|
||||
const B2VectorOrientation aCurrentOrientation(getOrientation(aNextVec, aCurrVec));
|
||||
|
||||
for(sal_uInt32 a(0); a < nPointCount; a++)
|
||||
if(aOrientation == B2VectorOrientation::Neutral)
|
||||
{
|
||||
const B2DPoint aNextPoint(rCandidate.getB2DPoint((a + 1) % nPointCount));
|
||||
const B2DVector aNextVec(aNextPoint - aCurrPoint);
|
||||
const B2VectorOrientation aCurrentOrientation(getOrientation(aNextVec, aCurrVec));
|
||||
|
||||
if(aOrientation == B2VectorOrientation::Neutral)
|
||||
{
|
||||
// set start value, maybe neutral again
|
||||
aOrientation = aCurrentOrientation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(aCurrentOrientation != B2VectorOrientation::Neutral && aCurrentOrientation != aOrientation)
|
||||
{
|
||||
// different orientations found, that's it
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// prepare next
|
||||
aCurrPoint = aNextPoint;
|
||||
aCurrVec = -aNextVec;
|
||||
// set start value, maybe neutral again
|
||||
aOrientation = aCurrentOrientation;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(aCurrentOrientation != B2VectorOrientation::Neutral && aCurrentOrientation != aOrientation)
|
||||
{
|
||||
// different orientations found, that's it
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// prepare next
|
||||
aCurrPoint = aNextPoint;
|
||||
aCurrVec = -aNextVec;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -180,23 +180,23 @@ namespace basegfx
|
||||
bool Triangulator::CheckPointInTriangle(EdgeEntry* pEdgeA, EdgeEntry const * pEdgeB, const B2DPoint& rTestPoint)
|
||||
{
|
||||
// inside triangle or on edge?
|
||||
if(utils::isPointInTriangle(pEdgeA->getStart(), pEdgeA->getEnd(), pEdgeB->getEnd(), rTestPoint, true))
|
||||
if(!utils::isPointInTriangle(pEdgeA->getStart(), pEdgeA->getEnd(), pEdgeB->getEnd(), rTestPoint, true))
|
||||
return true;
|
||||
|
||||
// but not on point
|
||||
if(!rTestPoint.equal(pEdgeA->getEnd()) && !rTestPoint.equal(pEdgeB->getEnd()))
|
||||
{
|
||||
// but not on point
|
||||
if(!rTestPoint.equal(pEdgeA->getEnd()) && !rTestPoint.equal(pEdgeB->getEnd()))
|
||||
{
|
||||
// found point in triangle -> split triangle inserting two edges
|
||||
EdgeEntry* pStart = new EdgeEntry(pEdgeA->getStart(), rTestPoint);
|
||||
EdgeEntry* pEnd = new EdgeEntry(*pStart);
|
||||
maNewEdgeEntries.emplace_back(pStart);
|
||||
maNewEdgeEntries.emplace_back(pEnd);
|
||||
// found point in triangle -> split triangle inserting two edges
|
||||
EdgeEntry* pStart = new EdgeEntry(pEdgeA->getStart(), rTestPoint);
|
||||
EdgeEntry* pEnd = new EdgeEntry(*pStart);
|
||||
maNewEdgeEntries.emplace_back(pStart);
|
||||
maNewEdgeEntries.emplace_back(pEnd);
|
||||
|
||||
pStart->setNext(pEnd);
|
||||
pEnd->setNext(pEdgeA->getNext());
|
||||
pEdgeA->setNext(pStart);
|
||||
pStart->setNext(pEnd);
|
||||
pEnd->setNext(pEdgeA->getNext());
|
||||
pEdgeA->setNext(pStart);
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -395,28 +395,26 @@ namespace basegfx::trapezoidhelper
|
||||
aEdgeB.getStart(), aDeltaB,
|
||||
CutFlagValue::LINE,
|
||||
&fCutA,
|
||||
&fCutB) != CutFlagValue::NONE)
|
||||
{
|
||||
// use a simple metric (length criteria) for choosing the numerically
|
||||
// better cut
|
||||
const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY());
|
||||
const double fSimpleLengthB(aDeltaB.getX() + aDeltaB.getY());
|
||||
const bool bAIsLonger(fSimpleLengthA > fSimpleLengthB);
|
||||
B2DPoint* pNewPoint = bAIsLonger
|
||||
? maNewPoints.allocatePoint(aEdgeA.getStart() + (fCutA * aDeltaA))
|
||||
: maNewPoints.allocatePoint(aEdgeB.getStart() + (fCutB * aDeltaB));
|
||||
&fCutB) == CutFlagValue::NONE)
|
||||
return false;
|
||||
|
||||
// try to split both edges
|
||||
bool bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent);
|
||||
bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent);
|
||||
// use a simple metric (length criteria) for choosing the numerically
|
||||
// better cut
|
||||
const double fSimpleLengthA(aDeltaA.getX() + aDeltaA.getY());
|
||||
const double fSimpleLengthB(aDeltaB.getX() + aDeltaB.getY());
|
||||
const bool bAIsLonger(fSimpleLengthA > fSimpleLengthB);
|
||||
B2DPoint* pNewPoint = bAIsLonger
|
||||
? maNewPoints.allocatePoint(aEdgeA.getStart() + (fCutA * aDeltaA))
|
||||
: maNewPoints.allocatePoint(aEdgeB.getStart() + (fCutB * aDeltaB));
|
||||
|
||||
if(!bRetval)
|
||||
maNewPoints.freeIfLast(pNewPoint);
|
||||
// try to split both edges
|
||||
bool bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent);
|
||||
bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent);
|
||||
|
||||
return bRetval;
|
||||
}
|
||||
if(!bRetval)
|
||||
maNewPoints.freeIfLast(pNewPoint);
|
||||
|
||||
return false;
|
||||
return bRetval;
|
||||
}
|
||||
|
||||
void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges)
|
||||
|
@@ -1596,38 +1596,38 @@ bool SbModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
|
||||
SetFlag( SbxFlagBits::ExtSearch | SbxFlagBits::GlobalSearch );
|
||||
sal_uInt8 bImage;
|
||||
rStrm.ReadUChar( bImage );
|
||||
if( bImage )
|
||||
{
|
||||
std::unique_ptr<SbiImage> p(new SbiImage);
|
||||
sal_uInt32 nImgVer = 0;
|
||||
if( !bImage )
|
||||
return true;
|
||||
|
||||
if( !p->Load( rStrm, nImgVer ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// If the image is in old format, we fix up the method start offsets
|
||||
if ( nImgVer < B_EXT_IMG_VERSION )
|
||||
{
|
||||
fixUpMethodStart( false, p.get() );
|
||||
p->ReleaseLegacyBuffer();
|
||||
}
|
||||
aComment = p->aComment;
|
||||
SetName( p->aName );
|
||||
if( p->GetCodeSize() )
|
||||
{
|
||||
aOUSource = p->aOUSource;
|
||||
// Old version: image away
|
||||
if( nVer == 1 )
|
||||
{
|
||||
SetSource32( p->aOUSource );
|
||||
}
|
||||
else
|
||||
pImage = std::move(p);
|
||||
}
|
||||
else
|
||||
std::unique_ptr<SbiImage> p(new SbiImage);
|
||||
sal_uInt32 nImgVer = 0;
|
||||
|
||||
if( !p->Load( rStrm, nImgVer ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// If the image is in old format, we fix up the method start offsets
|
||||
if ( nImgVer < B_EXT_IMG_VERSION )
|
||||
{
|
||||
fixUpMethodStart( false, p.get() );
|
||||
p->ReleaseLegacyBuffer();
|
||||
}
|
||||
aComment = p->aComment;
|
||||
SetName( p->aName );
|
||||
if( p->GetCodeSize() )
|
||||
{
|
||||
aOUSource = p->aOUSource;
|
||||
// Old version: image away
|
||||
if( nVer == 1 )
|
||||
{
|
||||
SetSource32( p->aOUSource );
|
||||
}
|
||||
else
|
||||
pImage = std::move(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetSource32( p->aOUSource );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@@ -50,27 +50,26 @@ ErrCode returnInt64InOutArg(SbxArray *pArgs, SbxVariable &rRetVal,
|
||||
pOut->PutCurrency(nValue);
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
if (pOut->IsObject())
|
||||
{
|
||||
// FIXME: should we clone this and use pOut->PutObject ?
|
||||
SbxObject* pObj = dynamic_cast<SbxObject*>( pOut->GetObject() );
|
||||
if (!pObj)
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
if (!pOut->IsObject())
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
|
||||
// We expect two Longs but other mappings could be possible too.
|
||||
SbxArray* pProps = pObj->GetProperties();
|
||||
if (pProps->Count() != 2)
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
SbxVariable* pLow = pProps->Get(0);
|
||||
SbxVariable* pHigh = pProps->Get(1);
|
||||
if (!pLow || !pLow->IsLong() ||
|
||||
!pHigh || !pHigh->IsLong())
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
pLow->PutLong(nValue & 0xffffffff);
|
||||
pHigh->PutLong(nValue >> 32);
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
// FIXME: should we clone this and use pOut->PutObject ?
|
||||
SbxObject* pObj = dynamic_cast<SbxObject*>( pOut->GetObject() );
|
||||
if (!pObj)
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
|
||||
// We expect two Longs but other mappings could be possible too.
|
||||
SbxArray* pProps = pObj->GetProperties();
|
||||
if (pProps->Count() != 2)
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
SbxVariable* pLow = pProps->Get(0);
|
||||
SbxVariable* pHigh = pProps->Get(1);
|
||||
if (!pLow || !pLow->IsLong() ||
|
||||
!pHigh || !pHigh->IsLong())
|
||||
return ERRCODE_BASIC_BAD_ARGUMENT;
|
||||
pLow->PutLong(nValue & 0xffffffff);
|
||||
pHigh->PutLong(nValue >> 32);
|
||||
return ERRCODE_NONE;
|
||||
}
|
||||
|
||||
ErrCode builtin_kernel32(std::u16string_view aFuncName, SbxArray *pArgs,
|
||||
|
@@ -1666,40 +1666,39 @@ static bool checkUnoStructCopy( bool bVBA, SbxVariableRef const & refVal, SbxVar
|
||||
aAny = pUnoVal ? pUnoVal->getUnoAny() : pUnoStructVal->getUnoAny();
|
||||
else
|
||||
return false;
|
||||
if ( aAny.getValueType().getTypeClass() == TypeClass_STRUCT )
|
||||
if ( aAny.getValueType().getTypeClass() != TypeClass_STRUCT )
|
||||
return false;
|
||||
|
||||
refVar->SetType( SbxOBJECT );
|
||||
ErrCode eOldErr = SbxBase::GetError();
|
||||
// There are some circumstances when calling GetObject
|
||||
// will trigger an error, we need to squash those here.
|
||||
// Alternatively it is possible that the same scenario
|
||||
// could overwrite and existing error. Lets prevent that
|
||||
SbxObjectRef xVarObj = static_cast<SbxObject*>(refVar->GetObject());
|
||||
if ( eOldErr != ERRCODE_NONE )
|
||||
SbxBase::SetError( eOldErr );
|
||||
else
|
||||
SbxBase::ResetError();
|
||||
|
||||
SbUnoStructRefObject* pUnoStructObj = dynamic_cast<SbUnoStructRefObject*>( xVarObj.get() );
|
||||
|
||||
OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName();
|
||||
OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName();
|
||||
|
||||
if ( pUnoStructObj )
|
||||
{
|
||||
refVar->SetType( SbxOBJECT );
|
||||
ErrCode eOldErr = SbxBase::GetError();
|
||||
// There are some circumstances when calling GetObject
|
||||
// will trigger an error, we need to squash those here.
|
||||
// Alternatively it is possible that the same scenario
|
||||
// could overwrite and existing error. Lets prevent that
|
||||
SbxObjectRef xVarObj = static_cast<SbxObject*>(refVar->GetObject());
|
||||
if ( eOldErr != ERRCODE_NONE )
|
||||
SbxBase::SetError( eOldErr );
|
||||
else
|
||||
SbxBase::ResetError();
|
||||
|
||||
SbUnoStructRefObject* pUnoStructObj = dynamic_cast<SbUnoStructRefObject*>( xVarObj.get() );
|
||||
|
||||
OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName();
|
||||
OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName();
|
||||
|
||||
if ( pUnoStructObj )
|
||||
{
|
||||
StructRefInfo aInfo = pUnoStructObj->getStructInfo();
|
||||
aInfo.setValue( aAny );
|
||||
}
|
||||
else
|
||||
{
|
||||
SbUnoObject* pNewUnoObj = new SbUnoObject( sName, aAny );
|
||||
// #70324: adopt ClassName
|
||||
pNewUnoObj->SetClassName( sClassName );
|
||||
refVar->PutObject( pNewUnoObj );
|
||||
}
|
||||
return true;
|
||||
StructRefInfo aInfo = pUnoStructObj->getStructInfo();
|
||||
aInfo.setValue( aAny );
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
SbUnoObject* pNewUnoObj = new SbUnoObject( sName, aAny );
|
||||
// #70324: adopt ClassName
|
||||
pNewUnoObj->SetClassName( sClassName );
|
||||
refVar->PutObject( pNewUnoObj );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -687,40 +687,40 @@ bool SbxValue::SetType( SbxDataType t )
|
||||
}
|
||||
t = SbxEMPTY;
|
||||
}
|
||||
if( ( t & 0x0FFF ) != ( aData.eType & 0x0FFF ) )
|
||||
if( ( t & 0x0FFF ) == ( aData.eType & 0x0FFF ) )
|
||||
return true;
|
||||
|
||||
if( !CanWrite() || IsFixed() )
|
||||
{
|
||||
if( !CanWrite() || IsFixed() )
|
||||
SetError( ERRCODE_BASIC_CONVERSION );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// De-allocate potential objects
|
||||
switch( aData.eType )
|
||||
{
|
||||
SetError( ERRCODE_BASIC_CONVERSION );
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// De-allocate potential objects
|
||||
switch( aData.eType )
|
||||
{
|
||||
case SbxSTRING:
|
||||
delete aData.pOUString;
|
||||
break;
|
||||
case SbxOBJECT:
|
||||
if( aData.pObj && aData.pObj != this )
|
||||
{
|
||||
SAL_WARN("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
|
||||
SbxVariable *pThisVar = dynamic_cast<SbxVariable*>( this );
|
||||
sal_uInt32 nSlotId = pThisVar
|
||||
? pThisVar->GetUserData() & 0xFFFF
|
||||
: 0;
|
||||
DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == "Parent",
|
||||
"SID_PARENTOBJECT is not named 'Parent'" );
|
||||
bool bParentProp = nSlotId == 5345;
|
||||
if ( !bParentProp )
|
||||
aData.pObj->ReleaseRef();
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
aData.clear(t);
|
||||
case SbxSTRING:
|
||||
delete aData.pOUString;
|
||||
break;
|
||||
case SbxOBJECT:
|
||||
if( aData.pObj && aData.pObj != this )
|
||||
{
|
||||
SAL_WARN("basic.sbx", "Not at Parent-Prop - otherwise CyclicRef");
|
||||
SbxVariable *pThisVar = dynamic_cast<SbxVariable*>( this );
|
||||
sal_uInt32 nSlotId = pThisVar
|
||||
? pThisVar->GetUserData() & 0xFFFF
|
||||
: 0;
|
||||
DBG_ASSERT( nSlotId != 5345 || pThisVar->GetName() == "Parent",
|
||||
"SID_PARENTOBJECT is not named 'Parent'" );
|
||||
bool bParentProp = nSlotId == 5345;
|
||||
if ( !bParentProp )
|
||||
aData.pObj->ReleaseRef();
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
aData.clear(t);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user