basegfx/source/matrix/b2dhommatrixtools.cxx | 41 ++++++++++++ basegfx/source/polygon/b2dpolygon.cxx | 2 basegfx/source/polygon/b2dpolygontools.cxx | 33 +++++++++ basegfx/source/polygon/b2dpolypolygoncutter.cxx | 77 ++++++++++++++++++++++- basegfx/source/polygon/b2dpolypolygontools.cxx | 17 +++++ extensions/source/bibliography/toolbar.cxx | 15 ++-- extensions/source/bibliography/toolbar.hxx | 8 +- extensions/source/propctrlr/browserline.cxx | 4 - extensions/source/propctrlr/browserline.hxx | 4 - extensions/source/update/ui/updatecheckui.cxx | 29 +++----- include/basegfx/matrix/b2dhommatrixtools.hxx | 6 + include/basegfx/polygon/b2dpolygontools.hxx | 5 + include/basegfx/polygon/b2dpolypolygontools.hxx | 5 + include/basegfx/tuple/b2dtuple.hxx | 4 - include/basegfx/tuple/b3dtuple.hxx | 4 - sc/source/ui/inc/output.hxx | 2 sc/source/ui/view/gridwin.cxx | 8 +- sc/source/ui/view/output.cxx | 34 +++++----- vcl/source/gdi/region.cxx | 5 - vcl/source/window/builder.cxx | 1 vcl/win/source/gdi/salgdi.cxx | 80 ++++++++++++++++++++---- 21 files changed, 311 insertions(+), 73 deletions(-)
New commits: commit f0b9a27703db603a6a2fcf1d6f4db87e0bf4823b Author: Caolán McNamara <[email protected]> Date: Wed Aug 14 10:00:48 2013 +0100 make extensions XubString free Change-Id: I0216d11ade872af889fc805e4c2a9241f7f230c5 diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index ea3999f..0c3c90b 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -104,7 +104,7 @@ void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureS const OUString* pStringArray = (const OUString*)pStringSeq->getConstArray(); sal_uInt32 nCount = pStringSeq->getLength(); - XubString aEntry; + OUString aEntry; for( sal_uInt32 i=0; i<nCount; i++ ) { aEntry = String(pStringArray[i]); @@ -113,8 +113,7 @@ void BibTBListBoxListener::statusChanged(const ::com::sun::star::frame::FeatureS pToolBar->UpdateSourceList(sal_True); } - XubString aStr = String(rEvt.FeatureDescriptor); - pToolBar->SelectSourceEntry(aStr); + pToolBar->SelectSourceEntry(rEvt.FeatureDescriptor); } }; @@ -219,7 +218,7 @@ BibToolBar::BibToolBar(Window* pParent, Link aLink, WinBits nStyle): aEdQuery.SetSizePixel(aLBSource.GetSizePixel()); aEdQuery.Show(); - XubString aStr=GetItemText(TBC_FT_SOURCE); + OUString aStr=GetItemText(TBC_FT_SOURCE); Rectangle aRect=GetItemRect(TBC_FT_SOURCE); aFtSource.SetText(aStr); aFtSource.SetSizePixel(aRect.GetSize()); @@ -377,7 +376,7 @@ void BibToolBar::ClearFilterMenu() aPopupMenu.Clear(); nMenuId=0; } -sal_uInt16 BibToolBar::InsertFilterItem(const XubString& aMenuEntry) +sal_uInt16 BibToolBar::InsertFilterItem(const OUString& aMenuEntry) { nMenuId++; aPopupMenu.InsertItem(nMenuId,aMenuEntry); @@ -407,12 +406,12 @@ void BibToolBar::UpdateSourceList(sal_Bool bFlag) aLBSource.SetUpdateMode(bFlag); } -void BibToolBar::InsertSourceEntry(const XubString& aEntry, sal_uInt16 nPos) +void BibToolBar::InsertSourceEntry(const OUString& aEntry, sal_uInt16 nPos) { aLBSource.InsertEntry(aEntry, nPos); } -void BibToolBar::SelectSourceEntry(const XubString& aStr) +void BibToolBar::SelectSourceEntry(const OUString& aStr) { aLBSource.SelectEntry(aStr); } @@ -423,7 +422,7 @@ void BibToolBar::EnableQuery(sal_Bool bFlag) aEdQuery.Enable(bFlag); } -void BibToolBar::SetQueryString(const XubString& aStr) +void BibToolBar::SetQueryString(const OUString& aStr) { aEdQuery.SetText(aStr); } diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx index 877931c..b7cc0f5 100644 --- a/extensions/source/bibliography/toolbar.hxx +++ b/extensions/source/bibliography/toolbar.hxx @@ -156,15 +156,15 @@ class BibToolBar: public ToolBox void ClearSourceList(); void UpdateSourceList(sal_Bool bFlag=sal_True); void EnableSourceList(sal_Bool bFlag=sal_True); - void InsertSourceEntry(const XubString&,sal_uInt16 nPos=LISTBOX_APPEND ); - void SelectSourceEntry(const XubString& ); + void InsertSourceEntry(const OUString&,sal_uInt16 nPos=LISTBOX_APPEND ); + void SelectSourceEntry(const OUString& ); void EnableQuery(sal_Bool bFlag=sal_True); - void SetQueryString(const XubString& ); + void SetQueryString(const OUString& ); void AdjustToolBox(); void ClearFilterMenu(); - sal_uInt16 InsertFilterItem(const XubString& ); + sal_uInt16 InsertFilterItem(const OUString& ); void SelectFilterItem(sal_uInt16 nId); void statusChanged(const ::com::sun::star::frame::FeatureStateEvent& Event) diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx index d88fdad..3e9d031 100644 --- a/extensions/source/propctrlr/browserline.cxx +++ b/extensions/source/propctrlr/browserline.cxx @@ -256,7 +256,7 @@ namespace pcr } //------------------------------------------------------------------ - void OBrowserLine::SetTitle(const XubString& _rNewTtile ) + void OBrowserLine::SetTitle(const OUString& _rNewTtile ) { if ( GetTitle() == _rNewTtile ) return; @@ -291,7 +291,7 @@ namespace pcr } //------------------------------------------------------------------ - XubString OBrowserLine::GetTitle() const + OUString OBrowserLine::GetTitle() const { OUString sDisplayName = m_aFtTitle.GetText(); diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx index c137198..32c3462 100644 --- a/extensions/source/propctrlr/browserline.hxx +++ b/extensions/source/propctrlr/browserline.hxx @@ -85,9 +85,9 @@ namespace pcr void SetComponentHelpIds( const OString& _rHelpId, const OString& _sPrimaryButtonId, const OString& _sSecondaryButtonId ); - void SetTitle(const String& rString ); + void SetTitle(const OUString& rString ); void FullFillTitleString(); - String GetTitle() const; + OUString GetTitle() const; void SetTitleWidth(sal_uInt16); void SetPosSizePixel(Point aPos,Size aSize); diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx index 57861a7..7f1ec03 100644 --- a/extensions/source/update/ui/updatecheckui.cxx +++ b/extensions/source/update/ui/updatecheckui.cxx @@ -90,8 +90,8 @@ class BubbleWindow : public FloatingWindow Region maBounds; Polygon maRectPoly; Polygon maTriPoly; - XubString maBubbleTitle; - XubString maBubbleText; + OUString maBubbleTitle; + OUString maBubbleText; Image maBubbleImage; Size maMaxTextSize; Rectangle maTitleRect; @@ -102,8 +102,8 @@ private: void RecalcTextRects(); public: - BubbleWindow( Window* pParent, const XubString& rTitle, - const XubString& rText, const Image& rImage ); + BubbleWindow( Window* pParent, const OUString& rTitle, + const OUString& rText, const Image& rImage ); ~BubbleWindow(); virtual void MouseButtonDown( const MouseEvent& rMEvt ); @@ -111,7 +111,7 @@ public: void Resize(); void Show( sal_Bool bVisible = sal_True, sal_uInt16 nFlags = SHOW_NOACTIVATE ); void SetTipPosPixel( const Point& rTipPos ) { maTipPos = rTipPos; } - void SetTitleAndText( const XubString& rTitle, const XubString& rText, + void SetTitleAndText( const OUString& rTitle, const OUString& rText, const Image& rImage ); }; @@ -552,15 +552,12 @@ BubbleWindow * UpdateCheckUI::GetBubbleWindow() BubbleWindow* pBubbleWin = mpBubbleWin; if ( !pBubbleWin ) { - pBubbleWin = new BubbleWindow( mpIconSysWin, - XubString( maBubbleTitle ), - XubString( maBubbleText ), - maBubbleImage ); + pBubbleWin = new BubbleWindow( mpIconSysWin, maBubbleTitle, + maBubbleText, maBubbleImage ); mbBubbleChanged = false; } else if ( mbBubbleChanged ) { - pBubbleWin->SetTitleAndText( XubString( maBubbleTitle ), - XubString( maBubbleText ), + pBubbleWin->SetTitleAndText( maBubbleTitle, maBubbleText, maBubbleImage ); mbBubbleChanged = false; } @@ -784,8 +781,8 @@ IMPL_LINK( UpdateCheckUI, ApplicationEventHdl, VclSimpleEvent *, pEvent) #define TEXT_MAX_HEIGHT 200 //------------------------------------------------------------------------------ -BubbleWindow::BubbleWindow( Window* pParent, const XubString& rTitle, - const XubString& rText, const Image& rImage ) +BubbleWindow::BubbleWindow( Window* pParent, const OUString& rTitle, + const OUString& rText, const Image& rImage ) : FloatingWindow( pParent, WB_SYSTEMWINDOW | WB_OWNERDRAWDECORATION | WB_NOBORDER @@ -836,8 +833,8 @@ void BubbleWindow::Resize() } //------------------------------------------------------------------------------ -void BubbleWindow::SetTitleAndText( const XubString& rTitle, - const XubString& rText, +void BubbleWindow::SetTitleAndText( const OUString& rTitle, + const OUString& rText, const Image& rImage ) { maBubbleTitle = rTitle; @@ -905,7 +902,7 @@ void BubbleWindow::Show( sal_Bool bVisible, sal_uInt16 nFlags ) } // don't show bubbles without a text - if ( ( maBubbleTitle.Len() == 0 ) && ( maBubbleText.Len() == 0 ) ) + if ( ( maBubbleTitle.isEmpty() ) && ( maBubbleText.isEmpty() ) ) return; Size aWindowSize = GetSizePixel(); commit fbe0e7c1050268ece3961390feeeff2ecc428df7 Author: Caolán McNamara <[email protected]> Date: Wed Aug 14 09:45:17 2013 +0100 set helpid for toolbuttons Change-Id: I4cc2d199ed94444a056134359cbe2674a2885555 diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 9d31230..4c25fae 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1447,6 +1447,7 @@ Window *VclBuilder::makeObject(Window *pParent, const OString &name, const OStri pToolBox->InsertItem(nItemId, OStringToOUString(extractLabel(rMap), RTL_TEXTENCODING_UTF8), nBits); pToolBox->SetItemCommand(nItemId, aCommand); + pToolBox->SetHelpId(nItemId, m_sHelpRoot + id); } OUString sTooltip(OStringToOUString(extractTooltipText(rMap), RTL_TEXTENCODING_UTF8)); commit b5c9668d34acdbce500609725760d6578debb95a Author: Armin Le Grand <[email protected]> Date: Tue Aug 13 15:10:34 2013 +0000 Resolves: #i122149# Corrected stuff around polygon-based clip regions do not use them where not needed (cherry picked from commit 4ccb1eb7d58005ab3b501b7c6ff128fadbcd5066) Conflicts: basegfx/inc/basegfx/matrix/b2dhommatrixtools.hxx basegfx/inc/basegfx/polygon/b2dpolygontools.hxx basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx basegfx/inc/basegfx/tuple/b2dtuple.hxx basegfx/inc/basegfx/tuple/b3dtuple.hxx sc/source/ui/inc/output.hxx sc/source/ui/view/gridwin.cxx sc/source/ui/view/output.cxx vcl/win/source/gdi/salgdi.cxx Change-Id: Ie265814a51180bffe3c821a3f2148cb3bb54ecad diff --git a/basegfx/source/matrix/b2dhommatrixtools.cxx b/basegfx/source/matrix/b2dhommatrixtools.cxx index 5666064..3e39fd5 100644 --- a/basegfx/source/matrix/b2dhommatrixtools.cxx +++ b/basegfx/source/matrix/b2dhommatrixtools.cxx @@ -357,6 +357,47 @@ namespace basegfx return aRetval; } + + /// special for the case to map from source range to target range + B2DHomMatrix createSourceRangeTargetRangeTransform( + const B2DRange& rSourceRange, + const B2DRange& rTargetRange) + { + B2DHomMatrix aRetval; + + if(&rSourceRange == &rTargetRange) + { + return aRetval; + } + + if(!fTools::equalZero(rSourceRange.getMinX()) || !fTools::equalZero(rSourceRange.getMinY())) + { + aRetval.set(0, 2, -rSourceRange.getMinX()); + aRetval.set(1, 2, -rSourceRange.getMinY()); + } + + const double fSourceW(rSourceRange.getWidth()); + const double fSourceH(rSourceRange.getHeight()); + const bool bDivX(!fTools::equalZero(fSourceW) && !fTools::equal(fSourceW, 1.0)); + const bool bDivY(!fTools::equalZero(fSourceH) && !fTools::equal(fSourceH, 1.0)); + const double fScaleX(bDivX ? rTargetRange.getWidth() / fSourceW : rTargetRange.getWidth()); + const double fScaleY(bDivY ? rTargetRange.getHeight() / fSourceH : rTargetRange.getHeight()); + + if(!fTools::equalZero(fScaleX) || !fTools::equalZero(fScaleY)) + { + aRetval.scale(fScaleX, fScaleY); + } + + if(!fTools::equalZero(rTargetRange.getMinX()) || !fTools::equalZero(rTargetRange.getMinY())) + { + aRetval.translate( + rTargetRange.getMinX(), + rTargetRange.getMinY()); + } + + return aRetval; + } + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 6b661f9..a24cab4 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -1252,7 +1252,7 @@ namespace basegfx { OSL_ENSURE(nIndex < mpPolygon->count(), "B2DPolygon access outside range (!)"); - if(getB2DPoint(nIndex) != rValue) + if(mpPolygon->getPoint(nIndex) != rValue) { mpPolygon->setPoint(nIndex, rValue); } diff --git a/basegfx/source/polygon/b2dpolygontools.cxx b/basegfx/source/polygon/b2dpolygontools.cxx index 59b2813..de75b15 100644 --- a/basegfx/source/polygon/b2dpolygontools.cxx +++ b/basegfx/source/polygon/b2dpolygontools.cxx @@ -3193,6 +3193,39 @@ namespace basegfx } } + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate) + { + if(rCandidate.areControlPointsUsed()) + { + return false; + } + + const sal_uInt32 nPointCount(rCandidate.count()); + + if(nPointCount < 2) + { + return true; + } + + const sal_uInt32 nEdgeCount(rCandidate.isClosed() ? nPointCount + 1 : nPointCount); + basegfx::B2DPoint aLast(rCandidate.getB2DPoint(0)); + + for(sal_uInt32 a(1); a < nEdgeCount; a++) + { + const sal_uInt32 nNextIndex(a % nPointCount); + const basegfx::B2DPoint aCurrent(rCandidate.getB2DPoint(nNextIndex)); + + if(!basegfx::fTools::equal(aLast.getX(), aCurrent.getX()) && !basegfx::fTools::equal(aLast.getY(), aCurrent.getY())) + { + return false; + } + + aLast = aCurrent; + } + + return true; + } + } // end of namespace tools } // end of namespace basegfx diff --git a/basegfx/source/polygon/b2dpolypolygoncutter.cxx b/basegfx/source/polygon/b2dpolypolygoncutter.cxx index f30d922..22b9d4f 100644 --- a/basegfx/source/polygon/b2dpolypolygoncutter.cxx +++ b/basegfx/source/polygon/b2dpolypolygoncutter.cxx @@ -104,6 +104,8 @@ namespace basegfx typedef ::std::vector< PN > PNV; typedef ::std::vector< VN > VNV; typedef ::std::vector< SN > SNV; + typedef ::std::pair< basegfx::B2DPoint /*orig*/, basegfx::B2DPoint /*repl*/ > CorrectionPair; + typedef ::std::vector< CorrectionPair > CorrectionTable; ////////////////////////////////////////////////////////////////////////////// @@ -114,6 +116,7 @@ namespace basegfx PNV maPNV; VNV maVNV; SNV maSNV; + CorrectionTable maCorrectionTable; unsigned mbIsCurve : 1; unsigned mbChanged : 1; @@ -438,13 +441,44 @@ namespace basegfx void impSolve() { - // sort by point to identify common nodes + // sort by point to identify common nodes easier ::std::sort(maSNV.begin(), maSNV.end()); // handle common nodes const sal_uInt32 nNodeCount(maSNV.size()); + sal_uInt32 a(0); - for(sal_uInt32 a(0); a < nNodeCount - 1; a++) + // snap unsharp-equal points + if(nNodeCount) + { + basegfx::B2DPoint* pLast(&maSNV[0].mpPN->maPoint); + + for(a = 1; a < nNodeCount; a++) + { + basegfx::B2DPoint* pCurrent(&maSNV[a].mpPN->maPoint); + + if(pLast->equal(*pCurrent) && (pLast->getX() != pCurrent->getX() || pLast->getY() != pCurrent->getY())) + { + const basegfx::B2DPoint aMiddle((*pLast + *pCurrent) * 0.5); + + if(pLast->getX() != aMiddle.getX() || pLast->getY() != aMiddle.getY()) + { + maCorrectionTable.push_back(CorrectionPair(*pLast, aMiddle)); + *pLast = aMiddle; + } + + if(pCurrent->getX() != aMiddle.getX() || pCurrent->getY() != aMiddle.getY()) + { + maCorrectionTable.push_back(CorrectionPair(*pCurrent, aMiddle)); + *pCurrent = aMiddle; + } + } + + pLast = pCurrent; + } + } + + for(a = 0; a < nNodeCount - 1; a++) { // test a before using it, not after. Also use nPointCount instead of aSortNodes.size() PN& rPNb = *(maSNV[a].mpPN); @@ -614,8 +648,45 @@ namespace basegfx } else { + const sal_uInt32 nCorrectionSize(maCorrectionTable.size()); + // no change, return original - return maOriginal; + if(!nCorrectionSize) + { + return maOriginal; + } + + // apply coordinate corrections to ensure inside/outside correctness after solving + const sal_uInt32 nPolygonCount(maOriginal.count()); + basegfx::B2DPolyPolygon aRetval(maOriginal); + + for(sal_uInt32 a(0); a < nPolygonCount; a++) + { + basegfx::B2DPolygon aTemp(aRetval.getB2DPolygon(a)); + const sal_uInt32 nPointCount(aTemp.count()); + bool bChanged; + + for(sal_uInt32 b(0); b < nPointCount; b++) + { + const basegfx::B2DPoint aCandidate(aTemp.getB2DPoint(b)); + + for(sal_uInt32 c(0); c < nCorrectionSize; c++) + { + if(maCorrectionTable[c].first.getX() == aCandidate.getX() && maCorrectionTable[c].first.getY() == aCandidate.getY()) + { + aTemp.setB2DPoint(b, maCorrectionTable[c].second); + bChanged = true; + } + } + } + + if(bChanged) + { + aRetval.setB2DPolygon(a, aTemp); + } + } + + return aRetval; } } }; diff --git a/basegfx/source/polygon/b2dpolypolygontools.cxx b/basegfx/source/polygon/b2dpolypolygontools.cxx index c2b18ef..b7db01c 100644 --- a/basegfx/source/polygon/b2dpolypolygontools.cxx +++ b/basegfx/source/polygon/b2dpolypolygontools.cxx @@ -498,6 +498,23 @@ namespace basegfx return aRetval; } + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate) + { + if(rCandidate.areControlPointsUsed()) + { + return false; + } + + for(sal_uInt32 a(0); a < rCandidate.count(); a++) + { + if(!containsOnlyHorizontalAndVerticalEdges(rCandidate.getB2DPolygon(a))) + { + return false; + } + } + + return true; + } } // end of namespace tools } // end of namespace basegfx diff --git a/include/basegfx/matrix/b2dhommatrixtools.hxx b/include/basegfx/matrix/b2dhommatrixtools.hxx index ed25536..39682c0 100644 --- a/include/basegfx/matrix/b2dhommatrixtools.hxx +++ b/include/basegfx/matrix/b2dhommatrixtools.hxx @@ -23,6 +23,7 @@ #include <sal/types.h> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/vector/b2dvector.hxx> +#include <basegfx/range/b2drange.hxx> #include <basegfx/basegfxdllapi.h> @@ -127,6 +128,11 @@ namespace basegfx fRadiant); } + /// special for the case to map from source range to target range + B2DHomMatrix createSourceRangeTargetRangeTransform( + const B2DRange& rSourceRange, + const B2DRange& rTargetRange); + } // end of namespace tools } // end of namespace basegfx diff --git a/include/basegfx/polygon/b2dpolygontools.hxx b/include/basegfx/polygon/b2dpolygontools.hxx index dce4798..3be763b 100644 --- a/include/basegfx/polygon/b2dpolygontools.hxx +++ b/include/basegfx/polygon/b2dpolygontools.hxx @@ -434,6 +434,11 @@ namespace basegfx */ BASEGFX_DLLPUBLIC B2DPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolygon& rCandidate); + /** returns true if the Polygon only contains horizontal or vertical edges + so that it could be represented by RegionBands + */ + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolygon& rCandidate); + } // end of namespace tools } // end of namespace basegfx diff --git a/include/basegfx/polygon/b2dpolypolygontools.hxx b/include/basegfx/polygon/b2dpolypolygontools.hxx index 01c1306..092294e 100644 --- a/include/basegfx/polygon/b2dpolypolygontools.hxx +++ b/include/basegfx/polygon/b2dpolypolygontools.hxx @@ -234,6 +234,11 @@ namespace basegfx */ BASEGFX_DLLPUBLIC B2DPolyPolygon snapPointsOfHorizontalOrVerticalEdges(const B2DPolyPolygon& rCandidate); + /** returns true if the Polygon only contains horizontal or vertical edges + so that it could be represented by RegionBands + */ + bool containsOnlyHorizontalAndVerticalEdges(const B2DPolyPolygon& rCandidate); + } // end of namespace tools } // end of namespace basegfx diff --git a/include/basegfx/tuple/b2dtuple.hxx b/include/basegfx/tuple/b2dtuple.hxx index ac2b78f..f21124b 100644 --- a/include/basegfx/tuple/b2dtuple.hxx +++ b/include/basegfx/tuple/b2dtuple.hxx @@ -215,12 +215,12 @@ namespace basegfx bool operator==( const B2DTuple& rTup ) const { - return equal(rTup); + return mfX == rTup.mfX && mfY == rTup.mfY; } bool operator!=( const B2DTuple& rTup ) const { - return !equal(rTup); + return mfX != rTup.mfX || mfY != rTup.mfY; } B2DTuple& operator=( const B2DTuple& rTup ) diff --git a/include/basegfx/tuple/b3dtuple.hxx b/include/basegfx/tuple/b3dtuple.hxx index 9d8d080..d974f86 100644 --- a/include/basegfx/tuple/b3dtuple.hxx +++ b/include/basegfx/tuple/b3dtuple.hxx @@ -240,12 +240,12 @@ namespace basegfx bool operator==( const B3DTuple& rTup ) const { - return equal(rTup); + return mfX == rTup.mfX && mfY == rTup.mfY && mfZ == rTup.mfZ; } bool operator!=( const B3DTuple& rTup ) const { - return !equal(rTup); + return mfX != rTup.mfX || mfY != rTup.mfY || mfZ != rTup.mfZ; } B3DTuple& operator=( const B3DTuple& rTup ) diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx index 7e9af7f..cefeca8 100644 --- a/sc/source/ui/inc/output.hxx +++ b/sc/source/ui/inc/output.hxx @@ -312,7 +312,7 @@ public: void DrawSelectiveObjects(const sal_uInt16 nLayer); sal_Bool SetChangedClip(); // sal_False = not - PolyPolygon GetChangedArea(); + Region GetChangedAreaRegion(); void FindChanged(); void SetPagebreakMode( ScPageBreakData* pPageData ); diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 29016c2..2b4e657 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4609,10 +4609,12 @@ void ScGridWindow::UpdateFormulas() aOutputData.FindChanged(); - PolyPolygon aChangedPoly( aOutputData.GetChangedArea() ); // logic (PixelToLogic) - if ( aChangedPoly.Count() ) + // #i122149# do not use old GetChangedArea() which used polygon-based Regions, but use + // the region-band based new version; anyways, only rectangles are added + Region aChangedRegion( aOutputData.GetChangedAreaRegion() ); // logic (PixelToLogic) + if(!aChangedRegion.IsEmpty()) { - Invalidate(Region(aChangedPoly)); + Invalidate(aChangedRegion); } CheckNeedsRepaint(); // #i90362# used to be called via Draw() - still needed here diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 6a5c8e6..37b8c31 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1867,42 +1867,46 @@ drawinglayer::processor2d::BaseProcessor2D* ScOutputData::CreateProcessor2D( ) // Drucker -PolyPolygon ScOutputData::GetChangedArea() +Region ScOutputData::GetChangedAreaRegion() { - PolyPolygon aPoly; - + Region aRegion; Rectangle aDrawingRect; + bool bHad(false); + long nPosY = nScrY; + SCSIZE nArrY; + aDrawingRect.Left() = nScrX; aDrawingRect.Right() = nScrX+nScrW-1; - sal_Bool bHad = false; - long nPosY = nScrY; - SCSIZE nArrY; - for (nArrY=1; nArrY+1<nArrCount; nArrY++) + for(nArrY=1; nArrY+1<nArrCount; nArrY++) { RowInfo* pThisRowInfo = &pRowInfo[nArrY]; - if ( pThisRowInfo->bChanged ) + if(pThisRowInfo->bChanged) { - if (!bHad) + if(!bHad) { aDrawingRect.Top() = nPosY; - bHad = sal_True; + bHad = true; } + aDrawingRect.Bottom() = nPosY + pRowInfo[nArrY].nHeight - 1; } - else if (bHad) + else if(bHad) { - aPoly.Insert( Polygon( mpDev->PixelToLogic(aDrawingRect) ) ); + aRegion.Union(mpDev->PixelToLogic(aDrawingRect)); bHad = false; } + nPosY += pRowInfo[nArrY].nHeight; } - if (bHad) - aPoly.Insert( Polygon( mpDev->PixelToLogic(aDrawingRect) ) ); + if(bHad) + { + aRegion.Union(mpDev->PixelToLogic(aDrawingRect)); + } - return aPoly; + return aRegion; } sal_Bool ScOutputData::SetChangedClip() diff --git a/vcl/source/gdi/region.cxx b/vcl/source/gdi/region.cxx index e715d02..3ddc53d 100644 --- a/vcl/source/gdi/region.cxx +++ b/vcl/source/gdi/region.cxx @@ -1271,9 +1271,10 @@ Rectangle Region::GetBoundRect() const } else { + // #i122149# corrected rounding, no need for ceil() and floor() here return Rectangle( - static_cast<sal_Int32>(floor(aRange.getMinX())), static_cast<sal_Int32>(floor(aRange.getMinY())), - static_cast<sal_Int32>(ceil(aRange.getMaxX())), static_cast<sal_Int32>(ceil(aRange.getMaxY()))); + basegfx::fround(aRange.getMinX()), basegfx::fround(aRange.getMinY()), + basegfx::fround(aRange.getMaxX()), basegfx::fround(aRange.getMaxY())); } } diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 8928d51..e3a660f 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -20,20 +20,18 @@ #include <stdio.h> #include <string.h> - #include <svsys.h> #include <rtl/strbuf.hxx> - #include <tools/debug.hxx> #include <tools/poly.hxx> - #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> - +#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <win/wincomp.hxx> #include <win/saldata.hxx> #include <win/salgdi.h> #include <win/salframe.h> +#include <basegfx/matrix/b2dhommatrixtools.hxx> // ======================================================================= @@ -846,8 +844,40 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) mhRegion = 0; } - if( i_rClip.HasPolyPolygonOrB2DPolyPolygon() ) + bool bUsePolygon(i_rClip.HasPolyPolygonOrB2DPolyPolygon()); + static bool bTryToAvoidPolygon(true); + + // #i122149# try to avoid usage of PolyPolygon ClipRegions when PolyPolygon is no curve + // and only contains horizontal/vertical edges. In that case, use the fallback + // in GetRegionRectangles which will use Region::GetAsRegionBand() which will do + // the correct polygon-to-RegionBand transformation. + // Background is that when using the same Rectangle as rectangle or as Polygon + // clip region will lead to different results; the polygon-based one will be + // one pixel less to the right and down (see GDI docu for CreatePolygonRgn). This + // again is because of the polygon-nature and it's classic handling when filling. + // This also means that all cases which use a 'true' polygon-based incarnation of + // a Region should know what they do - it may lead to repaint errors. + if(bUsePolygon && bTryToAvoidPolygon) + { + const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); + + if(!aPolyPolygon.areControlPointsUsed()) + { + if(basegfx::tools::containsOnlyHorizontalAndVerticalEdges(aPolyPolygon)) + { + bUsePolygon = false; + } + } + } + + if(bUsePolygon) { + // #i122149# check the comment above to know that this may lead to potentioal repaint + // problems. It may be solved (if needed) by scaling the polygon by one in X + // and Y. Currently the workaround to only use it if really unavoidable will + // solve most cases. When someone is really using polygon-based Regions he + // should know what he is doing. + // Added code to do that scaling to check if it works, testing it. const basegfx::B2DPolyPolygon aPolyPolygon( i_rClip.GetAsB2DPolyPolygon() ); const sal_uInt32 nCount(aPolyPolygon.count()); @@ -856,21 +886,38 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) std::vector< POINT > aPolyPoints; aPolyPoints.reserve( 1024 ); std::vector< INT > aPolyCounts( nCount, 0 ); + basegfx::B2DHomMatrix aExpand; + static bool bExpandByOneInXandY(true); - for(sal_uInt32 a(0); a < nCount; a++) + if(bExpandByOneInXandY) { - basegfx::B2DPolygon aPoly(aPolyPolygon.getB2DPolygon(a)); + const basegfx::B2DRange aRangeS(aPolyPolygon.getB2DRange()); + const basegfx::B2DRange aRangeT(aRangeS.getMinimum(), aRangeS.getMaximum() + basegfx::B2DTuple(1.0, 1.0)); + aExpand = basegfx::B2DHomMatrix(basegfx::tools::createSourceRangeTargetRangeTransform(aRangeS, aRangeT)); + } - aPoly = basegfx::tools::adaptiveSubdivideByDistance( aPoly, 1 ); - const sal_uInt32 nPoints = aPoly.count(); + for(sal_uInt32 a(0); a < nCount; a++) + { + const basegfx::B2DPolygon aPoly( + basegfx::tools::adaptiveSubdivideByDistance( + aPolyPolygon.getB2DPolygon(a), + 1)); + const sal_uInt32 nPoints(aPoly.count()); aPolyCounts[a] = nPoints; for( sal_uInt32 b = 0; b < nPoints; b++ ) { - basegfx::B2DPoint aPt( aPoly.getB2DPoint( b ) ); + basegfx::B2DPoint aPt(aPoly.getB2DPoint(b)); + + if(bExpandByOneInXandY) + { + aPt = aExpand * aPt; + } + POINT aPOINT; - aPOINT.x = (LONG)aPt.getX(); - aPOINT.y = (LONG)aPt.getY(); + // #i122149# do correct rounding + aPOINT.x = basegfx::fround(aPt.getX()); + aPOINT.y = basegfx::fround(aPt.getY()); aPolyPoints.push_back( aPOINT ); } } @@ -993,7 +1040,16 @@ bool WinSalGraphics::setClipRegion( const Region& i_rClip ) } if( mhRegion ) + { SelectClipRgn( getHDC(), mhRegion ); + + // debug code if you weant to check range of the newly applied ClipRegion + //RECT aBound; + //const int aRegionType = GetRgnBox(mhRegion, &aBound); + // + //bool bBla = true; + } + return mhRegion != 0; }
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
