xref: /aoo42x/main/sc/source/ui/dbgui/sortdlg.cxx (revision a479921a)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_scui.hxx"
26 
27 
28 
29 #include <vcl/msgbox.hxx>
30 #include "tpsort.hxx"
31 #include "sortdlg.hxx"
32 #include "scresid.hxx"
33 #include "sortdlg.hrc"
34 
35 #if !LAYOUT_SFX_TABDIALOG_BROKEN
36 #include <layout/layout-pre.hxx>
37 #endif
38 
ScSortDlg(Window * pParent,const SfxItemSet * pArgSet)39 ScSortDlg::ScSortDlg( Window*			pParent,
40 					  const SfxItemSet* pArgSet ) :
41 		SfxTabDialog( pParent,
42 					  ScResId( RID_SCDLG_SORT ),
43 					  pArgSet ),
44 		bIsHeaders	( sal_False ),
45 		bIsByRows	( sal_False )
46 
47 {
48 #if LAYOUT_SFX_TABDIALOG_BROKEN
49 	AddTabPage( TP_FIELDS,	ScTabPageSortFields::Create,  0 );
50 	AddTabPage( TP_OPTIONS,	ScTabPageSortOptions::Create, 0 );
51 #else
52     String fields = rtl::OUString::createFromAscii ("fields");
53 	AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, sal_False, TAB_APPEND);
54     String options = rtl::OUString::createFromAscii ("options");
55 	AddTabPage( TP_OPTIONS,	options, ScTabPageSortOptions::Create, 0, sal_False, TAB_APPEND);
56 #endif
57 	FreeResource();
58 }
59 
~ScSortDlg()60 __EXPORT ScSortDlg::~ScSortDlg()
61 {
62 }
63 
64 //==================================================================
ScSortWarningDlg(Window * pParent,const String & rExtendText,const String & rCurrentText)65 ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
66                                    const String& rExtendText,
67                                    const String& rCurrentText ):
68         ModalDialog     ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
69         aFtText         ( this, ScResId( FT_TEXT ) ),
70         aFtTip          ( this, ScResId( FT_TIP ) ),
71         aBtnExtSort     ( this, ScResId( BTN_EXTSORT ) ),
72         aBtnCurSort     ( this, ScResId( BTN_CURSORT ) ),
73         aBtnCancel      ( this, ScResId( BTN_CANCEL ) )
74 {
75     String sTextName = aFtText.GetText();
76     sTextName.SearchAndReplaceAscii("%1", rExtendText);
77     sTextName.SearchAndReplaceAscii("%2", rCurrentText);
78     aFtText.SetText( sTextName );
79 
80     aBtnExtSort	.SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
81     aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
82 
83     FreeResource();
84 }
85 
~ScSortWarningDlg()86 ScSortWarningDlg::~ScSortWarningDlg()
87 {
88 }
89 
IMPL_LINK(ScSortWarningDlg,BtnHdl,PushButton *,pBtn)90 IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
91 {
92     if ( pBtn == &aBtnExtSort )
93     {
94         EndDialog( BTN_EXTEND_RANGE );
95     }
96     else if( pBtn == &aBtnCurSort )
97     {
98         EndDialog( BTN_CURRENT_SELECTION );
99     }
100     return 0;
101 }
102 //========================================================================//
103