xref: /trunk/main/sc/source/ui/dbgui/sortdlg.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 #undef SC_DLLIMPLEMENTATION
32 
33 
34 #include <vcl/msgbox.hxx>
35 #include "tpsort.hxx"
36 #include "sortdlg.hxx"
37 #include "scresid.hxx"
38 #include "sortdlg.hrc"
39 
40 #if !LAYOUT_SFX_TABDIALOG_BROKEN
41 #include <layout/layout-pre.hxx>
42 #endif
43 
44 ScSortDlg::ScSortDlg( Window*			pParent,
45 					  const SfxItemSet* pArgSet ) :
46 		SfxTabDialog( pParent,
47 					  ScResId( RID_SCDLG_SORT ),
48 					  pArgSet ),
49 		bIsHeaders	( sal_False ),
50 		bIsByRows	( sal_False )
51 
52 {
53 #if LAYOUT_SFX_TABDIALOG_BROKEN
54 	AddTabPage( TP_FIELDS,	ScTabPageSortFields::Create,  0 );
55 	AddTabPage( TP_OPTIONS,	ScTabPageSortOptions::Create, 0 );
56 #else
57     String fields = rtl::OUString::createFromAscii ("fields");
58 	AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, sal_False, TAB_APPEND);
59     String options = rtl::OUString::createFromAscii ("options");
60 	AddTabPage( TP_OPTIONS,	options, ScTabPageSortOptions::Create, 0, sal_False, TAB_APPEND);
61 #endif
62 	FreeResource();
63 }
64 
65 __EXPORT ScSortDlg::~ScSortDlg()
66 {
67 }
68 
69 //==================================================================
70 ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
71                                    const String& rExtendText,
72                                    const String& rCurrentText ):
73         ModalDialog     ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
74         aFtText         ( this, ScResId( FT_TEXT ) ),
75         aFtTip          ( this, ScResId( FT_TIP ) ),
76         aBtnExtSort     ( this, ScResId( BTN_EXTSORT ) ),
77         aBtnCurSort     ( this, ScResId( BTN_CURSORT ) ),
78         aBtnCancel      ( this, ScResId( BTN_CANCEL ) )
79 {
80     String sTextName = aFtText.GetText();
81     sTextName.SearchAndReplaceAscii("%1", rExtendText);
82     sTextName.SearchAndReplaceAscii("%2", rCurrentText);
83     aFtText.SetText( sTextName );
84 
85     aBtnExtSort	.SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
86     aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
87 
88     FreeResource();
89 }
90 
91 ScSortWarningDlg::~ScSortWarningDlg()
92 {
93 }
94 
95 IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
96 {
97     if ( pBtn == &aBtnExtSort )
98     {
99         EndDialog( BTN_EXTEND_RANGE );
100     }
101     else if( pBtn == &aBtnCurSort )
102     {
103         EndDialog( BTN_CURRENT_SELECTION );
104     }
105     return 0;
106 }
107 //========================================================================//
108