Files
libreoffice/editeng/source/uno/unoedprx.cxx

1246 lines
39 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
re-base on ALv2 code. Includes (at least) relevant parts of: linecap: Reintegrating finished LineCap feature Patch contributed by Regina Henschel http://svn.apache.org/viewvc?view=revision&revision=1232507 Patches contributed by Sven Jacobi impress212: #i81610# fixed animation export http://svn.apache.org/viewvc?view=revision&revision=1167620 impress212: drawinglayer gbuild environment changes http://svn.apache.org/viewvc?view=revision&revision=1167627 http://svn.apache.org/viewvc?view=revision&revision=1167628 impress212: DffPropSet -> minor code improvements, removing table http://svn.apache.org/viewvc?view=revision&revision=1167634 impress212: #158494# fixed excel import (text rotation) http://svn.apache.org/viewvc?view=revision&revision=1167638 Patches contributed by Armin Le Grand Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement http://svn.apache.org/viewvc?view=revision&revision=1220836 #118728# changed indentifying definitions for Svg file detection http://svn.apache.org/viewvc?view=revision&revision=1229961 #118838# LineGeometry creation for complicated cases optimized to create single Polygons http://svn.apache.org/viewvc?view=revision&revision=1236232 #119176# corrected file type detection for SVG for svg files without xml header http://svn.apache.org/viewvc?view=revision&revision=1309445 #118728# Extended Svg file detection http://svn.apache.org/viewvc?view=revision&revision=1230531 #118529# solve break converters and convert commands for OLEs and images http://svn.apache.org/viewvc?view=revision&revision=1186168 svg: added WaE changes from branch svgreplacement to trunc http://svn.apache.org/viewvc?view=revision&revision=1222974 svg: corrected missing member initialization http://svn.apache.org/viewvc?view=revision&revision=1226134 fix for #118525#: Using primitives for chart sub-geometry visualisation http://svn.apache.org/viewvc?view=revision&revision=1226879 #118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert metafiles to bitmapEx ... http://svn.apache.org/viewvc?view=revision&revision=1293316 fix for #118525#: removed no longer used variable maOriginalMapMode, one more exception eliminated http://svn.apache.org/viewvc?view=revision&revision=1227097 #16758# Added buffering to the VDev usages of the VclProcessor2D derivates... http://svn.apache.org/viewvc?view=revision&revision=1229521 #116758# Secured VDev buffer device to Vcl deinit http://svn.apache.org/viewvc?view=revision&revision=1230574 #116758# added remembering allocated VDevs for VDevBuffer to be able to also delete these when vcl goes down; it should never happen, but You never know http://svn.apache.org/viewvc?view=revision&revision=1230927 #118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive representation instead of TransparencePrimitive2D http://svn.apache.org/viewvc?view=revision&revision=1231198 #118822# secured 3D geometry creation (slices) by subdividing the 2D source polyPolygon early http://svn.apache.org/viewvc?view=revision&revision=1234749 #118829# enhanced Svg gradient quality, obstacles avoided http://svn.apache.org/viewvc?view=revision&revision=1235361 #118834# Unified usage of TextBreakupHelper as single tooling class for i18n text primitive breakup http://svn.apache.org/viewvc?view=revision&revision=1236110 #118853# added square pixel size limit to conversion of TransparencePrimitive2D to Metafile action http://svn.apache.org/viewvc?view=revision&revision=1237656 #118824# coreccted mirroring and boundrect when the graphicmanager is used for bitmap output http://svn.apache.org/viewvc?view=revision&revision=1240097 #115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for various optimization scenarios http://svn.apache.org/viewvc?view=revision&revision=1241434 #118783# Corrected errors in ID strings, corrected Svg line/fill export, corrected polygon close state http://svn.apache.org/viewvc?view=revision&revision=1232006 #118796# corrected null-pointer usage in SVG text exporter http://svn.apache.org/viewvc?view=revision&revision=1240262 #118729# Use GraphicStreamUrl and GraphicUrl to allow multi image import with linked graphics, too http://svn.apache.org/viewvc?view=revision&revision=1229962 #118898# corrected error in GDIMetaFile::GetBoundRect in handling MetaFloatTransparentAction http://svn.apache.org/viewvc?view=revision&revision=1293349 #118855# Corrected handling of possibly created empty clipRegions after PolyPolygon clipping http://svn.apache.org/viewvc?view=revision&revision=1237725 #115962# Better (but not yet optimal, see comments in task) handling of MetaFloatTransparentAction in PDF export http://svn.apache.org/viewvc?view=revision&revision=1241078 IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ... http://svn.apache.org/viewvc?view=revision&revision=1200879 118779# Added svg content streaming in/out to ImpGraphic stream operators http://svn.apache.org/viewvc?view=revision&revision=1231908 linecap: correctons for WaE and mac drawing http://svn.apache.org/viewvc?view=revision&revision=1232793 svg: uses current system Dpi for Svg replacement image creation http://svn.apache.org/viewvc?view=revision&revision=1233948 Patches contributed by Mathias Bauer (and others) gnumake4 work variously http://svn.apache.org/viewvc?view=revision&revision=1394326 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1394326 Remove duplicate header includes. cws mba34issues01: #i117720#: convert assertion into warning http://svn.apache.org/viewvc?view=revision&revision=1172352 118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand. http://svn.apache.org/viewvc?view=revision&revision=1182166 cws mba34issues01: #i117714#: remove assertion http://svn.apache.org/viewvc?view=revision&revision=1172357 Patch contributed by Jurgen Schmidt add some additional checks to ensure proper reading operations http://svn.apache.org/viewvc?view=revision&revision=1209022 mostly prefer our stream / bounds checking work. Patches contributed by Herbert Duerr #i118816# add clarifying comment regarding Font::*Color*() methods http://svn.apache.org/viewvc?view=revision&revision=1233833 extend macro->string handling for empty strings http://svn.apache.org/viewvc?view=revision&revision=1175801 avoid magic constants for SALCOLOR_NONE http://svn.apache.org/viewvc?view=revision&revision=1177543 initialize slant properly in ImplFontMetricData constructor (author=iorsh) http://svn.apache.org/viewvc?view=revision&revision=1177551 #i118675# make check for extension updates more stable http://svn.apache.org/viewvc?view=revision&revision=1214797 #a118617# remove VBasicEventListener.dll binary There are no known users depending on its CLSID http://svn.apache.org/viewvc?view=revision&revision=1203697 Patches contributed by Ariel Constenla-Haile Fix build breaker on Linux/gcc http://svn.apache.org/viewvc?view=revision&revision=1221104 Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG http://svn.apache.org/viewvc?view=revision&revision=1215559 Patches contributed by Oliver-Rainer Wittmann sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider instances of <SwFlyDrawObj> http://svn.apache.org/viewvc?view=revision&revision=1172120 sw34bf06: #i117783# - Writer's implementation of XPagePrintable - apply print settings to new printing routines http://svn.apache.org/viewvc?view=revision&revision=1172115 gnumake4 work variously from Hans-Joachim Lankenau http://svn.apache.org/viewvc?view=revision&revision=1397315 http://svn.apache.org/viewvc?view=revision&revision=1396797 http://svn.apache.org/viewvc?view=revision&revision=1396782 http://svn.apache.org/viewvc?view=revision&revision=1394707 plus some amount of re-splitting of legacy headers. Patch contributed by Pavel Janik WaE: Remove unused variables. http://svn.apache.org/viewvc?view=revision&revision=1230697 Patches contributed by Takashi Ono mingwport35: i#117795: MinGW port fix for vcl2gnumake http://svn.apache.org/viewvc?view=revision&revision=1172091 mingwport35: i#117795: MinGW port fix for vcl2gnumake http://svn.apache.org/viewvc?view=revision&revision=1172091 Patch contributed by Christian Lippka impress212: #i98044# re enable Text menu for outline and title shapes http://svn.apache.org/viewvc?view=revision&revision=1167639 Patch contributed by Andre Fischer 118674: Made category B code optional and disabled by default. http://svn.apache.org/viewvc?view=revision&revision=1215131 118881: Ignore empty paragraphs after bullets. http://svn.apache.org/viewvc?view=revision&revision=1296205 Patches contributed by Philipp Lohmann ooo340fixes: #i117780# use rtl allocator http://svn.apache.org/viewvc?view=revision&revision=1172087 ooo34gsl02: #i117807# fix an off by one error (index actually inside the pfb section header) http://svn.apache.org/viewvc?view=revision&revision=1167576 various cleanups, related compilation fixes, warning cleanups, re-working of obsolete stl template pieces to use boost instead, changed string classes, re-adapt KDE about data, about dialog, fixing warnings, and other fixes & improvements. Disable svg import / render for about/ branding code-paths for now. Restore full icon theme set. Remove OS/2 conditionals and sources. Remove conflicting gtk/full-screen monitors support. Retain existing svg rasterizer files - temporarily disabled. Standardize stringificaiton and fixup dllpostfix issues. Rename SvgGradientHelper::== to equalTo to avoid overloading issues. Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01: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 .
*/
// Global header
#include <limits.h>
#include <utility>
#include <vector>
#include <algorithm>
#include <osl/mutex.hxx>
#include <vcl/window.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Reference.hxx>
// Project-local header
#include "editeng/unoedprx.hxx"
#include <editeng/unotext.hxx>
#include <editeng/unoedhlp.hxx>
#include <editeng/editdata.hxx>
#include <editeng/editeng.hxx>
#include <editeng/editview.hxx>
#include <editeng/AccessibleStringWrap.hxx>
#include <editeng/outliner.hxx>
using namespace ::com::sun::star;
class SvxAccessibleTextIndex
{
public:
SvxAccessibleTextIndex() :
mnPara(0),
mnIndex(0),
mnEEIndex(0),
mnFieldOffset(0),
mnFieldLen(0),
mbInField(false),
mnBulletOffset(0),
mnBulletLen(0),
mbInBullet(false) {};
~SvxAccessibleTextIndex() {};
// Get/Set current paragraph
void SetParagraph( sal_Int32 nPara )
{
mnPara = nPara;
}
sal_Int32 GetParagraph() const { return mnPara; }
/** Set the index in the UAA semantic
@param nIndex
The index from the UA API (fields and bullets are expanded)
@param rTF
The text forwarder to use in the calculations
*/
void SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF );
void SetIndex( sal_Int32 nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
sal_Int32 GetIndex() const { return mnIndex; }
/** Set the index in the edit engine semantic
Update the object state to reflect the given index position in
EditEngine/Outliner index values
@param nEEIndex
The index from the edit engine (fields span exactly one index increment)
@param rTF
The text forwarder to use in the calculations
*/
void SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF );
void SetEEIndex( sal_Int32 nPara, sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
sal_uInt16 GetEEIndex() const;
void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
sal_Int32 GetFieldLen() const { return mnFieldLen; }
void AreInField( bool bInField = true ) { mbInField = bInField; }
bool InField() const { return mbInField; }
void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
sal_Int32 GetBulletLen() const { return mnBulletLen; }
void AreInBullet( bool bInBullet = true ) { mbInBullet = bInBullet; }
bool InBullet() const { return mbInBullet; }
/// returns false if the given range is non-editable (e.g. contains bullets or _parts_ of fields)
bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
private:
sal_Int32 mnPara;
sal_Int32 mnIndex;
sal_Int32 mnEEIndex;
sal_Int32 mnFieldOffset;
sal_Int32 mnFieldLen;
bool mbInField;
sal_Int32 mnBulletOffset;
sal_Int32 mnBulletLen;
bool mbInBullet;
};
ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
{
// deal with field special case: to really get a field contained
// within a selection, the start index must be before or on the
// field, the end index after it.
// The SvxAccessibleTextIndex.GetEEIndex method gives the index on
// the field, as long the input index is on the field. Thus,
// correction necessary for the end index
// Therefore, for _ranges_, if part of the field is touched, all
// of the field must be selected
if( rStart.GetParagraph() <= rEnd.GetParagraph() ||
(rStart.GetParagraph() == rEnd.GetParagraph() &&
rStart.GetEEIndex() <= rEnd.GetEEIndex()) )
{
if( rEnd.InField() && rEnd.GetFieldOffset() )
return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
rEnd.GetParagraph(), rEnd.GetEEIndex()+1 );
}
else if( rStart.GetParagraph() > rEnd.GetParagraph() ||
(rStart.GetParagraph() == rEnd.GetParagraph() &&
rStart.GetEEIndex() > rEnd.GetEEIndex()) )
{
if( rStart.InField() && rStart.GetFieldOffset() )
return ESelection( rStart.GetParagraph(), rStart.GetEEIndex()+1,
rEnd.GetParagraph(), rEnd.GetEEIndex() );
}
return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
rEnd.GetParagraph(), rEnd.GetEEIndex() );
}
ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
{
return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
}
sal_uInt16 SvxAccessibleTextIndex::GetEEIndex() const
{
DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
"SvxAccessibleTextIndex::GetEEIndex: index value overflow");
return static_cast< sal_uInt16 > (mnEEIndex);
}
void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF )
{
// reset
mnFieldOffset = 0;
mbInField = false;
mnFieldLen = 0;
mnBulletOffset = 0;
mbInBullet = false;
mnBulletLen = 0;
// set known values
mnEEIndex = nEEIndex;
// calculate unknowns
sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
mnIndex = nEEIndex;
EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
// any text bullets?
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP )
{
mnIndex += aBulletInfo.aText.getLength();
}
for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
{
EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
if( aFieldInfo.aPosition.nIndex > nEEIndex )
break;
if( aFieldInfo.aPosition.nIndex == nEEIndex )
{
AreInField();
break;
}
// #106010#
mnIndex += ::std::max(aFieldInfo.aCurrentText.getLength()-1, (sal_Int32)0);
}
}
void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
{
// reset
mnFieldOffset = 0;
mbInField = false;
mnFieldLen = 0;
mnBulletOffset = 0;
mbInBullet = false;
mnBulletLen = 0;
// set known values
mnIndex = nIndex;
// calculate unknowns
sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
mnEEIndex = nIndex;
EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
// any text bullets?
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP )
{
sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
if( nIndex < nBulletLen )
{
AreInBullet();
SetBulletOffset( nIndex, nBulletLen );
mnEEIndex = 0;
return;
}
mnEEIndex = mnEEIndex - nBulletLen;
}
for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
{
EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
// we're before a field
if( aFieldInfo.aPosition.nIndex > mnEEIndex )
break;
// #106010#
mnEEIndex -= ::std::max(aFieldInfo.aCurrentText.getLength()-1, (sal_Int32)0);
// we're within a field
if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
{
AreInField();
SetFieldOffset( ::std::max(aFieldInfo.aCurrentText.getLength()-1, (sal_Int32)0) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
aFieldInfo.aCurrentText.getLength() );
mnEEIndex = aFieldInfo.aPosition.nIndex ;
break;
}
}
}
bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
{
if( GetIndex() > rEnd.GetIndex() )
return rEnd.IsEditableRange( *this );
if( InBullet() || rEnd.InBullet() )
return false;
if( InField() && GetFieldOffset() )
return false; // within field
if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
return false; // within field
return true;
}
SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( false )
{
}
SvxEditSourceAdapter::~SvxEditSourceAdapter()
{
}
SvxEditSource* SvxEditSourceAdapter::Clone() const
{
if( mbEditSourceValid && mpAdaptee.get() )
{
::std::unique_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
if( pClonedAdaptee.get() )
{
SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter();
if( pClone )
{
pClone->SetEditSource( std::move(pClonedAdaptee) );
return pClone;
}
}
}
return NULL;
}
SvxAccessibleTextAdapter* SvxEditSourceAdapter::GetTextForwarderAdapter()
{
if( mbEditSourceValid && mpAdaptee.get() )
{
SvxTextForwarder* pTextForwarder = mpAdaptee->GetTextForwarder();
if( pTextForwarder )
{
maTextAdapter.SetForwarder(*pTextForwarder);
return &maTextAdapter;
}
}
return NULL;
}
SvxTextForwarder* SvxEditSourceAdapter::GetTextForwarder()
{
return GetTextForwarderAdapter();
}
SvxViewForwarder* SvxEditSourceAdapter::GetViewForwarder()
{
if( mbEditSourceValid && mpAdaptee.get() )
return mpAdaptee->GetViewForwarder();
return NULL;
}
SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( bool bCreate )
{
if( mbEditSourceValid && mpAdaptee.get() )
{
SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
if( pEditViewForwarder )
{
SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
if( pTextAdapter )
{
maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
return &maEditViewAdapter;
}
}
}
return NULL;
}
SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( bool bCreate )
{
return GetEditViewForwarderAdapter( bCreate );
}
void SvxEditSourceAdapter::UpdateData()
{
if( mbEditSourceValid && mpAdaptee.get() )
mpAdaptee->UpdateData();
}
SfxBroadcaster& SvxEditSourceAdapter::GetBroadcaster() const
{
if( mbEditSourceValid && mpAdaptee.get() )
return mpAdaptee->GetBroadcaster();
return maDummyBroadcaster;
}
void SvxEditSourceAdapter::SetEditSource( ::std::unique_ptr< SvxEditSource > && pAdaptee )
{
if( pAdaptee.get() )
{
mpAdaptee = std::move(pAdaptee);
mbEditSourceValid = true;
}
else
{
// do a lazy delete (prevents us from deleting the broadcaster
// from within a broadcast in
// AccessibleTextHelper_Impl::Notify)
mbEditSourceValid = false;
}
}
SvxAccessibleTextAdapter::SvxAccessibleTextAdapter()
: mpTextForwarder(NULL)
{
}
SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter()
{
}
sal_Int32 SvxAccessibleTextAdapter::GetParagraphCount() const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetParagraphCount();
}
sal_Int32 SvxAccessibleTextAdapter::GetTextLen( sal_Int32 nParagraph ) const
{
SvxAccessibleTextIndex aIndex;
aIndex.SetEEIndex( nParagraph, mpTextForwarder->GetTextLen( nParagraph ), *this );
return aIndex.GetIndex();
}
OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
// normalize selection
if( rSel.nStartPara > rSel.nEndPara ||
(rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
{
::std::swap( aStartIndex, aEndIndex );
}
OUString sStr = mpTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
// trim field text, if necessary
if( aStartIndex.InField() )
{
DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0 &&
aStartIndex.GetFieldOffset() <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow");
sStr = sStr.copy( aStartIndex.GetFieldOffset() );
}
if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
{
DBG_ASSERT(sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow");
sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) );
}
EBulletInfo aBulletInfo1 = GetBulletInfo( aStartIndex.GetParagraph() );
EBulletInfo aBulletInfo2 = GetBulletInfo( aEndIndex.GetParagraph() );
if( aEndIndex.InBullet() )
{
// append trailing bullet
2011-12-14 14:43:58 -05:00
sStr += aBulletInfo2.aText;
DBG_ASSERT(sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow");
sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
}
else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
HaveTextBullet( aEndIndex.GetParagraph() ) )
{
OUString sBullet = aBulletInfo2.aText;
DBG_ASSERT(sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
"SvxAccessibleTextIndex::GetText: index value overflow");
sBullet = sBullet.copy(0, sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
// insert bullet
sStr = sStr.replaceAt( GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex(), 0, sBullet );
}
return sStr;
}
SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
return mpTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex), nOnlyHardAttrib );
}
SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( sal_Int32 nPara ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetParaAttribs( nPara );
}
void SvxAccessibleTextAdapter::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
mpTextForwarder->SetParaAttribs( nPara, rSet );
}
void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , bool , sal_uInt16 )
{
}
void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
mpTextForwarder->GetPortions( nPara, rList );
}
SfxItemState SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
return mpTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
nWhich );
}
SfxItemState SvxAccessibleTextAdapter::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetItemState( nPara, nWhich );
}
void SvxAccessibleTextAdapter::QuickInsertText( const OUString& rText, const ESelection& rSel )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
mpTextForwarder->QuickInsertText( rText,
MakeEESelection(aStartIndex, aEndIndex) );
}
void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
mpTextForwarder->QuickInsertField( rFld,
MakeEESelection(aStartIndex, aEndIndex) );
}
void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
mpTextForwarder->QuickSetAttribs( rSet,
MakeEESelection(aStartIndex, aEndIndex) );
}
void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
mpTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
}
SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetPool();
}
OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
}
void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
mpTextForwarder->FieldClicked( rField, nPara, nPos );
}
sal_uInt16 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aIndex;
aIndex.SetIndex(nPara, nLogicalIndex, *mpTextForwarder);
return aIndex.GetEEIndex();
}
bool SvxAccessibleTextAdapter::IsValid() const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
if( mpTextForwarder )
return mpTextForwarder->IsValid();
else
return false;
}
LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aIndex;
aIndex.SetIndex( nPara, nPos, *this );
return mpTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
}
sal_Int32 SvxAccessibleTextAdapter::GetFieldCount( sal_Int32 nPara ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetFieldCount( nPara );
}
EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetFieldInfo( nPara, nField );
}
EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( sal_Int32 nPara ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetBulletInfo( nPara );
}
void SvxAccessibleTextAdapter::SetUpdateModeForAcc(bool bUp)
{
return mpTextForwarder->SetUpdateModeForAcc(bUp);
}
bool SvxAccessibleTextAdapter::GetUpdateModeForAcc( ) const
{
return mpTextForwarder->GetUpdateModeForAcc();
}
Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aIndex;
aIndex.SetIndex( nPara, nIndex, *this );
// preset if anything goes wrong below
// n-th char in GetParagraphIndex's paragraph
Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
if( aIndex.InBullet() )
{
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
OutputDevice* pOutDev = GetRefDevice();
DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
// preset if anything goes wrong below
aRect = aBulletInfo.aBounds; // better than nothing
if( pOutDev )
{
AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect );
aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
}
}
else
{
// handle field content manually
if( aIndex.InField() )
{
OutputDevice* pOutDev = GetRefDevice();
DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetCharBounds: No ref device");
if( pOutDev )
{
ESelection aSel = MakeEESelection( aIndex );
SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mpTextForwarder->GetAttribs( aSel ) );
AccessibleStringWrap aStringWrap( *pOutDev,
aFont,
mpTextForwarder->GetText( aSel ) );
Rectangle aStartRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect );
aRect.Move( aStartRect.Left(), aStartRect.Top() );
}
}
}
return aRect;
}
Rectangle SvxAccessibleTextAdapter::GetParaBounds( sal_Int32 nPara ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
2002-05-27 15:43:06 +00:00
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP )
{
// include bullet in para bounding box
Rectangle aRect( mpTextForwarder->GetParaBounds( nPara ) );
2002-05-27 15:43:06 +00:00
aRect.Union( aBulletInfo.aBounds );
return aRect;
}
CWS-TOOLING: integrate CWS aw058 2008-11-19 14:27:57 +0100 aw r263994 : #i95264# corrected line primitive range calculation for hairlines 2008-11-18 11:31:52 +0100 wg r263754 : i96156 2008-11-18 11:22:38 +0100 wg r263752 : i96156 2008-11-13 11:46:49 +0100 aw r263626 : #i93169# used flag the wrong way; true means that nothing was done yet 2008-11-12 15:33:41 +0100 wg r263601 : i96156 2008-11-12 13:22:38 +0100 wg r263592 : i95527 2008-11-12 13:18:51 +0100 wg r263591 : i95527 2008-10-29 13:22:02 +0100 aw r262794 : #i93485# identified reason and with PL's help changed problem accordingly with usage of an old fallback. This will need to be optimized again by HDU when he finds the time. 2008-10-28 18:23:04 +0100 aw r262763 : unxmacxi compiler warning fixed 2008-10-28 18:17:01 +0100 aw r262762 : unxmacxi compiler warning fixed 2008-10-28 17:55:18 +0100 aw r262761 : unxmacxi compiler warning fixed 2008-10-28 13:48:22 +0100 aw r262743 : #i93485# added UnifiedAlphaPrimitive2D to VclRenderer; corrected getB2DRange implementations for hairlines which are view-dependent 2008-10-28 12:40:55 +0100 aw r262735 : #i93485# had to move Pre/PostPaint to LocalPre/PostPaint since PrePaint is a virtual window method 2008-10-27 15:54:10 +0100 aw r262679 : #i19871# adapted the call order to parent implementations in some Nbc methods in SdrPathObj due to errors in SnapRect recalculation when GluePoints are involved 2008-10-24 18:31:48 +0200 aw r262661 : #i77187# disable all buttons in bezier toolbar when move and/or resize protected object is involved 2008-10-24 18:30:16 +0200 aw r262660 : #i77187# simplified and secured model changers, added toolbar update, disabled move drag start when polygon point is selected 2008-10-24 12:57:50 +0200 hdu r262635 : #i93485# use device transformation for SAL layer 2008-10-24 12:41:37 +0200 hdu r262634 : #i93485# use device transformation for SAL layer 2008-10-23 19:46:12 +0200 aw r262630 : mac compiler warning fixed 2008-10-23 18:15:02 +0200 aw r262628 : #i93485# modified dialog previews to use prerendering 2008-10-23 18:14:27 +0200 aw r262627 : #i93485# added assert when render helper uses Window as copy source 2008-10-22 18:07:30 +0200 aw r262610 : #i95264# fixes assertion 2008-10-22 14:31:51 +0200 aw r262606 : #i89661# also enabling DrawTransparent shortcut for VCL-Renderer 2008-10-22 14:10:31 +0200 aw r262604 : #i89661# new HitTest 2D primitive to support BoundRect and HitTest calculations/tests 2008-10-22 14:09:22 +0200 aw r262603 : #i89661# new HitTest tolerance, new TextFrame selection overlay, support for HitTest geometry 2008-10-22 14:08:16 +0200 aw r262602 : #i89661# correcting old HitTest tolerance expansion 2008-10-20 15:31:48 +0200 aw r262321 : #i89661# added patch to test it 2008-10-20 11:50:31 +0200 aw r262310 : #i87762# removed no longer used icons (aw053) 2008-10-17 15:41:48 +0200 aw r262288 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-17 15:40:54 +0200 aw r262287 : #i93169#, #i93180# FormControl corrections for Primitive handling 2008-10-16 11:12:44 +0200 aw r262253 : #i93595# removed superfluous grid interface 2008-10-16 11:11:20 +0200 aw r262252 : #i93595# changed grid display to sub-grid usage and new defaults 2008-10-15 15:09:40 +0200 aw r262234 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-15 15:09:09 +0200 aw r262233 : #i93597# moved flag for only vertical PageBorder 2008-10-15 15:08:46 +0200 aw r262232 : #i93597# moved flag for only vertical PageBorder, added reacting on it to primitive creation 2008-10-14 16:27:07 +0200 aw r262207 : #i93648# (flushViewObjectContacts) and #i93318# (propertyChange) 2008-10-14 16:25:10 +0200 aw r262206 : #i93318# back to old state since detecting a change is not placed well at the primitive (which is a graphical information at the itme it was fetched). Instead i will add the needed check and flush at the FormControl's VOC 2008-10-14 13:47:38 +0200 aw r262201 : #i93318# added a change listener to the XControlModel and code to make the operator== at control primitive fail
2008-11-19 14:05:59 +00:00
return mpTextForwarder->GetParaBounds( nPara );
}
MapMode SvxAccessibleTextAdapter::GetMapMode() const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetMapMode();
}
OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetRefDevice();
}
bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& nPara, sal_Int32& nIndex ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
if( !mpTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
return false;
SvxAccessibleTextIndex aIndex;
aIndex.SetEEIndex(nPara, nIndex, *this);
DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nIndex = aIndex.GetIndex();
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
// any text bullets?
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP )
{
if( aBulletInfo.aBounds.IsInside( rPoint) )
{
OutputDevice* pOutDev = GetRefDevice();
DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
if( !pOutDev )
return false;
AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
Point aPoint = rPoint;
aPoint.Move( -aBulletInfo.aBounds.Left(), -aBulletInfo.aBounds.Top() );
DBG_ASSERT(aStringWrap.GetIndexAtPoint( aPoint ) >= 0 &&
aStringWrap.GetIndexAtPoint( aPoint ) <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nIndex = aStringWrap.GetIndexAtPoint( aPoint );
return true;
}
}
if( aIndex.InField() )
{
OutputDevice* pOutDev = GetRefDevice();
DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
if( !pOutDev )
return false;
ESelection aSelection = MakeEESelection( aIndex );
SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mpTextForwarder->GetAttribs( aSelection ) );
AccessibleStringWrap aStringWrap( *pOutDev,
aFont,
mpTextForwarder->GetText( aSelection ) );
Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
Point aPoint = rPoint;
aPoint.Move( -aRect.Left(), -aRect.Top() );
DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0 &&
aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nIndex = (aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
return true;
}
return true;
}
bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aIndex;
aIndex.SetIndex(nPara, nIndex, *this);
nIndex = aIndex.GetEEIndex();
if( aIndex.InBullet() )
{
DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
aIndex.GetBulletLen() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
// always treat bullet as separate word
nStart = 0;
nEnd = aIndex.GetBulletLen();
return true;
}
if( aIndex.InField() )
{
DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX &&
nStart + aIndex.GetFieldLen() >= 0 &&
nStart + aIndex.GetFieldLen() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
// always treat field as separate word
// TODO: to circumvent this, _we_ would have to do the break iterator stuff!
nStart = aIndex.GetIndex() - aIndex.GetFieldOffset();
nEnd = nStart + aIndex.GetFieldLen();
return true;
}
if( !mpTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
return false;
aIndex.SetEEIndex( nPara, nStart, *this );
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
aIndex.GetIndex() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nStart = aIndex.GetIndex();
aIndex.SetEEIndex( nPara, nEnd, *this );
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
aIndex.GetIndex() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nEnd = aIndex.GetIndex();
return true;
}
bool SvxAccessibleTextAdapter::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool /* bInCell */ ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aIndex;
aIndex.SetIndex(nPara, nIndex, *this);
nIndex = aIndex.GetEEIndex();
if( aIndex.InBullet() )
{
DBG_ASSERT(aIndex.GetBulletLen() >= 0 &&
aIndex.GetBulletLen() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
// always treat bullet as distinct attribute
nStartIndex = 0;
nEndIndex = aIndex.GetBulletLen();
return true;
}
if( aIndex.InField() )
{
DBG_ASSERT(aIndex.GetIndex() - aIndex.GetFieldOffset() >= 0 &&
aIndex.GetIndex() - aIndex.GetFieldOffset() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
// always treat field as distinct attribute
nStartIndex = aIndex.GetIndex() - aIndex.GetFieldOffset();
nEndIndex = nStartIndex + aIndex.GetFieldLen();
return true;
}
if( !mpTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
return false;
aIndex.SetEEIndex( nPara, nStartIndex, *this );
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
aIndex.GetIndex() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nStartIndex = aIndex.GetIndex();
aIndex.SetEEIndex( nPara, nEndIndex, *this );
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
aIndex.GetIndex() <= USHRT_MAX,
"SvxAccessibleTextIndex::SetIndex: index value overflow");
nEndIndex = aIndex.GetIndex();
return true;
}
sal_Int32 SvxAccessibleTextAdapter::GetLineCount( sal_Int32 nPara ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetLineCount( nPara );
}
sal_Int32 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
2002-05-27 15:43:06 +00:00
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
sal_Int32 nCurrLine;
sal_Int32 nCurrIndex, nLastIndex;
for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
2002-05-27 15:43:06 +00:00
{
nLastIndex = nCurrIndex;
nCurrIndex =
nCurrIndex + mpTextForwarder->GetLineLen( nPara, nCurrLine );
2002-05-27 15:43:06 +00:00
}
2002-05-27 15:43:06 +00:00
aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
if( nLine > 0 )
{
aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
return aEndIndex.GetIndex() - aStartIndex.GetIndex();
2002-05-27 15:43:06 +00:00
}
else
return aEndIndex.GetIndex();
}
void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const
CWS-TOOLING: integrate CWS swa11y32_2nd 2009-08-13 13:04:09 +0200 mav r274936 : #i104204# remove support for Ctrl-Tab 2009-08-13 09:59:22 +0200 od r274924 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit also object:state-changed:focus, if cursor is inside <XAccessibleText> object 2009-08-11 12:15:11 +0200 tl r274851 : CWS-TOOLING: rebase CWS swa11y32_2nd to trunk@274622 (milestone: DEV300:m54) 2009-07-14 17:35:03 +0200 tl r273982 : 2009-07-10 10:46:39 +0200 tl r273879 : CWS-TOOLING: rebase CWS swa11y32 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 14:00:25 +0200 mav r273577 : #i102879# the text of the button should not change 2009-07-01 13:16:19 +0200 od r273574 : #159496# method <GetHelpAnchor_Impl(..)> - do not release the solar mutex 2009-06-29 15:29:10 +0200 od r273476 : #i95042# method <CreateXWindow(..)> - return instance <VCLXComboBox> for <Window> instance of type <MetricBox>. note: <MetricBox> is inherited from <ComboBox> 2009-06-23 15:49:32 +0200 mav r273283 : #i101967# fix tab-control implementation 2009-06-22 13:56:22 +0200 od r273229 : #i100938# method <text_wrapper_get_run_attributes(..)> - always provide start_offset and end_offset - do _not_ increment the end_offset provide by <accessibility::TextSegment> instance 2009-06-02 12:09:03 +0200 mav r272492 : #i101959# Let the additional dialog window add its childred to the parents tab-hierarchy 2009-06-02 09:55:39 +0200 mav r272484 : #i102015# allow to have indirect child windows in tab-hierarchy 2009-06-02 09:49:42 +0200 mav r272482 : #i102015# Let the windows containing the extension dialog controls add controls to the tab hierarchy 2009-05-27 15:45:33 +0200 od r272354 : #i101012# method <SvxIconChoiceCtrl_Impl::EntrySelected(..)> - emit vcl event LISTBOX_SELECT only in case that the given entry is selected. 2009-05-27 09:54:36 +0200 od r272333 : #i92103# map UNO-API accessible events list box entry expanded/collapsed to corresponding atk events. 2009-05-27 09:52:15 +0200 od r272331 : #i92103# process list box entry expanded/collapsed events 2009-05-27 09:49:19 +0200 od r272330 : #i92103# emit vcl event list box entry expanded/collapsed 2009-05-26 10:42:05 +0200 od r272283 : #i93269# correct fix: check success of <queryInterface> call 2009-05-04 15:52:04 +0200 od r271469 : #i92103# new vcl event ids VCLEVENT_LISTBOX_ENTRY_EXPANDED and VCLEVENT_LISTBOX_ENTRY_COLLAPSED 2009-05-04 15:10:20 +0200 od r271460 : #i92103# refine definition of new constants 2009-05-04 14:36:44 +0200 od r271454 : #i92103# new constants for indicating that a list box entry is expanded respectively collapsed. 2009-04-30 16:09:40 +0200 od r271421 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit text_caret_moved event for <XAccessibleText> object, if cursor is inside the <XAccessibleText> object. 2009-04-22 14:00:10 +0200 tl r271105 : warning-free code 2009-04-22 09:17:30 +0200 tl r271073 : CWS-TOOLING: rebase CWS swa11y32 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 12:53:03 +0200 cd r270974 : #i83639# Check extendedhelp state to provide correct tool tip text 2009-04-03 13:07:13 +0200 tl r270471 : #i63983# changed accessible object names to empty strings 2009-04-01 15:52:09 +0200 tl r270336 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:12:42 +0200 tl r270333 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:10:34 +0200 tl r270331 : warning-free code 2009-04-01 12:54:44 +0200 tl r270319 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-04-01 12:52:56 +0200 tl r270318 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-03-27 18:31:01 +0100 tbe r270166 : #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 2009-03-13 13:43:54 +0100 tl r269476 : #i94322# ImpEditView::ShowCursor and nPara == USHRT_MAX problem fixed 2009-03-12 10:27:30 +0100 tl r269366 : warning-free code; unresolved external dbg_out when compiling with debug=t 2009-03-11 12:40:31 +0100 tl r269312 : warning-free code Solaris x86 2009-03-10 15:49:01 +0100 tl r269279 : #i86443# handle GetColumnCount() == 0 2009-03-10 10:48:32 +0100 cl r269254 : #i91742# name cells for accessibility 2009-03-09 17:06:33 +0100 cl r269203 : #i91742# call init on accessible cells
2009-08-26 13:37:34 +00:00
{
mpTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
CWS-TOOLING: integrate CWS swa11y32_2nd 2009-08-13 13:04:09 +0200 mav r274936 : #i104204# remove support for Ctrl-Tab 2009-08-13 09:59:22 +0200 od r274924 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit also object:state-changed:focus, if cursor is inside <XAccessibleText> object 2009-08-11 12:15:11 +0200 tl r274851 : CWS-TOOLING: rebase CWS swa11y32_2nd to trunk@274622 (milestone: DEV300:m54) 2009-07-14 17:35:03 +0200 tl r273982 : 2009-07-10 10:46:39 +0200 tl r273879 : CWS-TOOLING: rebase CWS swa11y32 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 14:00:25 +0200 mav r273577 : #i102879# the text of the button should not change 2009-07-01 13:16:19 +0200 od r273574 : #159496# method <GetHelpAnchor_Impl(..)> - do not release the solar mutex 2009-06-29 15:29:10 +0200 od r273476 : #i95042# method <CreateXWindow(..)> - return instance <VCLXComboBox> for <Window> instance of type <MetricBox>. note: <MetricBox> is inherited from <ComboBox> 2009-06-23 15:49:32 +0200 mav r273283 : #i101967# fix tab-control implementation 2009-06-22 13:56:22 +0200 od r273229 : #i100938# method <text_wrapper_get_run_attributes(..)> - always provide start_offset and end_offset - do _not_ increment the end_offset provide by <accessibility::TextSegment> instance 2009-06-02 12:09:03 +0200 mav r272492 : #i101959# Let the additional dialog window add its childred to the parents tab-hierarchy 2009-06-02 09:55:39 +0200 mav r272484 : #i102015# allow to have indirect child windows in tab-hierarchy 2009-06-02 09:49:42 +0200 mav r272482 : #i102015# Let the windows containing the extension dialog controls add controls to the tab hierarchy 2009-05-27 15:45:33 +0200 od r272354 : #i101012# method <SvxIconChoiceCtrl_Impl::EntrySelected(..)> - emit vcl event LISTBOX_SELECT only in case that the given entry is selected. 2009-05-27 09:54:36 +0200 od r272333 : #i92103# map UNO-API accessible events list box entry expanded/collapsed to corresponding atk events. 2009-05-27 09:52:15 +0200 od r272331 : #i92103# process list box entry expanded/collapsed events 2009-05-27 09:49:19 +0200 od r272330 : #i92103# emit vcl event list box entry expanded/collapsed 2009-05-26 10:42:05 +0200 od r272283 : #i93269# correct fix: check success of <queryInterface> call 2009-05-04 15:52:04 +0200 od r271469 : #i92103# new vcl event ids VCLEVENT_LISTBOX_ENTRY_EXPANDED and VCLEVENT_LISTBOX_ENTRY_COLLAPSED 2009-05-04 15:10:20 +0200 od r271460 : #i92103# refine definition of new constants 2009-05-04 14:36:44 +0200 od r271454 : #i92103# new constants for indicating that a list box entry is expanded respectively collapsed. 2009-04-30 16:09:40 +0200 od r271421 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit text_caret_moved event for <XAccessibleText> object, if cursor is inside the <XAccessibleText> object. 2009-04-22 14:00:10 +0200 tl r271105 : warning-free code 2009-04-22 09:17:30 +0200 tl r271073 : CWS-TOOLING: rebase CWS swa11y32 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 12:53:03 +0200 cd r270974 : #i83639# Check extendedhelp state to provide correct tool tip text 2009-04-03 13:07:13 +0200 tl r270471 : #i63983# changed accessible object names to empty strings 2009-04-01 15:52:09 +0200 tl r270336 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:12:42 +0200 tl r270333 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:10:34 +0200 tl r270331 : warning-free code 2009-04-01 12:54:44 +0200 tl r270319 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-04-01 12:52:56 +0200 tl r270318 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-03-27 18:31:01 +0100 tbe r270166 : #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 2009-03-13 13:43:54 +0100 tl r269476 : #i94322# ImpEditView::ShowCursor and nPara == USHRT_MAX problem fixed 2009-03-12 10:27:30 +0100 tl r269366 : warning-free code; unresolved external dbg_out when compiling with debug=t 2009-03-11 12:40:31 +0100 tl r269312 : warning-free code Solaris x86 2009-03-10 15:49:01 +0100 tl r269279 : #i86443# handle GetColumnCount() == 0 2009-03-10 10:48:32 +0100 cl r269254 : #i91742# name cells for accessibility 2009-03-09 17:06:33 +0100 cl r269203 : #i91742# call init on accessible cells
2009-08-26 13:37:34 +00:00
}
sal_Int32 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const
CWS-TOOLING: integrate CWS swa11y32_2nd 2009-08-13 13:04:09 +0200 mav r274936 : #i104204# remove support for Ctrl-Tab 2009-08-13 09:59:22 +0200 od r274924 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit also object:state-changed:focus, if cursor is inside <XAccessibleText> object 2009-08-11 12:15:11 +0200 tl r274851 : CWS-TOOLING: rebase CWS swa11y32_2nd to trunk@274622 (milestone: DEV300:m54) 2009-07-14 17:35:03 +0200 tl r273982 : 2009-07-10 10:46:39 +0200 tl r273879 : CWS-TOOLING: rebase CWS swa11y32 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 14:00:25 +0200 mav r273577 : #i102879# the text of the button should not change 2009-07-01 13:16:19 +0200 od r273574 : #159496# method <GetHelpAnchor_Impl(..)> - do not release the solar mutex 2009-06-29 15:29:10 +0200 od r273476 : #i95042# method <CreateXWindow(..)> - return instance <VCLXComboBox> for <Window> instance of type <MetricBox>. note: <MetricBox> is inherited from <ComboBox> 2009-06-23 15:49:32 +0200 mav r273283 : #i101967# fix tab-control implementation 2009-06-22 13:56:22 +0200 od r273229 : #i100938# method <text_wrapper_get_run_attributes(..)> - always provide start_offset and end_offset - do _not_ increment the end_offset provide by <accessibility::TextSegment> instance 2009-06-02 12:09:03 +0200 mav r272492 : #i101959# Let the additional dialog window add its childred to the parents tab-hierarchy 2009-06-02 09:55:39 +0200 mav r272484 : #i102015# allow to have indirect child windows in tab-hierarchy 2009-06-02 09:49:42 +0200 mav r272482 : #i102015# Let the windows containing the extension dialog controls add controls to the tab hierarchy 2009-05-27 15:45:33 +0200 od r272354 : #i101012# method <SvxIconChoiceCtrl_Impl::EntrySelected(..)> - emit vcl event LISTBOX_SELECT only in case that the given entry is selected. 2009-05-27 09:54:36 +0200 od r272333 : #i92103# map UNO-API accessible events list box entry expanded/collapsed to corresponding atk events. 2009-05-27 09:52:15 +0200 od r272331 : #i92103# process list box entry expanded/collapsed events 2009-05-27 09:49:19 +0200 od r272330 : #i92103# emit vcl event list box entry expanded/collapsed 2009-05-26 10:42:05 +0200 od r272283 : #i93269# correct fix: check success of <queryInterface> call 2009-05-04 15:52:04 +0200 od r271469 : #i92103# new vcl event ids VCLEVENT_LISTBOX_ENTRY_EXPANDED and VCLEVENT_LISTBOX_ENTRY_COLLAPSED 2009-05-04 15:10:20 +0200 od r271460 : #i92103# refine definition of new constants 2009-05-04 14:36:44 +0200 od r271454 : #i92103# new constants for indicating that a list box entry is expanded respectively collapsed. 2009-04-30 16:09:40 +0200 od r271421 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit text_caret_moved event for <XAccessibleText> object, if cursor is inside the <XAccessibleText> object. 2009-04-22 14:00:10 +0200 tl r271105 : warning-free code 2009-04-22 09:17:30 +0200 tl r271073 : CWS-TOOLING: rebase CWS swa11y32 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 12:53:03 +0200 cd r270974 : #i83639# Check extendedhelp state to provide correct tool tip text 2009-04-03 13:07:13 +0200 tl r270471 : #i63983# changed accessible object names to empty strings 2009-04-01 15:52:09 +0200 tl r270336 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:12:42 +0200 tl r270333 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:10:34 +0200 tl r270331 : warning-free code 2009-04-01 12:54:44 +0200 tl r270319 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-04-01 12:52:56 +0200 tl r270318 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-03-27 18:31:01 +0100 tbe r270166 : #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 2009-03-13 13:43:54 +0100 tl r269476 : #i94322# ImpEditView::ShowCursor and nPara == USHRT_MAX problem fixed 2009-03-12 10:27:30 +0100 tl r269366 : warning-free code; unresolved external dbg_out when compiling with debug=t 2009-03-11 12:40:31 +0100 tl r269312 : warning-free code Solaris x86 2009-03-10 15:49:01 +0100 tl r269279 : #i86443# handle GetColumnCount() == 0 2009-03-10 10:48:32 +0100 cl r269254 : #i91742# name cells for accessibility 2009-03-09 17:06:33 +0100 cl r269203 : #i91742# call init on accessible cells
2009-08-26 13:37:34 +00:00
{
return mpTextForwarder->GetLineNumberAtIndex( nPara, nIndex );
CWS-TOOLING: integrate CWS swa11y32_2nd 2009-08-13 13:04:09 +0200 mav r274936 : #i104204# remove support for Ctrl-Tab 2009-08-13 09:59:22 +0200 od r274924 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit also object:state-changed:focus, if cursor is inside <XAccessibleText> object 2009-08-11 12:15:11 +0200 tl r274851 : CWS-TOOLING: rebase CWS swa11y32_2nd to trunk@274622 (milestone: DEV300:m54) 2009-07-14 17:35:03 +0200 tl r273982 : 2009-07-10 10:46:39 +0200 tl r273879 : CWS-TOOLING: rebase CWS swa11y32 to trunk@273468 (milestone: DEV300:m51) 2009-07-01 14:00:25 +0200 mav r273577 : #i102879# the text of the button should not change 2009-07-01 13:16:19 +0200 od r273574 : #159496# method <GetHelpAnchor_Impl(..)> - do not release the solar mutex 2009-06-29 15:29:10 +0200 od r273476 : #i95042# method <CreateXWindow(..)> - return instance <VCLXComboBox> for <Window> instance of type <MetricBox>. note: <MetricBox> is inherited from <ComboBox> 2009-06-23 15:49:32 +0200 mav r273283 : #i101967# fix tab-control implementation 2009-06-22 13:56:22 +0200 od r273229 : #i100938# method <text_wrapper_get_run_attributes(..)> - always provide start_offset and end_offset - do _not_ increment the end_offset provide by <accessibility::TextSegment> instance 2009-06-02 12:09:03 +0200 mav r272492 : #i101959# Let the additional dialog window add its childred to the parents tab-hierarchy 2009-06-02 09:55:39 +0200 mav r272484 : #i102015# allow to have indirect child windows in tab-hierarchy 2009-06-02 09:49:42 +0200 mav r272482 : #i102015# Let the windows containing the extension dialog controls add controls to the tab hierarchy 2009-05-27 15:45:33 +0200 od r272354 : #i101012# method <SvxIconChoiceCtrl_Impl::EntrySelected(..)> - emit vcl event LISTBOX_SELECT only in case that the given entry is selected. 2009-05-27 09:54:36 +0200 od r272333 : #i92103# map UNO-API accessible events list box entry expanded/collapsed to corresponding atk events. 2009-05-27 09:52:15 +0200 od r272331 : #i92103# process list box entry expanded/collapsed events 2009-05-27 09:49:19 +0200 od r272330 : #i92103# emit vcl event list box entry expanded/collapsed 2009-05-26 10:42:05 +0200 od r272283 : #i93269# correct fix: check success of <queryInterface> call 2009-05-04 15:52:04 +0200 od r271469 : #i92103# new vcl event ids VCLEVENT_LISTBOX_ENTRY_EXPANDED and VCLEVENT_LISTBOX_ENTRY_COLLAPSED 2009-05-04 15:10:20 +0200 od r271460 : #i92103# refine definition of new constants 2009-05-04 14:36:44 +0200 od r271454 : #i92103# new constants for indicating that a list box entry is expanded respectively collapsed. 2009-04-30 16:09:40 +0200 od r271421 : #i93269# method <atk_wrapper_focus_idle_handler(..)> - emit text_caret_moved event for <XAccessibleText> object, if cursor is inside the <XAccessibleText> object. 2009-04-22 14:00:10 +0200 tl r271105 : warning-free code 2009-04-22 09:17:30 +0200 tl r271073 : CWS-TOOLING: rebase CWS swa11y32 to trunk@270723 (milestone: DEV300:m46) 2009-04-20 12:53:03 +0200 cd r270974 : #i83639# Check extendedhelp state to provide correct tool tip text 2009-04-03 13:07:13 +0200 tl r270471 : #i63983# changed accessible object names to empty strings 2009-04-01 15:52:09 +0200 tl r270336 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:12:42 +0200 tl r270333 : #i90991# accessible names and description for paragraphs should be empty 2009-04-01 15:10:34 +0200 tl r270331 : warning-free code 2009-04-01 12:54:44 +0200 tl r270319 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-04-01 12:52:56 +0200 tl r270318 : #i89176# Implementation of XAccessibleMultiLineText in EditEngine 2009-03-27 18:31:01 +0100 tbe r270166 : #i92143# text getRangeExtents reports incorrect 'x' values for spreadsheet cells 2009-03-13 13:43:54 +0100 tl r269476 : #i94322# ImpEditView::ShowCursor and nPara == USHRT_MAX problem fixed 2009-03-12 10:27:30 +0100 tl r269366 : warning-free code; unresolved external dbg_out when compiling with debug=t 2009-03-11 12:40:31 +0100 tl r269312 : warning-free code Solaris x86 2009-03-10 15:49:01 +0100 tl r269279 : #i86443# handle GetColumnCount() == 0 2009-03-10 10:48:32 +0100 cl r269254 : #i91742# name cells for accessibility 2009-03-09 17:06:33 +0100 cl r269203 : #i91742# call init on accessible cells
2009-08-26 13:37:34 +00:00
}
bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
return mpTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
}
bool SvxAccessibleTextAdapter::InsertText( const OUString& rStr, const ESelection& rSel )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
return mpTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
}
bool SvxAccessibleTextAdapter::QuickFormatDoc( bool bFull )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->QuickFormatDoc( bFull );
}
sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_Int32 nPara ) const
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->GetDepth( nPara );
}
bool SvxAccessibleTextAdapter::SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth )
{
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
return mpTextForwarder->SetDepth( nPara, nNewDepth );
}
void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder )
{
mpTextForwarder = &rForwarder;
}
bool SvxAccessibleTextAdapter::HaveImageBullet( sal_Int32 nPara ) const
{
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible &&
aBulletInfo.nType == SVX_NUM_BITMAP );
}
bool SvxAccessibleTextAdapter::HaveTextBullet( sal_Int32 nPara ) const
{
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
aBulletInfo.bVisible &&
aBulletInfo.nType != SVX_NUM_BITMAP );
}
bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel )
{
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
// normalize selection
if( rSel.nStartPara > rSel.nEndPara ||
(rSel.nStartPara == rSel.nEndPara && rSel.nStartPos > rSel.nEndPos) )
{
::std::swap( aStartIndex, aEndIndex );
}
return aStartIndex.IsEditableRange( aEndIndex );
}
const SfxItemSet * SvxAccessibleTextAdapter::GetEmptyItemSetPtr()
{
2011-03-01 19:07:44 +01:00
OSL_FAIL( "not implemented" );
return 0;
}
void SvxAccessibleTextAdapter::AppendParagraph()
{
2011-03-01 19:07:44 +01:00
OSL_FAIL( "not implemented" );
}
sal_Int32 SvxAccessibleTextAdapter::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & )
{
2011-03-01 19:07:44 +01:00
OSL_FAIL( "not implemented" );
return 0;
}
void SvxAccessibleTextAdapter::CopyText(const SvxTextForwarder&)
{
2011-03-01 19:07:44 +01:00
OSL_FAIL( "not implemented" );
}
SvxAccessibleTextEditViewAdapter::SvxAccessibleTextEditViewAdapter()
: mpViewForwarder(NULL)
, mpTextForwarder(NULL)
{
}
SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter()
{
}
bool SvxAccessibleTextEditViewAdapter::IsValid() const
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
if( mpViewForwarder )
return mpViewForwarder->IsValid();
else
return false;
}
Rectangle SvxAccessibleTextEditViewAdapter::GetVisArea() const
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
return mpViewForwarder->GetVisArea();
}
Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
return mpViewForwarder->LogicToPixel(rPoint, rMapMode);
}
Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
return mpViewForwarder->PixelToLogic(rPoint, rMapMode);
}
bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
ESelection aSelection;
if( !mpViewForwarder->GetSelection( aSelection ) )
return false;
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mpTextForwarder );
aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mpTextForwarder );
DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
"SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
rSel = ESelection( aStartIndex.GetParagraph(), aStartIndex.GetIndex(),
aEndIndex.GetParagraph(), aEndIndex.GetIndex() );
return true;
}
bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel )
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
SvxAccessibleTextIndex aStartIndex;
SvxAccessibleTextIndex aEndIndex;
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mpTextForwarder );
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mpTextForwarder );
return mpViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
}
bool SvxAccessibleTextEditViewAdapter::Copy()
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
return mpViewForwarder->Copy();
}
bool SvxAccessibleTextEditViewAdapter::Cut()
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
return mpViewForwarder->Cut();
}
bool SvxAccessibleTextEditViewAdapter::Paste()
{
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
return mpViewForwarder->Paste();
}
void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& rForwarder,
SvxAccessibleTextAdapter& rTextForwarder )
{
mpViewForwarder = &rForwarder;
mpTextForwarder = &rTextForwarder;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */