1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: viewopti.cxx,v $
10 * $Revision: 1.9.32.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
36 #include <vcl/svapp.hxx>
38 #include <com/sun/star/uno/Any.hxx>
39 #include <com/sun/star/uno/Sequence.hxx>
42 #include "globstr.hrc"
44 #include "viewopti.hxx"
45 #include "rechead.hxx"
46 #include "scresid.hxx"
48 #include "miscuno.hxx"
52 using namespace com::sun::star::uno
;
54 //------------------------------------------------------------------
56 TYPEINIT1(ScTpViewItem
, SfxPoolItem
);
58 #define SC_VERSION ((USHORT)302)
61 //========================================================================
62 // class ScGridOptions
63 //========================================================================
66 void ScGridOptions::SetDefaults()
68 *this = ScGridOptions();
70 // Raster-Defaults sind jetzt zwischen den Apps unterschiedlich
71 // darum hier selber eintragen (alles in 1/100mm)
73 if ( ScOptionsUtil::IsMetricSystem() )
75 nFldDrawX
= 1000; // 1cm
82 nFldDrawX
= 1270; // 0,5"
91 //------------------------------------------------------------------------
93 const ScGridOptions
& ScGridOptions::operator=( const ScGridOptions
& rCpy
)
95 nFldDrawX
= rCpy
.nFldDrawX
; // UINT32
96 nFldDrawX
= rCpy
.nFldDrawX
;
97 nFldDivisionX
= rCpy
.nFldDivisionX
;
98 nFldDrawY
= rCpy
.nFldDrawY
;
99 nFldDivisionY
= rCpy
.nFldDivisionY
;
100 nFldSnapX
= rCpy
.nFldSnapX
;
101 nFldSnapY
= rCpy
.nFldSnapY
;
102 bUseGridsnap
= rCpy
.bUseGridsnap
; // BitBool
103 bSynchronize
= rCpy
.bSynchronize
;
104 bGridVisible
= rCpy
.bGridVisible
;
105 bEqualGrid
= rCpy
.bEqualGrid
;
110 //------------------------------------------------------------------------
112 int ScGridOptions::operator==( const ScGridOptions
& rCpy
) const
114 return ( nFldDrawX
== rCpy
.nFldDrawX
115 && nFldDrawX
== rCpy
.nFldDrawX
116 && nFldDivisionX
== rCpy
.nFldDivisionX
117 && nFldDrawY
== rCpy
.nFldDrawY
118 && nFldDivisionY
== rCpy
.nFldDivisionY
119 && nFldSnapX
== rCpy
.nFldSnapX
120 && nFldSnapY
== rCpy
.nFldSnapY
121 && bUseGridsnap
== rCpy
.bUseGridsnap
122 && bSynchronize
== rCpy
.bSynchronize
123 && bGridVisible
== rCpy
.bGridVisible
124 && bEqualGrid
== rCpy
.bEqualGrid
);
128 //========================================================================
129 // class ScViewOptions
130 //========================================================================
132 ScViewOptions::ScViewOptions()
137 //------------------------------------------------------------------------
139 ScViewOptions::ScViewOptions( const ScViewOptions
& rCpy
)
144 //------------------------------------------------------------------------
146 __EXPORT
ScViewOptions::~ScViewOptions()
150 //------------------------------------------------------------------------
152 void ScViewOptions::SetDefaults()
154 aOptArr
[ VOPT_FORMULAS
] =
155 aOptArr
[ VOPT_SYNTAX
] =
156 aOptArr
[ VOPT_HELPLINES
] =
157 aOptArr
[ VOPT_BIGHANDLES
] = FALSE
;
158 aOptArr
[ VOPT_NOTES
] =
159 aOptArr
[ VOPT_NULLVALS
] =
160 aOptArr
[ VOPT_VSCROLL
] =
161 aOptArr
[ VOPT_HSCROLL
] =
162 aOptArr
[ VOPT_TABCONTROLS
] =
163 aOptArr
[ VOPT_OUTLINER
] =
164 aOptArr
[ VOPT_HEADER
] =
165 aOptArr
[ VOPT_GRID
] =
166 aOptArr
[ VOPT_ANCHOR
] =
167 aOptArr
[ VOPT_PAGEBREAKS
] =
168 aOptArr
[ VOPT_SOLIDHANDLES
] =
169 aOptArr
[ VOPT_CLIPMARKS
] = TRUE
;
171 aModeArr
[VOBJ_TYPE_OLE
] =
172 aModeArr
[VOBJ_TYPE_CHART
] =
173 aModeArr
[VOBJ_TYPE_DRAW
] = VOBJ_MODE_SHOW
;
175 aGridCol
= Color( SC_STD_GRIDCOLOR
);
176 aGridColName
= ScGlobal::GetRscString( STR_GRIDCOLOR
);
178 aGridOpt
.SetDefaults();
181 //------------------------------------------------------------------------
183 Color
ScViewOptions::GetGridColor( String
* pStrName
) const
186 *pStrName
= aGridColName
;
191 //------------------------------------------------------------------------
193 const ScViewOptions
& ScViewOptions::operator=( const ScViewOptions
& rCpy
)
197 for ( i
=0; i
<MAX_OPT
; i
++ ) aOptArr
[i
] = rCpy
.aOptArr
[i
];
198 for ( i
=0; i
<MAX_TYPE
; i
++ ) aModeArr
[i
] = rCpy
.aModeArr
[i
];
200 aGridCol
= rCpy
.aGridCol
;
201 aGridColName
= rCpy
.aGridColName
;
202 aGridOpt
= rCpy
.aGridOpt
;
207 //------------------------------------------------------------------------
209 int ScViewOptions::operator==( const ScViewOptions
& rOpt
) const
214 for ( i
=0; i
<MAX_OPT
&& bEqual
; i
++ ) bEqual
= (aOptArr
[i
] == rOpt
.aOptArr
[i
]);
215 for ( i
=0; i
<MAX_TYPE
&& bEqual
; i
++ ) bEqual
= (aModeArr
[i
] == rOpt
.aModeArr
[i
]);
217 bEqual
= bEqual
&& (aGridCol
== rOpt
.aGridCol
);
218 bEqual
= bEqual
&& (aGridColName
== rOpt
.aGridColName
);
219 bEqual
= bEqual
&& (aGridOpt
== rOpt
.aGridOpt
);
224 //------------------------------------------------------------------------
226 SvxGridItem
* ScViewOptions::CreateGridItem( USHORT nId
/* = SID_ATTR_GRID_OPTIONS */ ) const
228 SvxGridItem
* pItem
= new SvxGridItem( nId
);
230 pItem
->SetFldDrawX ( aGridOpt
.GetFldDrawX() );
231 pItem
->SetFldDivisionX ( aGridOpt
.GetFldDivisionX() );
232 pItem
->SetFldDrawY ( aGridOpt
.GetFldDrawY() );
233 pItem
->SetFldDivisionY ( aGridOpt
.GetFldDivisionY() );
234 pItem
->SetFldSnapX ( aGridOpt
.GetFldSnapX() );
235 pItem
->SetFldSnapY ( aGridOpt
.GetFldSnapY() );
236 pItem
->SetUseGridSnap ( aGridOpt
.GetUseGridSnap() );
237 pItem
->SetSynchronize ( aGridOpt
.GetSynchronize() );
238 pItem
->SetGridVisible ( aGridOpt
.GetGridVisible() );
239 pItem
->SetEqualGrid ( aGridOpt
.GetEqualGrid() );
244 //========================================================================
245 // ScTpViewItem - Daten fuer die ViewOptions-TabPage
246 //========================================================================
248 //UNUSED2008-05 ScTpViewItem::ScTpViewItem( USHORT nWhichP ) : SfxPoolItem( nWhichP )
252 //------------------------------------------------------------------------
254 ScTpViewItem::ScTpViewItem( USHORT nWhichP
, const ScViewOptions
& rOpt
)
255 : SfxPoolItem ( nWhichP
),
260 //------------------------------------------------------------------------
262 ScTpViewItem::ScTpViewItem( const ScTpViewItem
& rItem
)
263 : SfxPoolItem ( rItem
),
264 theOptions ( rItem
.theOptions
)
268 //------------------------------------------------------------------------
270 __EXPORT
ScTpViewItem::~ScTpViewItem()
274 //------------------------------------------------------------------------
276 String __EXPORT
ScTpViewItem::GetValueText() const
278 return String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM("ScTpViewItem") );
281 //------------------------------------------------------------------------
283 int __EXPORT
ScTpViewItem::operator==( const SfxPoolItem
& rItem
) const
285 DBG_ASSERT( SfxPoolItem::operator==( rItem
), "unequal Which or Type" );
287 const ScTpViewItem
& rPItem
= (const ScTpViewItem
&)rItem
;
289 return ( theOptions
== rPItem
.theOptions
);
292 //------------------------------------------------------------------------
294 SfxPoolItem
* __EXPORT
ScTpViewItem::Clone( SfxItemPool
* ) const
296 return new ScTpViewItem( *this );
299 //==================================================================
300 // Config Item containing view options
301 //==================================================================
303 #define CFGPATH_LAYOUT "Office.Calc/Layout"
305 #define SCLAYOUTOPT_GRIDLINES 0
306 #define SCLAYOUTOPT_GRIDCOLOR 1
307 #define SCLAYOUTOPT_PAGEBREAK 2
308 #define SCLAYOUTOPT_GUIDE 3
309 #define SCLAYOUTOPT_SIMPLECONT 4
310 #define SCLAYOUTOPT_LARGECONT 5
311 #define SCLAYOUTOPT_COLROWHDR 6
312 #define SCLAYOUTOPT_HORISCROLL 7
313 #define SCLAYOUTOPT_VERTSCROLL 8
314 #define SCLAYOUTOPT_SHEETTAB 9
315 #define SCLAYOUTOPT_OUTLINE 10
316 #define SCLAYOUTOPT_COUNT 11
318 #define CFGPATH_DISPLAY "Office.Calc/Content/Display"
320 #define SCDISPLAYOPT_FORMULA 0
321 #define SCDISPLAYOPT_ZEROVALUE 1
322 #define SCDISPLAYOPT_NOTETAG 2
323 #define SCDISPLAYOPT_VALUEHI 3
324 #define SCDISPLAYOPT_ANCHOR 4
325 #define SCDISPLAYOPT_TEXTOVER 5
326 #define SCDISPLAYOPT_OBJECTGRA 6
327 #define SCDISPLAYOPT_CHART 7
328 #define SCDISPLAYOPT_DRAWING 8
329 #define SCDISPLAYOPT_COUNT 9
331 #define CFGPATH_GRID "Office.Calc/Grid"
333 #define SCGRIDOPT_RESOLU_X 0
334 #define SCGRIDOPT_RESOLU_Y 1
335 #define SCGRIDOPT_SUBDIV_X 2
336 #define SCGRIDOPT_SUBDIV_Y 3
337 #define SCGRIDOPT_OPTION_X 4
338 #define SCGRIDOPT_OPTION_Y 5
339 #define SCGRIDOPT_SNAPTOGRID 6
340 #define SCGRIDOPT_SYNCHRON 7
341 #define SCGRIDOPT_VISIBLE 8
342 #define SCGRIDOPT_SIZETOGRID 9
343 #define SCGRIDOPT_COUNT 10
346 Sequence
<OUString
> ScViewCfg::GetLayoutPropertyNames()
348 static const char* aPropNames
[] =
350 "Line/GridLine", // SCLAYOUTOPT_GRIDLINES
351 "Line/GridLineColor", // SCLAYOUTOPT_GRIDCOLOR
352 "Line/PageBreak", // SCLAYOUTOPT_PAGEBREAK
353 "Line/Guide", // SCLAYOUTOPT_GUIDE
354 "Line/SimpleControlPoint", // SCLAYOUTOPT_SIMPLECONT
355 "Line/LargeControlPoint", // SCLAYOUTOPT_LARGECONT
356 "Window/ColumnRowHeader", // SCLAYOUTOPT_COLROWHDR
357 "Window/HorizontalScroll", // SCLAYOUTOPT_HORISCROLL
358 "Window/VerticalScroll", // SCLAYOUTOPT_VERTSCROLL
359 "Window/SheetTab", // SCLAYOUTOPT_SHEETTAB
360 "Window/OutlineSymbol" // SCLAYOUTOPT_OUTLINE
362 Sequence
<OUString
> aNames(SCLAYOUTOPT_COUNT
);
363 OUString
* pNames
= aNames
.getArray();
364 for(int i
= 0; i
< SCLAYOUTOPT_COUNT
; i
++)
365 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
370 Sequence
<OUString
> ScViewCfg::GetDisplayPropertyNames()
372 static const char* aPropNames
[] =
374 "Formula", // SCDISPLAYOPT_FORMULA
375 "ZeroValue", // SCDISPLAYOPT_ZEROVALUE
376 "NoteTag", // SCDISPLAYOPT_NOTETAG
377 "ValueHighlighting", // SCDISPLAYOPT_VALUEHI
378 "Anchor", // SCDISPLAYOPT_ANCHOR
379 "TextOverflow", // SCDISPLAYOPT_TEXTOVER
380 "ObjectGraphic", // SCDISPLAYOPT_OBJECTGRA
381 "Chart", // SCDISPLAYOPT_CHART
382 "DrawingObject" // SCDISPLAYOPT_DRAWING
384 Sequence
<OUString
> aNames(SCDISPLAYOPT_COUNT
);
385 OUString
* pNames
= aNames
.getArray();
386 for(int i
= 0; i
< SCDISPLAYOPT_COUNT
; i
++)
387 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
392 Sequence
<OUString
> ScViewCfg::GetGridPropertyNames()
394 static const char* aPropNames
[] =
396 "Resolution/XAxis/NonMetric", // SCGRIDOPT_RESOLU_X
397 "Resolution/YAxis/NonMetric", // SCGRIDOPT_RESOLU_Y
398 "Subdivision/XAxis", // SCGRIDOPT_SUBDIV_X
399 "Subdivision/YAxis", // SCGRIDOPT_SUBDIV_Y
400 "Option/XAxis/NonMetric", // SCGRIDOPT_OPTION_X
401 "Option/YAxis/NonMetric", // SCGRIDOPT_OPTION_Y
402 "Option/SnapToGrid", // SCGRIDOPT_SNAPTOGRID
403 "Option/Synchronize", // SCGRIDOPT_SYNCHRON
404 "Option/VisibleGrid", // SCGRIDOPT_VISIBLE
405 "Option/SizeToGrid" // SCGRIDOPT_SIZETOGRID
407 Sequence
<OUString
> aNames(SCGRIDOPT_COUNT
);
408 OUString
* pNames
= aNames
.getArray();
409 for(int i
= 0; i
< SCGRIDOPT_COUNT
; i
++)
410 pNames
[i
] = OUString::createFromAscii(aPropNames
[i
]);
412 // adjust for metric system
413 if (ScOptionsUtil::IsMetricSystem())
415 pNames
[SCGRIDOPT_RESOLU_X
] = OUString::createFromAscii( "Resolution/XAxis/Metric" );
416 pNames
[SCGRIDOPT_RESOLU_Y
] = OUString::createFromAscii( "Resolution/YAxis/Metric" );
417 pNames
[SCGRIDOPT_OPTION_X
] = OUString::createFromAscii( "Option/XAxis/Metric" );
418 pNames
[SCGRIDOPT_OPTION_Y
] = OUString::createFromAscii( "Option/YAxis/Metric" );
425 ScViewCfg::ScViewCfg() :
426 aLayoutItem( OUString::createFromAscii( CFGPATH_LAYOUT
) ),
427 aDisplayItem( OUString::createFromAscii( CFGPATH_DISPLAY
) ),
428 aGridItem( OUString::createFromAscii( CFGPATH_GRID
) )
430 sal_Int32 nIntVal
= 0;
432 Sequence
<OUString
> aNames
= GetLayoutPropertyNames();
433 Sequence
<Any
> aValues
= aLayoutItem
.GetProperties(aNames
);
434 aLayoutItem
.EnableNotification(aNames
);
435 const Any
* pValues
= aValues
.getConstArray();
436 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
437 if(aValues
.getLength() == aNames
.getLength())
439 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
441 DBG_ASSERT(pValues
[nProp
].hasValue(), "property value missing");
442 if(pValues
[nProp
].hasValue())
446 case SCLAYOUTOPT_GRIDCOLOR
:
447 if ( pValues
[nProp
] >>= nIntVal
)
448 SetGridColor( Color(nIntVal
), EMPTY_STRING
);
450 case SCLAYOUTOPT_GRIDLINES
:
451 SetOption( VOPT_GRID
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
453 case SCLAYOUTOPT_PAGEBREAK
:
454 SetOption( VOPT_PAGEBREAKS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
456 case SCLAYOUTOPT_GUIDE
:
457 SetOption( VOPT_HELPLINES
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
459 case SCLAYOUTOPT_SIMPLECONT
:
460 // content is reversed
461 SetOption( VOPT_SOLIDHANDLES
, !ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
463 case SCLAYOUTOPT_LARGECONT
:
464 SetOption( VOPT_BIGHANDLES
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
466 case SCLAYOUTOPT_COLROWHDR
:
467 SetOption( VOPT_HEADER
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
469 case SCLAYOUTOPT_HORISCROLL
:
470 SetOption( VOPT_HSCROLL
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
472 case SCLAYOUTOPT_VERTSCROLL
:
473 SetOption( VOPT_VSCROLL
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
475 case SCLAYOUTOPT_SHEETTAB
:
476 SetOption( VOPT_TABCONTROLS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
478 case SCLAYOUTOPT_OUTLINE
:
479 SetOption( VOPT_OUTLINER
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
485 aLayoutItem
.SetCommitLink( LINK( this, ScViewCfg
, LayoutCommitHdl
) );
487 aNames
= GetDisplayPropertyNames();
488 aValues
= aDisplayItem
.GetProperties(aNames
);
489 aDisplayItem
.EnableNotification(aNames
);
490 pValues
= aValues
.getConstArray();
491 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
492 if(aValues
.getLength() == aNames
.getLength())
494 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
496 DBG_ASSERT(pValues
[nProp
].hasValue(), "property value missing");
497 if(pValues
[nProp
].hasValue())
501 case SCDISPLAYOPT_FORMULA
:
502 SetOption( VOPT_FORMULAS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
504 case SCDISPLAYOPT_ZEROVALUE
:
505 SetOption( VOPT_NULLVALS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
507 case SCDISPLAYOPT_NOTETAG
:
508 SetOption( VOPT_NOTES
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
510 case SCDISPLAYOPT_VALUEHI
:
511 SetOption( VOPT_SYNTAX
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
513 case SCDISPLAYOPT_ANCHOR
:
514 SetOption( VOPT_ANCHOR
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
516 case SCDISPLAYOPT_TEXTOVER
:
517 SetOption( VOPT_CLIPMARKS
, ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
519 case SCDISPLAYOPT_OBJECTGRA
:
520 if ( pValues
[nProp
] >>= nIntVal
)
522 //#i80528# adapt to new range eventually
523 if((sal_Int32
)VOBJ_MODE_HIDE
< nIntVal
) nIntVal
= (sal_Int32
)VOBJ_MODE_SHOW
;
525 SetObjMode( VOBJ_TYPE_OLE
, (ScVObjMode
)nIntVal
);
528 case SCDISPLAYOPT_CHART
:
529 if ( pValues
[nProp
] >>= nIntVal
)
531 //#i80528# adapt to new range eventually
532 if((sal_Int32
)VOBJ_MODE_HIDE
< nIntVal
) nIntVal
= (sal_Int32
)VOBJ_MODE_SHOW
;
534 SetObjMode( VOBJ_TYPE_CHART
, (ScVObjMode
)nIntVal
);
537 case SCDISPLAYOPT_DRAWING
:
538 if ( pValues
[nProp
] >>= nIntVal
)
540 //#i80528# adapt to new range eventually
541 if((sal_Int32
)VOBJ_MODE_HIDE
< nIntVal
) nIntVal
= (sal_Int32
)VOBJ_MODE_SHOW
;
543 SetObjMode( VOBJ_TYPE_DRAW
, (ScVObjMode
)nIntVal
);
550 aDisplayItem
.SetCommitLink( LINK( this, ScViewCfg
, DisplayCommitHdl
) );
552 ScGridOptions aGrid
= GetGridOptions(); //! initialization necessary?
553 aNames
= GetGridPropertyNames();
554 aValues
= aGridItem
.GetProperties(aNames
);
555 aGridItem
.EnableNotification(aNames
);
556 pValues
= aValues
.getConstArray();
557 DBG_ASSERT(aValues
.getLength() == aNames
.getLength(), "GetProperties failed");
558 if(aValues
.getLength() == aNames
.getLength())
560 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
562 DBG_ASSERT(pValues
[nProp
].hasValue(), "property value missing");
563 if(pValues
[nProp
].hasValue())
567 case SCGRIDOPT_RESOLU_X
:
568 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFldDrawX( nIntVal
);
570 case SCGRIDOPT_RESOLU_Y
:
571 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFldDrawY( nIntVal
);
573 case SCGRIDOPT_SUBDIV_X
:
574 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFldDivisionX( nIntVal
);
576 case SCGRIDOPT_SUBDIV_Y
:
577 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFldDivisionY( nIntVal
);
579 case SCGRIDOPT_OPTION_X
:
580 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFldSnapX( nIntVal
);
582 case SCGRIDOPT_OPTION_Y
:
583 if (pValues
[nProp
] >>= nIntVal
) aGrid
.SetFldSnapY( nIntVal
);
585 case SCGRIDOPT_SNAPTOGRID
:
586 aGrid
.SetUseGridSnap( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
588 case SCGRIDOPT_SYNCHRON
:
589 aGrid
.SetSynchronize( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
591 case SCGRIDOPT_VISIBLE
:
592 aGrid
.SetGridVisible( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
594 case SCGRIDOPT_SIZETOGRID
:
595 aGrid
.SetEqualGrid( ScUnoHelpFunctions::GetBoolFromAny( pValues
[nProp
] ) );
601 SetGridOptions( aGrid
);
602 aGridItem
.SetCommitLink( LINK( this, ScViewCfg
, GridCommitHdl
) );
605 IMPL_LINK( ScViewCfg
, LayoutCommitHdl
, void *, EMPTYARG
)
607 Sequence
<OUString
> aNames
= GetLayoutPropertyNames();
608 Sequence
<Any
> aValues(aNames
.getLength());
609 Any
* pValues
= aValues
.getArray();
611 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
615 case SCLAYOUTOPT_GRIDCOLOR
:
616 pValues
[nProp
] <<= (sal_Int32
) GetGridColor().GetColor();
618 case SCLAYOUTOPT_GRIDLINES
:
619 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_GRID
) );
621 case SCLAYOUTOPT_PAGEBREAK
:
622 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_PAGEBREAKS
) );
624 case SCLAYOUTOPT_GUIDE
:
625 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_HELPLINES
) );
627 case SCLAYOUTOPT_SIMPLECONT
:
628 // content is reversed
629 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], !GetOption( VOPT_SOLIDHANDLES
) );
631 case SCLAYOUTOPT_LARGECONT
:
632 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_BIGHANDLES
) );
634 case SCLAYOUTOPT_COLROWHDR
:
635 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_HEADER
) );
637 case SCLAYOUTOPT_HORISCROLL
:
638 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_HSCROLL
) );
640 case SCLAYOUTOPT_VERTSCROLL
:
641 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_VSCROLL
) );
643 case SCLAYOUTOPT_SHEETTAB
:
644 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_TABCONTROLS
) );
646 case SCLAYOUTOPT_OUTLINE
:
647 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_OUTLINER
) );
651 aLayoutItem
.PutProperties(aNames
, aValues
);
656 IMPL_LINK( ScViewCfg
, DisplayCommitHdl
, void *, EMPTYARG
)
658 Sequence
<OUString
> aNames
= GetDisplayPropertyNames();
659 Sequence
<Any
> aValues(aNames
.getLength());
660 Any
* pValues
= aValues
.getArray();
662 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
666 case SCDISPLAYOPT_FORMULA
:
667 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_FORMULAS
) );
669 case SCDISPLAYOPT_ZEROVALUE
:
670 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_NULLVALS
) );
672 case SCDISPLAYOPT_NOTETAG
:
673 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_NOTES
) );
675 case SCDISPLAYOPT_VALUEHI
:
676 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_SYNTAX
) );
678 case SCDISPLAYOPT_ANCHOR
:
679 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_ANCHOR
) );
681 case SCDISPLAYOPT_TEXTOVER
:
682 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], GetOption( VOPT_CLIPMARKS
) );
684 case SCDISPLAYOPT_OBJECTGRA
:
685 pValues
[nProp
] <<= (sal_Int32
) GetObjMode( VOBJ_TYPE_OLE
);
687 case SCDISPLAYOPT_CHART
:
688 pValues
[nProp
] <<= (sal_Int32
) GetObjMode( VOBJ_TYPE_CHART
);
690 case SCDISPLAYOPT_DRAWING
:
691 pValues
[nProp
] <<= (sal_Int32
) GetObjMode( VOBJ_TYPE_DRAW
);
695 aDisplayItem
.PutProperties(aNames
, aValues
);
700 IMPL_LINK( ScViewCfg
, GridCommitHdl
, void *, EMPTYARG
)
702 const ScGridOptions
& rGrid
= GetGridOptions();
704 Sequence
<OUString
> aNames
= GetGridPropertyNames();
705 Sequence
<Any
> aValues(aNames
.getLength());
706 Any
* pValues
= aValues
.getArray();
708 for(int nProp
= 0; nProp
< aNames
.getLength(); nProp
++)
712 case SCGRIDOPT_RESOLU_X
:
713 pValues
[nProp
] <<= (sal_Int32
) rGrid
.GetFldDrawX();
715 case SCGRIDOPT_RESOLU_Y
:
716 pValues
[nProp
] <<= (sal_Int32
) rGrid
.GetFldDrawY();
718 case SCGRIDOPT_SUBDIV_X
:
719 pValues
[nProp
] <<= (sal_Int32
) rGrid
.GetFldDivisionX();
721 case SCGRIDOPT_SUBDIV_Y
:
722 pValues
[nProp
] <<= (sal_Int32
) rGrid
.GetFldDivisionY();
724 case SCGRIDOPT_OPTION_X
:
725 pValues
[nProp
] <<= (sal_Int32
) rGrid
.GetFldSnapX();
727 case SCGRIDOPT_OPTION_Y
:
728 pValues
[nProp
] <<= (sal_Int32
) rGrid
.GetFldSnapY();
730 case SCGRIDOPT_SNAPTOGRID
:
731 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], rGrid
.GetUseGridSnap() );
733 case SCGRIDOPT_SYNCHRON
:
734 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], rGrid
.GetSynchronize() );
736 case SCGRIDOPT_VISIBLE
:
737 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], rGrid
.GetGridVisible() );
739 case SCGRIDOPT_SIZETOGRID
:
740 ScUnoHelpFunctions::SetBoolInAny( pValues
[nProp
], rGrid
.GetEqualGrid() );
744 aGridItem
.PutProperties(aNames
, aValues
);
749 void ScViewCfg::SetOptions( const ScViewOptions
& rNew
)
751 *(ScViewOptions
*)this = rNew
;
752 aLayoutItem
.SetModified();
753 aDisplayItem
.SetModified();
754 aGridItem
.SetModified();