summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2013-11-26 14:25:22 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-11-26 15:27:17 +0000
commitc23ab5eaed57cc3fb5860e26c591c73c5b22687b (patch)
tree7a918b328e80763fa334f59c789cff399f207541 /editeng
parent62fcdfa34aa302aa9051e90e75b94eb442fa1db7 (diff)
Integrate branch of IAccessible2
WaE: Reorder initializations to prevent compiler warnings. (cherry picked from commit c05431aa92fa2c7c7258418a6ecd651b5c26d982) WaE: unname unused variable to prevent compiler warnings. (cherry picked from commit 2259256a390c4b6f83cfb5dbe4a65df5032aee47) Conflicts: editeng/source/accessibility/AccessibleEditableTextPara.cxx ad61537527a74670af266feb9e4d26d2d654daf7 66044902b8d94fc15d4c30270e6cc419fb7d3565 Change-Id: I3ec9798f2c7d854824722c0cf44b62128b4f4cb4
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/accessibility/AccessibleEditableTextPara.cxx915
-rw-r--r--editeng/source/accessibility/AccessibleParaManager.cxx9
-rw-r--r--editeng/source/accessibility/AccessibleStaticTextBase.cxx155
-rw-r--r--editeng/source/accessibility/accessibility.src10
-rw-r--r--editeng/source/editeng/edtspell.cxx1
-rw-r--r--editeng/source/editeng/impedit.cxx16
-rw-r--r--editeng/source/editeng/impedit.hxx4
-rw-r--r--editeng/source/editeng/impedit2.cxx1
-rw-r--r--editeng/source/editeng/impedit3.cxx7
-rw-r--r--editeng/source/misc/splwrap.cxx2
-rw-r--r--editeng/source/outliner/outliner.cxx7
-rw-r--r--editeng/source/uno/unoedhlp.cxx167
-rw-r--r--editeng/source/uno/unoedprx.cxx27
-rw-r--r--editeng/source/uno/unofored.cxx4
-rw-r--r--editeng/source/uno/unoforou.cxx4
-rw-r--r--editeng/source/uno/unonrule.cxx1
-rw-r--r--editeng/source/uno/unotext.cxx2
17 files changed, 1256 insertions, 76 deletions
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 191a19339101..e9941dfb7106 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -51,6 +51,7 @@
#include <editeng/unoprnms.hxx>
#include <editeng/unoipset.hxx>
#include <editeng/outliner.hxx>
+#include <svl/intitem.hxx>
//------------------------------------------------------------------------
//
@@ -60,17 +61,17 @@
#include <com/sun/star/beans/PropertyState.hpp>
-//!!!#include <svx/unoshape.hxx>
-//!!!#include <svx/dialmgr.hxx>
-//!!!#include "accessibility.hrc"
-
#include <editeng/unolingu.hxx>
#include <editeng/unopracc.hxx>
#include "editeng/AccessibleEditableTextPara.hxx"
#include "AccessibleHyperlink.hxx"
#include <svtools/colorcfg.hxx>
-
+#include <algorithm>
+using namespace std;
+#include "editeng.hrc"
+#include <editeng/eerdll.hxx>
+#include <editeng/numitem.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::beans;
@@ -85,12 +86,12 @@ using namespace ::com::sun::star::accessibility;
namespace accessibility
{
-
const SvxItemPropertySet* ImplGetSvxCharAndParaPropertiesSet()
{
// PropertyMap for character and paragraph properties
static const SfxItemPropertyMapEntry aPropMap[] =
{
+ SVX_UNOEDIT_OUTLINER_PROPERTIES,
SVX_UNOEDIT_CHAR_PROPERTIES,
SVX_UNOEDIT_PARA_PROPERTIES,
SVX_UNOEDIT_NUMBERING_PROPERTIE,
@@ -211,7 +212,10 @@ namespace accessibility
DBG_WARNING( "AccessibleEditableTextPara::implGetParagraphBoundary: only a base implementation, ignoring the index" );
rBoundary.startPos = 0;
- rBoundary.endPos = GetTextLen();
+ //rBoundary.endPos = GetTextLen();
+ OUString sText( implGetText() );
+ sal_Int32 nLength = sText.getLength();
+ rBoundary.endPos = nLength;
}
void AccessibleEditableTextPara::implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex )
@@ -361,13 +365,11 @@ namespace accessibility
{
DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
- mpEditSource = pEditSource;
-
WeakBullet::HardRefType aChild( maImageBullet.get() );
if( aChild.is() )
aChild->SetEditSource(pEditSource);
- if( !mpEditSource )
+ if( !pEditSource )
{
// going defunc
UnSetState( AccessibleStateType::SHOWING );
@@ -377,7 +379,7 @@ namespace accessibility
Dispose();
}
-
+ mpEditSource = pEditSource;
// #108900# Init last text content
try
{
@@ -858,19 +860,61 @@ namespace accessibility
OUString SAL_CALL AccessibleEditableTextPara::getAccessibleDescription() throw (uno::RuntimeException)
{
DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
+ SolarMutexGuard aGuard;
-// SolarMutexGuard aGuard;
+ // append first 40 characters from text, or first line, if shorter
+ // (writer takes first sentence here, but that's not supported
+ // from EditEngine)
+ // throws if defunc
+ OUString aLine;
- return OUString();
+ if( getCharacterCount() )
+ aLine = getTextAtIndex(0, AccessibleTextType::LINE).SegmentText;
+
+ // Get the string from the resource for the specified id.
+ OUString sStr(EditResId(RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION));
+ OUString sParaIndex = OUString::number(GetParagraphIndex());
+ sStr = sStr.replaceFirst("$(ARG)", sParaIndex);
+
+ if( aLine.getLength() > MaxDescriptionLen )
+ {
+ OUString aCurrWord;
+ sal_Int32 i;
+
+ // search backward from MaxDescriptionLen for previous word start
+ for( aCurrWord=getTextAtIndex(MaxDescriptionLen, AccessibleTextType::WORD).SegmentText,
+ i=MaxDescriptionLen,
+ aLine=OUString();
+ i>=0;
+ --i )
+ {
+ if( getTextAtIndex(i, AccessibleTextType::WORD).SegmentText != aCurrWord )
+ {
+ if( i == 0 )
+ // prevent completely empty string
+ aLine = getTextAtIndex(0, AccessibleTextType::WORD).SegmentText;
+ else
+ aLine = getTextRange(0, i);
+ }
+ }
+ }
+
+ return OUString( sStr ) + aLine;
}
OUString SAL_CALL AccessibleEditableTextPara::getAccessibleName() throw (uno::RuntimeException)
{
DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
-// SolarMutexGuard aGuard;
+ SolarMutexGuard aGuard;
+
+ // throws if defunc
+ sal_Int32 nPara( GetParagraphIndex() );
- return OUString();
+ // Get the string from the resource for the specified id.
+ OUString sStr(EditResId(RID_SVXSTR_A11Y_PARAGRAPH_NAME));
+ OUString sParaIndex = OUString::number(nPara);
+ return sStr.replaceFirst("$(ARG)", sParaIndex);
}
uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleEditableTextPara::getAccessibleRelationSet() throw (uno::RuntimeException)
@@ -917,6 +961,140 @@ namespace accessibility
}
}
+ static uno::Sequence< OUString > getAttributeNames()
+ {
+ static uno::Sequence< OUString >* pNames = NULL;
+
+ if( pNames == NULL )
+ {
+ uno::Sequence< OUString >* pSeq = new uno::Sequence< OUString >( 21 );
+ OUString* pStrings = pSeq->getArray();
+ sal_Int32 i = 0;
+ #define STR(x) pStrings[i++] = OUString(x)
+ STR("CharColor");
+ STR("CharContoured");
+ STR("CharEmphasis");
+ STR("CharEscapement");
+ STR("CharFontName");
+ STR("CharHeight");
+ STR("CharPosture");
+ STR("CharShadowed");
+ STR("CharStrikeout");
+ STR("CharUnderline");
+ STR("CharUnderlineColor");
+ STR("CharWeight");
+ STR("NumberingLevel");
+ STR("NumberingRules");
+ STR("ParaAdjust");
+ STR("ParaBottomMargin");
+ STR("ParaFirstLineIndent");
+ STR("ParaLeftMargin");
+ STR("ParaLineSpacing");
+ STR("ParaRightMargin");
+ STR("ParaTabStops");
+ #undef STR
+ DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+ if( i != pSeq->getLength() )
+ pSeq->realloc( i );
+ pNames = pSeq;
+ }
+ return *pNames;
+ }
+
+ struct IndexCompare
+ {
+ const PropertyValue* pValues;
+ IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+ bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+ {
+ return (pValues[a].Name < pValues[b].Name) ? true : false;
+ }
+ };
+
+ OUString AccessibleEditableTextPara::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
+ {
+ OUString strFldType;
+ SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
+ //For field object info
+ sal_Int32 nParaIndex = GetParagraphIndex();
+ sal_Int32 nAllFieldLen = 0;
+ sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1;
+ EFieldInfo ree;
+ sal_Int32 reeBegin, reeEnd;
+ sal_Int32 nFieldType = -1;
+ for(sal_uInt16 j = 0; j < nField; j++)
+ {
+ ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j);
+ reeBegin = ree.aPosition.nIndex + nAllFieldLen;
+ reeEnd = reeBegin + ree.aCurrentText.getLength();
+ nAllFieldLen += (ree.aCurrentText.getLength() - 1);
+ if( reeBegin > nIndex )
+ {
+ break;
+ }
+ if( nIndex >= reeBegin && nIndex < reeEnd )
+ {
+ nFoundFieldIndex = j;
+ break;
+ }
+ }
+ if( nFoundFieldIndex >= 0 )
+ {
+ // So we get a field, check its type now.
+ nFieldType = ree.pFieldItem->GetField()->GetClassId() ;
+ }
+ switch(nFieldType)
+ {
+ case text::textfield::Type::DATE:
+ {
+ const SvxDateField* pDateField = static_cast< const SvxDateField* >(ree.pFieldItem->GetField());
+ if (pDateField)
+ {
+ if (pDateField->GetType() == SVXDATETYPE_FIX)
+ strFldType = "date (fixed)";
+ else if (pDateField->GetType() == SVXDATETYPE_VAR)
+ strFldType = "date (variable)";
+ }
+ }
+ break;
+ case text::textfield::Type::PAGE:
+ strFldType = "page-number";
+ break;
+ //support the sheet name & pages fields
+ case text::textfield::Type::PAGES:
+ strFldType = "page-count";
+ break;
+ case text::textfield::Type::TABLE:
+ strFldType = "sheet-name";
+ break;
+ //End
+ case text::textfield::Type::TIME:
+ strFldType = "time";
+ break;
+ case text::textfield::Type::EXTENDED_TIME:
+ {
+ const SvxExtTimeField* pTimeField = static_cast< const SvxExtTimeField* >(ree.pFieldItem->GetField());
+ if (pTimeField)
+ {
+ if (pTimeField->GetType() == SVXTIMETYPE_FIX)
+ strFldType = "time (fixed)";
+ else if (pTimeField->GetType() == SVXTIMETYPE_VAR)
+ strFldType = "time (variable)";
+ }
+ }
+ break;
+ case text::textfield::Type::AUTHOR:
+ strFldType = "author";
+ break;
+ case text::textfield::Type::EXTENDED_FILE:
+ case text::textfield::Type::DOCINFO_TITLE:
+ strFldType = "file name";
+ default:
+ break;
+ }
+ return strFldType;
+ }
+
uno::Reference< XAccessibleStateSet > SAL_CALL AccessibleEditableTextPara::getAccessibleStateSet() throw (uno::RuntimeException)
{
DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
@@ -928,7 +1106,16 @@ namespace accessibility
if( !pStateSet )
return uno::Reference<XAccessibleStateSet>();
-
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ if (xParentStates.is() && xParentStates->contains(AccessibleStateType::EDITABLE) )
+ {
+ pStateSet->AddState(AccessibleStateType::EDITABLE);
+ }
return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
}
@@ -1149,6 +1336,15 @@ namespace accessibility
GetParagraphIndex() == aSelection.nEndPara )
{
// caret is always nEndPara,nEndPos
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
+ aBulletInfo.bVisible &&
+ aBulletInfo.nType != SVX_NUM_BITMAP )
+ {
+ sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
+ if( aSelection.nEndPos - nBulletLen >= 0 )
+ return aSelection.nEndPos - nBulletLen;
+ }
return aSelection.nEndPos;
}
@@ -1180,13 +1376,30 @@ namespace accessibility
DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
SolarMutexGuard aGuard;
- CheckIndex(nIndex); // may throw IndexOutOfBoundsException
+ //Skip the bullet range to ingnore the bullet text
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if (aBulletInfo.bVisible)
+ nIndex += aBulletInfo.aText.getLength();
+ if (nIndex != 0 && nIndex >= getCharacterCount())
+ nIndex = getCharacterCount()-1;
+ //
+ if (nIndex != 0)
+ CheckIndex(nIndex); // may throw IndexOutOfBoundsException
+
+ bool bSupplementalMode = false;
+ uno::Sequence< OUString > aPropertyNames = rRequestedAttributes;
+ if (aPropertyNames.getLength() == 0)
+ {
+ bSupplementalMode = true;
+ aPropertyNames = getAttributeNames();
+ }
// get default attribues...
- ::comphelper::SequenceAsHashMap aPropHashMap( getDefaultAttributes( rRequestedAttributes ) );
+ ::comphelper::SequenceAsHashMap aPropHashMap( getDefaultAttributes( aPropertyNames ) );
// ... and override them with the direct attributes from the specific position
- uno::Sequence< beans::PropertyValue > aRunAttribs( getRunAttributes( nIndex, rRequestedAttributes ) );
+ uno::Sequence< beans::PropertyValue > aRunAttribs( getRunAttributes( nIndex, aPropertyNames ) );
sal_Int32 nRunAttribs = aRunAttribs.getLength();
const beans::PropertyValue *pRunAttrib = aRunAttribs.getConstArray();
for (sal_Int32 k = 0; k < nRunAttribs; ++k)
@@ -1216,7 +1429,55 @@ namespace accessibility
rRes.Handle = -1;
rRes.State = bIsDirectVal ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
}
-
+ if( bSupplementalMode )
+ {
+ _correctValues( nIndex, aRes );
+ // NumberingPrefix
+ nRes = aRes.getLength();
+ aRes.realloc( nRes + 1 );
+ pRes = aRes.getArray();
+ beans::PropertyValue &rRes = pRes[nRes];
+ rRes.Name = "NumberingPrefix";
+ OUString numStr;
+ if (aBulletInfo.nType != SVX_NUM_CHAR_SPECIAL && aBulletInfo.nType != SVX_NUM_BITMAP)
+ numStr = aBulletInfo.aText;
+ rRes.Value <<= numStr;
+ rRes.Handle = -1;
+ rRes.State = PropertyState_DIRECT_VALUE;
+ //For field object.
+ OUString strFieldType = GetFieldTypeNameAtIndex(nIndex);
+ if (!strFieldType.isEmpty())
+ {
+ nRes = aRes.getLength();
+ aRes.realloc( nRes + 1 );
+ pRes = aRes.getArray();
+ beans::PropertyValue &rResField = pRes[nRes];
+ beans::PropertyValue aFieldType;
+ rResField.Name = "FieldType";
+ rResField.Value <<= strFieldType.toAsciiLowerCase();
+ rResField.Handle = -1;
+ rResField.State = PropertyState_DIRECT_VALUE;
+ }
+ //sort property values
+ // build sorted index array
+ sal_Int32 nLength = aRes.getLength();
+ const beans::PropertyValue* pPairs = aRes.getConstArray();
+ sal_Int32* pIndices = new sal_Int32[nLength];
+ sal_Int32 i = 0;
+ for( i = 0; i < nLength; i++ )
+ pIndices[i] = i;
+ sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+ // create sorted sequences accoring to index array
+ uno::Sequence<beans::PropertyValue> aNewValues( nLength );
+ beans::PropertyValue* pNewValues = aNewValues.getArray();
+ for( i = 0; i < nLength; i++ )
+ {
+ pNewValues[i] = pPairs[pIndices[i]];
+ }
+ delete[] pIndices;
+ //
+ return aNewValues;
+ }
return aRes;
}
@@ -1273,6 +1534,9 @@ namespace accessibility
SolarMutexGuard aGuard;
+ if ((rPoint.X <= 0) && (rPoint.Y <= 0))
+ return 0;
+
sal_Int32 nPara;
sal_uInt16 nIndex;
@@ -1406,6 +1670,276 @@ namespace accessibility
return OCommonAccessibleText::getTextRange(nStartIndex, nEndIndex);
}
+ void AccessibleEditableTextPara::_correctValues( const sal_Int32 /* nIndex */,
+ uno::Sequence< PropertyValue >& rValues)
+ {
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ sal_Int32 nRes = rValues.getLength();
+ beans::PropertyValue *pRes = rValues.getArray();
+ for (sal_Int32 i = 0; i < nRes; ++i)
+ {
+ beans::PropertyValue &rRes = pRes[i];
+ // Char color
+ if (rRes.Name == "CharColor")
+ {
+ uno::Any &anyChar = rRes.Value;
+ sal_uInt32 crChar = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>(anyChar.pReserved));
+ if (COL_AUTO == crChar )
+ {
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleComponent > xComponent;
+ if (mxParent.is())
+ {
+ xComponent.set(mxParent,uno::UNO_QUERY);
+ }
+ else
+ {
+ xComponent.set(m_xAccInfo,uno::UNO_QUERY);
+ }
+ if (xComponent.is())
+ {
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xContext(xComponent,uno::UNO_QUERY);
+ if (xContext->getAccessibleRole() == AccessibleRole::SHAPE
+ || xContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+ {
+ anyChar <<= COL_BLACK;
+ }
+ else
+ {
+ Color cr(xComponent->getBackground());
+ crChar = cr.IsDark() ? COL_WHITE : COL_BLACK;
+ anyChar <<= crChar;
+ }
+ }
+ }
+ continue;
+ }
+ // Underline
+ if (rRes.Name == "CharUnderline")
+ {
+ /*
+ // MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW.
+ if (IsCurrentEditorEnableAutoSpell( mxParent ))
+ {
+ try
+ {
+ SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_False );
+ sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex );
+ if ( bWrong )
+ {
+ uno::Any &anyUnderLine = pRes[9].Value;
+ // MT IA2: Not needed? sal_uInt16 crUnderLine = (sal_uInt16)(anyUnderLine.pReserved);
+ anyUnderLine <<= (sal_uInt16)UNDERLINE_WAVE;
+ }
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ }
+ */
+ continue;
+ }
+ // Underline color && Mis-spell
+ if (rRes.Name == "CharUnderlineColor")
+ {
+ uno::Any &anyCharUnderLine = rRes.Value;
+ sal_uInt32 crCharUnderLine = static_cast<sal_uInt32>( reinterpret_cast<sal_uIntPtr>( anyCharUnderLine.pReserved));
+ if (COL_AUTO == crCharUnderLine )
+ {
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleComponent > xComponent;
+ if (mxParent.is())
+ {
+ xComponent.set(mxParent,uno::UNO_QUERY);
+ }
+ else
+ {
+ xComponent.set(m_xAccInfo,uno::UNO_QUERY);
+ }
+ if (xComponent.is())
+ {
+ uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xContext(xComponent,uno::UNO_QUERY);
+ if (xContext->getAccessibleRole() == AccessibleRole::SHAPE
+ || xContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+ {
+ anyCharUnderLine <<= COL_BLACK;
+ }
+ else
+ {
+ Color cr(xComponent->getBackground());
+ crCharUnderLine = cr.IsDark() ? COL_WHITE : COL_BLACK;
+ anyCharUnderLine <<= crCharUnderLine;
+ }
+ }
+ }
+ // MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW.
+ /*
+ if (IsCurrentEditorEnableAutoSpell( mxParent ))
+ {
+ try
+ {
+ SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_False );
+ sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex );
+ if ( bWrong )
+ {
+ uno::Any &anyUnderLineColor = rRes.Value;
+ // MT IA2: Not needed? sal_uInt16 crUnderLineColor = (sal_uInt16)(anyUnderLineColor.pReserved);
+ anyUnderLineColor <<= COL_LIGHTRED;
+ }
+ }
+ catch( const uno::RuntimeException& )
+ {
+ }
+ }
+ */
+ continue;
+ }
+ // NumberingLevel
+ if (rRes.Name == "NumberingLevel")
+ {
+ const SvxNumBulletItem& rNumBullet = ( SvxNumBulletItem& )rCacheTF.GetParaAttribs(static_cast< sal_uInt16 >(GetParagraphIndex())).Get(EE_PARA_NUMBULLET);
+ if(rNumBullet.GetNumRule()->GetLevelCount()==0)
+ {
+ rRes.Value <<= (sal_Int16)-1;
+ rRes.Handle = -1;
+ rRes.State = PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+// SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
+// ImplGetSvxCharAndParaPropertiesMap() );
+ // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap
+ SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() );
+
+ aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) );
+ rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex );
+ rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex );
+ rRes.Handle = -1;
+ }
+ continue;
+ }
+ // NumberingRules
+ if (rRes.Name == "NumberingRules")
+ {
+ SfxItemSet aAttribs = rCacheTF.GetParaAttribs( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ sal_Bool bVis = ((const SfxUInt16Item&)aAttribs.Get( EE_PARA_BULLETSTATE )).GetValue() ? sal_True : sal_False;
+ if(bVis)
+ {
+ rRes.Value <<= (sal_Int16)-1;
+ rRes.Handle = -1;
+ rRes.State = PropertyState_DIRECT_VALUE;
+ }
+ else
+ {
+ // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap
+ SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() );
+ aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) );
+ rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex );
+ rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex );
+ rRes.Handle = -1;
+ }
+ continue;
+ }
+ }
+ }
+ sal_Int32 AccessibleEditableTextPara::SkipField(sal_Int32 nIndex, sal_Bool bForward)
+ {
+ sal_Int32 nParaIndex = GetParagraphIndex();
+ SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
+ sal_Int32 nAllFieldLen = 0;
+ sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1;
+ EFieldInfo ree;
+ sal_Int32 reeBegin=0, reeEnd=0;
+ for(sal_uInt16 j = 0; j < nField; j++)
+ {
+ ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j);
+ reeBegin = ree.aPosition.nIndex + nAllFieldLen;
+ reeEnd = reeBegin + ree.aCurrentText.getLength();
+ nAllFieldLen += (ree.aCurrentText.getLength() - 1);
+ if( reeBegin > nIndex )
+ {
+ break;
+ }
+ if( nIndex >= reeBegin && nIndex < reeEnd )
+ {
+ if(ree.pFieldItem->GetField()->GetClassId() != text::textfield::Type::URL)
+ {
+ nFoundFieldIndex = j;
+ break;
+ }
+ }
+ }
+ if( nFoundFieldIndex >= 0 )
+ {
+ if( bForward )
+ return reeEnd - 1;
+ else
+ return reeBegin;
+ }
+ return nIndex;
+ }
+ sal_Bool AccessibleEditableTextPara::ExtendByField( ::com::sun::star::accessibility::TextSegment& Segment )
+ {
+ sal_Int32 nParaIndex = GetParagraphIndex();
+ SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
+ sal_Int32 nAllFieldLen = 0;
+ sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1;
+ EFieldInfo ree;
+ sal_Int32 reeBegin=0, reeEnd=0;
+ for(sal_uInt16 j = 0; j < nField; j++)
+ {
+ ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j);
+ reeBegin = ree.aPosition.nIndex + nAllFieldLen;
+ reeEnd = reeBegin + ree.aCurrentText.getLength();
+ nAllFieldLen += (ree.aCurrentText.getLength() - 1);
+ if( reeBegin > Segment.SegmentEnd )
+ {
+ break;
+ }
+ if( (Segment.SegmentEnd > reeBegin && Segment.SegmentEnd <= reeEnd) ||
+ (Segment.SegmentStart >= reeBegin && Segment.SegmentStart < reeEnd) )
+ {
+ if(ree.pFieldItem->GetField()->GetClassId() != text::textfield::Type::URL)
+ {
+ nFoundFieldIndex = j;
+ break;
+ }
+ }
+ }
+ sal_Bool bExtend = sal_False;
+ if( nFoundFieldIndex >= 0 )
+ {
+ if( Segment.SegmentEnd < reeEnd )
+ {
+ Segment.SegmentEnd = reeEnd;
+ bExtend = sal_True;
+ }
+ if( Segment.SegmentStart > reeBegin )
+ {
+ Segment.SegmentStart = reeBegin;
+ bExtend = sal_True;
+ }
+ if( bExtend )
+ {
+ //If there is a bullet before the field, should add the bullet length into the segment.
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(sal_uInt16(nParaIndex));
+ sal_Int32 nBulletLen = aBulletInfo.aText.getLength();
+ if (nBulletLen > 0)
+ {
+ Segment.SegmentEnd += nBulletLen;
+ if (nFoundFieldIndex > 0)
+ Segment.SegmentStart += nBulletLen;
+ Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
+ //After get the correct field name, should restore the offset value which don't contain the bullet.
+ Segment.SegmentEnd -= nBulletLen;
+ if (nFoundFieldIndex > 0)
+ Segment.SegmentStart -= nBulletLen;
+ }
+ else
+ Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
+ }
+ }
+ return bExtend;
+ }
+
::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
@@ -1421,6 +1955,13 @@ namespace accessibility
switch( aTextType )
{
+ case AccessibleTextType::CHARACTER:
+ case AccessibleTextType::WORD:
+ {
+ aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
+ ExtendByField( aResult );
+ break;
+ }
// Not yet handled by OCommonAccessibleText. Missing
// implGetAttributeRunBoundary() method there
case AccessibleTextType::ATTRIBUTE_RUN:
@@ -1435,17 +1976,79 @@ namespace accessibility
else
{
sal_uInt16 nStartIndex, nEndIndex;
-
+ //For the bullet paragraph, the bullet string is ingnored for IAText::attributes() function.
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ // MT IA2: Not used? sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if (aBulletInfo.bVisible)
+ nIndex += aBulletInfo.aText.getLength();
+ if (nIndex != 0 && nIndex >= getCharacterCount())
+ nIndex = getCharacterCount()-1;
+ CheckPosition(nIndex);
if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) )
{
aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex);
+ if (aBulletInfo.bVisible)
+ {
+ nStartIndex -= aBulletInfo.aText.getLength();
+ nEndIndex -= aBulletInfo.aText.getLength();
+ }
aResult.SegmentStart = nStartIndex;
aResult.SegmentEnd = nEndIndex;
}
}
break;
}
-
+ case AccessibleTextType::LINE:
+ {
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ sal_Int32 nParaIndex = GetParagraphIndex();
+ CheckPosition(nIndex);
+ if (nIndex != 0 && nIndex == getCharacterCount())
+ --nIndex;
+ sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( nParaIndex );
+ sal_Int32 nCurIndex;
+ //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line,
+ //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed
+ //by the IAText::attributes(). So here must do special support for bullet line.
+ sal_Int32 nBulletLen = 0;
+ for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine )
+ {
+ if (nLine == 0)
+ {
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( nParaIndex );
+ if (aBulletInfo.bVisible)
+ {
+ //in bullet or numbering;
+ nBulletLen = aBulletInfo.aText.getLength();
+ }
+ }
+ sal_Int32 nLineLen = rCacheTF.GetLineLen(nParaIndex, nLine);
+ if (nLine == 0)
+ nCurIndex += nLineLen - nBulletLen;
+ else
+ nCurIndex += nLineLen;
+ if( nCurIndex > nIndex )
+ {
+ if (nLine ==0)
+ {
+ aResult.SegmentStart = 0;
+ aResult.SegmentEnd = nCurIndex;
+ aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen);
+ break;
+ }
+ else
+ {
+ aResult.SegmentStart = nCurIndex - nLineLen;
+ aResult.SegmentEnd = nCurIndex;
+ //aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd );
+ aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
+ break;
+ }
+ }
+ }
+ break;
+ }
default:
aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
break;
@@ -1466,7 +2069,7 @@ namespace accessibility
::com::sun::star::accessibility::TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
-
+ i18n::Boundary aBoundary;
switch( aTextType )
{
// Not yet handled by OCommonAccessibleText. Missing
@@ -1504,7 +2107,115 @@ namespace accessibility
}
break;
}
+ case AccessibleTextType::LINE:
+ {
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ sal_Int32 nParaIndex = GetParagraphIndex();
+
+ CheckPosition(nIndex);
+
+ sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) );
+ //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line,
+ //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed
+ //by the IAText::attributes(). So here must do special support for bullet line.
+ sal_Int32 nCurIndex=0, nLastIndex=0, nCurLineLen=0;
+ sal_Int32 nLastLineLen = 0, nBulletLen = 0;;
+ // get the line before the line the index points into
+ for( nLine=0, nCurIndex=0, nLastIndex=0; nLine<nLineCount; ++nLine )
+ {
+ nLastIndex = nCurIndex;
+ if (nLine == 0)
+ {
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) );
+ if (aBulletInfo.bVisible)
+ {
+ //in bullet or numbering;
+ nBulletLen = aBulletInfo.aText.getLength();
+ }
+ }
+ if (nLine == 1)
+ nLastLineLen = nCurLineLen - nBulletLen;
+ else
+ nLastLineLen = nCurLineLen;
+ nCurLineLen = rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
+ //nCurIndex += nCurLineLen;
+ if (nLine == 0)
+ nCurIndex += nCurLineLen - nBulletLen;
+ else
+ nCurIndex += nCurLineLen;
+
+ //if( nCurIndex > nIndex &&
+ //nLastIndex > nCurLineLen )
+ if (nCurIndex > nIndex)
+ {
+ if (nLine == 0)
+ {
+ break;
+ }
+ else if (nLine == 1)
+ {
+ aResult.SegmentStart = 0;
+ aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex );
+ aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen);
+ break;
+ }
+ else
+ {
+ //aResult.SegmentStart = nLastIndex - nCurLineLen;
+ aResult.SegmentStart = nLastIndex - nLastLineLen;
+ aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex );
+ aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
+ break;
+ }
+ }
+ }
+
+ break;
+ }
+ case AccessibleTextType::WORD:
+ {
+ nIndex = SkipField( nIndex, sal_False);
+ OUString sText( implGetText() );
+ sal_Int32 nLength = sText.getLength();
+
+ // get word at index
+ implGetWordBoundary( aBoundary, nIndex );
+
+ //sal_Int32 curWordStart = aBoundary.startPos;
+ //sal_Int32 preWordStart = curWordStart;
+ sal_Int32 curWordStart , preWordStart;
+ if( aBoundary.startPos == -1 || aBoundary.startPos > nIndex)
+ curWordStart = preWordStart = nIndex;
+ else
+ curWordStart = preWordStart = aBoundary.startPos;
+
+ // get previous word
+
+ sal_Bool bWord = sal_False;
+
+ //while ( preWordStart > 0 && aBoundary.startPos == curWordStart)
+ while ( (preWordStart >= 0 && !bWord ) || ( aBoundary.endPos > curWordStart ) )
+ {
+ preWordStart--;
+ bWord = implGetWordBoundary( aBoundary, preWordStart );
+ }
+ if ( bWord && implIsValidBoundary( aBoundary, nLength ) )
+ {
+ aResult.SegmentText = sText.copy( aBoundary.startPos, aBoundary.endPos - aBoundary.startPos );
+ aResult.SegmentStart = aBoundary.startPos;
+ aResult.SegmentEnd = aBoundary.endPos;
+ ExtendByField( aResult );
+ }
+ }
+ break;
+ case AccessibleTextType::CHARACTER:
+ {
+ nIndex = SkipField( nIndex, sal_False);
+ aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
+ ExtendByField( aResult );
+ break;
+ }
default:
aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
break;
@@ -1525,7 +2236,7 @@ namespace accessibility
::com::sun::star::accessibility::TextSegment aResult;
aResult.SegmentStart = -1;
aResult.SegmentEnd = -1;
-
+ i18n::Boundary aBoundary;
switch( aTextType )
{
case AccessibleTextType::ATTRIBUTE_RUN:
@@ -1548,6 +2259,91 @@ namespace accessibility
break;
}
+ case AccessibleTextType::LINE:
+ {
+ SvxTextForwarder& rCacheTF = GetTextForwarder();
+ sal_Int32 nParaIndex = GetParagraphIndex();
+ // MT IA2 not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) );
+
+ CheckPosition(nIndex);
+
+ sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) );
+ sal_Int32 nCurIndex;
+ //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line,
+ //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed
+ //by the IAText::attributes(). So here must do special support for bullet line.
+ sal_Int32 nBulletLen = 0;
+ // get the line after the line the index points into
+ for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine )
+ {
+ if (nLine == 0)
+ {
+ EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) );
+ if (aBulletInfo.bVisible)
+ {
+ //in bullet or numbering;
+ nBulletLen = aBulletInfo.aText.getLength();
+ }
+ }
+ //nCurIndex += rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
+ sal_Int32 nLineLen = rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine);
+
+ if (nLine == 0)
+ nCurIndex += nLineLen - nBulletLen;
+ else
+ nCurIndex += nLineLen;
+
+ if( nCurIndex > nIndex &&
+ nLine < nLineCount-1 )
+ {
+ aResult.SegmentStart = nCurIndex;
+ aResult.SegmentEnd = nCurIndex + rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine+1);
+ aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
+ break;
+ }
+ }
+
+ break;
+ }
+ case AccessibleTextType::WORD:
+ {
+ nIndex = SkipField( nIndex, sal_True);
+ OUString sText( implGetText() );
+ sal_Int32 nLength = sText.getLength();
+
+ // get word at index
+ sal_Bool bWord = implGetWordBoundary( aBoundary, nIndex );
+
+ // real current world
+ sal_Int32 nextWord = nIndex;
+ //if( nIndex >= aBoundary.startPos && nIndex <= aBoundary.endPos )
+ if( nIndex <= aBoundary.endPos )
+ {
+ nextWord = aBoundary.endPos;
+ if( sText.getStr()[nextWord] == sal_Unicode(' ') ) nextWord++;
+ bWord = implGetWordBoundary( aBoundary, nextWord );
+ }
+
+ if ( bWord && implIsValidBoundary( aBoundary, nLength ) )
+ {
+ aResult.SegmentText = sText.copy( aBoundary.startPos, aBoundary.endPos - aBoundary.startPos );
+ aResult.SegmentStart = aBoundary.startPos;
+ aResult.SegmentEnd = aBoundary.endPos;
+
+ // If the end position of aBoundary is inside a field, extend the result to the end of the field
+
+ ExtendByField( aResult );
+ }
+ }
+ break;
+
+ case AccessibleTextType::CHARACTER:
+ {
+ nIndex = SkipField( nIndex, sal_True);
+ aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
+ ExtendByField( aResult );
+ break;
+ }
default:
aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
break;
@@ -1579,11 +2375,17 @@ namespace accessibility
CheckRange(nStartIndex, nEndIndex);
+ //Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+ sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+ nBulletLen = aBulletInfo.aText.getLength();
// save current selection
ESelection aOldSelection;
rCacheVF.GetSelection( aOldSelection );
- rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+ //rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+ rCacheVF.SetSelection( MakeSelection(nStartIndex + nBulletLen, nEndIndex + nBulletLen) );
aRetVal = rCacheVF.Copy();
rCacheVF.SetSelection( aOldSelection ); // restore
@@ -1612,11 +2414,19 @@ namespace accessibility
CheckRange(nStartIndex, nEndIndex);
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+ // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+ sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+ nBulletLen = aBulletInfo.aText.getLength();
+ ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
+ //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+ if( !rCacheTF.IsEditable( aSelection ) )
return sal_False; // non-editable area selected
// don't save selection, might become invalid after cut!
- rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+ //rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+ rCacheVF.SetSelection( aSelection );
return rCacheVF.Cut();
}
@@ -1642,11 +2452,17 @@ namespace accessibility
CheckPosition(nIndex);
- if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
+ // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+ sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+ nBulletLen = aBulletInfo.aText.getLength();
+ if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) )
return sal_False; // non-editable area selected
// #104400# set empty selection (=> cursor) to given index
- rCacheVF.SetSelection( MakeCursor(nIndex) );
+ //rCacheVF.SetSelection( MakeCursor(nIndex) );
+ rCacheVF.SetSelection( MakeCursor(nIndex + nBulletLen) );
return rCacheVF.Paste();
}
@@ -1674,10 +2490,19 @@ namespace accessibility
CheckRange(nStartIndex, nEndIndex);
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+ // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+ sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+ nBulletLen = aBulletInfo.aText.getLength();
+ ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
+
+ //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+ if( !rCacheTF.IsEditable( aSelection ) )
return sal_False; // non-editable area selected
- sal_Bool bRet = rCacheTF.Delete( MakeSelection(nStartIndex, nEndIndex) );
+ //sal_Bool bRet = rCacheTF.Delete( MakeSelection(nStartIndex, nEndIndex) );
+ sal_Bool bRet = rCacheTF.Delete( aSelection );
GetEditSource().UpdateData();
@@ -1707,11 +2532,17 @@ namespace accessibility
CheckPosition(nIndex);
- if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
+ // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+ sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+ nBulletLen = aBulletInfo.aText.getLength();
+
+ if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) )
return sal_False; // non-editable area selected
// #104400# insert given text at empty selection (=> cursor)
- sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex) );
+ sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex + nBulletLen) );
rCacheTF.QuickFormatDoc();
GetEditSource().UpdateData();
@@ -1742,11 +2573,20 @@ namespace accessibility
CheckRange(nStartIndex, nEndIndex);
- if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+ // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+ sal_Int32 nBulletLen = 0;
+ EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+ if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+ nBulletLen = aBulletInfo.aText.getLength();
+ ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
+
+ //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+ if( !rCacheTF.IsEditable( aSelection ) )
return sal_False; // non-editable area selected
// insert given text into given range => replace
- sal_Bool bRet = rCacheTF.InsertText( sReplacement, MakeSelection(nStartIndex, nEndIndex) );
+ //sal_Bool bRet = rCacheTF.InsertText( sReplacement, MakeSelection(nStartIndex, nEndIndex) );
+ sal_Bool bRet = rCacheTF.InsertText( sReplacement, aSelection );
rCacheTF.QuickFormatDoc();
GetEditSource().UpdateData();
@@ -1947,7 +2787,10 @@ namespace accessibility
DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
"AccessibleEditableTextPara::getCharacterAttributes: index value overflow");
- CheckIndex(nIndex);
+ if( getCharacterCount() > 0 )
+ CheckIndex(nIndex);
+ else
+ CheckPosition(nIndex);
SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
ImplGetSvxCharAndParaPropertiesSet() );
diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx b/editeng/source/accessibility/AccessibleParaManager.cxx
index 08d6bf05698f..c9b6479f9101 100644
--- a/editeng/source/accessibility/AccessibleParaManager.cxx
+++ b/editeng/source/accessibility/AccessibleParaManager.cxx
@@ -350,12 +350,15 @@ namespace accessibility
{
DBG_ASSERT( 0 <= nStartPara && 0 <= nEndPara &&
maChildren.size() > static_cast<size_t>(nStartPara) &&
- maChildren.size() >= static_cast<size_t>(nEndPara) ,
- "AccessibleParaManager::FireEvent: invalid index" );
+ maChildren.size() >= static_cast<size_t>(nEndPara) &&
+ nEndPara >= nStartPara, "AccessibleParaManager::FireEvent: invalid index" );
+
+
if( 0 <= nStartPara && 0 <= nEndPara &&
maChildren.size() > static_cast<size_t>(nStartPara) &&
- maChildren.size() >= static_cast<size_t>(nEndPara) )
+ maChildren.size() >= static_cast<size_t>(nEndPara) &&
+ nEndPara >= nStartPara )
{
VectorOfChildren::const_iterator front = maChildren.begin();
VectorOfChildren::const_iterator back = front;
diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index c7a3c9b2f346..890bc5480241 100644
--- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -77,7 +77,7 @@ namespace accessibility
return ( lhs.Name == rhs.Name && lhs.Value == rhs.Value );
}
};
-
+ sal_Unicode cNewLine(0x0a);
//------------------------------------------------------------------------
//
// Static Helper
@@ -114,7 +114,7 @@ namespace accessibility
*/
class AccessibleStaticTextBase_Impl
{
-
+ friend class AccessibleStaticTextBase;
public:
// receive pointer to our frontend class and view window
@@ -188,6 +188,7 @@ namespace accessibility
sal_Int32 nEndPara, sal_Int32 nEndIndex );
Rectangle GetParagraphBoundingBox() const;
+ sal_Bool RemoveLineBreakCount( sal_Int32& rIndex );
private:
@@ -368,8 +369,7 @@ namespace accessibility
{
nCurrCount = GetParagraph( nCurrPara ).getCharacterCount();
nCurrIndex += nCurrCount;
-
- if( nCurrIndex > nFlatIndex )
+ if( nCurrIndex >= nFlatIndex )
{
// check overflow
DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= SAL_MAX_INT32 &&
@@ -459,7 +459,57 @@ namespace accessibility
}
return aRect;
}
+ //the input argument is the index(including "\n" ) in the string.
+ //the function will calculate the actual index(not including "\n") in the string.
+ //and return true if the index is just at a "\n"
+ sal_Bool AccessibleStaticTextBase_Impl::RemoveLineBreakCount( sal_Int32& rIndex )
+ {
+ // get the total char number inside the cell.
+ sal_Int32 i, nCount, nParas;
+ for( i=0, nCount=0, nParas=GetParagraphCount(); i<nParas; ++i )
+ nCount += GetParagraph(i).getCharacterCount();
+ nCount = nCount + (nParas-1);
+ if( nCount == 0 && rIndex == 0) return sal_False;
+
+ sal_Int32 nCurrPara, nCurrCount;
+ sal_Int32 nLineBreakPos = 0, nLineBreakCount = 0;
+ sal_Int32 nParaCount = GetParagraphCount();
+ for ( nCurrCount = 0, nCurrPara = 0; nCurrPara < nParaCount; nCurrPara++ )
+ {
+ nCurrCount += GetParagraph( nCurrPara ).getCharacterCount();
+ nLineBreakPos = nCurrCount++;
+ if ( rIndex == nLineBreakPos )
+ {
+ rIndex -= (++nLineBreakCount);//(++nLineBreakCount);
+ if ( rIndex < 0)
+ {
+ rIndex = 0;
+ }
+ //if the index is at the last position of the last paragraph
+ //there is no "\n" , so we should increase rIndex by 1 and return false.
+ if ( (nCurrPara+1) == nParaCount )
+ {
+ rIndex++;
+ return sal_False;
+ }
+ else
+ {
+ return sal_True;
+ }
+ }
+ else if ( rIndex < nLineBreakPos )
+ {
+ rIndex -= nLineBreakCount;
+ return sal_False;
+ }
+ else
+ {
+ nLineBreakCount++;
+ }
+ }
+ return sal_False;
+ }
//------------------------------------------------------------------------
//
// AccessibleStaticTextBase implementation
@@ -653,6 +703,9 @@ namespace accessibility
{
SolarMutexGuard aGuard;
+ //get the actual index without "\n"
+ mpImpl->RemoveLineBreakCount( nIndex );
+
EPosition aPos( mpImpl->Index2Internal(nIndex) );
return mpImpl->GetParagraph( aPos.nPara ).getCharacterAttributes( aPos.nIndex, aRequestedAttributes );
@@ -683,7 +736,8 @@ namespace accessibility
sal_Int32 i, nCount, nParas;
for( i=0, nCount=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
nCount += mpImpl->GetParagraph(i).getCharacterCount();
-
+ //count on the number of "\n" which equals number of paragraphs decrease 1.
+ nCount = nCount + (nParas-1);
return nCount;
}
@@ -786,37 +840,88 @@ namespace accessibility
if( nStartIndex > nEndIndex )
::std::swap(nStartIndex, nEndIndex);
-
+ //if startindex equals endindex we will get nothing. So return an empty string directly.
+ if ( nStartIndex == nEndIndex )
+ {
+ return OUString();
+ }
+ sal_Bool bStart = mpImpl->RemoveLineBreakCount( nStartIndex );
+ //if the start index is just at a "\n", we need to begin from the next char
+ if ( bStart )
+ {
+ nStartIndex++;
+ }
+ //we need to find out whether the previous position of the current endindex is at "\n" or not
+ //if yes we need to mark it and add "\n" at the end of the result
+ sal_Int32 nTemp = nEndIndex - 1;
+ sal_Bool bEnd = mpImpl->RemoveLineBreakCount( nTemp );
+ sal_Bool bTemp = mpImpl->RemoveLineBreakCount( nEndIndex );
+ //if the below condition is true it indicates an empty paragraph with just a "\n"
+ //so we need to set one "\n" flag to avoid duplication.
+ if ( bStart && bEnd && ( nStartIndex == nEndIndex) )
+ {
+ bEnd = sal_False;
+ }
+ //if the current endindex is at a "\n", we need to increase endindex by 1 to make sure
+ //the char before "\n" is included. Because string returned by this function will not include
+ //the char at the endindex.
+ if ( bTemp )
+ {
+ nEndIndex++;
+ }
+ OUString aRes;
EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) );
EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) );
// #102170# Special case: start and end paragraph are identical
if( aStartIndex.nPara == aEndIndex.nPara )
{
- return mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex );
+ //we don't return the string directly now for that we have to do some further process for "\n"
+ aRes = mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex );
}
else
{
sal_Int32 i( aStartIndex.nPara );
- OUString aRes( mpImpl->GetParagraph(i).getTextRange( aStartIndex.nIndex,
- mpImpl->GetParagraph(i).getCharacterCount()-1) );
+ aRes = mpImpl->GetParagraph(i).getTextRange( aStartIndex.nIndex,
+ mpImpl->GetParagraph(i).getCharacterCount()/*-1*/);
++i;
// paragraphs inbetween are fully included
for( ; i<aEndIndex.nPara; ++i )
+ {
+ aRes += OUString(cNewLine);
aRes += mpImpl->GetParagraph(i).getText();
+ }
if( i<=aEndIndex.nPara )
+ {
+ //if the below condition is mathed it means the endindex is at mid of the last paragraph
+ //we need to add a "\n" before we add the last part of the string.
+ if ( !bEnd && aEndIndex.nIndex )
+ {
+ aRes += OUString(cNewLine);
+ }
aRes += mpImpl->GetParagraph(i).getTextRange( 0, aEndIndex.nIndex );
-
- return aRes;
+ }
}
+ //According the the flag we marked before, we have to add "\n" at the beginning
+ //or at the end of the result string.
+ if ( bStart )
+ {
+ aRes = OUString(cNewLine) + aRes;
+ }
+ if ( bEnd )
+ {
+ aRes += OUString(cNewLine);
+ }
+ return aRes;
}
::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
SolarMutexGuard aGuard;
+ sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex );
EPosition aPos( mpImpl->Range2Internal(nIndex) );
::com::sun::star::accessibility::TextSegment aResult;
@@ -836,6 +941,17 @@ namespace accessibility
aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) );
aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
}
+ else if ( AccessibleTextType::ATTRIBUTE_RUN == aTextType )
+ {
+ SvxAccessibleTextAdapter& rTextForwarder = mpImpl->GetParagraph( aPos.nIndex ).GetTextForwarder();
+ sal_uInt16 nStartIndex, nEndIndex;
+ if ( rTextForwarder.GetAttributeRun( nStartIndex, nEndIndex, aPos.nPara, aPos.nIndex, sal_True ) )
+ {
+ aResult.SegmentText = getTextRange( nStartIndex, nEndIndex );
+ aResult.SegmentStart = nStartIndex;
+ aResult.SegmentEnd = nEndIndex;
+ }
+ }
else
{
// No special handling required, forward to wrapped class
@@ -843,6 +959,10 @@ namespace accessibility
// #112814# Adapt the start index with the paragraph offset
mpImpl->CorrectTextSegment( aResult, aPos.nPara );
+ if ( bLineBreak )
+ {
+ aResult.SegmentText = OUString(cNewLine);
+ }
}
return aResult;
@@ -852,6 +972,8 @@ namespace accessibility
{
SolarMutexGuard aGuard;
+ sal_Int32 nOldIdx = nIndex;
+ sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex );
EPosition aPos( mpImpl->Range2Internal(nIndex) );
::com::sun::star::accessibility::TextSegment aResult;
@@ -883,6 +1005,10 @@ namespace accessibility
// #112814# Adapt the start index with the paragraph offset
mpImpl->CorrectTextSegment( aResult, aPos.nPara );
+ if ( bLineBreak && (nOldIdx-1) >= 0)
+ {
+ aResult = getTextAtIndex( nOldIdx-1, aTextType );
+ }
}
return aResult;
@@ -892,6 +1018,9 @@ namespace accessibility
{
SolarMutexGuard aGuard;
+ sal_Int32 nTemp = nIndex+1;
+ sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nTemp );
+ mpImpl->RemoveLineBreakCount( nIndex );
EPosition aPos( mpImpl->Range2Internal(nIndex) );
::com::sun::star::accessibility::TextSegment aResult;
@@ -917,6 +1046,10 @@ namespace accessibility
// #112814# Adapt the start index with the paragraph offset
mpImpl->CorrectTextSegment( aResult, aPos.nPara );
+ if ( bLineBreak )
+ {
+ aResult.SegmentText = OUString(cNewLine) + aResult.SegmentText;
+ }
}
return aResult;
diff --git a/editeng/source/accessibility/accessibility.src b/editeng/source/accessibility/accessibility.src
index 58e3842bd469..d66829019a9e 100644
--- a/editeng/source/accessibility/accessibility.src
+++ b/editeng/source/accessibility/accessibility.src
@@ -29,4 +29,14 @@ String RID_SVXSTR_A11Y_IMAGEBULLET_NAME
Text [ en-US ] = "Image bullet" ;
};
+String RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION
+{
+ Text [ en-US ] = "Paragraph: $(ARG) " ;
+};
+
+String RID_SVXSTR_A11Y_PARAGRAPH_NAME
+{
+ Text [ en-US ] = "Paragraph $(ARG)" ;
+};
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/editeng/edtspell.cxx b/editeng/source/editeng/edtspell.cxx
index 3ec1a921cf3e..b860af517aef 100644
--- a/editeng/source/editeng/edtspell.cxx
+++ b/editeng/source/editeng/edtspell.cxx
@@ -132,6 +132,7 @@ sal_Bool EditSpellWrapper::SpellMore()
if ( pSpellInfo->bMultipleDoc )
{
bMore = pEE->SpellNextDocument();
+ SetCurTextObj( pEE->GetCurTextObj() );
if ( bMore )
{
// The text has been entered into the engine, when backwords then
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 035eacb9ac15..9eae423aa50a 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -117,7 +117,21 @@ void ImpEditView::SetEditSelection( const EditSelection& rEditSelection )
if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() )
{
- EENotify aNotify( EE_NOTIFY_TEXTVIEWSELECTIONCHANGED );
+ const EditDoc& rDoc = pEditEngine->GetEditDoc();
+ const EditPaM pmEnd = rDoc.GetEndPaM();
+ EENotifyType eNotifyType;
+ if (rDoc.Count() > 1 &&
+ pmEnd == rEditSelection.Min() &&
+ pmEnd == rEditSelection.Max())//if move cursor to the last para.
+ {
+ eNotifyType = EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA;
+ }
+ else
+ {
+ eNotifyType = EE_NOTIFY_TEXTVIEWSELECTIONCHANGED;
+ }
+ //EENotify aNotify( EE_NOTIFY_TEXTVIEWSELECTIONCHANGED );
+ EENotify aNotify( eNotifyType );
aNotify.pEditEngine = pEditEngine;
aNotify.pEditView = GetEditViewPtr();
pEditEngine->pImpEditEngine->CallNotify( aNotify );
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 31b72db317df..d86e21f3e186 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -485,6 +485,7 @@ private:
bool bInSelection:1;
bool bIsInUndo:1;
bool bUpdate:1;
+ bool bUpdateForAcc:1;
bool bUndoEnabled:1;
bool bOwnerOfRefDev:1;
bool bDowning:1;
@@ -689,6 +690,9 @@ public:
void SetUpdateMode( bool bUp, EditView* pCurView = 0, sal_Bool bForceUpdate = sal_False );
bool GetUpdateMode() const { return bUpdate; }
+ void SetUpdateModeForAcc(bool bUp);
+ bool GetUpdateModeForAcc() const { return bUpdateForAcc; }
+
ViewsType& GetEditViews() { return aEditViews; }
const ViewsType& GetEditViews() const { return aEditViews; }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 1c094c35fe31..d1c879c49861 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -91,6 +91,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) :
bInSelection(false),
bIsInUndo(false),
bUpdate(true),
+ bUpdateForAcc(true),
bUndoEnabled(true),
bOwnerOfRefDev(false),
bDowning(false),
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 57a05aaf3901..99b851d0fb32 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -357,7 +357,7 @@ void ImpEditEngine::FormatFullDoc()
void ImpEditEngine::FormatDoc()
{
- if ( !GetUpdateMode() || IsFormatting() )
+ if (!GetUpdateMode() || IsFormatting() || !GetUpdateModeForAcc())
return;
EnterBlockNotifications();
@@ -3849,6 +3849,11 @@ void ImpEditEngine::InsertContent( ContentNode* pNode, sal_Int32 nPos )
GetEditEnginePtr()->ParagraphInserted( nPos );
}
+void ImpEditEngine::SetUpdateModeForAcc(bool bUp)
+{
+ bUpdateForAcc = bUp;
+}
+
EditPaM ImpEditEngine::SplitContent( sal_Int32 nNode, sal_uInt16 nSepPos )
{
ContentNode* pNode = aEditDoc.GetObject( nNode );
diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx
index 9256b1c7ea12..c7a386017ba0 100644
--- a/editeng/source/misc/splwrap.cxx
+++ b/editeng/source/misc/splwrap.cxx
@@ -152,6 +152,7 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn,
pWin ( pWn ),
xSpell ( xSpellChecker ),
+ mpTextObj( NULL),
bOtherCntnt ( bOther ),
bDialog ( sal_False ),
bHyphen ( sal_False ),
@@ -174,6 +175,7 @@ SvxSpellWrapper::SvxSpellWrapper( Window* pWn,
const sal_Bool bStart, const sal_Bool bOther ) :
pWin ( pWn ),
xHyph ( xHyphenator ),
+ mpTextObj( NULL),
bOtherCntnt ( bOther ),
bDialog ( sal_False ),
bHyphen ( sal_False ),
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index a8e3d660ef04..0d3e5ac5e737 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1477,6 +1477,13 @@ sal_Bool Outliner::HasChildren( Paragraph* pParagraph ) const
bool Outliner::ImplHasNumberFormat( sal_Int32 nPara ) const
{
return GetNumberFormat(nPara) != 0;
+ if ( GetNumberFormat(nPara) )
+ {
+ const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE );
+ return rBulletState.GetValue();
+ }
+ else
+ return sal_False;
}
const SvxNumberFormat* Outliner::GetNumberFormat( sal_Int32 nPara ) const
diff --git a/editeng/source/uno/unoedhlp.cxx b/editeng/source/uno/unoedhlp.cxx
index 93217f0b37ba..82a2b0d79acf 100644
--- a/editeng/source/uno/unoedhlp.cxx
+++ b/editeng/source/uno/unoedhlp.cxx
@@ -20,6 +20,7 @@
#include <editeng/unoedhlp.hxx>
#include <editeng/editdata.hxx>
#include <editeng/editeng.hxx>
+#include <svl/itemset.hxx>
//------------------------------------------------------------------------
@@ -53,7 +54,7 @@ sal_Int32 SvxEditSourceHint::GetEndValue() const
{
return mnEnd;
}
-
+TYPEINIT1( SvxEditSourceHintEndPara , SvxEditSourceHint );
//------------------------------------------------------------------------
SAL_WNODEPRECATED_DECLARATIONS_PUSH
@@ -95,7 +96,8 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
case EE_NOTIFY_INPUT_END:
return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) );
-
+ case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA:
+ return ::std::auto_ptr<SfxHint>( new SvxEditSourceHintEndPara( EDITSOURCE_HINT_SELECTIONCHANGED ) );
default:
OSL_FAIL( "SvxEditSourceHelper::EENotification2Hint unknown notification" );
break;
@@ -106,8 +108,165 @@ SAL_WNODEPRECATED_DECLARATIONS_PUSH
}
SAL_WNODEPRECATED_DECLARATIONS_POP
-sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_uInt16 nIndex )
+sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool /*bInCell*/ )
{
+ // IA2 CWS introduced bInCell, but also did many other changes here.
+ // Need to verify implementation with AT (IA2 and ATK)
+ // Old implementation at the end of the method for reference...
+
+#if 0 // IA2 CWS
+
+ //added dummy attributes for the default text
+ EECharAttribArray aCharAttribs, aTempCharAttribs;
+ rEE.GetCharAttribs( nPara, aTempCharAttribs );
+ if ( aTempCharAttribs.Count() )
+ {
+ sal_uInt32 nIndex2 = 0;
+ sal_uInt32 nParaLen = rEE.GetTextLen(nPara);
+ for ( sal_uInt16 nAttr = 0; nAttr < aTempCharAttribs.Count(); nAttr++ )
+ {
+ if ( nIndex2 < aTempCharAttribs[nAttr].nStart )
+ {
+ EECharAttrib aEEAttr;
+ aEEAttr.nStart = sal_uInt16(nIndex2);
+ aEEAttr.nEnd = aTempCharAttribs[nAttr].nStart;
+ aCharAttribs.Insert( aEEAttr, nAttr );
+ }
+ nIndex2 = aTempCharAttribs[nAttr].nEnd;
+ aCharAttribs.Insert( aTempCharAttribs[nAttr], aCharAttribs.Count() );
+ }
+ if ( nIndex2 != nParaLen )
+ {
+ EECharAttrib aEEAttr;
+ aEEAttr.nStart = sal_uInt16(nIndex2);
+ aEEAttr.nEnd = sal_uInt16(nParaLen);
+ aCharAttribs.Insert( aEEAttr, aCharAttribs.Count() );
+ }
+ }
+ // find closest index in front of nIndex
+ sal_uInt16 nAttr, nCurrIndex;
+ sal_Int32 nClosestStartIndex;
+ sal_Int32 nClosestStartIndex_s, nClosestStartIndex_e;
+ for( nAttr=0, nClosestStartIndex_s=0, nClosestStartIndex_e=0; nAttr<aCharAttribs.Count(); ++nAttr )
+ {
+ nCurrIndex = aCharAttribs[nAttr].nStart;
+
+ //if( nCurrIndex > nIndex )
+ // break; // aCharAttribs array is sorted in increasing order for nStart values
+
+ if( nCurrIndex > nClosestStartIndex_s &&
+ nCurrIndex <= nIndex)
+ {
+ nClosestStartIndex_s = nCurrIndex;
+ }
+ nCurrIndex = aCharAttribs[nAttr].nEnd;
+ if ( nCurrIndex > nClosestStartIndex_e &&
+ nCurrIndex < nIndex )
+ {
+ nClosestStartIndex_e = nCurrIndex;
+ }
+ }
+ nClosestStartIndex = nClosestStartIndex_s > nClosestStartIndex_e ? nClosestStartIndex_s : nClosestStartIndex_e;
+
+ // find closest index behind of nIndex
+ sal_Int32 nClosestEndIndex;
+ sal_Int32 nClosestEndIndex_s, nClosestEndIndex_e;
+ for( nAttr=0, nClosestEndIndex_s=nClosestEndIndex_e=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
+ {
+ nCurrIndex = aCharAttribs[nAttr].nEnd;
+
+ if( nCurrIndex > nIndex &&
+ nCurrIndex < nClosestEndIndex_e )
+ {
+ nClosestEndIndex_e = nCurrIndex;
+ }
+ nCurrIndex = aCharAttribs[nAttr].nStart;
+ if ( nCurrIndex > nIndex &&
+ nCurrIndex < nClosestEndIndex_s)
+ {
+ nClosestEndIndex_s = nCurrIndex;
+ }
+ }
+ nClosestEndIndex = nClosestEndIndex_s < nClosestEndIndex_e ? nClosestEndIndex_s : nClosestEndIndex_e;
+
+ nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
+ nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
+ if ( bInCell )
+ {
+ EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex );
+ sal_uInt32 nParaCount = rEE.GetParagraphCount();
+ sal_uInt32 nCrrntParaLen = rEE.GetTextLen(nPara);
+ //need to find closest index in front of nIndex in the previous paragraphs
+ if ( aStartPos.nIndex == 0 )
+ {
+ SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS );
+ for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- )
+ {
+ sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) );
+ if ( nLen )
+ {
+ sal_uInt16 nStartIdx, nEndIdx;
+ GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), sal_uInt16(nLen), sal_False );
+ SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), sal_uInt16(nLen-1), sal_uInt16(nLen), GETATTRIBS_CHARATTRIBS );
+ if ( aSet == aCrrntSet )
+ {
+ aStartPos.nPara = sal_uInt16(nParaIdx);
+ aStartPos.nIndex = nStartIdx;
+ if ( aStartPos.nIndex != 0 )
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ //need find closest index behind nIndex in the following paragrphs
+ if ( aEndPos.nIndex == nCrrntParaLen )
+ {
+ SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, sal_uInt16(nCrrntParaLen-1), sal_uInt16(nCrrntParaLen), GETATTRIBS_CHARATTRIBS );
+ for ( sal_uInt32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ )
+ {
+ sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) );
+ if ( nLen )
+ {
+ sal_uInt16 nStartIdx, nEndIdx;
+ GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), 0, sal_False );
+ SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), 0, 1, GETATTRIBS_CHARATTRIBS );
+ if ( aSet == aCrrntSet )
+ {
+ aEndPos.nPara = sal_uInt16(nParaIdx);
+ aEndPos.nIndex = nEndIdx;
+ if ( aEndPos.nIndex != nLen )
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ nStartIndex = 0;
+ if ( aStartPos.nPara > 0 )
+ {
+ for ( sal_uInt16 i = 0; i < aStartPos.nPara; i++ )
+ {
+ nStartIndex += rEE.GetTextLen(i)+1;
+ }
+ }
+ nStartIndex += aStartPos.nIndex;
+ nEndIndex = 0;
+ if ( aEndPos.nPara > 0 )
+ {
+ for ( sal_uInt16 i = 0; i < aEndPos.nPara; i++ )
+ {
+ nEndIndex += rEE.GetTextLen(i)+1;
+ }
+ }
+ nEndIndex += aEndPos.nIndex;
+ }
+
+ return sal_True;
+
+#else // old implementation
std::vector<EECharAttrib> aCharAttribs;
rEE.GetCharAttribs( nPara, aCharAttribs );
@@ -141,6 +300,8 @@ sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt
nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
return sal_True;
+
+#endif
}
Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical )
diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx
index 735ca946f704..109e91fcc1d6 100644
--- a/editeng/source/uno/unoedprx.cxx
+++ b/editeng/source/uno/unoedprx.cxx
@@ -495,21 +495,6 @@ OUString SvxAccessibleTextAdapter::GetText( const ESelection& rSel ) const
EBulletInfo aBulletInfo1 = GetBulletInfo( aStartIndex.GetParagraph() );
EBulletInfo aBulletInfo2 = GetBulletInfo( aEndIndex.GetParagraph() );
- if( aStartIndex.InBullet() )
- {
- // prepend leading bullet
- OUString sBullet = aBulletInfo1.aText;
-
- DBG_ASSERT(aStartIndex.GetBulletOffset() >= 0 &&
- aStartIndex.GetBulletOffset() <= USHRT_MAX,
- "SvxAccessibleTextIndex::GetText: index value overflow");
-
- sBullet = sBullet.copy( aStartIndex.GetBulletOffset() );
-
- sBullet += sStr;
- sStr = sBullet;
- }
-
if( aEndIndex.InBullet() )
{
// append trailing bullet
@@ -729,6 +714,16 @@ EBulletInfo SvxAccessibleTextAdapter::GetBulletInfo( sal_Int32 nPara ) const
return mrTextForwarder->GetBulletInfo( nPara );
}
+void SvxAccessibleTextAdapter::SetUpdateModeForAcc(sal_Bool bUp)
+{
+ return mrTextForwarder->SetUpdateModeForAcc(bUp);
+}
+
+sal_Bool SvxAccessibleTextAdapter::GetUpdateModeForAcc( ) const
+{
+ return mrTextForwarder->GetUpdateModeForAcc();
+}
+
Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_Int32 nPara, sal_uInt16 nIndex ) const
{
DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
@@ -954,7 +949,7 @@ sal_Bool SvxAccessibleTextAdapter::GetWordIndices( sal_Int32 nPara, sal_uInt16 n
return sal_True;
}
-sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex ) const
+sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool /* bInCell */ ) const
{
DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
diff --git a/editeng/source/uno/unofored.cxx b/editeng/source/uno/unofored.cxx
index 656f144218ea..f073beec20ba 100644
--- a/editeng/source/uno/unofored.cxx
+++ b/editeng/source/uno/unofored.cxx
@@ -406,9 +406,9 @@ sal_Bool SvxEditEngineForwarder::GetWordIndices( sal_Int32 nPara, sal_uInt16 nIn
return sal_False;
}
-sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex ) const
+sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const
{
- return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex );
+ return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex, bInCell );
}
sal_uInt16 SvxEditEngineForwarder::GetLineCount( sal_Int32 nPara ) const
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index 8a98d64aaa45..330068871280 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -403,9 +403,9 @@ sal_Bool SvxOutlinerForwarder::GetWordIndices( sal_Int32 nPara, sal_uInt16 nInde
return sal_False;
}
-sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex ) const
+sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_Int32 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const
{
- return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex );
+ return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex, bInCell );
}
sal_uInt16 SvxOutlinerForwarder::GetLineCount( sal_Int32 nPara ) const
diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx
index 578539e38aea..7e12f9737a6b 100644
--- a/editeng/source/uno/unonrule.cxx
+++ b/editeng/source/uno/unonrule.cxx
@@ -207,6 +207,7 @@ Sequence<beans::PropertyValue> SvxUnoNumberingRules::getNumberingRuleByIndex( sa
pArray[nIdx++] = aSuffixProp;
}
+ if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
{
sal_Unicode nCode = rFmt.GetBulletChar();
OUString aStr( &nCode, 1 );
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index f9b09dd1d544..8a63ef7e3e5c 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -2571,7 +2571,7 @@ sal_Bool SvxDummyTextSource::GetWordIndices( sal_Int32, sal_uInt16, sal_uInt16&,
return sal_False;
}
-sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_Int32, sal_uInt16 ) const
+sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_Int32, sal_uInt16, sal_Bool ) const
{
return sal_False;
}