Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerfilter / source / dmapper / TablePositionHandler.hxx
blob1b9d9c80839140b7124825382ae4ea092c07a860
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 #pragma once
11 #include "LoggedResources.hxx"
13 namespace com::sun::star::beans
15 struct PropertyValue;
18 namespace writerfilter::dmapper
20 /// Handler for floating table positioning
21 class TablePositionHandler : public LoggedProperties
23 OUString m_aVertAnchor{ "margin" };
24 OUString m_aYSpec;
25 OUString m_aHorzAnchor{ "text" };
26 OUString m_aXSpec;
27 sal_Int32 m_nY = 0;
28 sal_Int32 m_nX = 0;
29 sal_Int32 m_nLeftFromText = 0;
30 sal_Int32 m_nRightFromText = 0;
31 sal_Int32 m_nTopFromText = 0;
32 sal_Int32 m_nBottomFromText = 0;
33 Id m_nTableOverlap = 0;
35 // Properties
36 void lcl_attribute(Id nId, Value& rVal) override;
37 void lcl_sprm(Sprm& sprm) override;
39 public:
40 sal_Int32 getY() const { return m_nY; }
41 sal_Int32 getX() const { return m_nX; }
42 sal_Int32 getLeftFromText() const { return m_nLeftFromText; }
43 sal_Int32 getRightFromText() const { return m_nRightFromText; }
44 sal_Int32 getTopFromText() const { return m_nTopFromText; }
45 sal_Int32 getBottomFromText() const { return m_nBottomFromText; }
47 const OUString& getVertAnchor() const { return m_aVertAnchor; }
48 const OUString& getYSpec() const { return m_aYSpec; }
49 const OUString& getHorzAnchor() const { return m_aHorzAnchor; }
50 const OUString& getXSpec() const { return m_aXSpec; }
52 void setTableOverlap(Id nTableOverlap) { m_nTableOverlap = nTableOverlap; }
54 TablePositionHandler();
55 ~TablePositionHandler() override;
57 /** Compute the UNO properties for the frame containing the table based
58 on the received tokens.
60 Note that the properties will need to be adjusted with the table
61 properties before actually using them.
63 css::uno::Sequence<css::beans::PropertyValue> getTablePosition() const;
65 bool operator==(const TablePositionHandler& rHandler) const;
68 using TablePositionHandlerPtr = tools::SvRef<TablePositionHandler>;
69 } // namespace writerfilter::dmapper
71 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */