android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / access / accfootnote.cxx
blob6fb7ebca864cc05e656db3db325ed83b70369450
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
23 #include <ftnfrm.hxx>
24 #include <fmtftn.hxx>
25 #include <txtftn.hxx>
26 #include <viewsh.hxx>
27 #include <accmap.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 constexpr OUStringLiteral sImplementationNameFootnote
37 = u"com.sun.star.comp.Writer.SwAccessibleFootnoteView";
38 constexpr OUStringLiteral sImplementationNameEndnote
39 = u"com.sun.star.comp.Writer.SwAccessibleEndnoteView";
41 SwAccessibleFootnote::SwAccessibleFootnote(
42 std::shared_ptr<SwAccessibleMap> const& pInitMap,
43 bool bIsEndnote,
44 const SwFootnoteFrame *pFootnoteFrame ) :
45 SwAccessibleContext( pInitMap,
46 bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
47 pFootnoteFrame )
49 TranslateId pResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
50 : STR_ACCESS_FOOTNOTE_NAME;
52 OUString sArg;
53 const SwTextFootnote *pTextFootnote =
54 static_cast< const SwFootnoteFrame *>( GetFrame() )->GetAttr();
55 if( pTextFootnote )
57 const SwDoc *pDoc = GetShell()->GetDoc();
58 sArg = pTextFootnote->GetFootnote().GetViewNumStr(*pDoc, pFootnoteFrame->getRootFrame());
61 SetName(GetResource(pResId, &sArg));
64 SwAccessibleFootnote::~SwAccessibleFootnote()
68 OUString SAL_CALL SwAccessibleFootnote::getAccessibleDescription()
70 SolarMutexGuard aGuard;
72 ThrowIfDisposed();
74 TranslateId pResId = AccessibleRole::END_NOTE == GetRole()
75 ? STR_ACCESS_ENDNOTE_DESC
76 : STR_ACCESS_FOOTNOTE_DESC ;
78 OUString sArg;
79 const SwTextFootnote *pTextFootnote =
80 static_cast< const SwFootnoteFrame *>( GetFrame() )->GetAttr();
81 if( pTextFootnote )
83 const SwDoc *pDoc = GetMap()->GetShell()->GetDoc();
84 sArg = pTextFootnote->GetFootnote().GetViewNumStr(*pDoc, GetFrame()->getRootFrame());
87 return GetResource(pResId, &sArg);
90 OUString SAL_CALL SwAccessibleFootnote::getImplementationName()
92 if( AccessibleRole::END_NOTE == GetRole() )
93 return sImplementationNameEndnote;
94 else
95 return sImplementationNameFootnote;
98 sal_Bool SAL_CALL SwAccessibleFootnote::supportsService(const OUString& sTestServiceName)
100 return cppu::supportsService(this, sTestServiceName);
103 Sequence< OUString > SAL_CALL SwAccessibleFootnote::getSupportedServiceNames()
105 return { (AccessibleRole::END_NOTE == GetRole())?OUString("com.sun.star.text.AccessibleEndnoteView"):OUString("com.sun.star.text.AccessibleFootnoteView"),
106 sAccessibleServiceName };
109 Sequence< sal_Int8 > SAL_CALL SwAccessibleFootnote::getImplementationId()
111 return css::uno::Sequence<sal_Int8>();
114 bool SwAccessibleFootnote::IsEndnote( const SwFootnoteFrame *pFootnoteFrame )
116 const SwTextFootnote *pTextFootnote = pFootnoteFrame ->GetAttr();
117 return pTextFootnote && pTextFootnote->GetFootnote().IsEndNote() ;
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */