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