Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_DLG_NAME_HXX
29 : : #define _SVX_DLG_NAME_HXX
30 : :
31 : :
32 : : #include <vcl/edit.hxx>
33 : : #include <vcl/button.hxx>
34 : : #include <vcl/dialog.hxx>
35 : : #include <vcl/fixed.hxx>
36 : :
37 : : // #i68101#
38 : : #include <svtools/svmedit.hxx>
39 : :
40 : : /// Dialog for editing a name
41 [ # # ][ # # ]: 0 : class SvxNameDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
42 : : {
43 : : private:
44 : : FixedText aFtDescription;
45 : : Edit aEdtName;
46 : : OKButton aBtnOK;
47 : : CancelButton aBtnCancel;
48 : : HelpButton aBtnHelp;
49 : :
50 : : Link aCheckNameHdl;
51 : : #if _SOLAR__PRIVATE
52 : : DECL_LINK(ModifyHdl, void *);
53 : : #endif
54 : :
55 : : public:
56 : : SvxNameDialog( Window* pWindow, const String& rName, const String& rDesc );
57 : :
58 [ # # ]: 0 : void GetName( String& rName ){rName = aEdtName.GetText();}
59 : :
60 : : /** add a callback Link that is called whenever the content of the edit
61 : : field is changed. The Link result determines whether the OK
62 : : Button is enabled (> 0) or disabled (== 0).
63 : :
64 : : @param rLink a Callback declared with DECL_LINK and implemented with
65 : : IMPL_LINK, that is executed on modification.
66 : :
67 : : @param bCheckImmediately If true, the Link is called directly after
68 : : setting it. It is recommended to set this flag to true to avoid
69 : : an inconsistent state if the initial String (given in the CTOR)
70 : : does not satisfy the check condition.
71 : :
72 : : @todo Remove the parameter bCheckImmediately and incorporate the 'true'
73 : : behaviour as default.
74 : : */
75 : 0 : void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
76 : : {
77 : 0 : aCheckNameHdl = rLink;
78 [ # # ]: 0 : if ( bCheckImmediately )
79 : 0 : aBtnOK.Enable( rLink.Call( this ) > 0 );
80 : 0 : }
81 : :
82 : 0 : void SetEditHelpId( const rtl::OString& aHelpId) {aEdtName.SetHelpId(aHelpId);}
83 : : };
84 : :
85 : : /** #i68101#
86 : : Dialog for editing Object Title and Description
87 : : plus uniqueness-callback-linkHandler */
88 [ # # ][ # # ]: 0 : class SvxObjectNameDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
89 : : {
90 : : private:
91 : : // name
92 : : FixedText aFtName;
93 : : Edit aEdtName;
94 : :
95 : : // separator
96 : : FixedLine aFlSeparator;
97 : :
98 : : // buttons
99 : : HelpButton aBtnHelp;
100 : : OKButton aBtnOK;
101 : : CancelButton aBtnCancel;
102 : :
103 : : // callback link for name uniqueness
104 : : Link aCheckNameHdl;
105 : : #if _SOLAR__PRIVATE
106 : : DECL_LINK(ModifyHdl, void *);
107 : : #endif
108 : :
109 : : public:
110 : : // constructor
111 : : SvxObjectNameDialog(Window* pWindow, const String& rName);
112 : :
113 : : // data access
114 [ # # ]: 0 : void GetName(String& rName) {rName = aEdtName.GetText(); }
115 : :
116 : : // set handler
117 : 0 : void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
118 : : {
119 : 0 : aCheckNameHdl = rLink;
120 : :
121 [ # # ]: 0 : if(bCheckImmediately)
122 : : {
123 : 0 : aBtnOK.Enable(rLink.Call(this) > 0);
124 : : }
125 : 0 : }
126 : : };
127 : :
128 : : /** #i68101#
129 : : Dialog for editing Object Title and Description */
130 [ # # ][ # # ]: 0 : class SvxObjectTitleDescDialog : public ModalDialog
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
131 : : {
132 : : private:
133 : : // title
134 : : FixedText aFtTitle;
135 : : Edit aEdtTitle;
136 : :
137 : : // description
138 : : FixedText aFtDescription;
139 : : MultiLineEdit aEdtDescription;
140 : :
141 : : // separator
142 : : FixedLine aFlSeparator;
143 : :
144 : : // buttons
145 : : HelpButton aBtnHelp;
146 : : OKButton aBtnOK;
147 : : CancelButton aBtnCancel;
148 : :
149 : : public:
150 : : // constructor
151 : : SvxObjectTitleDescDialog(Window* pWindow, const String& rTitle, const String& rDesc);
152 : :
153 : : // data access
154 [ # # ]: 0 : void GetTitle(String& rTitle) {rTitle = aEdtTitle.GetText(); }
155 [ # # ]: 0 : void GetDescription(String& rDescription) {rDescription = aEdtDescription.GetText(); }
156 : : };
157 : :
158 : : /// Dialog to cancel, save, or add
159 : : class SvxMessDialog : public ModalDialog
160 : : {
161 : : private:
162 : : FixedText aFtDescription;
163 : : PushButton aBtn1;
164 : : PushButton aBtn2;
165 : : CancelButton aBtnCancel;
166 : : FixedImage aFtImage;
167 : : Image* pImage;
168 : : #if _SOLAR__PRIVATE
169 : : DECL_LINK(Button1Hdl, void *);
170 : : DECL_LINK(Button2Hdl, void *);
171 : : #endif
172 : : public:
173 : : SvxMessDialog( Window* pWindow, const String& rText, const String& rDesc, Image* pImg = NULL );
174 : : ~SvxMessDialog();
175 : :
176 : : void SetButtonText( sal_uInt16 nBtnId, const String& rNewTxt );
177 : : };
178 : :
179 : :
180 : :
181 : : #endif // _SVX_DLG_NAME_HXX
182 : :
183 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|