update dev300-m58
[ooovba.git] / sc / source / ui / miscdlgs / strindlg.cxx
blobd7a851dfc16434cca1085d492c2ae066b143faaa
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: strindlg.cxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #undef SC_DLLIMPLEMENTATION
38 //------------------------------------------------------------------
40 #include <tools/debug.hxx>
42 #include "strindlg.hxx"
43 #include "scresid.hxx"
44 #include "miscdlgs.hrc"
46 #include <layout/layout-pre.hxx>
48 #if ENABLE_LAYOUT
49 #undef ScResId
50 #define ScResId(x) #x
51 #undef ModalDialog
52 #define ModalDialog( parent, id ) Dialog( parent, "string-input.xml", id )
53 #endif /* ENABLE_LAYOUT */
55 //==================================================================
57 ScStringInputDlg::ScStringInputDlg( Window* pParent,
58 const String& rTitle,
59 const String& rEditTitle,
60 const String& rDefault,
61 ULONG nHelpId ) :
62 ModalDialog ( pParent, ScResId( RID_SCDLG_STRINPUT ) ),
64 aFtEditTitle ( this, ScResId( FT_LABEL ) ),
65 aEdInput ( this, ScResId( ED_INPUT ) ),
66 aBtnOk ( this, ScResId( BTN_OK ) ),
67 aBtnCancel ( this, ScResId( BTN_CANCEL ) ),
68 aBtnHelp ( this, ScResId( BTN_HELP ) )
70 SetHelpId( nHelpId );
71 SetText( rTitle );
72 aFtEditTitle.SetText( rEditTitle );
73 aEdInput.SetText( rDefault );
74 aEdInput.SetSelection(Selection(SELECTION_MIN, SELECTION_MAX));
76 // HelpId for Edit different for different uses
78 DBG_ASSERT( nHelpId == FID_TAB_APPEND || nHelpId == FID_TAB_RENAME ||
79 nHelpId == HID_SC_ADD_AUTOFMT || nHelpId == HID_SC_RENAME_AUTOFMT ||
80 nHelpId == SID_RENAME_OBJECT ||
81 // #i68101#
82 nHelpId == SID_TITLE_DESCRIPTION_OBJECT,
83 "unknown ID" );
84 if ( nHelpId == FID_TAB_APPEND )
85 aEdInput.SetHelpId( HID_SC_APPEND_NAME );
86 else if ( nHelpId == FID_TAB_RENAME )
87 aEdInput.SetHelpId( HID_SC_RENAME_NAME );
88 else if ( nHelpId == HID_SC_ADD_AUTOFMT )
89 aEdInput.SetHelpId( HID_SC_AUTOFMT_NAME );
90 else if ( nHelpId == HID_SC_RENAME_AUTOFMT )
91 aEdInput.SetHelpId( HID_SC_REN_AFMT_NAME );
92 else if ( nHelpId == SID_RENAME_OBJECT )
93 aEdInput.SetHelpId( HID_SC_RENAME_OBJECT );
94 // #i68101#
95 else if ( nHelpId == SID_TITLE_DESCRIPTION_OBJECT )
96 aEdInput.SetHelpId( HID_SC_TITLE_DESCRIPTION_OBJECT );
98 //-------------
99 FreeResource();
102 //------------------------------------------------------------------------
104 void ScStringInputDlg::GetInputString( String& rString ) const
106 rString = aEdInput.GetText();
109 __EXPORT ScStringInputDlg::~ScStringInputDlg()