tdf#150789 - FILEOPEN PPTX: fix text in SmartArt vertically off
[LibreOffice.git] / connectivity / source / drivers / macab / macaborder.cxx
blob133e5d599136ad72e8b1241a40dfbf2bbbb50d30
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "macaborder.hxx"
22 #include "MacabHeader.hxx"
23 #include "MacabRecord.hxx"
25 using namespace ::connectivity::macab;
27 MacabOrder::~MacabOrder()
31 MacabSimpleOrder::MacabSimpleOrder(MacabHeader const *header, std::u16string_view sColumnName, bool bAscending)
32 : MacabOrder(),
33 m_nFieldNumber(header->getColumnNumber(sColumnName)),
34 m_bAscending(bAscending)
38 sal_Int32 MacabSimpleOrder::compare(const MacabRecord *record1, const MacabRecord *record2) const
40 sal_Int32 result;
42 result = MacabRecord::compareFields(record1->get(m_nFieldNumber), record2->get(m_nFieldNumber));
44 if (!m_bAscending) result = -result;
46 return result;
49 MacabComplexOrder::MacabComplexOrder()
50 : MacabOrder(),
51 m_aOrders()
55 MacabComplexOrder::~MacabComplexOrder()
59 void MacabComplexOrder::addOrder(MacabOrder *pOrder)
61 m_aOrders.emplace_back(pOrder);
64 sal_Int32 MacabComplexOrder::compare(const MacabRecord *record1, const MacabRecord *record2) const
66 for (auto const & p: m_aOrders)
68 sal_Int32 result = p->compare(record1, record2);
70 if (result) return result;
72 return 0;
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */