Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / dmapper / BorderHandler.hxx
blob9a523bffc57667e8fea84667cebe7db28ee258b5
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 .
19 #pragma once
21 #include <vector>
22 #include "LoggedResources.hxx"
23 #include "PropertyMap.hxx"
24 #include <com/sun/star/table/BorderLine2.hpp>
25 #include <com/sun/star/beans/PropertyValue.hpp>
26 #include <o3tl/enumarray.hxx>
27 #include <docmodel/theme/ThemeColorType.hxx>
28 #include <docmodel/color/ComplexColor.hxx>
30 namespace writerfilter::dmapper
32 class PropertyMap;
33 class BorderHandler : public LoggedProperties
35 private:
36 //todo: order is a guess
37 enum class BorderPosition
39 Top,
40 Left,
41 Bottom,
42 Right,
43 Horizontal,
44 Vertical,
45 LAST = Vertical
48 //values of the current border
49 sal_Int32 m_nLineWidth;
50 sal_Int32 m_nLineType;
51 sal_Int32 m_nLineColor;
52 sal_Int32 m_nLineDistance;
53 bool m_bShadow;
54 bool m_bOOXML;
55 model::ThemeColorType m_eThemeColorType = model::ThemeColorType::Unknown;
56 sal_Int32 m_nThemeShade = 0;
57 sal_Int32 m_nThemeTint = 0;
59 o3tl::enumarray<BorderPosition, bool> m_aFilledLines;
60 o3tl::enumarray<BorderPosition, css::table::BorderLine2> m_aBorderLines;
61 OUString m_aInteropGrabBagName;
62 std::vector<css::beans::PropertyValue> m_aInteropGrabBag;
63 void appendGrabBag(const OUString& aKey, const OUString& aValue);
65 // Properties
66 virtual void lcl_attribute(Id Name, Value & val) override;
67 virtual void lcl_sprm(Sprm & sprm) override;
69 public:
70 explicit BorderHandler( bool bOOXML );
71 virtual ~BorderHandler() override;
73 PropertyMapPtr getProperties();
74 css::table::BorderLine2 getBorderLine();
75 sal_Int32 getLineDistance() const { return m_nLineDistance;}
76 sal_Int32 getLineType() const { return m_nLineType;}
77 bool getShadow() const { return m_bShadow;}
78 void enableInteropGrabBag(const OUString& aName);
79 css::beans::PropertyValue getInteropGrabBag(const OUString& aName = OUString());
81 model::ComplexColor getComplexColor() const;
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */