1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 <vcl/svapp.hxx>
21 #include <dlgname.hxx>
22 #include <defdlgname.hxx>
24 /*************************************************************************
26 |* Dialog for editing a name
28 \************************************************************************/
30 SvxNameDialog::SvxNameDialog(weld::Window
* pParent
, const OUString
& rName
, const OUString
& rDesc
)
31 : GenericDialogController(pParent
, "cui/ui/namedialog.ui", "NameDialog")
32 , m_xEdtName(m_xBuilder
->weld_entry("name_entry"))
33 , m_xFtDescription(m_xBuilder
->weld_label("description_label"))
34 , m_xBtnOK(m_xBuilder
->weld_button("ok"))
36 m_xFtDescription
->set_label(rDesc
);
37 m_xEdtName
->set_text(rName
);
38 m_xEdtName
->select_region(0, -1);
39 ModifyHdl(*m_xEdtName
);
40 m_xEdtName
->connect_changed(LINK(this, SvxNameDialog
, ModifyHdl
));
43 IMPL_LINK_NOARG(SvxNameDialog
, ModifyHdl
, weld::Entry
&, void)
45 // Do not allow empty names
46 if (m_aCheckNameHdl
.IsSet())
47 m_xBtnOK
->set_sensitive(!m_xEdtName
->get_text().isEmpty() && m_aCheckNameHdl
.Call(*this));
49 m_xBtnOK
->set_sensitive(!m_xEdtName
->get_text().isEmpty());
53 // Dialog for editing Object Name
54 // plus uniqueness-callback-linkHandler
56 SvxObjectNameDialog::SvxObjectNameDialog(weld::Window
* pParent
, const OUString
& rName
)
57 : GenericDialogController(pParent
, "cui/ui/objectnamedialog.ui", "ObjectNameDialog")
58 , m_xEdtName(m_xBuilder
->weld_entry("object_name_entry"))
59 , m_xBtnOK(m_xBuilder
->weld_button("ok"))
62 m_xEdtName
->set_text(rName
);
63 m_xEdtName
->select_region(0, -1);
66 ModifyHdl(*m_xEdtName
);
67 m_xEdtName
->connect_changed(LINK(this, SvxObjectNameDialog
, ModifyHdl
));
70 IMPL_LINK_NOARG(SvxObjectNameDialog
, ModifyHdl
, weld::Entry
&, void)
72 if (aCheckNameHdl
.IsSet())
74 m_xBtnOK
->set_sensitive(aCheckNameHdl
.Call(*this));
79 // Dialog for editing Object Title and Description
81 SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(weld::Window
* pParent
, const OUString
& rTitle
,
82 const OUString
& rDescription
)
83 : GenericDialogController(pParent
, "cui/ui/objecttitledescdialog.ui", "ObjectTitleDescDialog")
84 , m_xEdtTitle(m_xBuilder
->weld_entry("object_title_entry"))
85 , m_xEdtDescription(m_xBuilder
->weld_text_view("desc_entry"))
87 //lock height to initial height
88 m_xEdtDescription
->set_size_request(-1, m_xEdtDescription
->get_text_height() * 5);
90 m_xEdtTitle
->set_text(rTitle
);
91 m_xEdtDescription
->set_text(rDescription
);
94 m_xEdtTitle
->select_region(0, -1);
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */