Kaydet (Commit) aaab3a79 authored tarafından Jian Fang Zhang's avatar Jian Fang Zhang Kaydeden (comit) Fridrich Štrba

Resolves: #i120017, 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
(cherry picked from commit bcf01fd7)
Signed-off-by: 's avatarFridrich Štrba <fridrich.strba@bluewin.ch>

Conflicts:
	sc/source/ui/view/gridwin.cxx

Change-Id: Ie8a529c697979cf75c303bddcaddd2776f5b8047
üst 3545b039
...@@ -936,6 +936,8 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange ) ...@@ -936,6 +936,8 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
long nSizeY = 0; long nSizeY = 0;
long nHeight = 0; long nHeight = 0;
pViewData->GetMergeSizePixel( nCol, nRow, 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());
Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich ); Point aPos = pViewData->GetScrPos( nCol, nRow, eWhich );
if ( bLayoutRTL ) if ( bLayoutRTL )
aPos.X() -= nSizeX; aPos.X() -= nSizeX;
...@@ -1820,8 +1822,19 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta ...@@ -1820,8 +1822,19 @@ void ScGridWindow::HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventSta
if ( !bDouble && !bFormulaMode && rMEvt.IsLeft() ) 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*) ScMergeFlagAttr* pAttr = (ScMergeFlagAttr*)
pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG ); pDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG );
if( pRealPosAttr->HasAutoFilter() )
{
SC_MOD()->InputEnterHandler();
if (DoAutoFilterButton( nRealPosX, nRealPosY, rMEvt))
return;
}
if (pAttr->HasAutoFilter()) if (pAttr->HasAutoFilter())
{ {
if (DoAutoFilterButton(nPosX, nPosY, rMEvt)) if (DoAutoFilterButton(nPosX, nPosY, rMEvt))
......
...@@ -125,6 +125,8 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& ...@@ -125,6 +125,8 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent&
long nSizeX, nSizeY; long nSizeX, nSizeY;
pViewData->GetMergeSizePixel( nCol, nRow, 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); Size aScrSize(nSizeX-1, nSizeY-1);
// Check if the mouse cursor is clicking on the popup arrow box. // Check if the mouse cursor is clicking on the popup arrow box.
......
...@@ -1144,7 +1144,9 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, Out ...@@ -1144,7 +1144,9 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, Out
for (nCol=nX1; nCol<=nX2; nCol++) for (nCol=nX1; nCol<=nX2; nCol++)
{ {
CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1]; 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) if (!pQueryParam)
pQueryParam = new ScQueryParam; pQueryParam = new ScQueryParam;
...@@ -1197,7 +1199,13 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, Out ...@@ -1197,7 +1199,13 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, Out
bool bArrowState = bSimpleQuery && bColumnFound; bool bArrowState = bSimpleQuery && bColumnFound;
long nSizeX; long nSizeX;
long nSizeY; 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 ); Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich );
aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL); aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment