LibreOffice Module framework (master) 1
toolboxdocumenthandler.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
23
24#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
25
26#include <rtl/ustring.hxx>
28
29#include <unordered_map>
30
31namespace framework{
32
33// Hash code function for using in all hash maps of follow implementation.
34
35// workaround for incremental linking bugs in MSVC2015
36class SAL_DLLPUBLIC_TEMPLATE OReadToolBoxDocumentHandler_Base : public cppu::WeakImplHelper< css::xml::sax::XDocumentHandler > {};
37
39{
40 public:
42 {
54 };
55
57 {
60 };
61
62 OReadToolBoxDocumentHandler( const css::uno::Reference< css::container::XIndexContainer >& rItemContainer );
63 virtual ~OReadToolBoxDocumentHandler() override;
64
65 // XDocumentHandler
66 virtual void SAL_CALL startDocument() override;
67
68 virtual void SAL_CALL endDocument() override;
69
70 virtual void SAL_CALL startElement(
71 const OUString& aName,
72 const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override;
73
74 virtual void SAL_CALL endElement(const OUString& aName) override;
75
76 virtual void SAL_CALL characters(const OUString& aChars) override;
77
78 virtual void SAL_CALL ignorableWhitespace(const OUString& aWhitespaces) override;
79
80 virtual void SAL_CALL processingInstruction(const OUString& aTarget,
81 const OUString& aData) override;
82
83 virtual void SAL_CALL setDocumentLocator(
84 const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override;
85
86 private:
87 OUString getErrorLineString();
88
89 class ToolBoxHashMap : public std::unordered_map<OUString,
90 ToolBox_XML_Entry>
91 {
92 };
93
100 css::uno::Reference< css::container::XIndexContainer > m_rItemContainer;
101 css::uno::Reference< css::xml::sax::XLocator > m_xLocator;
102
103 OUString m_aType;
104 OUString m_aLabel;
105 OUString m_aStyle;
106 OUString m_aIsVisible;
108};
109
111{
112 public:
114 const css::uno::Reference< css::container::XIndexAccess >& rItemAccess,
115 css::uno::Reference< css::xml::sax::XDocumentHandler > const & rDocumentHandler );
117
121
122 private:
125 void WriteToolBoxItem( const OUString& aCommandURL, const OUString& aLabel, sal_Int16 nStyle, bool bVisible );
126
129 void WriteToolBoxSpace();
130
133 void WriteToolBoxBreak();
134
138
139 css::uno::Reference< css::xml::sax::XDocumentHandler > m_xWriteDocumentHandler;
140 css::uno::Reference< css::xml::sax::XAttributeList > m_xEmptyList;
141 css::uno::Reference< css::container::XIndexAccess > m_rItemAccess;
145};
146
147} // namespace framework
148
149/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL characters(const OUString &aChars) override
virtual void SAL_CALL setDocumentLocator(const css::uno::Reference< css::xml::sax::XLocator > &xLocator) override
virtual void SAL_CALL ignorableWhitespace(const OUString &aWhitespaces) override
virtual void SAL_CALL startDocument() override
virtual void SAL_CALL endDocument() override
virtual void SAL_CALL endElement(const OUString &aName) override
OReadToolBoxDocumentHandler(const css::uno::Reference< css::container::XIndexContainer > &rItemContainer)
virtual void SAL_CALL startElement(const OUString &aName, const css::uno::Reference< css::xml::sax::XAttributeList > &xAttribs) override
virtual void SAL_CALL processingInstruction(const OUString &aTarget, const OUString &aData) override
css::uno::Reference< css::container::XIndexContainer > m_rItemContainer
css::uno::Reference< css::xml::sax::XLocator > m_xLocator
css::uno::Reference< css::xml::sax::XDocumentHandler > m_xWriteDocumentHandler
css::uno::Reference< css::xml::sax::XAttributeList > m_xEmptyList
OWriteToolBoxDocumentHandler(const css::uno::Reference< css::container::XIndexAccess > &rItemAccess, css::uno::Reference< css::xml::sax::XDocumentHandler > const &rDocumentHandler)
void WriteToolBoxItem(const OUString &aCommandURL, const OUString &aLabel, sal_Int16 nStyle, bool bVisible)
css::uno::Reference< css::container::XIndexAccess > m_rItemAccess
bool bVisible
OUString aLabel