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 .
19 #ifndef _SVX_DLG_NAME_HXX
20 #define _SVX_DLG_NAME_HXX
23 #include <vcl/edit.hxx>
24 #include <vcl/button.hxx>
25 #include <vcl/dialog.hxx>
26 #include <vcl/fixed.hxx>
29 #include <svtools/svmedit.hxx>
31 /// Dialog for editing a name
32 class SvxNameDialog
: public ModalDialog
35 FixedText aFtDescription
;
38 CancelButton aBtnCancel
;
43 DECL_LINK(ModifyHdl
, void *);
46 SvxNameDialog( Window
* pWindow
, const String
& rName
, const String
& rDesc
);
48 void GetName( String
& rName
){rName
= aEdtName
.GetText();}
50 /** add a callback Link that is called whenever the content of the edit
51 field is changed. The Link result determines whether the OK
52 Button is enabled (> 0) or disabled (== 0).
54 @param rLink a Callback declared with DECL_LINK and implemented with
55 IMPL_LINK, that is executed on modification.
57 @param bCheckImmediately If true, the Link is called directly after
58 setting it. It is recommended to set this flag to true to avoid
59 an inconsistent state if the initial String (given in the CTOR)
60 does not satisfy the check condition.
62 @todo Remove the parameter bCheckImmediately and incorporate the 'true'
65 void SetCheckNameHdl( const Link
& rLink
, bool bCheckImmediately
= false )
67 aCheckNameHdl
= rLink
;
68 if ( bCheckImmediately
)
69 aBtnOK
.Enable( rLink
.Call( this ) > 0 );
72 void SetEditHelpId( const rtl::OString
& aHelpId
) {aEdtName
.SetHelpId(aHelpId
);}
76 Dialog for editing Object Title and Description
77 plus uniqueness-callback-linkHandler */
78 class SvxObjectNameDialog
: public ModalDialog
86 FixedLine aFlSeparator
;
91 CancelButton aBtnCancel
;
93 // callback link for name uniqueness
96 DECL_LINK(ModifyHdl
, void *);
100 SvxObjectNameDialog(Window
* pWindow
, const String
& rName
);
103 void GetName(String
& rName
) {rName
= aEdtName
.GetText(); }
106 void SetCheckNameHdl(const Link
& rLink
, bool bCheckImmediately
= false)
108 aCheckNameHdl
= rLink
;
110 if(bCheckImmediately
)
112 aBtnOK
.Enable(rLink
.Call(this) > 0);
118 Dialog for editing Object Title and Description */
119 class SvxObjectTitleDescDialog
: public ModalDialog
127 FixedText aFtDescription
;
128 MultiLineEdit aEdtDescription
;
131 FixedLine aFlSeparator
;
136 CancelButton aBtnCancel
;
140 SvxObjectTitleDescDialog(Window
* pWindow
, const String
& rTitle
, const String
& rDesc
);
143 void GetTitle(String
& rTitle
) {rTitle
= aEdtTitle
.GetText(); }
144 void GetDescription(String
& rDescription
) {rDescription
= aEdtDescription
.GetText(); }
147 /// Dialog to cancel, save, or add
148 class SvxMessDialog
: public ModalDialog
151 FixedText aFtDescription
;
154 CancelButton aBtnCancel
;
158 DECL_LINK(Button1Hdl
, void *);
159 DECL_LINK(Button2Hdl
, void *);
162 SvxMessDialog( Window
* pWindow
, const String
& rText
, const String
& rDesc
, Image
* pImg
= NULL
);
165 void SetButtonText( sal_uInt16 nBtnId
, const String
& rNewTxt
);
170 #endif // _SVX_DLG_NAME_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */