summaryrefslogtreecommitdiff
path: root/editeng/source/uno
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/source/uno
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/source/uno')
-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
6 files changed, 181 insertions, 24 deletions
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;
}