2010-10-12 15:53:47 +02:00
|
|
|
/* -*- 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 .
|
|
|
|
*/
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2006-09-17 05:16:53 +00:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
// Global header
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
#include <limits.h>
|
2014-09-24 16:03:36 +02:00
|
|
|
#include <utility>
|
2002-05-16 15:12:20 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <algorithm>
|
2010-10-16 03:18:35 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2002-05-16 15:12:20 +00:00
|
|
|
#include <vcl/window.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <com/sun/star/uno/Any.hxx>
|
|
|
|
#include <com/sun/star/uno/Reference.hxx>
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
// Project-local header
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2010-01-07 18:52:36 +01:00
|
|
|
#include "editeng/unoedprx.hxx"
|
2010-01-06 19:26:54 +01:00
|
|
|
#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>
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
|
|
|
|
class SvxAccessibleTextIndex
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SvxAccessibleTextIndex() :
|
|
|
|
mnPara(0),
|
|
|
|
mnIndex(0),
|
|
|
|
mnEEIndex(0),
|
|
|
|
mnFieldOffset(0),
|
|
|
|
mnFieldLen(0),
|
2014-04-09 11:03:42 +02:00
|
|
|
mbInField(false),
|
2002-05-16 15:12:20 +00:00
|
|
|
mnBulletOffset(0),
|
2002-05-23 11:46:18 +00:00
|
|
|
mnBulletLen(0),
|
2014-04-09 11:03:42 +02:00
|
|
|
mbInBullet(false) {};
|
2002-05-16 15:12:20 +00:00
|
|
|
~SvxAccessibleTextIndex() {};
|
|
|
|
|
|
|
|
// Get/Set current paragraph
|
2013-05-08 18:12:32 +02:00
|
|
|
void SetParagraph( sal_Int32 nPara )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
mnPara = nPara;
|
|
|
|
}
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 GetParagraph() const { return mnPara; }
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
/** 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 );
|
2013-05-08 18:12:32 +02:00
|
|
|
void SetIndex( sal_Int32 nPara, sal_Int32 nIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetIndex(nIndex, rTF); }
|
2002-05-16 15:12:20 +00:00
|
|
|
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
|
|
|
|
*/
|
2011-01-13 14:12:48 +01:00
|
|
|
void SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF );
|
2013-05-08 18:12:32 +02:00
|
|
|
void SetEEIndex( sal_Int32 nPara, sal_uInt16 nEEIndex, const SvxTextForwarder& rTF ) { SetParagraph(nPara); SetEEIndex(nEEIndex, rTF); }
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 GetEEIndex() const;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
void SetFieldOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnFieldOffset = nOffset; mnFieldLen = nLen; }
|
|
|
|
sal_Int32 GetFieldOffset() const { return mnFieldOffset; }
|
|
|
|
sal_Int32 GetFieldLen() const { return mnFieldLen; }
|
2014-04-09 11:03:42 +02:00
|
|
|
void AreInField( bool bInField = true ) { mbInField = bInField; }
|
|
|
|
bool InField() const { return mbInField; }
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
void SetBulletOffset( sal_Int32 nOffset, sal_Int32 nLen ) { mnBulletOffset = nOffset; mnBulletLen = nLen; }
|
|
|
|
sal_Int32 GetBulletOffset() const { return mnBulletOffset; }
|
|
|
|
sal_Int32 GetBulletLen() const { return mnBulletLen; }
|
2014-04-09 11:03:42 +02:00
|
|
|
void AreInBullet( bool bInBullet = true ) { mbInBullet = bInBullet; }
|
|
|
|
bool InBullet() const { return mbInBullet; }
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
/// returns false if the given range is non-editable (e.g. contains bullets or _parts_ of fields)
|
2014-04-09 11:03:42 +02:00
|
|
|
bool IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
private:
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 mnPara;
|
2002-05-16 15:12:20 +00:00
|
|
|
sal_Int32 mnIndex;
|
2002-05-17 16:35:51 +00:00
|
|
|
sal_Int32 mnEEIndex;
|
2002-05-16 15:12:20 +00:00
|
|
|
sal_Int32 mnFieldOffset;
|
|
|
|
sal_Int32 mnFieldLen;
|
2014-04-09 11:03:42 +02:00
|
|
|
bool mbInField;
|
2002-05-16 15:12:20 +00:00
|
|
|
sal_Int32 mnBulletOffset;
|
|
|
|
sal_Int32 mnBulletLen;
|
2014-04-09 11:03:42 +02:00
|
|
|
bool mbInBullet;
|
2002-05-16 15:12:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd )
|
|
|
|
{
|
2002-05-17 16:35:51 +00:00
|
|
|
// 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() );
|
|
|
|
}
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
return ESelection( rStart.GetParagraph(), rStart.GetEEIndex(),
|
|
|
|
rEnd.GetParagraph(), rEnd.GetEEIndex() );
|
|
|
|
}
|
|
|
|
|
|
|
|
ESelection MakeEESelection( const SvxAccessibleTextIndex& rIndex )
|
|
|
|
{
|
2002-05-17 16:35:51 +00:00
|
|
|
return ESelection( rIndex.GetParagraph(), rIndex.GetEEIndex(),
|
|
|
|
rIndex.GetParagraph(), rIndex.GetEEIndex() + 1 );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
sal_uInt16 SvxAccessibleTextIndex::GetEEIndex() const
|
2002-05-17 16:35:51 +00:00
|
|
|
{
|
|
|
|
DBG_ASSERT(mnEEIndex >= 0 && mnEEIndex <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::GetEEIndex: index value overflow");
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
return static_cast< sal_uInt16 > (mnEEIndex);
|
2002-05-17 16:35:51 +00:00
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
void SvxAccessibleTextIndex::SetEEIndex( sal_uInt16 nEEIndex, const SvxTextForwarder& rTF )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2002-05-17 16:35:51 +00:00
|
|
|
// reset
|
|
|
|
mnFieldOffset = 0;
|
2014-04-09 11:03:42 +02:00
|
|
|
mbInField = false;
|
2002-05-17 16:35:51 +00:00
|
|
|
mnFieldLen = 0;
|
|
|
|
mnBulletOffset = 0;
|
2014-04-09 11:03:42 +02:00
|
|
|
mbInBullet = false;
|
2002-05-17 16:35:51 +00:00
|
|
|
mnBulletLen = 0;
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
// set known values
|
|
|
|
mnEEIndex = nEEIndex;
|
|
|
|
|
|
|
|
// calculate unknowns
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
mnIndex = nEEIndex;
|
|
|
|
|
|
|
|
EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
|
|
|
|
|
|
|
|
// any text bullets?
|
|
|
|
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
|
|
|
|
aBulletInfo.bVisible &&
|
|
|
|
aBulletInfo.nType != SVX_NUM_BITMAP )
|
|
|
|
{
|
2013-09-06 16:31:38 +02:00
|
|
|
mnIndex += aBulletInfo.aText.getLength();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2003-03-27 14:06:05 +00:00
|
|
|
// #106010#
|
2013-09-11 10:24:01 +02:00
|
|
|
mnIndex += ::std::max(aFieldInfo.aCurrentText.getLength()-1, (sal_Int32)0);
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAccessibleTextIndex::SetIndex( sal_Int32 nIndex, const SvxTextForwarder& rTF )
|
|
|
|
{
|
2002-05-17 16:35:51 +00:00
|
|
|
// reset
|
|
|
|
mnFieldOffset = 0;
|
2014-04-09 11:03:42 +02:00
|
|
|
mbInField = false;
|
2002-05-17 16:35:51 +00:00
|
|
|
mnFieldLen = 0;
|
|
|
|
mnBulletOffset = 0;
|
2014-04-09 11:03:42 +02:00
|
|
|
mbInBullet = false;
|
2002-05-17 16:35:51 +00:00
|
|
|
mnBulletLen = 0;
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
// set known values
|
|
|
|
mnIndex = nIndex;
|
|
|
|
|
|
|
|
// calculate unknowns
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nCurrField, nFieldCount = rTF.GetFieldCount( GetParagraph() );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
DBG_ASSERT(nIndex >= 0 && nIndex <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
|
|
|
|
2002-05-17 16:35:51 +00:00
|
|
|
mnEEIndex = nIndex;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
EBulletInfo aBulletInfo = rTF.GetBulletInfo( GetParagraph() );
|
|
|
|
|
|
|
|
// any text bullets?
|
|
|
|
if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
|
|
|
|
aBulletInfo.bVisible &&
|
|
|
|
aBulletInfo.nType != SVX_NUM_BITMAP )
|
|
|
|
{
|
2013-09-06 16:31:38 +02:00
|
|
|
sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
if( nIndex < nBulletLen )
|
|
|
|
{
|
|
|
|
AreInBullet();
|
|
|
|
SetBulletOffset( nIndex, nBulletLen );
|
2002-05-17 16:35:51 +00:00
|
|
|
mnEEIndex = 0;
|
2002-05-16 15:12:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2002-05-17 16:35:51 +00:00
|
|
|
mnEEIndex = mnEEIndex - nBulletLen;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for( nCurrField=0; nCurrField < nFieldCount; ++nCurrField )
|
|
|
|
{
|
|
|
|
EFieldInfo aFieldInfo( rTF.GetFieldInfo( GetParagraph(), nCurrField ) );
|
|
|
|
|
|
|
|
// we're before a field
|
|
|
|
if( aFieldInfo.aPosition.nIndex > mnEEIndex )
|
|
|
|
break;
|
|
|
|
|
2003-03-27 14:06:05 +00:00
|
|
|
// #106010#
|
2013-09-11 10:24:01 +02:00
|
|
|
mnEEIndex -= ::std::max(aFieldInfo.aCurrentText.getLength()-1, (sal_Int32)0);
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
// we're within a field
|
2003-03-27 14:06:05 +00:00
|
|
|
if( aFieldInfo.aPosition.nIndex >= mnEEIndex )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
AreInField();
|
2013-09-11 10:24:01 +02:00
|
|
|
SetFieldOffset( ::std::max(aFieldInfo.aCurrentText.getLength()-1, (sal_Int32)0) - (aFieldInfo.aPosition.nIndex - mnEEIndex),
|
2013-09-09 12:59:28 +02:00
|
|
|
aFieldInfo.aCurrentText.getLength() );
|
2002-05-16 15:12:20 +00:00
|
|
|
mnEEIndex = aFieldInfo.aPosition.nIndex ;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-09 11:03:42 +02:00
|
|
|
bool SvxAccessibleTextIndex::IsEditableRange( const SvxAccessibleTextIndex& rEnd ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
if( GetIndex() > rEnd.GetIndex() )
|
|
|
|
return rEnd.IsEditableRange( *this );
|
|
|
|
|
|
|
|
if( InBullet() || rEnd.InBullet() )
|
2014-04-09 11:03:42 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
if( InField() && GetFieldOffset() )
|
2014-04-09 11:03:42 +02:00
|
|
|
return false; // within field
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
if( rEnd.InField() && rEnd.GetFieldOffset() >= rEnd.GetFieldLen() - 1 )
|
2014-04-09 11:03:42 +02:00
|
|
|
return false; // within field
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-04-09 11:03:42 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-22 21:20:15 +01:00
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-28 15:42:50 +02:00
|
|
|
SvxEditSourceAdapter::SvxEditSourceAdapter() : mbEditSourceValid( false )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxEditSourceAdapter::~SvxEditSourceAdapter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxEditSource* SvxEditSourceAdapter::Clone() const
|
|
|
|
{
|
|
|
|
if( mbEditSourceValid && mpAdaptee.get() )
|
2002-05-17 16:35:51 +00:00
|
|
|
{
|
2014-09-24 16:03:36 +02:00
|
|
|
::std::unique_ptr< SvxEditSource > pClonedAdaptee( mpAdaptee->Clone() );
|
2002-05-17 16:35:51 +00:00
|
|
|
|
|
|
|
if( pClonedAdaptee.get() )
|
|
|
|
{
|
|
|
|
SvxEditSourceAdapter* pClone = new SvxEditSourceAdapter();
|
|
|
|
|
|
|
|
if( pClone )
|
|
|
|
{
|
2014-09-24 16:03:36 +02:00
|
|
|
pClone->SetEditSource( std::move(pClonedAdaptee) );
|
2002-05-17 16:35:51 +00:00
|
|
|
return pClone;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-02-28 15:42:50 +02:00
|
|
|
SvxAccessibleTextEditViewAdapter* SvxEditSourceAdapter::GetEditViewForwarderAdapter( bool bCreate )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
if( mbEditSourceValid && mpAdaptee.get() )
|
|
|
|
{
|
2002-10-22 14:42:18 +00:00
|
|
|
SvxEditViewForwarder* pEditViewForwarder = mpAdaptee->GetEditViewForwarder(bCreate);
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
if( pEditViewForwarder )
|
|
|
|
{
|
|
|
|
SvxAccessibleTextAdapter* pTextAdapter = GetTextForwarderAdapter();
|
|
|
|
|
|
|
|
if( pTextAdapter )
|
|
|
|
{
|
|
|
|
maEditViewAdapter.SetForwarder(*pEditViewForwarder, *pTextAdapter);
|
|
|
|
|
|
|
|
return &maEditViewAdapter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2014-02-11 14:28:50 +02:00
|
|
|
SvxEditViewForwarder* SvxEditSourceAdapter::GetEditViewForwarder( bool bCreate )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2014-09-24 16:03:36 +02:00
|
|
|
void SvxEditSourceAdapter::SetEditSource( ::std::unique_ptr< SvxEditSource > && pAdaptee )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
if( pAdaptee.get() )
|
|
|
|
{
|
2014-09-24 16:03:36 +02:00
|
|
|
mpAdaptee = std::move(pAdaptee);
|
2014-02-28 15:42:50 +02:00
|
|
|
mbEditSourceValid = true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// do a lazy delete (prevents us from deleting the broadcaster
|
|
|
|
// from within a broadcast in
|
|
|
|
// AccessibleTextHelper_Impl::Notify)
|
2014-02-28 15:42:50 +02:00
|
|
|
mbEditSourceValid = false;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-03 08:51:19 +01:00
|
|
|
SvxAccessibleTextAdapter::SvxAccessibleTextAdapter()
|
|
|
|
: mpTextForwarder(NULL)
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxAccessibleTextAdapter::~SvxAccessibleTextAdapter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::GetParagraphCount() const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetParagraphCount();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::GetTextLen( sal_Int32 nParagraph ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
SvxAccessibleTextIndex aIndex;
|
2014-02-13 14:06:22 +00:00
|
|
|
aIndex.SetEEIndex( nParagraph, mpTextForwarder->GetTextLen( nParagraph ), *this );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
return aIndex.GetIndex();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-09-03 18:29:30 +02:00
|
|
|
OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
OUString sStr = mpTextForwarder->GetText( MakeEESelection(aStartIndex, aEndIndex) );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-05-17 16:35:51 +00:00
|
|
|
// trim field text, if necessary
|
|
|
|
if( aStartIndex.InField() )
|
|
|
|
{
|
|
|
|
DBG_ASSERT(aStartIndex.GetFieldOffset() >= 0 &&
|
|
|
|
aStartIndex.GetFieldOffset() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::GetText: index value overflow");
|
|
|
|
|
2013-09-10 09:51:45 +02:00
|
|
|
sStr = sStr.copy( aStartIndex.GetFieldOffset() );
|
2002-05-17 16:35:51 +00:00
|
|
|
}
|
|
|
|
if( aEndIndex.InField() && aEndIndex.GetFieldOffset() )
|
|
|
|
{
|
2013-09-10 09:51:45 +02:00
|
|
|
DBG_ASSERT(sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) >= 0 &&
|
|
|
|
sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) <= USHRT_MAX,
|
2002-05-17 16:35:51 +00:00
|
|
|
"SvxAccessibleTextIndex::GetText: index value overflow");
|
|
|
|
|
2013-09-10 09:51:45 +02:00
|
|
|
sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetFieldLen() - aEndIndex.GetFieldOffset()) );
|
2002-05-17 16:35:51 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
EBulletInfo aBulletInfo1 = GetBulletInfo( aStartIndex.GetParagraph() );
|
|
|
|
EBulletInfo aBulletInfo2 = GetBulletInfo( aEndIndex.GetParagraph() );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
if( aEndIndex.InBullet() )
|
|
|
|
{
|
|
|
|
// append trailing bullet
|
2011-12-14 14:43:58 -05:00
|
|
|
sStr += aBulletInfo2.aText;
|
2002-05-17 16:35:51 +00:00
|
|
|
|
2013-09-10 09:51:45 +02:00
|
|
|
DBG_ASSERT(sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
|
|
|
|
sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
|
2002-05-17 16:35:51 +00:00
|
|
|
"SvxAccessibleTextIndex::GetText: index value overflow");
|
|
|
|
|
2013-09-10 09:51:45 +02:00
|
|
|
sStr = sStr.copy(0, sStr.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
2002-05-17 16:35:51 +00:00
|
|
|
else if( aStartIndex.GetParagraph() != aEndIndex.GetParagraph() &&
|
|
|
|
HaveTextBullet( aEndIndex.GetParagraph() ) )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2013-09-10 09:51:45 +02:00
|
|
|
OUString sBullet = aBulletInfo2.aText;
|
2002-05-17 16:35:51 +00:00
|
|
|
|
2013-09-10 09:51:45 +02:00
|
|
|
DBG_ASSERT(sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) >= 0 &&
|
|
|
|
sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) <= USHRT_MAX,
|
2002-05-17 16:35:51 +00:00
|
|
|
"SvxAccessibleTextIndex::GetText: index value overflow");
|
|
|
|
|
2013-09-10 09:51:45 +02:00
|
|
|
sBullet = sBullet.copy(0, sBullet.getLength() - (aEndIndex.GetBulletLen() - aEndIndex.GetBulletOffset()) );
|
2002-05-17 16:35:51 +00:00
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
// insert bullet
|
2013-09-10 09:51:45 +02:00
|
|
|
sStr = sStr.replaceAt( GetTextLen(aStartIndex.GetParagraph()) - aStartIndex.GetIndex(), 0, sBullet );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return sStr;
|
|
|
|
}
|
|
|
|
|
2014-04-04 08:45:26 +02:00
|
|
|
SfxItemSet SvxAccessibleTextAdapter::GetAttribs( const ESelection& rSel, EditEngineAttribs nOnlyHardAttrib ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-04-04 08:45:26 +02:00
|
|
|
return mpTextForwarder->GetAttribs( MakeEESelection(aStartIndex, aEndIndex), nOnlyHardAttrib );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
SfxItemSet SvxAccessibleTextAdapter::GetParaAttribs( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetParaAttribs( nPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
void SvxAccessibleTextAdapter::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->SetParaAttribs( nPara, rSet );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
void SvxAccessibleTextAdapter::RemoveAttribs( const ESelection& , bool , sal_uInt16 )
|
2008-07-01 11:52:29 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void SvxAccessibleTextAdapter::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->GetPortions( nPara, rList );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-07-23 10:48:58 +02:00
|
|
|
SfxItemState SvxAccessibleTextAdapter::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetItemState( MakeEESelection(aStartIndex, aEndIndex),
|
2002-05-16 15:12:20 +00:00
|
|
|
nWhich );
|
|
|
|
}
|
|
|
|
|
2014-07-23 10:48:58 +02:00
|
|
|
SfxItemState SvxAccessibleTextAdapter::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetItemState( nPara, nWhich );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-09-03 18:29:30 +02:00
|
|
|
void SvxAccessibleTextAdapter::QuickInsertText( const OUString& rText, const ESelection& rSel )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->QuickInsertText( rText,
|
2002-05-16 15:12:20 +00:00
|
|
|
MakeEESelection(aStartIndex, aEndIndex) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAccessibleTextAdapter::QuickInsertField( const SvxFieldItem& rFld, const ESelection& rSel )
|
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->QuickInsertField( rFld,
|
2002-05-16 15:12:20 +00:00
|
|
|
MakeEESelection(aStartIndex, aEndIndex) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAccessibleTextAdapter::QuickSetAttribs( const SfxItemSet& rSet, const ESelection& rSel )
|
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->QuickSetAttribs( rSet,
|
2002-05-16 15:12:20 +00:00
|
|
|
MakeEESelection(aStartIndex, aEndIndex) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAccessibleTextAdapter::QuickInsertLineBreak( const ESelection& rSel )
|
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->QuickInsertLineBreak( MakeEESelection(aStartIndex, aEndIndex) );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SfxItemPool* SvxAccessibleTextAdapter::GetPool() const
|
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetPool();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
OUString SvxAccessibleTextAdapter::CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, Color*& rpTxtColor, Color*& rpFldColor )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->CalcFieldValue( rField, nPara, nPos, rpTxtColor, rpFldColor );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void SvxAccessibleTextAdapter::FieldClicked( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos )
|
2010-02-25 16:58:44 +01:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2010-02-25 16:58:44 +01:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->FieldClicked( rField, nPara, nPos );
|
2010-02-25 16:58:44 +01:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_uInt16 SvxAccessibleTextAdapter::CalcEditEngineIndex( sal_Int32 nPara, sal_Int32 nLogicalIndex )
|
2010-02-25 16:58:44 +01:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2010-02-25 16:58:44 +01:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aIndex;
|
2014-02-13 14:06:22 +00:00
|
|
|
aIndex.SetIndex(nPara, nLogicalIndex, *mpTextForwarder);
|
2010-02-25 16:58:44 +01:00
|
|
|
return aIndex.GetEEIndex();
|
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::IsValid() const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
if( mpTextForwarder )
|
|
|
|
return mpTextForwarder->IsValid();
|
2002-05-16 15:12:20 +00:00
|
|
|
else
|
2014-02-28 09:47:38 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
LanguageType SvxAccessibleTextAdapter::GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aIndex;
|
|
|
|
|
|
|
|
aIndex.SetIndex( nPara, nPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetLanguage( nPara, aIndex.GetEEIndex() );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::GetFieldCount( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetFieldCount( nPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
EFieldInfo SvxAccessibleTextAdapter::GetFieldInfo( sal_Int32 nPara, sal_uInt16 nField ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetFieldInfo( nPara, nField );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetBulletInfo( nPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
void SvxAccessibleTextAdapter::SetUpdateModeForAcc(bool bUp)
|
2013-11-26 14:25:22 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->SetUpdateModeForAcc(bUp);
|
2013-11-26 14:25:22 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::GetUpdateModeForAcc( ) const
|
2013-11-26 14:25:22 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetUpdateModeForAcc();
|
2013-11-26 14:25:22 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_Int32 nIndex ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aIndex;
|
|
|
|
aIndex.SetIndex( nPara, nIndex, *this );
|
|
|
|
|
|
|
|
// preset if anything goes wrong below
|
|
|
|
// n-th char in GetParagraphIndex's paragraph
|
2014-02-13 14:06:22 +00:00
|
|
|
Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
2003-04-04 15:57:24 +00:00
|
|
|
AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-19 14:30:47 +02:00
|
|
|
aStringWrap.GetCharacterBounds( aIndex.GetBulletOffset(), aRect );
|
|
|
|
aRect.Move( aBulletInfo.aBounds.Left(), aBulletInfo.aBounds.Top() );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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 );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mpTextForwarder->GetAttribs( aSel ) );
|
2003-04-04 15:57:24 +00:00
|
|
|
AccessibleStringWrap aStringWrap( *pOutDev,
|
|
|
|
aFont,
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->GetText( aSel ) );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
Rectangle aStartRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
|
2002-05-17 16:35:51 +00:00
|
|
|
|
2014-02-19 14:30:47 +02:00
|
|
|
aStringWrap.GetCharacterBounds( aIndex.GetFieldOffset(), aRect );
|
|
|
|
aRect.Move( aStartRect.Left(), aStartRect.Top() );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aRect;
|
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
Rectangle SvxAccessibleTextAdapter::GetParaBounds( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
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
|
2014-02-13 14:06:22 +00:00
|
|
|
Rectangle aRect( mpTextForwarder->GetParaBounds( nPara ) );
|
2002-05-27 15:43:06 +00:00
|
|
|
|
|
|
|
aRect.Union( aBulletInfo.aBounds );
|
|
|
|
|
|
|
|
return aRect;
|
|
|
|
}
|
2008-11-19 14:05:59 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetParaBounds( nPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MapMode SvxAccessibleTextAdapter::GetMapMode() const
|
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetMapMode();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OutputDevice* SvxAccessibleTextAdapter::GetRefDevice() const
|
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetRefDevice();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::GetIndexAtPoint( const Point& rPoint, sal_Int32& nPara, sal_Int32& nIndex ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
if( !mpTextForwarder->GetIndexAtPoint( rPoint, nPara, nIndex ) )
|
2014-02-28 09:47:38 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aIndex;
|
|
|
|
aIndex.SetEEIndex(nPara, nIndex, *this);
|
|
|
|
|
|
|
|
DBG_ASSERT(aIndex.GetIndex() >= 0 && aIndex.GetIndex() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
nIndex = aIndex.GetIndex();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
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 )
|
2014-02-28 09:47:38 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2003-04-04 15:57:24 +00:00
|
|
|
AccessibleStringWrap aStringWrap( *pOutDev, aBulletInfo.aFont, aBulletInfo.aText );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
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");
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
nIndex = aStringWrap.GetIndexAtPoint( aPoint );
|
2014-02-28 09:47:38 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aIndex.InField() )
|
|
|
|
{
|
|
|
|
OutputDevice* pOutDev = GetRefDevice();
|
|
|
|
|
|
|
|
DBG_ASSERT(pOutDev!=NULL, "SvxAccessibleTextAdapter::GetIndexAtPoint: No ref device");
|
|
|
|
|
|
|
|
if( !pOutDev )
|
2014-02-28 09:47:38 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
ESelection aSelection = MakeEESelection( aIndex );
|
2014-02-13 14:06:22 +00:00
|
|
|
SvxFont aFont = EditEngine::CreateSvxFontFromItemSet( mpTextForwarder->GetAttribs( aSelection ) );
|
2003-04-04 15:57:24 +00:00
|
|
|
AccessibleStringWrap aStringWrap( *pOutDev,
|
|
|
|
aFont,
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->GetText( aSelection ) );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
Rectangle aRect = mpTextForwarder->GetCharBounds( nPara, aIndex.GetEEIndex() );
|
2002-05-17 16:35:51 +00:00
|
|
|
Point aPoint = rPoint;
|
|
|
|
aPoint.Move( -aRect.Left(), -aRect.Top() );
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
DBG_ASSERT(aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) >= 0 &&
|
|
|
|
aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( rPoint ) <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
nIndex = (aIndex.GetIndex() + aStringWrap.GetIndexAtPoint( aPoint ));
|
2014-02-28 09:47:38 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_Int32 nIndex, sal_Int32& nStart, sal_Int32& nEnd ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aIndex;
|
|
|
|
aIndex.SetIndex(nPara, nIndex, *this);
|
2002-05-17 16:35:51 +00:00
|
|
|
nIndex = aIndex.GetEEIndex();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
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;
|
2014-02-02 22:16:48 -06:00
|
|
|
nEnd = aIndex.GetBulletLen();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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!
|
2014-02-02 22:16:48 -06:00
|
|
|
nStart = aIndex.GetIndex() - aIndex.GetFieldOffset();
|
|
|
|
nEnd = nStart + aIndex.GetFieldLen();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
if( !mpTextForwarder->GetWordIndices( nPara, nIndex, nStart, nEnd ) )
|
2014-02-28 09:47:38 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
aIndex.SetEEIndex( nPara, nStart, *this );
|
|
|
|
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
|
|
|
|
aIndex.GetIndex() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
2014-02-02 22:16:48 -06:00
|
|
|
nStart = aIndex.GetIndex();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
aIndex.SetEEIndex( nPara, nEnd, *this );
|
|
|
|
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
|
|
|
|
aIndex.GetIndex() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
2014-02-02 22:16:48 -06:00
|
|
|
nEnd = aIndex.GetIndex();
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-26 15:30:29 +02:00
|
|
|
bool SvxAccessibleTextAdapter::GetAttributeRun( sal_Int32& nStartIndex, sal_Int32& nEndIndex, sal_Int32 nPara, sal_Int32 nIndex, bool /* bInCell */ ) const
|
2002-08-02 10:35:10 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-08-02 10:35:10 +00:00
|
|
|
|
|
|
|
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;
|
2014-02-02 22:16:48 -06:00
|
|
|
nEndIndex = aIndex.GetBulletLen();
|
2002-08-02 10:35:10 +00:00
|
|
|
|
2014-02-26 15:30:29 +02:00
|
|
|
return true;
|
2002-08-02 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2014-02-02 22:16:48 -06:00
|
|
|
nStartIndex = aIndex.GetIndex() - aIndex.GetFieldOffset();
|
|
|
|
nEndIndex = nStartIndex + aIndex.GetFieldLen();
|
2002-08-02 10:35:10 +00:00
|
|
|
|
2014-02-26 15:30:29 +02:00
|
|
|
return true;
|
2002-08-02 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
if( !mpTextForwarder->GetAttributeRun( nStartIndex, nEndIndex, nPara, nIndex ) )
|
2014-02-26 15:30:29 +02:00
|
|
|
return false;
|
2002-08-02 10:35:10 +00:00
|
|
|
|
|
|
|
aIndex.SetEEIndex( nPara, nStartIndex, *this );
|
|
|
|
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
|
|
|
|
aIndex.GetIndex() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
2014-02-02 22:16:48 -06:00
|
|
|
nStartIndex = aIndex.GetIndex();
|
2002-08-02 10:35:10 +00:00
|
|
|
|
|
|
|
aIndex.SetEEIndex( nPara, nEndIndex, *this );
|
|
|
|
DBG_ASSERT(aIndex.GetIndex() >= 0 &&
|
|
|
|
aIndex.GetIndex() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextIndex::SetIndex: index value overflow");
|
2014-02-02 22:16:48 -06:00
|
|
|
nEndIndex = aIndex.GetIndex();
|
2002-08-02 10:35:10 +00:00
|
|
|
|
2014-02-26 15:30:29 +02:00
|
|
|
return true;
|
2002-08-02 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::GetLineCount( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetLineCount( nPara );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::GetLineLen( sal_Int32 nPara, sal_Int32 nLine ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-05-27 15:43:06 +00:00
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 nCurrLine;
|
|
|
|
sal_Int32 nCurrIndex, nLastIndex;
|
2002-05-29 14:49:18 +00:00
|
|
|
for( nCurrLine=0, nCurrIndex=0, nLastIndex=0; nCurrLine<=nLine; ++nCurrLine )
|
2002-05-27 15:43:06 +00:00
|
|
|
{
|
|
|
|
nLastIndex = nCurrIndex;
|
2006-10-12 12:27:56 +00:00
|
|
|
nCurrIndex =
|
2014-02-13 14:06:22 +00:00
|
|
|
nCurrIndex + mpTextForwarder->GetLineLen( nPara, nCurrLine );
|
2002-05-27 15:43:06 +00:00
|
|
|
}
|
2002-05-17 16:35:51 +00:00
|
|
|
|
2002-05-27 15:43:06 +00:00
|
|
|
aEndIndex.SetEEIndex( nPara, nCurrIndex, *this );
|
|
|
|
if( nLine > 0 )
|
|
|
|
{
|
|
|
|
aStartIndex.SetEEIndex( nPara, nLastIndex, *this );
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
return aEndIndex.GetIndex() - aStartIndex.GetIndex();
|
2002-05-27 15:43:06 +00:00
|
|
|
}
|
|
|
|
else
|
2014-02-02 22:16:48 -06:00
|
|
|
return aEndIndex.GetIndex();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
void SvxAccessibleTextAdapter::GetLineBoundaries( /*out*/sal_Int32 &rStart, /*out*/sal_Int32 &rEnd, sal_Int32 nParagraph, sal_Int32 nLine ) const
|
2009-08-26 13:37:34 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder->GetLineBoundaries( rStart, rEnd, nParagraph, nLine );
|
2009-08-26 13:37:34 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::GetLineNumberAtIndex( sal_Int32 nPara, sal_Int32 nIndex ) const
|
2009-08-26 13:37:34 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetLineNumberAtIndex( nPara, nIndex );
|
2009-08-26 13:37:34 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::Delete( const ESelection& rSel )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->Delete( MakeEESelection(aStartIndex, aEndIndex ) );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::InsertText( const OUString& rStr, const ESelection& rSel )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *this );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *this );
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->InsertText( rStr, MakeEESelection(aStartIndex, aEndIndex) );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::QuickFormatDoc( bool bFull )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->QuickFormatDoc( bFull );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2013-05-08 18:12:32 +02:00
|
|
|
sal_Int16 SvxAccessibleTextAdapter::GetDepth( sal_Int32 nPara ) const
|
2002-07-26 10:35:10 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-07-26 10:35:10 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->GetDepth( nPara );
|
2002-07-26 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::SetDepth( sal_Int32 nPara, sal_Int16 nNewDepth )
|
2002-07-26 10:35:10 +00:00
|
|
|
{
|
2014-07-03 08:51:19 +01:00
|
|
|
assert(mpTextForwarder && "SvxAccessibleTextAdapter: no forwarder");
|
2002-07-26 10:35:10 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpTextForwarder->SetDepth( nPara, nNewDepth );
|
2002-07-26 10:35:10 +00:00
|
|
|
}
|
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
void SvxAccessibleTextAdapter::SetForwarder( SvxTextForwarder& rForwarder )
|
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
mpTextForwarder = &rForwarder;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::HaveImageBullet( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
|
|
|
|
aBulletInfo.bVisible &&
|
|
|
|
aBulletInfo.nType == SVX_NUM_BITMAP );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::HaveTextBullet( sal_Int32 nPara ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
EBulletInfo aBulletInfo = GetBulletInfo( nPara );
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
return ( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
|
|
|
|
aBulletInfo.bVisible &&
|
|
|
|
aBulletInfo.nType != SVX_NUM_BITMAP );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextAdapter::IsEditable( const ESelection& rSel )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
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 );
|
|
|
|
}
|
|
|
|
|
2007-07-18 12:07:06 +00:00
|
|
|
const SfxItemSet * SvxAccessibleTextAdapter::GetEmptyItemSetPtr()
|
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "not implemented" );
|
2007-07-18 12:07:06 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAccessibleTextAdapter::AppendParagraph()
|
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "not implemented" );
|
2007-07-18 12:07:06 +00:00
|
|
|
}
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
sal_Int32 SvxAccessibleTextAdapter::AppendTextPortion( sal_Int32, const OUString &, const SfxItemSet & )
|
2007-07-18 12:07:06 +00:00
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "not implemented" );
|
2007-07-18 12:07:06 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2008-07-01 11:52:29 +00:00
|
|
|
void SvxAccessibleTextAdapter::CopyText(const SvxTextForwarder&)
|
|
|
|
{
|
2011-03-01 19:07:44 +01:00
|
|
|
OSL_FAIL( "not implemented" );
|
2008-07-01 11:52:29 +00:00
|
|
|
}
|
2007-07-18 12:07:06 +00:00
|
|
|
|
2002-05-16 15:12:20 +00:00
|
|
|
SvxAccessibleTextEditViewAdapter::SvxAccessibleTextEditViewAdapter()
|
2014-02-13 14:06:22 +00:00
|
|
|
: mpViewForwarder(NULL)
|
|
|
|
, mpTextForwarder(NULL)
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxAccessibleTextEditViewAdapter::~SvxAccessibleTextEditViewAdapter()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-02-28 09:47:38 +02:00
|
|
|
bool SvxAccessibleTextEditViewAdapter::IsValid() const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
if( mpViewForwarder )
|
|
|
|
return mpViewForwarder->IsValid();
|
2002-05-16 15:12:20 +00:00
|
|
|
else
|
2014-02-28 09:47:38 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Rectangle SvxAccessibleTextEditViewAdapter::GetVisArea() const
|
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->GetVisArea();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Point SvxAccessibleTextEditViewAdapter::LogicToPixel( const Point& rPoint, const MapMode& rMapMode ) const
|
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->LogicToPixel(rPoint, rMapMode);
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Point SvxAccessibleTextEditViewAdapter::PixelToLogic( const Point& rPoint, const MapMode& rMapMode ) const
|
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->PixelToLogic(rPoint, rMapMode);
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:27:20 +02:00
|
|
|
bool SvxAccessibleTextEditViewAdapter::GetSelection( ESelection& rSel ) const
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
ESelection aSelection;
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
if( !mpViewForwarder->GetSelection( aSelection ) )
|
2014-02-28 14:27:20 +02:00
|
|
|
return false;
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
aStartIndex.SetEEIndex( aSelection.nStartPara, aSelection.nStartPos, *mpTextForwarder );
|
|
|
|
aEndIndex.SetEEIndex( aSelection.nEndPara, aSelection.nEndPos, *mpTextForwarder );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2002-05-23 11:46:18 +00:00
|
|
|
DBG_ASSERT(aStartIndex.GetIndex() >= 0 && aStartIndex.GetIndex() <= USHRT_MAX &&
|
|
|
|
aEndIndex.GetIndex() >= 0 && aEndIndex.GetIndex() <= USHRT_MAX,
|
|
|
|
"SvxAccessibleTextEditViewAdapter::GetSelection: index value overflow");
|
|
|
|
|
2014-02-02 22:16:48 -06:00
|
|
|
rSel = ESelection( aStartIndex.GetParagraph(), aStartIndex.GetIndex(),
|
|
|
|
aEndIndex.GetParagraph(), aEndIndex.GetIndex() );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-28 14:27:20 +02:00
|
|
|
return true;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:27:20 +02:00
|
|
|
bool SvxAccessibleTextEditViewAdapter::SetSelection( const ESelection& rSel )
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
|
|
|
SvxAccessibleTextIndex aStartIndex;
|
|
|
|
SvxAccessibleTextIndex aEndIndex;
|
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
aStartIndex.SetIndex( rSel.nStartPara, rSel.nStartPos, *mpTextForwarder );
|
|
|
|
aEndIndex.SetIndex( rSel.nEndPara, rSel.nEndPos, *mpTextForwarder );
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->SetSelection( MakeEESelection(aStartIndex, aEndIndex) );
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:27:20 +02:00
|
|
|
bool SvxAccessibleTextEditViewAdapter::Copy()
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->Copy();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:27:20 +02:00
|
|
|
bool SvxAccessibleTextEditViewAdapter::Cut()
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->Cut();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
2014-02-28 14:27:20 +02:00
|
|
|
bool SvxAccessibleTextEditViewAdapter::Paste()
|
2002-05-16 15:12:20 +00:00
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
DBG_ASSERT(mpViewForwarder, "SvxAccessibleTextEditViewAdapter: no forwarder");
|
2002-05-16 15:12:20 +00:00
|
|
|
|
2014-02-13 14:06:22 +00:00
|
|
|
return mpViewForwarder->Paste();
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SvxAccessibleTextEditViewAdapter::SetForwarder( SvxEditViewForwarder& rForwarder,
|
|
|
|
SvxAccessibleTextAdapter& rTextForwarder )
|
|
|
|
{
|
2014-02-13 14:06:22 +00:00
|
|
|
mpViewForwarder = &rForwarder;
|
|
|
|
mpTextForwarder = &rTextForwarder;
|
2002-05-16 15:12:20 +00:00
|
|
|
}
|
2007-07-18 12:07:06 +00:00
|
|
|
|
2010-10-12 15:53:47 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|