1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_starmath.hxx"
32 #include <svl/itemset.hxx>
33 #include <svl/hint.hxx>
34 #include <svl/smplhint.hxx>
35 #include <unotools/pathoptions.hxx>
36 #include <sfx2/sfxsids.hrc>
37 #include <svl/eitem.hxx>
38 #include <svl/itempool.hxx>
39 #include <svl/stritem.hxx>
40 #include <svl/intitem.hxx>
41 #include <tools/stream.hxx>
48 #include "starmath.hrc"
51 /////////////////////////////////////////////////////////////////
63 void SmConfig::ItemSetToConfig(const SfxItemSet
&rSet
)
65 const SfxPoolItem
*pItem
= NULL
;
69 if (rSet
.GetItemState(SID_PRINTSIZE
, TRUE
, &pItem
) == SFX_ITEM_SET
)
70 { nU16
= ((const SfxUInt16Item
*) pItem
)->GetValue();
71 SetPrintSize( (SmPrintSize
) nU16
);
73 if (rSet
.GetItemState(SID_PRINTZOOM
, TRUE
, &pItem
) == SFX_ITEM_SET
)
74 { nU16
= ((const SfxUInt16Item
*) pItem
)->GetValue();
75 SetPrintZoomFactor( nU16
);
77 if (rSet
.GetItemState(SID_PRINTTITLE
, TRUE
, &pItem
) == SFX_ITEM_SET
)
78 { bVal
= ((const SfxBoolItem
*) pItem
)->GetValue();
79 SetPrintTitle( bVal
);
81 if (rSet
.GetItemState(SID_PRINTTEXT
, TRUE
, &pItem
) == SFX_ITEM_SET
)
82 { bVal
= ((const SfxBoolItem
*) pItem
)->GetValue();
83 SetPrintFormulaText( bVal
);
85 if (rSet
.GetItemState(SID_PRINTFRAME
, TRUE
, &pItem
) == SFX_ITEM_SET
)
86 { bVal
= ((const SfxBoolItem
*) pItem
)->GetValue();
87 SetPrintFrame( bVal
);
89 if (rSet
.GetItemState(SID_AUTOREDRAW
, TRUE
, &pItem
) == SFX_ITEM_SET
)
90 { bVal
= ((const SfxBoolItem
*) pItem
)->GetValue();
91 SetAutoRedraw( bVal
);
93 if (rSet
.GetItemState(SID_NO_RIGHT_SPACES
, TRUE
, &pItem
) == SFX_ITEM_SET
)
94 { bVal
= ((const SfxBoolItem
*) pItem
)->GetValue();
95 if (IsIgnoreSpacesRight() != bVal
)
97 SetIgnoreSpacesRight( bVal
);
99 // (angezeigte) Formeln muessen entsprechen neu formatiert werden.
100 // Das erreichen wir mit:
101 Broadcast(SfxSimpleHint(HINT_FORMATCHANGED
));
109 void SmConfig::ConfigToItemSet(SfxItemSet
&rSet
) const
111 const SfxItemPool
*pPool
= rSet
.GetPool();
113 rSet
.Put(SfxUInt16Item(pPool
->GetWhich(SID_PRINTSIZE
),
114 (UINT16
) GetPrintSize()));
115 rSet
.Put(SfxUInt16Item(pPool
->GetWhich(SID_PRINTZOOM
),
116 (UINT16
) GetPrintZoomFactor()));
118 rSet
.Put(SfxBoolItem(pPool
->GetWhich(SID_PRINTTITLE
), IsPrintTitle()));
119 rSet
.Put(SfxBoolItem(pPool
->GetWhich(SID_PRINTTEXT
), IsPrintFormulaText()));
120 rSet
.Put(SfxBoolItem(pPool
->GetWhich(SID_PRINTFRAME
), IsPrintFrame()));
121 rSet
.Put(SfxBoolItem(pPool
->GetWhich(SID_AUTOREDRAW
), IsAutoRedraw()));
122 rSet
.Put(SfxBoolItem(pPool
->GetWhich(SID_NO_RIGHT_SPACES
), IsIgnoreSpacesRight()));
126 /////////////////////////////////////////////////////////////////