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 .
20 #ifndef INCLUDED_FRAMEWORK_INC_XML_STATUSBARDOCUMENTHANDLER_HXX
21 #define INCLUDED_FRAMEWORK_INC_XML_STATUSBARDOCUMENTHANDLER_HXX
23 #include <framework/statusbarconfiguration.hxx>
25 #include <com/sun/star/xml/sax/XDocumentHandler.hpp>
27 #include <rtl/ustring.hxx>
28 #include <cppuhelper/implbase1.hxx>
30 #include <unordered_map>
32 #include <framework/fwedllapi.h>
36 // Hash code function for using in all hash maps of follow implementation.
38 class FWE_DLLPUBLIC OReadStatusBarDocumentHandler
:
39 public ::cppu::WeakImplHelper1
< ::com::sun::star::xml::sax::XDocumentHandler
>
42 enum StatusBar_XML_Entry
45 SB_ELEMENT_STATUSBARITEM
,
49 SB_ATTRIBUTE_AUTOSIZE
,
50 SB_ATTRIBUTE_OWNERDRAW
,
57 enum StatusBar_XML_Namespace
61 SB_XML_NAMESPACES_COUNT
64 OReadStatusBarDocumentHandler( const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexContainer
>& aStatusBarItems
);
65 virtual ~OReadStatusBarDocumentHandler();
68 virtual void SAL_CALL
startDocument()
69 throw ( ::com::sun::star::xml::sax::SAXException
,
70 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
72 virtual void SAL_CALL
endDocument()
73 throw( ::com::sun::star::xml::sax::SAXException
,
74 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
76 virtual void SAL_CALL
startElement(
77 const OUString
& aName
,
78 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> &xAttribs
)
79 throw( ::com::sun::star::xml::sax::SAXException
,
80 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual void SAL_CALL
endElement(const OUString
& aName
)
83 throw( ::com::sun::star::xml::sax::SAXException
,
84 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual void SAL_CALL
characters(const OUString
& aChars
)
87 throw( ::com::sun::star::xml::sax::SAXException
,
88 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
90 virtual void SAL_CALL
ignorableWhitespace(const OUString
& aWhitespaces
)
91 throw( ::com::sun::star::xml::sax::SAXException
,
92 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
94 virtual void SAL_CALL
processingInstruction(const OUString
& aTarget
,
95 const OUString
& aData
)
96 throw( ::com::sun::star::xml::sax::SAXException
,
97 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
99 virtual void SAL_CALL
setDocumentLocator(
100 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
> &xLocator
)
101 throw( ::com::sun::star::xml::sax::SAXException
,
102 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
105 OUString
getErrorLineString();
107 class StatusBarHashMap
: public std::unordered_map
<OUString
,
108 StatusBar_XML_Entry
,
110 std::equal_to
< OUString
> >
115 StatusBarHashMap().swap( *this );// get rid of reserved capacity
119 bool m_bStatusBarStartFound
;
120 bool m_bStatusBarEndFound
;
121 bool m_bStatusBarItemStartFound
;
122 StatusBarHashMap m_aStatusBarMap
;
123 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexContainer
> m_aStatusBarItems
;
124 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XLocator
> m_xLocator
;
127 class FWE_DLLPUBLIC OWriteStatusBarDocumentHandler
130 OWriteStatusBarDocumentHandler(
131 const ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
>& rStatusBarItems
,
132 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
>& rWriteDocHandler
);
133 virtual ~OWriteStatusBarDocumentHandler();
135 void WriteStatusBarDocument() throw
136 ( ::com::sun::star::xml::sax::SAXException
,
137 ::com::sun::star::uno::RuntimeException
);
140 void WriteStatusBarItem(
141 const OUString
& rCommandURL
,
142 const OUString
& rHelpURL
,
145 sal_Int16 nWidth
) throw
146 ( ::com::sun::star::xml::sax::SAXException
,
147 ::com::sun::star::uno::RuntimeException
);
149 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XIndexAccess
> m_aStatusBarItems
;
150 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> m_xWriteDocumentHandler
;
151 ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
> m_xEmptyList
;
152 OUString m_aXMLStatusBarNS
;
153 OUString m_aXMLXlinkNS
;
154 OUString m_aAttributeType
;
155 OUString m_aAttributeURL
;
158 } // namespace framework
162 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */