sw/source/uibase/shells/drawsh.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 4f5f5b5d0e141e1d719eae3ba243ccf6e4e50e41
Author: Miklos Vajna <vmik...@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.
    
    (cherry picked from commit 5bfff14d8f2240ff37b91b78c337438214dfa1bc)
    
    Change-Id: Ic1df38edc38495d7899038ec2b8ad753da87d352
    Reviewed-on: https://gerrit.libreoffice.org/14726
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/sw/source/uibase/shells/drawsh.cxx 
b/sw/source/uibase/shells/drawsh.cxx
index 5986acb..86202dd 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -531,7 +531,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)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to