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 <tools/shl.hxx>
21 #include <vcl/msgbox.hxx>
25 #include "dlgname.hxx"
26 #include "defdlgname.hxx"
27 #include <dialmgr.hxx>
29 /*************************************************************************
31 |* Dialog for editing a name
33 \************************************************************************/
35 SvxNameDialog::SvxNameDialog( Window
* pWindow
, const String
& rName
, const String
& rDesc
) :
36 ModalDialog ( pWindow
, "NameDialog", "cui/ui/namedialog.ui" )
39 get(pFtDescription
, "description_label");
40 get(pEdtName
, "name_entry");
42 pFtDescription
->SetText( rDesc
);
43 pEdtName
->SetText( rName
);
44 pEdtName
->SetSelection(Selection(SELECTION_MIN
, SELECTION_MAX
));
46 pEdtName
->SetModifyHdl(LINK(this, SvxNameDialog
, ModifyHdl
));
49 IMPL_LINK_NOARG(SvxNameDialog
, ModifyHdl
)
51 if(aCheckNameHdl
.IsSet())
52 pBtnOK
->Enable(aCheckNameHdl
.Call(this) > 0);
56 ///////////////////////////////////////////////////////////////////////////////////////////////
58 // Dialog for editing Object Name
59 // plus uniqueness-callback-linkHandler
61 SvxObjectNameDialog::SvxObjectNameDialog(
63 const String
& rName
) :
64 ModalDialog ( pWindow
, "ObjectNameDialog", "cui/ui/objectnamedialog.ui" )
67 get(pEdtName
, "object_name_entry");
69 pEdtName
->SetText(rName
);
72 pEdtName
->SetSelection(Selection(SELECTION_MIN
, SELECTION_MAX
));
74 pEdtName
->SetModifyHdl(LINK(this, SvxObjectNameDialog
, ModifyHdl
));
77 IMPL_LINK_NOARG(SvxObjectNameDialog
, ModifyHdl
)
79 if(aCheckNameHdl
.IsSet())
81 pBtnOK
->Enable(aCheckNameHdl
.Call(this) > 0);
87 ///////////////////////////////////////////////////////////////////////////////////////////////
89 // Dialog for editing Object Title and Description
91 SvxObjectTitleDescDialog::SvxObjectTitleDescDialog(
94 const String
& rDescription
) :
95 ModalDialog ( pWindow
, "ObjectTitleDescDialog", "cui/ui/objecttitledescdialog.ui" )
97 get(pEdtTitle
, "object_title_entry");
98 get(pEdtDescription
, "desc_entry");
99 //lock height to initial height
100 pEdtDescription
->set_height_request(pEdtDescription
->get_preferred_size().Height());
102 pEdtTitle
->SetText(rTitle
);
103 pEdtDescription
->SetText(rDescription
);
106 pEdtTitle
->SetSelection(Selection(SELECTION_MIN
, SELECTION_MAX
));
109 ///////////////////////////////////////////////////////////////////////////////////////////////
111 /*************************************************************************
113 |* dialog for cancelling, saving or adding
115 \************************************************************************/
117 SvxMessDialog::SvxMessDialog( Window
* pWindow
, const String
& rText
, const String
& rDesc
, Image
* pImg
)
118 : ModalDialog(pWindow
, "MessBox", "cui/ui/messbox.ui")
121 get(pBtn1
, "mess_box_btn1");
122 get(pBtn2
, "mess_box_btn2");
123 get(pFtDescription
, "mess_box_description");
124 get(pFtImage
, "mess_box_image");
127 pImage
= new Image( *pImg
);
128 pFtImage
->SetImage( *pImage
);
129 pFtImage
->SetStyle( ( pFtImage
->GetStyle()/* | WB_NOTABSTOP */) & ~WB_3DLOOK
);
134 pFtDescription
->SetText( rDesc
);
136 pBtn1
->SetClickHdl( LINK( this, SvxMessDialog
, Button1Hdl
) );
137 pBtn2
->SetClickHdl( LINK( this, SvxMessDialog
, Button2Hdl
) );
140 SvxMessDialog::~SvxMessDialog()
145 /*************************************************************************/
147 IMPL_LINK_NOARG_INLINE_START(SvxMessDialog
, Button1Hdl
)
149 EndDialog( RET_BTN_1
);
152 IMPL_LINK_NOARG_INLINE_END(SvxMessDialog
, Button1Hdl
)
154 /*************************************************************************/
156 IMPL_LINK_NOARG_INLINE_START(SvxMessDialog
, Button2Hdl
)
158 EndDialog( RET_BTN_2
);
161 IMPL_LINK_NOARG_INLINE_END(SvxMessDialog
, Button2Hdl
)
163 /*************************************************************************/
165 void SvxMessDialog::SetButtonText( sal_uInt16 nBtnId
, const String
& rNewTxt
)
170 pBtn1
->SetText( rNewTxt
);
174 pBtn2
->SetText( rNewTxt
);
178 OSL_FAIL( "Invalid button number!!!" );
183 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */