2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2002-02-27 08:30:44 +00:00
|
|
|
|
2003-04-24 15:11:43 +00:00
|
|
|
#include <com/sun/star/accessibility/AccessibleRole.hpp>
|
2002-02-27 08:30:44 +00:00
|
|
|
#include <unotools/accessiblestatesethelper.hxx>
|
2013-12-05 19:17:18 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2002-02-27 08:30:44 +00:00
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <hffrm.hxx>
|
|
|
|
#include "accheaderfooter.hxx"
|
2017-10-23 22:30:30 +02:00
|
|
|
#include <strings.hrc>
|
2002-02-27 08:30:44 +00:00
|
|
|
|
2007-09-27 07:21:44 +00:00
|
|
|
using namespace ::com::sun::star;
|
2002-02-27 08:30:44 +00:00
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::uno;
|
2003-04-24 15:11:43 +00:00
|
|
|
using namespace ::com::sun::star::accessibility;
|
2002-02-27 08:30:44 +00:00
|
|
|
|
2002-12-05 13:32:16 +00:00
|
|
|
const sal_Char sImplementationNameHeader[] = "com.sun.star.comp.Writer.SwAccessibleHeaderView";
|
|
|
|
const sal_Char sImplementationNameFooter[] = "com.sun.star.comp.Writer.SwAccessibleFooterView";
|
2002-02-27 08:30:44 +00:00
|
|
|
|
|
|
|
SwAccessibleHeaderFooter::SwAccessibleHeaderFooter(
|
2017-03-24 13:04:32 +01:00
|
|
|
std::shared_ptr<SwAccessibleMap> const& pInitMap,
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwHeaderFrame* pHdFrame ) :
|
|
|
|
SwAccessibleContext( pInitMap, AccessibleRole::HEADER, pHdFrame )
|
2002-02-27 08:30:44 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
OUString sArg( OUString::number( pHdFrame->GetPhyPageNum() ) );
|
2002-02-27 08:30:44 +00:00
|
|
|
SetName( GetResource( STR_ACCESS_HEADER_NAME, &sArg ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAccessibleHeaderFooter::SwAccessibleHeaderFooter(
|
2017-03-24 13:04:32 +01:00
|
|
|
std::shared_ptr<SwAccessibleMap> const& pInitMap,
|
2015-11-25 06:03:10 -05:00
|
|
|
const SwFooterFrame* pFtFrame ) :
|
|
|
|
SwAccessibleContext( pInitMap, AccessibleRole::FOOTER, pFtFrame )
|
2002-02-27 08:30:44 +00:00
|
|
|
{
|
2015-11-25 06:03:10 -05:00
|
|
|
OUString sArg( OUString::number( pFtFrame->GetPhyPageNum() ) );
|
2002-02-27 08:30:44 +00:00
|
|
|
SetName( GetResource( STR_ACCESS_FOOTER_NAME, &sArg ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
SwAccessibleHeaderFooter::~SwAccessibleHeaderFooter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2015-04-14 12:44:47 +02:00
|
|
|
OUString SAL_CALL SwAccessibleHeaderFooter::getAccessibleDescription()
|
2002-02-27 08:30:44 +00:00
|
|
|
{
|
2010-10-13 01:44:10 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2002-02-27 08:30:44 +00:00
|
|
|
|
2017-03-24 21:50:29 +01:00
|
|
|
ThrowIfDisposed();
|
2002-02-27 08:30:44 +00:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
const char* pResId = AccessibleRole::HEADER == GetRole()
|
2002-02-27 08:30:44 +00:00
|
|
|
? STR_ACCESS_HEADER_DESC
|
|
|
|
: STR_ACCESS_FOOTER_DESC ;
|
|
|
|
|
2002-04-11 13:04:40 +00:00
|
|
|
OUString sArg( GetFormattedPageNumber() );
|
2002-02-27 08:30:44 +00:00
|
|
|
|
2017-06-11 20:56:30 +01:00
|
|
|
return GetResource(pResId, &sArg);
|
2002-02-27 08:30:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OUString SAL_CALL SwAccessibleHeaderFooter::getImplementationName()
|
|
|
|
{
|
2002-07-09 11:51:33 +00:00
|
|
|
if( AccessibleRole::HEADER == GetRole() )
|
2013-03-01 13:50:58 +01:00
|
|
|
return OUString(sImplementationNameHeader);
|
2002-07-09 11:51:33 +00:00
|
|
|
else
|
2013-03-01 13:50:58 +01:00
|
|
|
return OUString(sImplementationNameFooter);
|
2002-02-27 08:30:44 +00:00
|
|
|
}
|
|
|
|
|
2013-12-05 19:17:18 -02:00
|
|
|
sal_Bool SAL_CALL SwAccessibleHeaderFooter::supportsService(const OUString& sTestServiceName)
|
2002-02-27 08:30:44 +00:00
|
|
|
{
|
2013-12-05 19:17:18 -02:00
|
|
|
return cppu::supportsService(this, sTestServiceName);
|
2002-02-27 08:30:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Sequence< OUString > SAL_CALL SwAccessibleHeaderFooter::getSupportedServiceNames()
|
|
|
|
{
|
2002-07-09 11:51:33 +00:00
|
|
|
Sequence< OUString > aRet(2);
|
2002-02-27 08:30:44 +00:00
|
|
|
OUString* pArray = aRet.getArray();
|
|
|
|
if( AccessibleRole::HEADER == GetRole() )
|
2013-12-05 19:17:18 -02:00
|
|
|
pArray[0] = "com.sun.star.text.AccessibleHeaderView";
|
2002-02-27 08:30:44 +00:00
|
|
|
else
|
2013-12-05 19:17:18 -02:00
|
|
|
pArray[0] = "com.sun.star.text.AccessibleFooterView";
|
2014-12-18 13:35:13 +01:00
|
|
|
pArray[1] = sAccessibleServiceName;
|
2002-02-27 08:30:44 +00:00
|
|
|
return aRet;
|
|
|
|
}
|
2002-08-15 09:25:23 +00:00
|
|
|
|
|
|
|
Sequence< sal_Int8 > SAL_CALL SwAccessibleHeaderFooter::getImplementationId()
|
|
|
|
{
|
2014-03-10 16:24:57 +01:00
|
|
|
return css::uno::Sequence<sal_Int8>();
|
2002-08-15 09:25:23 +00:00
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
2013-11-29 13:03:27 +00:00
|
|
|
sal_Int32 SAL_CALL SwAccessibleHeaderFooter::getBackground()
|
|
|
|
{
|
|
|
|
Reference< XAccessible > xParent = getAccessibleParent();
|
|
|
|
if (xParent.is())
|
|
|
|
{
|
|
|
|
Reference< XAccessibleComponent > xAccContext (xParent,UNO_QUERY);
|
|
|
|
if(xAccContext.is())
|
|
|
|
{
|
|
|
|
return xAccContext->getBackground();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return SwAccessibleContext::getBackground();
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:30:41 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|