1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
22 #include <statusbarconfiguration.hxx>
24 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
26 #include <rtl/ustring.hxx>
27 #include <rtl/ref.hxx>
28 #include <comphelper/attributelist.hxx>
29 #include <cppuhelper/implbase.hxx>
31 #include <unordered_map>
35 // Hash code function for using in all hash maps of follow implementation.
37 // workaround for incremental linking bugs in MSVC2015
38 class SAL_DLLPUBLIC_TEMPLATE OReadStatusBarDocumentHandler_Base
: public cppu::WeakImplHelper
< css::xml::sax::XDocumentHandler
> {};
40 class OReadStatusBarDocumentHandler final
: public OReadStatusBarDocumentHandler_Base
43 enum StatusBar_XML_Entry
46 SB_ELEMENT_STATUSBARITEM
,
50 SB_ATTRIBUTE_AUTOSIZE
,
51 SB_ATTRIBUTE_OWNERDRAW
,
55 SB_ATTRIBUTE_MANDATORY
,
59 enum StatusBar_XML_Namespace
65 OReadStatusBarDocumentHandler( const css::uno::Reference
< css::container::XIndexContainer
>& aStatusBarItems
);
66 virtual ~OReadStatusBarDocumentHandler() override
;
69 virtual void SAL_CALL
startDocument() override
;
71 virtual void SAL_CALL
endDocument() override
;
73 virtual void SAL_CALL
startElement(
74 const OUString
& aName
,
75 const css::uno::Reference
< css::xml::sax::XAttributeList
> &xAttribs
) override
;
77 virtual void SAL_CALL
endElement(const OUString
& aName
) override
;
79 virtual void SAL_CALL
characters(const OUString
& aChars
) override
;
81 virtual void SAL_CALL
ignorableWhitespace(const OUString
& aWhitespaces
) override
;
83 virtual void SAL_CALL
processingInstruction(const OUString
& aTarget
,
84 const OUString
& aData
) override
;
86 virtual void SAL_CALL
setDocumentLocator(
87 const css::uno::Reference
< css::xml::sax::XLocator
> &xLocator
) override
;
90 OUString
getErrorLineString();
92 class StatusBarHashMap
: public std::unordered_map
<OUString
,
97 bool m_bStatusBarStartFound
;
98 bool m_bStatusBarItemStartFound
;
99 StatusBarHashMap m_aStatusBarMap
;
100 css::uno::Reference
< css::container::XIndexContainer
> m_aStatusBarItems
;
101 css::uno::Reference
< css::xml::sax::XLocator
> m_xLocator
;
104 class OWriteStatusBarDocumentHandler final
107 OWriteStatusBarDocumentHandler(
108 const css::uno::Reference
< css::container::XIndexAccess
>& rStatusBarItems
,
109 const css::uno::Reference
< css::xml::sax::XDocumentHandler
>& rWriteDocHandler
);
110 ~OWriteStatusBarDocumentHandler();
112 /// @throws css::xml::sax::SAXException
113 /// @throws css::uno::RuntimeException
114 void WriteStatusBarDocument();
117 /// @throws css::xml::sax::SAXException
118 /// @throws css::uno::RuntimeException
119 void WriteStatusBarItem(
120 const OUString
& rCommandURL
,
125 css::uno::Reference
< css::container::XIndexAccess
> m_aStatusBarItems
;
126 css::uno::Reference
< css::xml::sax::XDocumentHandler
> m_xWriteDocumentHandler
;
127 OUString m_aXMLStatusBarNS
;
128 OUString m_aXMLXlinkNS
;
129 OUString m_aAttributeURL
;
132 } // namespace framework
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */