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 INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
20 : #define INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
21 :
22 :
23 : #include <vcl/edit.hxx>
24 : #include <vcl/button.hxx>
25 : #include <vcl/dialog.hxx>
26 : #include <vcl/fixed.hxx>
27 : #include <vcl/vclmedit.hxx>
28 :
29 : /// Dialog for editing a name
30 0 : class SvxNameDialog : public ModalDialog
31 : {
32 : private:
33 : FixedText* pFtDescription;
34 : Edit* pEdtName;
35 : OKButton* pBtnOK;
36 :
37 : Link aCheckNameHdl;
38 :
39 : DECL_LINK(ModifyHdl, void *);
40 :
41 : public:
42 : SvxNameDialog( Window* pWindow, const OUString& rName, const OUString& rDesc );
43 :
44 0 : void GetName( OUString& rName ){rName = pEdtName->GetText();}
45 :
46 : /** add a callback Link that is called whenever the content of the edit
47 : field is changed. The Link result determines whether the OK
48 : Button is enabled (> 0) or disabled (== 0).
49 :
50 : @param rLink a Callback declared with DECL_LINK and implemented with
51 : IMPL_LINK, that is executed on modification.
52 :
53 : @param bCheckImmediately If true, the Link is called directly after
54 : setting it. It is recommended to set this flag to true to avoid
55 : an inconsistent state if the initial String (given in the CTOR)
56 : does not satisfy the check condition.
57 :
58 : @todo Remove the parameter bCheckImmediately and incorporate the 'true'
59 : behaviour as default.
60 : */
61 0 : void SetCheckNameHdl( const Link& rLink, bool bCheckImmediately = false )
62 : {
63 0 : aCheckNameHdl = rLink;
64 0 : if ( bCheckImmediately )
65 0 : pBtnOK->Enable( rLink.Call( this ) > 0 );
66 0 : }
67 :
68 0 : void SetEditHelpId( const OString& aHelpId) {pEdtName->SetHelpId(aHelpId);}
69 : };
70 :
71 : /** #i68101#
72 : Dialog for editing Object name
73 : plus uniqueness-callback-linkHandler */
74 0 : class SvxObjectNameDialog : public ModalDialog
75 : {
76 : private:
77 : // name
78 : Edit* pEdtName;
79 :
80 : // buttons
81 : OKButton* pBtnOK;
82 :
83 : // callback link for name uniqueness
84 : Link aCheckNameHdl;
85 :
86 : DECL_LINK(ModifyHdl, void *);
87 :
88 : public:
89 : // constructor
90 : SvxObjectNameDialog(Window* pWindow, const OUString& rName);
91 :
92 : // data access
93 0 : void GetName(OUString& rName) {rName = pEdtName->GetText(); }
94 :
95 : // set handler
96 0 : void SetCheckNameHdl(const Link& rLink, bool bCheckImmediately = false)
97 : {
98 0 : aCheckNameHdl = rLink;
99 :
100 0 : if(bCheckImmediately)
101 : {
102 0 : pBtnOK->Enable(rLink.Call(this) > 0);
103 : }
104 0 : }
105 : };
106 :
107 : /** #i68101#
108 : Dialog for editing Object Title and Description */
109 0 : class SvxObjectTitleDescDialog : public ModalDialog
110 : {
111 : private:
112 : // title
113 : Edit* pEdtTitle;
114 :
115 : // description
116 : VclMultiLineEdit* pEdtDescription;
117 :
118 : public:
119 : // constructor
120 : SvxObjectTitleDescDialog(Window* pWindow, const OUString& rTitle, const OUString& rDesc);
121 :
122 : // data access
123 0 : void GetTitle(OUString& rTitle) {rTitle = pEdtTitle->GetText(); }
124 0 : void GetDescription(OUString& rDescription) {rDescription = pEdtDescription->GetText(); }
125 : };
126 :
127 : /// Dialog to cancel, save, or add
128 : class SvxMessDialog : public ModalDialog
129 : {
130 : private:
131 : FixedText* pFtDescription;
132 : PushButton* pBtn1;
133 : PushButton* pBtn2;
134 : FixedImage* pFtImage;
135 : Image* pImage;
136 :
137 : DECL_LINK(Button1Hdl, void *);
138 : DECL_LINK(Button2Hdl, void *);
139 :
140 : public:
141 : SvxMessDialog( Window* pWindow, const OUString& rText, const OUString& rDesc, Image* pImg = NULL );
142 : virtual ~SvxMessDialog();
143 :
144 : void SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt );
145 : };
146 :
147 :
148 :
149 : #endif // INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
150 :
151 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|