summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-13 15:16:30 +0100
committerNoel Power <noel.power@novell.com>2010-10-13 15:16:30 +0100
commit5d63ff6e8802a4a87df68d702fc25ef97aad3b38 (patch)
tree99be90879206043319608b70dd8abffa77b2e786
parent65389fcbb71197b3f97f5d4c80c18f827c9466d0 (diff)
parent586d64f3208f39f4196c3dd595948d56f8aa770c (diff)
Merge branch 'master' of ssh://noelp@git.freedesktop.org/git/libreoffice/calc
-rw-r--r--sc/source/filter/excel/xeescher.cxx2
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx22
-rw-r--r--sc/source/ui/inc/dpcontrol.hxx4
-rw-r--r--sc/source/ui/view/gridwin2.cxx17
-rw-r--r--sc/source/ui/view/gridwin4.cxx13
-rw-r--r--sc/source/ui/view/output2.cxx22
6 files changed, 49 insertions, 31 deletions
diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx
index d5610e3ffa67..e46c4af88839 100644
--- a/sc/source/filter/excel/xeescher.cxx
+++ b/sc/source/filter/excel/xeescher.cxx
@@ -848,7 +848,7 @@ void XclExpTbxControlObj::WriteSubRecs( XclExpStream& rStrm )
}
else if( mnObjType == EXC_OBJTYPE_DROPDOWN )
{
- rStrm << sal_uInt16( 0 ) << mnLineCount;
+ rStrm << sal_uInt16( 0 ) << mnLineCount << sal_uInt16( 0 ) << sal_uInt16( 0 );
}
rStrm.EndRecord();
diff --git a/sc/source/ui/cctrl/dpcontrol.cxx b/sc/source/ui/cctrl/dpcontrol.cxx
index 6bd6c59e6ebd..c49b54ee9835 100644
--- a/sc/source/ui/cctrl/dpcontrol.cxx
+++ b/sc/source/ui/cctrl/dpcontrol.cxx
@@ -67,7 +67,8 @@ ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pSt
mbBaseButton(true),
mbPopupButton(false),
mbHasHiddenMember(false),
- mbPopupPressed(false)
+ mbPopupPressed(false),
+ mbPopupLeft(false)
{
if (pZoomX)
maZoomX = *pZoomX;
@@ -89,10 +90,15 @@ void ScDPFieldButton::setText(const OUString& rText)
maText = rText;
}
-void ScDPFieldButton::setBoundingBox(const Point& rPos, const Size& rSize)
+void ScDPFieldButton::setBoundingBox(const Point& rPos, const Size& rSize, bool bLayoutRTL)
{
maPos = rPos;
maSize = rSize;
+ if (bLayoutRTL)
+ {
+ // rPos is the logical-left position, adjust maPos to visual-left (inside the cell border)
+ maPos.X() -= maSize.Width() - 1;
+ }
}
void ScDPFieldButton::setDrawBaseButton(bool b)
@@ -115,6 +121,11 @@ void ScDPFieldButton::setPopupPressed(bool b)
mbPopupPressed = b;
}
+void ScDPFieldButton::setPopupLeft(bool b)
+{
+ mbPopupLeft = b;
+}
+
void ScDPFieldButton::draw()
{
const long nMargin = 2;
@@ -180,7 +191,12 @@ void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const
if (nH > 18)
nH = 18;
- rPos.setX(maPos.getX() + maSize.getWidth() - nW);
+ // #i114944# AutoFilter button is left-aligned in RTL.
+ // DataPilot button is always right-aligned for now, so text output isn't affected.
+ if (mbPopupLeft)
+ rPos.setX(maPos.getX());
+ else
+ rPos.setX(maPos.getX() + maSize.getWidth() - nW);
rPos.setY(maPos.getY() + maSize.getHeight() - nH);
rSize.setWidth(nW);
rSize.setHeight(nH);
diff --git a/sc/source/ui/inc/dpcontrol.hxx b/sc/source/ui/inc/dpcontrol.hxx
index 45badf0c88fd..25cb3e05acac 100644
--- a/sc/source/ui/inc/dpcontrol.hxx
+++ b/sc/source/ui/inc/dpcontrol.hxx
@@ -69,11 +69,12 @@ public:
~ScDPFieldButton();
void setText(const ::rtl::OUString& rText);
- void setBoundingBox(const Point& rPos, const Size& rSize);
+ void setBoundingBox(const Point& rPos, const Size& rSize, bool bLayoutRTL);
void setDrawBaseButton(bool b);
void setDrawPopupButton(bool b);
void setHasHiddenMember(bool b);
void setPopupPressed(bool b);
+ void setPopupLeft(bool b);
void draw();
void getPopupBoundingBox(Point& rPos, Size& rSize) const;
@@ -94,6 +95,7 @@ private:
bool mbPopupButton;
bool mbHasHiddenMember;
bool mbPopupPressed;
+ bool mbPopupLeft;
};
// ============================================================================
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index 89389232cc4b..4aa2b1476759 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -145,7 +145,8 @@ bool ScGridWindow::DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent&
// Check if the mouse cursor is clicking on the popup arrow box.
mpFilterButton.reset(new ScDPFieldButton(this, &GetSettings().GetStyleSettings(), &pViewData->GetZoomX(), &pViewData->GetZoomY(), pDoc));
- mpFilterButton->setBoundingBox(aScrPos, aScrSize);
+ mpFilterButton->setBoundingBox(aScrPos, aScrSize, bLayoutRTL);
+ mpFilterButton->setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
Point aPopupPos;
Size aPopupSize;
mpFilterButton->getPopupBoundingBox(aPopupPos, aPopupSize);
@@ -368,6 +369,8 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, BOOL bMove )
bool ScGridWindow::DPTestFieldPopupArrow(const MouseEvent& rMEvt, const ScAddress& rPos, ScDPObject* pDPObj)
{
+ BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
+
// Get the geometry of the cell.
Point aScrPos = pViewData->GetScrPos(rPos.Col(), rPos.Row(), eWhich);
long nSizeX, nSizeY;
@@ -376,7 +379,8 @@ bool ScGridWindow::DPTestFieldPopupArrow(const MouseEvent& rMEvt, const ScAddres
// Check if the mouse cursor is clicking on the popup arrow box.
ScDPFieldButton aBtn(this, &GetSettings().GetStyleSettings());
- aBtn.setBoundingBox(aScrPos, aScrSize);
+ aBtn.setBoundingBox(aScrPos, aScrSize, bLayoutRTL);
+ aBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
Point aPopupPos;
Size aPopupSize;
aBtn.getPopupBoundingBox(aPopupPos, aPopupSize);
@@ -517,9 +521,16 @@ void ScGridWindow::DPLaunchFieldPopupMenu(
}
}
+ BOOL bLayoutRTL = pViewData->GetDocument()->IsLayoutRTL( pViewData->GetTabNo() );
+
Rectangle aCellRect(rScrPos, rScrSize);
const Size& rPopupSize = mpDPFieldPopup->getWindowSize();
- if (rScrSize.getWidth() > rPopupSize.getWidth())
+ if (bLayoutRTL)
+ {
+ // RTL: rScrPos is logical-left (visual right) position, always right-align with that
+ aCellRect.SetPos(Point(rScrPos.X() - rPopupSize.Width() + 1, rScrPos.Y()));
+ }
+ else if (rScrSize.getWidth() > rPopupSize.getWidth())
{
// If the cell width is larger than the popup window width, launch it
// right-aligned with the cell.
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 811c130ba914..f86f79a1d25a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1276,7 +1276,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich );
- aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1));
+ aCellBtn.setBoundingBox(aScrPos, Size(nSizeX-1, nSizeY-1), bLayoutRTL);
+ aCellBtn.setPopupLeft(bLayoutRTL); // #i114944# AutoFilter button is left-aligned in RTL
aCellBtn.setDrawBaseButton(false);
aCellBtn.setDrawPopupButton(true);
aCellBtn.setHasHiddenMember(bArrowState);
@@ -1300,17 +1301,13 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
long nPosX = aScrPos.X();
long nPosY = aScrPos.Y();
- if ( bLayoutRTL )
- {
- // overwrite the right, not left (visually) grid as long as the
- // left/right colors of the button borders aren't mirrored.
- nPosX -= nSizeX - 2;
- }
+ // bLayoutRTL is handled in setBoundingBox
String aStr;
pDoc->GetString(nCol, nRow, nTab, aStr);
aCellBtn.setText(aStr);
- aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1));
+ aCellBtn.setBoundingBox(Point(nPosX, nPosY), Size(nSizeX-1, nSizeY-1), bLayoutRTL);
+ aCellBtn.setPopupLeft(false); // DataPilot popup is always right-aligned for now
aCellBtn.setDrawBaseButton(true);
aCellBtn.setDrawPopupButton(pInfo->bPopupButton);
aCellBtn.setHasHiddenMember(pInfo->bFilterActive);
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index fd6a1d05d1cb..32e3c6d9e0ab 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -82,7 +82,7 @@
#include <math.h>
//! Autofilter-Breite mit column.cxx zusammenfassen
-#define DROPDOWN_BITMAP_SIZE 17
+#define DROPDOWN_BITMAP_SIZE 18
#define DRAWTEXT_MAX 32767
@@ -1307,7 +1307,8 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY
( static_cast<const ScMergeFlagAttr&>(rPattern.GetItem(ATTR_MERGE_FLAG)).GetValue() & SC_MF_AUTO ) &&
( !bBreak || pRefDevice == pFmtDevice ) )
{
- long nFilter = Min( nMergeSizeY, (long) DROPDOWN_BITMAP_SIZE );
+ // filter drop-down width is now independent from row height
+ const long nFilter = DROPDOWN_BITMAP_SIZE;
BOOL bFit = ( nNeeded + nFilter <= nMergeSizeX );
if ( bFit || bCellIsValue )
{
@@ -3732,20 +3733,11 @@ void ScOutputData::DrawRotated(BOOL bPixelToLogic)
eOrient!=SVX_ORIENTATION_STACKED &&
pInfo && pInfo->bAutoFilter)
{
- if (pRowInfo[nArrY].nHeight < DROPDOWN_BITMAP_SIZE)
- {
- if (bPixelToLogic)
- nAvailWidth -= pRefDevice->PixelToLogic(Size(0,pRowInfo[nArrY].nHeight)).Height();
- else
- nAvailWidth -= pRowInfo[nArrY].nHeight;
- }
+ // filter drop-down width is now independent from row height
+ if (bPixelToLogic)
+ nAvailWidth -= pRefDevice->PixelToLogic(Size(0,DROPDOWN_BITMAP_SIZE)).Height();
else
- {
- if (bPixelToLogic)
- nAvailWidth -= pRefDevice->PixelToLogic(Size(0,DROPDOWN_BITMAP_SIZE)).Height();
- else
- nAvailWidth -= DROPDOWN_BITMAP_SIZE;
- }
+ nAvailWidth -= DROPDOWN_BITMAP_SIZE;
long nComp = nEngineWidth;
if (nAvailWidth<nComp) nAvailWidth=nComp;
}