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_sc.hxx"
26
27 #undef SC_DLLIMPLEMENTATION
28
29
30 #include <vcl/msgbox.hxx>
31 #include "tpsort.hxx"
32 #include "sortdlg.hxx"
33 #include "scresid.hxx"
34 #include "sortdlg.hrc"
35
36 #if !LAYOUT_SFX_TABDIALOG_BROKEN
37 #include <layout/layout-pre.hxx>
38 #endif
39
ScSortDlg(Window * pParent,const SfxItemSet * pArgSet)40 ScSortDlg::ScSortDlg( Window* pParent,
41 const SfxItemSet* pArgSet ) :
42 SfxTabDialog( pParent,
43 ScResId( RID_SCDLG_SORT ),
44 pArgSet ),
45 bIsHeaders ( sal_False ),
46 bIsByRows ( sal_False )
47
48 {
49 #if LAYOUT_SFX_TABDIALOG_BROKEN
50 AddTabPage( TP_FIELDS, ScTabPageSortFields::Create, 0 );
51 AddTabPage( TP_OPTIONS, ScTabPageSortOptions::Create, 0 );
52 #else
53 String fields = rtl::OUString::createFromAscii ("fields");
54 AddTabPage( TP_FIELDS, fields, ScTabPageSortFields::Create, 0, sal_False, TAB_APPEND);
55 String options = rtl::OUString::createFromAscii ("options");
56 AddTabPage( TP_OPTIONS, options, ScTabPageSortOptions::Create, 0, sal_False, TAB_APPEND);
57 #endif
58 FreeResource();
59 }
60
~ScSortDlg()61 __EXPORT ScSortDlg::~ScSortDlg()
62 {
63 }
64
65 //==================================================================
ScSortWarningDlg(Window * pParent,const String & rExtendText,const String & rCurrentText)66 ScSortWarningDlg::ScSortWarningDlg( Window* pParent,
67 const String& rExtendText,
68 const String& rCurrentText ):
69 ModalDialog ( pParent, ScResId( RID_SCDLG_SORT_WARNING ) ),
70 aFtText ( this, ScResId( FT_TEXT ) ),
71 aFtTip ( this, ScResId( FT_TIP ) ),
72 aBtnExtSort ( this, ScResId( BTN_EXTSORT ) ),
73 aBtnCurSort ( this, ScResId( BTN_CURSORT ) ),
74 aBtnCancel ( this, ScResId( BTN_CANCEL ) )
75 {
76 String sTextName = aFtText.GetText();
77 sTextName.SearchAndReplaceAscii("%1", rExtendText);
78 sTextName.SearchAndReplaceAscii("%2", rCurrentText);
79 aFtText.SetText( sTextName );
80
81 aBtnExtSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
82 aBtnCurSort .SetClickHdl( LINK( this, ScSortWarningDlg, BtnHdl ) );
83
84 FreeResource();
85 }
86
~ScSortWarningDlg()87 ScSortWarningDlg::~ScSortWarningDlg()
88 {
89 }
90
IMPL_LINK(ScSortWarningDlg,BtnHdl,PushButton *,pBtn)91 IMPL_LINK( ScSortWarningDlg, BtnHdl, PushButton*, pBtn )
92 {
93 if ( pBtn == &aBtnExtSort )
94 {
95 EndDialog( BTN_EXTEND_RANGE );
96 }
97 else if( pBtn == &aBtnCurSort )
98 {
99 EndDialog( BTN_CURRENT_SELECTION );
100 }
101 return 0;
102 }
103 //========================================================================//
104