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