Resolves tdf#128258 - Draw a dotted line before hidden columns/rows
Color and on/off configurable via Tools > Options > Application Colors
Change-Id: Ia4b1e1c86f36d1b0f508a5b3e866a79418f16c5a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128553
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx
index 81030a79..0bf654b 100644
--- a/cui/source/options/optcolor.cxx
+++ b/cui/source/options/optcolor.cxx
@@ -127,6 +127,7 @@ const vEntryInfo[] =
{ Group_Calc, IDS(brk) },
{ Group_Calc, IDS(brkmanual) },
{ Group_Calc, IDS(brkauto) },
{ Group_Calc, IDS_CB(hiddencolrow) },
{ Group_Calc, IDS(det) },
{ Group_Calc, IDS(deterror) },
{ Group_Calc, IDS(ref) },
diff --git a/cui/uiconfig/ui/colorconfigwin.ui b/cui/uiconfig/ui/colorconfigwin.ui
index c25ddba..319ac0e 100644
--- a/cui/uiconfig/ui/colorconfigwin.ui
+++ b/cui/uiconfig/ui/colorconfigwin.ui
@@ -795,7 +795,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=2 n-rows=12 -->
<!-- n-columns=2 n-rows=13 -->
<object class="GtkGrid" id="gdCalc">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -944,7 +944,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
@@ -961,7 +961,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
<property name="top-attach">5</property>
</packing>
</child>
<child>
@@ -978,7 +978,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">5</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
@@ -993,7 +993,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">5</property>
<property name="top-attach">6</property>
</packing>
</child>
<child>
@@ -1010,7 +1010,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">6</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
@@ -1025,7 +1025,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">6</property>
<property name="top-attach">7</property>
</packing>
</child>
<child>
@@ -1042,7 +1042,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">7</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
@@ -1057,7 +1057,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">7</property>
<property name="top-attach">8</property>
</packing>
</child>
<child>
@@ -1074,7 +1074,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">8</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
@@ -1089,7 +1089,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">8</property>
<property name="top-attach">9</property>
</packing>
</child>
<child>
@@ -1106,7 +1106,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">9</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
@@ -1121,7 +1121,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">9</property>
<property name="top-attach">10</property>
</packing>
</child>
<child>
@@ -1138,7 +1138,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">10</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
@@ -1153,7 +1153,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">10</property>
<property name="top-attach">11</property>
</packing>
</child>
<child>
@@ -1170,7 +1170,7 @@
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">11</property>
<property name="top-attach">12</property>
</packing>
</child>
<child>
@@ -1185,7 +1185,50 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">11</property>
<property name="top-attach">12</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="hiddencolrow">
<property name="label" translatable="yes" context="colorconfigwin|hiddencolrow">Hidden columns/rows</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="draw-indicator">True</property>
<accessibility>
<relation type="label-for" target="hiddencolrow_lb"/>
</accessibility>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="hiddencolrow_lb">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">False</property>
<property name="halign">end</property>
<property name="draw-indicator">True</property>
<property name="label" translatable="no"></property>
<child>
<placeholder/>
</child>
<accessibility>
<relation type="labelled-by" target="hiddencolrow"/>
</accessibility>
<child internal-child="accessible">
<object class="AtkObject" id="hiddencolrow_lb-atkobject">
<property name="AtkObject::accessible-name" translatable="yes" context="colorconfigwin|hiddencolrow_lb">Hidden row/column color</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">4</property>
</packing>
</child>
</object>
diff --git a/include/svtools/colorcfg.hxx b/include/svtools/colorcfg.hxx
index c7a8111..562d4a3 100644
--- a/include/svtools/colorcfg.hxx
+++ b/include/svtools/colorcfg.hxx
@@ -56,6 +56,7 @@ enum ColorConfigEntry
CALCPAGEBREAK ,
CALCPAGEBREAKMANUAL,
CALCPAGEBREAKAUTOMATIC,
CALCHIDDENROWCOL ,
CALCDETECTIVE ,
CALCDETECTIVEERROR ,
CALCREFERENCE ,
diff --git a/officecfg/registry/data/org/openoffice/Office/UI.xcu b/officecfg/registry/data/org/openoffice/Office/UI.xcu
index 4e0e4c0..ed31bbb 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI.xcu
@@ -303,6 +303,14 @@
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcHiddenColRow">
<prop oor:name="IsVisible">
<value>true</value>
</prop>
<prop oor:name="Color">
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcDetective">
<prop oor:name="Color">
<value xsi:nil="true"/>
@@ -588,6 +596,14 @@
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcHiddenColRow">
<prop oor:name="IsVisible">
<value>true</value>
</prop>
<prop oor:name="Color">
<value xsi:nil="true"/>
</prop>
</node>
<node oor:name="CalcDetective">
<prop oor:name="Color">
<value>3494505</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/UI.xcs b/officecfg/registry/schema/org/openoffice/Office/UI.xcs
index 64c0188..aa4fdce 100644
--- a/officecfg/registry/schema/org/openoffice/Office/UI.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/UI.xcs
@@ -370,6 +370,22 @@
</info>
</prop>
</group>
<group oor:name="CalcHiddenColRow">
<info>
<desc>Specifies the settings used for hidden rows/cols in Calc.</desc>
</info>
<prop oor:name="IsVisible" oor:type="xs:boolean" oor:nillable="false">
<info>
<desc>Specifies the visibility of hidden row/col indicator (true = visible).</desc>
</info>
<value>true</value>
</prop>
<prop oor:name="Color" oor:type="xs:int">
<info>
<desc>Specifies the color used for hidden rows/cols.</desc>
</info>
</prop>
</group>
<group oor:name="CalcDetective">
<info>
<desc>Specifies the settings used for audition arrows in Calc.</desc>
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 183705d..e1ab39e 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -274,6 +274,7 @@ class SAL_DLLPUBLIC_RTTI ScGridWindow : public vcl::Window, public DropTargetHel
void DrawAfterScroll();
tools::Rectangle GetListValButtonRect( const ScAddress& rButtonPos );
void DrawHiddenIndicator( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext);
void DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext);
bool GetEditUrl( const Point& rPos,
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 8c9e4e0..1dc1bab 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -43,6 +43,8 @@
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/sdr/contact/viewcontact.hxx>
#include <tabvwsh.hxx>
#include <vcl/lineinfo.hxx>
#include <vcl/sysdata.hxx>
#include <gridwin.hxx>
#include <viewdata.hxx>
@@ -851,6 +853,9 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
pContentDev->SetMapMode(MapMode(MapUnit::MapPixel));
//tdf#128258 - draw a dotted line before hidden columns/rows
DrawHiddenIndicator(nX1,nY1,nX2,nY2, *pContentDev);
if ( bPageMode )
{
// DrawPagePreview draws complete lines/page numbers, must always be clipped
@@ -1691,6 +1696,39 @@ void ScGridWindow::CheckNeedsRepaint()
rBindings.Invalidate( SID_TABLE_CELL );
}
void ScGridWindow::DrawHiddenIndicator( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
{
ScDocument& rDoc = mrViewData.GetDocument();
SCTAB nTab = mrViewData.GetTabNo();
const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
const svtools::ColorConfigValue aColorValue = rColorCfg.GetColorValue(svtools::CALCHIDDENROWCOL);
if (aColorValue.bIsVisible) {
rRenderContext.SetLineColor(aColorValue.nColor);
LineInfo aLineInfo(LineStyle::Dash, 2);
aLineInfo.SetDashCount(0);
aLineInfo.SetDotCount(1);
aLineInfo.SetDistance(15);
//round caps except when running VCL_PLUGIN=gen
if (mrViewData.GetActiveWin()->GetSystemData()->toolkit != SystemEnvData::Toolkit::Gen)
aLineInfo.SetLineCap(css::drawing::LineCap_ROUND);
aLineInfo.SetDotLen(1);
for (int i=nX1; i<nX2; i++) {
if (rDoc.ColHidden(i,nTab) && (i<MAXCOL ? !rDoc.ColHidden(i+1,nTab) : true)) {
Point aStart = mrViewData.GetScrPos(i, nY1, eWhich, true );
Point aEnd = mrViewData.GetScrPos(i, nY2, eWhich, true );
rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
}
}
for (int i=nY1; i<nY2; i++) {
if (rDoc.RowHidden(i,nTab) && (i<MAXROW ? !rDoc.RowHidden(i+1,nTab) : true)) {
Point aStart = mrViewData.GetScrPos(nX1, i, eWhich, true );
Point aEnd = mrViewData.GetScrPos(nX2, i, eWhich, true );
rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
}
}
} //visible
}
void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, vcl::RenderContext& rRenderContext)
{
ScPageBreakData* pPageData = mrViewData.GetView()->GetPageBreakData();
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index 3bbd37f..79279b9 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -139,6 +139,7 @@ uno::Sequence< OUString> GetPropertyNames(const OUString& rScheme)
{ std::u16string_view(u"/CalcPageBreak"), false },
{ std::u16string_view(u"/CalcPageBreakManual"), false },
{ std::u16string_view(u"/CalcPageBreakAutomatic"), false },
{ std::u16string_view(u"/CalcHiddenColRow"), true },
{ std::u16string_view(u"/CalcDetective") ,false },
{ std::u16string_view(u"/CalcDetectiveError") ,false },
{ std::u16string_view(u"/CalcReference") ,false },
@@ -433,6 +434,7 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
COL_BLUE, //CALCPAGEBREAK
Color(0x2300dc), //CALCPAGEBREAKMANUAL
COL_GRAY7, //CALCPAGEBREAKAUTOMATIC
Color(0x2300dc), //CALCHIDDENCOLROW
COL_LIGHTBLUE, // CALCDETECTIVE
COL_LIGHTRED, // CALCDETECTIVEERROR
Color(0xef0fff), // CALCREFERENCE