Hi,
this is a patch to fix fdo#30800.
A tiny specification, what has been implemented is at the wiki:
http://wiki.documentfoundation.org/User:Andreschnabel/Spec_Calc_grid_lines_on_colored_background
Comments and questions are welcome, as this is the first time that I
actually *add* some code.
Patch is contributed under LGPLv3+/MPL.
Thanks and regards,
André
From 619e34e7c3a594804cca9c6f6a070b534a2d074c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Schnabel?= <andre.schnabel@gmx.net>
Date: Wed, 29 Jun 2011 20:02:47 +0200
Subject: [PATCH] fix for fdo#30800: Option to display calc gridlines on colored cells
* change UI option for grid line display to tri-state drop down
* view option VOPT_GRID will take the information wheter to "Show"
or "Hide" grid lines. New view option VOPT_GRID_ONTOP will take
the information wheter to display grid lines on top of colored
cells or not
* depending on VOPT_GRID_ONTOP grid lines will be drawn before or
after drawing cell background in ScGridWindow::Draw
* store option as boolean property "GridOnColoredCells" (path:
"/org.openoffice.Office.Calc/Layout/Line") in user config
* see
http://wiki.documentfoundation.org/User:Andreschnabel/Spec_Calc_grid_lines_on_colored_background#UI_definitions
for spec
---
sc/inc/viewopti.hxx | 1 +
sc/source/core/tool/viewopti.cxx | 11 +++++++-
sc/source/ui/inc/optdlg.hrc | 3 +-
sc/source/ui/inc/tpview.hxx | 5 ++-
sc/source/ui/optdlg/tpview.cxx | 50 +++++++++++++++++++++++++-------------
sc/source/ui/src/optdlg.src | 21 +++++++++++++--
sc/source/ui/view/gridwin4.cxx | 2 +-
7 files changed, 68 insertions(+), 25 deletions(-)
diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx
index ad4641e..6ad4814 100644
--- a/sc/inc/viewopti.hxx
+++ b/sc/inc/viewopti.hxx
@@ -52,6 +52,7 @@ enum ScViewOption
VOPT_OUTLINER,
VOPT_HEADER,
VOPT_GRID,
+ VOPT_GRID_ONTOP,
VOPT_HELPLINES,
VOPT_ANCHOR,
VOPT_PAGEBREAKS,
diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx
index 97139c6..85e6b0d 100644
--- a/sc/source/core/tool/viewopti.cxx
+++ b/sc/source/core/tool/viewopti.cxx
@@ -153,6 +153,7 @@ void ScViewOptions::SetDefaults()
aOptArr[ VOPT_FORMULAS ] =
aOptArr[ VOPT_SYNTAX ] =
aOptArr[ VOPT_HELPLINES ] =
+ aOptArr[ VOPT_GRID_ONTOP ] =
aOptArr[ VOPT_BIGHANDLES ] = false;
aOptArr[ VOPT_NOTES ] =
aOptArr[ VOPT_NULLVALS ] =
@@ -308,7 +309,8 @@ SfxPoolItem* ScTpViewItem::Clone( SfxItemPool * ) const
#define SCLAYOUTOPT_VERTSCROLL 8
#define SCLAYOUTOPT_SHEETTAB 9
#define SCLAYOUTOPT_OUTLINE 10
-#define SCLAYOUTOPT_COUNT 11
+#define SCLAYOUTOPT_GRID_ONCOLOR 11
+#define SCLAYOUTOPT_COUNT 12
#define CFGPATH_DISPLAY "Office.Calc/Content/Display"
@@ -343,6 +345,7 @@ Sequence<OUString> ScViewCfg::GetLayoutPropertyNames()
static const char* aPropNames[] =
{
"Line/GridLine", // SCLAYOUTOPT_GRIDLINES
+ "Line/GridOnColoredCells", // SCLAYOUTOPT_GRID_ONCOLOR
"Line/GridLineColor", // SCLAYOUTOPT_GRIDCOLOR
"Line/PageBreak", // SCLAYOUTOPT_PAGEBREAK
"Line/Guide", // SCLAYOUTOPT_GUIDE
@@ -445,6 +448,9 @@ ScViewCfg::ScViewCfg() :
case SCLAYOUTOPT_GRIDLINES:
SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] )
);
break;
+ case SCLAYOUTOPT_GRID_ONCOLOR:
+ SetOption( VOPT_GRID_ONTOP, ScUnoHelpFunctions::GetBoolFromAny(
pValues[nProp] ) );
+ break;
case SCLAYOUTOPT_PAGEBREAK:
SetOption( VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny(
pValues[nProp] ) );
break;
@@ -613,6 +619,9 @@ IMPL_LINK( ScViewCfg, LayoutCommitHdl, void *, EMPTYARG )
case SCLAYOUTOPT_GRIDLINES:
ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_GRID ) );
break;
+ case SCLAYOUTOPT_GRID_ONCOLOR:
+ ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_GRID_ONTOP ) );
+ break;
case SCLAYOUTOPT_PAGEBREAK:
ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_PAGEBREAKS ) );
break;
diff --git a/sc/source/ui/inc/optdlg.hrc b/sc/source/ui/inc/optdlg.hrc
index 4cdb0a5..90c0db7 100644
--- a/sc/source/ui/inc/optdlg.hrc
+++ b/sc/source/ui/inc/optdlg.hrc
@@ -145,7 +145,6 @@
#define CB_TBLREG 54
#define CB_OUTLINE 55
#define GB_LINES 56
-#define CB_GRID 57
#define FT_COLOR 58
#define LB_COLOR 59
#define CB_GUIDELINE 60
@@ -162,6 +161,8 @@
#define FL_SEPARATOR1 71
#define FL_SEPARATOR2 72
#define FL_SEPARATOR 73
+#define FT_GRID 74
+#define LB_GRID 75
// TP_INPUT
#define GB_OPTIONS 70
diff --git a/sc/source/ui/inc/tpview.hxx b/sc/source/ui/inc/tpview.hxx
index ff3cd11..338db98 100644
--- a/sc/source/ui/inc/tpview.hxx
+++ b/sc/source/ui/inc/tpview.hxx
@@ -47,7 +47,8 @@ class ScViewOptions;
class ScTpContentOptions : public SfxTabPage
{
FixedLine aLinesGB;
- CheckBox aGridCB;
+ FixedText aGridFT;
+ ListBox aGridLB;
FixedText aColorFT;
ColorListBox aColorLB;
CheckBox aBreakCB;
@@ -89,7 +90,7 @@ class ScTpContentOptions : public SfxTabPage
ScViewOptions* pLocalOptions;
void InitGridOpt();
- DECL_LINK( GridHdl, CheckBox* );
+ DECL_LINK( GridHdl, ListBox* );
DECL_LINK( SelLbObjHdl, ListBox* );
DECL_LINK( CBHdl, CheckBox* );
diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx
index ce555fe..197169e 100644
--- a/sc/source/ui/optdlg/tpview.cxx
+++ b/sc/source/ui/optdlg/tpview.cxx
@@ -62,7 +62,8 @@ ScTpContentOptions::ScTpContentOptions( Window* pParent,
SfxTabPage(pParent, ScResId( RID_SCPAGE_CONTENT ), rArgSet),
aLinesGB( this, ScResId(GB_LINES )),
- aGridCB( this, ScResId(CB_GRID )),
+ aGridFT( this, ScResId(FT_GRID )),
+ aGridLB( this, ScResId(LB_GRID )),
aColorFT( this, ScResId(FT_COLOR )),
aColorLB( this, ScResId(LB_COLOR )),
aBreakCB( this, ScResId(CB_PAGEBREAKS )),
@@ -108,6 +109,7 @@ ScTpContentOptions::ScTpContentOptions( Window* pParent,
aObjGrfLB. SetSelectHdl(aSelObjHdl);
aDiagramLB. SetSelectHdl(aSelObjHdl);
aDrawLB. SetSelectHdl(aSelObjHdl);
+ aGridLB. SetSelectHdl( LINK( this, ScTpContentOptions, GridHdl ) );
Link aCBHdl(LINK( this, ScTpContentOptions, CBHdl ) );
aFormulaCB .SetClickHdl(aCBHdl);
@@ -127,7 +129,6 @@ ScTpContentOptions::ScTpContentOptions( Window* pParent,
aBigHandleCB.SetClickHdl(aCBHdl);
aRowColHeaderCB.SetClickHdl(aCBHdl);
- aGridCB .SetClickHdl( LINK( this, ScTpContentOptions, GridHdl ) );
}
ScTpContentOptions::~ScTpContentOptions()
@@ -153,7 +154,7 @@ sal_Bool ScTpContentOptions::FillItemSet( SfxItemSet& rCoreSet )
aObjGrfLB .GetSavedValue() != aObjGrfLB .GetSelectEntryPos() ||
aDiagramLB .GetSavedValue() != aDiagramLB .GetSelectEntryPos() ||
aDrawLB .GetSavedValue() != aDrawLB .GetSelectEntryPos() ||
- aGridCB .GetSavedValue() != aGridCB.IsChecked() ||
+ aGridLB .GetSavedValue() != aGridLB .GetSelectEntryPos() ||
aRowColHeaderCB .GetSavedValue() != aRowColHeaderCB.IsChecked() ||
aHScrollCB .GetSavedValue() != aHScrollCB .IsChecked() ||
aVScrollCB .GetSavedValue() != aVScrollCB .IsChecked() ||
@@ -239,7 +240,7 @@ void ScTpContentOptions::Reset( const SfxItemSet& rCoreSet )
aVScrollCB .SaveValue();
aTblRegCB .SaveValue();
aOutlineCB .SaveValue();
- aGridCB .SaveValue();
+ aGridLB .SaveValue();
aColorLB .SaveValue();
aBreakCB .SaveValue();
aGuideLineCB .SaveValue();
@@ -310,19 +311,30 @@ IMPL_LINK( ScTpContentOptions, CBHdl, CheckBox*, pBtn )
void ScTpContentOptions::InitGridOpt()
{
- sal_Bool bGrid = pLocalOptions->GetOption( VOPT_GRID );
-
- aGridCB.Check( bGrid );
+ sal_Bool bGrid = pLocalOptions->GetOption( VOPT_GRID );
+ sal_Bool bGridOnTop = pLocalOptions->GetOption( VOPT_GRID_ONTOP );
+ sal_uInt16 nSelPos = 0;
if ( bGrid )
+ {
aColorFT.Enable(), aColorLB.Enable();
+ if ( !bGridOnTop )
+ nSelPos = 0;
+ else
+ nSelPos = 1;
+ }
else
+ {
aColorFT.Disable(), aColorLB.Disable();
+ nSelPos = 2;
+ }
+
+ aGridLB.SelectEntryPos (nSelPos);
if ( aColorLB.GetEntryCount() == 0 )
{
SfxObjectShell* pDocSh = SfxObjectShell::Current();
- // hier koennte auch eine andere DocShell kommen!
+ // there might be another DocShell here
pDocSh = PTR_CAST(ScDocShell, pDocSh);
XColorTable* pColorTable = NULL;
@@ -344,7 +356,7 @@ void ScTpContentOptions::InitGridOpt()
aColorLB.SetUpdateMode( false );
- // Eintraege aus der Colortable
+ // items from ColorTable
long nCount = pColorTable->Count();
for ( long n=0; n<nCount; n++ )
@@ -353,9 +365,9 @@ void ScTpContentOptions::InitGridOpt()
aColorLB.InsertEntry( pEntry->GetColor(), pEntry->GetName() );
}
- // Standard-Gitterfarbe
+ // default GridColor
- Color aStdCol( SC_STD_GRIDCOLOR ); // wie Default in ScViewOptions
+ Color aStdCol( SC_STD_GRIDCOLOR ); // same default as in ScViewOptions
if ( LISTBOX_ENTRY_NOTFOUND ==
aColorLB.GetEntryPos( aStdCol ) )
aColorLB.InsertEntry( aStdCol, ScGlobal::GetRscString( STR_GRIDCOLOR ) );
@@ -369,7 +381,7 @@ void ScTpContentOptions::InitGridOpt()
String aName;
Color aCol = pLocalOptions->GetGridColor( &aName );
- sal_uInt16 nSelPos = aColorLB.GetEntryPos( aCol );
+ nSelPos = aColorLB.GetEntryPos( aCol );
if ( LISTBOX_ENTRY_NOTFOUND != nSelPos )
aColorLB.SelectEntryPos( nSelPos );
@@ -377,12 +389,16 @@ void ScTpContentOptions::InitGridOpt()
aColorLB.SelectEntryPos( aColorLB.InsertEntry( aCol, aName ) );
}
-IMPL_LINK( ScTpContentOptions, GridHdl, CheckBox*, pBox )
+IMPL_LINK( ScTpContentOptions, GridHdl, ListBox*, pLb )
{
- sal_Bool bChecked = pBox->IsChecked();
- aColorFT.Enable(bChecked);
- aColorLB.Enable(bChecked);
- pLocalOptions->SetOption( VOPT_GRID, bChecked );
+ sal_uInt16 nSelPos = pLb->GetSelectEntryPos();
+ sal_Bool bGrid = ( nSelPos <= 1 );
+ sal_Bool bGridOnTop = ( nSelPos == 1 );
+
+ aColorFT.Enable(bGridOnTop);
+ aColorLB.Enable(bGridOnTop);
+ pLocalOptions->SetOption( VOPT_GRID, bGrid );
+ pLocalOptions->SetOption( VOPT_GRID_ONTOP, bGridOnTop );
return 0;
}
diff --git a/sc/source/ui/src/optdlg.src b/sc/source/ui/src/optdlg.src
index b6f9fe3..b1a722c 100644
--- a/sc/source/ui/src/optdlg.src
+++ b/sc/source/ui/src/optdlg.src
@@ -446,13 +446,28 @@ TabPage RID_SCPAGE_CONTENT
Size = MAP_APPFONT ( 121 , 8 ) ;
Text [ en-US ] = "Visual aids";
};
- CheckBox CB_GRID
+ FixedText FT_GRID
{
- HelpID = "sc:CheckBox:RID_SCPAGE_CONTENT:CB_GRID";
+ HelpID = "sc:CheckBox:RID_SCPAGE_CONTENT:FT_GRID";
Pos = MAP_APPFONT ( 12 , 14 ) ;
- Size = MAP_APPFONT ( 112 , 10 ) ;
+ Size = MAP_APPFONT ( 40 , 8 ) ;
Text [ en-US ] = "~Grid lines" ;
};
+ ListBox LB_GRID
+ {
+ HelpID = "sc:ListBox:RID_SCPAGE_CONTENT:LB_GRID";
+ Pos = MAP_APPFONT ( 54 , 12 ) ;
+ Size = MAP_APPFONT ( 70 , 46 ) ;
+ Border = TRUE ;
+ DropDown = TRUE ;
+ StringList [ en-US ] =
+ {
+ < "Show" ; Default ; > ;
+ < "Show on colored cells" ; Default ; > ;
+ < "Hide" ; Default ; > ;
+ };
+
+ };
FixedText FT_COLOR
{
Pos = MAP_APPFONT ( 21 , 28 ) ;
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 5046c15..55563d5 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -399,7 +399,6 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
{
ScModule* pScMod = SC_MOD();
sal_Bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg();
- sal_Bool bGridFirst = true; //! entscheiden!!!
if (pViewData->IsMinimized())
return;
@@ -543,6 +542,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
aOutputData.SetViewShell( pViewData->GetViewShell() );
sal_Bool bGrid = rOpts.GetOption( VOPT_GRID ) && pViewData->GetShowGrid();
+ sal_Bool bGridFirst = !rOpts.GetOption( VOPT_GRID_ONTOP );
sal_Bool bPage = rOpts.GetOption( VOPT_PAGEBREAKS );
--
1.7.3.4
From 36de0a6aa9a199ad86d1e360bd8f2acaee59eea8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andr=C3=A9=20Schnabel?= <andre.schnabel@gmx.net>
Date: Wed, 29 Jun 2011 20:28:34 +0200
Subject: [PATCH] fix for fdo#30800: Option to display grid lines on colored cells
* declaration of new config property "GridOnColoredCells"
(path: "/org.openoffice.Office.Calc/Layout/Line")
---
.../registry/schema/org/openoffice/Office/Calc.xcs | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index a5528eb..efe840c 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -297,6 +297,15 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="GridOnColoredCells" oor:type="xs:boolean">
+ <!-- UIHints: Tools - Options -Spreadsheets - Layout - [Section] Visual Aids
-->
+ <info>
+ <author>André Schnabel</author>
+ <desc>Specifies whether grid lines should be displayed on top of colored
cells.</desc>
+ <label>Grid lines on colored background</label>
+ </info>
+ <value>false</value>
+ </prop>
<prop oor:name="GridLineColor" oor:type="xs:int">
<!-- OldPath: Calc/Layout/Lines -->
<!-- OldLocation: Soffice.cfg -->
--
1.7.3.4
Context
- [Libreoffice] [PATCH] fix for fdo#30800: Option to display calc gridlines on colored cells · André Schnabel
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.