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