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 #include <com/sun/star/accessibility/AccessibleRole.hpp>
21 #include <cppuhelper/supportsservice.hxx>
22 #include <vcl/svapp.hxx>
28 #include "accfootnote.hxx"
29 #include <strings.hrc>
31 using namespace ::com::sun::star
;
32 using namespace ::com::sun::star::uno
;
33 using namespace ::com::sun::star::lang
;
34 using namespace ::com::sun::star::accessibility
;
36 SwAccessibleFootnote::SwAccessibleFootnote(
37 std::shared_ptr
<SwAccessibleMap
> const& pInitMap
,
39 const SwFootnoteFrame
*pFootnoteFrame
) :
40 SwAccessibleContext( pInitMap
,
41 bIsEndnote
? AccessibleRole::END_NOTE
: AccessibleRole::FOOTNOTE
,
44 TranslateId pResId
= bIsEndnote
? STR_ACCESS_ENDNOTE_NAME
45 : STR_ACCESS_FOOTNOTE_NAME
;
48 const SwTextFootnote
*pTextFootnote
=
49 static_cast< const SwFootnoteFrame
*>( GetFrame() )->GetAttr();
52 const SwDoc
*pDoc
= GetShell()->GetDoc();
53 sArg
= pTextFootnote
->GetFootnote().GetViewNumStr(*pDoc
, pFootnoteFrame
->getRootFrame());
56 SetName(GetResource(pResId
, &sArg
));
59 SwAccessibleFootnote::~SwAccessibleFootnote()
63 OUString SAL_CALL
SwAccessibleFootnote::getAccessibleDescription()
65 SolarMutexGuard aGuard
;
69 TranslateId pResId
= AccessibleRole::END_NOTE
== GetRole()
70 ? STR_ACCESS_ENDNOTE_DESC
71 : STR_ACCESS_FOOTNOTE_DESC
;
74 const SwTextFootnote
*pTextFootnote
=
75 static_cast< const SwFootnoteFrame
*>( GetFrame() )->GetAttr();
78 const SwDoc
*pDoc
= GetMap()->GetShell()->GetDoc();
79 sArg
= pTextFootnote
->GetFootnote().GetViewNumStr(*pDoc
, GetFrame()->getRootFrame());
82 return GetResource(pResId
, &sArg
);
85 OUString SAL_CALL
SwAccessibleFootnote::getImplementationName()
87 if( AccessibleRole::END_NOTE
== GetRole() )
88 return u
"com.sun.star.comp.Writer.SwAccessibleEndnoteView"_ustr
;
90 return u
"com.sun.star.comp.Writer.SwAccessibleFootnoteView"_ustr
;
93 sal_Bool SAL_CALL
SwAccessibleFootnote::supportsService(const OUString
& sTestServiceName
)
95 return cppu::supportsService(this, sTestServiceName
);
98 Sequence
< OUString
> SAL_CALL
SwAccessibleFootnote::getSupportedServiceNames()
100 return { (AccessibleRole::END_NOTE
== GetRole())?u
"com.sun.star.text.AccessibleEndnoteView"_ustr
:u
"com.sun.star.text.AccessibleFootnoteView"_ustr
,
101 sAccessibleServiceName
};
104 Sequence
< sal_Int8
> SAL_CALL
SwAccessibleFootnote::getImplementationId()
106 return css::uno::Sequence
<sal_Int8
>();
109 bool SwAccessibleFootnote::IsEndnote( const SwFootnoteFrame
*pFootnoteFrame
)
111 const SwTextFootnote
*pTextFootnote
= pFootnoteFrame
->GetAttr();
112 return pTextFootnote
&& pTextFootnote
->GetFootnote().IsEndNote() ;
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */