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 
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"))
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  if (m_aCheckNameHdl.IsSet())
45  m_xBtnOK->set_sensitive(!m_xEdtName->get_text().isEmpty() && m_aCheckNameHdl.Call(*this));
46  else
47  m_xBtnOK->set_sensitive(!m_xEdtName->get_text().isEmpty());
48 }
49 
50 // #i68101#
51 // Dialog for editing Object Name
52 // plus uniqueness-callback-linkHandler
53 
55  : GenericDialogController(pParent, "cui/ui/objectnamedialog.ui", "ObjectNameDialog")
56  , m_xEdtName(m_xBuilder->weld_entry("object_name_entry"))
57  , m_xBtnOK(m_xBuilder->weld_button("ok"))
58 {
59  // set name
60  m_xEdtName->set_text(rName);
61  m_xEdtName->select_region(0, -1);
62 
63  // activate name
64  ModifyHdl(*m_xEdtName);
65  m_xEdtName->connect_changed(LINK(this, SvxObjectNameDialog, ModifyHdl));
66 }
67 
69 {
70  if (aCheckNameHdl.IsSet())
71  {
72  m_xBtnOK->set_sensitive(aCheckNameHdl.Call(*this));
73  }
74 }
75 
76 // #i68101#
77 // Dialog for editing Object Title and Description
78 
80  const OUString& rDescription)
81  : GenericDialogController(pParent, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog")
82  , m_xEdtTitle(m_xBuilder->weld_entry("object_title_entry"))
83  , m_xEdtDescription(m_xBuilder->weld_text_view("desc_entry"))
84 {
85  //lock height to initial height
86  m_xEdtDescription->set_size_request(-1, m_xEdtDescription->get_text_height() * 5);
87  // set title & desc
88  m_xEdtTitle->set_text(rTitle);
89  m_xEdtDescription->set_text(rDescription);
90 
91  // activate title
92  m_xEdtTitle->select_region(0, -1);
93 }
94 
95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::TextView > m_xEdtDescription
Definition: dlgname.hxx:106
Dialog for editing a name.
Definition: dlgname.hxx:25
IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl, weld::Entry &, void)
Definition: dlgname.cxx:41
std::unique_ptr< weld::Label > m_xFtDescription
Definition: dlgname.hxx:29
std::unique_ptr< weld::Entry > m_xEdtName
Definition: dlgname.hxx:28
#i68101# Dialog for editing Object name plus uniqueness-callback-linkHandler
Definition: dlgname.hxx:69
SvxObjectNameDialog(weld::Window *pWindow, const OUString &rName)
Definition: dlgname.cxx:54
std::unique_ptr< weld::Entry > m_xEdtTitle
Definition: dlgname.hxx:103
SvxNameDialog(weld::Window *pWindow, const OUString &rName, const OUString &rDesc)
Definition: dlgname.cxx:28
std::unique_ptr< weld::Entry > m_xEdtName
Definition: dlgname.hxx:73
SvxObjectTitleDescDialog(weld::Window *pWindow, const OUString &rTitle, const OUString &rDesc)
Definition: dlgname.cxx:79