Bug 87371 - Unintuitive cell border style handling
Summary: Unintuitive cell border style handling
Status: CONFIRMED
Alias: None
Product: calligrasheets
Classification: Applications
Component: usability (other bugs)
Version First Reported In: 1.3.2
Platform: unspecified Linux
: NOR minor
Target Milestone: ---
Assignee: Calligra Sheets (KSpread) Bugs
URL:
Keywords: triaged
: 65100 124230 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-17 18:13 UTC by Dik Takken
Modified: 2021-03-09 22:43 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2004-08-17 18:13:26 UTC
Version:           1.3.2 (using KDE KDE 3.3.0)
OS:                Linux

Every cell shares it's borders with the surrounding cells. Often when I try to change the style of one of the borders of a specific cell, it fails because the adjacent cell also has it's own style setting for that border. So, I need to go to the adjacent cell and change the same border there as well. This isn't a very comfortable way of working with cell borders. Users can easily get the impression that KSpread  behaviour is buggy. 

Maybe adjacent cells should share one definition of the style of their shared borders in stead of each cell having it's own definition.
Comment 1 Sebastian Sauer 2006-08-19 18:11:57 UTC
*** Bug 124230 has been marked as a duplicate of this bug. ***
Comment 2 Sebastian Sauer 2006-08-19 18:43:19 UTC
*** Bug 65100 has been marked as a duplicate of this bug. ***
Comment 3 Thomas McGuire 2006-11-13 00:55:37 UTC
I don't agree that the severity is only set to "minor".
I tried to make a timetable with nice borders, but soon gave up after too much frustration with the borders and used OO for the task.
I saw many rendering bugs and such, which I believe is the result of two adjacent cells sharing a different border style.

Like the original reporter said, please handle adjacent borders like one border, like OpenOffice does.
Comment 4 Stefan Nikolaus 2007-08-04 20:40:51 UTC
SVN commit 696417 by nikolaus:

Commands	Style.
		Unset the borders of the adjacent cells, if a outer border is set.

		The undo does not work properly yet; redo does though.

CCBUG: 87371


 M  +41 -1     StyleCommand.cpp  


--- trunk/koffice/kspread/commands/StyleCommand.cpp #696416:696417
@@ -51,8 +51,12 @@
     {
         if ( m_firstrun )
         {
+            const QRect rect = range.adjusted(m_style->hasAttribute(Style::LeftPen) ? -1 : 0,
+                                              m_style->hasAttribute(Style::TopPen) ? -1 : 0,
+                                              m_style->hasAttribute(Style::RightPen) ? 1 : 0,
+                                              m_style->hasAttribute(Style::BottomPen) ? 1 : 0);
             const QList< QPair<QRectF,SharedSubStyle> > rawUndoData
-                    = m_sheet->styleStorage()->undoData( Region(element->rect()) );
+                    = m_sheet->styleStorage()->undoData( Region(rect) );
             for ( int i = 0; i < rawUndoData.count(); ++i )
             {
 //                 if ( m_style->hasAttribute( rawUndoData[i].second->type() ) ||
@@ -115,6 +119,15 @@
             style.setLeftBorderPen( leftPen );
             m_sheet->cellStorage()->setStyle( Region(QRect(range.left(), range.top(), 1, range.height())), style );
             m_style->setLeftBorderPen(leftPen); // restore pen
+            // reset the border of the adjacent cell
+            if (range.left() > 1)
+            {
+                Style tmpStyle;
+                tmpStyle.setRightBorderPen(QPen(Qt::NoPen));
+                const Region region(QRect(range.left() - 1, range.top(), 1, range.height()));
+                m_sheet->cellStorage()->setStyle(region, tmpStyle);
+                m_sheet->setRegionPaintDirty(region);
+            }
         }
         if ( rightPen.style() != Qt::NoPen )
         {
@@ -122,6 +135,15 @@
             style.setRightBorderPen( rightPen );
             m_sheet->cellStorage()->setStyle( Region(QRect(range.right(), range.top(), 1, range.height())), style );
             m_style->setRightBorderPen(rightPen); // restore pen
+            // reset the border of the adjacent cell
+            if (range.right() < KS_colMax)
+            {
+                Style tmpStyle;
+                tmpStyle.setLeftBorderPen(QPen(Qt::NoPen));
+                const Region region(QRect(range.right() + 1, range.top(), 1, range.height()));
+                m_sheet->cellStorage()->setStyle(region, tmpStyle);
+                m_sheet->setRegionPaintDirty(region);
+            }
         }
         if ( topPen.style() != Qt::NoPen )
         {
@@ -129,6 +151,15 @@
             style.setTopBorderPen( topPen );
             m_sheet->cellStorage()->setStyle( Region(QRect(range.left(), range.top(), range.width(), 1)), style );
             m_style->setTopBorderPen(topPen); // restore pen
+            // reset the border of the adjacent cell
+            if (range.top() > 1)
+            {
+                Style tmpStyle;
+                tmpStyle.setBottomBorderPen(QPen(Qt::NoPen));
+                const Region region(QRect(range.left(), range.top() - 1, range.width(), 1));
+                m_sheet->cellStorage()->setStyle(region, tmpStyle);
+                m_sheet->setRegionPaintDirty(region);
+            }
         }
         if ( bottomPen.style() != Qt::NoPen )
         {
@@ -136,6 +167,15 @@
             style.setBottomBorderPen( bottomPen );
             m_sheet->cellStorage()->setStyle( Region(QRect(range.left(), range.bottom(), range.width(), 1)), style );
             m_style->setBottomBorderPen(bottomPen); // restore pen
+            // reset the border of the adjacent cell
+            if (range.bottom() < KS_rowMax)
+            {
+                Style tmpStyle;
+                tmpStyle.setTopBorderPen(QPen(Qt::NoPen));
+                const Region region(QRect(range.left(), range.bottom() + 1, range.width(), 1));
+                m_sheet->cellStorage()->setStyle(region, tmpStyle);
+                m_sheet->setRegionPaintDirty(region);
+            }
         }
     }
     return true;
Comment 5 Stefan Nikolaus 2008-08-21 13:18:14 UTC
I wonder, if the calculation of the border value could be replaced since the new style storage. Check!
Comment 6 Michael Leupold 2008-10-26 23:07:22 UTC
I can't triage this bug because removing borders currently doesn't work on trunk r876221.
Comment 7 Justin Zobel 2021-03-09 22:43:52 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.