Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / dmapper / LatentStyleHandler.cxx
blobbc381d21fe3eb6b93da3c18b6ff66aeefd0a2dc9
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/.
8 */
9 #include "LatentStyleHandler.hxx"
10 #include "TagLogger.hxx"
11 #include <ooxml/resourceids.hxx>
13 namespace writerfilter::dmapper
15 using namespace ::com::sun::star;
17 LatentStyleHandler::LatentStyleHandler()
18 : LoggedProperties("LatentStyleHandler")
22 LatentStyleHandler::~LatentStyleHandler() = default;
24 void LatentStyleHandler::lcl_attribute(Id nId, Value& rVal)
26 beans::PropertyValue aValue;
27 bool bFound = true;
28 switch (nId)
30 case NS_ooxml::LN_CT_LsdException_name:
31 aValue.Name = "name";
32 break;
33 case NS_ooxml::LN_CT_LsdException_locked:
34 aValue.Name = "locked";
35 break;
36 case NS_ooxml::LN_CT_LsdException_uiPriority:
37 aValue.Name = "uiPriority";
38 break;
39 case NS_ooxml::LN_CT_LsdException_semiHidden:
40 aValue.Name = "semiHidden";
41 break;
42 case NS_ooxml::LN_CT_LsdException_unhideWhenUsed:
43 aValue.Name = "unhideWhenUsed";
44 break;
45 case NS_ooxml::LN_CT_LsdException_qFormat:
46 aValue.Name = "qFormat";
47 break;
48 default:
49 bFound = false;
50 #ifdef DBG_UTIL
51 TagLogger::getInstance().element("unhandled");
52 #endif
53 break;
55 if (bFound)
57 aValue.Value <<= rVal.getString();
58 m_aAttributes.push_back(aValue);
62 void LatentStyleHandler::lcl_sprm(Sprm& /*rSprm*/) {}
64 const std::vector<beans::PropertyValue>& LatentStyleHandler::getAttributes() const
66 return m_aAttributes;
69 } // namespace writerfilter::dmapper
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */