1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <osl/diagnose.h>
22 #include <com/sun/star/uno/Any.hxx>
23 #include <com/sun/star/uno/Sequence.hxx>
25 #include <svtools/colorcfg.hxx>
28 #include <viewopti.hxx>
31 #include <miscuno.hxx>
34 using namespace com::sun::star::uno
;
38 void ScGridOptions::SetDefaults()
40 *this = ScGridOptions();
42 // grid defaults differ now between the apps
43 // therefore, enter here in its own right (all in 1/100mm)
45 if ( ScOptionsUtil::IsMetricSystem() )
47 nFldDrawX
= 1000; // 1cm
52 nFldDrawX
= 1270; // 0,5"
59 bool ScGridOptions::operator==( const ScGridOptions
& rCpy
) const
61 return ( nFldDrawX
== rCpy
.nFldDrawX
62 && nFldDivisionX
== rCpy
.nFldDivisionX
63 && nFldDrawY
== rCpy
.nFldDrawY
64 && nFldDivisionY
== rCpy
.nFldDivisionY
65 && bUseGridsnap
== rCpy
.bUseGridsnap
66 && bSynchronize
== rCpy
.bSynchronize
67 && bGridVisible
== rCpy
.bGridVisible
68 && bEqualGrid
== rCpy
.bEqualGrid
);
71 ScViewRenderingOptions::ScViewRenderingOptions()
72 : sColorSchemeName(u
"Default"_ustr
)
73 , aDocCol(ScModule::get()->GetColorConfig().GetColorValue(svtools::DOCCOLOR
).nColor
)
77 bool ScViewRenderingOptions::operator==(const ScViewRenderingOptions
& rOther
) const
79 return sColorSchemeName
== rOther
.sColorSchemeName
&&
80 aDocCol
== rOther
.aDocCol
;
83 ScViewOptions::ScViewOptions()
88 ScViewOptions::ScViewOptions( const ScViewOptions
& rCpy
)
93 ScViewOptions::~ScViewOptions()
97 void ScViewOptions::SetDefaults()
99 aOptArr
[ VOPT_FORMULAS
] = false;
100 aOptArr
[ VOPT_SYNTAX
] = false;
101 aOptArr
[ VOPT_HELPLINES
] = false;
102 aOptArr
[ VOPT_GRID_ONTOP
] = false;
103 aOptArr
[ VOPT_NOTES
] = true;
104 aOptArr
[ VOPT_NOTEAUTHOR
] = true;
105 aOptArr
[ VOPT_FORMULAS_MARKS
] = false;
106 aOptArr
[ VOPT_NULLVALS
] = true;
107 aOptArr
[ VOPT_VSCROLL
] = true;
108 aOptArr
[ VOPT_HSCROLL
] = true;
109 aOptArr
[ VOPT_TABCONTROLS
] = true;
110 aOptArr
[ VOPT_OUTLINER
] = true;
111 aOptArr
[ VOPT_HEADER
] = true;
112 aOptArr
[ VOPT_GRID
] = true;
113 aOptArr
[ VOPT_ANCHOR
] = true;
114 aOptArr
[ VOPT_PAGEBREAKS
] = true;
115 aOptArr
[ VOPT_SUMMARY
] = true;
116 aOptArr
[ VOPT_COPY_SHEET
] = false;
117 aOptArr
[ VOPT_THEMEDCURSOR
] = false;
119 aModeArr
[VOBJ_TYPE_OLE
] = VOBJ_MODE_SHOW
;
120 aModeArr
[VOBJ_TYPE_CHART
] = VOBJ_MODE_SHOW
;
121 aModeArr
[VOBJ_TYPE_DRAW
] = VOBJ_MODE_SHOW
;
123 aGridCol
= svtools::ColorConfig().GetColorValue( svtools::CALCGRID
).nColor
;
125 aGridOpt
.SetDefaults();
128 Color
const & ScViewOptions::GetGridColor( OUString
* pStrName
) const
131 *pStrName
= aGridColName
;
136 ScViewOptions
& ScViewOptions::operator=(const ScViewOptions
& rCpy
) = default;
138 bool ScViewOptions::operator==( const ScViewOptions
& rOpt
) const
143 for ( i
=0; i
<MAX_OPT
&& bEqual
; i
++ ) bEqual
= (aOptArr
[i
] == rOpt
.aOptArr
[i
]);
144 for ( i
=0; i
<MAX_TYPE
&& bEqual
; i
++ ) bEqual
= (aModeArr
[i
] == rOpt
.aModeArr
[i
]);
146 bEqual
= bEqual
&& (aGridCol
== rOpt
.aGridCol
);
147 bEqual
= bEqual
&& (aGridColName
== rOpt
.aGridColName
);
148 bEqual
= bEqual
&& (aGridOpt
== rOpt
.aGridOpt
);
153 std::unique_ptr
<SvxGridItem
> ScViewOptions::CreateGridItem() const
155 std::unique_ptr
<SvxGridItem
> pItem(new SvxGridItem( SID_ATTR_GRID_OPTIONS
));
157 pItem
->SetFieldDrawX ( aGridOpt
.GetFieldDrawX() );
158 pItem
->SetFieldDivisionX ( aGridOpt
.GetFieldDivisionX() );
159 pItem
->SetFieldDrawY ( aGridOpt
.GetFieldDrawY() );
160 pItem
->SetFieldDivisionY ( aGridOpt
.GetFieldDivisionY() );
161 pItem
->SetUseGridSnap ( aGridOpt
.GetUseGridSnap() );
162 pItem
->SetSynchronize ( aGridOpt
.GetSynchronize() );
163 pItem
->SetGridVisible ( aGridOpt
.GetGridVisible() );
164 pItem
->SetEqualGrid ( aGridOpt
.GetEqualGrid() );
169 // ScTpViewItem - data for the ViewOptions TabPage
171 ScTpViewItem::ScTpViewItem( const ScViewOptions
& rOpt
)
172 : SfxPoolItem ( SID_SCVIEWOPTIONS
, SfxItemType::ScTpViewItemType
),
177 ScTpViewItem::~ScTpViewItem()
181 bool ScTpViewItem::operator==( const SfxPoolItem
& rItem
) const
183 assert(SfxPoolItem::operator==(rItem
));
185 const ScTpViewItem
& rPItem
= static_cast<const ScTpViewItem
&>(rItem
);
187 return ( theOptions
== rPItem
.theOptions
);
190 ScTpViewItem
* ScTpViewItem::Clone( SfxItemPool
* ) const
192 return new ScTpViewItem( *this );
195 // Config Item containing view options
197 constexpr OUStringLiteral CFGPATH_LAYOUT
= u
"Office.Calc/Layout";
199 #define SCLAYOUTOPT_GRIDLINES 0
200 #define SCLAYOUTOPT_GRIDCOLOR 1
201 #define SCLAYOUTOPT_PAGEBREAK 2
202 #define SCLAYOUTOPT_GUIDE 3
203 #define SCLAYOUTOPT_COLROWHDR 4
204 #define SCLAYOUTOPT_HORISCROLL 5
205 #define SCLAYOUTOPT_VERTSCROLL 6
206 #define SCLAYOUTOPT_SHEETTAB 7
207 #define SCLAYOUTOPT_OUTLINE 8
208 #define SCLAYOUTOPT_GRID_ONCOLOR 9
209 #define SCLAYOUTOPT_SUMMARY 10
210 #define SCLAYOUTOPT_THEMEDCURSOR 11
212 constexpr OUStringLiteral CFGPATH_DISPLAY
= u
"Office.Calc/Content/Display";
214 #define SCDISPLAYOPT_FORMULA 0
215 #define SCDISPLAYOPT_ZEROVALUE 1
216 #define SCDISPLAYOPT_NOTETAG 2
217 #define SCDISPLAYOPT_NOTEAUTHOR 3
218 #define SCDISPLAYOPT_FORMULAMARK 4
219 #define SCDISPLAYOPT_VALUEHI 5
220 #define SCDISPLAYOPT_ANCHOR 6
221 #define SCDISPLAYOPT_OBJECTGRA 7
222 #define SCDISPLAYOPT_CHART 8
223 #define SCDISPLAYOPT_DRAWING 9
225 constexpr OUStringLiteral CFGPATH_GRID
= u
"Office.Calc/Grid";
227 #define SCGRIDOPT_RESOLU_X 0
228 #define SCGRIDOPT_RESOLU_Y 1
229 #define SCGRIDOPT_SUBDIV_X 2
230 #define SCGRIDOPT_SUBDIV_Y 3
231 #define SCGRIDOPT_SNAPTOGRID 4
232 #define SCGRIDOPT_SYNCHRON 5
233 #define SCGRIDOPT_VISIBLE 6
234 #define SCGRIDOPT_SIZETOGRID 7
236 Sequence
<OUString
> ScViewCfg::GetLayoutPropertyNames()
238 return {u
"Line/GridLine"_ustr
, // SCLAYOUTOPT_GRIDLINES
239 u
"Line/GridLineColor"_ustr
, // SCLAYOUTOPT_GRIDCOLOR
240 u
"Line/PageBreak"_ustr
, // SCLAYOUTOPT_PAGEBREAK
241 u
"Line/Guide"_ustr
, // SCLAYOUTOPT_GUIDE
242 u
"Window/ColumnRowHeader"_ustr
, // SCLAYOUTOPT_COLROWHDR
243 u
"Window/HorizontalScroll"_ustr
, // SCLAYOUTOPT_HORISCROLL
244 u
"Window/VerticalScroll"_ustr
, // SCLAYOUTOPT_VERTSCROLL
245 u
"Window/SheetTab"_ustr
, // SCLAYOUTOPT_SHEETTAB
246 u
"Window/OutlineSymbol"_ustr
, // SCLAYOUTOPT_OUTLINE
247 u
"Line/GridOnColoredCells"_ustr
, // SCLAYOUTOPT_GRID_ONCOLOR;
248 u
"Window/SearchSummary"_ustr
, // SCLAYOUTOPT_SUMMARY
249 u
"Window/ThemedCursor"_ustr
}; // SCLAYOUTOPT_THEMEDCURSOR
252 Sequence
<OUString
> ScViewCfg::GetDisplayPropertyNames()
254 return {u
"Formula"_ustr
, // SCDISPLAYOPT_FORMULA
255 u
"ZeroValue"_ustr
, // SCDISPLAYOPT_ZEROVALUE
256 u
"NoteTag"_ustr
, // SCDISPLAYOPT_NOTETAG
257 u
"NoteAuthor"_ustr
, // SCDISPLAYOPT_NOTEAUTHOR
258 u
"FormulaMark"_ustr
, // SCDISPLAYOPT_FORMULAMARK
259 u
"ValueHighlighting"_ustr
, // SCDISPLAYOPT_VALUEHI
260 u
"Anchor"_ustr
, // SCDISPLAYOPT_ANCHOR
261 u
"ObjectGraphic"_ustr
, // SCDISPLAYOPT_OBJECTGRA
262 u
"Chart"_ustr
, // SCDISPLAYOPT_CHART
263 u
"DrawingObject"_ustr
}; // SCDISPLAYOPT_DRAWING;
266 Sequence
<OUString
> ScViewCfg::GetGridPropertyNames()
268 const bool bIsMetric
= ScOptionsUtil::IsMetricSystem();
270 return {(bIsMetric
? u
"Resolution/XAxis/Metric"_ustr
271 : u
"Resolution/XAxis/NonMetric"_ustr
), // SCGRIDOPT_RESOLU_X
272 (bIsMetric
? u
"Resolution/YAxis/Metric"_ustr
273 : u
"Resolution/YAxis/NonMetric"_ustr
), // SCGRIDOPT_RESOLU_Y
274 u
"Subdivision/XAxis"_ustr
, // SCGRIDOPT_SUBDIV_X
275 u
"Subdivision/YAxis"_ustr
, // SCGRIDOPT_SUBDIV_Y
276 u
"Option/SnapToGrid"_ustr
, // SCGRIDOPT_SNAPTOGRID
277 u
"Option/Synchronize"_ustr
, // SCGRIDOPT_SYNCHRON
278 u
"Option/VisibleGrid"_ustr
, // SCGRIDOPT_VISIBLE
279 u
"Option/SizeToGrid"_ustr
}; // SCGRIDOPT_SIZETOGRID;
282 ScViewCfg::ScViewCfg() :
283 aLayoutItem( CFGPATH_LAYOUT
),
284 aDisplayItem( CFGPATH_DISPLAY
),
285 aGridItem( CFGPATH_GRID
)
287 sal_Int32 nIntVal
= 0;
289 Sequence
<OUString
> aNames
= GetLayoutPropertyNames();
290 Sequence
<Any
> aValues
= aLayoutItem
.GetProperties(aNames
);
291 aLayoutItem
.EnableNotification(aNames
);
292 const Any
* pValues
= aValues
.getConstArray();
293 OSL_ENSURE(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
294 if(aValues
.getLength() == aNames
.getLength())
296 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
298 OSL_ENSURE(pValues
[nProp
].hasValue(), "property value missing");
299 if(pValues
[nProp
].hasValue())
303 case SCLAYOUTOPT_GRIDCOLOR
:
306 if ( pValues
[nProp
] >>= aColor
)
307 SetGridColor( aColor
, OUString() );
310 case SCLAYOUTOPT_GRIDLINES
:
311 SetOption( VOPT_GRID
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
313 case SCLAYOUTOPT_GRID_ONCOLOR
:
314 SetOption( VOPT_GRID_ONTOP
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
316 case SCLAYOUTOPT_PAGEBREAK
:
317 SetOption( VOPT_PAGEBREAKS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
319 case SCLAYOUTOPT_GUIDE
:
320 SetOption( VOPT_HELPLINES
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
322 case SCLAYOUTOPT_COLROWHDR
:
323 SetOption( VOPT_HEADER
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
325 case SCLAYOUTOPT_HORISCROLL
:
326 SetOption( VOPT_HSCROLL
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
328 case SCLAYOUTOPT_VERTSCROLL
:
329 SetOption( VOPT_VSCROLL
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
331 case SCLAYOUTOPT_SHEETTAB
:
332 SetOption( VOPT_TABCONTROLS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
334 case SCLAYOUTOPT_OUTLINE
:
335 SetOption( VOPT_OUTLINER
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
337 case SCLAYOUTOPT_SUMMARY
:
338 SetOption( VOPT_SUMMARY
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
340 case SCLAYOUTOPT_THEMEDCURSOR
:
341 SetOption( VOPT_THEMEDCURSOR
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
347 aLayoutItem
.SetCommitLink( LINK( this, ScViewCfg
, LayoutCommitHdl
) );
349 aNames
= GetDisplayPropertyNames();
350 aValues
= aDisplayItem
.GetProperties(aNames
);
351 aDisplayItem
.EnableNotification(aNames
);
352 pValues
= aValues
.getConstArray();
353 OSL_ENSURE(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
354 if(aValues
.getLength() == aNames
.getLength())
356 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
358 OSL_ENSURE(pValues
[nProp
].hasValue(), "property value missing");
359 if(pValues
[nProp
].hasValue())
363 case SCDISPLAYOPT_FORMULA
:
364 SetOption( VOPT_FORMULAS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
366 case SCDISPLAYOPT_ZEROVALUE
:
367 SetOption( VOPT_NULLVALS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
369 case SCDISPLAYOPT_NOTETAG
:
370 SetOption( VOPT_NOTES
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
372 case SCDISPLAYOPT_NOTEAUTHOR
:
373 SetOption( VOPT_NOTEAUTHOR
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
375 case SCDISPLAYOPT_FORMULAMARK
:
376 SetOption( VOPT_FORMULAS_MARKS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
378 case SCDISPLAYOPT_VALUEHI
:
379 SetOption( VOPT_SYNTAX
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
381 case SCDISPLAYOPT_ANCHOR
:
382 SetOption( VOPT_ANCHOR
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
384 case SCDISPLAYOPT_OBJECTGRA
:
385 if ( pValues
[nProp
] >>= nIntVal
)
387 //#i80528# adapt to new range eventually
388 if(sal_Int32(VOBJ_MODE_HIDE
) < nIntVal
) nIntVal
= sal_Int32(VOBJ_MODE_SHOW
);
390 SetObjMode( VOBJ_TYPE_OLE
, static_cast<ScVObjMode
>(nIntVal
));
393 case SCDISPLAYOPT_CHART
:
394 if ( pValues
[nProp
] >>= nIntVal
)
396 //#i80528# adapt to new range eventually
397 if(sal_Int32(VOBJ_MODE_HIDE
) < nIntVal
) nIntVal
= sal_Int32(VOBJ_MODE_SHOW
);
399 SetObjMode( VOBJ_TYPE_CHART
, static_cast<ScVObjMode
>(nIntVal
));
402 case SCDISPLAYOPT_DRAWING
:
403 if ( pValues
[nProp
] >>= nIntVal
)
405 //#i80528# adapt to new range eventually
406 if(sal_Int32(VOBJ_MODE_HIDE
) < nIntVal
) nIntVal
= sal_Int32(VOBJ_MODE_SHOW
);
408 SetObjMode( VOBJ_TYPE_DRAW
, static_cast<ScVObjMode
>(nIntVal
));
415 aDisplayItem
.SetCommitLink( LINK( this, ScViewCfg
, DisplayCommitHdl
) );
417 aGridItem
.EnableNotification(GetGridPropertyNames());
419 aGridItem
.SetCommitLink( LINK( this, ScViewCfg
, GridCommitHdl
) );
420 aGridItem
.SetNotifyLink( LINK( this, ScViewCfg
, GridNotifyHdl
) );
423 IMPL_LINK_NOARG(ScViewCfg
, LayoutCommitHdl
, ScLinkConfigItem
&, void)
425 Sequence
<OUString
> aNames
= GetLayoutPropertyNames();
426 Sequence
<Any
> aValues(aNames
.getLength());
427 Any
* pValues
= aValues
.getArray();
429 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
433 case SCLAYOUTOPT_GRIDCOLOR
:
434 pValues
[nProp
] <<= GetGridColor();
436 case SCLAYOUTOPT_GRIDLINES
:
437 pValues
[nProp
] <<= GetOption( VOPT_GRID
);
439 case SCLAYOUTOPT_GRID_ONCOLOR
:
440 pValues
[nProp
] <<= GetOption( VOPT_GRID_ONTOP
);
442 case SCLAYOUTOPT_PAGEBREAK
:
443 pValues
[nProp
] <<= GetOption( VOPT_PAGEBREAKS
);
445 case SCLAYOUTOPT_GUIDE
:
446 pValues
[nProp
] <<= GetOption( VOPT_HELPLINES
);
448 case SCLAYOUTOPT_COLROWHDR
:
449 pValues
[nProp
] <<= GetOption( VOPT_HEADER
);
451 case SCLAYOUTOPT_HORISCROLL
:
452 pValues
[nProp
] <<= GetOption( VOPT_HSCROLL
);
454 case SCLAYOUTOPT_VERTSCROLL
:
455 pValues
[nProp
] <<= GetOption( VOPT_VSCROLL
);
457 case SCLAYOUTOPT_SHEETTAB
:
458 pValues
[nProp
] <<= GetOption( VOPT_TABCONTROLS
);
460 case SCLAYOUTOPT_OUTLINE
:
461 pValues
[nProp
] <<= GetOption( VOPT_OUTLINER
);
463 case SCLAYOUTOPT_SUMMARY
:
464 pValues
[nProp
] <<= GetOption( VOPT_SUMMARY
);
466 case SCLAYOUTOPT_THEMEDCURSOR
:
467 pValues
[nProp
] <<= GetOption( VOPT_THEMEDCURSOR
);
471 aLayoutItem
.PutProperties(aNames
, aValues
);
474 IMPL_LINK_NOARG(ScViewCfg
, DisplayCommitHdl
, ScLinkConfigItem
&, void)
476 Sequence
<OUString
> aNames
= GetDisplayPropertyNames();
477 Sequence
<Any
> aValues(aNames
.getLength());
478 Any
* pValues
= aValues
.getArray();
480 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
484 case SCDISPLAYOPT_FORMULA
:
485 pValues
[nProp
] <<= GetOption( VOPT_FORMULAS
);
487 case SCDISPLAYOPT_ZEROVALUE
:
488 pValues
[nProp
] <<= GetOption( VOPT_NULLVALS
);
490 case SCDISPLAYOPT_NOTETAG
:
491 pValues
[nProp
] <<= GetOption( VOPT_NOTES
);
493 case SCDISPLAYOPT_NOTEAUTHOR
:
494 pValues
[nProp
] <<= GetOption( VOPT_NOTEAUTHOR
);
496 case SCDISPLAYOPT_FORMULAMARK
:
497 pValues
[nProp
] <<= GetOption( VOPT_FORMULAS_MARKS
);
499 case SCDISPLAYOPT_VALUEHI
:
500 pValues
[nProp
] <<= GetOption( VOPT_SYNTAX
);
502 case SCDISPLAYOPT_ANCHOR
:
503 pValues
[nProp
] <<= GetOption( VOPT_ANCHOR
);
505 case SCDISPLAYOPT_OBJECTGRA
:
506 pValues
[nProp
] <<= static_cast<sal_Int32
>(GetObjMode( VOBJ_TYPE_OLE
));
508 case SCDISPLAYOPT_CHART
:
509 pValues
[nProp
] <<= static_cast<sal_Int32
>(GetObjMode( VOBJ_TYPE_CHART
));
511 case SCDISPLAYOPT_DRAWING
:
512 pValues
[nProp
] <<= static_cast<sal_Int32
>(GetObjMode( VOBJ_TYPE_DRAW
));
516 aDisplayItem
.PutProperties(aNames
, aValues
);
519 void ScViewCfg::ReadGridCfg()
521 const Sequence
<OUString
> aNames
= GetGridPropertyNames();
522 const Sequence
<Any
> aValues
= aGridItem
.GetProperties(aNames
);
523 OSL_ENSURE(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
524 if (aValues
.getLength() != aNames
.getLength())
527 sal_Int32 nIntVal
= 0;
529 ScGridOptions aGrid
= GetGridOptions(); //TODO: initialization necessary?
530 const Any
* pValues
= aValues
.getConstArray();
532 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
534 OSL_ENSURE(pValues
[nProp
].hasValue(), "property value missing");
535 if(pValues
[nProp
].hasValue())
539 case SCGRIDOPT_RESOLU_X
:
540 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFieldDrawX( nIntVal
);
542 case SCGRIDOPT_RESOLU_Y
:
543 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFieldDrawY( nIntVal
);
545 case SCGRIDOPT_SUBDIV_X
:
546 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFieldDivisionX( nIntVal
);
548 case SCGRIDOPT_SUBDIV_Y
:
549 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFieldDivisionY( nIntVal
);
551 case SCGRIDOPT_SNAPTOGRID
:
552 aGrid
.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
554 case SCGRIDOPT_SYNCHRON
:
555 aGrid
.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
557 case SCGRIDOPT_VISIBLE
:
558 aGrid
.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
560 case SCGRIDOPT_SIZETOGRID
:
561 aGrid
.SetEqualGrid( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
567 SetGridOptions( aGrid
);
570 IMPL_LINK_NOARG(ScViewCfg
, GridNotifyHdl
, ScLinkConfigItem
&, void) { ReadGridCfg(); }
572 IMPL_LINK_NOARG(ScViewCfg
, GridCommitHdl
, ScLinkConfigItem
&, void)
574 const ScGridOptions
& rGrid
= GetGridOptions();
576 Sequence
<OUString
> aNames
= GetGridPropertyNames();
577 Sequence
<Any
> aValues(aNames
.getLength());
578 Any
* pValues
= aValues
.getArray();
580 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
584 case SCGRIDOPT_RESOLU_X
:
585 pValues
[nProp
] <<= static_cast<sal_Int32
>(rGrid
.GetFieldDrawX());
587 case SCGRIDOPT_RESOLU_Y
:
588 pValues
[nProp
] <<= static_cast<sal_Int32
>(rGrid
.GetFieldDrawY());
590 case SCGRIDOPT_SUBDIV_X
:
591 pValues
[nProp
] <<= static_cast<sal_Int32
>(rGrid
.GetFieldDivisionX());
593 case SCGRIDOPT_SUBDIV_Y
:
594 pValues
[nProp
] <<= static_cast<sal_Int32
>(rGrid
.GetFieldDivisionY());
596 case SCGRIDOPT_SNAPTOGRID
:
597 pValues
[nProp
] <<= rGrid
.GetUseGridSnap();
599 case SCGRIDOPT_SYNCHRON
:
600 pValues
[nProp
] <<= rGrid
.GetSynchronize();
602 case SCGRIDOPT_VISIBLE
:
603 pValues
[nProp
] <<= rGrid
.GetGridVisible();
605 case SCGRIDOPT_SIZETOGRID
:
606 pValues
[nProp
] <<= rGrid
.GetEqualGrid();
610 aGridItem
.PutProperties(aNames
, aValues
);
613 void ScViewCfg::SetOptions( const ScViewOptions
& rNew
)
615 *static_cast<ScViewOptions
*>(this) = rNew
;
616 aLayoutItem
.SetModified();
617 aDisplayItem
.SetModified();
618 aGridItem
.SetModified();
621 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */