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