Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / cui / source / inc / dlgname.hxx
blobde6405278136ac9d5aaa74d871aee70463316522
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
28 // #i68101#
29 #include <svtools/svmedit.hxx>
31 /// Dialog for editing a name
32 class SvxNameDialog : public ModalDialog
34 private:
35 FixedText aFtDescription;
36 Edit aEdtName;
37 OKButton aBtnOK;
38 CancelButton aBtnCancel;
39 HelpButton aBtnHelp;
41 Link aCheckNameHdl;
43 DECL_LINK(ModifyHdl, void *);
45 public:
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'
63 behaviour as default.
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);}
75 /** #i68101#
76 Dialog for editing Object Title and Description
77 plus uniqueness-callback-linkHandler */
78 class SvxObjectNameDialog : public ModalDialog
80 private:
81 // name
82 FixedText aFtName;
83 Edit aEdtName;
85 // separator
86 FixedLine aFlSeparator;
88 // buttons
89 HelpButton aBtnHelp;
90 OKButton aBtnOK;
91 CancelButton aBtnCancel;
93 // callback link for name uniqueness
94 Link aCheckNameHdl;
96 DECL_LINK(ModifyHdl, void *);
98 public:
99 // constructor
100 SvxObjectNameDialog(Window* pWindow, const String& rName);
102 // data access
103 void GetName(String& rName) {rName = aEdtName.GetText(); }
105 // set handler
106 void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
108 aCheckNameHdl = rLink;
110 if(bCheckImmediately)
112 aBtnOK.Enable(rLink.Call(this) > 0);
117 /** #i68101#
118 Dialog for editing Object Title and Description */
119 class SvxObjectTitleDescDialog : public ModalDialog
121 private:
122 // title
123 FixedText aFtTitle;
124 Edit aEdtTitle;
126 // description
127 FixedText aFtDescription;
128 MultiLineEdit aEdtDescription;
130 // separator
131 FixedLine aFlSeparator;
133 // buttons
134 HelpButton aBtnHelp;
135 OKButton aBtnOK;
136 CancelButton aBtnCancel;
138 public:
139 // constructor
140 SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc);
142 // data access
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
150 private:
151 FixedText aFtDescription;
152 PushButton aBtn1;
153 PushButton aBtn2;
154 CancelButton aBtnCancel;
155 FixedImage aFtImage;
156 Image* pImage;
158 DECL_LINK(Button1Hdl, void *);
159 DECL_LINK(Button2Hdl, void *);
161 public:
162 SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL );
163 ~SvxMessDialog();
165 void SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt );
170 #endif // _SVX_DLG_NAME_HXX
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */