sc/source/ui/inc/gridwin.hxx | 14 +++++ sc/source/ui/view/gridwin.cxx | 109 ++++++++++++++++++++++++++++++++---------- sc/source/ui/view/output.cxx | 40 ++++++++++++--- 3 files changed, 129 insertions(+), 34 deletions(-)
New commits: commit 0c6b4f5c7f620e6848803d86321cdaa29f261452 Author: Tomaž Vajngerl <qui...@gmail.com> Date: Thu Aug 8 22:42:48 2013 +0200 Make selection corner marks slightly transparent. Change-Id: Ibf363d741ca346adefd30f5b68d9a47db73db8df diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index a786718..6a5c8e6 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -804,6 +804,8 @@ void ScOutputData::DrawDocumentBackground() namespace { +static const double lclCornerRectTransparency = 40.0; + void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, OutputDevice* pDev, const Rectangle& rRect) { long nPosZero = 0; @@ -2096,7 +2098,7 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, } if ( bHandle && bRight && bBottom ) { - mpDev->SetLineColor(); + mpDev->SetLineColor( rColor ); mpDev->SetFillColor( rColor ); const sal_Int32 aRadius = 4; @@ -2112,10 +2114,15 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, sal_Int32 aRectMinY2 = nMinY + aRadius; // Draw corner rectangles - mpDev->DrawRect( Rectangle( aRectMaxX1, aRectMaxY1, aRectMaxX2, aRectMaxY2 ) ); - mpDev->DrawRect( Rectangle( aRectMinX1, aRectMinY1, aRectMinX2, aRectMinY2 ) ); - mpDev->DrawRect( Rectangle( aRectMinX1, aRectMaxY1, aRectMinX2, aRectMaxY2 ) ); - mpDev->DrawRect( Rectangle( aRectMaxX1, aRectMinY1, aRectMaxX2, aRectMinY2 ) ); + Rectangle aLowerRight( aRectMaxX1, aRectMaxY1, aRectMaxX2, aRectMaxY2 ); + Rectangle aUpperLeft ( aRectMinX1, aRectMinY1, aRectMinX2, aRectMinY2 ); + Rectangle aLowerLeft ( aRectMinX1, aRectMaxY1, aRectMinX2, aRectMaxY2 ); + Rectangle aUpperRight( aRectMaxX1, aRectMinY1, aRectMaxX2, aRectMinY2 ); + + mpDev->DrawTransparent( PolyPolygon( Polygon( aLowerRight ) ), lclCornerRectTransparency ); + mpDev->DrawTransparent( PolyPolygon( Polygon( aUpperLeft ) ), lclCornerRectTransparency ); + mpDev->DrawTransparent( PolyPolygon( Polygon( aLowerLeft ) ), lclCornerRectTransparency ); + mpDev->DrawTransparent( PolyPolygon( Polygon( aUpperRight ) ), lclCornerRectTransparency ); } } } commit 5f3b4c0eb6905bcff588baaec235dbf726da191b Author: Tomaž Vajngerl <qui...@gmail.com> Date: Thu Aug 8 21:11:54 2013 +0200 fdo#67592 Resize selection box from all 4 corners Change-Id: I40c857eb1ed5c784a3911667f685c6450bf7a7c4 diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index 0909f41..f32ea5e 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -82,6 +82,16 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe friend class ScFilterListBox; private: + + enum RfCorner + { + NONE, + LEFT_UP, + RIGHT_UP, + LEFT_DOWN, + RIGHT_DOWN + }; + // #114409# ::sdr::overlay::OverlayObjectList* mpOOCursors; ::sdr::overlay::OverlayObjectList* mpOOSelection; @@ -171,6 +181,8 @@ private: Rectangle aInvertRect; + RfCorner aRFSelectedCorned; + bool bEEMouse:1; // Edit Engine has mouse bool bDPMouse:1; // DataPilot D&D (new Pivot table) bool bRFMouse:1; // RangeFinder drag @@ -255,7 +267,7 @@ private: bool GetEditUrlOrError( bool bSpellErr, const Point& rPos, String* pName=0, String* pUrl=0, String* pTarget=0 ); - bool HitRangeFinder( const Point& rMouse, bool& rCorner, sal_uInt16* pIndex = NULL, + bool HitRangeFinder( const Point& rMouse, RfCorner& rCorner, sal_uInt16* pIndex = NULL, SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL ); sal_uInt16 HitPageBreak( const Point& rMouse, ScRange* pSource = NULL, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 7afbab1..29016c2 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -1765,9 +1765,11 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta // Reihenfolge passend zum angezeigten Cursor: // RangeFinder, AutoFill, PageBreak, Drawing - bool bCorner; - bool bFound = HitRangeFinder(rMEvt.GetPosPixel(), bCorner, &nRFIndex, &nRFAddX, &nRFAddY); - bRFSize = bCorner; + RfCorner rCorner = NONE; + bool bFound = HitRangeFinder(rMEvt.GetPosPixel(), rCorner, &nRFIndex, &nRFAddX, &nRFAddY); + bRFSize = (rCorner != NONE); + aRFSelectedCorned = rCorner; + if (bFound) { bRFMouse = true; // die anderen Variablen sind oben initialisiert @@ -2545,10 +2547,10 @@ void ScGridWindow::MouseMove( const MouseEvent& rMEvt ) // Range-Finder - bool bCorner; - if ( HitRangeFinder( rMEvt.GetPosPixel(), bCorner ) ) + RfCorner rCorner = NONE; + if ( HitRangeFinder( rMEvt.GetPosPixel(), rCorner ) ) { - if (bCorner) + if (rCorner != NONE) SetPointer( Pointer( POINTER_CROSS ) ); else SetPointer( Pointer( POINTER_HAND ) ); @@ -4702,8 +4704,8 @@ Point ScGridWindow::GetMousePosPixel() const { return aCurMousePos; } //------------------------------------------------------------------------ -bool ScGridWindow::HitRangeFinder( const Point& rMouse, bool& rCorner, - sal_uInt16* pIndex, SCsCOL* pAddX, SCsROW* pAddY ) +bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner, + sal_uInt16* pIndex, SCsCOL* pAddX, SCsROW* pAddY) { bool bFound = false; ScInputHandler* pHdl = SC_MOD()->GetInputHdl( pViewData->GetViewShell() ); @@ -4724,36 +4726,74 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, bool& rCorner, // zusammengefasste (einzeln/Bereich) ??? ScAddress aAddr( nPosX, nPosY, nTab ); - Point aNext = pViewData->GetScrPos( nPosX, nPosY, eWhich, true ); + Point aCellStart = pViewData->GetScrPos( nPosX, nPosY, eWhich, true ); + Point aCellEnd = aCellStart; long nSizeXPix; long nSizeYPix; pViewData->GetMergeSizePixel( nPosX, nPosY, nSizeXPix, nSizeYPix ); - aNext.X() += nSizeXPix * nLayoutSign; - aNext.Y() += nSizeYPix; - bool bCornerHor; + aCellEnd.X() += nSizeXPix * nLayoutSign; + aCellEnd.Y() += nSizeYPix; + + bool bCornerHorizontalRight; + bool bCornerHorizontalLeft; if ( bLayoutRTL ) - bCornerHor = ( rMouse.X() >= aNext.X() && rMouse.X() <= aNext.X() + 8 ); + { + bCornerHorizontalRight = ( rMouse.X() >= aCellEnd.X() && rMouse.X() <= aCellEnd.X() + 8 ); + bCornerHorizontalLeft = ( rMouse.X() >= aCellStart.X() - 8 && rMouse.X() <= aCellStart.X() ); + } else - bCornerHor = ( rMouse.X() >= aNext.X() - 8 && rMouse.X() <= aNext.X() ); + { + bCornerHorizontalRight = ( rMouse.X() >= aCellEnd.X() - 8 && rMouse.X() <= aCellEnd.X() ); + bCornerHorizontalLeft = ( rMouse.X() >= aCellStart.X() && rMouse.X() <= aCellStart.X() + 8 ); + } - bool bCellCorner = ( bCornerHor && - rMouse.Y() >= aNext.Y() - 8 && rMouse.Y() <= aNext.Y() ); - // corner is hit only if the mouse is within the cell + bool bCornerVerticalDown = rMouse.Y() >= aCellEnd.Y() - 8 && rMouse.Y() <= aCellEnd.Y(); + bool bCornerVerticalUp = rMouse.Y() >= aCellStart.Y() && rMouse.Y() <= aCellStart.Y() + 8; + // corner is hit only if the mouse is within the cell sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); for (sal_uInt16 i=nCount; i;) { - // rueckwaerts suchen, damit der zuletzt gepaintete Rahmen gefunden wird + // search backwards so that the last repainted frame is found --i; ScRangeFindData* pData = pRangeFinder->GetObject(i); if ( pData->aRef.In(aAddr) ) { - if (pIndex) *pIndex = i; - if (pAddX) *pAddX = nPosX - pData->aRef.aStart.Col(); - if (pAddY) *pAddY = nPosY - pData->aRef.aStart.Row(); - bFound = sal_True; - rCorner = ( bCellCorner && aAddr == pData->aRef.aEnd ); + if (pIndex) + *pIndex = i; + if (pAddX) + *pAddX = nPosX - pData->aRef.aStart.Col(); + if (pAddY) + *pAddY = nPosY - pData->aRef.aStart.Row(); + + bFound = true; + + rCorner = NONE; + + ScAddress aEnd = pData->aRef.aEnd; + ScAddress aStart = pData->aRef.aStart; + + if ( bCornerHorizontalLeft && bCornerVerticalUp && + aAddr == aStart) + { + rCorner = LEFT_UP; + } + else if (bCornerHorizontalRight && bCornerVerticalDown && + aAddr == aEnd) + { + rCorner = RIGHT_DOWN; + } + else if (bCornerHorizontalRight && bCornerVerticalUp && + aAddr == ScAddress(aEnd.Col(), aStart.Row(), aStart.Tab())) + { + rCorner = RIGHT_UP; + } + else if (bCornerHorizontalLeft && bCornerVerticalDown && + aAddr == ScAddress(aStart.Col(), aEnd.Row(), aStart.Tab())) + { + rCorner = LEFT_DOWN; + } break; } } @@ -4972,8 +5012,27 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, sal_Bool bUp ) ScRange aNew = aOld; if ( bRFSize ) { - aNew.aEnd.SetCol((SCCOL)nPosX); - aNew.aEnd.SetRow((SCROW)nPosY); + switch (aRFSelectedCorned) + { + case LEFT_UP: + aNew.aStart.SetCol((SCCOL)nPosX); + aNew.aStart.SetRow((SCROW)nPosY); + break; + case LEFT_DOWN: + aNew.aStart.SetCol((SCCOL)nPosX); + aNew.aEnd.SetRow((SCROW)nPosY); + break; + case RIGHT_UP: + aNew.aEnd.SetCol((SCCOL)nPosX); + aNew.aStart.SetRow((SCROW)nPosY); + break; + case RIGHT_DOWN: + aNew.aEnd.SetCol((SCCOL)nPosX); + aNew.aEnd.SetRow((SCROW)nPosY); + break; + default: + break; + } } else { diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 5826efd..a786718 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -2013,8 +2013,8 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, { long nMinX = nScrX; long nMinY = nScrY; - long nMaxX = nScrX+nScrW-1; - long nMaxY = nScrY+nScrH-1; + long nMaxX = nScrX + nScrW - 1; + long nMaxY = nScrY + nScrH - 1; if ( bLayoutRTL ) { long nTemp = nMinX; @@ -2086,19 +2086,36 @@ void ScOutputData::DrawRefMark( SCCOL nRefStartX, SCROW nRefStartY, else { if (bTop) - mpDev->DrawLine( Point( nMinX,nMinY ), Point( nMaxX,nMinY ) ); + mpDev->DrawLine( Point( nMinX, nMinY ), Point( nMaxX, nMinY ) ); if (bBottom) - mpDev->DrawLine( Point( nMinX,nMaxY ), Point( nMaxX,nMaxY ) ); + mpDev->DrawLine( Point( nMinX, nMaxY ), Point( nMaxX, nMaxY ) ); if (bLeft) - mpDev->DrawLine( Point( nMinX,nMinY ), Point( nMinX,nMaxY ) ); + mpDev->DrawLine( Point( nMinX, nMinY ), Point( nMinX, nMaxY ) ); if (bRight) - mpDev->DrawLine( Point( nMaxX,nMinY ), Point( nMaxX,nMaxY ) ); + mpDev->DrawLine( Point( nMaxX, nMinY ), Point( nMaxX, nMaxY ) ); } if ( bHandle && bRight && bBottom ) { mpDev->SetLineColor(); mpDev->SetFillColor( rColor ); - mpDev->DrawRect( Rectangle( nMaxX-3*nLayoutSign, nMaxY-3, nMaxX+nLayoutSign, nMaxY+1 ) ); + + const sal_Int32 aRadius = 4; + + sal_Int32 aRectMaxX1 = nMaxX - nLayoutSign * aRadius; + sal_Int32 aRectMaxX2 = nMaxX + nLayoutSign; + sal_Int32 aRectMinX1 = nMinX - nLayoutSign; + sal_Int32 aRectMinX2 = nMinX + nLayoutSign * aRadius; + + sal_Int32 aRectMaxY1 = nMaxY - aRadius; + sal_Int32 aRectMaxY2 = nMaxY + 1; + sal_Int32 aRectMinY1 = nMinY - 1; + sal_Int32 aRectMinY2 = nMinY + aRadius; + + // Draw corner rectangles + mpDev->DrawRect( Rectangle( aRectMaxX1, aRectMaxY1, aRectMaxX2, aRectMaxY2 ) ); + mpDev->DrawRect( Rectangle( aRectMinX1, aRectMinY1, aRectMinX2, aRectMinY2 ) ); + mpDev->DrawRect( Rectangle( aRectMinX1, aRectMaxY1, aRectMinX2, aRectMaxY2 ) ); + mpDev->DrawRect( Rectangle( aRectMaxX1, aRectMinY1, aRectMaxX2, aRectMinY2 ) ); } } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits