Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1979

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/79/1979/1

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
---
M svx/source/table/svdotable.cxx
1 file changed, 40 insertions(+), 17 deletions(-)



diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx
index 9bf2268..ab6113e 100644
--- a/svx/source/table/svdotable.cxx
+++ b/svx/source/table/svdotable.cxx
@@ -462,47 +462,70 @@
 
 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 ) );
                     }
                 }

-- 
To view, visit https://gerrit.libreoffice.org/1979
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If412b443ec8f82942ff80ba3aec24a9bfc053ac9
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Karthikeyan Krishnamurthi <karthikeyan@kacst.edu.sa>

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.