diff options
-rw-r--r-- | starmath/Library_sm.mk | 1 | ||||
-rw-r--r-- | starmath/inc/config.hxx | 48 | ||||
-rw-r--r-- | starmath/inc/smmod.hxx | 6 | ||||
-rw-r--r-- | starmath/source/ElementsDockingWindow.cxx | 1 | ||||
-rw-r--r-- | starmath/source/cfgitem.cxx | 70 | ||||
-rw-r--r-- | starmath/source/cfgitem.hxx | 13 | ||||
-rw-r--r-- | starmath/source/config.cxx | 119 | ||||
-rw-r--r-- | starmath/source/dialog.cxx | 2 | ||||
-rw-r--r-- | starmath/source/document.cxx | 2 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 2 | ||||
-rw-r--r-- | starmath/source/mathmlexport.cxx | 4 | ||||
-rw-r--r-- | starmath/source/parse.cxx | 2 | ||||
-rw-r--r-- | starmath/source/smmod.cxx | 6 | ||||
-rw-r--r-- | starmath/source/symbol.cxx | 1 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 4 | ||||
-rw-r--r-- | starmath/source/view.cxx | 2 |
16 files changed, 95 insertions, 188 deletions
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 203143f09fe8..a648b8c2bc1e 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -65,7 +65,6 @@ $(eval $(call gb_Library_add_exception_objects,sm,\ starmath/source/action \ starmath/source/caret \ starmath/source/cfgitem \ - starmath/source/config \ starmath/source/cursor \ starmath/source/dialog \ starmath/source/document \ diff --git a/starmath/inc/config.hxx b/starmath/inc/config.hxx deleted file mode 100644 index 559545bcec85..000000000000 --- a/starmath/inc/config.hxx +++ /dev/null @@ -1,48 +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 . - */ -#ifndef INCLUDED_STARMATH_INC_CONFIG_HXX -#define INCLUDED_STARMATH_INC_CONFIG_HXX - -#include <svl/SfxBroadcaster.hxx> -#include <svl/lstner.hxx> -#include "format.hxx" - -#include "cfgitem.hxx" - - -class SfxItemSet; - -class SmConfig : public SmMathConfig, public SfxBroadcaster -{ - SmFontPickList vFontPickList[7]; - -public: - SmConfig(); - virtual ~SmConfig(); - - SmFontPickList & GetFontPickList(sal_uInt16 nIdent) { return vFontPickList[nIdent]; } - - void ItemSetToConfig(const SfxItemSet &rSet); - void ConfigToItemSet(SfxItemSet &rSet) const; -}; - -#endif - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/starmath/inc/smmod.hxx b/starmath/inc/smmod.hxx index 59020d815280..9ee0deb9cce8 100644 --- a/starmath/inc/smmod.hxx +++ b/starmath/inc/smmod.hxx @@ -34,9 +34,9 @@ #include <memory> class SfxObjectFactory; -class SmConfig; class SmModule; class SmSymbolManager; +class SmMathConfig; /************************************************************************* |* @@ -88,7 +88,7 @@ public: class SmModule : public SfxModule, utl::ConfigurationListener { std::unique_ptr<svtools::ColorConfig> mpColorConfig; - std::unique_ptr<SmConfig> mpConfig; + std::unique_ptr<SmMathConfig> mpConfig; std::unique_ptr<SmLocalizedSymbolData> mpLocSymbolData; std::unique_ptr<SvtSysLocale> mpSysLocale; VclPtr<VirtualDevice> mpVirtualDev; @@ -111,7 +111,7 @@ public: svtools::ColorConfig & GetColorConfig(); - SmConfig * GetConfig(); + SmMathConfig * GetConfig(); SmSymbolManager & GetSymbolManager(); SmLocalizedSymbolData & GetLocSymbolData(); 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" |