cui/source/dialogs/dlgname.cxx   |   13 +++++++++++++
 include/cui/dlgname.hxx          |    4 ++++
 sw/source/ui/frmdlg/frmpage.cxx  |   14 ++++++++++++++
 sw/source/uibase/inc/frmpage.hxx |    2 ++
 4 files changed, 33 insertions(+)

New commits:
commit 04e90103b9a031af4073967228c6ccfc59438ec0
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jul 7 13:32:34 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jul 7 15:45:09 2023 +0200

    tdf#152484 cui,sw: if decorative is enabled, disable title/description
    
    ... in sw Frame Properties dialog and cui SvxObjectTitleDescDialog.
    
    Reportedly Word behaves weirdly if decorative is set and a description
    exists at the same time.
    
    Change-Id: I9fa149127bacc3567486334a14f42b05871a629f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154165
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/cui/source/dialogs/dlgname.cxx b/cui/source/dialogs/dlgname.cxx
index 84f21a86d616..fa12a158445f 100644
--- a/cui/source/dialogs/dlgname.cxx
+++ b/cui/source/dialogs/dlgname.cxx
@@ -90,7 +90,9 @@ 
SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const
                                                    const OUString& 
rDescription,
                                                    bool const isDecorative)
     : GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", 
"ObjectTitleDescDialog")
+    , m_xTitleFT(m_xBuilder->weld_label("object_title_label"))
     , m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry"))
+    , m_xDescriptionFT(m_xBuilder->weld_label("desc_label"))
     , m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry"))
     , m_xDecorativeCB(m_xBuilder->weld_check_button("decorative"))
 {
@@ -104,6 +106,17 @@ 
SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const
     m_xEdtTitle->select_region(0, -1);
 
     m_xDecorativeCB->set_active(isDecorative);
+    m_xDecorativeCB->connect_toggled(LINK(this, SvxObjectTitleDescDialog, 
DecorativeHdl));
+    DecorativeHdl(*m_xDecorativeCB);
+}
+
+IMPL_LINK_NOARG(SvxObjectTitleDescDialog, DecorativeHdl, weld::Toggleable&, 
void)
+{
+    bool const bEnable(!m_xDecorativeCB->get_active());
+    m_xEdtTitle->set_sensitive(bEnable);
+    m_xTitleFT->set_sensitive(bEnable);
+    m_xEdtDescription->set_sensitive(bEnable);
+    m_xDescriptionFT->set_sensitive(bEnable);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/cui/dlgname.hxx b/include/cui/dlgname.hxx
index 2ca8a8a55e29..9083177ee980 100644
--- a/include/cui/dlgname.hxx
+++ b/include/cui/dlgname.hxx
@@ -105,13 +105,17 @@ class SvxObjectTitleDescDialog final : public 
weld::GenericDialogController
 {
 private:
     // title
+    std::unique_ptr<weld::Label> m_xTitleFT;
     std::unique_ptr<weld::Entry> m_xEdtTitle;
 
     // description
+    std::unique_ptr<weld::Label> m_xDescriptionFT;
     std::unique_ptr<weld::TextView> m_xEdtDescription;
 
     std::unique_ptr<weld::CheckButton> m_xDecorativeCB;
 
+    DECL_LINK(DecorativeHdl, weld::Toggleable&, void);
+
 public:
     // constructor
     SvxObjectTitleDescDialog(weld::Window* pWindow, const OUString& rTitle, 
const OUString& rDesc,
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index 19bed7ba0476..352dc15df463 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2860,6 +2860,7 @@ SwFrameAddPage::SwFrameAddPage(weld::Container* pPage, 
weld::DialogController* p
     , m_xNameED(m_xBuilder->weld_entry("name"))
     , m_xAltNameFT(m_xBuilder->weld_label("altname_label"))
     , m_xAltNameED(m_xBuilder->weld_entry("altname"))
+    , m_xDescriptionFT(m_xBuilder->weld_label("description_label"))
     , m_xDescriptionED(m_xBuilder->weld_text_view("description"))
     , m_xDecorativeCB(m_xBuilder->weld_check_button("decorative"))
     , m_xSequenceFrame(m_xBuilder->weld_widget("frmSequence"))
@@ -2884,6 +2885,8 @@ SwFrameAddPage::SwFrameAddPage(weld::Container* pPage, 
weld::DialogController* p
     m_xTextFlowLB->append(SvxFrameDirection::Vertical_LR_BT, 
SvxResId(RID_SVXSTR_PAGEDIR_LTR_BTT_VERT));
     m_xTextFlowLB->append(SvxFrameDirection::Environment, 
SvxResId(RID_SVXSTR_FRAMEDIR_SUPER));
     m_xDescriptionED->set_size_request(-1, 
m_xDescriptionED->get_preferred_size().Height());
+
+    m_xDecorativeCB->connect_toggled(LINK(this, SwFrameAddPage, 
DecorativeHdl));
 }
 
 SwFrameAddPage::~SwFrameAddPage()
@@ -3090,6 +3093,8 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet )
         m_xVertAlignLB->set_active(nPos);
     }
     m_xVertAlignLB->save_value();
+
+    DecorativeHdl(*m_xDecorativeCB);
 }
 
 bool SwFrameAddPage::FillItemSet(SfxItemSet *rSet)
@@ -3178,6 +3183,15 @@ IMPL_LINK_NOARG(SwFrameAddPage, EditModifyHdl, 
weld::Entry&, void)
     m_xAltNameFT->set_sensitive(bEnable);
 }
 
+IMPL_LINK_NOARG(SwFrameAddPage, DecorativeHdl, weld::Toggleable&, void)
+{
+    bool const bEnable(!m_xDecorativeCB->get_active());
+    m_xAltNameED->set_sensitive(bEnable);
+    m_xAltNameFT->set_sensitive(bEnable);
+    m_xDescriptionED->set_sensitive(bEnable);
+    m_xDescriptionFT->set_sensitive(bEnable);
+}
+
 void SwFrameAddPage::SetFormatUsed(bool bFormatUsed)
 {
     m_bFormat = bFormatUsed;
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index 8270004838e2..6f05ca1d651a 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -281,6 +281,7 @@ class SwFrameAddPage final : public SfxTabPage
     std::unique_ptr<weld::Entry> m_xNameED;
     std::unique_ptr<weld::Label> m_xAltNameFT;
     std::unique_ptr<weld::Entry> m_xAltNameED;
+    std::unique_ptr<weld::Label> m_xDescriptionFT;
     std::unique_ptr<weld::TextView> m_xDescriptionED;
     std::unique_ptr<weld::CheckButton> m_xDecorativeCB;
     std::unique_ptr<weld::Widget> m_xSequenceFrame;
@@ -302,6 +303,7 @@ class SwFrameAddPage final : public SfxTabPage
     std::unique_ptr<svx::FrameDirectionListBox> m_xTextFlowLB;
 
     DECL_LINK(EditModifyHdl, weld::Entry&, void);
+    DECL_LINK(DecorativeHdl, weld::Toggleable&, void);
     DECL_LINK(ChainModifyHdl, weld::ComboBox&, void);
 
     static const WhichRangesContainer s_aAddPgRg;

Reply via email to