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 : #ifndef _SVX_DLG_NAME_HXX
20 : #define _SVX_DLG_NAME_HXX
21 :
22 :
23 : #include <vcl/edit.hxx>
24 : #include <vcl/button.hxx>
25 : #include <vcl/dialog.hxx>
26 : #include <vcl/fixed.hxx>
27 :
28 : // #i68101#
29 : #include <svtools/svmedit.hxx>
30 :
31 : /// Dialog for editing a name
32 0 : class SvxNameDialog : public ModalDialog
33 : {
34 : private:
35 : FixedText aFtDescription;
36 : Edit aEdtName;
37 : OKButton aBtnOK;
38 : CancelButton aBtnCancel;
39 : HelpButton aBtnHelp;
40 :
41 : Link aCheckNameHdl;
42 :
43 : DECL_LINK(ModifyHdl, void *);
44 :
45 : public:
46 : SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc );
47 :
48 0 : void GetName( String& rName ){rName = aEdtName.GetText();}
49 :
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).
53 :
54 : @param rLink a Callback declared with DECL_LINK and implemented with
55 : IMPL_LINK, that is executed on modification.
56 :
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.
61 :
62 : @todo Remove the parameter bCheckImmediately and incorporate the 'true'
63 : behaviour as default.
64 : */
65 0 : void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
66 : {
67 0 : aCheckNameHdl = rLink;
68 0 : if ( bCheckImmediately )
69 0 : aBtnOK.Enable( rLink.Call( this ) > 0 );
70 0 : }
71 :
72 0 : void SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);}
73 : };
74 :
75 : /** #i68101#
76 : Dialog for editing Object Title and Description
77 : plus uniqueness-callback-linkHandler */
78 0 : class SvxObjectNameDialog : public ModalDialog
79 : {
80 : private:
81 : // name
82 : FixedText aFtName;
83 : Edit aEdtName;
84 :
85 : // separator
86 : FixedLine aFlSeparator;
87 :
88 : // buttons
89 : HelpButton aBtnHelp;
90 : OKButton aBtnOK;
91 : CancelButton aBtnCancel;
92 :
93 : // callback link for name uniqueness
94 : Link aCheckNameHdl;
95 :
96 : DECL_LINK(ModifyHdl, void *);
97 :
98 : public:
99 : // constructor
100 : SvxObjectNameDialog(Window* pWindow, const String& rName);
101 :
102 : // data access
103 0 : void GetName(String& rName) {rName = aEdtName.GetText(); }
104 :
105 : // set handler
106 0 : void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
107 : {
108 0 : aCheckNameHdl = rLink;
109 :
110 0 : if(bCheckImmediately)
111 : {
112 0 : aBtnOK.Enable(rLink.Call(this) > 0);
113 : }
114 0 : }
115 : };
116 :
117 : /** #i68101#
118 : Dialog for editing Object Title and Description */
119 0 : class SvxObjectTitleDescDialog : public ModalDialog
120 : {
121 : private:
122 : // title
123 : FixedText aFtTitle;
124 : Edit aEdtTitle;
125 :
126 : // description
127 : FixedText aFtDescription;
128 : MultiLineEdit aEdtDescription;
129 :
130 : // separator
131 : FixedLine aFlSeparator;
132 :
133 : // buttons
134 : HelpButton aBtnHelp;
135 : OKButton aBtnOK;
136 : CancelButton aBtnCancel;
137 :
138 : public:
139 : // constructor
140 : SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc);
141 :
142 : // data access
143 0 : void GetTitle(String& rTitle) {rTitle = aEdtTitle.GetText(); }
144 0 : void GetDescription(String& rDescription) {rDescription = aEdtDescription.GetText(); }
145 : };
146 :
147 : /// Dialog to cancel, save, or add
148 : class SvxMessDialog : public ModalDialog
149 : {
150 : private:
151 : FixedText aFtDescription;
152 : PushButton aBtn1;
153 : PushButton aBtn2;
154 : CancelButton aBtnCancel;
155 : FixedImage aFtImage;
156 : Image* pImage;
157 :
158 : DECL_LINK(Button1Hdl, void *);
159 : DECL_LINK(Button2Hdl, void *);
160 :
161 : public:
162 : SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL );
163 : ~SvxMessDialog();
164 :
165 : void SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt );
166 : };
167 :
168 :
169 :
170 : #endif // _SVX_DLG_NAME_HXX
171 :
172 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|