summaryrefslogtreecommitdiff
path: root/starmath/source/cfgitem.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-05-26 08:38:37 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-05-26 06:47:56 +0000
commitaad92a7ce2f74782064a69c1f3797544bd3298ee (patch)
treed48d0707fc9af909816e2cfb5e87c2ed3a1ad654 /starmath/source/cfgitem.cxx
parent01ef2044d0b2c3429eca71de6afef0241e0196f3 (diff)
loplugin:unnecessarysuperclass, merge SmMathConfig with SmConfig
Change-Id: I2c431e9f72f5dee14cf1b603b11972a2e9d88725 Reviewed-on: https://gerrit.libreoffice.org/15902 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'starmath/source/cfgitem.cxx')
-rw-r--r--starmath/source/cfgitem.cxx70
1 files changed, 70 insertions, 0 deletions
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 7616043124e8..14029a7c62e8 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -19,6 +19,11 @@
#include <vector>
+#include <svl/itemset.hxx>
+#include <svl/stritem.hxx>
+#include <svl/intitem.hxx>
+#include <svl/itempool.hxx>
+#include <svl/eitem.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
@@ -1137,5 +1142,70 @@ void SmMathConfig::Notify( const com::sun::star::uno::Sequence< OUString >& )
{}
+void SmMathConfig::ItemSetToConfig(const SfxItemSet &rSet)
+{
+ const SfxPoolItem *pItem = NULL;
+
+ sal_uInt16 nU16;
+ bool bVal;
+ if (rSet.GetItemState(SID_PRINTSIZE, true, &pItem) == SfxItemState::SET)
+ { nU16 = static_cast<const SfxUInt16Item *>(pItem)->GetValue();
+ SetPrintSize( (SmPrintSize) nU16 );
+ }
+ if (rSet.GetItemState(SID_PRINTZOOM, true, &pItem) == SfxItemState::SET)
+ { nU16 = static_cast<const SfxUInt16Item *>(pItem)->GetValue();
+ SetPrintZoomFactor( nU16 );
+ }
+ if (rSet.GetItemState(SID_PRINTTITLE, true, &pItem) == SfxItemState::SET)
+ { bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
+ SetPrintTitle( bVal );
+ }
+ if (rSet.GetItemState(SID_PRINTTEXT, true, &pItem) == SfxItemState::SET)
+ { bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
+ SetPrintFormulaText( bVal );
+ }
+ if (rSet.GetItemState(SID_PRINTFRAME, true, &pItem) == SfxItemState::SET)
+ { bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
+ SetPrintFrame( bVal );
+ }
+ if (rSet.GetItemState(SID_AUTOREDRAW, true, &pItem) == SfxItemState::SET)
+ { bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
+ SetAutoRedraw( bVal );
+ }
+ if (rSet.GetItemState(SID_NO_RIGHT_SPACES, true, &pItem) == SfxItemState::SET)
+ { bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
+ if (IsIgnoreSpacesRight() != bVal)
+ {
+ SetIgnoreSpacesRight( bVal );
+
+ // reformat (displayed) formulas accordingly
+ Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
+ }
+ }
+ if (rSet.GetItemState(SID_SAVE_ONLY_USED_SYMBOLS, true, &pItem) == SfxItemState::SET)
+ { bVal = static_cast<const SfxBoolItem *>(pItem)->GetValue();
+ SetSaveOnlyUsedSymbols( bVal );
+ }
+
+ SaveOther();
+}
+
+
+void SmMathConfig::ConfigToItemSet(SfxItemSet &rSet) const
+{
+ const SfxItemPool *pPool = rSet.GetPool();
+
+ rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
+ (sal_uInt16) GetPrintSize()));
+ rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
+ (sal_uInt16) GetPrintZoomFactor()));
+
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT), IsPrintFormulaText()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
+ rSet.Put(SfxBoolItem(pPool->GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), IsSaveOnlyUsedSymbols()));
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */