diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2015-02-06 02:01:30 -0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-02-12 10:21:31 +0000 |
commit | 7215e025bbeb3e459f0be3d4d20a83ccd7435a02 (patch) | |
tree | 14e631874a393724059bfa7c8a570a66049de9b0 /starmath | |
parent | 5bfff14d8f2240ff37b91b78c337438214dfa1bc (diff) |
Math: Make use of officecfg API and remove unneeded code
Change-Id: I8b747588ebde70e322b8e6719fb7e2cf789e8a99
Reviewed-on: https://gerrit.libreoffice.org/14347
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/Library_sm.mk | 5 | ||||
-rw-r--r-- | starmath/source/cfgitem.cxx | 125 |
2 files changed, 28 insertions, 102 deletions
diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk index 7208dcb49c74..ce46d777af2e 100644 --- a/starmath/Library_sm.mk +++ b/starmath/Library_sm.mk @@ -27,7 +27,10 @@ $(eval $(call gb_Library_add_defs,sm,\ $(eval $(call gb_Library_use_external,sm,boost_headers)) -$(eval $(call gb_Library_use_custom_headers,sm,oox/generated)) +$(eval $(call gb_Library_use_custom_headers,sm,\ + officecfg/registry \ + oox/generated \ +)) $(eval $(call gb_Library_use_sdk_api,sm)) diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx index 8092dd87d8e8..648f1b0fdcb5 100644 --- a/starmath/source/cfgitem.cxx +++ b/starmath/source/cfgitem.cxx @@ -23,6 +23,7 @@ #include <vcl/settings.hxx> #include <sal/macros.h> +#include <officecfg/Office/Math.hxx> #include "cfgitem.hxx" #include "starmath.hrc" @@ -60,22 +61,6 @@ static Sequence< OUString > lcl_GetSymbolPropertyNames() }; } -static Sequence< OUString > lcl_GetMathPropertyNames() -{ - return Sequence< OUString > { - "Print/Title", - "Print/FormulaText", - "Print/Frame", - "Print/Size", - "Print/ZoomFactor", - "LoadSave/IsSaveOnlyUsedSymbols", - "Misc/IgnoreSpacesRight", - "View/ToolboxVisible", - "View/AutoRedraw", - "View/FormulaCursor" - }; -} - static Sequence< OUString > lcl_GetFormatPropertyNames() { //! Beware of order according to *_BEGIN *_END defines in format.hxx ! @@ -790,62 +775,17 @@ void SmMathConfig::LoadOther() if (!pOther) pOther = new SmCfgOther; - Sequence< OUString > aNames = lcl_GetMathPropertyNames(); - sal_Int32 nProps = aNames.getLength(); - - Sequence< Any > aValues( GetProperties( aNames ) ); - if (nProps && aValues.getLength() == nProps) - { - const Any *pValues = aValues.getConstArray(); - const Any *pVal = pValues; - - sal_Int16 nTmp16 = 0; - bool bTmp = false; - - // Print/Title - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bPrintTitle = bTmp; - ++pVal; - // Print/FormulaText - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bPrintFormulaText = bTmp; - ++pVal; - // Print/Frame - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bPrintFrame = bTmp; - ++pVal; - // Print/Size - if (pVal->hasValue() && (*pVal >>= nTmp16)) - pOther->ePrintSize = (SmPrintSize) nTmp16; - ++pVal; - // Print/ZoomFactor - if (pVal->hasValue() && (*pVal >>= nTmp16)) - pOther->nPrintZoomFactor = nTmp16; - ++pVal; - // LoadSave/IsSaveOnlyUsedSymbols - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bIsSaveOnlyUsedSymbols = bTmp; - ++pVal; - // Misc/IgnoreSpacesRight - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bIgnoreSpacesRight = bTmp; - ++pVal; - // View/ToolboxVisible - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bToolboxVisible = bTmp; - ++pVal; - // View/AutoRedraw - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bAutoRedraw = bTmp; - ++pVal; - // View/FormulaCursor - if (pVal->hasValue() && (*pVal >>= bTmp)) - pOther->bFormulaCursor = bTmp; - ++pVal; - - OSL_ENSURE( pVal - pValues == nProps, "property mismatch" ); - SetOtherModified( false ); - } + pOther->bPrintTitle = officecfg::Office::Math::Print::Title::get(); + pOther->bPrintFormulaText = officecfg::Office::Math::Print::FormulaText::get(); + pOther->bPrintFrame = officecfg::Office::Math::Print::Frame::get(); + pOther->ePrintSize = static_cast<SmPrintSize>(officecfg::Office::Math::Print::Size::get()); + pOther->nPrintZoomFactor = officecfg::Office::Math::Print::ZoomFactor::get(); + pOther->bIsSaveOnlyUsedSymbols = officecfg::Office::Math::LoadSave::IsSaveOnlyUsedSymbols::get(); + pOther->bIgnoreSpacesRight = officecfg::Office::Math::Misc::IgnoreSpacesRight::get(); + pOther->bToolboxVisible = officecfg::Office::Math::View::ToolboxVisible::get(); + pOther->bAutoRedraw = officecfg::Office::Math::View::AutoRedraw::get(); + pOther->bFormulaCursor = officecfg::Office::Math::View::FormulaCursor::get(); + SetOtherModified( false ); } @@ -854,37 +794,20 @@ void SmMathConfig::SaveOther() if (!pOther || !IsOtherModified()) return; - const Sequence< OUString > aNames = lcl_GetMathPropertyNames(); - sal_Int32 nProps = aNames.getLength(); + std::shared_ptr<comphelper::ConfigurationChanges> batch(comphelper::ConfigurationChanges::create()); - Sequence< Any > aValues( nProps ); - Any *pValues = aValues.getArray(); - Any *pValue = pValues; - - // Print/Title - *pValue++ <<= pOther->bPrintTitle; - // Print/FormulaText - *pValue++ <<= pOther->bPrintFormulaText; - // Print/Frame - *pValue++ <<= pOther->bPrintFrame; - // Print/Size - *pValue++ <<= (sal_Int16) pOther->ePrintSize; - // Print/ZoomFactor - *pValue++ <<= (sal_Int16) pOther->nPrintZoomFactor; - // LoadSave/IsSaveOnlyUsedSymbols - *pValue++ <<= pOther->bIsSaveOnlyUsedSymbols; - // Misc/IgnoreSpacesRight - *pValue++ <<= pOther->bIgnoreSpacesRight; - // View/ToolboxVisible - *pValue++ <<= pOther->bToolboxVisible; - // View/AutoRedraw - *pValue++ <<= pOther->bAutoRedraw; - // View/FormulaCursor - *pValue++ <<= pOther->bFormulaCursor; - - OSL_ENSURE( pValue - pValues == nProps, "property mismatch" ); - PutProperties( aNames , aValues ); + officecfg::Office::Math::Print::Title::set(pOther->bPrintTitle, batch); + officecfg::Office::Math::Print::FormulaText::set(pOther->bPrintFormulaText, batch); + officecfg::Office::Math::Print::Frame::set(pOther->bPrintFrame, batch); + officecfg::Office::Math::Print::Size::set(pOther->ePrintSize, batch); + officecfg::Office::Math::Print::ZoomFactor::set(pOther->nPrintZoomFactor, batch); + officecfg::Office::Math::LoadSave::IsSaveOnlyUsedSymbols::set(pOther->bIsSaveOnlyUsedSymbols, batch); + officecfg::Office::Math::Misc::IgnoreSpacesRight::set(pOther->bIgnoreSpacesRight, batch); + officecfg::Office::Math::View::ToolboxVisible::set(pOther->bToolboxVisible, batch); + officecfg::Office::Math::View::AutoRedraw::set(pOther->bAutoRedraw, batch); + officecfg::Office::Math::View::FormulaCursor::set(pOther->bFormulaCursor, batch); + batch->commit(); SetOtherModified( false ); } |