make sure to not divide by zero when computing miter limit
[LibreOffice.git] / framework / inc / xml / acceleratorconfigurationreader.hxx
blob77546301374919faa951ee4e7866273d20dd38cf
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 .
20 #pragma once
22 #include <accelerators/acceleratorcache.hxx>
24 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
26 #include <com/sun/star/xml/sax/XLocator.hpp>
28 #include <cppuhelper/implbase.hxx>
29 #include <rtl/ustring.hxx>
31 namespace framework{
33 class AcceleratorConfigurationReader final : public ::cppu::WeakImplHelper< css::xml::sax::XDocumentHandler >
36 // const, types
38 private:
40 /** @short classification of XML elements. */
41 enum EXMLElement
43 E_ELEMENT_ACCELERATORLIST,
44 E_ELEMENT_ITEM
47 /** @short classification of XML attributes. */
48 enum EXMLAttribute
50 E_ATTRIBUTE_KEYCODE,
51 E_ATTRIBUTE_MOD_SHIFT,
52 E_ATTRIBUTE_MOD_MOD1,
53 E_ATTRIBUTE_MOD_MOD2,
54 E_ATTRIBUTE_MOD_MOD3,
55 E_ATTRIBUTE_URL
58 // member
60 private:
62 /** @short reference to the outside container, where this
63 reader/writer must work on. */
64 AcceleratorCache& m_rContainer;
66 /** @short used to detect if an accelerator list
67 occurs recursive inside xml. */
68 bool m_bInsideAcceleratorList;
70 /** @short used to detect if an accelerator item
71 occurs recursive inside xml. */
72 bool m_bInsideAcceleratorItem;
74 /** @short provide information about the parsing state.
76 @descr We use it to find out the line and column, where
77 an error occurred.
79 css::uno::Reference< css::xml::sax::XLocator > m_xLocator;
81 // interface
83 public:
85 /** @short connect this new reader/writer instance
86 to an outside container, which should be used
87 flushed to the underlying XML configuration or
88 filled from there.
90 @param rContainer
91 a reference to the outside container.
93 AcceleratorConfigurationReader(AcceleratorCache& rContainer);
95 /** @short does nothing real ... */
96 virtual ~AcceleratorConfigurationReader() override;
98 // XDocumentHandler
99 virtual void SAL_CALL startDocument() override;
101 virtual void SAL_CALL endDocument() override;
103 virtual void SAL_CALL startElement(const OUString& sElement ,
104 const css::uno::Reference< css::xml::sax::XAttributeList >& xAttributeList) override;
106 virtual void SAL_CALL endElement(const OUString& sElement) override;
108 virtual void SAL_CALL characters(const OUString& sChars) override;
110 virtual void SAL_CALL ignorableWhitespace(const OUString& sWhitespaces) override;
112 virtual void SAL_CALL processingInstruction(const OUString& sTarget,
113 const OUString& sData ) override;
115 virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator >& xLocator) override;
117 // helper
119 private:
121 /** TODO document me */
122 static EXMLElement implst_classifyElement(std::u16string_view sElement);
124 /** TODO document me */
125 static EXMLAttribute implst_classifyAttribute(std::u16string_view sAttribute);
127 /** TODO document me */
128 OUString implts_getErrorLineString();
131 } // namespace framework
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */