update dev300-m58
[ooovba.git] / applied_patches / 0017-cws-calctabcolor-sc.diff
blob11c4a2f8c08b64368712bd8227e01599ca5242e3
1 diff --git sc/inc/ViewSettingsSequenceDefines.hxx sc/inc/ViewSettingsSequenceDefines.hxx
2 index 63671c5..c720413 100644
3 --- sc/inc/ViewSettingsSequenceDefines.hxx
4 +++ sc/inc/ViewSettingsSequenceDefines.hxx
5 @@ -64,7 +64,7 @@
6 // this are the defines for the position of the settings in the
7 // TableViewSettingsSequence
9 -#define SC_TABLE_VIEWSETTINGS_COUNT 14
10 +#define SC_TABLE_VIEWSETTINGS_COUNT 15
12 #define SC_CURSOR_X 0
13 #define SC_CURSOR_Y 1
14 @@ -80,6 +80,7 @@
15 #define SC_TABLE_ZOOM_TYPE 11
16 #define SC_TABLE_ZOOM_VALUE 12
17 #define SC_TABLE_PAGE_VIEW_ZOOM_VALUE 13
18 +#define SC_TABLE_TAB_BG_COLOR 14
20 #define SC_CURSORPOSITIONX "CursorPositionX"
21 #define SC_CURSORPOSITIONY "CursorPositionY"
22 diff --git sc/inc/globstr.hrc sc/inc/globstr.hrc
23 index 1db4648..5c0f48e 100644
24 --- sc/inc/globstr.hrc
25 +++ sc/inc/globstr.hrc
26 @@ -573,7 +573,10 @@
27 #define STR_STYLE_FAMILY_CELL 433
28 #define STR_STYLE_FAMILY_PAGE 434
30 -#define STR_COUNT 435
31 +#define STR_UNDO_SET_TAB_BG_COLOR 435
32 +#define STR_UNDO_SET_MULTI_TAB_BG_COLOR 436
34 +#define STR_COUNT 437
36 #endif
38 diff --git sc/inc/sc.hrc sc/inc/sc.hrc
39 index c9bd929..76f0343 100644
40 --- sc/inc/sc.hrc
41 +++ sc/inc/sc.hrc
42 @@ -833,8 +833,10 @@
43 #define FID_TAB_INDEX (TAB_POPUP_START+6)
44 #define FID_TAB_RTL (TAB_POPUP_START+7)
45 #define FID_TAB_DESELECTALL (TAB_POPUP_START+8)
46 +#define FID_TAB_MENU_SET_TAB_BG_COLOR (TAB_POPUP_START + 9)
47 +#define FID_TAB_SET_TAB_BG_COLOR (TAB_POPUP_START + 10)
49 -#define TAB_POPUP_END (DATA_MENU_END + 20)
50 +#define TAB_POPUP_END (TAB_POPUP_START + 20)
52 #define OBJBAR_FORMAT_START (TAB_POPUP_END)
53 #define SID_ALIGNLEFT (OBJBAR_FORMAT_START+6)
54 @@ -1430,7 +1432,10 @@
56 #define RID_SCSTR_ONCLICK (STR_START + 402)
58 -#define STR_END RID_SCSTR_ONCLICK
59 +#define SCSTR_SET_TAB_BG_COLOR (STR_START + 403)
60 +#define SCSTR_NO_TAB_BG_COLOR (STR_START + 404)
62 +#define STR_END (SCSTR_NO_TAB_BG_COLOR)
64 #define BMP_START (STR_END)
66 @@ -1639,8 +1644,9 @@
67 #define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151)
68 #define RID_POPUP_FILTER (SC_DIALOGS_START + 152)
69 #define RID_SCDLG_TEXT_IMPORT_OPTIONS (SC_DIALOGS_START + 153)
70 +#define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154)
72 -#define SC_DIALOGS_END (SC_DIALOGS_START + 154)
73 +#define SC_DIALOGS_END (SC_DIALOGS_START + 155)
75 #ifndef STD_MASKCOLOR
76 #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
77 diff --git sc/inc/scabstdlg.hxx sc/inc/scabstdlg.hxx
78 index 1de5302..81f190b 100644
79 --- sc/inc/scabstdlg.hxx
80 +++ sc/inc/scabstdlg.hxx
81 @@ -285,6 +285,12 @@ public:
82 virtual void GetInputString( String& rString ) const = 0;
85 +class AbstractScTabBgColorDlg : public VclAbstractDialog //add for ScTabBgColorDlg
87 +public:
88 + virtual void GetSelectedColor( Color& rColor ) const = 0;
89 +};
91 class AbstractScImportOptionsDlg : public VclAbstractDialog //add for ScImportOptionsDlg
93 public:
94 @@ -434,6 +440,14 @@ public:
95 const String& rDefault,
96 ULONG nHelpId ,
97 int nId ) = 0;
99 + virtual AbstractScTabBgColorDlg * CreateScTabBgColorDlg ( Window* pParent, //add for ScTabBgColorDlg
100 + const String& rTitle, //Dialog Title
101 + const String& rTabBgColorNoColorText, //Label for no tab color
102 + const Color& rDefaultColor, //Currently selected Color
103 + ULONG nHelpId ,
104 + int nId ) = 0;
106 virtual AbstractScImportOptionsDlg * CreateScImportOptionsDlg ( Window* pParent, //add for ScImportOptionsDlg
107 int nId,
108 BOOL bAscii = TRUE,
109 diff --git sc/inc/scextopt.hxx sc/inc/scextopt.hxx
110 index d9e654e..0e3866e 100644
111 --- sc/inc/scextopt.hxx
112 +++ sc/inc/scextopt.hxx
113 @@ -80,6 +80,8 @@ struct ScExtTabSettings
114 bool mbSelected; /// true = Sheet is selected.
115 bool mbFrozenPanes; /// true = Frozen panes; false = Normal splits.
116 bool mbPageMode; /// true = Pagebreak mode; false = Normal view mode.
117 + Color maTabBgColor; /// Tab Bg Color
118 + bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? TRUE : FALSE; };
120 explicit ScExtTabSettings();
122 diff --git sc/inc/tabbgcolor.hxx sc/inc/tabbgcolor.hxx
123 new file mode 100644
124 index 0000000..83b694a
125 --- /dev/null
126 +++ sc/inc/tabbgcolor.hxx
127 @@ -0,0 +1,46 @@
128 +/*************************************************************************
130 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
132 + * Copyright 2008 by Sun Microsystems, Inc.
134 + * OpenOffice.org - a multi-platform office productivity suite
136 + * $RCSfile: tabbgcolor.hxx,v $
137 + * $Revision: 1.00 $
139 + * This file is part of OpenOffice.org.
141 + * OpenOffice.org is free software: you can redistribute it and/or modify
142 + * it under the terms of the GNU Lesser General Public License version 3
143 + * only, as published by the Free Software Foundation.
145 + * OpenOffice.org is distributed in the hope that it will be useful,
146 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
147 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
148 + * GNU Lesser General Public License version 3 for more details
149 + * (a copy is included in the LICENSE file that accompanied this code).
151 + * You should have received a copy of the GNU Lesser General Public License
152 + * version 3 along with OpenOffice.org. If not, see
153 + * <http://www.openoffice.org/license.html>
154 + * for a copy of the LGPLv3 License.
156 + ************************************************************************/
157 +#ifndef SC_TABBGCOLOR_HXX
158 +#define SC_TABBGCOLOR_HXX
160 +#include <tools/color.hxx>
161 +#include <tools/list.hxx>
163 +struct ScUndoSetTabBgColorInfo
165 +public:
166 + SCTAB nTabId;
167 + Color aOldTabBgColor;
168 + Color aNewTabBgColor;
169 + BOOL IsDefaultOldTabBgColor() const {return aOldTabBgColor == Color( COL_AUTO ) ? TRUE : FALSE ;};
170 + BOOL IsDefaultNewTabBgColor() const {return aOldTabBgColor == Color( COL_AUTO ) ? TRUE : FALSE ;};
172 +DECLARE_LIST( ScUndoSetTabBgColorInfoList, ScUndoSetTabBgColorInfo* )
173 +#endif
174 diff --git sc/inc/unonames.hxx sc/inc/unonames.hxx
175 index faa463f..589fa37 100644
176 --- sc/inc/unonames.hxx
177 +++ sc/inc/unonames.hxx
178 @@ -529,6 +529,8 @@
179 #define SC_UNO_ZOOMTYPE "ZoomType"
180 #define SC_UNO_ZOOMVALUE "ZoomValue"
181 #define SC_UNO_UPDTEMPL "UpdateFromTemplate"
182 +#define SC_UNO_TABCOLOR "TabColor"
184 /*Stampit enable/disable print cancel */
185 #define SC_UNO_ALLOWPRINTJOBCANCEL "AllowPrintJobCancel"
187 diff --git sc/sdi/docsh.sdi sc/sdi/docsh.sdi
188 index 67803b5..4a773ab 100644
189 --- sc/sdi/docsh.sdi
190 +++ sc/sdi/docsh.sdi
191 @@ -63,6 +63,7 @@ interface TableSelection
192 FID_DELETE_TABLE [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
193 FID_TAB_RENAME [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
194 FID_TAB_RTL [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
195 + FID_TAB_SET_TAB_BG_COLOR [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
197 SID_TABLE_ACTIVATE [ ExecMethod = Execute; ]
199 diff --git sc/sdi/scalc.sdi sc/sdi/scalc.sdi
200 index 9a1678d..2d0e476 100644
201 --- sc/sdi/scalc.sdi
202 +++ sc/sdi/scalc.sdi
203 @@ -7824,3 +7824,56 @@ SfxVoidItem ShareDocument SID_SHARE_DOC
204 ToolBoxConfig = FALSE,
205 GroupId = GID_OPTIONS;
208 +//--------------------------------------------------------------------------
209 +SvxColorItem TabBgColor FID_TAB_SET_TAB_BG_COLOR
212 + // flags:
213 + AutoUpdate = FALSE,
214 + Cachable = Cachable,
215 + FastCall = FALSE,
216 + HasCoreId = FALSE,
217 + HasDialog = TRUE,
218 + ReadOnlyDoc = TRUE,
219 + Toggle = FALSE,
220 + Container = FALSE,
221 + RecordAbsolute = FALSE,
222 + RecordPerSet;
223 + Synchron;
225 + Readonly = FALSE,
227 + // config:
228 + AccelConfig = TRUE,
229 + MenuConfig = TRUE,
230 + StatusBarConfig = FALSE,
231 + ToolBoxConfig = FALSE,
232 + GroupId = GID_FORMAT;
235 +//--------------------------------------------------------------------------
236 +SfxVoidItem SetTabBgColor FID_TAB_MENU_SET_TAB_BG_COLOR
237 +(SvxColorItem TabBgColor FID_TAB_SET_TAB_BG_COLOR)
239 + /* flags: */
240 + AutoUpdate = FALSE,
241 + Cachable = Cachable,
242 + FastCall = FALSE,
243 + HasCoreId = FALSE,
244 + HasDialog = TRUE,
245 + ReadOnlyDoc = TRUE,
246 + Toggle = FALSE,
247 + Container = FALSE,
248 + RecordAbsolute = FALSE,
249 + RecordPerSet;
250 + Synchron;
252 + /* config: */
253 + AccelConfig = TRUE,
254 + MenuConfig = TRUE,
255 + StatusBarConfig = FALSE,
256 + ToolBoxConfig = FALSE,
257 + GroupId = GID_FORMAT;
260 diff --git sc/sdi/tabvwsh.sdi sc/sdi/tabvwsh.sdi
261 index 624cb09..44855a2 100644
262 --- sc/sdi/tabvwsh.sdi
263 +++ sc/sdi/tabvwsh.sdi
264 @@ -61,6 +61,7 @@ interface Tables
265 FID_TABLE_HIDE [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
266 FID_TABLE_SHOW [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
267 SID_SELECT_TABLES [ ExecMethod = Execute; StateMethod = GetState; ]
268 + FID_TAB_MENU_SET_TAB_BG_COLOR [ ExecMethod = ExecuteTable; StateMethod = GetStateTable; ]
271 // ===========================================================================
272 diff --git sc/source/filter/excel/read.cxx sc/source/filter/excel/read.cxx
273 index a93f993..e8c2d89 100644
274 --- sc/source/filter/excel/read.cxx
275 +++ sc/source/filter/excel/read.cxx
276 @@ -1152,6 +1152,9 @@ FltError ImportExcel8::Read( void )
277 case EXC_ID_SXVDEX: rPTableMgr.ReadSxvdex( maStrm ); break;
278 case EXC_ID_SXEX: rPTableMgr.ReadSxex( maStrm ); break;
279 case EXC_ID_SXVIEWEX9: rPTableMgr.ReadSxViewEx9( maStrm ); break;
281 + // 0x0862 (SHEETEXT)
282 + case EXC_ID_SHEETEXT: rTabViewSett.ReadTabBgColor( maStrm, rPal ); break;
285 break;
286 diff --git sc/source/filter/excel/xestyle.cxx sc/source/filter/excel/xestyle.cxx
287 index d93eec3..de32a64 100644
288 --- sc/source/filter/excel/xestyle.cxx
289 +++ sc/source/filter/excel/xestyle.cxx
290 @@ -77,6 +77,7 @@ sal_uInt32 lclGetWeighting( XclExpColorType eType )
291 case EXC_COLOR_CELLTEXT:
292 case EXC_COLOR_CHARTTEXT:
293 case EXC_COLOR_CTRLTEXT: return 10;
294 + case EXC_COLOR_TABBG:
295 case EXC_COLOR_CELLAREA: return 20;
296 case EXC_COLOR_GRID: return 50;
297 default: DBG_ERRORFILE( "lclGetWeighting - unknown color type" );
298 diff --git sc/source/filter/excel/xeview.cxx sc/source/filter/excel/xeview.cxx
299 index da4af8c..81c5b9a 100644
300 --- sc/source/filter/excel/xeview.cxx
301 +++ sc/source/filter/excel/xeview.cxx
302 @@ -259,6 +259,35 @@ void XclExpSelection::WriteBody( XclExpStream& rStrm )
303 maSelData.maXclSelection.Write( rStrm, false );
306 +// ----------------------------------------------------------------------------
308 +XclExpTabBgColor::XclExpTabBgColor( const XclTabViewData& rTabViewData ) :
309 + XclExpRecord( EXC_ID_SHEETEXT, 18 ),
310 + mrTabViewData( rTabViewData )
313 +//TODO Fix savexml...
314 +/*void XclExpTabBgColor::SaveXml( XclExpXmlStream& rStrm )
316 +}*/
318 +void XclExpTabBgColor::WriteBody( XclExpStream& rStrm )
320 + if ( mrTabViewData.IsDefaultTabBgColor() )
321 + return;
322 + sal_uInt16 rt = 0x0862; //rt
323 + sal_uInt16 grbitFrt = 0x0000; //grbit must be set to 0
324 + sal_uInt32 unused = 0x00000000; //Use twice...
325 + sal_uInt32 cb = 0x00000014; // Record Size, may be larger in future...
326 + sal_uInt16 reserved = 0x0000; //trailing bits are 0
327 + sal_uInt16 TabBgColorIndex;
328 + XclExpPalette& rPal = rStrm.GetRoot().GetPalette();
329 + TabBgColorIndex = rPal.GetColorIndex(mrTabViewData.mnTabBgColorId);
330 + if (TabBgColorIndex < 8 || TabBgColorIndex > 63 ) // only numbers 8 - 63 are valid numbers
331 + TabBgColorIndex = 127; //Excel specs: 127 makes excel ignore tab color information.
332 + rStrm << rt << grbitFrt << unused << unused << cb << TabBgColorIndex << reserved;
335 // Sheet view settings ========================================================
337 namespace {
338 @@ -368,6 +397,14 @@ XclExpTabViewSettings::XclExpTabViewSettings( const XclExpRoot& rRoot, SCTAB nSc
339 maData.mnNormalZoom = lclGetXclZoom( rTabSett.mnNormalZoom, EXC_WIN2_NORMALZOOM_DEF );
340 maData.mnPageZoom = lclGetXclZoom( rTabSett.mnPageZoom, EXC_WIN2_PAGEZOOM_DEF );
341 maData.mnCurrentZoom = maData.mbPageMode ? maData.mnPageZoom : maData.mnNormalZoom;
343 + // Tab Bg Color
344 + if ( GetBiff() == EXC_BIFF8 && !rTabSett.IsDefaultTabBgColor() )
346 + XclExpPalette& rPal = GetPalette();
347 + maData.maTabBgColor = rTabSett.maTabBgColor;
348 + maData.mnTabBgColorId = rPal.InsertColor(maData.maTabBgColor, EXC_COLOR_TABBG, EXC_COLOR_NOTABBG );
353 @@ -380,6 +417,7 @@ void XclExpTabViewSettings::Save( XclExpStream& rStrm )
354 WriteSelection( rStrm, EXC_PANE_TOPRIGHT );
355 WriteSelection( rStrm, EXC_PANE_BOTTOMLEFT );
356 WriteSelection( rStrm, EXC_PANE_BOTTOMRIGHT );
357 + WriteTabBgColor( rStrm );
360 static void lcl_WriteSelection( XclExpXmlStream& rStrm, const XclTabViewData& rData, sal_uInt8 nPane )
361 @@ -494,5 +532,10 @@ void XclExpTabViewSettings::WriteSelection( XclExpStream& rStrm, sal_uInt8 nPane
362 XclExpSelection( maData, nPane ).Save( rStrm );
365 +void XclExpTabViewSettings::WriteTabBgColor( XclExpStream& rStrm ) const
367 + if ( !maData.IsDefaultTabBgColor() )
368 + XclExpTabBgColor( maData ).Save( rStrm );
370 // ============================================================================
372 diff --git sc/source/filter/excel/xichart.cxx sc/source/filter/excel/xichart.cxx
373 index 69ead7f..41ec801 100644
374 --- sc/source/filter/excel/xichart.cxx
375 +++ sc/source/filter/excel/xichart.cxx
376 @@ -3765,6 +3765,12 @@ void XclImpChart::ReadChartSubStream( XclImpStream& rStrm )
378 case EXC_ID_WINDOW2: rTabViewSett.ReadWindow2( rStrm, true );break;
379 case EXC_ID_SCL: rTabViewSett.ReadScl( rStrm ); break;
380 + case EXC_ID_SHEETEXT: //0x0862
382 + XclImpPalette& rPal = GetPalette();
383 + rTabViewSett.ReadTabBgColor( rStrm, rPal);
385 + break;
388 switch( rStrm.GetRecId() )
389 diff --git sc/source/filter/excel/xiview.cxx sc/source/filter/excel/xiview.cxx
390 index a871bdd..fbd72d0 100644
391 --- sc/source/filter/excel/xiview.cxx
392 +++ sc/source/filter/excel/xiview.cxx
393 @@ -109,6 +109,24 @@ void XclImpTabViewSettings::Initialize()
394 maData.SetDefaults();
397 +void XclImpTabViewSettings::ReadTabBgColor( XclImpStream& rStrm, XclImpPalette& rPal )
399 + DBG_ASSERT_BIFF( GetBiff() >= EXC_BIFF8 );
400 + if( GetBiff() < EXC_BIFF8 )
401 + return;
403 + sal_uInt8 ColorIndex;
404 + Color TabBgColor;
406 + rStrm.Ignore( 16 );
407 + ColorIndex = rStrm.ReaduInt8() & EXC_SHEETEXT_TABCOLOR; //0x7F
408 + if ( ColorIndex >= 8 && ColorIndex <= 63 ) //only accept valid index values
410 + TabBgColor = rPal.GetColor( ColorIndex );
411 + maData.maTabBgColor = TabBgColor;
415 void XclImpTabViewSettings::ReadWindow2( XclImpStream& rStrm, bool bChart )
417 if( GetBiff() == EXC_BIFF2 )
418 @@ -279,6 +297,10 @@ void XclImpTabViewSettings::Finalize()
419 aViewOpt.SetOption( VOPT_OUTLINER, maData.mbShowOutline );
420 rDoc.SetViewOptions( aViewOpt );
423 + // *** set tab bg color
424 + if ( !maData.IsDefaultTabBgColor() )
425 + rTabSett.maTabBgColor = maData.maTabBgColor;
428 // ============================================================================
429 diff --git sc/source/filter/excel/xlview.cxx sc/source/filter/excel/xlview.cxx
430 index 080075b..8580d7a 100644
431 --- sc/source/filter/excel/xlview.cxx
432 +++ sc/source/filter/excel/xlview.cxx
433 @@ -79,6 +79,7 @@ void XclTabViewData::SetDefaults()
434 mbDefGridColor = true;
435 mbShowFormulas = false;
436 mbShowGrid = mbShowHeadings = mbShowZeros = mbShowOutline = true;
437 + maTabBgColor.SetColor( COL_AUTO );
440 bool XclTabViewData::IsSplit() const
441 diff --git sc/source/filter/inc/xestyle.hxx sc/source/filter/inc/xestyle.hxx
442 index 8485bb1..9508c8b 100644
443 --- sc/source/filter/inc/xestyle.hxx
444 +++ sc/source/filter/inc/xestyle.hxx
445 @@ -61,7 +61,8 @@ enum XclExpColorType
446 EXC_COLOR_CHARTLINE, /// Line in a chart.
447 EXC_COLOR_CHARTAREA, /// Area in a chart.
448 EXC_COLOR_CTRLTEXT, /// Text color in a form control.
449 - EXC_COLOR_GRID /// Spreadsheet grid color.
450 + EXC_COLOR_GRID, /// Spreadsheet grid color.
451 + EXC_COLOR_TABBG /// Spreadsheet tab bg color.
454 // ----------------------------------------------------------------------------
455 diff --git sc/source/filter/inc/xeview.hxx sc/source/filter/inc/xeview.hxx
456 index 4d8b10d..5c54ecd 100644
457 --- sc/source/filter/inc/xeview.hxx
458 +++ sc/source/filter/inc/xeview.hxx
459 @@ -134,6 +134,20 @@ private:
460 sal_uInt8 mnPane; /// Pane identifier of this selection.
463 +class XclExpTabBgColor : public XclExpRecord
465 +public:
466 + explicit XclExpTabBgColor( const XclTabViewData& rTabViewData );
468 + /* virtual void SaveXml( XclExpXmlStream& rStrm ); TODO Fix XML Saving Stream */
469 +private:
470 + /** Writes the contents of the SHEETEXT record. */
471 + virtual void WriteBody( XclExpStream& rStrm );
473 +private:
474 + const XclTabViewData& mrTabViewData; /// view settings data of current sheet.
477 // View settings ==============================================================
479 /** Contains all view settings records for a single sheet. */
480 @@ -156,6 +170,7 @@ private:
481 void WriteScl( XclExpStream& rStrm ) const;
482 void WritePane( XclExpStream& rStrm ) const;
483 void WriteSelection( XclExpStream& rStrm, sal_uInt8 nPane ) const;
484 + void WriteTabBgColor( XclExpStream& rStrm ) const;
486 private:
487 XclTabViewData maData; /// All view settings for a sheet.
488 diff --git sc/source/filter/inc/xiview.hxx sc/source/filter/inc/xiview.hxx
489 index f0b393e..a54c67b 100644
490 --- sc/source/filter/inc/xiview.hxx
491 +++ sc/source/filter/inc/xiview.hxx
492 @@ -83,7 +83,8 @@ public:
493 void ReadPane( XclImpStream& rStrm );
494 /** Reads a SELECTION record. */
495 void ReadSelection( XclImpStream& rStrm );
497 + /** Reads a SHEETEXT record (Tab Color). */
498 + void ReadTabBgColor( XclImpStream& rStrm, XclImpPalette& rPal );
499 /** Sets the view settings at the current sheet or the extended sheet options object. */
500 void Finalize();
502 diff --git sc/source/filter/inc/xlview.hxx sc/source/filter/inc/xlview.hxx
503 index 4a3798e..3070c28 100644
504 --- sc/source/filter/inc/xlview.hxx
505 +++ sc/source/filter/inc/xlview.hxx
506 @@ -89,6 +89,11 @@ const sal_uInt8 EXC_PANE_TOPLEFT = 3; /// Single, top, left, o
508 const sal_uInt16 EXC_ID_SCL = 0x00A0;
510 +// (0x0862) SHEETEXT ----------------------------------------------------------
512 +const sal_uInt16 EXC_ID_SHEETEXT = 0x0862; /// header id for sheetext
513 +const sal_uInt8 EXC_SHEETEXT_TABCOLOR = 0x7F; /// mask for tab color
514 +const sal_uInt16 EXC_COLOR_NOTABBG = 0x7F; /// Excel ignores Tab color when set to this value...
515 // Structs ====================================================================
517 /** Contains all view settings for the entire document. */
518 @@ -149,6 +154,9 @@ struct XclTabViewData
519 bool mbShowHeadings; /// true = Show column/row headings.
520 bool mbShowZeros; /// true = Show zero value zells.
521 bool mbShowOutline; /// true = Show outlines.
522 + Color maTabBgColor; /// Tab Color default = (COL_AUTO )
523 + bool IsDefaultTabBgColor() const { return maTabBgColor == Color(COL_AUTO) ? TRUE : FALSE; };
524 + sal_uInt32 mnTabBgColorId; /// pallette color id
526 explicit XclTabViewData();
527 ~XclTabViewData();
528 diff --git sc/source/ui/attrdlg/scdlgfact.cxx sc/source/ui/attrdlg/scdlgfact.cxx
529 index 7cf83db..c896365 100644
530 --- sc/source/ui/attrdlg/scdlgfact.cxx
531 +++ sc/source/ui/attrdlg/scdlgfact.cxx
532 @@ -65,6 +65,7 @@
533 #include "scendlg.hxx" //add for ScNewScenarioDlg
534 #include "shtabdlg.hxx" //add for ScShowTabDlg
535 #include "strindlg.hxx" //add for ScStringInputDlg
536 +#include "tabbgcolordlg.hxx"//add for ScTabBgColorDlg
537 #include "scuiimoptdlg.hxx" //add for ScImportOptionsDlg
538 #include "attrdlg.hxx" //add for ScAttrDlg
539 #include "hfedtdlg.hxx" //add for ScHFEditDlg
540 @@ -115,6 +116,7 @@ IMPL_ABSTDLG_BASE(AbstractScDPShowDetailDlg_Impl); //add for ScDPShowDetailDlg
541 IMPL_ABSTDLG_BASE(AbstractScNewScenarioDlg_Impl); //add for ScNewScenarioDlg
542 IMPL_ABSTDLG_BASE(AbstractScShowTabDlg_Impl); //add for ScShowTabDlg
543 IMPL_ABSTDLG_BASE(AbstractScStringInputDlg_Impl); //add for ScStringInputDlg
544 +IMPL_ABSTDLG_BASE(AbstractScTabBgColorDlg_Impl); //add for ScTabBgColorDlg
545 IMPL_ABSTDLG_BASE(AbstractScImportOptionsDlg_Impl); //add for ScImportOptionsDlg
546 IMPL_ABSTDLG_BASE(AbstractScTextImportOptionsDlg_Impl);
547 IMPL_ABSTDLG_BASE(AbstractTabDialog_Impl); //add for ScAttrDlg, ScHFEditDlg, ScStyleDlg, ScSubTotalDlg,ScCharDlg, ScParagraphDlg, ScValidationDlg, ScSortDlg
548 @@ -616,6 +618,14 @@ void AbstractScStringInputDlg_Impl::GetInputString( String& rString ) const //a
550 //add for AbstractScStringInputDlg_Impl end
552 +//add for AbstractScTabBgColorDlg_Impl begin
553 +void AbstractScTabBgColorDlg_Impl::GetSelectedColor( Color& rColor ) const //add for ScTabBgColorDlg
555 + pDlg->GetSelectedColor( rColor );
557 +//add for AbstractScTabBgColorDlg_Impl end
560 //add for AbstractScImportOptionsDlg_Impl begin
561 void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOptions ) const //add for ScImportOptionsDlg
563 @@ -1291,6 +1301,31 @@ AbstractScShowTabDlg * ScAbstractDialogFactory_Impl::CreateScShowTabDlg ( Window
565 //add for ScStringInputDlg end
567 +//add for ScTabBgColorDlg begin
568 +AbstractScTabBgColorDlg * ScAbstractDialogFactory_Impl::CreateScTabBgColorDlg (
569 + Window* pParent,
570 + const String& rTitle,
571 + const String& rTabBgColorNoColorText,
572 + const Color& rDefaultColor,
573 + ULONG nHelpId ,
574 + int nId )
576 +ScTabBgColorDlg * pDlg=NULL;
577 +switch ( nId )
579 + case RID_SCDLG_TAB_BG_COLOR :
580 + pDlg = new ScTabBgColorDlg( pParent, rTitle, rTabBgColorNoColorText, rDefaultColor, nHelpId );
581 + break;
582 + default:
583 + break;
586 +if ( pDlg )
587 + return new AbstractScTabBgColorDlg_Impl( pDlg );
588 +return 0;
590 +//add for ScTabBgColorDlg end
592 //add for ScImportOptionsDlg begin
593 AbstractScImportOptionsDlg * ScAbstractDialogFactory_Impl::CreateScImportOptionsDlg ( Window* pParent,
594 int nId,
595 diff --git sc/source/ui/attrdlg/scdlgfact.hxx sc/source/ui/attrdlg/scdlgfact.hxx
596 index 6fef61d..059cc8e 100644
597 --- sc/source/ui/attrdlg/scdlgfact.hxx
598 +++ sc/source/ui/attrdlg/scdlgfact.hxx
599 @@ -61,6 +61,7 @@ class ScDPShowDetailDlg;
600 class ScNewScenarioDlg;
601 class ScShowTabDlg;
602 class ScStringInputDlg;
603 +class ScTabBgColorDlg;
604 class ScImportOptionsDlg;
605 class SfxTabDialog;
606 class ScSortWarningDlg;
607 @@ -338,6 +339,12 @@ class AbstractScStringInputDlg_Impl : public AbstractScStringInputDlg //add fo
608 virtual void GetInputString( String& rString ) const;
611 +class AbstractScTabBgColorDlg_Impl : public AbstractScTabBgColorDlg //add for ScTabBgColorDlg
613 + DECL_ABSTDLG_BASE( AbstractScTabBgColorDlg_Impl, ScTabBgColorDlg )
614 + virtual void GetSelectedColor( Color& rColor ) const;
617 class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg //add for ScImportOptionsDlg
619 DECL_ABSTDLG_BASE( AbstractScImportOptionsDlg_Impl, ScImportOptionsDlg)
620 @@ -521,6 +528,14 @@ public:
621 const String& rDefault,
622 ULONG nHelpId ,
623 int nId );
625 + virtual AbstractScTabBgColorDlg * CreateScTabBgColorDlg ( Window* pParent, //add for ScStringInputDlg
626 + const String& rTitle, //Dialog Title
627 + const String& rTabBgColorNoColorText, //Label for no tab color
628 + const Color& rDefaultColor, //Currently selected Color
629 + ULONG nHelpId ,
630 + int nId );
632 virtual AbstractScImportOptionsDlg * CreateScImportOptionsDlg ( Window* pParent, //add for ScImportOptionsDlg
633 int nId,
634 BOOL bAscii = TRUE,
635 diff --git sc/source/ui/docshell/docfunc.cxx sc/source/ui/docshell/docfunc.cxx
636 index 9b8b4f7..0467a11 100644
637 --- sc/source/ui/docshell/docfunc.cxx
638 +++ sc/source/ui/docshell/docfunc.cxx
639 @@ -2855,6 +2855,104 @@ BOOL ScDocFunc::RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL
640 return bSuccess;
643 +BOOL ScDocFunc::SetTabBgColor( SCTAB nTab, const Color& rColor, BOOL bRecord, BOOL bApi )
646 + ScDocument* pDoc = rDocShell.GetDocument();
647 + if (bRecord && !pDoc->IsUndoEnabled())
648 + bRecord = FALSE;
649 + if ( !pDoc->IsDocEditable() || pDoc->IsTabProtected(nTab) )
651 + if (!bApi)
652 + rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Check to see what this string is...
653 + return FALSE;
656 + ScViewData* pViewData = rDocShell.GetViewData();
658 + Color aOldTabBgColor;
659 + aOldTabBgColor = pViewData->GetTabBgColor(nTab);
661 + BOOL bSuccess = FALSE;
662 + pViewData->SetTabBgColor(rColor, nTab);
663 + if ( pViewData->GetTabBgColor( nTab ) == rColor)
664 + bSuccess = TRUE;
665 + if (bSuccess)
667 + if (bRecord)
669 + rDocShell.GetUndoManager()->AddUndoAction(
670 + new ScUndoSetTabBgColor( &rDocShell, nTab, aOldTabBgColor, rColor));
672 + rDocShell.PostPaintExtras();
673 + ScDocShellModificator aModificator( rDocShell );
674 + aModificator.SetDocumentModified();
675 + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
677 + bSuccess = TRUE;
679 + return bSuccess;
682 +BOOL ScDocFunc::SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList, BOOL bRecord, BOOL bApi )
684 + ScDocument* pDoc = rDocShell.GetDocument();
685 + if (bRecord && !pDoc->IsUndoEnabled())
686 + bRecord = FALSE;
687 + if ( !pDoc->IsDocEditable() )
689 + if (!bApi)
690 + rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Get a better String Error...
691 + return FALSE;
694 + ScViewData* pViewData = rDocShell.GetViewData();
695 + USHORT nTab;
696 + Color aNewTabBgColor;
697 + ScUndoSetTabBgColorInfo* rUndoSetTabBgColorInfo;
698 + BOOL bSuccess = TRUE;
699 + USHORT nTabProtectCount = 0;
700 + for ( USHORT i=0; i < rUndoSetTabBgColorInfoList->Count(); i++ )
702 + rUndoSetTabBgColorInfo = rUndoSetTabBgColorInfoList->GetObject(i);
703 + nTab = rUndoSetTabBgColorInfo->nTabId;
704 + if ( !pDoc->IsTabProtected(nTab) )
706 + aNewTabBgColor = rUndoSetTabBgColorInfo->aNewTabBgColor;
707 + rUndoSetTabBgColorInfo->aOldTabBgColor = pViewData->GetTabBgColor(nTab);
708 + pViewData->SetTabBgColor(aNewTabBgColor, nTab);
709 + if ( pViewData->GetTabBgColor( nTab ) != aNewTabBgColor)
711 + bSuccess = FALSE;
712 + break;
715 + else
717 + nTabProtectCount++;
720 + if ( nTabProtectCount == rUndoSetTabBgColorInfoList->Count() )
722 + if (!bApi)
723 + rDocShell.ErrorMessage(STR_PROTECTIONERR); //TODO Get a better String Error...
724 + return FALSE;
726 + if (bSuccess)
728 + if (bRecord)
730 + rDocShell.GetUndoManager()->AddUndoAction(
731 + new ScUndoSetTabBgColor( &rDocShell, rUndoSetTabBgColorInfoList));
733 + rDocShell.PostPaintExtras();
734 + ScDocShellModificator aModificator( rDocShell );
735 + aModificator.SetDocumentModified();
736 + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
738 + return bSuccess;
741 //------------------------------------------------------------------------
743 //! SetWidthOrHeight - noch doppelt zu ViewFunc !!!!!!
744 diff --git sc/source/ui/inc/docfunc.hxx sc/source/ui/inc/docfunc.hxx
745 index b02cf98..49a242a 100644
746 --- sc/source/ui/inc/docfunc.hxx
747 +++ sc/source/ui/inc/docfunc.hxx
748 @@ -34,6 +34,7 @@
749 #include <tools/link.hxx>
750 #include "global.hxx"
751 #include "formula/grammar.hxx"
752 +#include "tabbgcolor.hxx"
754 class ScEditEngineDefaulter;
755 class SdrUndoAction;
756 @@ -120,6 +121,10 @@ public:
757 BOOL RenameTable( SCTAB nTab, const String& rName, BOOL bRecord, BOOL bApi );
758 BOOL DeleteTable( SCTAB nTab, BOOL bRecord, BOOL bApi );
760 + BOOL SetTabBgColor( SCTAB nTab, const Color& rColor, BOOL bRecord, BOOL bApi );
761 + BOOL SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList,
762 + BOOL bRecord, BOOL bApi );
764 BOOL SetTableVisible( SCTAB nTab, BOOL bVisible, BOOL bApi );
766 BOOL SetLayoutRTL( SCTAB nTab, BOOL bRTL, BOOL bApi );
767 diff --git sc/source/ui/inc/miscdlgs.hrc sc/source/ui/inc/miscdlgs.hrc
768 index 154d310..97cd0ca 100644
769 --- sc/source/ui/inc/miscdlgs.hrc
770 +++ sc/source/ui/inc/miscdlgs.hrc
771 @@ -184,3 +184,9 @@
772 #define BTN_GROUP_ROWS 3
773 #define STR_GROUP 1
774 #define STR_UNGROUP 2
776 +// Tab Bg Color
777 +#define TAB_BG_COLOR_CT_BORDER 1
778 +#define TAB_BG_COLOR_SET_BGDCOLOR 2
779 +#define TAB_BG_COLOR_GB_BGDCOLOR 3
781 diff --git sc/source/ui/inc/tabbgcolordlg.hxx sc/source/ui/inc/tabbgcolordlg.hxx
782 new file mode 100644
783 index 0000000..235a06e
784 --- /dev/null
785 +++ sc/source/ui/inc/tabbgcolordlg.hxx
786 @@ -0,0 +1,80 @@
787 +/*************************************************************************
789 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
790 + *
791 + * Copyright 2008 by Sun Microsystems, Inc.
793 + * OpenOffice.org - a multi-platform office productivity suite
795 + * $RCSfile: tabbgcolordlg.hxx,v $
796 + * $Revision: 1.0 $
798 + * This file is part of OpenOffice.org.
800 + * OpenOffice.org is free software: you can redistribute it and/or modify
801 + * it under the terms of the GNU Lesser General Public License version 3
802 + * only, as published by the Free Software Foundation.
804 + * OpenOffice.org is distributed in the hope that it will be useful,
805 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
806 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
807 + * GNU Lesser General Public License version 3 for more details
808 + * (a copy is included in the LICENSE file that accompanied this code).
810 + * You should have received a copy of the GNU Lesser General Public License
811 + * version 3 along with OpenOffice.org. If not, see
812 + * <http://www.openoffice.org/license.html>
813 + * for a copy of the LGPLv3 License.
815 + ************************************************************************/
817 +#ifndef SC_TABBGCOLORDLG_HXX
818 +#define SC_TABBGCOLORDLG_HXX
820 +#include <vcl/dialog.hxx>
821 +#include <vcl/fixed.hxx>
822 +#include <vcl/imagebtn.hxx>
823 +#include <svtools/valueset.hxx>
825 +//------------------------------------------------------------------------
827 +class ScTabBgColorDlg : public ModalDialog
829 +public:
830 + ScTabBgColorDlg( Window* pParent,
831 + const String& rTitle,
832 + const String& rTabBgColorNoColorText,
833 + const Color& rDefaultColor,
834 + ULONG nHelpId );
835 + ~ScTabBgColorDlg();
837 + void GetSelectedColor( Color& rColor ) const;
838 + //void SelectColor( const Color& rColor2 ) const;
839 +private:
840 + class ScTabBgColorValueSet : public ValueSet
843 + public:
844 + ScTabBgColorValueSet(Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg);
846 + virtual void KeyInput( const KeyEvent& rKEvt );
847 + private:
848 + ScTabBgColorDlg* aTabBgColorDlg;
849 + };
850 + Control aBorderWin;
851 + ScTabBgColorValueSet aTabBgColorSet;
852 + FixedLine aTabBgColorBox;
853 + OKButton aBtnOk;
854 + CancelButton aBtnCancel;
855 + HelpButton aBtnHelp;
856 + Color aTabBgColor;
857 + const String aTabBgColorNoColorText;
858 + ULONG aHelpId;
860 + void FillColorValueSets_Impl();
862 + DECL_LINK( TabBgColorDblClickHdl_Impl, ValueSet* );
863 + DECL_LINK( TabBgColorOKHdl_Impl, OKButton* pBtn );
866 +#endif // SC_TABBGCOLORDLG_HXX
867 diff --git sc/source/ui/inc/undotab.hxx sc/source/ui/inc/undotab.hxx
868 index 7f18fdb..a0e954b 100644
869 --- sc/source/ui/inc/undotab.hxx
870 +++ sc/source/ui/inc/undotab.hxx
871 @@ -35,6 +35,7 @@
872 #include "markdata.hxx"
873 #include "formula/grammar.hxx"
874 #include <tools/color.hxx>
875 +#include "tabbgcolor.hxx"
877 #ifndef _SVSTDARR_SHORTS
879 @@ -226,6 +227,37 @@ private:
880 void DoChange() const;
883 +class ScUndoSetTabBgColor: public ScSimpleUndo
885 +public:
886 + TYPEINFO();
887 + ScUndoSetTabBgColor(
888 + ScDocShell* pNewDocShell,
889 + SCTAB nT,
890 + const Color& aOTabBgColor,
891 + const Color& aNTabBgColor);
892 + ScUndoSetTabBgColor(
893 + ScDocShell* pNewDocShell,
894 + ScUndoSetTabBgColorInfoList* pUndoSetTabBgColorInfoList);
895 + virtual ~ScUndoSetTabBgColor();
897 + virtual void Undo();
898 + virtual void Redo();
899 + virtual void Repeat(SfxRepeatTarget& rTarget);
900 + virtual BOOL CanRepeat(SfxRepeatTarget& rTarget) const;
902 +virtual String GetComment() const;
904 +private:
905 + SCTAB nTab;
906 + Color aOldTabBgColor;
907 + Color aNewTabBgColor;
908 + ScUndoSetTabBgColorInfoList* aUndoSetTabBgColorInfoList;
909 + BOOL bIsMultipleUndo;
911 + void DoChange( SCTAB nTab, const Color& rTabBgColor ) const;
912 + void DoChange( BOOL bUndoType ) const;
915 class ScUndoMakeScenario: public ScSimpleUndo
917 diff --git sc/source/ui/inc/viewdata.hxx sc/source/ui/inc/viewdata.hxx
918 index 024eac3..72fa6e5 100644
919 --- sc/source/ui/inc/viewdata.hxx
920 +++ sc/source/ui/inc/viewdata.hxx
921 @@ -144,6 +144,9 @@ private:
923 BOOL bOldCurValid; // "virtuelle" Cursorpos. bei zusammengefassten
925 + Color aTabBgColor;
926 + BOOL IsDefaultTabBgColor() const {return aTabBgColor == Color( COL_AUTO ) ? TRUE : FALSE ;};
928 ScViewDataTable();
929 ~ScViewDataTable();
931 @@ -276,6 +279,10 @@ public:
932 void CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
933 void MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
935 + void SetTabBgColor( Color rTabBgColor, SCTAB nTab );
936 + BOOL IsDefaultTabBgColor( SCTAB nTab ) const;
937 + Color GetTabBgColor( SCTAB nTab ) const;
939 SCTAB GetRefTabNo() const { return nRefTabNo; }
940 void SetRefTabNo( SCTAB nNewTab ) { nRefTabNo = nNewTab; }
942 diff --git sc/source/ui/inc/viewfunc.hxx sc/source/ui/inc/viewfunc.hxx
943 index 3d703da..8e41aea 100644
944 --- sc/source/ui/inc/viewfunc.hxx
945 +++ sc/source/ui/inc/viewfunc.hxx
946 @@ -32,6 +32,8 @@
948 #include "tabview.hxx"
950 +#include "tabbgcolor.hxx"
952 #ifndef _SVSTDARR_SHORTS
953 #define _SVSTDARR_SHORTS
954 #include <svtools/svstdarr.hxx>
955 @@ -276,6 +278,9 @@ public:
956 SCTAB nCount, const SCTAB* pSrcTabs,
957 BOOL bLink,SCTAB nTab);
959 + BOOL SetTabBgColor( const Color& rColor, SCTAB nTabNr );
960 + BOOL SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList );
962 void InsertTableLink( const String& rFile,
963 const String& rFilter, const String& rOptions,
964 const String& rTabName );
965 diff --git sc/source/ui/miscdlgs/makefile.mk sc/source/ui/miscdlgs/makefile.mk
966 index 66e1f33..a1ad212 100644
967 --- sc/source/ui/miscdlgs/makefile.mk
968 +++ sc/source/ui/miscdlgs/makefile.mk
969 @@ -50,6 +50,7 @@ SLOFILES = \
970 $(SLO)$/delcodlg.obj \
971 $(SLO)$/inscodlg.obj \
972 $(SLO)$/strindlg.obj \
973 + $(SLO)$/tabbgcolordlg.obj \
974 $(SLO)$/mtrindlg.obj \
975 $(SLO)$/lbseldlg.obj \
976 $(SLO)$/filldlg.obj \
977 diff --git sc/source/ui/miscdlgs/tabbgcolordlg.cxx sc/source/ui/miscdlgs/tabbgcolordlg.cxx
978 new file mode 100644
979 index 0000000..8e9987e
980 --- /dev/null
981 +++ sc/source/ui/miscdlgs/tabbgcolordlg.cxx
982 @@ -0,0 +1,197 @@
983 +/*************************************************************************
985 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
986 + *
987 + * Copyright 2008 by Sun Microsystems, Inc.
989 + * OpenOffice.org - a multi-platform office productivity suite
991 + * $RCSfile: tabbgcolordlg.cxx,v $
992 + * $Revision: 1.0 $
994 + * This file is part of OpenOffice.org.
996 + * OpenOffice.org is free software: you can redistribute it and/or modify
997 + * it under the terms of the GNU Lesser General Public License version 3
998 + * only, as published by the Free Software Foundation.
1000 + * OpenOffice.org is distributed in the hope that it will be useful,
1001 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1002 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1003 + * GNU Lesser General Public License version 3 for more details
1004 + * (a copy is included in the LICENSE file that accompanied this code).
1006 + * You should have received a copy of the GNU Lesser General Public License
1007 + * version 3 along with OpenOffice.org. If not, see
1008 + * <http://www.openoffice.org/license.html>
1009 + * for a copy of the LGPLv3 License.
1011 + ************************************************************************/
1013 +// MARKER(update_precomp.py): autogen include statement, do not remove
1014 +#include "precompiled_sc.hxx"
1016 +#undef SC_DLLIMPLEMENTATION
1018 +//------------------------------------------------------------------
1020 +#include <tools/debug.hxx>
1021 +#include <tools/color.hxx>
1022 +#include <sfx2/objsh.hxx>
1023 +#include <svx/xtable.hxx>
1024 +#include <svx/drawitem.hxx>
1025 +#include <svtools/pathoptions.hxx>
1026 +#include <tools/resid.hxx>
1027 +#include "tabbgcolordlg.hxx"
1028 +#include "scresid.hxx"
1029 +#include "miscdlgs.hrc"
1030 +#include <svx/svxitems.hrc>
1032 +//==================================================================
1034 +#define HDL(hdl) LINK(this,ScTabBgColorDlg,hdl)
1036 +__EXPORT ScTabBgColorDlg::ScTabBgColorDlg( Window* pParent,
1037 + const String& rTitle,
1038 + const String& rTabBgColorNoColorText,
1039 + const Color& rDefaultColor,
1040 + ULONG nHelpId ) :
1041 + ModalDialog ( pParent, ScResId( RID_SCDLG_TAB_BG_COLOR ) ),
1042 + aBorderWin ( this, ScResId( TAB_BG_COLOR_CT_BORDER ) ),
1043 + aTabBgColorSet ( &aBorderWin, ScResId( TAB_BG_COLOR_SET_BGDCOLOR ), this ),
1044 + aTabBgColorBox ( this, ScResId( TAB_BG_COLOR_GB_BGDCOLOR ) ),
1045 + aBtnOk ( this, ScResId( BTN_OK ) ),
1046 + aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
1047 + aBtnHelp ( this, ScResId( BTN_HELP ) ),
1048 + aTabBgColorNoColorText ( rTabBgColorNoColorText ),
1049 + aTabBgColor ( rDefaultColor ),
1050 + aHelpId ( nHelpId )
1053 + SetHelpId( nHelpId );
1054 + this->SetText( rTitle );
1055 + this->SetStyle(GetStyle() | WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL | WB_SYSTEMWINDOW | WB_STANDALONE | WB_HIDE);
1056 + //TODO: Assign Help ID's to all controls...
1057 + aTabBgColorBox.SetText(rTitle);
1058 + FillColorValueSets_Impl();
1059 + aTabBgColorSet.SetDoubleClickHdl( HDL(TabBgColorDblClickHdl_Impl) );
1060 + aBtnOk.SetClickHdl( HDL(TabBgColorOKHdl_Impl) );
1061 + FreeResource();
1064 +//------------------------------------------------------------------------
1066 +void ScTabBgColorDlg::GetSelectedColor( Color& rColor ) const
1068 + rColor = this->aTabBgColor;
1071 +__EXPORT ScTabBgColorDlg::~ScTabBgColorDlg()
1075 +void ScTabBgColorDlg::FillColorValueSets_Impl()
1077 + SfxObjectShell* pDocSh = SfxObjectShell::Current();
1078 + const SfxPoolItem* pItem = NULL;
1079 + XColorTable* pColorTable = NULL;
1080 + const Size aSize15x15 = Size( 15, 15 );
1081 + const Size aSize10x10 = Size( 10, 10 );
1082 + const Size aSize5x5 = Size( 5, 5 );
1083 + USHORT nSelectedItem = 0;
1084 + FASTBOOL bOwn = FALSE;
1086 + DBG_ASSERT( pDocSh, "DocShell not found!" );
1088 + if ( pDocSh && ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) ) )
1089 + pColorTable = ( (SvxColorTableItem*)pItem )->GetColorTable();
1090 + if ( !pColorTable )
1092 + bOwn = TRUE;
1093 + pColorTable = new XColorTable( SvtPathOptions().GetPalettePath() );
1095 + if ( pColorTable )
1097 + short i = 0;
1098 + long nCount = pColorTable->Count();
1099 + XColorEntry* pEntry = NULL;
1100 + Color aColWhite( COL_WHITE );
1101 + String aStrWhite( ScResId( RID_SVXITEMS_COLOR_WHITE ) );
1102 + WinBits nBits = ( aTabBgColorSet.GetStyle() | WB_NAMEFIELD | WB_ITEMBORDER | WB_NONEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT | WB_NOPOINTERFOCUS);
1103 + aTabBgColorSet.SetText( aTabBgColorNoColorText );
1104 + aTabBgColorSet.SetStyle( nBits );
1105 + for ( i = 0; i < nCount; i++ )
1107 + pEntry = pColorTable->GetColor(i);
1108 + aTabBgColorSet.InsertItem( i + 1, pEntry->GetColor(), pEntry->GetName() );
1109 + if (pEntry->GetColor() == aTabBgColor)
1110 + nSelectedItem = (i + 1);
1113 + while ( i < 80 )
1115 + aTabBgColorSet.InsertItem( i + 1, aColWhite, aStrWhite );
1116 + i++;
1119 + if ( nCount > 80 )
1121 + aTabBgColorSet.SetStyle( nBits | WB_VSCROLL );
1124 + aTabBgColorSet.SetColCount( 10 );
1125 + aTabBgColorSet.SetLineCount( 10 );
1126 + aTabBgColorSet.CalcWindowSizePixel( aSize15x15 );
1127 + aTabBgColorSet.Format();
1128 + aTabBgColorSet.SelectItem(nSelectedItem);
1129 + aTabBgColorSet.Resize();
1130 + if ( bOwn )
1131 + delete pColorTable;
1134 +IMPL_LINK( ScTabBgColorDlg, TabBgColorDblClickHdl_Impl, ValueSet*, EMPTYARG )
1136 + Handler, called when color selection is changed
1139 + USHORT nItemId = aTabBgColorSet.GetSelectItemId();
1140 + Color aColor = nItemId ? ( aTabBgColorSet.GetItemColor( nItemId ) ) : Color( COL_AUTO );
1141 + aTabBgColor = aColor;
1142 + EndDialog( TRUE );
1143 + return 0;
1146 +IMPL_LINK( ScTabBgColorDlg, TabBgColorOKHdl_Impl, OKButton*, EMPTYARG )
1149 +// Handler, called when the OK button is pushed
1151 + USHORT nItemId = aTabBgColorSet.GetSelectItemId();
1152 + Color aColor = nItemId ? ( aTabBgColorSet.GetItemColor( nItemId ) ) : Color( COL_AUTO );
1153 + aTabBgColor = aColor;
1154 + EndDialog( TRUE );
1155 + return 0;
1158 +__EXPORT ScTabBgColorDlg::ScTabBgColorValueSet::ScTabBgColorValueSet( Control* pParent, const ResId& rResId, ScTabBgColorDlg* pTabBgColorDlg ) :
1159 + ValueSet(pParent, rResId)
1161 + aTabBgColorDlg = pTabBgColorDlg;
1164 +void ScTabBgColorDlg::ScTabBgColorValueSet::KeyInput( const KeyEvent& rKEvt )
1166 + switch ( rKEvt.GetKeyCode().GetCode() )
1168 + case KEY_SPACE:
1169 + case KEY_RETURN:
1171 + USHORT nItemId = GetSelectItemId();
1172 + const Color& aColor = nItemId ? ( GetItemColor( nItemId ) ) : Color( COL_AUTO );
1173 + aTabBgColorDlg->aTabBgColor = aColor;
1174 + aTabBgColorDlg->EndDialog(TRUE);
1176 + break;
1178 + ValueSet::KeyInput(rKEvt);
1180 diff --git sc/source/ui/src/globstr.src sc/source/ui/src/globstr.src
1181 index c5b8cfd..2ae00ca 100644
1182 --- sc/source/ui/src/globstr.src
1183 +++ sc/source/ui/src/globstr.src
1184 @@ -1130,6 +1130,14 @@ Resource RID_GLOBSTR
1186 Text [ en-US ] = "Rename Sheet" ;
1188 + String STR_UNDO_SET_TAB_BG_COLOR
1190 + Text [ en-US ] = "Color Tab" ;
1191 + };
1192 + String STR_UNDO_SET_MULTI_TAB_BG_COLOR
1194 + Text [ en-US ] = "Color Tabs" ;
1195 + };
1196 String STR_UNDO_MOVE_TAB
1198 Text [ en-US ] = "Move Sheets" ;
1199 diff --git sc/source/ui/src/miscdlgs.src sc/source/ui/src/miscdlgs.src
1200 index da8cb03..ef2a8ac 100644
1201 --- sc/source/ui/src/miscdlgs.src
1202 +++ sc/source/ui/src/miscdlgs.src
1203 @@ -546,6 +546,96 @@ ModalDialog RID_SCDLG_STRINPUT
1204 Size = MAP_APPFONT ( 110 , 8 ) ;
1207 +ModalDialog RID_SCDLG_TAB_BG_COLOR
1209 + OutputSize = TRUE ;
1210 + SVLook = TRUE ;
1211 + Size = MAP_APPFONT ( 118 , 167 ) ;
1212 + Moveable = TRUE ;
1213 + Closeable = TRUE ;
1214 + Control TAB_BG_COLOR_CT_BORDER
1216 + Border = TRUE ;
1217 + Pos = MAP_APPFONT ( 1 , 1 ) ; //12, 32
1218 + Size = MAP_APPFONT ( 116+2 , 145+2 ) ;
1219 + DialogControl = TRUE;
1220 + };
1221 + Control TAB_BG_COLOR_SET_BGDCOLOR
1223 + // * HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ;
1224 + Hide = FALSE ;
1225 + Pos = MAP_APPFONT ( 0 , 0 ) ;
1226 + Size = MAP_APPFONT ( 116 , 145 ) ;
1227 + TabStop = TRUE ;
1228 + };
1229 + CancelButton BTN_CANCEL
1231 + Pos = MAP_APPFONT ( 82 , 151 ) ;
1232 + Size = MAP_APPFONT ( 35 , 14 ) ;
1233 + TabStop = TRUE ;
1234 + DefButton = FALSE ;
1235 + };
1236 + OKButton BTN_OK
1238 + Pos = MAP_APPFONT ( 45 , 151 ) ;
1239 + Size = MAP_APPFONT ( 35 , 14 ) ;
1240 + TabStop = TRUE ;
1241 + DefButton = TRUE ;
1242 + };
1243 + HelpButton BTN_HELP
1245 + Pos = MAP_APPFONT ( 2 , 151 ) ;
1246 + Size = MAP_APPFONT ( 35 , 14 ) ;
1247 + TabStop = TRUE ;
1248 + DefButton = FALSE ;
1249 + };
1252 +ModalDialog RID_SCDLG_TAB_BG_COLOR
1254 + OutputSize = TRUE ;
1255 + SVLook = TRUE ;
1256 + Size = MAP_APPFONT ( 180 , 150 ) ;
1257 + Moveable = TRUE ;
1258 + Closeable = TRUE ;
1259 + Control TAB_BG_COLOR_CT_BORDER
1261 + Border = TRUE ;
1262 + Pos = MAP_APPFONT ( 1 , 1 ) ; //12, 32
1263 + Size = MAP_APPFONT ( 116+2 , 145+2 ) ;
1264 + DialogControl = TRUE;
1265 + };
1266 + Control TAB_BG_COLOR_SET_BGDCOLOR
1268 + // * HelpId = HID_BACKGROUND_CTL_BGDCOLORSET ;
1269 + Hide = FALSE ;
1270 + Pos = MAP_APPFONT ( 0 , 0 ) ;
1271 + Size = MAP_APPFONT ( 116 , 145 ) ;
1272 + TabStop = TRUE ;
1273 + };
1274 + OKButton BTN_OK
1276 + Pos = MAP_APPFONT ( 125 , 50 ) ;
1277 + Size = MAP_APPFONT ( 50 , 14 ) ;
1278 + TabStop = TRUE ;
1279 + DefButton = TRUE ;
1280 + };
1281 + CancelButton BTN_CANCEL
1283 + Pos = MAP_APPFONT ( 125 , 67 ) ;
1284 + Size = MAP_APPFONT ( 50 , 14 ) ;
1285 + TabStop = TRUE ;
1286 + DefButton = FALSE ;
1287 + };
1288 + HelpButton BTN_HELP
1290 + Pos = MAP_APPFONT ( 125 , 84 ) ;
1291 + Size = MAP_APPFONT ( 50 , 14 ) ;
1292 + TabStop = TRUE ;
1293 + DefButton = FALSE ;
1294 + };
1298 ModalDialog RID_SCDLG_MTRINPUT
1300 diff --git sc/source/ui/src/popup.src sc/source/ui/src/popup.src
1301 index 05d10b9..5f19299 100644
1302 --- sc/source/ui/src/popup.src
1303 +++ sc/source/ui/src/popup.src
1304 @@ -193,6 +193,15 @@ Menu RID_POPUP_TAB
1305 HelpId = FID_TAB_RTL ;
1306 Text [ en-US ] = "S~heet Right-To-Left" ;
1308 + //------------------------------
1309 + MenuItem { Separator = TRUE ; };
1310 + //------------------------------
1311 + MenuItem
1313 + Identifier = FID_TAB_MENU_SET_TAB_BG_COLOR ;
1314 + HelpId = FID_TAB_MENU_SET_TAB_BG_COLOR ;
1315 + Text [ en-US ] = "~Tab Color..." ;
1316 + };
1320 diff --git sc/source/ui/src/scstring.src sc/source/ui/src/scstring.src
1321 index c50a304..6fb17a3 100644
1322 --- sc/source/ui/src/scstring.src
1323 +++ sc/source/ui/src/scstring.src
1324 @@ -283,6 +283,14 @@ String SCSTR_RENAMETAB
1326 Text [ en-US ] = "Rename Sheet" ;
1328 +String SCSTR_SET_TAB_BG_COLOR
1330 + Text [ en-US ] = "Tab Color" ;
1332 +String SCSTR_NO_TAB_BG_COLOR
1334 + Text [ en-US ] = "Default" ;
1336 String SCSTR_RENAMEOBJECT
1338 Text [ en-US ] = "Name Object";
1339 diff --git sc/source/ui/undo/undotab.cxx sc/source/ui/undo/undotab.cxx
1340 index 5650376..0e56405 100644
1341 --- sc/source/ui/undo/undotab.cxx
1342 +++ sc/source/ui/undo/undotab.cxx
1343 @@ -70,6 +70,9 @@
1344 #include "drwlayer.hxx"
1345 #include "scresid.hxx"
1347 +// for set tab bg color
1348 +#include "viewdata.hxx"
1350 extern BOOL bDrawIsInUndo; //! irgendwo als Member !!!
1352 using namespace com::sun::star;
1353 @@ -93,6 +96,7 @@ TYPEINIT1(ScUndoScenarioFlags, SfxUndoAction);
1354 TYPEINIT1(ScUndoRenameObject, SfxUndoAction);
1355 TYPEINIT1(ScUndoLayoutRTL, SfxUndoAction);
1356 //UNUSED2009-05 TYPEINIT1(ScUndoSetGrammar, SfxUndoAction);
1357 +TYPEINIT1(ScUndoSetTabBgColor, SfxUndoAction);
1360 // -----------------------------------------------------------------------
1361 @@ -779,6 +783,113 @@ BOOL ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1362 return FALSE;
1365 +//---------------------------------------------------------------------------------
1367 +// Tab Bg Color
1370 +ScUndoSetTabBgColor::ScUndoSetTabBgColor( ScDocShell* pNewDocShell,
1371 + SCTAB nT,
1372 + const Color& aOTabBgColor,
1373 + const Color& aNTabBgColor) :
1374 + ScSimpleUndo( pNewDocShell ),
1375 + nTab ( nT ),
1376 + bIsMultipleUndo ( FALSE ),
1377 + aUndoSetTabBgColorInfoList ( NULL )
1379 + aOldTabBgColor = aOTabBgColor;
1380 + aNewTabBgColor = aNTabBgColor;
1383 +ScUndoSetTabBgColor::ScUndoSetTabBgColor( ScDocShell* pNewDocShell,
1384 + ScUndoSetTabBgColorInfoList* pUndoSetTabBgColorInfoList) :
1385 + ScSimpleUndo( pNewDocShell ),
1386 + bIsMultipleUndo ( TRUE )
1388 + aUndoSetTabBgColorInfoList = pUndoSetTabBgColorInfoList;
1391 +__EXPORT ScUndoSetTabBgColor::~ScUndoSetTabBgColor()
1395 +String __EXPORT ScUndoSetTabBgColor::GetComment() const
1397 + if (bIsMultipleUndo && aUndoSetTabBgColorInfoList && aUndoSetTabBgColorInfoList->Count() > 1)
1398 + return ScGlobal::GetRscString( STR_UNDO_SET_MULTI_TAB_BG_COLOR );
1399 + return ScGlobal::GetRscString( STR_UNDO_SET_TAB_BG_COLOR );
1402 +void ScUndoSetTabBgColor::DoChange( SCTAB nTabP, const Color& rTabBgColor ) const
1404 + if (bIsMultipleUndo)
1405 + return;
1406 + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1407 + if (pViewShell)
1409 + ScViewData* pViewData = pViewShell->GetViewData();
1410 + if (pViewData)
1412 + pViewData->SetTabBgColor( rTabBgColor, nTabP );
1413 + pDocShell->PostPaintExtras();
1414 + pDocShell->PostDataChanged();
1415 + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
1416 + pViewShell->UpdateInputHandler();
1421 +void ScUndoSetTabBgColor::DoChange(BOOL bUndoType) const
1423 + if (!bIsMultipleUndo)
1424 + return;
1425 + ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
1426 + if (pViewShell)
1428 + ScViewData* pViewData = pViewShell->GetViewData();
1429 + if (pViewData)
1431 + ScUndoSetTabBgColorInfo* aUndoSetTabBgColorInfo=NULL;
1432 + for (USHORT i=0; i < aUndoSetTabBgColorInfoList->Count(); i++)
1434 + aUndoSetTabBgColorInfo = aUndoSetTabBgColorInfoList->GetObject(i);
1435 + pViewData->SetTabBgColor(
1436 + bUndoType ? aUndoSetTabBgColorInfo->aOldTabBgColor : aUndoSetTabBgColorInfo->aNewTabBgColor,
1437 + aUndoSetTabBgColorInfo->nTabId);
1439 + pDocShell->PostPaintExtras();
1440 + pDocShell->PostDataChanged();
1441 + SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
1442 + pViewShell->UpdateInputHandler();
1447 +void __EXPORT ScUndoSetTabBgColor::Undo()
1449 + if ( bIsMultipleUndo )
1450 + DoChange(TRUE);
1451 + else
1452 + DoChange(nTab, aOldTabBgColor);
1455 +void __EXPORT ScUndoSetTabBgColor::Redo()
1457 + if ( bIsMultipleUndo )
1458 + DoChange(FALSE);
1459 + else
1460 + DoChange(nTab, aNewTabBgColor);
1463 +void __EXPORT ScUndoSetTabBgColor::Repeat(SfxRepeatTarget& /* rTarget */)
1465 + // No Repeat
1468 +BOOL __EXPORT ScUndoSetTabBgColor::CanRepeat(SfxRepeatTarget& /* rTarget */) const
1470 + return FALSE;
1473 // -----------------------------------------------------------------------
1475 diff --git sc/source/ui/view/scextopt.cxx sc/source/ui/view/scextopt.cxx
1476 index 586f934..fd28d95 100644
1477 --- sc/source/ui/view/scextopt.cxx
1478 +++ sc/source/ui/view/scextopt.cxx
1479 @@ -61,7 +61,8 @@ ScExtTabSettings::ScExtTabSettings() :
1480 mnPageZoom( 0 ),
1481 mbSelected( false ),
1482 mbFrozenPanes( false ),
1483 - mbPageMode( false )
1484 + mbPageMode( false ),
1485 + maTabBgColor( COL_AUTO)
1489 diff --git sc/source/ui/view/tabcont.cxx sc/source/ui/view/tabcont.cxx
1490 index 1040c10..ec447b1 100644
1491 --- sc/source/ui/view/tabcont.cxx
1492 +++ sc/source/ui/view/tabcont.cxx
1493 @@ -69,6 +69,7 @@ ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
1494 ScDocument* pDoc = pViewData->GetDocument();
1496 String aString;
1497 + Color aTabBgColor;
1498 SCTAB nCount = pDoc->GetTableCount();
1499 for (SCTAB i=0; i<nCount; i++)
1501 @@ -80,6 +81,12 @@ ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
1502 InsertPage( static_cast<sal_uInt16>(i)+1, aString, TPB_SPECIAL );
1503 else
1504 InsertPage( static_cast<sal_uInt16>(i)+1, aString );
1505 + if ( !pViewData->IsDefaultTabBgColor(i) )
1507 + aTabBgColor = pViewData->GetTabBgColor(i);
1508 + /*SetTabBgColor(static_cast<sal_uInt16>(i)+1, aTabBgColor, pViewData->IsDefaultTabBgColor(i) );*/
1509 + SetTabBgColor( static_cast<sal_uInt16>(i)+1, aTabBgColor );
1514 @@ -265,6 +272,7 @@ void ScTabControl::Select()
1515 rBind.Invalidate( FID_DELETE_TABLE );
1516 rBind.Invalidate( FID_TABLE_SHOW );
1517 rBind.Invalidate( FID_TABLE_HIDE );
1518 + rBind.Invalidate( FID_TAB_SET_TAB_BG_COLOR );
1520 // SetReference nur wenn der Konsolidieren-Dialog offen ist
1521 // (fuer Referenzen ueber mehrere Tabellen)
1522 @@ -291,16 +299,22 @@ void ScTabControl::UpdateStatus()
1523 SCTAB i;
1524 String aString;
1525 SCTAB nMaxCnt = Max( nCount, static_cast<SCTAB>(GetMaxId()) );
1526 + Color aTabBgColor;
1528 BOOL bModified = FALSE; // Tabellen-Namen
1529 for (i=0; i<nMaxCnt && !bModified; i++)
1531 if (pDoc->IsVisible(i))
1533 pDoc->GetName(i,aString);
1534 + aTabBgColor = pViewData->GetTabBgColor(i);
1536 else
1538 aString.Erase();
1541 - if (GetPageText(static_cast<sal_uInt16>(i)+1) != aString)
1542 + if ( (GetPageText(static_cast<sal_uInt16>(i)+1) != aString) || (GetTabBgColor(static_cast<sal_uInt16>(i)+1) != aTabBgColor) )
1543 bModified = TRUE;
1546 @@ -317,6 +331,11 @@ void ScTabControl::UpdateStatus()
1547 InsertPage( static_cast<sal_uInt16>(i)+1, aString, TPB_SPECIAL );
1548 else
1549 InsertPage( static_cast<sal_uInt16>(i)+1, aString );
1550 + if ( !pViewData->IsDefaultTabBgColor(i) )
1552 + aTabBgColor = pViewData->GetTabBgColor(i);
1553 + SetTabBgColor( static_cast<sal_uInt16>(i)+1, aTabBgColor );
1558 diff --git sc/source/ui/view/tabvwshf.cxx sc/source/ui/view/tabvwshf.cxx
1559 index ee49744..c65b62a 100644
1560 --- sc/source/ui/view/tabvwshf.cxx
1561 +++ sc/source/ui/view/tabvwshf.cxx
1562 @@ -58,6 +58,10 @@
1564 #include "scabstdlg.hxx" //CHINA001
1566 +#include "tabbgcolor.hxx" //DBW
1567 +#include "tabbgcolordlg.hxx" //DBW
1568 +#include <svx/colritem.hxx> //DBW
1570 #define IS_AVAILABLE(WhichId,ppItem) \
1571 (pReqArgs->GetItemState((WhichId), TRUE, ppItem ) == SFX_ITEM_SET)
1573 @@ -686,6 +690,120 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq )
1575 break;
1577 + case FID_TAB_SET_TAB_BG_COLOR:
1578 + case FID_TAB_MENU_SET_TAB_BG_COLOR:
1580 + if ( nSlot == FID_TAB_MENU_SET_TAB_BG_COLOR )
1581 + nSlot = FID_TAB_SET_TAB_BG_COLOR;
1583 + SCTAB nTabNr = pViewData->GetTabNo();
1584 + ScMarkData& rMark = pViewData->GetMarkData();
1585 + SCTAB nTabSelCount = rMark.GetSelectCount();
1587 + ScUndoSetTabBgColorInfo* aTabBgColorUndoInfo=NULL;
1588 + ScUndoSetTabBgColorInfoList* aTabBgColorUndoInfoList =NULL;
1590 + if ( !pDoc->IsDocEditable() )
1591 + break;
1593 + if ( pDoc->IsTabProtected( nTabNr ) ) // ||nTabSelCount > 1
1594 + break;
1596 + if( pReqArgs != NULL )
1598 + BOOL bDone = FALSE;
1599 + const SfxPoolItem* pItem;
1600 + Color aColor;
1601 + if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
1602 + nTabNr = ((const SfxUInt16Item*)pItem)->GetValue();
1604 + if( IS_AVAILABLE( nSlot, &pItem ) )
1605 + aColor = ((const SvxColorItem*)pItem)->GetValue();
1607 + if ( nTabSelCount > 1 )
1609 + aTabBgColorUndoInfoList = new ScUndoSetTabBgColorInfoList();
1610 + for (SCTAB nTab=0; nTab<nTabCount; nTab++)
1612 + if ( rMark.GetTableSelect(nTab) && !pDoc->IsTabProtected(nTab) )
1614 + aTabBgColorUndoInfo = new ScUndoSetTabBgColorInfo();
1615 + aTabBgColorUndoInfo->nTabId = nTab;
1616 + aTabBgColorUndoInfo->aNewTabBgColor = aColor;
1617 + aTabBgColorUndoInfoList->Insert(aTabBgColorUndoInfo);
1620 + bDone = SetTabBgColor( aTabBgColorUndoInfoList );
1622 + else
1624 + bDone = SetTabBgColor( aColor, nCurrentTab ); //ScViewFunc.SetTabBgColor
1626 + if( bDone )
1628 + rReq.Done( *pReqArgs );
1631 + else
1633 + USHORT nRet = RET_OK; /// temp
1634 + BOOL bDone = FALSE; /// temp
1635 + Color aTabBgColor;
1636 + Color aNewTabBgColor;
1638 + aTabBgColor = pViewData->GetTabBgColor( nCurrentTab );
1639 + ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
1640 + DBG_ASSERT(pFact, "ScAbstractFactory create fail!");
1641 + AbstractScTabBgColorDlg* pDlg = pFact->CreateScTabBgColorDlg(
1642 + GetDialogParent(),
1643 + String(ScResId(SCSTR_SET_TAB_BG_COLOR)),
1644 + String(ScResId(SCSTR_NO_TAB_BG_COLOR)),
1645 + aTabBgColor,
1646 + nSlot,RID_SCDLG_TAB_BG_COLOR);
1647 + while ( !bDone && nRet == RET_OK )
1649 + nRet = pDlg->Execute();
1650 + if( nRet == RET_OK )
1652 + Color aSelectedColor;
1653 + pDlg->GetSelectedColor(aSelectedColor);
1654 + aTabBgColorUndoInfoList = new ScUndoSetTabBgColorInfoList();
1655 + if ( nTabSelCount > 1 )
1657 + for (SCTAB nTab=0; nTab<nTabCount; nTab++)
1659 + if ( rMark.GetTableSelect(nTab) && !pDoc->IsTabProtected(nTab) )
1661 + aTabBgColorUndoInfo = new ScUndoSetTabBgColorInfo();
1662 + aTabBgColorUndoInfo->nTabId = nTab;
1663 + aTabBgColorUndoInfo->aNewTabBgColor = aSelectedColor;
1664 + aTabBgColorUndoInfoList->Insert(aTabBgColorUndoInfo);
1667 + bDone = SetTabBgColor( aTabBgColorUndoInfoList );
1669 + else
1671 + bDone = SetTabBgColor( aSelectedColor, nCurrentTab ); //ScViewFunc.SetTabBgColor
1673 + if ( bDone )
1675 + rReq.AppendItem( SvxColorItem( aTabBgColor, nSlot ) );
1676 + rReq.Done();
1678 + else
1680 + if( rReq.IsAPI() )
1682 + StarBASIC::Error( SbERR_SETPROP_FAILED );
1687 + delete( pDlg );
1690 + break;
1691 default:
1692 DBG_ERROR("Unbekannte Message bei ViewShell");
1693 break;
1694 @@ -804,6 +922,23 @@ void ScTabViewShell::GetStateTable( SfxItemSet& rSet )
1695 rSet.Put( SfxBoolItem( nWhich, pDoc->IsLayoutRTL( nTab ) ) );
1697 break;
1699 + case FID_TAB_MENU_SET_TAB_BG_COLOR:
1701 + if ( !pDoc->IsDocEditable()
1702 + || ( pDocShell && pDocShell->IsDocShared() )
1703 + || pDoc->IsTabProtected(nTab) )
1704 + rSet.DisableItem( nWhich );
1706 + break;
1708 + case FID_TAB_SET_TAB_BG_COLOR:
1710 + Color aColor;
1711 + aColor = pViewData->GetTabBgColor( nTab );
1712 + rSet.Put( SvxColorItem( aColor, nWhich ) );
1714 + break;
1716 nWhich = aIter.NextWhich();
1718 diff --git sc/source/ui/view/viewdata.cxx sc/source/ui/view/viewdata.cxx
1719 index fbb1306..d10a48d 100644
1720 --- sc/source/ui/view/viewdata.cxx
1721 +++ sc/source/ui/view/viewdata.cxx
1722 @@ -104,7 +104,8 @@ ScViewDataTable::ScViewDataTable() :
1723 nFixPosY( 0 ),
1724 nCurX( 0 ),
1725 nCurY( 0 ),
1726 - bOldCurValid( FALSE )
1727 + bOldCurValid( FALSE ),
1728 + aTabBgColor( Color(COL_AUTO) )
1730 nPosX[0]=nPosX[1]=0;
1731 nPosY[0]=nPosY[1]=0;
1732 @@ -164,6 +165,11 @@ void ScViewDataTable::WriteUserDataSequence(uno::Sequence <beans::PropertyValue>
1733 pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_PAGEVIEWZOOMVALUE));
1734 pSettings[SC_TABLE_PAGE_VIEW_ZOOM_VALUE].Value <<= nPageZoomValue;
1736 + if ( !IsDefaultTabBgColor() )
1738 + pSettings[SC_TABLE_TAB_BG_COLOR].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_TABCOLOR));
1739 + pSettings[SC_TABLE_TAB_BG_COLOR].Value <<= static_cast<sal_Int32>(aTabBgColor.GetColor());
1741 // pSettings[SC_TABLE_SELECTED].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_TABLESELECTED));
1742 // pSettings[SC_TABLE_SELECTED].Value <<= bool(rViewData.GetMarkData().GetTableSelect( nTab ));
1744 @@ -276,6 +282,13 @@ void ScViewDataTable::ReadUserDataSequence(const uno::Sequence <beans::PropertyV
1745 aSettings[i].Value >>= bSelected;
1746 rViewData.GetMarkData().SelectTable( nTab, bSelected );
1748 + else if (sName.compareToAscii(SC_UNO_TABCOLOR) == 0)
1750 + sal_Int32 nColor = COL_AUTO;
1751 + aSettings[i].Value >>= nColor;
1752 + if (nColor != COL_AUTO)
1753 + aTabBgColor.SetColor(static_cast<ColorData>(nColor));
1756 if (eHSplitMode == SC_SPLIT_FIX)
1757 nFixPosX = SanitizeCol( static_cast<SCCOL>( bHasHSplitInTwips ? nTempPosHTw : nTempPosH ));
1758 @@ -579,6 +592,36 @@ void ScViewData::MoveTab( SCTAB nSrcTab, SCTAB nDestTab )
1759 aMarkData.InsertTab( nInsTab ); // ggf. angepasst
1762 +void ScViewData::SetTabBgColor( Color rTabBgColor, SCTAB nTab )
1764 + if ( rTabBgColor != Color(COL_AUTO) )
1766 + if ( !pTabData[nTab] )
1767 + CreateTabData( nTab );
1768 + pTabData[nTab]->aTabBgColor = rTabBgColor;
1770 + else
1772 + if ( pTabData[nTab] )
1773 + pTabData[nTab]->aTabBgColor = Color( COL_AUTO );
1777 +Color ScViewData::GetTabBgColor( SCTAB nTab ) const
1779 + if ( !pTabData[nTab] )
1780 + return Color(COL_AUTO);
1781 + return pTabData[nTab]->aTabBgColor;
1784 +BOOL ScViewData::IsDefaultTabBgColor( SCTAB nTab ) const
1786 + if ( !pTabData[nTab] )
1787 + return true;
1788 + BOOL bResult = pTabData[nTab]->aTabBgColor==Color( COL_AUTO ) ? TRUE : FALSE;
1789 + return bResult;
1792 //UNUSED2008-05 void ScViewData::UpdateOle( ScSplitPos /* eWhich */ )
1793 //UNUSED2008-05 {
1794 //UNUSED2008-05 GetDocShell()->UpdateOle(this);
1795 @@ -2444,6 +2487,9 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const
1796 rTabSett.mbPageMode = bPagebreak;
1797 rTabSett.mnNormalZoom = static_cast< long >( pViewTab->aZoomY * Fraction( 100.0 ) );
1798 rTabSett.mnPageZoom = static_cast< long >( pViewTab->aPageZoomY * Fraction( 100.0 ) );
1800 + // Tab Bg Color
1801 + rTabSett.maTabBgColor = pViewTab->aTabBgColor;
1805 @@ -2598,6 +2644,10 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt )
1806 update map modes that are needed to draw text correctly. */
1807 SetPagebreakMode( rTabSett.mbPageMode );
1810 + // Tab Bg Color
1811 + if( !rTabSett.IsDefaultTabBgColor() )
1812 + rViewTab.aTabBgColor = rTabSett.maTabBgColor;
1816 diff --git sc/source/ui/view/viewfun2.cxx sc/source/ui/view/viewfun2.cxx
1817 index 681f51c..14d58f7 100644
1818 --- sc/source/ui/view/viewfun2.cxx
1819 +++ sc/source/ui/view/viewfun2.cxx
1820 @@ -89,6 +89,7 @@
1821 #include "funcdesc.hxx"
1822 #include "docuno.hxx"
1824 +#include "tabbgcolor.hxx" //DBW
1826 // STATIC DATA ---------------------------------------------------------------
1828 @@ -2276,6 +2277,28 @@ BOOL ScViewFunc::RenameTable( const String& rName, SCTAB nTab )
1830 //----------------------------------------------------------------------------
1832 +BOOL ScViewFunc::SetTabBgColor( const Color& rColor, SCTAB nTab )
1834 + BOOL bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( nTab, rColor, TRUE, FALSE );
1835 + if (bSuccess)
1837 + GetViewData()->GetViewShell()->UpdateInputHandler();
1839 + return bSuccess;
1842 +BOOL ScViewFunc::SetTabBgColor( ScUndoSetTabBgColorInfoList* rUndoSetTabBgColorInfoList )
1844 + BOOL bSuccess = GetViewData()->GetDocShell()->GetDocFunc().SetTabBgColor( rUndoSetTabBgColorInfoList, TRUE, FALSE );
1845 + if (bSuccess)
1847 + GetViewData()->GetViewShell()->UpdateInputHandler();
1849 + return bSuccess;
1852 +//----------------------------------------------------------------------------
1854 void ScViewFunc::InsertAreaLink( const String& rFile,
1855 const String& rFilter, const String& rOptions,
1856 const String& rSource, ULONG nRefresh )
1857 diff --git sc/uiconfig/scalc/menubar/menubar.xml sc/uiconfig/scalc/menubar/menubar.xml
1858 index ab3f121..eed3a97 100644
1859 --- sc/uiconfig/scalc/menubar/menubar.xml
1860 +++ sc/uiconfig/scalc/menubar/menubar.xml
1861 @@ -214,6 +214,8 @@
1862 <menu:menuitem menu:id=".uno:Hide"/>
1863 <menu:menuitem menu:id=".uno:Show"/>
1864 <menu:menuitem menu:id=".uno:SheetRightToLeft"/>
1865 + <menu:menuseparator/>
1866 + <menu:menuitem menu:id=".uno:SetTabBgColor"/>
1867 </menu:menupopup>
1868 </menu:menu>
1869 <menu:menuitem menu:id=".uno:ToggleMergeCells"/>
1870 diff --git sc/util/makefile.mk sc/util/makefile.mk
1871 index db377e5..f4e7973 100644
1872 --- sc/util/makefile.mk
1873 +++ sc/util/makefile.mk
1874 @@ -260,6 +260,7 @@ LIB8OBJFILES = \
1875 $(SLO)$/attrdlg.obj \
1876 $(SLO)$/scuiimoptdlg.obj \
1877 $(SLO)$/strindlg.obj \
1878 + $(SLO)$/tabbgcolordlg.obj \
1879 $(SLO)$/shtabdlg.obj \
1880 $(SLO)$/scendlg.obj \
1881 $(SLO)$/pvfundlg.obj \