LibreOffice Module sw (master) 1
accheaderfooter.cxx
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#include <com/sun/star/accessibility/AccessibleRole.hpp>
22#include <vcl/svapp.hxx>
23#include <hffrm.hxx>
24#include "accheaderfooter.hxx"
25#include <strings.hrc>
26
27using namespace ::com::sun::star;
28using namespace ::com::sun::star::lang;
29using namespace ::com::sun::star::uno;
30using namespace ::com::sun::star::accessibility;
31
32constexpr OUStringLiteral sImplementationNameHeader
33 = u"com.sun.star.comp.Writer.SwAccessibleHeaderView";
34constexpr OUStringLiteral sImplementationNameFooter
35 = u"com.sun.star.comp.Writer.SwAccessibleFooterView";
36
38 std::shared_ptr<SwAccessibleMap> const& pInitMap,
39 const SwHeaderFrame* pHdFrame ) :
40 SwAccessibleContext( pInitMap, AccessibleRole::HEADER, pHdFrame )
41{
42 OUString sArg( OUString::number( pHdFrame->GetPhyPageNum() ) );
43 SetName( GetResource( STR_ACCESS_HEADER_NAME, &sArg ) );
44}
45
47 std::shared_ptr<SwAccessibleMap> const& pInitMap,
48 const SwFooterFrame* pFtFrame ) :
49 SwAccessibleContext( pInitMap, AccessibleRole::FOOTER, pFtFrame )
50{
51 OUString sArg( OUString::number( pFtFrame->GetPhyPageNum() ) );
52 SetName( GetResource( STR_ACCESS_FOOTER_NAME, &sArg ) );
53}
54
56{
57}
58
60{
61 SolarMutexGuard aGuard;
62
64
65 TranslateId pResId = AccessibleRole::HEADER == GetRole()
66 ? STR_ACCESS_HEADER_DESC
67 : STR_ACCESS_FOOTER_DESC ;
68
69 OUString sArg( GetFormattedPageNumber() );
70
71 return GetResource(pResId, &sArg);
72}
73
75{
76 if( AccessibleRole::HEADER == GetRole() )
78 else
80}
81
82sal_Bool SAL_CALL SwAccessibleHeaderFooter::supportsService(const OUString& sTestServiceName)
83{
84 return cppu::supportsService(this, sTestServiceName);
85}
86
88{
89 return { (AccessibleRole::HEADER == GetRole())?OUString("com.sun.star.text.AccessibleHeaderView"):OUString("com.sun.star.text.AccessibleFooterView"),
91}
92
93Sequence< sal_Int8 > SAL_CALL SwAccessibleHeaderFooter::getImplementationId()
94{
95 return css::uno::Sequence<sal_Int8>();
96}
97
99{
100 Reference< XAccessible > xParent = getAccessibleParent();
101 if (xParent.is())
102 {
103 Reference< XAccessibleComponent > xAccContext (xParent,UNO_QUERY);
104 if(xAccContext.is())
105 {
106 return xAccContext->getBackground();
107 }
108 }
110}
111
112/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sAccessibleServiceName
Definition: acccontext.hxx:42
constexpr OUStringLiteral sImplementationNameHeader
constexpr OUStringLiteral sImplementationNameFooter
void SetName(const OUString &rName)
Definition: acccontext.hxx:99
sal_Int16 GetRole() const
Definition: acccontext.hxx:100
virtual css::uno::Reference< css::accessibility::XAccessible > SAL_CALL getAccessibleParent() override
Definition: acccontext.cxx:687
virtual sal_Int32 SAL_CALL getBackground() override
static OUString GetResource(TranslateId pResId, const OUString *pArg1=nullptr, const OUString *pArg2=nullptr)
OUString GetFormattedPageNumber() const
Definition: accframe.cxx:427
sal_Int32 SAL_CALL getBackground() override
virtual ~SwAccessibleHeaderFooter() override
virtual sal_Bool SAL_CALL supportsService(const OUString &sServiceName) override
Return whether the specified service is supported by this class.
virtual OUString SAL_CALL getImplementationName() override
Returns an identifier for the implementation of this object.
SwAccessibleHeaderFooter(std::shared_ptr< SwAccessibleMap > const &pInitMap, const SwHeaderFrame *pHdFrame)
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
virtual OUString SAL_CALL getAccessibleDescription() override
Return this object's description.
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Returns a list of all supported services.
Footer in the document layout, inside a page.
Definition: hffrm.hxx:51
sal_uInt16 GetPhyPageNum() const
Definition: trvlfrm.cxx:1706
Header in the document layout, inside a page.
Definition: hffrm.hxx:44
float u
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
unsigned char sal_Bool