[Libreoffice-commits] core.git: 2 commits - starmath/Library_sm.mk starmath/source sw/source

Marcos Paulo de Souza marcos.souza.org at gmail.com
Thu Feb 12 02:21:43 PST 2015


 starmath/Library_sm.mk             |    5 +
 starmath/source/cfgitem.cxx        |  125 +++++++------------------------------
 sw/source/uibase/shells/drawsh.cxx |   10 ++
 3 files changed, 37 insertions(+), 103 deletions(-)

New commits:
commit 7215e025bbeb3e459f0be3d4d20a83ccd7435a02
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Fri Feb 6 02:01:30 2015 -0200

    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 at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/starmath/Library_sm.mk b/starmath/Library_sm.mk
index 7208dcb..ce46d77 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 8092dd8..648f1b0 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 );
 }
 
commit 5bfff14d8f2240ff37b91b78c337438214dfa1bc
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Feb 12 11:00:20 2015 +0100

    tdf#89266 SwDrawShell::GetState: fix crash on adding textbox to fontwork
    
    Till we find a use case where it makes sense to support this, just hide
    the menu item to avoid the crash.
    
    Change-Id: Ic1df38edc38495d7899038ec2b8ad753da87d352

diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index e138418..80cb4c4 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -498,7 +498,15 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
                     SwFrmFmt* pFrmFmt = ::FindFrmFmt(pObj);
                     // Allow creating a TextBox only in case this is a draw format without a TextBox so far.
                     if (pFrmFmt && pFrmFmt->Which() == RES_DRAWFRMFMT && !SwTextBoxHelper::findTextBox(pFrmFmt))
-                        bDisable = false;
+                    {
+                        if (SdrObjCustomShape* pCustomShape = PTR_CAST(SdrObjCustomShape, pObj))
+                        {
+                            const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(pCustomShape->GetMergedItem(SDRATTR_CUSTOMSHAPE_GEOMETRY));
+                            if (const uno::Any* pAny = rGeometryItem.GetPropertyValueByName("Type"))
+                                // But still disallow fontwork shapes.
+                                bDisable = pAny->get<OUString>().startsWith("fontwork-");
+                        }
+                    }
                 }
 
                 if (bDisable)


More information about the Libreoffice-commits mailing list