summaryrefslogtreecommitdiff
path: root/starmath/source
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
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')
-rw-r--r--starmath/source/ElementsDockingWindow.cxx1
-rw-r--r--starmath/source/cfgitem.cxx70
-rw-r--r--starmath/source/cfgitem.hxx13
-rw-r--r--starmath/source/config.cxx119
-rw-r--r--starmath/source/dialog.cxx2
-rw-r--r--starmath/source/document.cxx2
-rw-r--r--starmath/source/edit.cxx2
-rw-r--r--starmath/source/mathmlexport.cxx4
-rw-r--r--starmath/source/parse.cxx2
-rw-r--r--starmath/source/smmod.cxx6
-rw-r--r--starmath/source/symbol.cxx1
-rw-r--r--starmath/source/unomodel.cxx4
-rw-r--r--starmath/source/view.cxx2
13 files changed, 92 insertions, 136 deletions
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index d3fcccb2554c..87680d2ca974 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -21,7 +21,6 @@
#include <starmath.hrc>
#include <smmod.hxx>
-#include <config.hxx>
#include <view.hxx>
#include <visitors.hxx>
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: */
diff --git a/starmath/source/cfgitem.hxx b/starmath/source/cfgitem.hxx
index 98122903497a..1fe89b424f05 100644
--- a/starmath/source/cfgitem.hxx
+++ b/starmath/source/cfgitem.hxx
@@ -39,6 +39,7 @@ class SmSym;
class SmFormat;
namespace vcl { class Font; }
struct SmCfgOther;
+class SfxItemSet;
struct SmFontFormat
{
@@ -91,14 +92,15 @@ public:
void SetModified( bool bVal ) { bModified = bVal; }
};
-class SmMathConfig : public utl::ConfigItem
+class SmMathConfig : public utl::ConfigItem, public SfxBroadcaster
{
std::unique_ptr<SmFormat> pFormat;
std::unique_ptr<SmCfgOther> pOther;
std::unique_ptr<SmFontFormatList> pFontFormatList;
std::unique_ptr<SmSymbolManager> pSymbolMgr;
- bool bIsOtherModified;
- bool bIsFormatModified;
+ bool bIsOtherModified;
+ bool bIsFormatModified;
+ SmFontPickList vFontPickList[7];
SmMathConfig(const SmMathConfig&) SAL_DELETED_FUNCTION;
SmMathConfig& operator=(const SmMathConfig&) SAL_DELETED_FUNCTION;
@@ -173,6 +175,11 @@ public:
void SetAutoRedraw( bool bVal );
bool IsShowFormulaCursor() const;
void SetShowFormulaCursor( bool bVal );
+
+ SmFontPickList & GetFontPickList(sal_uInt16 nIdent) { return vFontPickList[nIdent]; }
+
+ void ItemSetToConfig(const SfxItemSet &rSet);
+ void ConfigToItemSet(SfxItemSet &rSet) const;
};
#endif
diff --git a/starmath/source/config.cxx b/starmath/source/config.cxx
deleted file mode 100644
index 8b47ce51444a..000000000000
--- a/starmath/source/config.cxx
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <svl/itemset.hxx>
-#include <svl/hint.hxx>
-#include <svl/smplhint.hxx>
-#include <unotools/pathoptions.hxx>
-#include <sfx2/sfxsids.hrc>
-#include <svl/eitem.hxx>
-#include <svl/itempool.hxx>
-#include <svl/stritem.hxx>
-#include <svl/intitem.hxx>
-#include <tools/stream.hxx>
-
-
-#include "config.hxx"
-#include "format.hxx"
-#include "smmod.hxx"
-#include "starmath.hrc"
-
-
-
-SmConfig::SmConfig()
-{
-}
-
-
-SmConfig::~SmConfig()
-{
-}
-
-
-void SmConfig::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 SmConfig::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: */
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index c305e066ff84..5754b8377bf2 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -39,7 +39,7 @@
#include "dialog.hxx"
#include "starmath.hrc"
-#include "config.hxx"
+#include "cfgitem.hxx"
#include "smmod.hxx"
#include "symbol.hxx"
#include "view.hxx"
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 26e95ad24fb9..a9b6d9881b15 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -73,7 +73,6 @@
#include <sfx2/sfx.hrc>
#include <document.hxx>
#include <action.hxx>
-#include <config.hxx>
#include <dialog.hxx>
#include <format.hxx>
#include <smdll.hxx>
@@ -94,6 +93,7 @@
#include <tools/diagnose_ex.h>
#include "visitors.hxx"
#include "accessibility.hxx"
+#include "cfgitem.hxx"
#include <memory>
using namespace ::com::sun::star;
diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx
index e42749eba4f9..72b7b292d77b 100644
--- a/starmath/source/edit.cxx
+++ b/starmath/source/edit.cxx
@@ -47,7 +47,7 @@
#include "edit.hxx"
#include "view.hxx"
#include "document.hxx"
-#include "config.hxx"
+#include "cfgitem.hxx"
#include "accessibility.hxx"
#include <memory>
diff --git a/starmath/source/mathmlexport.cxx b/starmath/source/mathmlexport.cxx
index 060451bd23a5..af1091c3b400 100644
--- a/starmath/source/mathmlexport.cxx
+++ b/starmath/source/mathmlexport.cxx
@@ -71,7 +71,7 @@
#include <unomodel.hxx>
#include <document.hxx>
#include <utility.hxx>
-#include <config.hxx>
+#include "cfgitem.hxx"
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
@@ -578,7 +578,7 @@ void SmXMLExport::GetConfigurationSettings( Sequence < PropertyValue > & rProps)
PropertyValue* pProps = rProps.getArray();
if (pProps)
{
- SmConfig *pConfig = SM_MOD()->GetConfig();
+ SmMathConfig *pConfig = SM_MOD()->GetConfig();
const bool bUsedSymbolsOnly = pConfig && pConfig->IsSaveOnlyUsedSymbols();
const OUString sFormula ( "Formula" );
diff --git a/starmath/source/parse.cxx b/starmath/source/parse.cxx
index cde1214f2072..fb7ac7337f80 100644
--- a/starmath/source/parse.cxx
+++ b/starmath/source/parse.cxx
@@ -28,7 +28,7 @@
#include "starmath.hrc"
#include "smdll.hxx"
#include "smmod.hxx"
-#include "config.hxx"
+#include "cfgitem.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::i18n;
diff --git a/starmath/source/smmod.cxx b/starmath/source/smmod.cxx
index a3c9dd478c0d..771528a0552d 100644
--- a/starmath/source/smmod.cxx
+++ b/starmath/source/smmod.cxx
@@ -33,7 +33,7 @@
#include <tools/rtti.hxx>
#include "smmod.hxx"
#include "symbol.hxx"
-#include "config.hxx"
+#include "cfgitem.hxx"
#include "dialog.hxx"
#include "edit.hxx"
#include "view.hxx"
@@ -212,10 +212,10 @@ void SmModule::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32
ApplyColorConfigValues(*mpColorConfig);
}
-SmConfig * SmModule::GetConfig()
+SmMathConfig * SmModule::GetConfig()
{
if(!mpConfig)
- mpConfig.reset(new SmConfig);
+ mpConfig.reset(new SmMathConfig);
return mpConfig.get();
}
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index 899380b7bd8a..52d2a882ea24 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -32,7 +32,6 @@
#include "view.hxx"
#include "utility.hxx"
#include "dialog.hxx"
-#include "config.hxx"
#include "cfgitem.hxx"
#include "smmod.hxx"
#include "starmath.hrc"
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index dbebc9b92786..4a6c73d5b0b3 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -44,8 +44,8 @@
#include <view.hxx>
#include <symbol.hxx>
#include <starmath.hrc>
-#include <config.hxx>
#include <smdll.hxx>
+#include "cfgitem.hxx"
using namespace ::cppu;
using namespace ::std;
@@ -66,7 +66,7 @@ SmPrintUIOptions::SmPrintUIOptions()
return;
SmModule *pp = SM_MOD();
- SmConfig *pConfig = pp->GetConfig();
+ SmMathConfig *pConfig = pp->GetConfig();
SAL_WARN_IF( !pConfig, "starmath", "SmConfig not found" );
if (!pConfig)
return;
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index 3633cb6b4fd7..0086cadda2a1 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -64,7 +64,7 @@
#include "unomodel.hxx"
#include "view.hxx"
-#include "config.hxx"
+#include "cfgitem.hxx"
#include "dialog.hxx"
#include "document.hxx"
#include "starmath.hrc"