Update ooo320-m1
[ooovba.git] / starmath / source / config.cxx
blob1ebd6d65bf842fdee347dc0dd867c2cb1d580729
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: config.cxx,v $
10 * $Revision: 1.12 $
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_starmath.hxx"
35 #include <svtools/itemset.hxx>
36 #include <svtools/hint.hxx>
37 #include <svtools/smplhint.hxx>
38 #include <svtools/pathoptions.hxx>
39 #include <sfx2/sfxsids.hrc>
40 #include <svtools/eitem.hxx>
41 #include <svtools/itempool.hxx>
42 #include <svtools/stritem.hxx>
43 #include <svtools/intitem.hxx>
44 #include <tools/stream.hxx>
47 #include "config.hxx"
48 #include "format.hxx"
49 #include "smmod.hxx"
50 #ifndef _STARMATH_HRC
51 #include "starmath.hrc"
52 #endif
54 /////////////////////////////////////////////////////////////////
56 SmConfig::SmConfig()
61 SmConfig::~SmConfig()
66 void SmConfig::ItemSetToConfig(const SfxItemSet &rSet)
68 const SfxPoolItem *pItem = NULL;
70 UINT16 nU16;
71 BOOL bVal;
72 if (rSet.GetItemState(SID_PRINTSIZE, TRUE, &pItem) == SFX_ITEM_SET)
73 { nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
74 SetPrintSize( (SmPrintSize) nU16 );
76 if (rSet.GetItemState(SID_PRINTZOOM, TRUE, &pItem) == SFX_ITEM_SET)
77 { nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
78 SetPrintZoomFactor( nU16 );
80 if (rSet.GetItemState(SID_PRINTTITLE, TRUE, &pItem) == SFX_ITEM_SET)
81 { bVal = ((const SfxBoolItem *) pItem)->GetValue();
82 SetPrintTitle( bVal );
84 if (rSet.GetItemState(SID_PRINTTEXT, TRUE, &pItem) == SFX_ITEM_SET)
85 { bVal = ((const SfxBoolItem *) pItem)->GetValue();
86 SetPrintFormulaText( bVal );
88 if (rSet.GetItemState(SID_PRINTFRAME, TRUE, &pItem) == SFX_ITEM_SET)
89 { bVal = ((const SfxBoolItem *) pItem)->GetValue();
90 SetPrintFrame( bVal );
92 if (rSet.GetItemState(SID_AUTOREDRAW, TRUE, &pItem) == SFX_ITEM_SET)
93 { bVal = ((const SfxBoolItem *) pItem)->GetValue();
94 SetAutoRedraw( bVal );
96 if (rSet.GetItemState(SID_NO_RIGHT_SPACES, TRUE, &pItem) == SFX_ITEM_SET)
97 { bVal = ((const SfxBoolItem *) pItem)->GetValue();
98 if (IsIgnoreSpacesRight() != bVal)
100 SetIgnoreSpacesRight( bVal );
102 // (angezeigte) Formeln muessen entsprechen neu formatiert werden.
103 // Das erreichen wir mit:
104 Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
108 SaveOther();
112 void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
114 const SfxItemPool *pPool = rSet.GetPool();
116 rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
117 (UINT16) GetPrintSize()));
118 rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
119 (UINT16) GetPrintZoomFactor()));
121 rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
122 rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), IsPrintFormulaText()));
123 rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
124 rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
125 rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
129 /////////////////////////////////////////////////////////////////