Line data Source code
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 <vcl/msgbox.hxx>
21 :
22 : #include <cuires.hrc>
23 :
24 : #include "dlgname.hxx"
25 : #include "defdlgname.hxx"
26 : #include <dialmgr.hxx>
27 :
28 : /*************************************************************************
29 : |*
30 : |* Dialog for editing a name
31 : |*
32 : \************************************************************************/
33 :
34 0 : SvxNameDialog::SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const OUString& rDesc ) :
35 0 : ModalDialog ( pWindow, "NameDialog", "cui/ui/namedialog.ui" )
36 : {
37 0 : get(pBtnOK, "ok");
38 0 : get(pFtDescription, "description_label");
39 0 : get(pEdtName, "name_entry");
40 :
41 0 : pFtDescription->SetText( rDesc );
42 0 : pEdtName->SetText( rName );
43 0 : pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
44 0 : ModifyHdl(&pEdtName);
45 0 : pEdtName->SetModifyHdl(LINK(this, SvxNameDialog, ModifyHdl));
46 0 : }
47 :
48 0 : IMPL_LINK_NOARG(SvxNameDialog, ModifyHdl)
49 : {
50 0 : if(aCheckNameHdl.IsSet())
51 0 : pBtnOK->Enable(aCheckNameHdl.Call(this) > 0);
52 0 : return 0;
53 : }
54 :
55 :
56 : // #i68101#
57 : // Dialog for editing Object Name
58 : // plus uniqueness-callback-linkHandler
59 :
60 0 : SvxObjectNameDialog::SvxObjectNameDialog(
61 : vcl::Window* pWindow,
62 : const OUString& rName) :
63 0 : ModalDialog ( pWindow, "ObjectNameDialog", "cui/ui/objectnamedialog.ui" )
64 : {
65 0 : get(pBtnOK, "ok");
66 0 : get(pEdtName, "object_name_entry");
67 : // set name
68 0 : pEdtName->SetText(rName);
69 :
70 : // activate name
71 0 : pEdtName->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
72 0 : ModifyHdl(&pEdtName);
73 0 : pEdtName->SetModifyHdl(LINK(this, SvxObjectNameDialog, ModifyHdl));
74 0 : }
75 :
76 0 : IMPL_LINK_NOARG(SvxObjectNameDialog, ModifyHdl)
77 : {
78 0 : if(aCheckNameHdl.IsSet())
79 : {
80 0 : pBtnOK->Enable(aCheckNameHdl.Call(this) > 0);
81 : }
82 :
83 0 : return 0;
84 : }
85 :
86 :
87 : // #i68101#
88 : // Dialog for editing Object Title and Description
89 :
90 0 : SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(
91 : vcl::Window* pWindow,
92 : const OUString& rTitle,
93 : const OUString& rDescription) :
94 0 : ModalDialog ( pWindow, "ObjectTitleDescDialog", "cui/ui/objecttitledescdialog.ui" )
95 : {
96 0 : get(pEdtTitle, "object_title_entry");
97 0 : get(pEdtDescription, "desc_entry");
98 : //lock height to initial height
99 0 : pEdtDescription->set_height_request(pEdtDescription->get_preferred_size().Height());
100 : // set title & desc
101 0 : pEdtTitle->SetText(rTitle);
102 0 : pEdtDescription->SetText(rDescription);
103 :
104 : // activate title
105 0 : pEdtTitle->SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
106 0 : }
107 :
108 :
109 :
110 : /*************************************************************************
111 : |*
112 : |* dialog for cancelling, saving or adding
113 : |*
114 : \************************************************************************/
115 :
116 0 : SvxMessDialog::SvxMessDialog( vcl::Window* pWindow, const OUString& rText, const OUString& rDesc, Image* pImg )
117 : : ModalDialog(pWindow, "MessBox", "cui/ui/messbox.ui")
118 0 : , pImage(NULL)
119 : {
120 0 : get(pBtn1, "mess_box_btn1");
121 0 : get(pBtn2, "mess_box_btn2");
122 0 : get(pFtDescription, "mess_box_description");
123 0 : get(pFtImage, "mess_box_image");
124 0 : if( pImg )
125 : {
126 0 : pImage = new Image( *pImg );
127 0 : pFtImage->SetImage( *pImage );
128 0 : pFtImage->SetStyle( ( pFtImage->GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK );
129 0 : pFtImage->Show();
130 : }
131 :
132 0 : SetText( rText );
133 0 : pFtDescription->SetText( rDesc );
134 :
135 0 : pBtn1->SetClickHdl( LINK( this, SvxMessDialog, Button1Hdl ) );
136 0 : pBtn2->SetClickHdl( LINK( this, SvxMessDialog, Button2Hdl ) );
137 0 : }
138 :
139 0 : SvxMessDialog::~SvxMessDialog()
140 : {
141 0 : delete pImage;
142 0 : }
143 :
144 : /*************************************************************************/
145 :
146 0 : IMPL_LINK_NOARG_INLINE_START(SvxMessDialog, Button1Hdl)
147 : {
148 0 : EndDialog( RET_BTN_1 );
149 0 : return 0;
150 : }
151 0 : IMPL_LINK_NOARG_INLINE_END(SvxMessDialog, Button1Hdl)
152 :
153 : /*************************************************************************/
154 :
155 0 : IMPL_LINK_NOARG_INLINE_START(SvxMessDialog, Button2Hdl)
156 : {
157 0 : EndDialog( RET_BTN_2 );
158 0 : return 0;
159 : }
160 0 : IMPL_LINK_NOARG_INLINE_END(SvxMessDialog, Button2Hdl)
161 :
162 : /*************************************************************************/
163 :
164 0 : void SvxMessDialog::SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt )
165 : {
166 0 : switch ( nBtnId )
167 : {
168 : case MESS_BTN_1:
169 0 : pBtn1->SetText( rNewTxt );
170 0 : break;
171 :
172 : case MESS_BTN_2:
173 0 : pBtn2->SetText( rNewTxt );
174 0 : break;
175 :
176 : default:
177 : OSL_FAIL( "Invalid button number!!!" );
178 : }
179 0 : }
180 :
181 :
182 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|