summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorK_Karthikeyan <karthikeyan@kacst.edu.sa>2013-02-04 11:30:38 +0300
committerTor Lillqvist <tml@iki.fi>2013-02-08 19:24:34 +0000
commitc5b83e07f87a092a9b771365231df0a1667404bf (patch)
tree87f4eb0a9d9daf29a8a3786b473d8d2b3a94b47f /svx
parent195007a80725d14c5dac64e2c9d1ed21e58da380 (diff)
Resolves fdo#59889 fault in dragging edge of RTL table
i) Resolves fdo#59889 formatting in dragging edge of RTL table resizes column width of the next column instead of current column. ii) prevents resizing the whole table on dragging edge In NxN LTR table vertical edge responsible for resizing the column x(x=0 to N-1) is, Edge x+1. But, in RTL table vertical edge responisble for resizing the column x(x=0 to N-1, but from right to left)is, Edge x. Use (nEdge-1)instead nEdge-- to avoid conflicts. Change-Id: If412b443ec8f82942ff80ba3aec24a9bfc053ac9 Reviewed-on: https://gerrit.libreoffice.org/1979 Reviewed-by: Tor Lillqvist <tml@iki.fi> Tested-by: Tor Lillqvist <tml@iki.fi>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/table/svdotable.cxx57
1 files changed, 40 insertions, 17 deletions
diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index fd1c8dad7fba..d54c3f7cb75f 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -462,47 +462,70 @@ void SdrTableObjImpl::dispose()
void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset )
{
- if( (nEdge > 0) && mxTable.is()) try
+ if( (nEdge >= 0) && mxTable.is()) try
{
const OUString sSize( RTL_CONSTASCII_USTRINGPARAM( "Size" ) );
- nEdge--;
if( mbHorizontal )
{
- if( (nEdge >= 0) && (nEdge < getRowCount()) )
+ if( (nEdge >= 0) && (nEdge <= getRowCount()) )
{
- sal_Int32 nHeigth = mpLayouter->getRowHeight( nEdge );
- nHeigth += nOffset;
+ sal_Int32 nHeigth = mpLayouter->getRowHeight( (!nEdge)?nEdge:(nEdge-1) );
+ if(nEdge==0)
+ nHeigth -= nOffset;
+ else
+ nHeigth += nOffset;
Reference< XIndexAccess > xRows( mxTable->getRows(), UNO_QUERY_THROW );
- Reference< XPropertySet > xRowSet( xRows->getByIndex( nEdge ), UNO_QUERY_THROW );
+ Reference< XPropertySet > xRowSet( xRows->getByIndex( (!nEdge)?nEdge:(nEdge-1) ), UNO_QUERY_THROW );
xRowSet->setPropertyValue( sSize, Any( nHeigth ) );
}
}
else
{
- if( (nEdge >= 0) && (nEdge < getColumnCount()) )
+ /*
+ fixes fdo#59889 and resizing of table in edge dragging
+ Total vertical edges in a NxN table is N+1, indexed from 0 to N and total Columns is N, indexed from 0 to N-1
+ In LTR table vertical edge responsible for dragging of column x(x=0 to N-1) is, Edge x+1
+ But in RTL table vertical edge responisble for dragging of column x(x=0 to N-1, but from right to left)is, Edge x
+ In LTR table dragging of edge 0(for RTL table edge N) does nothing.
+ */
+ //Todo: Implement Dragging functionality for leftmost edge of table.
+ if( (nEdge >= 0) && (nEdge <= getColumnCount()) )
{
- sal_Int32 nWidth = mpLayouter->getColumnWidth( nEdge );
- nWidth += nOffset;
-
+ const bool bRTL = mpLayouter->GetWritingMode() == WritingMode_RL_TB;
+ sal_Int32 nWidth;
+ if(bRTL)
+ {
+ nWidth = mpLayouter->getColumnWidth( nEdge );
+ }
+ else
+ {
+ nWidth = mpLayouter->getColumnWidth( (!nEdge)?nEdge:(nEdge-1) );
+ }
Reference< XIndexAccess > xCols( mxTable->getColumns(), UNO_QUERY_THROW );
- Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
- xColSet->setPropertyValue( sSize, Any( nWidth ) );
-
+ nWidth += nOffset;
+ if(bRTL && nEdge<getColumnCount())
+ {
+ Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
+ xColSet->setPropertyValue( sSize, Any( nWidth ) );
+ }
+ else if(!bRTL && nEdge>0)
+ {
+ Reference< XPropertySet > xColSet( xCols->getByIndex( (nEdge-1) ), UNO_QUERY_THROW );
+ xColSet->setPropertyValue( sSize, Any( nWidth ) );
+ }
+ /* To prevent the table resizing on edge dragging */
if( nEdge > 0 && nEdge < mxTable->getColumnCount() )
{
- const bool bRTL = mpLayouter->GetWritingMode() == WritingMode_RL_TB;
if( bRTL )
nEdge--;
- else
- nEdge++;
if( (bRTL && (nEdge >= 0)) || (!bRTL && (nEdge < mxTable->getColumnCount())) )
{
nWidth = mpLayouter->getColumnWidth( nEdge );
nWidth = std::max( (sal_Int32)(nWidth - nOffset), (sal_Int32)0 );
- xColSet = Reference< XPropertySet >( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
+ Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW );
xColSet->setPropertyValue( sSize, Any( nWidth ) );
}
}