merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / dbgui / sortdlg.cxx
blobe2fb90bfb125e07e76fca43696209bf991b84c63
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: sortdlg.cxx,v $
10 * $Revision: 1.6 $
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
37 #include <vcl/msgbox.hxx>
38 #include "tpsort.hxx"
39 #include "sortdlg.hxx"
40 #include "scresid.hxx"
41 #include "sortdlg.hrc"
43 #if !LAYOUT_SFX_TABDIALOG_BROKEN
44 #include <layout/layout-pre.hxx>
45 #endif
47 ScSortDlg::ScSortDlg( Window* pParent,
48 const SfxItemSet* pArgSet ) :
49 SfxTabDialog( pParent,
50 ScResId( RID_SCDLG_SORT ),
51 pArgSet ),
52 bIsHeaders ( FALSE ),
53 bIsByRows ( FALSE )
56 #if LAYOUT_SFX_TABDIALOG_BROKEN
57 AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 );
58 AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 );
59 #else
60 String fields = rtl::OUString::createFromAscii ("fields");
61 AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, FALSE, TAB_APPEND);
62 String options = rtl::OUString::createFromAscii ("options");
63 AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, FALSE, TAB_APPEND);
64 #endif
65 FreeResource();
68 __EXPORT ScSortDlg::~ScSortDlg()
72 //==================================================================
73 ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
74 const String& rExtendText,
75 const String& rCurrentText ):
76 ModalDialog ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
77 aFtText ( this, ScResId( FT_TEXT ) ),
78 aFtTip ( this, ScResId( FT_TIP ) ),
79 aBtnExtSort ( this, ScResId( BTN_EXTSORT ) ),
80 aBtnCurSort ( this, ScResId( BTN_CURSORT ) ),
81 aBtnCancel ( this, ScResId( BTN_CANCEL ) )
83 String sTextName = aFtText.GetText();
84 sTextName.SearchAndReplaceAscii("%1", rExtendText);
85 sTextName.SearchAndReplaceAscii("%2", rCurrentText);
86 aFtText.SetText( sTextName );
88 aBtnExtSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
89 aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
91 FreeResource();
94 ScSortWarningDlg::~ScSortWarningDlg()
98 IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
100 if ( pBtn == &aBtnExtSort )
102 EndDialog( BTN_EXTEND_RANGE );
104 else if( pBtn == &aBtnCurSort )
106 EndDialog( BTN_CURRENT_SELECTION );
108 return 0;
110 //========================================================================//