eb9ea2a
From aa99cd6187c29bd958d4effaafce4d3a12fa31c0 Mon Sep 17 00:00:00 2001
eb9ea2a
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
eb9ea2a
Date: Mon, 8 Dec 2014 09:56:33 +0000
eb9ea2a
Subject: [PATCH] Resolves: rhbz#1164614 xslt dialog crashes if there are no
eb9ea2a
 entries
eb9ea2a
eb9ea2a
Change-Id: Id7d967389cbc9f8ae120749bbe1c79bbbe46b212
eb9ea2a
---
eb9ea2a
 filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 15 +++++++++++++++
eb9ea2a
 filter/source/xsltdialog/xmlfiltersettingsdialog.hxx |  1 +
eb9ea2a
 2 files changed, 16 insertions(+)
eb9ea2a
eb9ea2a
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
eb9ea2a
index 8d85688..e698688 100644
eb9ea2a
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
eb9ea2a
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
eb9ea2a
@@ -1355,6 +1355,16 @@ SvxPathControl::SvxPathControl(Window* pParent)
eb9ea2a
 #define ITEMID_NAME     1
eb9ea2a
 #define ITEMID_TYPE     2
eb9ea2a
 
eb9ea2a
+Size SvxPathControl::GetOptimalSize() const
eb9ea2a
+{
eb9ea2a
+    Size aDefSize(LogicToPixel(Size(150, 0), MapMode(MAP_APPFONT)));
eb9ea2a
+    Size aOptSize(VclVBox::GetOptimalSize());
eb9ea2a
+    long nRowHeight(GetTextHeight());
eb9ea2a
+    aOptSize.Height() = nRowHeight * 10;
eb9ea2a
+    aOptSize.Width() = std::max(aDefSize.Width(), aOptSize.Width());
eb9ea2a
+    return aOptSize;
eb9ea2a
+}
eb9ea2a
+
eb9ea2a
 void SvxPathControl::setAllocation(const Size &rAllocation)
eb9ea2a
 {
eb9ea2a
     VclVBox::setAllocation(rAllocation);
eb9ea2a
@@ -1366,6 +1376,11 @@ void SvxPathControl::setAllocation(const Size &rAllocation)
eb9ea2a
     {
eb9ea2a
         std::vector<long> aWidths;
eb9ea2a
         m_pFocusCtrl->getPreferredDimensions(aWidths);
eb9ea2a
+        if (aWidths.empty())
eb9ea2a
+        {
eb9ea2a
+            bHasBeenShown = false;
eb9ea2a
+            return;
eb9ea2a
+        }
eb9ea2a
         long nFirstColumnWidth = aWidths[1];
eb9ea2a
         m_pHeaderBar->SetItemSize(ITEMID_NAME, nFirstColumnWidth);
eb9ea2a
         m_pHeaderBar->SetItemSize(ITEMID_TYPE, 0xFFFF);
eb9ea2a
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
eb9ea2a
index 7fbd362..86828af 100644
eb9ea2a
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
eb9ea2a
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
eb9ea2a
@@ -44,6 +44,7 @@ private:
eb9ea2a
     HeaderBar* m_pHeaderBar;
eb9ea2a
     XMLFilterListBox* m_pFocusCtrl;
eb9ea2a
 protected:
eb9ea2a
+    virtual Size GetOptimalSize() const SAL_OVERRIDE;
eb9ea2a
     virtual void setAllocation(const Size &rAllocation) SAL_OVERRIDE;
eb9ea2a
 public:
eb9ea2a
     SvxPathControl(Window* pParent);
eb9ea2a
-- 
eb9ea2a
1.9.3
eb9ea2a