Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <i18npool/lang.h>
22 : #include <sortopt.hxx>
23 : #include <boost/foreach.hpp>
24 :
25 : /*--------------------------------------------------------------------
26 : Description: Sort Key
27 : --------------------------------------------------------------------*/
28 0 : SwSortKey::SwSortKey() :
29 : eSortOrder( SRT_ASCENDING ),
30 : nColumnId( 0 ),
31 0 : bIsNumeric( true )
32 : {
33 0 : }
34 :
35 0 : SwSortKey::SwSortKey(sal_uInt16 nId, const String& rSrtType, SwSortOrder eOrder) :
36 : sSortType( rSrtType ),
37 : eSortOrder( eOrder ),
38 : nColumnId( nId ),
39 0 : bIsNumeric( 0 == rSrtType.Len() )
40 : {
41 0 : }
42 :
43 0 : SwSortKey::SwSortKey(const SwSortKey& rOld) :
44 : sSortType( rOld.sSortType ),
45 : eSortOrder( rOld.eSortOrder ),
46 : nColumnId( rOld.nColumnId ),
47 0 : bIsNumeric( rOld.bIsNumeric )
48 : {
49 0 : }
50 :
51 : /*--------------------------------------------------------------------
52 : Description: Sorting options for Sorting
53 : --------------------------------------------------------------------*/
54 0 : SwSortOptions::SwSortOptions()
55 : : eDirection( SRT_ROWS ),
56 : cDeli( 9 ),
57 : nLanguage( LANGUAGE_SYSTEM ),
58 : bTable( false ),
59 0 : bIgnoreCase( false )
60 : {
61 0 : }
62 :
63 0 : SwSortOptions::SwSortOptions(const SwSortOptions& rOpt) :
64 : eDirection( rOpt.eDirection ),
65 : cDeli( rOpt.cDeli ),
66 : nLanguage( rOpt.nLanguage ),
67 : bTable( rOpt.bTable ),
68 0 : bIgnoreCase( rOpt.bIgnoreCase )
69 : {
70 0 : for( sal_uInt16 i=0; i < rOpt.aKeys.size(); ++i )
71 : {
72 0 : SwSortKey* pNew = new SwSortKey(*rOpt.aKeys[i]);
73 0 : aKeys.push_back( pNew );
74 : }
75 0 : }
76 :
77 0 : SwSortOptions::~SwSortOptions()
78 : {
79 0 : BOOST_FOREACH(SwSortKey *pKey, aKeys)
80 0 : delete pKey;
81 0 : }
82 :
83 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|