incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhan...@apache.org
Subject svn commit: r1352444 - in /incubator/ooo/trunk/main/sc/source/ui/view: gridwin.cxx gridwin2.cxx gridwin4.cxx
Date Thu, 21 Jun 2012 08:19:34 GMT
Author: zhangjf
Date: Thu Jun 21 08:19:34 2012
New Revision: 1352444

URL: http://svn.apache.org/viewvc?rev=1352444&view=rev
Log:
#120017#, fix the problem that filter button is not shown in merged cell

Patch by: zhao shao zhi, aoo.zhaoshzh@gmail.com
Found by: Yan Ji,<yanji.yj@gmail.com>
Review by: zhangjf

Modified:
    incubator/ooo/trunk/main/sc/source/ui/view/gridwin.cxx
    incubator/ooo/trunk/main/sc/source/ui/view/gridwin2.cxx
    incubator/ooo/trunk/main/sc/source/ui/view/gridwin4.cxx

Modified: incubator/ooo/trunk/main/sc/source/ui/view/gridwin.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/view/gridwin.cxx?rev=1352444&r1=1352443&r2=1352444&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/view/gridwin.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/view/gridwin.cxx Thu Jun 21 08:19:34 2012
@@ -880,6 +880,8 @@ void ScGridWindow::DoAutoFilterMenue( SC
 	long nSizeY  = 0;
 	long nHeight = 0;
 	pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
+	// The button height should not use the merged cell height, should still use single row
height
+	nSizeY = pViewData->ToPixel(pDoc->GetRowHeight(nRow, nTab), pViewData->GetPPTY());
 	Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich );
 	if ( bLayoutRTL )
 		aPos.X() -= nSizeX;
@@ -1674,12 +1676,23 @@ void ScGridWindow::HandleMouseButtonDown
 
     if ( !bDouble && !bFormulaMode && rMEvt.IsLeft() )
 	{
+		SCsCOL nRealPosX;
+		SCsROW nRealPosY;
+		pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nRealPosX, nRealPosY, false
);//the real row/col
+		ScMergeFlagAttr* pRealPosAttr = (ScMergeFlagAttr*)
+									pDoc->GetAttr( nRealPosX, nRealPosY, nTab, ATTR_MERGE_FLAG );
 		ScMergeFlagAttr* pAttr = (ScMergeFlagAttr*)
 									pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG );
-		if (pAttr->HasAutoFilter())
+		if( pRealPosAttr->HasAutoFilter() )
+		{
+			SC_MOD()->InputEnterHandler();	
+			if (DoAutoFilterButton( nRealPosX, nRealPosY, rMEvt))
+                return;
+		}
+		if( pAttr->HasAutoFilter() )
 		{
 			SC_MOD()->InputEnterHandler();	//Add for i85305
-			if (DoAutoFilterButton(nPosX, nPosY, rMEvt))
+			if (DoAutoFilterButton( nPosX, nPosY, rMEvt))
                 return;
 		}
 		if (pAttr->HasButton())

Modified: incubator/ooo/trunk/main/sc/source/ui/view/gridwin2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/view/gridwin2.cxx?rev=1352444&r1=1352443&r2=1352444&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/view/gridwin2.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/view/gridwin2.cxx Thu Jun 21 08:19:34 2012
@@ -137,6 +137,8 @@ bool ScGridWindow::DoAutoFilterButton( S
 
     long nSizeX, nSizeY;
     pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
+    // The button height should not use the merged cell height, should still use single row
height
+    nSizeY = pViewData->ToPixel(pDoc->GetRowHeight(nRow, nTab), pViewData->GetPPTY());
     Size aScrSize(nSizeX-1, nSizeY-1);
 
     // Check if the mouse cursor is clicking on the popup arrow box.

Modified: incubator/ooo/trunk/main/sc/source/ui/view/gridwin4.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sc/source/ui/view/gridwin4.cxx?rev=1352444&r1=1352443&r2=1352444&view=diff
==============================================================================
--- incubator/ooo/trunk/main/sc/source/ui/view/gridwin4.cxx (original)
+++ incubator/ooo/trunk/main/sc/source/ui/view/gridwin4.cxx Thu Jun 21 08:19:34 2012
@@ -1236,7 +1236,9 @@ void ScGridWindow::DrawButtons( SCCOL nX
 			for (nCol=nX1; nCol<=nX2; nCol++)
 			{
 				CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1];
-				if ( pInfo->bAutoFilter && !pInfo->bHOverlapped && !pInfo->bVOverlapped
)
+				//if several columns merged on a row, there should be only one auto button at the end
of the columns.
+				//if several rows merged on a column, the button may be in the middle, so "!pInfo->bVOverlapped"
should not be used
+				if ( pInfo->bAutoFilter && !pInfo->bHOverlapped )
 				{
 					if (!pQueryParam)
 						pQueryParam = new ScQueryParam;
@@ -1288,7 +1290,13 @@ void ScGridWindow::DrawButtons( SCCOL nX
                     bool bArrowState = bSimpleQuery && bColumnFound;
 					long	nSizeX;
 					long	nSizeY;
-					pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
+					SCCOL nStartCol= nCol;
+					SCROW nStartRow = nRow;
+					//if address(nCol,nRow) is not the start pos of the merge area, the value of the nSizeX
will be incorrect, it will be the length of the cell.
+					//should first get the start pos of the merge area, then get the nSizeX through the
start pos.
+					pDoc->ExtendOverlapped(nStartCol, nStartRow,nCol, nRow, nTab);//get nStartCol,nStartRow
+					pViewData->GetMergeSizePixel( nStartCol, nStartRow, nSizeX, nSizeY );//get nSizeX

+					nSizeY = pViewData->ToPixel(pDoc->GetRowHeight(nRow, nTab), pViewData->GetPPTY());
 					Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich );
 
                     aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);



Mime
View raw message