bump product version to 7.6.3.2-android
[LibreOffice.git] / cui / source / dialogs / dlgname.cxx
blobfa12a158445f231f7c0647af71130da1da988e13
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cui/dlgname.hxx>
22 /*************************************************************************
24 |* Dialog for editing a name
26 \************************************************************************/
28 SvxNameDialog::SvxNameDialog(weld::Window* pParent, const OUString& rName, const OUString& rDesc)
29 : GenericDialogController(pParent, "cui/ui/namedialog.ui", "NameDialog")
30 , m_xEdtName(m_xBuilder->weld_entry("name_entry"))
31 , m_xFtDescription(m_xBuilder->weld_label("description_label"))
32 , m_xBtnOK(m_xBuilder->weld_button("ok"))
34 m_xFtDescription->set_label(rDesc);
35 m_xEdtName->set_text(rName);
36 m_xEdtName->select_region(0, -1);
37 ModifyHdl(*m_xEdtName);
38 m_xEdtName->connect_changed(LINK(this, SvxNameDialog, ModifyHdl));
41 IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry&, void)
43 // Do not allow empty names
44 bool bEnable;
45 if (m_aCheckNameHdl.IsSet())
46 bEnable = !m_xEdtName->get_text().isEmpty() && m_aCheckNameHdl.Call(*this);
47 else
48 bEnable = !m_xEdtName->get_text().isEmpty();
49 m_xBtnOK->set_sensitive(bEnable);
50 // tdf#129032: feedback on reason to disabled controls
51 m_xEdtName->set_message_type(bEnable ? weld::EntryMessageType::Normal
52 : weld::EntryMessageType::Error);
53 OUString rTip = "";
54 if (!bEnable && m_aCheckNameTooltipHdl.IsSet())
55 rTip = m_aCheckNameTooltipHdl.Call(*this);
56 m_xBtnOK->set_tooltip_text(rTip);
57 m_xEdtName->set_tooltip_text(rTip);
60 // #i68101#
61 // Dialog for editing Object Name
62 // plus uniqueness-callback-linkHandler
64 SvxObjectNameDialog::SvxObjectNameDialog(weld::Window* pParent, const OUString& rName)
65 : GenericDialogController(pParent, "cui/ui/objectnamedialog.ui", "ObjectNameDialog")
66 , m_xEdtName(m_xBuilder->weld_entry("object_name_entry"))
67 , m_xBtnOK(m_xBuilder->weld_button("ok"))
69 // set name
70 m_xEdtName->set_text(rName);
71 m_xEdtName->select_region(0, -1);
73 // activate name
74 ModifyHdl(*m_xEdtName);
75 m_xEdtName->connect_changed(LINK(this, SvxObjectNameDialog, ModifyHdl));
78 IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl, weld::Entry&, void)
80 if (aCheckNameHdl.IsSet())
82 m_xBtnOK->set_sensitive(aCheckNameHdl.Call(*this));
86 // #i68101#
87 // Dialog for editing Object Title and Description
89 SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window* pParent, const OUString& rTitle,
90 const OUString& rDescription,
91 bool const isDecorative)
92 : GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog")
93 , m_xTitleFT(m_xBuilder->weld_label("object_title_label"))
94 , m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry"))
95 , m_xDescriptionFT(m_xBuilder->weld_label("desc_label"))
96 , m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry"))
97 , m_xDecorativeCB(m_xBuilder->weld_check_button("decorative"))
99 //lock height to initial height
100 m_xEdtDescription->set_size_request(-1, m_xEdtDescription->get_text_height() * 5);
101 // set title & desc
102 m_xEdtTitle->set_text(rTitle);
103 m_xEdtDescription->set_text(rDescription);
105 // activate title
106 m_xEdtTitle->select_region(0, -1);
108 m_xDecorativeCB->set_active(isDecorative);
109 m_xDecorativeCB->connect_toggled(LINK(this, SvxObjectTitleDescDialog, DecorativeHdl));
110 DecorativeHdl(*m_xDecorativeCB);
113 IMPL_LINK_NOARG(SvxObjectTitleDescDialog, DecorativeHdl, weld::Toggleable&, void)
115 bool const bEnable(!m_xDecorativeCB->get_active());
116 m_xEdtTitle->set_sensitive(bEnable);
117 m_xTitleFT->set_sensitive(bEnable);
118 m_xEdtDescription->set_sensitive(bEnable);
119 m_xDescriptionFT->set_sensitive(bEnable);
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */