1*d107581fSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*d107581fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*d107581fSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*d107581fSAndrew Rist * distributed with this work for additional information 6*d107581fSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*d107581fSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*d107581fSAndrew Rist * "License"); you may not use this file except in compliance 9*d107581fSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*d107581fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*d107581fSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*d107581fSAndrew Rist * software distributed under the License is distributed on an 15*d107581fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*d107581fSAndrew Rist * KIND, either express or implied. See the License for the 17*d107581fSAndrew Rist * specific language governing permissions and limitations 18*d107581fSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*d107581fSAndrew Rist *************************************************************/ 21*d107581fSAndrew Rist 22*d107581fSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_starmath.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include <svl/itemset.hxx> 29cdf0e10cSrcweir #include <svl/hint.hxx> 30cdf0e10cSrcweir #include <svl/smplhint.hxx> 31cdf0e10cSrcweir #include <unotools/pathoptions.hxx> 32cdf0e10cSrcweir #include <sfx2/sfxsids.hrc> 33cdf0e10cSrcweir #include <svl/eitem.hxx> 34cdf0e10cSrcweir #include <svl/itempool.hxx> 35cdf0e10cSrcweir #include <svl/stritem.hxx> 36cdf0e10cSrcweir #include <svl/intitem.hxx> 37cdf0e10cSrcweir #include <tools/stream.hxx> 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir #include "config.hxx" 41cdf0e10cSrcweir #include "format.hxx" 42cdf0e10cSrcweir #include "smmod.hxx" 43cdf0e10cSrcweir #ifndef _STARMATH_HRC 44cdf0e10cSrcweir #include "starmath.hrc" 45cdf0e10cSrcweir #endif 46cdf0e10cSrcweir 47cdf0e10cSrcweir ///////////////////////////////////////////////////////////////// 48cdf0e10cSrcweir 49cdf0e10cSrcweir SmConfig::SmConfig() 50cdf0e10cSrcweir { 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir 54cdf0e10cSrcweir SmConfig::~SmConfig() 55cdf0e10cSrcweir { 56cdf0e10cSrcweir } 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir void SmConfig::ItemSetToConfig(const SfxItemSet &rSet) 60cdf0e10cSrcweir { 61cdf0e10cSrcweir const SfxPoolItem *pItem = NULL; 62cdf0e10cSrcweir 63cdf0e10cSrcweir sal_uInt16 nU16; 64cdf0e10cSrcweir sal_Bool bVal; 65cdf0e10cSrcweir if (rSet.GetItemState(SID_PRINTSIZE, sal_True, &pItem) == SFX_ITEM_SET) 66cdf0e10cSrcweir { nU16 = ((const SfxUInt16Item *) pItem)->GetValue(); 67cdf0e10cSrcweir SetPrintSize( (SmPrintSize) nU16 ); 68cdf0e10cSrcweir } 69cdf0e10cSrcweir if (rSet.GetItemState(SID_PRINTZOOM, sal_True, &pItem) == SFX_ITEM_SET) 70cdf0e10cSrcweir { nU16 = ((const SfxUInt16Item *) pItem)->GetValue(); 71cdf0e10cSrcweir SetPrintZoomFactor( nU16 ); 72cdf0e10cSrcweir } 73cdf0e10cSrcweir if (rSet.GetItemState(SID_PRINTTITLE, sal_True, &pItem) == SFX_ITEM_SET) 74cdf0e10cSrcweir { bVal = ((const SfxBoolItem *) pItem)->GetValue(); 75cdf0e10cSrcweir SetPrintTitle( bVal ); 76cdf0e10cSrcweir } 77cdf0e10cSrcweir if (rSet.GetItemState(SID_PRINTTEXT, sal_True, &pItem) == SFX_ITEM_SET) 78cdf0e10cSrcweir { bVal = ((const SfxBoolItem *) pItem)->GetValue(); 79cdf0e10cSrcweir SetPrintFormulaText( bVal ); 80cdf0e10cSrcweir } 81cdf0e10cSrcweir if (rSet.GetItemState(SID_PRINTFRAME, sal_True, &pItem) == SFX_ITEM_SET) 82cdf0e10cSrcweir { bVal = ((const SfxBoolItem *) pItem)->GetValue(); 83cdf0e10cSrcweir SetPrintFrame( bVal ); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir if (rSet.GetItemState(SID_AUTOREDRAW, sal_True, &pItem) == SFX_ITEM_SET) 86cdf0e10cSrcweir { bVal = ((const SfxBoolItem *) pItem)->GetValue(); 87cdf0e10cSrcweir SetAutoRedraw( bVal ); 88cdf0e10cSrcweir } 89cdf0e10cSrcweir if (rSet.GetItemState(SID_NO_RIGHT_SPACES, sal_True, &pItem) == SFX_ITEM_SET) 90cdf0e10cSrcweir { bVal = ((const SfxBoolItem *) pItem)->GetValue(); 91cdf0e10cSrcweir if (IsIgnoreSpacesRight() != bVal) 92cdf0e10cSrcweir { 93cdf0e10cSrcweir SetIgnoreSpacesRight( bVal ); 94cdf0e10cSrcweir 95cdf0e10cSrcweir // (angezeigte) Formeln muessen entsprechen neu formatiert werden. 96cdf0e10cSrcweir // Das erreichen wir mit: 97cdf0e10cSrcweir Broadcast(SfxSimpleHint(HINT_FORMATCHANGED)); 98cdf0e10cSrcweir } 99cdf0e10cSrcweir } 100cdf0e10cSrcweir if (rSet.GetItemState(SID_SAVE_ONLY_USED_SYMBOLS, sal_True, &pItem) == SFX_ITEM_SET) 101cdf0e10cSrcweir { bVal = ((const SfxBoolItem *) pItem)->GetValue(); 102cdf0e10cSrcweir SetSaveOnlyUsedSymbols( bVal ); 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir SaveOther(); 106cdf0e10cSrcweir } 107cdf0e10cSrcweir 108cdf0e10cSrcweir 109cdf0e10cSrcweir void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const 110cdf0e10cSrcweir { 111cdf0e10cSrcweir const SfxItemPool *pPool = rSet.GetPool(); 112cdf0e10cSrcweir 113cdf0e10cSrcweir rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE), 114cdf0e10cSrcweir (sal_uInt16) GetPrintSize())); 115cdf0e10cSrcweir rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM), 116cdf0e10cSrcweir (sal_uInt16) GetPrintZoomFactor())); 117cdf0e10cSrcweir 118cdf0e10cSrcweir rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle())); 119cdf0e10cSrcweir rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), IsPrintFormulaText())); 120cdf0e10cSrcweir rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame())); 121cdf0e10cSrcweir rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw())); 122cdf0e10cSrcweir rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight())); 123cdf0e10cSrcweir rSet.Put(SfxBoolItem(pPool->GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), IsSaveOnlyUsedSymbols())); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir 126cdf0e10cSrcweir 127cdf0e10cSrcweir ///////////////////////////////////////////////////////////////// 128cdf0e10cSrcweir 129cdf0e10cSrcweir 130