| 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 | |
| 22 | #include "swdllapi.h" |
| 23 | #include <com/sun/star/lang/XServiceInfo.hpp> |
| 24 | #include <com/sun/star/beans/XPropertySet.hpp> |
| 25 | #include <com/sun/star/beans/XPropertyState.hpp> |
| 26 | #include <com/sun/star/beans/XMultiPropertySet.hpp> |
| 27 | #include <com/sun/star/container/XNamed.hpp> |
| 28 | #include <com/sun/star/text/XTextSection.hpp> |
| 29 | |
| 30 | #include <cppuhelper/implbase.hxx> |
| 31 | |
| 32 | #include <sfx2/Metadatable.hxx> |
| 33 | |
| 34 | #include "unobaseclass.hxx" |
| 35 | |
| 36 | class SwSectionFormat; |
| 37 | |
| 38 | typedef ::cppu::ImplInheritanceHelper |
| 39 | < ::sfx2::MetadatableMixin |
| 40 | , css::lang::XServiceInfo |
| 41 | , css::beans::XPropertySet |
| 42 | , css::container::XNamed |
| 43 | , css::text::XTextContent |
| 44 | > SwXSection_Base; |
| 45 | |
| 46 | /// Base class for SwXTextSection and SwXDocumentIndex |
| 47 | class SW_DLLPUBLIC SwXSection |
| 48 | : public SwXSection_Base |
| 49 | { |
| 50 | public: |
| 51 | ~SwXSection(); |
| 52 | }; |
| 53 | |
| 54 | |
| 55 | typedef ::cppu::ImplInheritanceHelper |
| 56 | < SwXSection |
| 57 | , css::beans::XPropertyState |
| 58 | , css::beans::XMultiPropertySet |
| 59 | , css::text::XTextSection |
| 60 | > SwXTextSection_Base; |
| 61 | |
| 62 | class SW_DLLPUBLIC SwXTextSection final |
| 63 | : public SwXTextSection_Base |
| 64 | { |
| 65 | |
| 66 | private: |
| 67 | |
| 68 | class Impl; |
| 69 | ::sw::UnoImplPtr<Impl> m_pImpl; |
| 70 | |
| 71 | SwXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader); |
| 72 | |
| 73 | virtual ~SwXTextSection() override; |
| 74 | |
| 75 | public: |
| 76 | |
| 77 | SwSectionFormat* GetFormat() const; |
| 78 | |
| 79 | static rtl::Reference< SwXTextSection > |
| 80 | CreateXTextSection(SwSectionFormat *const pFormat, |
| 81 | const bool bIndexHeader = false); |
| 82 | |
| 83 | // MetadatableMixin |
| 84 | virtual ::sfx2::Metadatable* GetCoreObject() override; |
| 85 | virtual css::uno::Reference< css::frame::XModel > |
| 86 | GetModel() override; |
| 87 | |
| 88 | // XServiceInfo |
| 89 | virtual OUString SAL_CALL getImplementationName() override; |
| 90 | virtual sal_Bool SAL_CALL supportsService( |
| 91 | const OUString& rServiceName) override; |
| 92 | virtual css::uno::Sequence< OUString > SAL_CALL |
| 93 | getSupportedServiceNames() override; |
| 94 | |
| 95 | // XComponent |
| 96 | virtual void SAL_CALL dispose() override; |
| 97 | virtual void SAL_CALL addEventListener( |
| 98 | const css::uno::Reference< css::lang::XEventListener > & xListener) override; |
| 99 | virtual void SAL_CALL removeEventListener( |
| 100 | const css::uno::Reference< css::lang::XEventListener > & xListener) override; |
| 101 | |
| 102 | // XPropertySet |
| 103 | virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL |
| 104 | getPropertySetInfo() override; |
| 105 | virtual void SAL_CALL setPropertyValue( |
| 106 | const OUString& rPropertyName, |
| 107 | const css::uno::Any& rValue) override; |
| 108 | virtual css::uno::Any SAL_CALL getPropertyValue( |
| 109 | const OUString& rPropertyName) override; |
| 110 | virtual void SAL_CALL addPropertyChangeListener( |
| 111 | const OUString& rPropertyName, |
| 112 | const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; |
| 113 | virtual void SAL_CALL removePropertyChangeListener( |
| 114 | const OUString& rPropertyName, |
| 115 | const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener) override; |
| 116 | virtual void SAL_CALL addVetoableChangeListener( |
| 117 | const OUString& rPropertyName, |
| 118 | const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; |
| 119 | virtual void SAL_CALL removeVetoableChangeListener( |
| 120 | const OUString& rPropertyName, |
| 121 | const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener) override; |
| 122 | |
| 123 | // XPropertyState |
| 124 | virtual css::beans::PropertyState SAL_CALL |
| 125 | getPropertyState(const OUString& rPropertyName) override; |
| 126 | virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL |
| 127 | getPropertyStates( |
| 128 | const css::uno::Sequence< OUString >& rPropertyNames) override; |
| 129 | virtual void SAL_CALL setPropertyToDefault( |
| 130 | const OUString& rPropertyName) override; |
| 131 | virtual css::uno::Any SAL_CALL getPropertyDefault( |
| 132 | const OUString& rPropertyName) override; |
| 133 | |
| 134 | // XMultiPropertySet |
| 135 | virtual void SAL_CALL setPropertyValues( |
| 136 | const css::uno::Sequence< OUString >& rPropertyNames, |
| 137 | const css::uno::Sequence< css::uno::Any >& rValues) override; |
| 138 | virtual css::uno::Sequence< css::uno::Any > |
| 139 | SAL_CALL getPropertyValues( |
| 140 | const css::uno::Sequence< OUString >& rPropertyNames) override; |
| 141 | virtual void SAL_CALL addPropertiesChangeListener( |
| 142 | const css::uno::Sequence< OUString >& rPropertyNames, |
| 143 | const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override; |
| 144 | virtual void SAL_CALL removePropertiesChangeListener( |
| 145 | const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override; |
| 146 | virtual void SAL_CALL firePropertiesChangeEvent( |
| 147 | const css::uno::Sequence< OUString >& rPropertyNames, |
| 148 | const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener) override; |
| 149 | |
| 150 | // XNamed |
| 151 | virtual OUString SAL_CALL getName() override; |
| 152 | virtual void SAL_CALL setName(const OUString& rName) override; |
| 153 | |
| 154 | // XTextContent |
| 155 | virtual void SAL_CALL attach( |
| 156 | const css::uno::Reference< css::text::XTextRange > & xTextRange) override; |
| 157 | virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override; |
| 158 | |
| 159 | // XTextSection |
| 160 | virtual css::uno::Reference< css::text::XTextSection > SAL_CALL |
| 161 | getParentSection() override; |
| 162 | virtual css::uno::Sequence< css::uno::Reference< css::text::XTextSection > > SAL_CALL |
| 163 | getChildSections() override; |
| 164 | |
| 165 | }; |
| 166 | |
| 167 | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |