bump product version to 5.0.4.1
[LibreOffice.git] / cui / source / inc / dlgname.hxx
blob644b441db613f4ed302e5e892f7413fa8d2cfb64
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 INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
20 #define INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
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>
29 /// Dialog for editing a name
30 class SvxNameDialog : public ModalDialog
32 private:
33 VclPtr<FixedText> pFtDescription;
34 VclPtr<Edit> pEdtName;
35 VclPtr<OKButton> pBtnOK;
37 Link<> aCheckNameHdl;
39 DECL_LINK(ModifyHdl, void *);
41 public:
42 SvxNameDialog( vcl::Window* pWindow, const OUString& rName, const OUString& rDesc );
43 virtual ~SvxNameDialog();
44 virtual void dispose() SAL_OVERRIDE;
46 void GetName( OUString& rName ){rName = pEdtName->GetText();}
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).
52 @param rLink a Callback declared with DECL_LINK and implemented with
53 IMPL_LINK, that is executed on modification.
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.
60 @todo Remove the parameter bCheckImmediately and incorporate the 'true'
61 behaviour as default.
63 void SetCheckNameHdl( const Link<>& rLink, bool bCheckImmediately = false )
65 aCheckNameHdl = rLink;
66 if ( bCheckImmediately )
67 pBtnOK->Enable( rLink.Call( this ) > 0 );
70 void SetEditHelpId( const OString& aHelpId) {pEdtName->SetHelpId(aHelpId);}
73 /** #i68101#
74 Dialog for editing Object name
75 plus uniqueness-callback-linkHandler */
76 class SvxObjectNameDialog : public ModalDialog
78 private:
79 // name
80 VclPtr<Edit> pEdtName;
82 // buttons
83 VclPtr<OKButton> pBtnOK;
85 // callback link for name uniqueness
86 Link<> aCheckNameHdl;
88 DECL_LINK(ModifyHdl, void *);
90 public:
91 // constructor
92 SvxObjectNameDialog(vcl::Window* pWindow, const OUString& rName);
93 virtual ~SvxObjectNameDialog();
94 virtual void dispose() SAL_OVERRIDE;
96 // data access
97 void GetName(OUString& rName) {rName = pEdtName->GetText(); }
99 // set handler
100 void SetCheckNameHdl(const Link<>& rLink, bool bCheckImmediately = false)
102 aCheckNameHdl = rLink;
104 if(bCheckImmediately)
106 pBtnOK->Enable(rLink.Call(this) > 0);
111 /** #i68101#
112 Dialog for editing Object Title and Description */
113 class SvxObjectTitleDescDialog : public ModalDialog
115 private:
116 // title
117 VclPtr<Edit> pEdtTitle;
119 // description
120 VclPtr<VclMultiLineEdit> pEdtDescription;
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 void GetTitle(OUString& rTitle) {rTitle = pEdtTitle->GetText(); }
129 void GetDescription(OUString& rDescription) {rDescription = pEdtDescription->GetText(); }
132 /// Dialog to cancel, save, or add
133 class SvxMessDialog : public ModalDialog
135 private:
136 VclPtr<FixedText> pFtDescription;
137 VclPtr<PushButton> pBtn1;
138 VclPtr<PushButton> pBtn2;
139 VclPtr<FixedImage> pFtImage;
140 Image* pImage;
142 DECL_LINK(Button1Hdl, void *);
143 DECL_LINK(Button2Hdl, void *);
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;
150 void SetButtonText( sal_uInt16 nBtnId, const OUString& rNewTxt );
155 #endif // INCLUDED_CUI_SOURCE_INC_DLGNAME_HXX
157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */