diff options
-rw-r--r-- | accessibility/source/extended/accessiblelistboxentry.cxx | 39 | ||||
-rw-r--r-- | avmedia/source/viewer/mediawindow.cxx | 56 | ||||
-rw-r--r-- | basctl/source/basicide/basobj2.cxx | 41 | ||||
-rw-r--r-- | basctl/source/basicide/basobj3.cxx | 32 | ||||
-rw-r--r-- | basctl/source/basicide/scriptdocument.cxx | 29 | ||||
-rw-r--r-- | basegfx/source/inc/hommatrixtemplate.hxx | 28 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygon.cxx | 53 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygontools.cxx | 138 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dpolygontriangulator.cxx | 28 | ||||
-rw-r--r-- | basegfx/source/polygon/b2dtrapezoid.cxx | 40 | ||||
-rw-r--r-- | basic/source/classes/sbxmod.cxx | 56 | ||||
-rw-r--r-- | basic/source/runtime/dllmgr-none.cxx | 41 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 59 | ||||
-rw-r--r-- | basic/source/sbx/sbxvalue.cxx | 62 |
14 files changed, 345 insertions, 357 deletions
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx index 716955b69595..be1d98650324 100644 --- a/accessibility/source/extended/accessiblelistboxentry.cxx +++ b/accessibility/source/extended/accessiblelistboxentry.cxx @@ -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( ) diff --git a/avmedia/source/viewer/mediawindow.cxx b/avmedia/source/viewer/mediawindow.cxx index 4ff32f636eb6..039ef62d4693 100644 --- a/avmedia/source/viewer/mediawindow.cxx +++ b/avmedia/source/viewer/mediawindow.cxx @@ -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() ); - - pPreferredSizePixel->setWidth( aAwtSize.Width ); - pPreferredSizePixel->setHeight( aAwtSize.Height ); - } + const awt::Size aAwtSize( xPlayer->getPreferredPlayerWindowSize() ); - 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; } } } diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx index f14535cbd3f1..28c1acdb383f 100644 --- a/basctl/source/basicide/basobj2.cxx +++ b/basctl/source/basicide/basobj2.cxx @@ -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; } diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx index 06f7c6a9e08c..26de81e35cb9 100644 --- a/basctl/source/basicide/basobj3.cxx +++ b/basctl/source/basicide/basobj3.cxx @@ -180,24 +180,24 @@ bool RenameDialog ( if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) ) return false; - if (pWin && pShell) - { - // set new name in window - pWin->SetName( rNewName ); + if (!pWin || !pShell) + return true; - // update property browser - pWin->UpdateBrowser(); + // set new name in window + pWin->SetName( rNewName ); - // 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() ); - } + // 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() ); } return true; } diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index fcef9e78802b..e23cfbe7a113 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -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() ) - { - xLib->removeByName( _rModuleName ); - Reference< XVBAModuleInfo > xVBAModuleInfo(xLib, UNO_QUERY); - if(xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo(_rModuleName)) - xVBAModuleInfo->removeModuleInfo(_rModuleName); - return true; - } - } - catch( const Exception& ) + Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, true ) ); + if ( xLib.is() ) { - 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; } diff --git a/basegfx/source/inc/hommatrixtemplate.hxx b/basegfx/source/inc/hommatrixtemplate.hxx index 44f7cd8027cf..a80df114c3e3 100644 --- a/basegfx/source/inc/hommatrixtemplate.hxx +++ b/basegfx/source/inc/hommatrixtemplate.hxx @@ -174,26 +174,26 @@ namespace basegfx::internal void testLastLine() { - if(mpLine) - { - bool bNecessary(false); + if(!mpLine) + return; - for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++) - { - const double fDefault(implGetDefaultValue((RowSize - 1), a)); - const double fLineValue(mpLine->get(a)); + bool bNecessary(false); - if(!::basegfx::fTools::equal(fDefault, fLineValue)) - { - bNecessary = true; - } - } + for(sal_uInt16 a(0);!bNecessary && a < RowSize; a++) + { + const double fDefault(implGetDefaultValue((RowSize - 1), a)); + const double fLineValue(mpLine->get(a)); - if(!bNecessary) + if(!::basegfx::fTools::equal(fDefault, fLineValue)) { - mpLine.reset(); + bNecessary = true; } } + + if(!bNecessary) + { + mpLine.reset(); + } } // Left-upper decomposition diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 4d2b681911e2..3c85a2666d25 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -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 diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index d497716e9c31..c6eb3cf5b28b 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -1530,36 +1530,36 @@ namespace basegfx::utils const B2DPolygon& aCandidate(rCandidate.getDefaultAdaptiveSubdivision()); const sal_uInt32 nPointCount(aCandidate.count()); - if(nPointCount) - { - 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++) - { - const sal_uInt32 nNextIndex((a + 1) % nPointCount); - const B2DPoint aNext(aCandidate.getB2DPoint(nNextIndex)); + if(!nPointCount) + return false; - if(isInEpsilonRange(aCurrent, aNext, rTestPosition, fDistance)) - { - return true; - } + const sal_uInt32 nEdgeCount(aCandidate.isClosed() ? nPointCount : nPointCount - 1); + B2DPoint aCurrent(aCandidate.getB2DPoint(0)); - // prepare next step - aCurrent = aNext; - } - } - else + if(nEdgeCount) + { + // edges + for(sal_uInt32 a(0); a < nEdgeCount; a++) { - // 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)) + 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)) + { + 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 + // set start value, maybe neutral again + aOrientation = aCurrentOrientation; + } + else + { + if(aCurrentOrientation != B2VectorOrientation::Neutral && aCurrentOrientation != aOrientation) { - if(aCurrentOrientation != B2VectorOrientation::Neutral && aCurrentOrientation != aOrientation) - { - // different orientations found, that's it - return false; - } + // different orientations found, that's it + return false; } - - // prepare next - aCurrPoint = aNextPoint; - aCurrVec = -aNextVec; } + + // prepare next + aCurrPoint = aNextPoint; + aCurrVec = -aNextVec; } return true; diff --git a/basegfx/source/polygon/b2dpolygontriangulator.cxx b/basegfx/source/polygon/b2dpolygontriangulator.cxx index 880b1b5c310c..5fbd3960e585 100644 --- a/basegfx/source/polygon/b2dpolygontriangulator.cxx +++ b/basegfx/source/polygon/b2dpolygontriangulator.cxx @@ -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; diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index 0bfb8fb5705f..b7991dbf55d4 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -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)); - - // try to split both edges - bool bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent); - bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent); - - if(!bRetval) - maNewPoints.freeIfLast(pNewPoint); - - return bRetval; - } + &fCutB) == CutFlagValue::NONE) + return false; + + // 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)); + + // try to split both edges + bool bRetval = splitEdgeAtGivenPoint(aEdgeA, *pNewPoint, aCurrent); + bRetval |= splitEdgeAtGivenPoint(aEdgeB, *pNewPoint, aCurrent); + + if(!bRetval) + maNewPoints.freeIfLast(pNewPoint); - return false; + return bRetval; } void solveHorizontalEdges(TrDeSimpleEdges& rTrDeSimpleEdges) diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index cdd05c0c1f14..2d38de16dcfd 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -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; } diff --git a/basic/source/runtime/dllmgr-none.cxx b/basic/source/runtime/dllmgr-none.cxx index 30070977d215..7d49ba1bdcdb 100644 --- a/basic/source/runtime/dllmgr-none.cxx +++ b/basic/source/runtime/dllmgr-none.cxx @@ -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; - - // 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; + if (!pOut->IsObject()) + 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, diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index bad307f27dd6..afc785e76b32 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -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 ) - { - 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(); + if ( aAny.getValueType().getTypeClass() != TypeClass_STRUCT ) + return false; - SbUnoStructRefObject* pUnoStructObj = dynamic_cast<SbUnoStructRefObject*>( xVarObj.get() ); + 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(); - OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName(); - OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName(); + SbUnoStructRefObject* pUnoStructObj = dynamic_cast<SbUnoStructRefObject*>( xVarObj.get() ); - 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; + OUString sClassName = pUnoVal ? pUnoVal->GetClassName() : pUnoStructVal->GetClassName(); + OUString sName = pUnoVal ? pUnoVal->GetName() : pUnoStructVal->GetName(); + + if ( pUnoStructObj ) + { + 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; } diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx index fe7245a6da76..10396c3e5eb9 100644 --- a/basic/source/sbx/sbxvalue.cxx +++ b/basic/source/sbx/sbxvalue.cxx @@ -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 + SetError( ERRCODE_BASIC_CONVERSION ); + return false; + } + else + { + // De-allocate potential objects + switch( aData.eType ) { - // 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; } |