LibreOffice Module cui (master) 1
dlgname.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#include <dlgname.hxx>
21
22/*************************************************************************
23|*
24|* Dialog for editing a name
25|*
26\************************************************************************/
27
28SvxNameDialog::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"))
33{
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));
39}
40
42{
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
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);
58}
59
60// #i68101#
61// Dialog for editing Object Name
62// plus uniqueness-callback-linkHandler
63
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"))
68{
69 // set name
70 m_xEdtName->set_text(rName);
71 m_xEdtName->select_region(0, -1);
72
73 // activate name
74 ModifyHdl(*m_xEdtName);
75 m_xEdtName->connect_changed(LINK(this, SvxObjectNameDialog, ModifyHdl));
76}
77
79{
80 if (aCheckNameHdl.IsSet())
81 {
82 m_xBtnOK->set_sensitive(aCheckNameHdl.Call(*this));
83 }
84}
85
86// #i68101#
87// Dialog for editing Object Title and Description
88
90 const OUString& rDescription)
91 : GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog")
92 , m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry"))
93 , m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry"))
94{
95 //lock height to initial height
96 m_xEdtDescription->set_size_request(-1, m_xEdtDescription->get_text_height() * 5);
97 // set title & desc
98 m_xEdtTitle->set_text(rTitle);
99 m_xEdtDescription->set_text(rDescription);
100
101 // activate title
102 m_xEdtTitle->select_region(0, -1);
103}
104
105/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Dialog for editing a name.
Definition: dlgname.hxx:25
std::unique_ptr< weld::Entry > m_xEdtName
Definition: dlgname.hxx:27
std::unique_ptr< weld::Label > m_xFtDescription
Definition: dlgname.hxx:28
SvxNameDialog(weld::Window *pWindow, const OUString &rName, const OUString &rDesc)
Definition: dlgname.cxx:28
#i68101# Dialog for editing Object name plus uniqueness-callback-linkHandler
Definition: dlgname.hxx:76
SvxObjectNameDialog(weld::Window *pWindow, const OUString &rName)
Definition: dlgname.cxx:64
std::unique_ptr< weld::Entry > m_xEdtName
Definition: dlgname.hxx:79
std::unique_ptr< weld::Entry > m_xEdtTitle
Definition: dlgname.hxx:106
SvxObjectTitleDescDialog(weld::Window *pWindow, const OUString &rTitle, const OUString &rDesc)
Definition: dlgname.cxx:89
std::unique_ptr< weld::TextView > m_xEdtDescription
Definition: dlgname.hxx:109
Link< AbstractSvxNameDialog &, bool > aCheckNameHdl
Definition: dlgfact.hxx:273
IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry &, void)
Definition: dlgname.cxx:41