cui/source/dialogs/QrCodeGenDialog.cxx  |   10 +++-
 cui/source/inc/QrCodeGenDialog.hxx      |    2 
 cui/uiconfig/ui/qrcodegen.ui            |   80 ++++++++++++++++++--------------
 vcl/unx/generic/gdi/cairotextrender.cxx |    6 ++
 4 files changed, 62 insertions(+), 36 deletions(-)

New commits:
commit ebc7e13c0a79dbc5f21e78bcd9bb63a58c585f4a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Dec 8 11:00:00 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Dec 8 13:57:49 2022 +0000

    Resolves: tdf#146395 allow newlines in QR Codes
    
    Change-Id: Ib390d97866ab013770e4f1cbdfb529296d64c140
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143811
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx 
b/cui/source/dialogs/QrCodeGenDialog.cxx
index 3e7b48e7af86..e028d4d10e94 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -156,7 +156,7 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, 
Reference<XModel> xModel
                                  bool bEditExisting)
     : GenericDialogController(pParent, "cui/ui/qrcodegen.ui", 
"QrCodeGenDialog")
     , m_xModel(std::move(xModel))
-    , m_xEdittext(m_xBuilder->weld_entry("edit_text"))
+    , m_xEdittext(m_xBuilder->weld_text_view("edit_text"))
     , m_xECC{ m_xBuilder->weld_radio_button("button_low"),
               m_xBuilder->weld_radio_button("button_medium"),
               m_xBuilder->weld_radio_button("button_quartile"),
@@ -167,16 +167,22 @@ QrCodeGenDialog::QrCodeGenDialog(weld::Widget* pParent, 
Reference<XModel> xModel
     , mpParent(pParent)
 #endif
 {
+    m_xEdittext->set_size_request(m_xEdittext->get_approximate_digit_width() * 
28,
+                                  m_xEdittext->get_height_rows(6));
     if (!bEditExisting)
     {
+        OUString sSelection;
         // TODO: This only works in Writer doc. Should also work in shapes
         Reference<XIndexAccess> xSelections(m_xModel->getCurrentSelection(), 
UNO_QUERY);
         if (xSelections.is())
         {
             Reference<XTextRange> xSelection(xSelections->getByIndex(0), 
UNO_QUERY);
             if (xSelection.is())
-                m_xEdittext->set_text(xSelection->getString());
+                sSelection = xSelection->getString();
         }
+        if (!sSelection.isEmpty())
+            m_xEdittext->set_text(sSelection);
+        m_xEdittext->select_region(0, -1);
         return;
     }
 
diff --git a/cui/source/inc/QrCodeGenDialog.hxx 
b/cui/source/inc/QrCodeGenDialog.hxx
index 2c205c6a85d4..001df88c5581 100644
--- a/cui/source/inc/QrCodeGenDialog.hxx
+++ b/cui/source/inc/QrCodeGenDialog.hxx
@@ -30,7 +30,7 @@ protected:
 
 private:
     css::uno::Reference<css::frame::XModel> m_xModel;
-    std::unique_ptr<weld::Entry> m_xEdittext;
+    std::unique_ptr<weld::TextView> m_xEdittext;
     std::unique_ptr<weld::RadioButton> m_xECC[4];
     std::unique_ptr<weld::SpinButton> m_xSpinBorder;
     std::unique_ptr<weld::ComboBox> m_xComboType;
diff --git a/cui/uiconfig/ui/qrcodegen.ui b/cui/uiconfig/ui/qrcodegen.ui
index 4f015dccfde3..7078e3aa44a5 100644
--- a/cui/uiconfig/ui/qrcodegen.ui
+++ b/cui/uiconfig/ui/qrcodegen.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="cui">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkAdjustment" id="margin_value">
@@ -8,9 +8,12 @@
     <property name="step-increment">1</property>
     <property name="page-increment">10</property>
   </object>
+  <object class="GtkTextBuffer" id="textbuffer1">
+    <property name="text" translatable="yes" 
context="qrcodegen|edit_name">www.libreoffice.org</property>
+  </object>
   <object class="GtkDialog" id="QrCodeGenDialog">
-    <property name="can_focus">False</property>
-    <property name="border_width">6</property>
+    <property name="can-focus">False</property>
+    <property name="border-width">6</property>
     <property name="title" translatable="yes" 
context="qrcodegen|QrCodeGenDialog">QR and Barcode</property>
     <property name="modal">True</property>
     <property name="default-width">0</property>
@@ -95,43 +98,27 @@
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
                 <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
                 <property name="label-xalign">0</property>
                 <property name="shadow-type">none</property>
                 <child>
-                  <!-- n-columns=2 n-rows=3 -->
+                  <!-- n-columns=2 n-rows=4 -->
                   <object class="GtkGrid">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
                     <property name="margin-top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
                     <property name="row-spacing">6</property>
                     <property name="column-spacing">12</property>
-                    <child>
-                      <object class="GtkEntry" id="edit_text">
-                        <property name="visible">True</property>
-                        <property name="can-focus">True</property>
-                        <property name="hexpand">True</property>
-                        <property name="activates-default">True</property>
-                        <property name="truncate-multiline">True</property>
-                        <property name="placeholder-text" translatable="yes" 
context="qrcodegen|edit_name">www.libreoffice.org</property>
-                        <child internal-child="accessible">
-                          <object class="AtkObject" id="edit_text-atkobject">
-                            <property name="AtkObject::accessible-description" 
translatable="yes" context="qr text">The text from which to generate the 
code.</property>
-                          </object>
-                        </child>
-                      </object>
-                      <packing>
-                        <property name="left-attach">1</property>
-                        <property name="top-attach">0</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkLabel" id="label_text">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
                         <property name="halign">start</property>
+                        <property name="valign">start</property>
                         <property name="label" translatable="yes" 
context="qrcodegen|label_text" comments="Text to be stored in the 
QR">URL/Text:</property>
                         <property name="use-underline">True</property>
-                        <property name="mnemonic-widget">edit_text</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
@@ -157,22 +144,22 @@
                     <child>
                       <object class="GtkLabel" id="label_type">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can-focus">False</property>
                         <property name="halign">start</property>
                         <property name="label" translatable="yes" 
context="qrcodegen|label_type" comments="Select type">Type:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">choose_type</property>
+                        <property name="use-underline">True</property>
+                        <property name="mnemonic-widget">choose_type</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
-                        <property name="left_attach">0</property>
-                        <property name="top_attach">3</property>
+                        <property name="left-attach">0</property>
+                        <property name="top-attach">3</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkComboBoxText" id="choose_type">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
+                        <property name="can-focus">False</property>
                         <property name="hexpand">True</property>
                         <property name="active">0</property>
                         <items>
@@ -186,9 +173,8 @@
                         </child>
                       </object>
                       <packing>
-                        <property name="left_attach">1</property>
-                        <property name="top_attach">3</property>
-                        <property name="width">2</property>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">3</property>
                       </packing>
                     </child>
                     <child>
@@ -347,6 +333,34 @@
                         <property name="top-attach">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkScrolledWindow">
+                        <property name="visible">True</property>
+                        <property name="can-focus">True</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="hscrollbar-policy">always</property>
+                        <property name="shadow-type">in</property>
+                        <child>
+                          <object class="GtkTextView" id="edit_text">
+                            <property name="visible">True</property>
+                            <property name="can-focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <property name="buffer">textbuffer1</property>
+                            <child internal-child="accessible">
+                              <object class="AtkObject" 
id="edit_text-atkobject">
+                                <property 
name="AtkObject::accessible-description" translatable="yes" context="qr 
text">The text from which to generate the code.</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">0</property>
+                      </packing>
+                    </child>
                   </object>
                 </child>
                 <child type="label">
commit 00e5509f07e1e53d506fc824df32e38a266952b1
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Thu Dec 8 11:42:16 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Thu Dec 8 13:57:37 2022 +0000

    ofz#53824 Out-of-memory
    
    Change-Id: I348da7f237146dfa690b974dcabdf26369997eb1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143816
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx 
b/vcl/unx/generic/gdi/cairotextrender.cxx
index 3dbaa79cd1e5..7bd74f0a4830 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -260,6 +260,12 @@ void CairoTextRender::DrawTextLayout(const 
GenericSalLayout& rLayout, const SalG
     }
 
 #if defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION)
+    if (nHeight > 8120)
+    {
+        SAL_WARN("vcl", "rendering text would use > 2G Memory: " << nHeight);
+        return;
+    }
+
     if (__lsan_disable)
         __lsan_disable();
 #endif

Reply via email to