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 <com/sun/star/lang/XServiceInfo.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/container/XNamed.hpp>
25 #include <com/sun/star/util/XRefreshable.hpp>
26 #include <com/sun/star/text/XDocumentIndexMark.hpp>
27 #include <com/sun/star/text/XDocumentIndex.hpp>
29 #include <cppuhelper/implbase.hxx>
31 #include <sfx2/Metadatable.hxx>
34 #include <unobaseclass.hxx>
35 #include "unosection.hxx"
39 class SwTOXBaseSection
;
43 typedef ::cppu::ImplInheritanceHelper
45 , css::util::XRefreshable
46 , css::text::XDocumentIndex
47 > SwXDocumentIndex_Base
;
49 class SW_DLLPUBLIC SwXDocumentIndex final
50 : public SwXDocumentIndex_Base
55 class StyleAccess_Impl
;
56 class TokenAccess_Impl
;
59 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
61 virtual ~SwXDocumentIndex() override
;
63 SwXDocumentIndex(SwTOXBaseSection
&, SwDoc
&);
66 SwXDocumentIndex(const TOXTypes eToxType
, SwDoc
& rDoc
);
70 static rtl::Reference
<SwXDocumentIndex
>
71 CreateXDocumentIndex(SwDoc
& rDoc
, SwTOXBaseSection
* pSection
,
72 TOXTypes eTypes
= TOX_INDEX
);
75 virtual ::sfx2::Metadatable
* GetCoreObject() override
;
76 virtual css::uno::Reference
< css::frame::XModel
>
80 virtual OUString SAL_CALL
getImplementationName() override
;
81 virtual sal_Bool SAL_CALL
supportsService(
82 const OUString
& rServiceName
) override
;
83 virtual css::uno::Sequence
< OUString
> SAL_CALL
84 getSupportedServiceNames() override
;
87 virtual void SAL_CALL
dispose() override
;
88 virtual void SAL_CALL
addEventListener(
89 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
90 virtual void SAL_CALL
removeEventListener(
91 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
94 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
95 getPropertySetInfo() override
;
96 virtual void SAL_CALL
setPropertyValue(
97 const OUString
& rPropertyName
,
98 const css::uno::Any
& rValue
) override
;
99 virtual css::uno::Any SAL_CALL
getPropertyValue(
100 const OUString
& rPropertyName
) override
;
101 virtual void SAL_CALL
addPropertyChangeListener(
102 const OUString
& rPropertyName
,
103 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
104 virtual void SAL_CALL
removePropertyChangeListener(
105 const OUString
& rPropertyName
,
106 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
107 virtual void SAL_CALL
addVetoableChangeListener(
108 const OUString
& rPropertyName
,
109 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
110 virtual void SAL_CALL
removeVetoableChangeListener(
111 const OUString
& rPropertyName
,
112 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
115 virtual OUString SAL_CALL
getName() override
;
116 virtual void SAL_CALL
setName(const OUString
& rName
) override
;
119 virtual void SAL_CALL
refresh() override
;
120 virtual void SAL_CALL
addRefreshListener(
121 const css::uno::Reference
< css::util::XRefreshListener
>& xListener
) override
;
122 virtual void SAL_CALL
removeRefreshListener(
123 const css::uno::Reference
< css::util::XRefreshListener
>& xListener
) override
;
126 virtual void SAL_CALL
attach(
127 const css::uno::Reference
< css::text::XTextRange
> & xTextRange
) override
;
128 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getAnchor() override
;
131 virtual OUString SAL_CALL
getServiceName() override
;
132 virtual void SAL_CALL
update() override
;
136 typedef ::cppu::WeakImplHelper
137 < css::lang::XServiceInfo
138 , css::beans::XPropertySet
139 , css::text::XDocumentIndexMark
140 > SwXDocumentIndexMark_Base
;
142 class SwXDocumentIndexMark final
143 : public SwXDocumentIndexMark_Base
149 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
151 virtual ~SwXDocumentIndexMark() override
;
153 SwXDocumentIndexMark(SwDoc
& rDoc
,
154 const SwTOXType
& rType
, const SwTOXMark
& rMark
);
157 SwXDocumentIndexMark(const TOXTypes eToxType
);
161 static rtl::Reference
<SwXDocumentIndexMark
>
162 CreateXDocumentIndexMark(SwDoc
& rDoc
,
163 SwTOXMark
* pMark
, TOXTypes eType
= TOX_INDEX
);
166 virtual OUString SAL_CALL
getImplementationName() override
;
167 virtual sal_Bool SAL_CALL
supportsService(
168 const OUString
& rServiceName
) override
;
169 virtual css::uno::Sequence
< OUString
> SAL_CALL
170 getSupportedServiceNames() override
;
173 virtual void SAL_CALL
dispose() override
;
174 virtual void SAL_CALL
addEventListener(
175 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
176 virtual void SAL_CALL
removeEventListener(
177 const css::uno::Reference
< css::lang::XEventListener
> & xListener
) override
;
180 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
181 getPropertySetInfo() override
;
182 virtual void SAL_CALL
setPropertyValue(
183 const OUString
& rPropertyName
,
184 const css::uno::Any
& rValue
) override
;
185 virtual css::uno::Any SAL_CALL
getPropertyValue(
186 const OUString
& rPropertyName
) override
;
187 virtual void SAL_CALL
addPropertyChangeListener(
188 const OUString
& rPropertyName
,
189 const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
190 virtual void SAL_CALL
removePropertyChangeListener(
191 const OUString
& rPropertyName
,
192 const css::uno::Reference
<css::beans::XPropertyChangeListener
>& xListener
) override
;
193 virtual void SAL_CALL
addVetoableChangeListener(
194 const OUString
& rPropertyName
,
195 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
196 virtual void SAL_CALL
removeVetoableChangeListener(
197 const OUString
& rPropertyName
,
198 const css::uno::Reference
< css::beans::XVetoableChangeListener
>& xListener
) override
;
201 virtual void SAL_CALL
attach(
202 const css::uno::Reference
< css::text::XTextRange
> & xTextRange
) override
;
203 virtual css::uno::Reference
< css::text::XTextRange
> SAL_CALL
getAnchor() override
;
205 // XDocumentIndexMark
206 virtual OUString SAL_CALL
getMarkEntry() override
;
207 virtual void SAL_CALL
setMarkEntry(const OUString
& rIndexEntry
) override
;
209 // called when the associated SwTOXMark is deleted
210 void OnSwTOXMarkDeleted();
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */