Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <vcl/svapp.hxx>
30 : :
31 : : #include <com/sun/star/uno/Any.hxx>
32 : : #include <com/sun/star/uno/Sequence.hxx>
33 : :
34 : : #include "global.hxx"
35 : : #include "globstr.hrc"
36 : : #include "cfgids.hxx"
37 : : #include "viewopti.hxx"
38 : : #include "rechead.hxx"
39 : : #include "scresid.hxx"
40 : : #include "sc.hrc"
41 : : #include "miscuno.hxx"
42 : :
43 : : using namespace utl;
44 : : using namespace com::sun::star::uno;
45 : :
46 : : using ::rtl::OUString;
47 : :
48 : : //------------------------------------------------------------------
49 : :
50 [ # # ][ # # ]: 0 : TYPEINIT1(ScTpViewItem, SfxPoolItem);
51 : :
52 : : #define SC_VERSION ((sal_uInt16)302)
53 : :
54 : :
55 : : //========================================================================
56 : : // class ScGridOptions
57 : : //========================================================================
58 : :
59 : :
60 : 2065 : void ScGridOptions::SetDefaults()
61 : : {
62 : 2065 : *this = ScGridOptions();
63 : :
64 : : // Raster-Defaults sind jetzt zwischen den Apps unterschiedlich
65 : : // darum hier selber eintragen (alles in 1/100mm)
66 : :
67 [ - + ]: 2065 : if ( ScOptionsUtil::IsMetricSystem() )
68 : : {
69 : 0 : nFldDrawX = 1000; // 1cm
70 : 0 : nFldDrawY = 1000;
71 : 0 : nFldSnapX = 1000;
72 : 0 : nFldSnapY = 1000;
73 : : }
74 : : else
75 : : {
76 : 2065 : nFldDrawX = 1270; // 0,5"
77 : 2065 : nFldDrawY = 1270;
78 : 2065 : nFldSnapX = 1270;
79 : 2065 : nFldSnapY = 1270;
80 : : }
81 : 2065 : nFldDivisionX = 1;
82 : 2065 : nFldDivisionY = 1;
83 : 2065 : }
84 : :
85 : : //------------------------------------------------------------------------
86 : :
87 : 11381 : const ScGridOptions& ScGridOptions::operator=( const ScGridOptions& rCpy )
88 : : {
89 : 11381 : nFldDrawX = rCpy.nFldDrawX; // UINT32
90 : 11381 : nFldDivisionX = rCpy.nFldDivisionX;
91 : 11381 : nFldDrawY = rCpy.nFldDrawY;
92 : 11381 : nFldDivisionY = rCpy.nFldDivisionY;
93 : 11381 : nFldSnapX = rCpy.nFldSnapX;
94 : 11381 : nFldSnapY = rCpy.nFldSnapY;
95 : 11381 : bUseGridsnap = rCpy.bUseGridsnap; // BitBool
96 : 11381 : bSynchronize = rCpy.bSynchronize;
97 : 11381 : bGridVisible = rCpy.bGridVisible;
98 : 11381 : bEqualGrid = rCpy.bEqualGrid;
99 : :
100 : 11381 : return *this;
101 : : }
102 : :
103 : : //------------------------------------------------------------------------
104 : :
105 : 0 : bool ScGridOptions::operator==( const ScGridOptions& rCpy ) const
106 : : {
107 : : return ( nFldDrawX == rCpy.nFldDrawX
108 : : && nFldDivisionX == rCpy.nFldDivisionX
109 : : && nFldDrawY == rCpy.nFldDrawY
110 : : && nFldDivisionY == rCpy.nFldDivisionY
111 : : && nFldSnapX == rCpy.nFldSnapX
112 : : && nFldSnapY == rCpy.nFldSnapY
113 : : && bUseGridsnap == rCpy.bUseGridsnap
114 : : && bSynchronize == rCpy.bSynchronize
115 : : && bGridVisible == rCpy.bGridVisible
116 [ # # ][ # # ]: 0 : && bEqualGrid == rCpy.bEqualGrid );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
117 : : }
118 : :
119 : :
120 : : //========================================================================
121 : : // class ScViewOptions
122 : : //========================================================================
123 : :
124 [ + - ]: 2065 : ScViewOptions::ScViewOptions()
125 : : {
126 [ + - ]: 2065 : SetDefaults();
127 : 2065 : }
128 : :
129 : : //------------------------------------------------------------------------
130 : :
131 [ + - ]: 3134 : ScViewOptions::ScViewOptions( const ScViewOptions& rCpy )
132 : : {
133 [ + - ]: 3134 : *this = rCpy;
134 : 3134 : }
135 : :
136 : : //------------------------------------------------------------------------
137 : :
138 [ + - ]: 4992 : ScViewOptions::~ScViewOptions()
139 : : {
140 : 4992 : }
141 : :
142 : : //------------------------------------------------------------------------
143 : :
144 : 2065 : void ScViewOptions::SetDefaults()
145 : : {
146 : : aOptArr[ VOPT_FORMULAS ] =
147 : 2065 : aOptArr[ VOPT_SYNTAX ] =
148 : 2065 : aOptArr[ VOPT_HELPLINES ] =
149 : 2065 : aOptArr[ VOPT_GRID_ONTOP ] =
150 : 2065 : aOptArr[ VOPT_NOTES ] =
151 : 2065 : aOptArr[ VOPT_NULLVALS ] =
152 : 2065 : aOptArr[ VOPT_VSCROLL ] =
153 : 2065 : aOptArr[ VOPT_HSCROLL ] =
154 : 2065 : aOptArr[ VOPT_TABCONTROLS ] =
155 : 2065 : aOptArr[ VOPT_OUTLINER ] =
156 : 2065 : aOptArr[ VOPT_HEADER ] =
157 : 2065 : aOptArr[ VOPT_GRID ] =
158 : 2065 : aOptArr[ VOPT_ANCHOR ] =
159 : 2065 : aOptArr[ VOPT_PAGEBREAKS ] =
160 : 28910 : aOptArr[ VOPT_CLIPMARKS ] = sal_True;
161 : :
162 : : aModeArr[VOBJ_TYPE_OLE ] =
163 : 2065 : aModeArr[VOBJ_TYPE_CHART] =
164 : 4130 : aModeArr[VOBJ_TYPE_DRAW ] = VOBJ_MODE_SHOW;
165 : :
166 : 2065 : aGridCol = Color( SC_STD_GRIDCOLOR );
167 : 2065 : aGridColName = ScGlobal::GetRscString( STR_GRIDCOLOR );
168 : :
169 : 2065 : aGridOpt.SetDefaults();
170 : 2065 : }
171 : :
172 : : //------------------------------------------------------------------------
173 : :
174 : 1524 : Color ScViewOptions::GetGridColor( String* pStrName ) const
175 : : {
176 [ + + ]: 1524 : if ( pStrName )
177 : 246 : *pStrName = aGridColName;
178 : :
179 : 1524 : return aGridCol;
180 : : }
181 : :
182 : : //------------------------------------------------------------------------
183 : :
184 : 6761 : const ScViewOptions& ScViewOptions::operator=( const ScViewOptions& rCpy )
185 : : {
186 : : sal_uInt16 i;
187 : :
188 [ + + ]: 108176 : for ( i=0; i<MAX_OPT; i++ ) aOptArr [i] = rCpy.aOptArr[i];
189 [ + + ]: 27044 : for ( i=0; i<MAX_TYPE; i++ ) aModeArr[i] = rCpy.aModeArr[i];
190 : :
191 : 6761 : aGridCol = rCpy.aGridCol;
192 : 6761 : aGridColName = rCpy.aGridColName;
193 : 6761 : aGridOpt = rCpy.aGridOpt;
194 : :
195 : 6761 : return *this;
196 : : }
197 : :
198 : : //------------------------------------------------------------------------
199 : :
200 : 2 : int ScViewOptions::operator==( const ScViewOptions& rOpt ) const
201 : : {
202 : 2 : sal_Bool bEqual = sal_True;
203 : : sal_uInt16 i;
204 : :
205 [ + - ][ + + ]: 22 : for ( i=0; i<MAX_OPT && bEqual; i++ ) bEqual = (aOptArr [i] == rOpt.aOptArr[i]);
[ + + ]
206 [ + - ][ - + ]: 2 : for ( i=0; i<MAX_TYPE && bEqual; i++ ) bEqual = (aModeArr[i] == rOpt.aModeArr[i]);
[ - + ]
207 : :
208 [ - + ][ # # ]: 2 : bEqual = bEqual && (aGridCol == rOpt.aGridCol);
209 [ - + ][ # # ]: 2 : bEqual = bEqual && (aGridColName == rOpt.aGridColName);
210 [ - + ][ # # ]: 2 : bEqual = bEqual && (aGridOpt == rOpt.aGridOpt);
211 : :
212 : 2 : return bEqual;
213 : : }
214 : :
215 : : //------------------------------------------------------------------------
216 : :
217 : 0 : SvxGridItem* ScViewOptions::CreateGridItem( sal_uInt16 nId /* = SID_ATTR_GRID_OPTIONS */ ) const
218 : : {
219 [ # # ]: 0 : SvxGridItem* pItem = new SvxGridItem( nId );
220 : :
221 : 0 : pItem->SetFldDrawX ( aGridOpt.GetFldDrawX() );
222 : 0 : pItem->SetFldDivisionX ( aGridOpt.GetFldDivisionX() );
223 : 0 : pItem->SetFldDrawY ( aGridOpt.GetFldDrawY() );
224 : 0 : pItem->SetFldDivisionY ( aGridOpt.GetFldDivisionY() );
225 : 0 : pItem->SetFldSnapX ( aGridOpt.GetFldSnapX() );
226 : 0 : pItem->SetFldSnapY ( aGridOpt.GetFldSnapY() );
227 : 0 : pItem->SetUseGridSnap ( aGridOpt.GetUseGridSnap() );
228 : 0 : pItem->SetSynchronize ( aGridOpt.GetSynchronize() );
229 : 0 : pItem->SetGridVisible ( aGridOpt.GetGridVisible() );
230 : 0 : pItem->SetEqualGrid ( aGridOpt.GetEqualGrid() );
231 : :
232 : 0 : return pItem;
233 : : }
234 : :
235 : : //========================================================================
236 : : // ScTpViewItem - Daten fuer die ViewOptions-TabPage
237 : : //========================================================================
238 : :
239 : : //------------------------------------------------------------------------
240 : :
241 : 0 : ScTpViewItem::ScTpViewItem( sal_uInt16 nWhichP, const ScViewOptions& rOpt )
242 : : : SfxPoolItem ( nWhichP ),
243 [ # # ]: 0 : theOptions ( rOpt )
244 : : {
245 : 0 : }
246 : :
247 : : //------------------------------------------------------------------------
248 : :
249 : 0 : ScTpViewItem::ScTpViewItem( const ScTpViewItem& rItem )
250 : : : SfxPoolItem ( rItem ),
251 [ # # ]: 0 : theOptions ( rItem.theOptions )
252 : : {
253 : 0 : }
254 : :
255 : : //------------------------------------------------------------------------
256 : :
257 [ # # ]: 0 : ScTpViewItem::~ScTpViewItem()
258 : : {
259 [ # # ]: 0 : }
260 : :
261 : : //------------------------------------------------------------------------
262 : :
263 : 0 : String ScTpViewItem::GetValueText() const
264 : : {
265 [ # # ]: 0 : return rtl::OUString("ScTpViewItem");
266 : : }
267 : :
268 : : //------------------------------------------------------------------------
269 : :
270 : 0 : int ScTpViewItem::operator==( const SfxPoolItem& rItem ) const
271 : : {
272 : : OSL_ENSURE( SfxPoolItem::operator==( rItem ), "unequal Which or Type" );
273 : :
274 : 0 : const ScTpViewItem& rPItem = (const ScTpViewItem&)rItem;
275 : :
276 : 0 : return ( theOptions == rPItem.theOptions );
277 : : }
278 : :
279 : : //------------------------------------------------------------------------
280 : :
281 : 0 : SfxPoolItem* ScTpViewItem::Clone( SfxItemPool * ) const
282 : : {
283 [ # # ]: 0 : return new ScTpViewItem( *this );
284 : : }
285 : :
286 : : //==================================================================
287 : : // Config Item containing view options
288 : : //==================================================================
289 : :
290 : : #define CFGPATH_LAYOUT "Office.Calc/Layout"
291 : :
292 : : #define SCLAYOUTOPT_GRIDLINES 0
293 : : #define SCLAYOUTOPT_GRIDCOLOR 1
294 : : #define SCLAYOUTOPT_PAGEBREAK 2
295 : : #define SCLAYOUTOPT_GUIDE 3
296 : : #define SCLAYOUTOPT_COLROWHDR 4
297 : : #define SCLAYOUTOPT_HORISCROLL 5
298 : : #define SCLAYOUTOPT_VERTSCROLL 6
299 : : #define SCLAYOUTOPT_SHEETTAB 7
300 : : #define SCLAYOUTOPT_OUTLINE 8
301 : : #define SCLAYOUTOPT_GRID_ONCOLOR 9
302 : : #define SCLAYOUTOPT_COUNT 10
303 : :
304 : : #define CFGPATH_DISPLAY "Office.Calc/Content/Display"
305 : :
306 : : #define SCDISPLAYOPT_FORMULA 0
307 : : #define SCDISPLAYOPT_ZEROVALUE 1
308 : : #define SCDISPLAYOPT_NOTETAG 2
309 : : #define SCDISPLAYOPT_VALUEHI 3
310 : : #define SCDISPLAYOPT_ANCHOR 4
311 : : #define SCDISPLAYOPT_TEXTOVER 5
312 : : #define SCDISPLAYOPT_OBJECTGRA 6
313 : : #define SCDISPLAYOPT_CHART 7
314 : : #define SCDISPLAYOPT_DRAWING 8
315 : : #define SCDISPLAYOPT_COUNT 9
316 : :
317 : : #define CFGPATH_GRID "Office.Calc/Grid"
318 : :
319 : : #define SCGRIDOPT_RESOLU_X 0
320 : : #define SCGRIDOPT_RESOLU_Y 1
321 : : #define SCGRIDOPT_SUBDIV_X 2
322 : : #define SCGRIDOPT_SUBDIV_Y 3
323 : : #define SCGRIDOPT_OPTION_X 4
324 : : #define SCGRIDOPT_OPTION_Y 5
325 : : #define SCGRIDOPT_SNAPTOGRID 6
326 : : #define SCGRIDOPT_SYNCHRON 7
327 : : #define SCGRIDOPT_VISIBLE 8
328 : : #define SCGRIDOPT_SIZETOGRID 9
329 : : #define SCGRIDOPT_COUNT 10
330 : :
331 : :
332 : 51 : Sequence<OUString> ScViewCfg::GetLayoutPropertyNames()
333 : : {
334 : : static const char* aPropNames[] =
335 : : {
336 : : "Line/GridLine", // SCLAYOUTOPT_GRIDLINES
337 : : "Line/GridLineColor", // SCLAYOUTOPT_GRIDCOLOR
338 : : "Line/PageBreak", // SCLAYOUTOPT_PAGEBREAK
339 : : "Line/Guide", // SCLAYOUTOPT_GUIDE
340 : : "Window/ColumnRowHeader", // SCLAYOUTOPT_COLROWHDR
341 : : "Window/HorizontalScroll", // SCLAYOUTOPT_HORISCROLL
342 : : "Window/VerticalScroll", // SCLAYOUTOPT_VERTSCROLL
343 : : "Window/SheetTab", // SCLAYOUTOPT_SHEETTAB
344 : : "Window/OutlineSymbol", // SCLAYOUTOPT_OUTLINE
345 : : "Line/GridOnColoredCells" // SCLAYOUTOPT_GRID_ONCOLOR
346 : : };
347 : 51 : Sequence<OUString> aNames(SCLAYOUTOPT_COUNT);
348 [ + - ]: 51 : OUString* pNames = aNames.getArray();
349 [ + + ]: 561 : for(int i = 0; i < SCLAYOUTOPT_COUNT; i++)
350 : 510 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
351 : :
352 : 51 : return aNames;
353 : : }
354 : :
355 : 51 : Sequence<OUString> ScViewCfg::GetDisplayPropertyNames()
356 : : {
357 : : static const char* aPropNames[] =
358 : : {
359 : : "Formula", // SCDISPLAYOPT_FORMULA
360 : : "ZeroValue", // SCDISPLAYOPT_ZEROVALUE
361 : : "NoteTag", // SCDISPLAYOPT_NOTETAG
362 : : "ValueHighlighting", // SCDISPLAYOPT_VALUEHI
363 : : "Anchor", // SCDISPLAYOPT_ANCHOR
364 : : "TextOverflow", // SCDISPLAYOPT_TEXTOVER
365 : : "ObjectGraphic", // SCDISPLAYOPT_OBJECTGRA
366 : : "Chart", // SCDISPLAYOPT_CHART
367 : : "DrawingObject" // SCDISPLAYOPT_DRAWING
368 : : };
369 : 51 : Sequence<OUString> aNames(SCDISPLAYOPT_COUNT);
370 [ + - ]: 51 : OUString* pNames = aNames.getArray();
371 [ + + ]: 510 : for(int i = 0; i < SCDISPLAYOPT_COUNT; i++)
372 : 459 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
373 : :
374 : 51 : return aNames;
375 : : }
376 : :
377 : 51 : Sequence<OUString> ScViewCfg::GetGridPropertyNames()
378 : : {
379 : : static const char* aPropNames[] =
380 : : {
381 : : "Resolution/XAxis/NonMetric", // SCGRIDOPT_RESOLU_X
382 : : "Resolution/YAxis/NonMetric", // SCGRIDOPT_RESOLU_Y
383 : : "Subdivision/XAxis", // SCGRIDOPT_SUBDIV_X
384 : : "Subdivision/YAxis", // SCGRIDOPT_SUBDIV_Y
385 : : "Option/XAxis/NonMetric", // SCGRIDOPT_OPTION_X
386 : : "Option/YAxis/NonMetric", // SCGRIDOPT_OPTION_Y
387 : : "Option/SnapToGrid", // SCGRIDOPT_SNAPTOGRID
388 : : "Option/Synchronize", // SCGRIDOPT_SYNCHRON
389 : : "Option/VisibleGrid", // SCGRIDOPT_VISIBLE
390 : : "Option/SizeToGrid" // SCGRIDOPT_SIZETOGRID
391 : : };
392 : 51 : Sequence<OUString> aNames(SCGRIDOPT_COUNT);
393 [ + - ]: 51 : OUString* pNames = aNames.getArray();
394 [ + + ]: 561 : for(int i = 0; i < SCGRIDOPT_COUNT; i++)
395 : 510 : pNames[i] = OUString::createFromAscii(aPropNames[i]);
396 : :
397 : : // adjust for metric system
398 [ + - ][ - + ]: 51 : if (ScOptionsUtil::IsMetricSystem())
399 : : {
400 [ # # ]: 0 : pNames[SCGRIDOPT_RESOLU_X] = OUString(RTL_CONSTASCII_USTRINGPARAM( "Resolution/XAxis/Metric" ));
401 [ # # ]: 0 : pNames[SCGRIDOPT_RESOLU_Y] = OUString(RTL_CONSTASCII_USTRINGPARAM( "Resolution/YAxis/Metric" ));
402 [ # # ]: 0 : pNames[SCGRIDOPT_OPTION_X] = OUString(RTL_CONSTASCII_USTRINGPARAM( "Option/XAxis/Metric" ));
403 [ # # ]: 0 : pNames[SCGRIDOPT_OPTION_Y] = OUString(RTL_CONSTASCII_USTRINGPARAM( "Option/YAxis/Metric" ));
404 : : }
405 : :
406 : 51 : return aNames;
407 : : }
408 : :
409 : :
410 : 51 : ScViewCfg::ScViewCfg() :
411 : : aLayoutItem( OUString(RTL_CONSTASCII_USTRINGPARAM( CFGPATH_LAYOUT )) ),
412 : : aDisplayItem( OUString(RTL_CONSTASCII_USTRINGPARAM( CFGPATH_DISPLAY )) ),
413 [ + - ][ + - ]: 51 : aGridItem( OUString(RTL_CONSTASCII_USTRINGPARAM( CFGPATH_GRID )) )
[ + - ][ + - ]
[ + - ][ + - ]
414 : : {
415 : 51 : sal_Int32 nIntVal = 0;
416 : :
417 [ + - ]: 51 : Sequence<OUString> aNames = GetLayoutPropertyNames();
418 [ + - ]: 51 : Sequence<Any> aValues = aLayoutItem.GetProperties(aNames);
419 [ + - ]: 51 : aLayoutItem.EnableNotification(aNames);
420 : 51 : const Any* pValues = aValues.getConstArray();
421 : : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
422 [ + - ]: 51 : if(aValues.getLength() == aNames.getLength())
423 : : {
424 [ + + ]: 561 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
425 : : {
426 : : OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
427 [ + - ]: 510 : if(pValues[nProp].hasValue())
428 : : {
429 [ + + + + : 510 : switch(nProp)
+ + + + +
+ - ]
430 : : {
431 : : case SCLAYOUTOPT_GRIDCOLOR:
432 [ + - ]: 51 : if ( pValues[nProp] >>= nIntVal )
433 [ + - ][ + - ]: 51 : SetGridColor( Color(nIntVal), EMPTY_STRING );
434 : 51 : break;
435 : : case SCLAYOUTOPT_GRIDLINES:
436 [ + - ]: 51 : SetOption( VOPT_GRID, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
437 : 51 : break;
438 : : case SCLAYOUTOPT_GRID_ONCOLOR:
439 [ + - ]: 51 : SetOption( VOPT_GRID_ONTOP, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
440 : 51 : break;
441 : : case SCLAYOUTOPT_PAGEBREAK:
442 [ + - ]: 51 : SetOption( VOPT_PAGEBREAKS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
443 : 51 : break;
444 : : case SCLAYOUTOPT_GUIDE:
445 [ + - ]: 51 : SetOption( VOPT_HELPLINES, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
446 : 51 : break;
447 : : case SCLAYOUTOPT_COLROWHDR:
448 [ + - ]: 51 : SetOption( VOPT_HEADER, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
449 : 51 : break;
450 : : case SCLAYOUTOPT_HORISCROLL:
451 [ + - ]: 51 : SetOption( VOPT_HSCROLL, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
452 : 51 : break;
453 : : case SCLAYOUTOPT_VERTSCROLL:
454 [ + - ]: 51 : SetOption( VOPT_VSCROLL, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
455 : 51 : break;
456 : : case SCLAYOUTOPT_SHEETTAB:
457 [ + - ]: 51 : SetOption( VOPT_TABCONTROLS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
458 : 51 : break;
459 : : case SCLAYOUTOPT_OUTLINE:
460 [ + - ]: 51 : SetOption( VOPT_OUTLINER, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
461 : 510 : break;
462 : : }
463 : : }
464 : : }
465 : : }
466 [ + - ][ + - ]: 51 : aLayoutItem.SetCommitLink( LINK( this, ScViewCfg, LayoutCommitHdl ) );
467 : :
468 [ + - ][ + - ]: 51 : aNames = GetDisplayPropertyNames();
[ + - ]
469 [ + - ][ + - ]: 51 : aValues = aDisplayItem.GetProperties(aNames);
[ + - ]
470 [ + - ]: 51 : aDisplayItem.EnableNotification(aNames);
471 : 51 : pValues = aValues.getConstArray();
472 : : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
473 [ + - ]: 51 : if(aValues.getLength() == aNames.getLength())
474 : : {
475 [ + + ]: 510 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
476 : : {
477 : : OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
478 [ + - ]: 459 : if(pValues[nProp].hasValue())
479 : : {
480 [ + + + + : 459 : switch(nProp)
+ + + + +
- ]
481 : : {
482 : : case SCDISPLAYOPT_FORMULA:
483 [ + - ]: 51 : SetOption( VOPT_FORMULAS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
484 : 51 : break;
485 : : case SCDISPLAYOPT_ZEROVALUE:
486 [ + - ]: 51 : SetOption( VOPT_NULLVALS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
487 : 51 : break;
488 : : case SCDISPLAYOPT_NOTETAG:
489 [ + - ]: 51 : SetOption( VOPT_NOTES, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
490 : 51 : break;
491 : : case SCDISPLAYOPT_VALUEHI:
492 [ + - ]: 51 : SetOption( VOPT_SYNTAX, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
493 : 51 : break;
494 : : case SCDISPLAYOPT_ANCHOR:
495 [ + - ]: 51 : SetOption( VOPT_ANCHOR, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
496 : 51 : break;
497 : : case SCDISPLAYOPT_TEXTOVER:
498 [ + - ]: 51 : SetOption( VOPT_CLIPMARKS, ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
499 : 51 : break;
500 : : case SCDISPLAYOPT_OBJECTGRA:
501 [ + - ]: 51 : if ( pValues[nProp] >>= nIntVal )
502 : : {
503 : : //#i80528# adapt to new range eventually
504 [ - + ]: 51 : if((sal_Int32)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int32)VOBJ_MODE_SHOW;
505 : :
506 : 51 : SetObjMode( VOBJ_TYPE_OLE, (ScVObjMode)nIntVal);
507 : : }
508 : 51 : break;
509 : : case SCDISPLAYOPT_CHART:
510 [ + - ]: 51 : if ( pValues[nProp] >>= nIntVal )
511 : : {
512 : : //#i80528# adapt to new range eventually
513 [ - + ]: 51 : if((sal_Int32)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int32)VOBJ_MODE_SHOW;
514 : :
515 : 51 : SetObjMode( VOBJ_TYPE_CHART, (ScVObjMode)nIntVal);
516 : : }
517 : 51 : break;
518 : : case SCDISPLAYOPT_DRAWING:
519 [ + - ]: 51 : if ( pValues[nProp] >>= nIntVal )
520 : : {
521 : : //#i80528# adapt to new range eventually
522 [ - + ]: 51 : if((sal_Int32)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int32)VOBJ_MODE_SHOW;
523 : :
524 : 51 : SetObjMode( VOBJ_TYPE_DRAW, (ScVObjMode)nIntVal);
525 : : }
526 : 459 : break;
527 : : }
528 : : }
529 : : }
530 : : }
531 [ + - ][ + - ]: 51 : aDisplayItem.SetCommitLink( LINK( this, ScViewCfg, DisplayCommitHdl ) );
532 : :
533 : 51 : ScGridOptions aGrid = GetGridOptions(); //! initialization necessary?
534 [ + - ][ + - ]: 51 : aNames = GetGridPropertyNames();
[ + - ]
535 [ + - ][ + - ]: 51 : aValues = aGridItem.GetProperties(aNames);
[ + - ]
536 [ + - ]: 51 : aGridItem.EnableNotification(aNames);
537 : 51 : pValues = aValues.getConstArray();
538 : : OSL_ENSURE(aValues.getLength() == aNames.getLength(), "GetProperties failed");
539 [ + - ]: 51 : if(aValues.getLength() == aNames.getLength())
540 : : {
541 [ + + ]: 561 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
542 : : {
543 : : OSL_ENSURE(pValues[nProp].hasValue(), "property value missing");
544 [ + - ]: 510 : if(pValues[nProp].hasValue())
545 : : {
546 [ + + + + : 510 : switch(nProp)
+ + + + +
+ - ]
547 : : {
548 : : case SCGRIDOPT_RESOLU_X:
549 [ + - ]: 51 : if (pValues[nProp] >>= nIntVal) aGrid.SetFldDrawX( nIntVal );
550 : 51 : break;
551 : : case SCGRIDOPT_RESOLU_Y:
552 [ + - ]: 51 : if (pValues[nProp] >>= nIntVal) aGrid.SetFldDrawY( nIntVal );
553 : 51 : break;
554 : : case SCGRIDOPT_SUBDIV_X:
555 [ + - ]: 51 : if (pValues[nProp] >>= nIntVal) aGrid.SetFldDivisionX( nIntVal );
556 : 51 : break;
557 : : case SCGRIDOPT_SUBDIV_Y:
558 [ + - ]: 51 : if (pValues[nProp] >>= nIntVal) aGrid.SetFldDivisionY( nIntVal );
559 : 51 : break;
560 : : case SCGRIDOPT_OPTION_X:
561 [ + - ]: 51 : if (pValues[nProp] >>= nIntVal) aGrid.SetFldSnapX( nIntVal );
562 : 51 : break;
563 : : case SCGRIDOPT_OPTION_Y:
564 [ + - ]: 51 : if (pValues[nProp] >>= nIntVal) aGrid.SetFldSnapY( nIntVal );
565 : 51 : break;
566 : : case SCGRIDOPT_SNAPTOGRID:
567 [ + - ]: 51 : aGrid.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
568 : 51 : break;
569 : : case SCGRIDOPT_SYNCHRON:
570 [ + - ]: 51 : aGrid.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
571 : 51 : break;
572 : : case SCGRIDOPT_VISIBLE:
573 [ + - ]: 51 : aGrid.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
574 : 51 : break;
575 : : case SCGRIDOPT_SIZETOGRID:
576 [ + - ]: 51 : aGrid.SetEqualGrid( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) );
577 : 510 : break;
578 : : }
579 : : }
580 : : }
581 : : }
582 [ + - ]: 51 : SetGridOptions( aGrid );
583 [ + - ][ + - ]: 51 : aGridItem.SetCommitLink( LINK( this, ScViewCfg, GridCommitHdl ) );
[ + - ][ + - ]
[ + - ]
584 : 51 : }
585 : :
586 : 0 : IMPL_LINK_NOARG(ScViewCfg, LayoutCommitHdl)
587 : : {
588 [ # # ]: 0 : Sequence<OUString> aNames = GetLayoutPropertyNames();
589 [ # # ]: 0 : Sequence<Any> aValues(aNames.getLength());
590 [ # # ]: 0 : Any* pValues = aValues.getArray();
591 : :
592 [ # # ]: 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
593 : : {
594 [ # # # # : 0 : switch(nProp)
# # # # #
# # ]
595 : : {
596 : : case SCLAYOUTOPT_GRIDCOLOR:
597 [ # # ][ # # ]: 0 : pValues[nProp] <<= (sal_Int32) GetGridColor().GetColor();
598 : 0 : break;
599 : : case SCLAYOUTOPT_GRIDLINES:
600 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_GRID ) );
601 : 0 : break;
602 : : case SCLAYOUTOPT_GRID_ONCOLOR:
603 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_GRID_ONTOP ) );
604 : 0 : break;
605 : : case SCLAYOUTOPT_PAGEBREAK:
606 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_PAGEBREAKS ) );
607 : 0 : break;
608 : : case SCLAYOUTOPT_GUIDE:
609 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_HELPLINES ) );
610 : 0 : break;
611 : : case SCLAYOUTOPT_COLROWHDR:
612 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_HEADER ) );
613 : 0 : break;
614 : : case SCLAYOUTOPT_HORISCROLL:
615 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_HSCROLL ) );
616 : 0 : break;
617 : : case SCLAYOUTOPT_VERTSCROLL:
618 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_VSCROLL ) );
619 : 0 : break;
620 : : case SCLAYOUTOPT_SHEETTAB:
621 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_TABCONTROLS ) );
622 : 0 : break;
623 : : case SCLAYOUTOPT_OUTLINE:
624 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_OUTLINER ) );
625 : 0 : break;
626 : : }
627 : : }
628 [ # # ]: 0 : aLayoutItem.PutProperties(aNames, aValues);
629 : :
630 [ # # ][ # # ]: 0 : return 0;
631 : : }
632 : :
633 : 0 : IMPL_LINK_NOARG(ScViewCfg, DisplayCommitHdl)
634 : : {
635 [ # # ]: 0 : Sequence<OUString> aNames = GetDisplayPropertyNames();
636 [ # # ]: 0 : Sequence<Any> aValues(aNames.getLength());
637 [ # # ]: 0 : Any* pValues = aValues.getArray();
638 : :
639 [ # # ]: 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
640 : : {
641 [ # # # # : 0 : switch(nProp)
# # # # #
# ]
642 : : {
643 : : case SCDISPLAYOPT_FORMULA:
644 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_FORMULAS ) );
645 : 0 : break;
646 : : case SCDISPLAYOPT_ZEROVALUE:
647 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_NULLVALS ) );
648 : 0 : break;
649 : : case SCDISPLAYOPT_NOTETAG:
650 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_NOTES ) );
651 : 0 : break;
652 : : case SCDISPLAYOPT_VALUEHI:
653 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_SYNTAX ) );
654 : 0 : break;
655 : : case SCDISPLAYOPT_ANCHOR:
656 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_ANCHOR ) );
657 : 0 : break;
658 : : case SCDISPLAYOPT_TEXTOVER:
659 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], GetOption( VOPT_CLIPMARKS ) );
660 : 0 : break;
661 : : case SCDISPLAYOPT_OBJECTGRA:
662 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) GetObjMode( VOBJ_TYPE_OLE );
663 : 0 : break;
664 : : case SCDISPLAYOPT_CHART:
665 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) GetObjMode( VOBJ_TYPE_CHART );
666 : 0 : break;
667 : : case SCDISPLAYOPT_DRAWING:
668 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) GetObjMode( VOBJ_TYPE_DRAW );
669 : 0 : break;
670 : : }
671 : : }
672 [ # # ]: 0 : aDisplayItem.PutProperties(aNames, aValues);
673 : :
674 [ # # ][ # # ]: 0 : return 0;
675 : : }
676 : :
677 : 0 : IMPL_LINK_NOARG(ScViewCfg, GridCommitHdl)
678 : : {
679 : 0 : const ScGridOptions& rGrid = GetGridOptions();
680 : :
681 [ # # ]: 0 : Sequence<OUString> aNames = GetGridPropertyNames();
682 [ # # ]: 0 : Sequence<Any> aValues(aNames.getLength());
683 [ # # ]: 0 : Any* pValues = aValues.getArray();
684 : :
685 [ # # ]: 0 : for(int nProp = 0; nProp < aNames.getLength(); nProp++)
686 : : {
687 [ # # # # : 0 : switch(nProp)
# # # # #
# # ]
688 : : {
689 : : case SCGRIDOPT_RESOLU_X:
690 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) rGrid.GetFldDrawX();
691 : 0 : break;
692 : : case SCGRIDOPT_RESOLU_Y:
693 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) rGrid.GetFldDrawY();
694 : 0 : break;
695 : : case SCGRIDOPT_SUBDIV_X:
696 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) rGrid.GetFldDivisionX();
697 : 0 : break;
698 : : case SCGRIDOPT_SUBDIV_Y:
699 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) rGrid.GetFldDivisionY();
700 : 0 : break;
701 : : case SCGRIDOPT_OPTION_X:
702 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) rGrid.GetFldSnapX();
703 : 0 : break;
704 : : case SCGRIDOPT_OPTION_Y:
705 [ # # ]: 0 : pValues[nProp] <<= (sal_Int32) rGrid.GetFldSnapY();
706 : 0 : break;
707 : : case SCGRIDOPT_SNAPTOGRID:
708 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], rGrid.GetUseGridSnap() );
709 : 0 : break;
710 : : case SCGRIDOPT_SYNCHRON:
711 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], rGrid.GetSynchronize() );
712 : 0 : break;
713 : : case SCGRIDOPT_VISIBLE:
714 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], rGrid.GetGridVisible() );
715 : 0 : break;
716 : : case SCGRIDOPT_SIZETOGRID:
717 [ # # ]: 0 : ScUnoHelpFunctions::SetBoolInAny( pValues[nProp], rGrid.GetEqualGrid() );
718 : 0 : break;
719 : : }
720 : : }
721 [ # # ]: 0 : aGridItem.PutProperties(aNames, aValues);
722 : :
723 [ # # ][ # # ]: 0 : return 0;
724 : : }
725 : :
726 : 0 : void ScViewCfg::SetOptions( const ScViewOptions& rNew )
727 : : {
728 : 0 : *(ScViewOptions*)this = rNew;
729 : 0 : aLayoutItem.SetModified();
730 : 0 : aDisplayItem.SetModified();
731 : 0 : aGridItem.SetModified();
732 : 0 : }
733 : :
734 : :
735 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|