diff options
author | Steve Yin <steve_y@apache.org> | 2013-11-14 08:18:05 +0000 |
---|---|---|
committer | Steve Yin <steve_y@apache.org> | 2013-11-14 08:18:05 +0000 |
commit | a5c4ddcf8ed5344d9bceeffd7431cd6895a407ca (patch) | |
tree | 7e830be2c7fae1c81a868f196aa940696efeeb37 /sc | |
parent | a2afc19e04f8bb3089cbfef34960ad8f0a3b99bf (diff) |
Integrate branch of IAccessible2
Notes
Notes:
merged as: c2405f80af8b61fa9b9088420afdb79584adf7c0
Diffstat (limited to 'sc')
65 files changed, 3916 insertions, 196 deletions
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx index bba7f97519eb..5b03676fd2fa 100644 --- a/sc/inc/chgtrack.hxx +++ b/sc/inc/chgtrack.hxx @@ -44,8 +44,25 @@ #endif #define DEBUG_CHANGETRACK 0 +//IAccessibility2 Implementation 2009----- +class ScChangeAction; +class ScAppOptions; +class ScActionColorChanger +{ +private: + const ScAppOptions& rOpt; + const ScStrCollection& rUsers; + String aLastUserName; + sal_uInt16 nLastUserIndex; + ColorData nColor; - +public: + ScActionColorChanger( const ScChangeTrack& rTrack ); + ~ScActionColorChanger() {} + void Update( const ScChangeAction& rAction ); + ColorData GetColor() const { return nColor; } +}; +//-----IAccessibility2 Implementation 2009 class ScBaseCell; class ScDocument; diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx index b0d3df16952d..f3c2b4bc1260 100644 --- a/sc/inc/detfunc.hxx +++ b/sc/inc/detfunc.hxx @@ -155,6 +155,9 @@ public: static ColorData GetCommentColor(); static void InitializeColors(); static sal_Bool IsColorsInitialized(); +//IAccessibility2 Implementation 2009----- + static void AppendChangTrackNoteSeparator(String &str); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index be2a41748556..02f1fa6141dd 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -440,7 +440,23 @@ private: sal_Int16 mnNamedRangesLockCount; +//IAccessibility2 Implementation 2009----- + String msDocAccTitle; public: + // SC_DLLPUBLIC sal_Bool RowHidden( SCROW nRow, SCTAB nTab ); + //inline sal_Bool RowHidden( SCROW nRow, SCTAB nTab ); // FillInfo + virtual void setDocAccTitle( const String& rTitle ) { msDocAccTitle = rTitle; } + virtual const String getDocAccTitle() const { return msDocAccTitle; } + +private: + sal_Bool bReadOnly; // MT: Really needed??? + +public: + virtual void setDocReadOnly( sal_Bool b){ bReadOnly = b; } + virtual sal_Bool getDocReadOnly() const { return bReadOnly; } + sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder); + void GetCellChangeTrackNote( const ScAddress &cell,String &strTrackText,sal_Bool &pbLeftEdge); +//-----IAccessibility2 Implementation 2009 SC_DLLPUBLIC sal_uLong GetCellCount() const; // alle Zellen SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const; sal_uLong GetWeightedCount() const; // Formeln und Edit staerker gewichtet @@ -466,6 +482,9 @@ public: SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL ); XColorListSharedPtr GetColorTable(); +//IAccessibility2 Implementation 2009----- + ScTable* GetTableByIndex(sal_Int32 nIndex); +//-----IAccessibility2 Implementation 2009 SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager() const; SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const; diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx index b9b85aa56385..315c734846fd 100644 --- a/sc/inc/dptablecache.hxx +++ b/sc/inc/dptablecache.hxx @@ -22,14 +22,11 @@ #ifndef DPTABLECACHE_HXX #define DPTABLECACHE_HXX -// Wang Xu Ming -- 12/21/2008 // Add Data Cache Support. #ifndef SC_SCGLOB_HXX #include "global.hxx" #endif -//Added by PengYunQuan for SODC_16015 #include <svl/zforlist.hxx> -//end #include <vector> #include "dpglobal.hxx" diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx index 7bfe56b12a7b..aab405196a91 100644 --- a/sc/inc/drwlayer.hxx +++ b/sc/inc/drwlayer.hxx @@ -230,6 +230,10 @@ public: const Point& rWinPoint, const Window& rCmpWnd ); static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = sal_False ); +//IAccessibility2 Implementation 2009----- + virtual ImageMap* GetImageMapForObject(SdrObject* pObj); + virtual sal_Int32 GetHyperlinkCount(SdrObject* pObj); +//-----IAccessibility2 Implementation 2009 private: static SfxObjectShell* pGlobalDrawPersist; // fuer AllocModel diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index ade9b38cc1db..d7553513bc7b 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -937,6 +937,11 @@ private: SCROW mnCurRow; SCROW mnUBound; }; + +//IAccessibility2 Implementation 2009----- +public : + ScColumn* GetColumnByIndex(sal_Int32 index); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 85c9ca658746..bcc0a9dea205 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -87,6 +87,11 @@ #include "recursionhelper.hxx" #include "lookupcache.hxx" #include "externalrefmgr.hxx" +//IAccessibility2 Implementation 2009----- +#include "appoptio.hxx" +#include "scmod.hxx" +#include "../../ui/inc/viewutil.hxx" +//-----IAccessibility2 Implementation 2009 #include "tabprotection.hxx" #include "formulaparserpool.hxx" #include "clipparam.hxx" @@ -211,6 +216,9 @@ ScDocument::ScDocument( ScDocumentMode eMode, eGrammar( formula::FormulaGrammar::GRAM_NATIVE ), bStyleSheetUsageInvalid( sal_True ), mbUndoEnabled( true ), +//IAccessibility2 Implementation 2009----- + bReadOnly(sal_False), +//-----IAccessibility2 Implementation 2009 mbAdjustHeightEnabled( true ), mbExecuteLinkEnabled( true ), mbChangeReadOnlyEnabled( false ), @@ -1295,3 +1303,158 @@ void ScDocument::ClearLookupCaches() if( pLookupCacheMapImpl ) pLookupCacheMapImpl->clear(); } +//IAccessibility2 Implementation 2009----- +sal_Bool ScDocument::IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder) +{ + ScChangeTrack* pTrack = GetChangeTrack(); + ScChangeViewSettings* pSettings = GetChangeViewSettings(); + if ( !pTrack || !pTrack->GetFirst() || !pSettings || !pSettings->ShowChanges() ) + return sal_False; // nix da oder abgeschaltet + ScActionColorChanger aColorChanger(*pTrack); + // Clipping passiert von aussen + //! ohne Clipping, nur betroffene Zeilen painten ??!??!? + const ScChangeAction* pAction = pTrack->GetFirst(); + while (pAction) + { + ScChangeActionType eType; + if ( pAction->IsVisible() ) + { + eType = pAction->GetType(); + const ScBigRange& rBig = pAction->GetBigRange(); + if ( rBig.aStart.Tab() == cell.Tab()) + { + ScRange aRange = rBig.MakeRange(); + if ( eType == SC_CAT_DELETE_ROWS ) + aRange.aEnd.SetRow( aRange.aStart.Row() ); + else if ( eType == SC_CAT_DELETE_COLS ) + aRange.aEnd.SetCol( aRange.aStart.Col() ); + if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) ) + { + if (aRange.In(cell)) + { + if (pColCellBoder != NULL) + { + aColorChanger.Update( *pAction ); + Color aColor( aColorChanger.GetColor() ); + *pColCellBoder = aColor; + } + return sal_True; + } + } + } + if ( eType == SC_CAT_MOVE && + ((const ScChangeActionMove*)pAction)-> + GetFromRange().aStart.Tab() == cell.Col() ) + { + ScRange aRange = ((const ScChangeActionMove*)pAction)-> + GetFromRange().MakeRange(); + if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) ) + { + if (aRange.In(cell)) + { + if (pColCellBoder != NULL) + { + aColorChanger.Update( *pAction ); + Color aColor( aColorChanger.GetColor() ); + *pColCellBoder = aColor; + } + return sal_True; + } + } + } + } + pAction = pAction->GetNext(); + } + return sal_False; +} +void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos,String &aTrackText,sal_Bool &bLeftEdge) +{ + aTrackText=String(); + // Change-Tracking + ScChangeTrack* pTrack = GetChangeTrack(); + ScChangeViewSettings* pSettings = GetChangeViewSettings(); + if ( pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges()) + { + const ScChangeAction* pFound = NULL; + const ScChangeAction* pFoundContent = NULL; + const ScChangeAction* pFoundMove = NULL; + long nModified = 0; + const ScChangeAction* pAction = pTrack->GetFirst(); + while (pAction) + { + if ( pAction->IsVisible() && + ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) ) + { + ScChangeActionType eType = pAction->GetType(); + const ScBigRange& rBig = pAction->GetBigRange(); + if ( rBig.aStart.Tab() == aCellPos.Tab()) + { + ScRange aRange = rBig.MakeRange(); + if ( eType == SC_CAT_DELETE_ROWS ) + aRange.aEnd.SetRow( aRange.aStart.Row() ); + else if ( eType == SC_CAT_DELETE_COLS ) + aRange.aEnd.SetCol( aRange.aStart.Col() ); + if ( aRange.In( aCellPos ) ) + { + pFound = pAction; // der letzte gewinnt + switch ( eType ) + { + case SC_CAT_CONTENT : + pFoundContent = pAction; + break; + case SC_CAT_MOVE : + pFoundMove = pAction; + break; + default: + break; + } + ++nModified; + } + } + if ( eType == SC_CAT_MOVE ) + { + ScRange aRange = + ((const ScChangeActionMove*)pAction)-> + GetFromRange().MakeRange(); + if ( aRange.In( aCellPos ) ) + { + pFound = pAction; + ++nModified; + } + } + } + pAction = pAction->GetNext(); + } + if ( pFound ) + { + if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT ) + pFound = pFoundContent; // Content gewinnt + if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE && + pFoundMove->GetActionNumber() > + pFound->GetActionNumber() ) + pFound = pFoundMove; // Move gewinnt + // bei geloeschten Spalten: Pfeil auf die linke Seite der Zelle + if ( pFound->GetType() == SC_CAT_DELETE_COLS ) + bLeftEdge = sal_True; + DateTime aDT = pFound->GetDateTime(); + aTrackText = pFound->GetUser(); + aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " )); + aTrackText += ScGlobal::pLocaleData->getDate(aDT); + aTrackText += ' '; + aTrackText += ScGlobal::pLocaleData->getTime(aDT); + aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n" )); + String aComStr=pFound->GetComment(); + if(aComStr.Len()>0) + { + aTrackText += aComStr; + aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n( " )); + } + pFound->GetDescription( aTrackText, this ); + if(aComStr.Len()>0) + { + aTrackText +=')'; + } + } + } +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 915dbf8620d6..1bff8fe38963 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -200,6 +200,15 @@ sal_Bool ScDocument::GetTable( const String& rName, SCTAB& rTab ) const return sal_False; } +//IAccessibility2 Implementation 2009----- +ScTable* ScDocument::GetTableByIndex(sal_Int32 nIndex) +{ + if ( nIndex <= MAXTAB && nIndex >= 0) + return pTab[nIndex]; + + return NULL; +} +//-----IAccessibility2 Implementation 2009 sal_Bool ScDocument::ValidTabName( const String& rName ) const { diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index c7315fbbddc2..0f444dafdafc 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -1506,7 +1506,6 @@ void ScDPSaveDimension::Refresh( const com::sun::star::uno::Reference< }; //remove unused members - //SODC_19124 for (MemberList::iterator i=maMemberList.begin(); i != maMemberList.end() ; ) { rtl::OUString aMemberName = (*i)->GetName(); diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index e2d3ea340e03..a1b07ca2fd91 100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -196,8 +196,8 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, sal_uInt16 nCol, sal_u if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() ) { - SetString ( aDocStr ); //[SODC_19347] add liyi - //bErr = sal_True; //[SODC_19347] del liyi + SetString ( aDocStr ); + //bErr = sal_True; mbFlag |= MK_ERR; } else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) ) @@ -293,8 +293,7 @@ sal_Int32 ScDPItemData::Compare( const ScDPItemData& rA, else return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString ); } -// -//Wang Xu Ming SODC_17561 + #ifdef DEBUG void ScDPItemData::dump() const { @@ -304,7 +303,6 @@ void ScDPItemData::dump() const DBG_TRACE1( "mbFlag= %d", mbFlag); } #endif -//End TypedStrData* ScDPItemData::CreateTypeString( ) { @@ -740,9 +738,8 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, sal if ( bMatchWholeCell ) { bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr ); - //Added by zhaosz,for sodc_2702,20060808 + String aStr = *rEntry.pStr;//"f*" - //modified by weihuaw,for SODC_16698 //use another way to find "*" in aStr sal_Bool bHasStar = sal_False; xub_StrLen nIndex; @@ -1044,7 +1041,7 @@ const ScDPItemData* ScDPTableDataCache::GetSortedItemData(SCCOL nDim, SCROW nOrd SCCOL ScDPTableDataCache::GetDimensionIndex(String sName) const { - for ( size_t n = 1; n < mrLabelNames.size(); n ++ ) //defects, label name map wrong SODC_17590, SODC_18932,SODC_18827,SODC_18960,SODC_18923 + for ( size_t n = 1; n < mrLabelNames.size(); n ++ ) //defects, label name map wrong { if ( mrLabelNames[n]->GetString() == sName ) return (SCCOL)(n-1); diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 4bd47f9608f2..9948ff11ea27 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -2027,7 +2027,27 @@ ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, sal_Bool bCreate ) } return 0; } +//IAccessibility2 Implementation 2009----- +ImageMap* ScDrawLayer::GetImageMapForObject(SdrObject* pObj) +{ + ScIMapInfo* pIMapInfo = const_cast<ScIMapInfo*>( GetIMapInfo( pObj ) ); + if ( pIMapInfo ) + { + return const_cast<ImageMap*>( &(pIMapInfo->GetImageMap()) ); + } + return NULL; +} +sal_Int32 ScDrawLayer::GetHyperlinkCount(SdrObject* pObj) +{ + sal_Int32 nHLCount = 0; + ScMacroInfo* pMacroInfo = GetMacroInfo(pObj, sal_False); + if (pMacroInfo) + // MT IA2: GetHlink*( doesn|t exist in DEV300 anymore... + nHLCount = 0; // pMacroInfo->GetHlink().getLength() > 0 ? 1 : 0; + return nHLCount; +} +//-----IAccessibility2 Implementation 2009 void ScDrawLayer::SetGlobalDrawPersist(SfxObjectShell* pPersist) // static { DBG_ASSERT(!pGlobalDrawPersist,"SetGlobalDrawPersist mehrfach"); diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 5ed85d319396..afd98fe63090 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -3308,3 +3308,14 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol ) const return n; } +//IAccessibility2 Implementation 2009----- +ScColumn* ScTable::GetColumnByIndex(sal_Int32 index) +{ + if( index <= MAXCOL && index >= 0 ) + { + return &(aCol[index]); + } + return NULL; +} +//-----IAccessibility2 Implementation 2009 + diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index d62612e2bf01..b634f46983b3 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -1706,3 +1706,10 @@ sal_Bool ScDetectiveFunc::IsColorsInitialized() return bColorsInitialized; } +//IAccessibility2 Implementation 2009----- +void ScDetectiveFunc::AppendChangTrackNoteSeparator(String &aDisplay) +{ + aDisplay.AppendAscii( RTL_CONSTASCII_STRINGPARAM("\n--------\n") ); +} +//-----IAccessibility2 Implementation 2009 + diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index 2d50fd18c1e2..04b0c3602b61 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -40,7 +40,9 @@ #include "editsrc.hxx" #include "dociter.hxx" #include "cell.hxx" - +//IAccessibility2 Implementation 2009----- +#include "validat.hxx" +//-----IAccessibility2 Implementation 2009 #ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX #include <unotools/accessiblestatesethelper.hxx> #endif @@ -58,6 +60,9 @@ #include <comphelper/sequence.hxx> #include <float.h> +//IAccessibility2 Implementation 2009----- +#include "AccessibleSpreadsheet.hxx" +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -117,11 +122,11 @@ void SAL_CALL ScAccessibleCell::disposing() //===== XInterface ===================================================== -IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase ) +IMPLEMENT_FORWARD_XINTERFACE3( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase, ScAccessibleCellAttributeImpl ) //===== XTypeProvider =================================================== -IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase ) +IMPLEMENT_FORWARD_XTYPEPROVIDER3( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase, ScAccessibleCellAttributeImpl ) //===== XAccessibleComponent ============================================ @@ -240,6 +245,25 @@ uno::Reference<XAccessibleStateSet> SAL_CALL pStateSet->AddState(AccessibleStateType::DEFUNC); else { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + pStateSet->AddState(AccessibleStateType::ENABLED); + pStateSet->AddState(AccessibleStateType::MULTI_LINE); + pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE); + if (IsOpaque(xParentStates)) + pStateSet->AddState(AccessibleStateType::OPAQUE); + pStateSet->AddState(AccessibleStateType::SELECTABLE); + if (IsSelected()) + pStateSet->AddState(AccessibleStateType::SELECTED); + if (isShowing()) + pStateSet->AddState(AccessibleStateType::SHOWING); + pStateSet->AddState(AccessibleStateType::TRANSIENT); + if (isVisible()) + pStateSet->AddState(AccessibleStateType::VISIBLE); + return pStateSet; + } +//-----IAccessibility2 Implementation 2009 if (IsEditable(xParentStates)) { pStateSet->AddState(AccessibleStateType::EDITABLE); @@ -248,6 +272,9 @@ uno::Reference<XAccessibleStateSet> SAL_CALL pStateSet->AddState(AccessibleStateType::ENABLED); pStateSet->AddState(AccessibleStateType::MULTI_LINE); pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE); +//IAccessibility2 Implementation 2009----- + pStateSet->AddState(AccessibleStateType::FOCUSABLE); +//-----IAccessibility2 Implementation 2009 if (IsOpaque(xParentStates)) pStateSet->AddState(AccessibleStateType::OPAQUE); pStateSet->AddState(AccessibleStateType::SELECTABLE); @@ -344,6 +371,17 @@ sal_Bool ScAccessibleCell::IsOpaque( sal_Bool ScAccessibleCell::IsSelected() { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + const ScAccessibleSpreadsheet *pSheet =static_cast<const ScAccessibleSpreadsheet*>(mxParent.get()); + if (pSheet) + { + return pSheet->IsScAddrFormulaSel(maCellAddress); + } + return sal_False; + } +//-----IAccessibility2 Implementation 2009 sal_Bool bResult(sal_False); if (mpViewShell && mpViewShell->GetViewData()) { @@ -363,6 +401,12 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell) ::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos) { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return ::std::auto_ptr< SvxEditSource >(); + } +//-----IAccessibility2 Implementation 2009 ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) ); ::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData)); @@ -453,3 +497,146 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange, pRelationSet->AddRelation(aRelation); } } +//IAccessibility2 Implementation 2009----- +::rtl::OUString ReplaceOneChar(::rtl::OUString oldOUString, ::rtl::OUString replacedChar, ::rtl::OUString replaceStr) +{ + int iReplace = -1; + iReplace = oldOUString.lastIndexOf(replacedChar); + if (iReplace > -1) + { + for(;iReplace>-1;) + { + oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr); + iReplace=oldOUString.lastIndexOf(replacedChar,iReplace); + } + } + return oldOUString; +} +::rtl::OUString ReplaceFourChar(::rtl::OUString oldOUString) +{ + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("\\"),::rtl::OUString::createFromAscii("\\\\")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(";"),::rtl::OUString::createFromAscii("\\;")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("="),::rtl::OUString::createFromAscii("\\=")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(","),::rtl::OUString::createFromAscii("\\,")); + oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(":"),::rtl::OUString::createFromAscii("\\:")); + return oldOUString; +} + +uno::Any SAL_CALL ScAccessibleCell::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + uno::Any strRet; + if (mpViewShell) + { + const ::rtl::OUString strAttr(::rtl::OUString::createFromAscii(":")); + const ::rtl::OUString strSplit(::rtl::OUString::createFromAscii(";")); + ::rtl::OUString strFor = mpViewShell->GetFormula(maCellAddress) ; + strFor = strFor.replaceAt(0,1,::rtl::OUString::createFromAscii("")); + strFor = ReplaceFourChar(strFor); + strFor =::rtl::OUString::createFromAscii("Formula:") + strFor; + strFor +=strSplit; + strFor +=::rtl::OUString::createFromAscii("Note:"); + strFor +=ReplaceFourChar(GetAllDisplayNote()); + strFor +=strSplit; + strFor += getShadowAttrs();//the string returned contains the spliter ";" + strFor += getBorderAttrs();//the string returned contains the spliter ";" + //end of cell attributes + if( mpDoc ) + { + strFor += ::rtl::OUString::createFromAscii("isdropdown:"); + if( IsDropdown() ) + strFor+= ::rtl::OUString::createFromAscii("true"); + else + strFor+= ::rtl::OUString::createFromAscii("false"); + strFor += ::rtl::OUString::createFromAscii(";"); + } + strRet <<= strFor ; + } + return strRet; +} + +// cell has its own ParaIndent property, so when calling character attributes on cell, the ParaIndent should replace the ParaLeftMargin if its value is not zero. +uno::Sequence< beans::PropertyValue > SAL_CALL ScAccessibleCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + uno::Sequence< beans::PropertyValue > aAttribs = AccessibleStaticTextBase::getCharacterAttributes( nIndex, aRequestedAttributes ); + beans::PropertyValue *pAttribs = aAttribs.getArray(); + + sal_uInt16 nParaIndent = static_cast< const SfxUInt16Item* >( mpDoc->GetAttr( maCellAddress.Col(), maCellAddress.Row(), maCellAddress.Tab(), ATTR_INDENT ) )->GetValue(); + if (nParaIndent > 0) + { + ::rtl::OUString sLeftMarginName (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin"))); + for (int i = 0; i < aAttribs.getLength(); ++i) + { + if (sLeftMarginName == pAttribs[i].Name) + { + pAttribs[i].Value = uno::makeAny( nParaIndent ); + break; + } + } + } + return aAttribs; +} + +sal_Bool ScAccessibleCell::IsFormulaMode() +{ + ScAccessibleSpreadsheet* pSheet =static_cast<ScAccessibleSpreadsheet*>(mxParent.get()); + if (pSheet) + { + return pSheet->IsFormulaMode(); + } + return sal_False; +} +sal_Bool ScAccessibleCell::IsDropdown() +{ + sal_uInt16 nPosX = maCellAddress.Col(); + sal_uInt16 nPosY = sal_uInt16(maCellAddress.Row()); + sal_uInt16 nTab = maCellAddress.Tab(); + //IAccessibility2 Implementation 2009----- + sal_uInt32 nValidation = static_cast< const SfxUInt32Item* >( mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_VALIDDATA ) )->GetValue(); + if( nValidation ) + { + const ScValidationData* pData = mpDoc->GetValidationEntry( nValidation ); + if( pData && pData->HasSelectionList() ) + return sal_True; + } + //-----IAccessibility2 Implementation 2009 + ScMergeFlagAttr* pAttr; + pAttr = (ScMergeFlagAttr*)mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG ); + if( pAttr->HasAutoFilter() ) + { + return sal_True; + } + else + { + sal_uInt16 nTabCount = mpDoc->GetTableCount(); + if ( nTab+1<nTabCount && mpDoc->IsScenario(nTab+1) && !mpDoc->IsScenario(nTab) ) + { + sal_uInt16 i; + ScMarkData aMarks; + for (i=nTab+1; i<nTabCount && mpDoc->IsScenario(i); i++) + mpDoc->MarkScenario( i, nTab, aMarks, sal_False, SC_SCENARIO_SHOWFRAME ); + ScRangeList aRanges; + aMarks.FillRangeListWithMarks( &aRanges, sal_False ); + sal_Bool bHasScenario; + sal_uInt16 nRangeCount = (sal_uInt16)aRanges.Count(); + for (i=0; i<nRangeCount; i++) + { + ScRange aRange = *aRanges.GetObject(i); + mpDoc->ExtendTotalMerge( aRange ); + sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 ); + // MT IA2: Not used: sal_Bool bIsInScen = sal_False; + if ( bTextBelow ) + { + bHasScenario = (aRange.aStart.Col() == nPosX && aRange.aEnd.Row() == nPosY-1); + } + else + { + bHasScenario = (aRange.aStart.Col() == nPosX && aRange.aStart.Row() == nPosY+1); + } + if( bHasScenario ) return sal_True; + } + } + } + return sal_False; +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx index 5d28e071ce45..5b245286b3db 100644 --- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx @@ -38,7 +38,10 @@ #include "sc.hrc" #endif #include "unonames.hxx" - +//IAccessibility2 Implementation 2009----- +#include "detfunc.hxx" +#include "chgtrack.hxx" +//-----IAccessibility2 Implementation 2009 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEROLE_HPP_ #include <com/sun/star/accessibility/AccessibleRole.hpp> #endif @@ -52,6 +55,11 @@ #include <rtl/uuid.h> #include <comphelper/sequence.hxx> #include <sfx2/objsh.hxx> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/sheet/XSheetAnnotation.hpp> +#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp> +#include <com/sun/star/text/XSimpleText.hpp> +//-----IAccessibility2 Implementation 2009 #include <float.h> @@ -226,17 +234,20 @@ sal_Int32 ScAccessibleCellBase::createAccessibleName(void) throw (uno::RuntimeException) { - String sName( ScResId(STR_ACC_CELL_NAME) ); +//IAccessibility2 Implementation 2009----- + //String sName( ScResId(STR_ACC_CELL_NAME) ); String sAddress; // Document not needed, because only the cell address, but not the tablename is needed // always us OOO notation maCellAddress.Format( sAddress, SCA_VALID, NULL ); - sName.SearchAndReplaceAscii("%1", sAddress); + //sName.SearchAndReplaceAscii("%1", sAddress); /* #i65103# ZoomText merges cell address and contents, e.g. if value 2 is contained in cell A1, ZT reads "cell A twelve" instead of "cell A1 - 2". Simple solution: Append a space character to the cell address. */ - sName.Append( ' ' ); - return rtl::OUString(sName); + //sName.Append( ' ' ); + //return rtl::OUString(sName); + return rtl::OUString(sAddress); +//-----IAccessibility2 Implementation 2009 } //===== XAccessibleValue ================================================ @@ -249,8 +260,14 @@ uno::Any SAL_CALL IsObjectValid(); uno::Any aAny; if (mpDoc) - aAny <<= mpDoc->GetValue(maCellAddress); - +//IAccessibility2 Implementation 2009----- + //aAny <<= mpDoc->GetValue(maCellAddress); + { + String valStr; + mpDoc->GetString(maCellAddress.Col(),maCellAddress.Row(),maCellAddress.Tab(), valStr); + aAny <<= rtl::OUString(valStr); + } +//-----IAccessibility2 Implementation 2009 return aAny; } @@ -339,3 +356,305 @@ sal_Bool ScAccessibleCellBase::IsEditable( bEditable = sal_True; return bEditable; } +//IAccessibility2 Implementation 2009----- +::rtl::OUString SAL_CALL ScAccessibleCellBase::GetNote(void) + throw (::com::sun::star::uno::RuntimeException) +{ + ScUnoGuard aGuard; + IsObjectValid(); + rtl::OUString msNote; + if (mpDoc) + { + SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); + if ( pObjSh ) + { + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY ); + if ( xSpreadDoc.is() ) + { + uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); + uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); + if ( xIndex.is() ) + { + uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab()); + uno::Reference<sheet::XSpreadsheet> xTable; + if (aTable>>=xTable) + { + uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row()); + if (xCell.is()) + { + uno::Reference <sheet::XSheetAnnotationAnchor> xAnnotationAnchor ( xCell, uno::UNO_QUERY); + if(xAnnotationAnchor.is()) + { + uno::Reference <sheet::XSheetAnnotation> xSheetAnnotation = xAnnotationAnchor->getAnnotation(); + if (xSheetAnnotation.is()) + { + uno::Reference <text::XSimpleText> xText (xSheetAnnotation, uno::UNO_QUERY); + if (xText.is()) + { + msNote = xText->getString(); + } + } + } + } + } + } + } + } + } + return msNote; +} +#ifndef _COM_SUN_STAR_TABLE_SHADOWFORMAT_HPP_ +#include <com/sun/star/table/ShadowFormat.hpp> +#endif +::rtl::OUString SAL_CALL ScAccessibleCellBase::getShadowAttrs(void) + throw (::com::sun::star::uno::RuntimeException) +{ + ScUnoGuard aGuard; + IsObjectValid(); + table::ShadowFormat aShadowFmt; + if (mpDoc) + { + SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); + if ( pObjSh ) + { + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY ); + if ( xSpreadDoc.is() ) + { + uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); + uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); + if ( xIndex.is() ) + { + uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab()); + uno::Reference<sheet::XSpreadsheet> xTable; + if (aTable>>=xTable) + { + uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row()); + if (xCell.is()) + { + uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY); + if (xCellProps.is()) + { + uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SHADOW))); + aAny >>= aShadowFmt; + } + } + } + } + } + } + } + //construct shadow attributes string + rtl::OUString sShadowAttrs( RTL_CONSTASCII_USTRINGPARAM("Shadow:") ); + rtl::OUString sInnerSplit( RTL_CONSTASCII_USTRINGPARAM(",") ); + rtl::OUString sOuterSplit( RTL_CONSTASCII_USTRINGPARAM(";") ); + sal_Int32 nLocationVal = 0; + switch( aShadowFmt.Location ) + { + case table::ShadowLocation_TOP_LEFT: + nLocationVal = 1; + break; + case table::ShadowLocation_TOP_RIGHT: + nLocationVal = 2; + break; + case table::ShadowLocation_BOTTOM_LEFT: + nLocationVal = 3; + break; + case table::ShadowLocation_BOTTOM_RIGHT: + nLocationVal = 4; + break; + default: + break; + } + //if there is no shadow property for the cell + if ( nLocationVal == 0 ) + { + sShadowAttrs += sOuterSplit; + return sShadowAttrs; + } + //else return all the shadow properties + sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Location=") ); + sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)nLocationVal ); + sShadowAttrs += sInnerSplit; + sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowWidth=") ); + sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)aShadowFmt.ShadowWidth ) ; + sShadowAttrs += sInnerSplit; + sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsTransparent=") ); + sShadowAttrs += rtl::OUString::valueOf( (sal_Bool)aShadowFmt.IsTransparent ) ; + sShadowAttrs += sInnerSplit; + sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color=") ); + sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)aShadowFmt.Color ); + sShadowAttrs += sOuterSplit; + return sShadowAttrs; +} +#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_ +#include <com/sun/star/table/BorderLine.hpp> +#endif +::rtl::OUString SAL_CALL ScAccessibleCellBase::getBorderAttrs(void) + throw (::com::sun::star::uno::RuntimeException) +{ + ScUnoGuard aGuard; + IsObjectValid(); + table::BorderLine aTopBorder; + table::BorderLine aBottomBorder; + table::BorderLine aLeftBorder; + table::BorderLine aRightBorder; + if (mpDoc) + { + SfxObjectShell* pObjSh = mpDoc->GetDocumentShell(); + if ( pObjSh ) + { + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY ); + if ( xSpreadDoc.is() ) + { + uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); + uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); + if ( xIndex.is() ) + { + uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab()); + uno::Reference<sheet::XSpreadsheet> xTable; + if (aTable>>=xTable) + { + uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row()); + if (xCell.is()) + { + uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY); + if (xCellProps.is()) + { + uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TOPBORDER))); + aAny >>= aTopBorder; + aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_BOTTBORDER))); + aAny >>= aBottomBorder; + aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_LEFTBORDER))); + aAny >>= aLeftBorder; + aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_RIGHTBORDER))); + aAny >>= aRightBorder; + } + } + } + } + } + } + } + + Color aColor; + sal_Bool bIn = mpDoc ? mpDoc->IsCellInChangeTrack(maCellAddress,&aColor) : sal_False; + if (bIn) + { + aTopBorder.Color = aColor.GetColor(); + aBottomBorder.Color = aColor.GetColor(); + aLeftBorder.Color = aColor.GetColor(); + aRightBorder.Color = aColor.GetColor(); + aTopBorder.OuterLineWidth =2; + aBottomBorder.OuterLineWidth =2; + aLeftBorder.OuterLineWidth =2; + aRightBorder.OuterLineWidth =2; + } + + //construct border attributes string + rtl::OUString sBorderAttrs; + rtl::OUString sInnerSplit( RTL_CONSTASCII_USTRINGPARAM(",") ); + rtl::OUString sOuterSplit( RTL_CONSTASCII_USTRINGPARAM(";") ); + //top border + //if top of the cell has no border + if ( aTopBorder.InnerLineWidth == 0 && aTopBorder.OuterLineWidth == 0 ) + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopBorder:;") ); + } + else//add all the border properties to the return string. + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopBorder:Color=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.Color ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.InnerLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.OuterLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.LineDistance ); + sBorderAttrs += sOuterSplit; + } + //bottom border + if ( aBottomBorder.InnerLineWidth == 0 && aBottomBorder.OuterLineWidth == 0 ) + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomBorde:;") ); + } + else + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomBorder:Color=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.Color ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.InnerLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.OuterLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.LineDistance ); + sBorderAttrs += sOuterSplit; + } + //left border + if ( aLeftBorder.InnerLineWidth == 0 && aLeftBorder.OuterLineWidth == 0 ) + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorder:;") ); + } + else + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorder:Color=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.Color ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.InnerLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.OuterLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.LineDistance ); + sBorderAttrs += sOuterSplit; + } + //right border + if ( aRightBorder.InnerLineWidth == 0 && aRightBorder.OuterLineWidth == 0 ) + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorder:;") ); + } + else + { + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorder:Color=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.Color ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.InnerLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.OuterLineWidth ); + sBorderAttrs += sInnerSplit; + sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") ); + sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.LineDistance ); + sBorderAttrs += sOuterSplit; + } + return sBorderAttrs; +} +//end of cell attributes + +::rtl::OUString SAL_CALL ScAccessibleCellBase::GetAllDisplayNote(void) + throw (::com::sun::star::uno::RuntimeException) +{ + ::rtl::OUString strNote; + String strTrackText; + if (mpDoc) + { + sal_Bool bLeftedge=sal_False; + mpDoc->GetCellChangeTrackNote(maCellAddress,strTrackText,bLeftedge); + } + if (strTrackText.Len() > 0 ) + { + ScDetectiveFunc::AppendChangTrackNoteSeparator(strTrackText); + strNote = strTrackText; + } + strNote += GetNote(); + return strNote; +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx index f5708cf6b31d..df37633000ea 100644 --- a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx +++ b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx @@ -31,17 +31,32 @@ #include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/XAccessibleAction.hpp> +#include <comphelper/accessiblekeybindinghelper.hxx> +#include <com/sun/star/awt/KeyModifier.hpp> +#include <vcl/keycodes.hxx> +//-----IAccessibility2 Implementation 2009 +#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX #include <unotools/accessiblestatesethelper.hxx> +#endif #include <rtl/uuid.h> #include <tools/gen.hxx> #include <toolkit/helper/convert.hxx> #include <tools/debug.hxx> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#include <unotools/accessiblerelationsethelper.hxx> +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; class ScAccessibleDataPilotButton : public ScAccessibleContextBase +//IAccessibility2 Implementation 2009----- + , public ::com::sun::star::accessibility::XAccessibleAction +//-----IAccessibility2 Implementation 2009 { public: //===== internal ======================================================== @@ -63,6 +78,19 @@ public: protected: virtual ~ScAccessibleDataPilotButton(void); public: +//IAccessibility2 Implementation 2009----- + // XAccessibleAction + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + ///===== XInterface ===================================================== + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + ::com::sun::star::uno::Type const & rType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); +//-----IAccessibility2 Implementation 2009 ///===== XAccessibleComponent ============================================ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > @@ -104,7 +132,10 @@ public: ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw (::com::sun::star::uno::RuntimeException); - +//IAccessibility2 Implementation 2009----- + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > + SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 ///===== XServiceInfo ==================================================== /** Returns an identifier for the implementation of this object. @@ -296,6 +327,10 @@ void ScAccessibleDataPilotControl::GotFocus() { DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); +//IAccessibility2 Implementation 2009----- + if(maChildren.size()==0) + return ; +//-----IAccessibility2 Implementation 2009 sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex()); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (xTempAcc.is() && maChildren[nIndex].pAcc) @@ -308,7 +343,10 @@ void ScAccessibleDataPilotControl::LostFocus() if (mpFieldWindow) { DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change"); - +//IAccessibility2 Implementation 2009----- + if(maChildren.size()==0) + return ; +//-----IAccessibility2 Implementation 2009 sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex()); uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc; if (xTempAcc.is() && maChildren[nIndex].pAcc) @@ -518,7 +556,11 @@ ScAccessibleDataPilotButton::ScAccessibleDataPilotButton( ::com::sun::star::accessibility::XAccessible>& rxParent, ScPivotFieldWindow* pFieldWindow, sal_Int32 nIndex) - : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON), +//IAccessibility2 Implementation 2009----- +//change role frome PUSH_BUTTON to BUTTON_MENU + //: ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON), + : ScAccessibleContextBase(rxParent, AccessibleRole::BUTTON_MENU), +//-----IAccessibility2 Implementation 2009 mpFieldWindow(pFieldWindow), mnIndex(nIndex) { @@ -657,7 +699,23 @@ uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotButton::getAcc return pStateSet; } +//IAccessibility2 Implementation 2009----- +::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > + SAL_CALL ScAccessibleDataPilotButton::getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException) +{ + utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper; + uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper; + if(mxParent.is()) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = mxParent; + pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + return xSet; + +} +//-----IAccessibility2 Implementation 2009 ///===== XServiceInfo ==================================================== ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void) @@ -685,6 +743,10 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotButton::getImplementationI ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void) throw (::com::sun::star::uno::RuntimeException) { +//IAccessibility2 Implementation 2009----- + if (mpFieldWindow) + return mpFieldWindow->GetHelpText(); +//-----IAccessibility2 Implementation 2009 return rtl::OUString(); } @@ -721,3 +783,67 @@ Rectangle ScAccessibleDataPilotButton::GetBoundingBox(void) const else return Rectangle(); } +//IAccessibility2 Implementation 2009----- +// ----------------------------------------------------------------------------- +// XAccessibleAction +// ----------------------------------------------------------------------------- +sal_Int32 ScAccessibleDataPilotButton::getAccessibleActionCount( ) throw (uno::RuntimeException) +{ + return 1; +} +// ----------------------------------------------------------------------------- +sal_Bool ScAccessibleDataPilotButton::doAccessibleAction ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw lang::IndexOutOfBoundsException(); + return sal_True; +} +// ----------------------------------------------------------------------------- +::rtl::OUString ScAccessibleDataPilotButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw lang::IndexOutOfBoundsException(); + return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "press" ) ); +} +// ----------------------------------------------------------------------------- +::com::sun::star::uno::Reference< XAccessibleKeyBinding > ScAccessibleDataPilotButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) + throw lang::IndexOutOfBoundsException(); + comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new comphelper::OAccessibleKeyBindingHelper(); + ::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper; + ScPivotFieldWindow* pWindow = mpFieldWindow; + if ( pWindow ) + { + awt::KeyStroke aKeyStroke; + aKeyStroke.Modifiers = 0; + aKeyStroke.KeyCode = KEY_SPACE; + pKeyBindingHelper->AddKeyBinding( aKeyStroke ); + } + return xKeyBinding; +} +//===== XInterface ===================================================== +uno::Any SAL_CALL ScAccessibleDataPilotButton::queryInterface( uno::Type const & rType ) + throw (::com::sun::star::uno::RuntimeException) +{ + uno::Any aAny (ScAccessibleContextBase::queryInterface(rType)); + if(!aAny.hasValue()) + { + aAny = ::cppu::queryInterface (rType, + static_cast<XAccessibleAction*>(this) + ); + } + return aAny; +} +void SAL_CALL ScAccessibleDataPilotButton::acquire() + throw () +{ + ScAccessibleContextBase::acquire(); +} +void SAL_CALL ScAccessibleDataPilotButton::release() + throw () +{ + ScAccessibleContextBase::release(); +} +//-----IAccessibility2 Implementation 2009 + diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 23b2238bd05d..7cc0fb25992a 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -70,9 +70,23 @@ #include <unotools/accessiblerelationsethelper.hxx> #include <toolkit/helper/convert.hxx> +//IAccessibility2 Implementation 2009----- +#include <svx/AccessibleControlShape.hxx> +#include <svx/AccessibleShape.hxx> +#include <svx/ShapeTypeHandler.hxx> +#include <svx/SvxShapeTypes.hxx> +#include <sfx2/objsh.hxx> +#include <editeng/editview.hxx> +#include <editeng/editeng.hxx> +//-----IAccessibility2 Implementation 2009 #include <list> #include <algorithm> +//IAccessibility2 Implementation 2009----- +#include "AccessibleCell.hxx" +#include "svx/unoapi.hxx" +#include "scmod.hxx" +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::std::for_each; @@ -245,6 +259,16 @@ public: const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo ) throw (::com::sun::star::uno::RuntimeException); +//IAccessibility2 Implementation 2009----- + virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel + (::com::sun::star::beans::XPropertySet* pSet) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible> + GetAccessibleCaption (const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape>& xShape) + throw (::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 ///===== Internal ======================================================== void SetDrawBroadcaster(); @@ -465,6 +489,45 @@ sal_Bool ScChildrenShapes::ReplaceChild (::accessibility::AccessibleShape* pCurr return bResult; } +//IAccessibility2 Implementation 2009----- +::accessibility::AccessibleControlShape * ScChildrenShapes::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int32 count = GetCount(); + for (sal_Int32 index=0;index<count;index++) + { + ScAccessibleShapeData* pShape = maZOrderedShapes[index]; + if (pShape) + { + ::accessibility::AccessibleShape* pAccShape = pShape->pAccShape; + if (pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL) + { + ::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape); + if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet) + return pCtlAccShape; + } + } + } + return NULL; +} +::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > +ScChildrenShapes::GetAccessibleCaption (const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape>& xShape) + throw (::com::sun::star::uno::RuntimeException) +{ + sal_Int32 count = GetCount(); + for (sal_Int32 index=0;index<count;index++) + { + ScAccessibleShapeData* pShape = maZOrderedShapes[index]; + if (pShape && pShape->xShape == xShape ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xNewChild( pShape->pAccShape ); +// uno::Reference<XAccessible> xNewChild( pShape->pAccShape , uno::UNO_QUERY ); + if(xNewChild.get()) + return xNewChild; + } + } + return NULL; +} +//-----IAccessibility2 Implementation 2009 sal_Int32 ScChildrenShapes::GetCount() const { SdrPage* pDrawPage = GetDrawPage(); @@ -743,6 +806,9 @@ uno::Reference< XAccessible > ScChildrenShapes::GetSelected(sal_Int32 nSelectedC std::vector < uno::Reference < drawing::XShape > > aShapes; FillShapes(aShapes); +//IAccessibility2 Implementation 2009----- + if(aShapes.size()<=0) return xAccessible; +//-----IAccessibility2 Implementation 2009 SortedShapes::iterator aItr; if (FindShape(aShapes[nSelectedChildIndex], aItr)) xAccessible = Get(aItr - maZOrderedShapes.begin()); @@ -887,9 +953,20 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin } else mnShapesSelected = 0; +//IAccessibility2 Implementation 2009----- + SdrObject *pFocusedObj = NULL; + if( mnShapesSelected == 1 && aShapesList.size() == 1) + { + pFocusedObj = GetSdrObjectFromXShape(aShapesList[0]->xShape); + } +//-----IAccessibility2 Implementation 2009 ScShapeDataLess aLess; std::sort(aShapesList.begin(), aShapesList.end(), aLess); - +//IAccessibility2 Implementation 2009----- + SortedShapes vecSelectedShapeAdd; + SortedShapes vecSelectedShapeRemove; + sal_Bool bHasSelect=sal_False; +//-----IAccessibility2 Implementation 2009 SortedShapes::iterator aXShapesItr(aShapesList.begin()); SortedShapes::const_iterator aXShapesEndItr(aShapesList.end()); SortedShapes::iterator aDataItr(maZOrderedShapes.begin()); @@ -914,9 +991,18 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED); (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED); bResult = sal_True; +//IAccessibility2 Implementation 2009----- + vecSelectedShapeAdd.push_back((*aDataItr)); +//-----IAccessibility2 Implementation 2009 } aFocusedItr = aDataItr; } +//IAccessibility2 Implementation 2009----- + else + { + bHasSelect = sal_True; + } +//-----IAccessibility2 Implementation 2009 ++aDataItr; ++aXShapesItr; } @@ -930,6 +1016,9 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED); (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED); bResult = sal_True; +//IAccessibility2 Implementation 2009----- + vecSelectedShapeRemove.push_back(*aDataItr); +//-----IAccessibility2 Implementation 2009 } } ++aDataItr; @@ -944,9 +1033,122 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin else ++aDataItr; } - if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1)) +//IAccessibility2 Implementation 2009----- + bool bWinFocus=false; + ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos)); + if (pWin) + { + bWinFocus = pWin->HasFocus(); + } + const SdrMarkList* pMarkList = NULL; + SdrObject* pMarkedObj = NULL; + SdrObject* pUpObj = NULL; + sal_Bool bIsFocuseMarked = sal_True; + if( mpViewShell && mnShapesSelected == 1 && bWinFocus) + { + ScDrawView* pScDrawView = mpViewShell->GetViewData()->GetScDrawView(); + if( pScDrawView ) + { + if( pScDrawView->GetMarkedObjectList().GetMarkCount() == 1 ) + { + pMarkList = &(pScDrawView->GetMarkedObjectList()); + pMarkedObj = pMarkList->GetMark(0)->GetMarkedSdrObj(); + uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY); + if( aFocusedItr != aDataEndItr && + (*aFocusedItr)->xShape.is() && + xMarkedXShape.is() && + (*aFocusedItr)->xShape != xMarkedXShape ) + bIsFocuseMarked = sal_False; + } + } + } + //if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1)) + if ( bIsFocuseMarked && (aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1) && bWinFocus) + { (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED); + } + else if( pFocusedObj && bWinFocus && pMarkList && pMarkList->GetMarkCount() == 1 && mnShapesSelected == 1 ) + { + if( pMarkedObj ) + { + uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY); + pUpObj = pMarkedObj->GetUpGroup(); + if( pMarkedObj == pFocusedObj ) + { + if( pUpObj ) + { + uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->getUnoShape(), uno::UNO_QUERY); + uno::Reference < XAccessible > xAccGroupShape = + const_cast<ScChildrenShapes*>(this)->GetAccessibleCaption( xUpGroupXShape ); + if( xAccGroupShape.is() ) + { + ::accessibility::AccessibleShape* pAccGroupShape = + static_cast< ::accessibility::AccessibleShape* >(xAccGroupShape.get()); + if( pAccGroupShape ) + { + sal_Int32 nCount = pAccGroupShape->getAccessibleChildCount(); + for( sal_Int32 i = 0; i < nCount; i++ ) + { + uno::Reference<XAccessible> xAccShape = pAccGroupShape->getAccessibleChild(i); + if (xAccShape.is()) + { + ::accessibility::AccessibleShape* pChildAccShape = static_cast< ::accessibility::AccessibleShape* >(xAccShape.get()); + uno::Reference< drawing::XShape > xChildShape = pChildAccShape->GetXShape(); + if (xChildShape == xMarkedXShape) + { + pChildAccShape->SetState(AccessibleStateType::FOCUSED); + } + else + { + pChildAccShape->ResetState(AccessibleStateType::FOCUSED); + } + } + } + } + } + } + } + } + } + if (vecSelectedShapeAdd.size() >= 10 ) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument); + mpAccessibleDocument->CommitChange(aEvent); + } + else + { + SortedShapes::iterator vi = vecSelectedShapeAdd.begin(); + for (; vi != vecSelectedShapeAdd.end() ; ++vi ) + { + AccessibleEventObject aEvent; + if (bHasSelect) + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; + } + else + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; + } + aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument); + uno::Reference< XAccessible > xChild( (*vi)->pAccShape); + aEvent.NewValue <<= xChild; + mpAccessibleDocument->CommitChange(aEvent); + } + } + SortedShapes::iterator vi = vecSelectedShapeRemove.begin(); + for (; vi != vecSelectedShapeRemove.end() ; ++vi ) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; + aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument); + uno::Reference< XAccessible > xChild( (*vi)->pAccShape); + aEvent.NewValue <<= xChild; + mpAccessibleDocument->CommitChange(aEvent); + } +//-----IAccessibility2 Implementation 2009 std::for_each(aShapesList.begin(), aShapesList.end(), Destroy()); return bResult; @@ -1357,12 +1559,32 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) const ScAccGridWinFocusGotHint& rRef = (const ScAccGridWinFocusGotHint&)rHint; if (rRef.GetNewGridWin() == meSplitPos) { +//IAccessibility2 Implementation 2009----- + uno::Reference<XAccessible> xAccessible; + if (mpChildrenShapes) + { + sal_Bool bTabMarked(IsTableSelected()); + xAccessible = mpChildrenShapes->GetSelected(0, bTabMarked); + } + if( xAccessible.is() ) + { + uno::Any aNewValue; + aNewValue<<=AccessibleStateType::FOCUSED; + static_cast< ::accessibility::AccessibleShape* >(xAccessible.get())-> + CommitChange(AccessibleEventId::STATE_CHANGED, + aNewValue, + uno::Any() ); + } + else + { if (mxTempAcc.is() && mpTempAccEdit) mpTempAccEdit->GotFocus(); else if (mpAccessibleSpreadsheet) mpAccessibleSpreadsheet->GotFocus(); else CommitFocusGained(); + } +//-----IAccessibility2 Implementation 2009 } } else if (rHint.ISA( SfxSimpleHint )) @@ -1381,11 +1603,18 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { mpChildrenShapes = new ScChildrenShapes( this, mpViewShell, meSplitPos ); } - +//IAccessibility2 Implementation 2009----- + //Invoke Init() to rebuild the mpChildrenShapes variable + this->Init(); +//-----IAccessibility2 Implementation 2009 AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN; aEvent.Source = uno::Reference< XAccessibleContext >(this); CommitChange(aEvent); // all childs changed +//IAccessibility2 Implementation 2009----- + if (mpAccessibleSpreadsheet) + mpAccessibleSpreadsheet->FireFirstCellFocus(); +//-----IAccessibility2 Implementation 2009 } else if (rRef.GetId() == SC_HINT_ACC_MAKEDRAWLAYER) { @@ -1396,19 +1625,25 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if (mpViewShell && mpViewShell->GetViewData()->HasEditView(meSplitPos)) { - mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos), - mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(), - rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode); - uno::Reference<XAccessible> xAcc = mpTempAccEdit; + //IAccessibility2 Implementation 2009------ + EditEngine* pEditEng = mpViewShell->GetViewData()->GetEditView(meSplitPos)->GetEditEngine(); + if (pEditEng && pEditEng->GetUpdateMode()) + { + mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos), + mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(), + rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode); + uno::Reference<XAccessible> xAcc = mpTempAccEdit; - AddChild(xAcc, sal_True); + AddChild(xAcc, sal_True); - if (mpAccessibleSpreadsheet) - mpAccessibleSpreadsheet->LostFocus(); - else - CommitFocusLost(); + if (mpAccessibleSpreadsheet) + mpAccessibleSpreadsheet->LostFocus(); + else + CommitFocusLost(); - mpTempAccEdit->GotFocus(); + mpTempAccEdit->GotFocus(); + } + //------IAccessibility2 Implementation 2009 } } else if (rRef.GetId() == SC_HINT_ACC_LEAVEEDITMODE) @@ -1420,10 +1655,15 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) mpTempAccEdit = NULL; RemoveChild(mxTempAcc, sal_True); - - if (mpAccessibleSpreadsheet) +//IAccessibility2 Implementation 2009----- + //if (mpAccessibleSpreadsheet) + if (mpAccessibleSpreadsheet && mpViewShell->IsActive()) +//-----IAccessibility2 Implementation 2009 mpAccessibleSpreadsheet->GotFocus(); - else +//IAccessibility2 Implementation 2009----- + //else + else if( mpViewShell->IsActive()) +//-----IAccessibility2 Implementation 2009 CommitFocusGained(); } } @@ -1484,6 +1724,12 @@ void SAL_CALL ScAccessibleDocument::selectionChanged( const lang::EventObject& / CommitChange(aEvent); } +//IAccessibility2 Implementation 2009----- + if(mpChildrenShapes ) + { + mpChildrenShapes->SelectionChanged(); + } +//-----IAccessibility2 Implementation 2009 } //===== XInterface ===================================================== @@ -1491,6 +1737,15 @@ void SAL_CALL ScAccessibleDocument::selectionChanged( const lang::EventObject& / uno::Any SAL_CALL ScAccessibleDocument::queryInterface( uno::Type const & rType ) throw (uno::RuntimeException) { +//IAccessibility2 Implementation 2009----- + uno::Any aAnyTmp; + if(rType == ::getCppuType((com::sun::star::uno::Reference<XAccessibleGetAccFlowTo> *)NULL) ) + { + com::sun::star::uno::Reference<XAccessibleGetAccFlowTo> AccFromXShape = this; + aAnyTmp <<= AccFromXShape; + return aAnyTmp; + } +//-----IAccessibility2 Implementation 2009 uno::Any aAny (ScAccessibleDocumentImpl::queryInterface(rType)); return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType); } @@ -1642,6 +1897,37 @@ uno::Reference<XAccessibleStateSet> SAL_CALL return pStateSet; } +//IAccessibility2 Implementation 2009----- +::rtl::OUString SAL_CALL + ScAccessibleDocument::getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sName = String(ScResId(STR_ACC_DOC_SPREADSHEET)); + ScDocument* pScDoc = GetDocument(); + if ( pScDoc ) + { + rtl::OUString sFileName = pScDoc->getDocAccTitle(); + if ( !sFileName.getLength() ) + { + SfxObjectShell* pObjSh = pScDoc->GetDocumentShell(); + if ( pObjSh ) + { + sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME ); + } + } + rtl::OUString sReadOnly; + if (pScDoc->getDocReadOnly()) + { + sReadOnly = String(ScResId(STR_ACC_DOC_SPREADSHEET_READONLY)); + } + if ( sFileName.getLength() ) + { + sName = sFileName + sReadOnly + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName; + } + } + return sName; +} +//-----IAccessibility2 Implementation 2009 ///===== XAccessibleSelection =========================================== void SAL_CALL @@ -2114,3 +2400,202 @@ rtl::OUString ScAccessibleDocument::GetCurrentCellDescription() const { return rtl::OUString(); } +//IAccessibility2 Implementation 2009----- +ScDocument *ScAccessibleDocument::GetDocument() const +{ + return mpViewShell ? mpViewShell->GetViewData()->GetDocument() : NULL; +} +ScAddress ScAccessibleDocument::GetCurCellAddress() const +{ + return mpViewShell ? mpViewShell->GetViewData()->GetCurPos() :ScAddress(); +} +uno::Any SAL_CALL ScAccessibleDocument::getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) +{ + + uno::Any anyAtrribute; + + rtl::OUString sName; + rtl::OUString sValue; + sal_uInt16 sheetIndex; + String sSheetName; + sheetIndex = getVisibleTable(); + if(GetDocument()==NULL) + return anyAtrribute; + GetDocument()->GetName(sheetIndex,sSheetName); + sName = rtl::OUString::createFromAscii("page-name:"); + sValue = sName + sSheetName ; + sName = rtl::OUString::createFromAscii(";page-number:"); + sValue += sName; + sValue += String::CreateFromInt32(sheetIndex+1) ; + sName = rtl::OUString::createFromAscii(";total-pages:"); + sValue += sName; + sValue += String::CreateFromInt32(GetDocument()->GetTableCount()); + sValue += rtl::OUString::createFromAscii(";"); + anyAtrribute <<= sValue; + return anyAtrribute; +} +com::sun::star::uno::Sequence< com::sun::star::uno::Any > ScAccessibleDocument::GetScAccFlowToSequence() +{ + if ( getAccessibleChildCount() ) + { + uno::Reference < XAccessible > xSCTableAcc = getAccessibleChild( 0 ); // table + if ( xSCTableAcc.is() ) + { + uno::Reference < XAccessibleSelection > xAccSelection( xSCTableAcc, uno::UNO_QUERY ); + sal_Int32 nSelCount = xAccSelection->getSelectedAccessibleChildCount(); + if( nSelCount ) + { + uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); // selected cell + if ( xSel.is() ) + { + uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); + if ( xSelContext.is() ) + { + if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL ) + { + sal_Int32 nParaCount = 0; + uno::Sequence <uno::Any> aSequence(nSelCount); + for ( sal_Int32 i = 0; i < nSelCount; i++ ) + { + xSel = xAccSelection->getSelectedAccessibleChild( i ) ; + if ( xSel.is() ) + { + xSelContext = xSel->getAccessibleContext(); + if ( xSelContext.is() ) + { + if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL ) + { + aSequence[nParaCount] = uno::makeAny( xSel ); + nParaCount++; + } + } + } + } + return aSequence; + } + } + } + } + } + } + uno::Sequence <uno::Any> aEmpty; + return aEmpty; +} +::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL ScAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) + throw ( ::com::sun::star::uno::RuntimeException ) +{ + const sal_Int32 SPELLCHECKFLOWTO = 1; + const sal_Int32 FINDREPLACEFLOWTO = 2; + if ( nType == SPELLCHECKFLOWTO ) + { + uno::Reference< ::com::sun::star::drawing::XShape > xShape; + rAny >>= xShape; + if ( xShape.is() ) + { + uno::Reference < XAccessible > xAcc = mpChildrenShapes->GetAccessibleCaption(xShape); + uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY ); + if ( xAccSelection.is() ) + { + if ( xAccSelection->getSelectedAccessibleChildCount() ) + { + uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); + if ( xSel.is() ) + { + uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); + if ( xSelContext.is() ) + { + //if in sw we find the selected paragraph here + if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Sequence<uno::Any> aRet( 1 ); + aRet[0] = uno::makeAny( xSel ); + return aRet; + } + } + } + } + } + } + else + { + if ( getSelectedAccessibleChildCount() ) + { + uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 ); + if ( xSel.is() ) + { + uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() ); + if ( xSelContext.is() ) + { + uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY ); + if ( xAccChildSelection.is() ) + { + if ( xAccChildSelection->getSelectedAccessibleChildCount() ) + { + uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 ); + if ( xChildSel.is() ) + { + uno::Reference < ::com::sun::star::accessibility::XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() ); + if ( xChildSelContext.is() && + xChildSelContext->getAccessibleRole() == ::com::sun::star::accessibility::AccessibleRole::PARAGRAPH ) + { + uno::Sequence<uno::Any> aRet( 1 ); + aRet[0] = uno::makeAny( xChildSel ); + return aRet; + } + } + } + } + } + } + } + } + } + else if ( nType == FINDREPLACEFLOWTO ) + { + sal_Bool bSuccess; + rAny >>= bSuccess; + if ( bSuccess ) + { + uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence(); + if ( aSeq.getLength() ) + { + return aSeq; + } + else if( mpAccessibleSpreadsheet ) + { + uno::Reference < XAccessible > xFindCellAcc = mpAccessibleSpreadsheet->GetActiveCell(); + // add xFindCellAcc to the return the Sequence + uno::Sequence< uno::Any> aSeq2(1); + aSeq2[0] = uno::makeAny( xFindCellAcc ); + return aSeq2; + } + } + } + uno::Sequence< uno::Any> aEmpty; + return aEmpty; +} +void ScAccessibleDocument::SwitchViewFireFocus() +{ + if (mpAccessibleSpreadsheet) + { + mpAccessibleSpreadsheet->FireFirstCellFocus(); + } +} + +sal_Int32 SAL_CALL ScAccessibleDocument::getForeground( ) + throw (uno::RuntimeException) +{ + return COL_BLACK; +} + +sal_Int32 SAL_CALL ScAccessibleDocument::getBackground( ) + throw (uno::RuntimeException) +{ + ScUnoGuard aGuard; + IsObjectValid(); + return SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor; +} +//-----IAccessibility2 Implementation 2009 + diff --git a/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx b/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx index 605dc6f6464b..90b38dd5e52f 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx @@ -45,3 +45,10 @@ ScAccessibleDocumentBase::ScAccessibleDocumentBase( ScAccessibleDocumentBase::~ScAccessibleDocumentBase(void) { } +//IAccessibility2 Implementation 2009----- +void ScAccessibleDocumentBase::SwitchViewFireFocus() +{ + CommitFocusGained(); +} +//-----IAccessibility2 Implementation 2009 + diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index a96376e59cb5..4cefd126083f 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -1899,6 +1899,35 @@ ScShapeChilds* ScAccessibleDocumentPagePreview::GetShapeChilds() return mpShapeChilds; } +//IAccessibility2 Implementation 2009----- +::rtl::OUString ScAccessibleDocumentPagePreview::getAccessibleName(void) +throw (::com::sun::star::uno::RuntimeException) +{ + rtl::OUString sName = String(ScResId(STR_ACC_DOC_SPREADSHEET)); + ScDocument* pScDoc = mpViewShell->GetDocument(); + if ( pScDoc ) + { + rtl::OUString sFileName = pScDoc->getDocAccTitle(); + if ( !sFileName.getLength() ) + { + SfxObjectShell* pObjSh = pScDoc->GetDocumentShell(); + if ( pObjSh ) + { + sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME ); + } + } + if ( sFileName.getLength() ) + { + sName = sFileName + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName; + sName += String(ScResId(STR_ACC_DOC_PREVIEW_SUFFIX)); + + } + } + + return sName; +} +//-----IAccessibility2 Implementation 2009======= + //UNUSED2009-05 uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable() //UNUSED2009-05 { //UNUSED2009-05 if (!mpTable) diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx index 8324f41f0adc..5f624362bd5d 100644 --- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx +++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx @@ -44,10 +44,23 @@ #include <rtl/uuid.h> #include <tools/debug.hxx> #include <svx/AccessibleTextHelper.hxx> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> #include <editeng/editview.hxx> #include <editeng/editeng.hxx> #include <svx/svdmodel.hxx> - +#include <sfx2/objsh.hxx> + +#include "unonames.hxx" +#include "document.hxx" +#include "AccessibleDocument.hxx" +#include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#include <unotools/accessiblerelationsethelper.hxx> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +using ::com::sun::star::lang::IndexOutOfBoundsException; +using ::com::sun::star::uno::RuntimeException; +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; @@ -68,6 +81,23 @@ ScAccessibleEditObject::ScAccessibleEditObject( CreateTextHelper(); SetName(rName); SetDescription(rDescription); +//IAccessibility2 Implementation 2009----- + if( meObjectType == CellInEditMode) + { + const ScAccessibleDocument *pAccDoc = const_cast<ScAccessibleDocument*>(static_cast<ScAccessibleDocument*>(rxParent.get())) ; + if (pAccDoc) + { + m_pScDoc = pAccDoc->GetDocument(); + m_curCellAddress =pAccDoc->GetCurCellAddress(); + } + else + { + m_pScDoc=NULL; + } + } + else + m_pScDoc=NULL; +//-----IAccessibility2 Implementation 2009 } ScAccessibleEditObject::~ScAccessibleEditObject() @@ -106,6 +136,33 @@ void ScAccessibleEditObject::GotFocus() mpTextHelper->SetFocus(sal_True); } +//IAccessibility2 Implementation 2009----- +//===== XInterface ========================================================== + +com::sun::star::uno::Any SAL_CALL + ScAccessibleEditObject::queryInterface (const com::sun::star::uno::Type & rType) + throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aReturn = ScAccessibleContextBase::queryInterface (rType); + if ( ! aReturn.hasValue()) + aReturn = ::cppu::queryInterface (rType, + static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this) + ); + return aReturn; +} +void SAL_CALL + ScAccessibleEditObject::acquire (void) + throw () +{ + ScAccessibleContextBase::acquire (); +} +void SAL_CALL + ScAccessibleEditObject::release (void) + throw () +{ + ScAccessibleContextBase::release (); +} +//-----IAccessibility2 Implementation 2009 //===== XAccessibleComponent ============================================ uno::Reference< XAccessible > SAL_CALL ScAccessibleEditObject::getAccessibleAtPoint( @@ -351,4 +408,153 @@ void ScAccessibleEditObject::CreateTextHelper() } } } +//IAccessibility2 Implementation 2009----- +sal_Int32 SAL_CALL ScAccessibleEditObject::getForeground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + return GetFgBgColor(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CCOLOR))); +} + +sal_Int32 SAL_CALL ScAccessibleEditObject::getBackground( ) + throw (::com::sun::star::uno::RuntimeException) +{ + return GetFgBgColor(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLBACK))); +} +sal_Int32 ScAccessibleEditObject::GetFgBgColor( const rtl::OUString &strPropColor) +{ + ScUnoGuard aGuard; + sal_Int32 nColor(0); + if (m_pScDoc) + { + SfxObjectShell* pObjSh = m_pScDoc->GetDocumentShell(); + if ( pObjSh ) + { + uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY ); + if ( xSpreadDoc.is() ) + { + uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets(); + uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY ); + if ( xIndex.is() ) + { + uno::Any aTable = xIndex->getByIndex(m_curCellAddress.Tab()); + uno::Reference<sheet::XSpreadsheet> xTable; + if (aTable>>=xTable) + { + uno::Reference<table::XCell> xCell = xTable->getCellByPosition(m_curCellAddress.Col(), m_curCellAddress.Row()); + if (xCell.is()) + { + uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY); + if (xCellProps.is()) + { + uno::Any aAny = xCellProps->getPropertyValue(strPropColor); + aAny >>= nColor; + } + } + } + } + } + } + } + return nColor; +} +//===== XAccessibleSelection ============================================ +//-------------------------------------------------------------------------------- +void SAL_CALL ScAccessibleEditObject::selectAccessibleChild( sal_Int32 ) +throw ( IndexOutOfBoundsException, RuntimeException ) +{ +} +//---------------------------------------------------------------------------------- +sal_Bool SAL_CALL ScAccessibleEditObject::isAccessibleChildSelected( sal_Int32 nChildIndex ) +throw ( IndexOutOfBoundsException, + RuntimeException ) +{ + uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex ); + uno::Reference<XAccessibleContext> xContext; + if( xAcc.is() ) + xContext = xAcc->getAccessibleContext(); + if( xContext.is() ) + { + if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleText > + xText(xAcc, uno::UNO_QUERY); + if( xText.is() ) + { + if( xText->getSelectionStart() >= 0 ) return sal_True; + } + } + } + return sal_False; +} +//--------------------------------------------------------------------- +void SAL_CALL ScAccessibleEditObject::clearAccessibleSelection( ) +throw ( RuntimeException ) +{ +} +//------------------------------------------------------------------------- +void SAL_CALL ScAccessibleEditObject::selectAllAccessibleChildren( ) +throw ( RuntimeException ) +{ +} +//---------------------------------------------------------------------------- +sal_Int32 SAL_CALL ScAccessibleEditObject::getSelectedAccessibleChildCount() +throw ( RuntimeException ) +{ + sal_Int32 nCount = 0; + sal_Int32 TotalCount = getAccessibleChildCount(); + for( sal_Int32 i = 0; i < TotalCount; i++ ) + if( isAccessibleChildSelected(i) ) nCount++; + return nCount; +} +//-------------------------------------------------------------------------------------- +uno::Reference<XAccessible> SAL_CALL ScAccessibleEditObject::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) +throw ( IndexOutOfBoundsException, RuntimeException) +{ + if ( nSelectedChildIndex > getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + sal_Int32 i1, i2; + for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ ) + if( isAccessibleChildSelected(i1) ) + { + if( i2 == nSelectedChildIndex ) + return getAccessibleChild( i1 ); + i2++; + } + return uno::Reference<XAccessible>(); +} +//---------------------------------------------------------------------------------- +void SAL_CALL ScAccessibleEditObject::deselectAccessibleChild( + sal_Int32 ) + throw ( IndexOutOfBoundsException, + RuntimeException ) +{ +} +uno::Reference< XAccessibleRelationSet > ScAccessibleEditObject::getAccessibleRelationSet( ) + throw (uno::RuntimeException) +{ + ScUnoGuard aGuard; + Window* pWindow = mpWindow; + utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper; + uno::Reference< XAccessibleRelationSet > rSet = rRelationSet; + if ( pWindow ) + { + Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy(); + if ( pLabeledBy && pLabeledBy != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pLabeledBy->GetAccessible(); + rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) ); + } + Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf(); + if ( pMemberOf && pMemberOf != pWindow ) + { + uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1); + aSequence[0] = pMemberOf->GetAccessible(); + rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) ); + } + return rSet; + } + return uno::Reference< XAccessibleRelationSet >(); +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 5cbf6bf3c32f..c75370dd8a2e 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -50,12 +50,212 @@ #include <tools/debug.hxx> #include <tools/gen.hxx> #include <svtools/colorcfg.hxx> - +//IAccessibility2 Implementation 2009----- +#include "scresid.hxx" +#include "sc.hrc" +//-----IAccessibility2 Implementation 2009 #include <algorithm> using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; +//IAccessibility2 Implementation 2009----- +bool CompMinCol(const std::pair<sal_uInt16,sal_uInt16> & pc1,const std::pair<sal_uInt16,sal_uInt16> &pc2) +{ + return pc1.first < pc2.first; +} +ScMyAddress ScAccessibleSpreadsheet::CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex) +{ + if (pMarkedRanges->Count() <= 1) + { + ScRange* pRange = pMarkedRanges->First(); + if (pRange) + { + // MT IA2: Not used. + // const int nRowNum = pRange->aEnd.Row() - pRange->aStart.Row() + 1; + const int nColNum = pRange->aEnd.Col() - pRange->aStart.Col() + 1; + const int nCurCol = nSelectedChildIndex % nColNum; + const int nCurRow = (nSelectedChildIndex - nCurCol)/nColNum; + return ScMyAddress(static_cast<SCCOL>(pRange->aStart.Col() + nCurCol), pRange->aStart.Row() + nCurRow, maActiveCell.Tab()); + } + } + else + { + sal_Int32 nMinRow = MAXROW; + sal_Int32 nMaxRow = 0; + m_vecTempRange.clear(); + ScRange* pRange = pMarkedRanges->First(); + while (pRange) + { + if (pRange->aStart.Tab() != pRange->aEnd.Tab()) + { + if ((maActiveCell.Tab() >= pRange->aStart.Tab()) || + maActiveCell.Tab() <= pRange->aEnd.Tab()) + { + m_vecTempRange.push_back(pRange); + nMinRow = std::min(pRange->aStart.Row(),nMinRow); + nMaxRow = std::max(pRange->aEnd.Row(),nMaxRow); + } + else + DBG_ERROR("Range of wrong table"); + } + else if(pRange->aStart.Tab() == maActiveCell.Tab()) + { + m_vecTempRange.push_back(pRange); + nMinRow = std::min(pRange->aStart.Row(),nMinRow); + nMaxRow = std::max(pRange->aEnd.Row(),nMaxRow); + } + else + DBG_ERROR("Range of wrong table"); + pRange = pMarkedRanges->Next(); + } + int nCurrentIndex = 0 ; + for(sal_Int32 row = nMinRow ; row <= nMaxRow ; ++row) + { + m_vecTempCol.clear(); + { + VEC_RANGE::const_iterator vi = m_vecTempRange.begin(); + for (; vi < m_vecTempRange.end(); ++vi) + { + ScRange *p = *vi; + if ( row >= p->aStart.Row() && row <= p->aEnd.Row()) + { + m_vecTempCol.push_back(std::make_pair(p->aStart.Col(),p->aEnd.Col())); + } + } + } + std::sort(m_vecTempCol.begin(),m_vecTempCol.end(),CompMinCol); + { + VEC_COL::const_iterator vic = m_vecTempCol.begin(); + for(; vic != m_vecTempCol.end(); ++vic) + { + const PAIR_COL &pariCol = *vic; + sal_uInt16 nCol = pariCol.second - pariCol.first + 1; + if (nCol + nCurrentIndex > nSelectedChildIndex) + { + return ScMyAddress(static_cast<SCCOL>(pariCol.first + nSelectedChildIndex - nCurrentIndex), row, maActiveCell.Tab()); + } + nCurrentIndex += nCol; + } + } + } + } + return ScMyAddress(0,0,maActiveCell.Tab()); +} +sal_Bool ScAccessibleSpreadsheet::CalcScRangeDifferenceMax(ScRange *pSrc,ScRange *pDest,int nMax,VEC_MYADDR &vecRet,int &nSize) +{ + //Src Must be :Src > Dest + if (pDest->In(*pSrc)) + {//Here is Src In Dest,Src <= Dest + return sal_False; + } + if (!pDest->Intersects(*pSrc)) + { + int nCellCount = sal_uInt32(pDest->aEnd.Col() - pDest->aStart.Col() + 1) + * sal_uInt32(pDest->aEnd.Row() - pDest->aStart.Row() + 1) + * sal_uInt32(pDest->aEnd.Tab() - pDest->aStart.Tab() + 1); + if (nCellCount + nSize > nMax) + { + return sal_True; + } + else if(nCellCount > 0) + { + nCellCount +=nSize; + for (sal_Int32 row = pDest->aStart.Row(); row <= pDest->aEnd.Row();++row) + { + for (sal_uInt16 col = pDest->aStart.Col(); col <= pDest->aEnd.Col();++col) + { + vecRet.push_back(ScMyAddress(col,row,pDest->aStart.Tab())); + } + } + } + return sal_False; + } + sal_Int32 nMinRow = pSrc->aStart.Row(); + sal_Int32 nMaxRow = pSrc->aEnd.Row(); + for (; nMinRow <= nMaxRow ; ++nMinRow,--nMaxRow) + { + for (sal_uInt16 col = pSrc->aStart.Col(); col <= pSrc->aEnd.Col();++col) + { + if (nSize > nMax) + { + return sal_True; + } + ScMyAddress cell(col,nMinRow,pSrc->aStart.Tab()); + if(!pDest->In(cell)) + {//In Src ,Not In Dest + vecRet.push_back(cell); + ++nSize; + } + } + if (nMinRow != nMaxRow) + { + for (sal_uInt16 col = pSrc->aStart.Col(); col <= pSrc->aEnd.Col();++col) + { + if (nSize > nMax) + { + return sal_True; + } + ScMyAddress cell(col,nMaxRow,pSrc->aStart.Tab()); + if(!pDest->In(cell)) + {//In Src ,Not In Dest + vecRet.push_back(cell); + ++nSize; + } + } + } + } + return sal_False; +} +//In Src , Not in Dest +sal_Bool ScAccessibleSpreadsheet::CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet) +{ + if (pSrc == NULL || pDest == NULL) + { + return sal_False; + } + int nSize =0; + if (pDest->GetCellCount() == 0)//if the Dest Rang List is empty + { + if (pSrc->GetCellCount() > sal_uInt32(nMax))//if the Src Cell count is greater then nMax + { + return sal_True; + } + //now the cell count is less then nMax + vecRet.reserve(10); + ScRange* pRange = pSrc->First(); + while (pRange) + { + for (sal_Int32 row = pRange->aStart.Row(); row <= pRange->aEnd.Row();++row) + { + for (sal_uInt16 col = pRange->aStart.Col(); col <= pRange->aEnd.Col();++col) + { + vecRet.push_back(ScMyAddress(col,row,pRange->aStart.Tab())); + } + } + pRange = pSrc->Next(); + } + return sal_False; + } + //the Dest Rang List is not empty + vecRet.reserve(10); + ScRange* pRange = pSrc->First(); + while (pRange) + { + ScRange* pRangeDest = pDest->First(); + while (pRangeDest) + { + if (CalcScRangeDifferenceMax(pRange,pRangeDest,nMax,vecRet,nSize)) + { + return sal_True; + } + pRangeDest = pDest->Next(); + } + pRange = pSrc->Next(); + } + return sal_False; +} +//-----IAccessibility2 Implementation 2009 //===== internal ============================================================ ScAccessibleSpreadsheet::ScAccessibleSpreadsheet( @@ -66,7 +266,13 @@ ScAccessibleSpreadsheet::ScAccessibleSpreadsheet( : ScAccessibleTableBase (pAccDoc, GetDocument(pViewShell), ScRange(ScAddress(0, 0, nTab),ScAddress(MAXCOL, MAXROW, nTab))), - mbIsSpreadsheet( sal_True ) + mbIsSpreadsheet( sal_True ), +//IAccessibility2 Implementation 2009----- + m_bFormulaMode(sal_False), + m_bFormulaLastMode(sal_False), + m_pAccFormulaCell(NULL), + m_nMinX(0),m_nMaxX(0),m_nMinY(0),m_nMaxY(0) +//-----IAccessibility2 Implementation 2009 { ConstructScAccessibleSpreadsheet( pAccDoc, pViewShell, nTab, eSplitPos ); } @@ -83,8 +289,10 @@ ScAccessibleSpreadsheet::~ScAccessibleSpreadsheet() { if (mpMarkedRanges) delete mpMarkedRanges; - if (mpSortedMarkedCells) - delete mpSortedMarkedCells; +//IAccessibility2 Implementation 2009----- + //if (mpSortedMarkedCells) + // delete mpSortedMarkedCells; +//-----IAccessibility2 Implementation 2009 if (mpViewShell) mpViewShell->RemoveAccessibilityObject(*this); } @@ -118,6 +326,13 @@ void ScAccessibleSpreadsheet::ConstructScAccessibleSpreadsheet( mpAccCell = GetAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col()); mpAccCell->acquire(); mpAccCell->Init(); + //IAccessibility2 Implementation 2009----- + ScDocument* pScDoc= GetDocument(mpViewShell); + if (pScDoc) + { + pScDoc->GetName( maActiveCell.Tab(), m_strOldTabName ); + } + //-----IAccessibility2 Implementation 2009 } } @@ -140,11 +355,18 @@ void SAL_CALL ScAccessibleSpreadsheet::disposing() void ScAccessibleSpreadsheet::CompleteSelectionChanged(sal_Bool bNewState) { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return ; + } +//-----IAccessibility2 Implementation 2009 if (mpMarkedRanges) DELETEZ(mpMarkedRanges); - if (mpSortedMarkedCells) - DELETEZ(mpSortedMarkedCells); - +//IAccessibility2 Implementation 2009----- + //if (mpSortedMarkedCells) + // DELETEZ(mpSortedMarkedCells); +//-----IAccessibility2 Implementation 2009 mbHasSelection = bNewState; AccessibleEventObject aEvent; @@ -173,12 +395,46 @@ void ScAccessibleSpreadsheet::LostFocus() void ScAccessibleSpreadsheet::GotFocus() { - CommitFocusGained(); - +//IAccessibility2 Implementation 2009----- + //CommitFocusGained(); +//-----IAccessibility2 Implementation 2009 AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; aEvent.Source = uno::Reference< XAccessibleContext >(this); - uno::Reference< XAccessible > xNew = mpAccCell; +//IAccessibility2 Implementation 2009----- + //uno::Reference< XAccessible > xNew = mpAccCell; + uno::Reference< XAccessible > xNew; + if (IsFormulaMode()) + { + if (!m_pAccFormulaCell || !m_bFormulaLastMode) + { + ScAddress aFormulaAddr; + if(!GetFormulaCurrentFocusCell(aFormulaAddr)) + { + return; + } + m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(),aFormulaAddr.Col()); + + m_pAccFormulaCell->acquire(); + m_pAccFormulaCell->Init(); + + + } + xNew = m_pAccFormulaCell; + } + else + { + if(mpAccCell->GetCellAddress() == maActiveCell) + { + xNew = mpAccCell; + } + else + { + CommitFocusCell(maActiveCell); + return ; + } + } +//-----IAccessibility2 Implementation 2009 aEvent.NewValue <<= xNew; CommitChange(aEvent); @@ -210,58 +466,247 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint { const SfxSimpleHint& rRef = (const SfxSimpleHint&)rHint; // only notify if child exist, otherwise it is not necessary +//IAccessibility2 Implementation 2009----- + //if ((rRef.GetId() == SC_HINT_ACC_CURSORCHANGED)) + //{ + // if (mpViewShell) + // { + // ScAddress aNewCell = mpViewShell->GetViewData()->GetCurPos(); + // sal_Bool bNewMarked(mpViewShell->GetViewData()->GetMarkData().GetTableSelect(aNewCell.Tab()) && + // (mpViewShell->GetViewData()->GetMarkData().IsMarked() || + // mpViewShell->GetViewData()->GetMarkData().IsMultiMarked())); + // sal_Bool bNewCellSelected(isAccessibleSelected(aNewCell.Row(), aNewCell.Col())); + // if ((bNewMarked != mbHasSelection) || + // (!bNewCellSelected && bNewMarked) || + // (bNewCellSelected && mbHasSelection)) + // { + // if (mpMarkedRanges) + // DELETEZ(mpMarkedRanges); + // if (mpSortedMarkedCells) + // DELETEZ(mpSortedMarkedCells); + // AccessibleEventObject aEvent; + // aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; + // aEvent.Source = uno::Reference< XAccessibleContext >(this); + + // mbHasSelection = bNewMarked; + + // CommitChange(aEvent); + // } + + // // active descendant changed event (new cell selected) + // bool bFireActiveDescChanged = (aNewCell != maActiveCell) && + // (aNewCell.Tab() == maActiveCell.Tab()) && IsFocused(); + + // /* Remember old active cell and set new active cell. + // #i82409# always update the class members mpAccCell and + // maActiveCell, even if the sheet is not focused, e.g. when + // using the name box in the toolbar. */ + // uno::Reference< XAccessible > xOld = mpAccCell; + // mpAccCell->release(); + // mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col()); + // mpAccCell->acquire(); + // mpAccCell->Init(); + // uno::Reference< XAccessible > xNew = mpAccCell; + // maActiveCell = aNewCell; + + // // #i14108# fire event only if sheet is focused + // if( bFireActiveDescChanged ) + // { + // AccessibleEventObject aEvent; + // aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; + // aEvent.Source = uno::Reference< XAccessibleContext >(this); + // aEvent.OldValue <<= xOld; + // aEvent.NewValue <<= xNew; + // CommitChange(aEvent); + // } + // } + //} + //else if ((rRef.GetId() == SC_HINT_DATACHANGED)) + //{ + // if (!mbDelIns) + // CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE); + // else + // mbDelIns = sal_False; + //} if ((rRef.GetId() == SC_HINT_ACC_CURSORCHANGED)) { if (mpViewShell) { - ScAddress aNewCell = mpViewShell->GetViewData()->GetCurPos(); - sal_Bool bNewMarked(mpViewShell->GetViewData()->GetMarkData().GetTableSelect(aNewCell.Tab()) && - (mpViewShell->GetViewData()->GetMarkData().IsMarked() || - mpViewShell->GetViewData()->GetMarkData().IsMultiMarked())); - sal_Bool bNewCellSelected(isAccessibleSelected(aNewCell.Row(), aNewCell.Col())); - if ((bNewMarked != mbHasSelection) || - (!bNewCellSelected && bNewMarked) || - (bNewCellSelected && mbHasSelection)) - { - if (mpMarkedRanges) - DELETEZ(mpMarkedRanges); - if (mpSortedMarkedCells) - DELETEZ(mpSortedMarkedCells); - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; - aEvent.Source = uno::Reference< XAccessibleContext >(this); + ScViewData *pViewData = mpViewShell->GetViewData(); - mbHasSelection = bNewMarked; + m_bFormulaMode = pViewData->IsRefMode() || SC_MOD()->IsFormulaMode(); + if ( m_bFormulaMode ) + { + NotifyRefMode(); + m_bFormulaLastMode = true; + return ; + } + if (m_bFormulaLastMode) + {//Last Notify Mode Is Formula Mode. + m_vecFormulaLastMyAddr.clear(); + RemoveFormulaSelection(sal_True); + if(m_pAccFormulaCell) + { + m_pAccFormulaCell->release(); + m_pAccFormulaCell =NULL; + } + //Remove All Selection + } + m_bFormulaLastMode = m_bFormulaMode; + AccessibleEventObject aEvent; + aEvent.Source = uno::Reference< XAccessible >(this); + ScAddress aNewCell = pViewData->GetCurPos(); + if(aNewCell.Tab() != maActiveCell.Tab()) + { + aEvent.EventId = AccessibleEventId::PAGE_CHANGED; + ScAccessibleDocument *pAccDoc = + static_cast<ScAccessibleDocument*>(getAccessibleParent().get()); + if(pAccDoc) + { + pAccDoc->CommitChange(aEvent); + } + } + sal_Bool bNewPosCell = (aNewCell != maActiveCell); + sal_Bool bNewPosCellFocus=sal_False; + if ( bNewPosCell && IsFocused() && aNewCell.Tab() == maActiveCell.Tab() ) + {//single Focus + bNewPosCellFocus=sal_True; + } + ScMarkData &refScMarkData = pViewData->GetMarkData(); + // MT IA2: Not used + // int nSelCount = refScMarkData.GetSelectCount(); + sal_Bool bIsMark =refScMarkData.IsMarked(); + sal_Bool bIsMultMark = refScMarkData.IsMultiMarked(); + sal_Bool bNewMarked = refScMarkData.GetTableSelect(aNewCell.Tab()) && ( bIsMark || bIsMultMark ); +// sal_Bool bNewCellSelected = isAccessibleSelected(aNewCell.Row(), aNewCell.Col()); + sal_uInt16 nTab = pViewData->GetTabNo(); + ScRange aMarkRange; + refScMarkData.GetMarkArea(aMarkRange); + aEvent.OldValue <<= ::com::sun::star::uno::Any(); + //Mark All + if ( !bNewPosCellFocus && + (bNewMarked || bIsMark || bIsMultMark ) && + aMarkRange == ScRange( 0,0,nTab, MAXCOL,MAXROW,nTab ) ) + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + aEvent.NewValue <<= ::com::sun::star::uno::Any(); CommitChange(aEvent); + return ; } + if (!mpMarkedRanges) + { + mpMarkedRanges = new ScRangeList(); + } + refScMarkData.FillRangeListWithMarks(mpMarkedRanges, sal_True); - // active descendant changed event (new cell selected) - bool bFireActiveDescChanged = (aNewCell != maActiveCell) && - (aNewCell.Tab() == maActiveCell.Tab()) && IsFocused(); - - /* Remember old active cell and set new active cell. - #i82409# always update the class members mpAccCell and - maActiveCell, even if the sheet is not focused, e.g. when - using the name box in the toolbar. */ - uno::Reference< XAccessible > xOld = mpAccCell; - mpAccCell->release(); - mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col()); - mpAccCell->acquire(); - mpAccCell->Init(); - uno::Reference< XAccessible > xNew = mpAccCell; - maActiveCell = aNewCell; - - // #i14108# fire event only if sheet is focused - if( bFireActiveDescChanged ) + //For Whole Col Row + sal_Bool bWholeRow = ::labs(aMarkRange.aStart.Row() - aMarkRange.aEnd.Row()) == MAXROW ; + sal_Bool bWholeCol = ::abs(aMarkRange.aStart.Col() - aMarkRange.aEnd.Col()) == MAXCOL ; + if ((bNewMarked || bIsMark || bIsMultMark ) && (bWholeCol || bWholeRow)) { - AccessibleEventObject aEvent; - aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; - aEvent.Source = uno::Reference< XAccessibleContext >(this); - aEvent.OldValue <<= xOld; - aEvent.NewValue <<= xNew; + if ( aMarkRange != m_aLastWithInMarkRange ) + { + RemoveSelection(refScMarkData); + if(bNewPosCell) + { + CommitFocusCell(aNewCell); + } + sal_Bool bLastIsWholeColRow = + ::labs(m_aLastWithInMarkRange.aStart.Row() - m_aLastWithInMarkRange.aEnd.Row()) == MAXROW && bWholeRow || + ::abs(m_aLastWithInMarkRange.aStart.Col() - m_aLastWithInMarkRange.aEnd.Col()) == MAXCOL && bWholeCol ; + sal_Bool bSelSmaller= + bLastIsWholeColRow && + !aMarkRange.In(m_aLastWithInMarkRange) && + aMarkRange.Intersects(m_aLastWithInMarkRange); + if( !bSelSmaller ) + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + aEvent.NewValue <<= ::com::sun::star::uno::Any(); + CommitChange(aEvent); + } + m_aLastWithInMarkRange = aMarkRange; + } + return ; + } + m_aLastWithInMarkRange = aMarkRange; + int nNewMarkCount = mpMarkedRanges->GetCellCount(); + sal_Bool bSendSingle= (0 == nNewMarkCount) && bNewPosCell; + if (bSendSingle) + { + RemoveSelection(refScMarkData); + if(bNewPosCellFocus) + { + CommitFocusCell(aNewCell); + } + uno::Reference< XAccessible > xChild ; + if (bNewPosCellFocus) + { + xChild = mpAccCell; + } + else + { + xChild = getAccessibleCellAt(aNewCell.Row(),aNewCell.Col()); + + maActiveCell = aNewCell; + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS; + aEvent.NewValue <<= xChild; + aEvent.OldValue <<= uno::Reference< XAccessible >(); + CommitChange(aEvent); + } + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; + aEvent.NewValue <<= xChild; CommitChange(aEvent); + OSL_ASSERT(m_mapSelectionSend.count(aNewCell) == 0 ); + m_mapSelectionSend.insert(MAP_ADDR_XACC::value_type(aNewCell,xChild)); + + } + else + { + ScRange aDelRange; + sal_Bool bIsDel = pViewData->GetDelMark( aDelRange ); + if ( (!bIsDel || (bIsDel && aMarkRange != aDelRange)) && + bNewMarked && + nNewMarkCount > 0 && + !IsSameMarkCell() ) + { + RemoveSelection(refScMarkData); + if(bNewPosCellFocus) + { + CommitFocusCell(aNewCell); + } + VEC_MYADDR vecNew; + if(CalcScRangeListDifferenceMax(mpMarkedRanges,&m_LastMarkedRanges,10,vecNew)) + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + aEvent.NewValue <<= ::com::sun::star::uno::Any(); + CommitChange(aEvent); + } + else + { + VEC_MYADDR::iterator viAddr = vecNew.begin(); + for(; viAddr < vecNew.end() ; ++viAddr ) + { + uno::Reference< XAccessible > xChild = getAccessibleCellAt(viAddr->Row(),viAddr->Col()); + if (!(bNewPosCellFocus && *viAddr == aNewCell) ) + { + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS; + aEvent.NewValue <<= xChild; + CommitChange(aEvent); + } + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; + aEvent.NewValue <<= xChild; + CommitChange(aEvent); + m_mapSelectionSend.insert(MAP_ADDR_XACC::value_type(*viAddr,xChild)); + } + } + } + } + if (bNewPosCellFocus && maActiveCell != aNewCell) + { + CommitFocusCell(aNewCell); } + m_LastMarkedRanges = *mpMarkedRanges; } } else if ((rRef.GetId() == SC_HINT_DATACHANGED)) @@ -270,7 +715,41 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE); else mbDelIns = sal_False; + ScViewData *pViewData = mpViewShell->GetViewData(); + ScAddress aNewCell = pViewData->GetCurPos(); + if( maActiveCell == aNewCell) + { + ScDocument* pScDoc= GetDocument(mpViewShell); + if (pScDoc) + { + String valStr; + pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab(), valStr); + if(m_strCurCellValue != valStr) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::VALUE_CHANGED; + mpAccCell->CommitChange(aEvent); + m_strCurCellValue=valStr; + } + String tabName; + pScDoc->GetName( maActiveCell.Tab(), tabName ); + if( m_strOldTabName != tabName ) + { + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::NAME_CHANGED; + String sOldName(ScResId(STR_ACC_TABLE_NAME)); + sOldName.SearchAndReplaceAscii("%1", m_strOldTabName); + aEvent.OldValue <<= ::rtl::OUString( sOldName ); + String sNewName(ScResId(STR_ACC_TABLE_NAME)); + sNewName.SearchAndReplaceAscii("%1", tabName); + aEvent.NewValue <<= ::rtl::OUString( sNewName ); + CommitChange( aEvent ); + m_strOldTabName = tabName; + } + } + } } +//-----IAccessibility2 Implementation 2009 // no longer needed, because the document calls the VisAreaChanged method /* else if (rRef.GetId() == SC_HINT_ACC_VISAREACHANGED) { @@ -371,7 +850,62 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ScAccessibleTableBase::Notify(rBC, rHint); } - +//IAccessibility2 Implementation 2009----- +void ScAccessibleSpreadsheet::RemoveSelection(ScMarkData &refScMarkData) +{ + AccessibleEventObject aEvent; + aEvent.Source = uno::Reference< XAccessible >(this); + aEvent.OldValue <<= ::com::sun::star::uno::Any(); + MAP_ADDR_XACC::iterator miRemove = m_mapSelectionSend.begin(); + for(; miRemove != m_mapSelectionSend.end() ;) + { + if (refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row(),sal_True) || + refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row(),sal_False) ) + { + ++miRemove; + continue; + } + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; + aEvent.NewValue <<= miRemove->second; + CommitChange(aEvent); + MAP_ADDR_XACC::iterator miNext = miRemove; + ++miNext; + m_mapSelectionSend.erase(miRemove); + miRemove = miNext; + } +} +void ScAccessibleSpreadsheet::CommitFocusCell(const ScAddress &aNewCell) +{ + OSL_ASSERT(!IsFormulaMode()); + if(IsFormulaMode()) + { + return ; + } + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; + aEvent.Source = uno::Reference< XAccessible >(this); + uno::Reference< XAccessible > xOld = mpAccCell; + mpAccCell->release(); + mpAccCell=NULL; + aEvent.OldValue <<= xOld; + mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col()); + mpAccCell->acquire(); + mpAccCell->Init(); + uno::Reference< XAccessible > xNew = mpAccCell; + aEvent.NewValue <<= xNew; + maActiveCell = aNewCell; + ScDocument* pScDoc= GetDocument(mpViewShell); + if (pScDoc) + { + pScDoc->GetString(maActiveCell.Col(),maActiveCell.Row(),maActiveCell.Tab(), m_strCurCellValue); + } + CommitChange(aEvent); +} +sal_Bool ScAccessibleSpreadsheet::IsSameMarkCell() +{ + return m_LastMarkedRanges == *mpMarkedRanges; +} +//-----IAccessibility2 Implementation 2009 //===== XAccessibleTable ================================================ uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleRowHeaders( ) @@ -418,6 +952,12 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib ScUnoGuard aGuard; IsObjectValid(); uno::Sequence<sal_Int32> aSequence; +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return aSequence; + } +//-----IAccessibility2 Implementation 2009 if (mpViewShell && mpViewShell->GetViewData()) { aSequence.realloc(maRange.aEnd.Row() - maRange.aStart.Row() + 1); @@ -445,6 +985,12 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib ScUnoGuard aGuard; IsObjectValid(); uno::Sequence<sal_Int32> aSequence; +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return aSequence; + } +//-----IAccessibility2 Implementation 2009 if (mpViewShell && mpViewShell->GetViewData()) { aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1); @@ -471,6 +1017,12 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleRowSelected( sal_Int32 nR { ScUnoGuard aGuard; IsObjectValid(); +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return sal_False; + } +//-----IAccessibility2 Implementation 2009 if ((nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0)) throw lang::IndexOutOfBoundsException(); @@ -490,6 +1042,12 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32 ScUnoGuard aGuard; IsObjectValid(); +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return sal_False; + } +//-----IAccessibility2 Implementation 2009 if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0)) throw lang::IndexOutOfBoundsException(); @@ -505,6 +1063,20 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32 ScAccessibleCell* ScAccessibleSpreadsheet::GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn) { ScAccessibleCell* pAccessibleCell = NULL; +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + ScAddress aCellAddress(static_cast<SCCOL>(nColumn), nRow, mpViewShell->GetViewData()->GetTabNo()); + if ((aCellAddress == m_aFormulaActiveCell) && m_pAccFormulaCell) + { + pAccessibleCell = m_pAccFormulaCell; + } + else + pAccessibleCell = new ScAccessibleCell(this, mpViewShell, aCellAddress, GetAccessibleIndexFormula(nRow, nColumn), meSplitPos, mpAccDoc); + } + else + { +//-----IAccessibility2 Implementation 2009 ScAddress aCellAddress(static_cast<SCCOL>(maRange.aStart.Col() + nColumn), static_cast<SCROW>(maRange.aStart.Row() + nRow), maRange.aStart.Tab()); if ((aCellAddress == maActiveCell) && mpAccCell) @@ -513,6 +1085,7 @@ ScAccessibleCell* ScAccessibleSpreadsheet::GetAccessibleCellAt(sal_Int32 nRow, s } else pAccessibleCell = new ScAccessibleCell(this, mpViewShell, aCellAddress, getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc); + } return pAccessibleCell; } @@ -522,12 +1095,16 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleCel { ScUnoGuard aGuard; IsObjectValid(); +//IAccessibility2 Implementation 2009----- + if (!IsFormulaMode()) + { if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) || nRow < 0 || nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) || nColumn < 0) throw lang::IndexOutOfBoundsException(); - + } +//-----IAccessibility2 Implementation 2009 uno::Reference<XAccessible> xAccessible; ScAccessibleCell* pAccessibleCell = GetAccessibleCellAt(nRow, nColumn); xAccessible = pAccessibleCell; @@ -541,6 +1118,13 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleSelected( sal_Int32 nRow, ScUnoGuard aGuard; IsObjectValid(); +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + ScAddress addr(static_cast<SCCOL>(nColumn), nRow, 0); + return IsScAddrFormulaSel(addr); + } +//-----IAccessibility2 Implementation 2009 if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0) || (nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0)) throw lang::IndexOutOfBoundsException(); @@ -570,7 +1154,15 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleAtP SCsCOL nX; SCsROW nY; mpViewShell->GetViewData()->GetPosFromPixel( rPoint.X, rPoint.Y, meSplitPos, nX, nY); +//IAccessibility2 Implementation 2009----- + try{ xAccessible = getAccessibleCellAt(nY, nX); + } + catch( ::com::sun::star::lang::IndexOutOfBoundsException e) + { + return NULL; + } +//-----IAccessibility2 Implementation 2009 } } return xAccessible; @@ -678,6 +1270,9 @@ void SAL_CALL IsObjectValid(); if (mpViewShell) { +//IAccessibility2 Implementation 2009----- + if (!IsFormulaMode()) +//-----IAccessibility2 Implementation 2009 mpViewShell->Unmark(); } } @@ -690,6 +1285,17 @@ void SAL_CALL IsObjectValid(); if (mpViewShell) { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + ScViewData *pViewData = mpViewShell->GetViewData(); + mpViewShell->InitRefMode( 0, 0, pViewData->GetTabNo(), SC_REFTYPE_REF ); + pViewData->SetRefStart(0,0,pViewData->GetTabNo()); + pViewData->SetRefStart(MAXCOL,MAXROW,pViewData->GetTabNo()); + mpViewShell->UpdateRef(MAXCOL, MAXROW, pViewData->GetTabNo()); + } + else +//-----IAccessibility2 Implementation 2009 mpViewShell->SelectAll(); } } @@ -703,16 +1309,27 @@ sal_Int32 SAL_CALL sal_Int32 nResult(0); if (mpViewShell) { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + nResult = GetRowAll() * GetColAll() ; + } + else + { +//-----IAccessibility2 Implementation 2009 if (!mpMarkedRanges) { mpMarkedRanges = new ScRangeList(); ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData()); - aMarkData.MarkToMulti(); +//IAccessibility2 Implementation 2009----- + //aMarkData.MarkToMulti(); +//-----IAccessibility2 Implementation 2009 aMarkData.FillRangeListWithMarks(mpMarkedRanges, sal_False); } // is possible, because there shouldn't be overlapped ranges in it if (mpMarkedRanges) nResult = mpMarkedRanges->GetCellCount(); + } } return nResult; } @@ -724,6 +1341,17 @@ uno::Reference<XAccessible > SAL_CALL ScUnoGuard aGuard; IsObjectValid(); uno::Reference < XAccessible > xAccessible; +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + if(CheckChildIndex(nSelectedChildIndex)) + { + ScAddress addr = GetChildIndexAddress(nSelectedChildIndex); + xAccessible = getAccessibleCellAt(addr.Row(), addr.Col()); + } + return xAccessible; + } +//-----IAccessibility2 Implementation 2009 if (mpViewShell) { if (!mpMarkedRanges) @@ -733,16 +1361,27 @@ uno::Reference<XAccessible > SAL_CALL } if (mpMarkedRanges) { - if (!mpSortedMarkedCells) - CreateSortedMarkedCells(); - if (mpSortedMarkedCells) +//IAccessibility2 Implementation 2009----- + //if (!mpSortedMarkedCells) + // CreateSortedMarkedCells(); + //if (mpSortedMarkedCells) + //{ + // if ((nSelectedChildIndex < 0) || + // (mpSortedMarkedCells->size() <= static_cast<sal_uInt32>(nSelectedChildIndex))) + // throw lang::IndexOutOfBoundsException(); + // else + // xAccessible = getAccessibleCellAt((*mpSortedMarkedCells)[nSelectedChildIndex].Row(), (*mpSortedMarkedCells)[nSelectedChildIndex].Col()); + if ((nSelectedChildIndex < 0) || + (mpMarkedRanges->GetCellCount() <= static_cast<sal_uInt32>(nSelectedChildIndex))) { - if ((nSelectedChildIndex < 0) || - (mpSortedMarkedCells->size() <= static_cast<sal_uInt32>(nSelectedChildIndex))) - throw lang::IndexOutOfBoundsException(); - else - xAccessible = getAccessibleCellAt((*mpSortedMarkedCells)[nSelectedChildIndex].Row(), (*mpSortedMarkedCells)[nSelectedChildIndex].Col()); + throw lang::IndexOutOfBoundsException(); } + ScMyAddress addr = CalcScAddressFromRangeList(mpMarkedRanges,nSelectedChildIndex); + if( m_mapSelectionSend.find(addr) != m_mapSelectionSend.end() ) + xAccessible = m_mapSelectionSend[addr]; + else + xAccessible = getAccessibleCellAt(addr.Row(), addr.Col()); +//-----IAccessibility2 Implementation 2009 } } return xAccessible; @@ -763,6 +1402,18 @@ void SAL_CALL sal_Int32 nCol(getAccessibleColumn(nChildIndex)); sal_Int32 nRow(getAccessibleRow(nChildIndex)); +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + if(IsScAddrFormulaSel( + ScAddress(static_cast<SCCOL>(nCol), nRow,mpViewShell->GetViewData()->GetTabNo())) + ) + { + SelectCell(nRow, nCol, sal_True); + } + return ; + } +//-----IAccessibility2 Implementation 2009 if (mpViewShell->GetViewData()->GetMarkData().IsCellMarked(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow))) SelectCell(nRow, nCol, sal_True); } @@ -770,48 +1421,65 @@ void SAL_CALL void ScAccessibleSpreadsheet::SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect) { - mpViewShell->SetTabNo( maRange.aStart.Tab() ); - - mpViewShell->DoneBlockMode( sal_True ); // continue selecting - mpViewShell->InitBlockMode( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), maRange.aStart.Tab(), bDeselect, sal_False, sal_False ); - - mpViewShell->SelectionChanged(); -} - -void ScAccessibleSpreadsheet::CreateSortedMarkedCells() -{ - mpSortedMarkedCells = new std::vector<ScMyAddress>(); - mpSortedMarkedCells->reserve(mpMarkedRanges->GetCellCount()); - ScRange* pRange = mpMarkedRanges->First(); - while (pRange) +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) { - if (pRange->aStart.Tab() != pRange->aEnd.Tab()) - { - if ((maActiveCell.Tab() >= pRange->aStart.Tab()) || - maActiveCell.Tab() <= pRange->aEnd.Tab()) - { - ScRange aRange(*pRange); - aRange.aStart.SetTab(maActiveCell.Tab()); - aRange.aEnd.SetTab(maActiveCell.Tab()); - AddMarkedRange(aRange); - } - else - { - DBG_ERROR("Range of wrong table"); - } + if (bDeselect) + {//?? + return ; } - else if(pRange->aStart.Tab() == maActiveCell.Tab()) - AddMarkedRange(*pRange); else { - DBG_ERROR("Range of wrong table"); + ScViewData *pViewData = mpViewShell->GetViewData(); + + mpViewShell->InitRefMode( static_cast<SCCOL>(nCol), nRow, pViewData->GetTabNo(), SC_REFTYPE_REF ); + mpViewShell->UpdateRef(static_cast<SCCOL>(nCol), nRow, pViewData->GetTabNo()); } - pRange = mpMarkedRanges->Next(); + return ; } - std::sort(mpSortedMarkedCells->begin(), mpSortedMarkedCells->end()); -} +//-----IAccessibility2 Implementation 2009 + mpViewShell->SetTabNo( maRange.aStart.Tab() ); -void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange) + mpViewShell->DoneBlockMode( sal_True ); // continue selecting + mpViewShell->InitBlockMode( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), maRange.aStart.Tab(), bDeselect, sal_False, sal_False ); + + mpViewShell->SelectionChanged(); +} +//IAccessibility2 Implementation 2009----- +//void ScAccessibleSpreadsheet::CreateSortedMarkedCells() +//{ +// mpSortedMarkedCells = new std::vector<ScMyAddress>(); +// mpSortedMarkedCells->reserve(mpMarkedRanges->GetCellCount()); +// ScRange* pRange = mpMarkedRanges->First(); +// while (pRange) +// { +// if (pRange->aStart.Tab() != pRange->aEnd.Tab()) +// { +// if ((maActiveCell.Tab() >= pRange->aStart.Tab()) || +// maActiveCell.Tab() <= pRange->aEnd.Tab()) +// { +// ScRange aRange(*pRange); +// aRange.aStart.SetTab(maActiveCell.Tab()); +// aRange.aEnd.SetTab(maActiveCell.Tab()); +// AddMarkedRange(aRange); +// } +// else +// { +// DBG_ERROR("Range of wrong table"); +// } +// } +// else if(pRange->aStart.Tab() == maActiveCell.Tab()) +// AddMarkedRange(*pRange); +// else +// { +// DBG_ERROR("Range of wrong table"); +// } +// pRange = mpMarkedRanges->Next(); +// } +// std::sort(mpSortedMarkedCells->begin(), mpSortedMarkedCells->end()); +//} + +/*void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange) { for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow) { @@ -821,7 +1489,8 @@ void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange) mpSortedMarkedCells->push_back(aCell); } } -} +}*/ +//-----IAccessibility2 Implementation 2009 //===== XServiceInfo ==================================================== @@ -871,7 +1540,8 @@ void SAL_CALL ScAccessibleSpreadsheet::addEventListener(const uno::Reference<XAc IsObjectValid(); ScAccessibleTableBase::addEventListener(xListener); - if (!mbIsFocusSend) +//IAccessibility2 Implementation 2009----- +/* if (!mbIsFocusSend) { mbIsFocusSend = sal_True; CommitFocusGained(); @@ -883,6 +1553,8 @@ void SAL_CALL ScAccessibleSpreadsheet::addEventListener(const uno::Reference<XAc CommitChange(aEvent); } +*/ +//-----IAccessibility2 Implementation 2009 } //==== internal ========================================================= @@ -924,6 +1596,12 @@ sal_Bool ScAccessibleSpreadsheet::IsDefunc( sal_Bool ScAccessibleSpreadsheet::IsEditable( const uno::Reference<XAccessibleStateSet>& /* rxParentStates */) { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return sal_False; + } +//-----IAccessibility2 Implementation 2009 sal_Bool bProtected(sal_False); if (mpDoc && mpDoc->IsTabProtected(maRange.aStart.Tab())) bProtected = sal_True; @@ -943,6 +1621,12 @@ sal_Bool ScAccessibleSpreadsheet::IsFocused() sal_Bool ScAccessibleSpreadsheet::IsCompleteSheetSelected() { +//IAccessibility2 Implementation 2009----- + if (IsFormulaMode()) + { + return sal_False; + } +//-----IAccessibility2 Implementation 2009 sal_Bool bResult(sal_False); if(mpViewShell) { @@ -993,3 +1677,277 @@ Rectangle ScAccessibleSpreadsheet::GetVisCells(const Rectangle& rVisArea) else return Rectangle(); } +//IAccessibility2 Implementation 2009----- +sal_Bool SAL_CALL ScAccessibleSpreadsheet::selectRow( sal_Int32 row ) +throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if (IsFormulaMode()) + { + return sal_False; + } + + mpViewShell->SetTabNo( maRange.aStart.Tab() ); + mpViewShell->DoneBlockMode( sal_True ); // continue selecting + mpViewShell->InitBlockMode( 0, row, maRange.aStart.Tab(), sal_False, sal_False, sal_True ); + mpViewShell->MarkCursor( MAXCOL, row, maRange.aStart.Tab(), sal_False, sal_True ); + mpViewShell->SelectionChanged(); + return sal_True; +} + +sal_Bool SAL_CALL ScAccessibleSpreadsheet::selectColumn( sal_Int32 column ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if (IsFormulaMode()) + { + return sal_False; + } + + mpViewShell->SetTabNo( maRange.aStart.Tab() ); + mpViewShell->DoneBlockMode( sal_True ); // continue selecting + mpViewShell->InitBlockMode( static_cast<SCCOL>(column), 0, maRange.aStart.Tab(), sal_False, sal_True, sal_False ); + mpViewShell->MarkCursor( static_cast<SCCOL>(column), MAXROW, maRange.aStart.Tab(), sal_True, sal_False ); + mpViewShell->SelectionChanged(); + return sal_True; +} + +sal_Bool SAL_CALL ScAccessibleSpreadsheet::unselectRow( sal_Int32 row ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if (IsFormulaMode()) + { + return sal_False; + } + + mpViewShell->SetTabNo( maRange.aStart.Tab() ); + mpViewShell->DoneBlockMode( sal_True ); // continue selecting + mpViewShell->InitBlockMode( 0, row, maRange.aStart.Tab(), sal_False, sal_False, sal_True, sal_True ); + mpViewShell->MarkCursor( MAXCOL, row, maRange.aStart.Tab(), sal_False, sal_True ); + mpViewShell->SelectionChanged(); + mpViewShell->DoneBlockMode( sal_True ); + return sal_True; +} + +sal_Bool SAL_CALL ScAccessibleSpreadsheet::unselectColumn( sal_Int32 column ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if (IsFormulaMode()) + { + return sal_False; + } + + mpViewShell->SetTabNo( maRange.aStart.Tab() ); + mpViewShell->DoneBlockMode( sal_True ); // continue selecting + mpViewShell->InitBlockMode( static_cast<SCCOL>(column), 0, maRange.aStart.Tab(), sal_False, sal_True, sal_False, sal_True ); + mpViewShell->MarkCursor( static_cast<SCCOL>(column), MAXROW, maRange.aStart.Tab(), sal_True, sal_False ); + mpViewShell->SelectionChanged(); + mpViewShell->DoneBlockMode( sal_True ); + return sal_True; +} + +void ScAccessibleSpreadsheet::FireFirstCellFocus() +{ + if (IsFormulaMode()) + { + return ; + } + if (mbIsFocusSend) + { + return ; + } + mbIsFocusSend = sal_True; + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; + aEvent.Source = uno::Reference< XAccessible >(this); + aEvent.NewValue <<= getAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col()); + CommitChange(aEvent); +} +void ScAccessibleSpreadsheet::NotifyRefMode() +{ + ScViewData *pViewData = mpViewShell->GetViewData(); + sal_uInt16 nRefStartX =pViewData->GetRefStartX(); + sal_Int32 nRefStartY=pViewData->GetRefStartY(); + sal_uInt16 nRefEndX=pViewData->GetRefEndX(); + sal_Int32 nRefEndY=pViewData->GetRefEndY(); + ScAddress aFormulaAddr; + if(!GetFormulaCurrentFocusCell(aFormulaAddr)) + { + return ; + } + if (m_aFormulaActiveCell != aFormulaAddr) + {//New Focus + m_nMinX =std::min(nRefStartX,nRefEndX); + m_nMaxX =std::max(nRefStartX,nRefEndX); + m_nMinY = std::min(nRefStartY,nRefEndY); + m_nMaxY = std::max(nRefStartY,nRefEndY); + RemoveFormulaSelection(); + AccessibleEventObject aEvent; + aEvent.Source = uno::Reference< XAccessible >(this); + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED; + aEvent.Source = uno::Reference< XAccessible >(this); + uno::Reference< XAccessible > xOld = m_pAccFormulaCell; + aEvent.OldValue <<= xOld; + m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(), aFormulaAddr.Col()); + m_pAccFormulaCell->acquire(); + m_pAccFormulaCell->Init(); + uno::Reference< XAccessible > xNew = m_pAccFormulaCell; + aEvent.NewValue <<= xNew; + CommitChange(aEvent); + if (nRefStartX == nRefEndX && nRefStartY == nRefEndY) + {//Selection Single + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED; + aEvent.NewValue <<= xNew; + CommitChange(aEvent); + m_mapFormulaSelectionSend.insert(MAP_ADDR_XACC::value_type(aFormulaAddr,xNew)); + m_vecFormulaLastMyAddr.clear(); + m_vecFormulaLastMyAddr.push_back(aFormulaAddr); + } + else + { + VEC_MYADDR vecCurSel; + int nCurSize = (m_nMaxX - m_nMinX +1)*(m_nMaxY - m_nMinY +1) ; + vecCurSel.reserve(nCurSize); + for (sal_uInt16 x = m_nMinX ; x <= m_nMaxX ; ++x) + { + for (sal_Int32 y = m_nMinY ; y <= m_nMaxY ; ++y) + { + ScMyAddress aAddr(x,y,0); + vecCurSel.push_back(aAddr); + } + } + std::sort(vecCurSel.begin(), vecCurSel.end()); + VEC_MYADDR vecNew; + std::set_difference(vecCurSel.begin(),vecCurSel.end(), + m_vecFormulaLastMyAddr.begin(),m_vecFormulaLastMyAddr.end(), + std::back_insert_iterator<VEC_MYADDR>(vecNew)); + int nNewSize = vecNew.size(); + if ( nNewSize > 10 ) + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + aEvent.NewValue <<= ::com::sun::star::uno::Any(); + CommitChange(aEvent); + } + else + { + VEC_MYADDR::iterator viAddr = vecNew.begin(); + for(; viAddr != vecNew.end() ; ++viAddr ) + { + uno::Reference< XAccessible > xChild; + if (*viAddr == aFormulaAddr) + { + xChild = m_pAccFormulaCell; + } + else + { + xChild = getAccessibleCellAt(viAddr->Row(),viAddr->Col()); + aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS; + aEvent.NewValue <<= xChild; + CommitChange(aEvent); + } + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; + aEvent.NewValue <<= xChild; + CommitChange(aEvent); + m_mapFormulaSelectionSend.insert(MAP_ADDR_XACC::value_type(*viAddr,xChild)); + } + } + m_vecFormulaLastMyAddr.swap(vecCurSel); + } + } + m_aFormulaActiveCell = aFormulaAddr; +} +void ScAccessibleSpreadsheet::RemoveFormulaSelection(sal_Bool bRemoveAll ) +{ + AccessibleEventObject aEvent; + aEvent.Source = uno::Reference< XAccessible >(this); + aEvent.OldValue <<= ::com::sun::star::uno::Any(); + MAP_ADDR_XACC::iterator miRemove = m_mapFormulaSelectionSend.begin(); + for(; miRemove != m_mapFormulaSelectionSend.end() ;) + { + if( !bRemoveAll && IsScAddrFormulaSel(miRemove->first) ) + { + ++miRemove; + continue; + } + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; + aEvent.NewValue <<= miRemove->second; + CommitChange(aEvent); + MAP_ADDR_XACC::iterator miNext = miRemove; + ++miNext; + m_mapFormulaSelectionSend.erase(miRemove); + miRemove = miNext; + } +} +sal_Bool ScAccessibleSpreadsheet::IsScAddrFormulaSel(const ScAddress &addr) const +{ + if( addr.Col() >= m_nMinX && addr.Col() <= m_nMaxX && + addr.Row() >= m_nMinY && addr.Row() <= m_nMaxY && + addr.Tab() == mpViewShell->GetViewData()->GetTabNo() ) + { + return sal_True; + } + return sal_False; +} +sal_Bool ScAccessibleSpreadsheet::CheckChildIndex(sal_Int32 nIndex) const +{ + sal_Int32 nMaxIndex = (m_nMaxX - m_nMinX +1)*(m_nMaxY - m_nMinY +1) -1 ; + return nIndex <= nMaxIndex && nIndex >= 0 ; +} +ScAddress ScAccessibleSpreadsheet::GetChildIndexAddress(sal_Int32 nIndex) const +{ + sal_Int32 nRowAll = GetRowAll(); + sal_uInt16 nColAll = GetColAll(); + if (nIndex < 0 || nIndex >= nRowAll * nColAll ) + { + return ScAddress(); + } + return ScAddress( + static_cast<SCCOL>((nIndex - nIndex % nRowAll) / nRowAll + + m_nMinX), + nIndex % nRowAll + m_nMinY, + mpViewShell->GetViewData()->GetTabNo() + ); +} +sal_Int32 ScAccessibleSpreadsheet::GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn ) +{ + sal_uInt16 nColRelative = sal_uInt16(nColumn) - GetColAll(); + sal_Int32 nRowRelative = nRow - GetRowAll(); + if (nRow < 0 || nColumn < 0 || nRowRelative >= GetRowAll() || nColRelative >= GetColAll() ) + { + return -1; + } + return GetRowAll() * nRowRelative + nColRelative; +} +sal_Bool ScAccessibleSpreadsheet::IsFormulaMode() +{ + ScViewData *pViewData = mpViewShell->GetViewData(); + m_bFormulaMode = pViewData->IsRefMode() || SC_MOD()->IsFormulaMode(); + return m_bFormulaMode ; +} +sal_Bool ScAccessibleSpreadsheet::GetFormulaCurrentFocusCell(ScAddress &addr) +{ + ScViewData *pViewData = mpViewShell->GetViewData(); + sal_uInt16 nRefX=0; + sal_Int32 nRefY=0; + if(m_bFormulaLastMode) + { + nRefX=pViewData->GetRefEndX(); + nRefY=pViewData->GetRefEndY(); + } + else + { + nRefX=pViewData->GetRefStartX(); + nRefY=pViewData->GetRefStartY(); + } + if( /* Always true: nRefX >= 0 && */ nRefX <= MAXCOL && nRefY >= 0 && nRefY <= MAXROW) + { + addr = ScAddress(nRefX,nRefY,pViewData->GetTabNo()); + return sal_True; + } + return sal_False; +} +uno::Reference < XAccessible > ScAccessibleSpreadsheet::GetActiveCell() +{ + if( m_mapSelectionSend.find( maActiveCell ) != m_mapSelectionSend.end() ) + return m_mapSelectionSend[maActiveCell]; + else + return getAccessibleCellAt(maActiveCell.Row(), maActiveCell .Col()); +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/sc/source/ui/Accessibility/AccessibleTableBase.cxx index a6e6b740a814..d05b88e725b5 100644 --- a/sc/source/ui/Accessibility/AccessibleTableBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleTableBase.cxx @@ -77,8 +77,23 @@ void SAL_CALL ScAccessibleTableBase::disposing() uno::Any SAL_CALL ScAccessibleTableBase::queryInterface( uno::Type const & rType ) throw (uno::RuntimeException) { - uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType)); - return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType); +//IAccessibility2 Implementation 2009----- + //uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType)); + //return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType); + uno::Any aRet; + if ( rType == ::getCppuType((uno::Reference<XAccessibleTableSelection> *)0) ) + { + uno::Reference<XAccessibleTableSelection> xThis( this ); + aRet <<= xThis; + return aRet; + } + else + { + uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType)); + return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType); + } + return aRet; +//-----IAccessibility2 Implementation 2009 } void SAL_CALL ScAccessibleTableBase::acquire() @@ -153,12 +168,18 @@ sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleRowExtentAt( sal_Int32 nR { SCROW nEndRow(0); SCCOL nEndCol(0); - if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), - nEndCol, nEndRow, maRange.aStart.Tab())) - { - if (nEndRow > nRow) - nCount = nEndRow - nRow + 1; - } +//IAccessibility2 Implementation 2009----- + mpDoc->GetTableByIndex(maRange.aStart.Tab())->GetColumnByIndex(nColumn)-> + ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False, sal_False ); + if (nEndRow > nRow) + nCount = nEndRow - nRow + 1; + // if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), + // nEndCol, nEndRow, maRange.aStart.Tab())) + //{ + // if (nEndRow > nRow) + // nCount = nEndRow - nRow + 1; + //} +//-----IAccessibility2 Implementation 2009 } return nCount; @@ -182,12 +203,18 @@ sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleColumnExtentAt( sal_Int32 { SCROW nEndRow(0); SCCOL nEndCol(0); - if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), - nEndCol, nEndRow, maRange.aStart.Tab())) - { - if (nEndCol > nColumn) +//IAccessibility2 Implementation 2009----- + mpDoc->GetTableByIndex(maRange.aStart.Tab())->GetColumnByIndex(nColumn)-> + ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False, sal_False ); + if (nEndCol > nColumn) nCount = nEndCol - nColumn + 1; - } + // if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), + // nEndCol, nEndRow, maRange.aStart.Tab())) + //{ + // if (nEndCol > nColumn) + // nCount = nEndCol - nColumn + 1; + //} +//-----IAccessibility2 Implementation 2009 } return nCount; @@ -489,3 +516,27 @@ void ScAccessibleTableBase::CommitTableModelChange(sal_Int32 nStartRow, sal_Int3 CommitChange(aEvent); } +//IAccessibility2 Implementation 2009----- +sal_Bool SAL_CALL ScAccessibleTableBase::selectRow( sal_Int32 ) +throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + return sal_True; +} +sal_Bool SAL_CALL ScAccessibleTableBase::selectColumn( sal_Int32 ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + return sal_True; +} +sal_Bool SAL_CALL ScAccessibleTableBase::unselectRow( sal_Int32 ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + return sal_True; +} +sal_Bool SAL_CALL ScAccessibleTableBase::unselectColumn( sal_Int32 ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + return sal_True; +} +//-----IAccessibility2 Implementation 2009 + + diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 577217d8f6b9..1f0c7e596263 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -1058,8 +1058,10 @@ ScDocShell* ScAccessibleCellTextData::GetDocShell(ScTabViewShell* pViewShell) // ============================================================================ - -ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin) +//IAccessibility2 Implementation 2009----- +//ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin) +ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone) +//-----IAccessibility2 Implementation 2009 : mpViewForwarder(NULL), mpEditViewForwarder(NULL), @@ -1068,13 +1070,22 @@ ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditVi mpForwarder(NULL), mpWindow(pWin) { - if (mpEditEngine) +//IAccessibility2 Implementation 2009----- + // Solution: If the object is cloned, do NOT add notify hdl. + mbIsCloned = isClone; + //if (mpEditEngine) + if (mpEditEngine && !mbIsCloned) +//-----IAccessibility2 Implementation 2009 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) ); } ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData() { - if (mpEditEngine) +//IAccessibility2 Implementation 2009----- + // Solution: If the object is cloned, do NOT set notify hdl. + //if (mpEditEngine) + if (mpEditEngine && !mbIsCloned) +//-----IAccessibility2 Implementation 2009 mpEditEngine->SetNotifyHdl(Link()); if (mpViewForwarder) delete mpViewForwarder; @@ -1106,7 +1117,11 @@ void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint& ScAccessibleTextData* ScAccessibleEditObjectTextData::Clone() const { - return new ScAccessibleEditObjectTextData(mpEditView, mpWindow); +//IAccessibility2 Implementation 2009----- + // Solution: Add para to indicate the object is cloned + //return new ScAccessibleEditObjectTextData(mpEditView, mpWindow); + return new ScAccessibleEditObjectTextData(mpEditView, mpWindow,sal_True); +//-----IAccessibility2 Implementation 2009 } SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder() @@ -1115,7 +1130,11 @@ SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder() { if (!mpEditEngine) mpEditEngine = mpEditView->GetEditEngine(); - if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()) +//IAccessibility2 Implementation 2009----- + // Solution: If the object is cloned, do NOT add notify hdl. + //if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()) + if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()&&!mbIsCloned) +//-----IAccessibility2 Implementation 2009 mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) ); if(!mpForwarder) mpForwarder = new SvxEditEngineForwarder(*mpEditEngine); diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 7652853b1856..a67efafd72ea 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -180,6 +180,11 @@ ScDbNameDlg::ScDbNameDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, aBtnDoSize, aBtnKeepFmt, aBtnStripData, theCurArea ); Init(); FreeResource(); + //IAccessibility2 Implementation 2009----- + SynFocusTimer.SetTimeout(150); + SynFocusTimer.SetTimeoutHdl(LINK( this, ScDbNameDlg, FocusToComoboxHdl)); + SynFocusTimer.Start(); + //-----IAccessibility2 Implementation 2009 aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign); } @@ -716,8 +721,37 @@ IMPL_LINK( ScDbNameDlg, AssModifyHdl, void *, EMPTYARG ) String aText = aEdAssign.GetText(); if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID ) theCurArea = aTmpRange; - +//IAccessibility2 Implementation 2009----- + if( aText.Len() > 0 && aEdName.GetText().Len() > 0 ) + { + aBtnAdd.Enable(); + aBtnHeader.Enable(); + aBtnDoSize.Enable(); + aBtnKeepFmt.Enable(); + aBtnStripData.Enable(); + aFTSource.Enable(); + aFTOperations.Enable(); + } + else + { + aBtnAdd.Disable(); + aBtnHeader.Disable(); + aBtnDoSize.Disable(); + aBtnKeepFmt.Disable(); + aBtnStripData.Disable(); + aFTSource.Disable(); + aFTOperations.Disable(); + } +//-----IAccessibility2 Implementation 2009 return 0; } - +//IAccessibility2 Implementation 2009----- +IMPL_LINK( ScDbNameDlg, FocusToComoboxHdl, Timer*, pTi) +{ + (void)pTi; + // CallEventListeners is still protected - figure out if we need to make it public, or if the focus stuff can be handled better in VCL directly. First see what AT is expecting... + // aEdName.CallEventListeners( VCLEVENT_CONTROL_GETFOCUS ); + return 0; +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index c81a9b71c32a..3ff13539ece8 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -121,6 +121,9 @@ #include "docsh.hxx" #include "docshimp.hxx" +//IAccessibility2 Implementation 2009----- +#include <sfx2/viewfrm.hxx> +//-----IAccessibility2 Implementation 2009 #include <rtl/logfile.hxx> #include <comphelper/processfactory.hxx> @@ -1587,6 +1590,23 @@ sal_Bool __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium ) PrepareSaveGuard aPrepareGuard( *this); +//IAccessibility2 Implementation 2009----- + aDocument.setDocAccTitle(String()); + // SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame)); + SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this ); + if (pFrame1) + { + Window* pWindow = &pFrame1->GetWindow(); + if ( pWindow ) + { + Window* pSysWin = pWindow->GetSystemWindow(); + if ( pSysWin ) + { + pSysWin->SetAccessibleName(String()); + } + } + } +//-----IAccessibility2 Implementation 2009 // wait cursor is handled with progress bar sal_Bool bRet = SfxObjectShell::SaveAs( rMedium ); if( bRet ) diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx index cf91e1908a89..f74a7b499763 100644 --- a/sc/source/ui/drawfunc/fudraw.cxx +++ b/sc/source/ui/drawfunc/fudraw.cxx @@ -354,10 +354,16 @@ sal_Bool __EXPORT FuDraw::KeyInput(const KeyEvent& rKEvt) // changeover to the next object if(!pView->MarkNextObj( !aCode.IsShift() )) { +//IAccessibility2 Implementation 2009----- + //If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj(). + if ( pView->GetMarkableObjCount() > 1 && pView->HasMarkableObj() ) + { +//-----IAccessibility2 Implementation 2009 // #97016# No next object: go over open end and // get first from the other side pView->UnmarkAllObj(); pView->MarkNextObj(!aCode.IsShift()); + } } // #97016# II diff --git a/sc/source/ui/inc/AccessibleCell.hxx b/sc/source/ui/inc/AccessibleCell.hxx index 51d0aba81a89..576853840973 100644 --- a/sc/source/ui/inc/AccessibleCell.hxx +++ b/sc/source/ui/inc/AccessibleCell.hxx @@ -32,17 +32,28 @@ #include <unotools/accessiblerelationsethelper.hxx> #include <editeng/AccessibleStaticTextBase.hxx> #include <comphelper/uno3.hxx> +//IAccessibility2 Implementation 2009----- +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_ +#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> +#endif +//-----IAccessibility2 Implementation 2009 class ScTabViewShell; class ScAccessibleDocument; +typedef cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleExtendedAttributes> + ScAccessibleCellAttributeImpl; + /** @descr This base class provides an implementation of the <code>AccessibleCell</code> service. */ class ScAccessibleCell : public ScAccessibleCellBase, - public accessibility::AccessibleStaticTextBase + public accessibility::AccessibleStaticTextBase, +//IAccessibility2 Implementation 2009----- + public ScAccessibleCellAttributeImpl +//-----IAccessibility2 Implementation 2009 { public: //===== internal ======================================================== @@ -134,6 +145,14 @@ public: getSupportedServiceNames(void) throw (::com::sun::star::uno::RuntimeException); +//IAccessibility2 Implementation 2009----- + virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + + // Override this method to handle cell's ParaIndent attribute specially. + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 private: ScTabViewShell* mpViewShell; ScAccessibleDocument* mpAccDoc; @@ -163,6 +182,10 @@ private: void AddRelation(const ScRange& rRange, const sal_uInt16 aRelationType, ::utl::AccessibleRelationSetHelper* pRelationSet); +//IAccessibility2 Implementation 2009----- + sal_Bool IsFormulaMode(); + sal_Bool IsDropdown(); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/AccessibleCellBase.hxx b/sc/source/ui/inc/AccessibleCellBase.hxx index d14f7953b425..d2287f460e63 100644 --- a/sc/source/ui/inc/AccessibleCellBase.hxx +++ b/sc/source/ui/inc/AccessibleCellBase.hxx @@ -142,6 +142,21 @@ private: virtual sal_Bool IsEditable( const com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); +//IAccessibility2 Implementation 2009----- +protected: + virtual ::rtl::OUString SAL_CALL GetNote(void) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL GetAllDisplayNote(void) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getShadowAttrs(void) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getBorderAttrs(void) + throw (::com::sun::star::uno::RuntimeException); +public: + const ScAddress& GetCellAddress() const { return maCellAddress; } + sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx index 35794a608c51..f13c4e3b7762 100644 --- a/sc/source/ui/inc/AccessibleDocument.hxx +++ b/sc/source/ui/inc/AccessibleDocument.hxx @@ -29,7 +29,12 @@ #include "viewdata.hxx" #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <com/sun/star/view/XSelectionChangeListener.hpp> -#include <cppuhelper/implbase2.hxx> +//IAccessibility2 Implementation 2009----- +//#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp> +#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp> +//-----IAccessibility2 Implementation 2009 #include <svx/IAccessibleViewForwarder.hxx> class ScTabViewShell; @@ -51,13 +56,19 @@ namespace utl <code>AccessibleContext</code> service. */ -typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleSelection, +//IAccessibility2 Implementation 2009----- +typedef cppu::ImplHelper3< ::com::sun::star::accessibility::XAccessibleSelection, + ::com::sun::star::accessibility::XAccessibleExtendedAttributes, +//-----IAccessibility2 Implementation 2009 ::com::sun::star::view::XSelectionChangeListener > ScAccessibleDocumentImpl; class ScAccessibleDocument : public ScAccessibleDocumentBase, public ScAccessibleDocumentImpl, +//IAccessibility2 Implementation 2009----- + public com::sun::star::accessibility::XAccessibleGetAccFlowTo, +//-----IAccessibility2 Implementation 2009 public accessibility::IAccessibleViewForwarder { public: @@ -124,6 +135,14 @@ public: getAccessibleStateSet(void) throw (::com::sun::star::uno::RuntimeException); +//IAccessibility2 Implementation 2009----- + virtual ::rtl::OUString SAL_CALL + getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; +//-----IAccessibility2 Implementation 2009 ///===== XAccessibleSelection =========================================== virtual void SAL_CALL @@ -318,6 +337,24 @@ private: rtl::OUString GetCurrentCellDescription() const; Rectangle GetVisibleArea_Impl() const; +//IAccessibility2 Implementation 2009----- + com::sun::star::uno::Sequence< com::sun::star::uno::Any > GetScAccFlowToSequence(); +public: + ScDocument *GetDocument() const ; + ScAddress GetCurCellAddress() const; + //===== XAccessibleGetAccFromXShape ============================================ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getForeground( ) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getBackground( ) + throw (::com::sun::star::uno::RuntimeException); +protected: + void SwitchViewFireFocus(); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/AccessibleDocumentBase.hxx b/sc/source/ui/inc/AccessibleDocumentBase.hxx index 9ffe9c0e7b66..11c8feda9490 100644 --- a/sc/source/ui/inc/AccessibleDocumentBase.hxx +++ b/sc/source/ui/inc/AccessibleDocumentBase.hxx @@ -37,6 +37,9 @@ public: ScAccessibleDocumentBase( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent); +//IAccessibility2 Implementation 2009----- + virtual void SwitchViewFireFocus(); +//-----IAccessibility2 Implementation 2009 protected: virtual ~ScAccessibleDocumentBase (void); }; diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx index 2f4a2657321c..8adb777991be 100644 --- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx +++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx @@ -85,6 +85,10 @@ public: getAccessibleStateSet(void) throw (::com::sun::star::uno::RuntimeException); +//IAccessibility2 Implementation 2009----- + virtual ::rtl::OUString SAL_CALL getAccessibleName(void) + throw (::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 ///===== XServiceInfo ==================================================== /** Returns an identifier for the implementation of this object. diff --git a/sc/source/ui/inc/AccessibleEditObject.hxx b/sc/source/ui/inc/AccessibleEditObject.hxx index 35f7af068ad3..34faf108cc91 100644 --- a/sc/source/ui/inc/AccessibleEditObject.hxx +++ b/sc/source/ui/inc/AccessibleEditObject.hxx @@ -27,6 +27,10 @@ #include "AccessibleContextBase.hxx" +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include "global.hxx" +//-----IAccessibility2 Implementation 2009 namespace accessibility { class AccessibleTextHelper; @@ -46,7 +50,10 @@ enum EditObjectType <code>AccessibleCell</code> service. */ class ScAccessibleEditObject - : public ScAccessibleContextBase + : public ScAccessibleContextBase, +//IAccessibility2 Implementation 2009----- + public ::com::sun::star::accessibility::XAccessibleSelection +//-----IAccessibility2 Implementation 2009 { public: //===== internal ======================================================== @@ -71,7 +78,17 @@ public: virtual void LostFocus(); virtual void GotFocus(); +//IAccessibility2 Implementation 2009----- +///===== XInterface ===================================================== + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + ::com::sun::star::uno::Type const & rType ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw (); + + virtual void SAL_CALL release() throw (); +//-----IAccessibility2 Implementation 2009 ///===== XAccessibleComponent ============================================ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > @@ -110,6 +127,32 @@ public: getAccessibleStateSet(void) throw (::com::sun::star::uno::RuntimeException); + //===== XAccessibleSelection ============================================ + + virtual void SAL_CALL selectAccessibleChild( + sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isAccessibleChildSelected( + sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL clearAccessibleSelection( ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL selectAllAccessibleChildren( ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) + throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deselectAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException); +//-----IAccessibility2 Implementation 2009 protected: /// Return this object's description. virtual ::rtl::OUString SAL_CALL @@ -168,6 +211,20 @@ private: ::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates); void CreateTextHelper(); +//IAccessibility2 Implementation 2009----- + ScDocument *m_pScDoc; + ScAddress m_curCellAddress; + + + ///===== XAccessibleComponent ============================================ + virtual sal_Int32 SAL_CALL getForeground( ) + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getBackground( ) + throw (::com::sun::star::uno::RuntimeException); + + sal_Int32 GetFgBgColor( const rtl::OUString &strPropColor) ; +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx index 170af5477490..f3dc86a655b6 100644 --- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx +++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx @@ -30,6 +30,10 @@ #include <vector> +//IAccessibility2 Implementation 2009----- +#include "rangelst.hxx" +#include <map> +//-----IAccessibility2 Implementation 2009 class ScMyAddress : public ScAddress { public: @@ -239,6 +243,17 @@ public: const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) throw (com::sun::star::uno::RuntimeException); +//IAccessibility2 Implementation 2009----- + //===== XAccessibleTableSelection ============================================ + virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; +//-----IAccessibility2 Implementation 2009 protected: /// Return the object's current bounding box relative to the desktop. @@ -279,6 +294,55 @@ private: ScDocument* GetDocument(ScTabViewShell* pViewShell); Rectangle GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos); Rectangle GetVisCells(const Rectangle& rVisArea); +//IAccessibility2 Implementation 2009----- + //void CreateSortedMarkedCells(); + //void AddMarkedRange(const ScRange& rRange); + typedef std::vector<ScMyAddress> VEC_MYADDR; + + typedef std::map<ScMyAddress,com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > + MAP_ADDR_XACC; + MAP_ADDR_XACC m_mapSelectionSend; + void RemoveSelection(ScMarkData &refScMarkData); + sal_Bool IsSameMarkCell(); + void CommitFocusCell(const ScAddress &aNewCell); +public: + void FireFirstCellFocus(); +private: + sal_Bool m_bFormulaMode; + sal_Bool m_bFormulaLastMode; + ScAddress m_aFormulaActiveCell; + MAP_ADDR_XACC m_mapFormulaSelectionSend; + VEC_MYADDR m_vecFormulaLastMyAddr; + ScAccessibleCell* m_pAccFormulaCell; + sal_uInt16 m_nMinX; + sal_uInt16 m_nMaxX; + sal_Int32 m_nMinY; + sal_Int32 m_nMaxY; + sal_Int32 GetRowAll() const { return m_nMaxY - m_nMinY + 1 ; } + sal_uInt16 GetColAll() const { return m_nMaxX - m_nMinX + 1; } + void NotifyRefMode(); + void RemoveFormulaSelection(sal_Bool bRemoveAll =sal_False); + sal_Bool CheckChildIndex(sal_Int32)const ; + ScAddress GetChildIndexAddress(sal_Int32) const; + sal_Int32 GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn ); + sal_Bool GetFormulaCurrentFocusCell(ScAddress &addr); +public: + sal_Bool IsScAddrFormulaSel (const ScAddress &addr) const ; + sal_Bool IsFormulaMode() ; + ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > GetActiveCell(); + ScRange m_aLastWithInMarkRange; + String m_strCurCellValue; + ScRangeList m_LastMarkedRanges; + typedef std::vector<ScRange*> VEC_RANGE; + VEC_RANGE m_vecTempRange; + typedef std::pair<sal_uInt16,sal_uInt16> PAIR_COL; + typedef std::vector<PAIR_COL> VEC_COL; + VEC_COL m_vecTempCol; + ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex); + sal_Bool CalcScRangeDifferenceMax(ScRange *pSrc,ScRange *pDest,int nMax,VEC_MYADDR &vecRet,int &nSize); + sal_Bool CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet); + String m_strOldTabName; +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/AccessibleTableBase.hxx b/sc/source/ui/inc/AccessibleTableBase.hxx index dc303ed50cd6..a6f4f080d956 100644 --- a/sc/source/ui/inc/AccessibleTableBase.hxx +++ b/sc/source/ui/inc/AccessibleTableBase.hxx @@ -30,6 +30,9 @@ #include "address.hxx" #include <com/sun/star/accessibility/XAccessibleTable.hpp> #include <com/sun/star/accessibility/XAccessibleSelection.hpp> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp> +//-----IAccessibility2 Implementation 2009 #include <cppuhelper/implbase2.hxx> class ScTabViewShell; @@ -45,6 +48,9 @@ typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleTable, class ScAccessibleTableBase : public ScAccessibleContextBase, +//IAccessibility2 Implementation 2009----- + public ::com::sun::star::accessibility::XAccessibleTableSelection, +//-----IAccessibility2 Implementation 2009 public ScAccessibleTableBaseImpl { public: @@ -199,6 +205,16 @@ public: getAccessibleChild(sal_Int32 nIndex) throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException); +//IAccessibility2 Implementation 2009----- + virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; +//-----IAccessibility2 Implementation 2009 protected: /// Return this object's description. diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx index b33f00b90921..9664a6d84688 100644 --- a/sc/source/ui/inc/AccessibleText.hxx +++ b/sc/source/ui/inc/AccessibleText.hxx @@ -132,7 +132,11 @@ private: class ScAccessibleEditObjectTextData : public ScAccessibleTextData { public: - ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin); +//IAccessibility2 Implementation 2009----- + // Solution: Add a para to indicate whether the object is cloned + //ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin); + ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone=sal_False); +//-----IAccessibility2 Implementation 2009 virtual ~ScAccessibleEditObjectTextData(); virtual ScAccessibleTextData* Clone() const; @@ -155,6 +159,9 @@ protected: EditEngine* mpEditEngine; SvxEditEngineForwarder* mpForwarder; Window* mpWindow; +//IAccessibility2 Implementation 2009----- + sal_Bool mbIsCloned; +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx index aafd55717cc6..88d65e1121f6 100644 --- a/sc/source/ui/inc/content.hxx +++ b/sc/source/ui/inc/content.hxx @@ -34,6 +34,9 @@ class ScNavigatorSettings; class ScDocument; class ScDocShell; class ScAreaLink; +//IAccessibility2 Implementation 2009----- +class SdrPage; +//-----IAccessibility2 Implementation 2009 #define SC_CONTENT_ROOT 0 #define SC_CONTENT_TABLE 1 @@ -64,6 +67,10 @@ class ScContentTree : public SvTreeListBox String aHiddenName; // URL zum Laden String aHiddenTitle; // fuer Anzeige ScDocument* pHiddenDocument; // temporaer +//IAccessibility2 Implementation 2009----- + sal_Bool bisInNavigatoeDlg; + String sKeyString; +//-----IAccessibility2 Implementation 2009 sal_uInt16 pPosList[SC_CONTENT_COUNT]; // fuer die Reihenfolge @@ -112,7 +119,12 @@ class ScContentTree : public SvTreeListBox DECL_LINK( ContentDoubleClickHdl, ScContentTree* ); DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* ); +//IAccessibility2 Implementation 2009----- +public: + SvLBoxEntry* pTmpEntry; + bool m_bFirstPaint; +//-----IAccessibility2 Implementation 2009 protected: // virtual sal_Bool Drop( const DropEvent& rEvt ); // virtual sal_Bool QueryDrop( DropEvent& rEvt ); @@ -126,11 +138,21 @@ protected: virtual void Command( const CommandEvent& rCEvt ); virtual void RequestHelp( const HelpEvent& rHEvt ); - +//IAccessibility2 Implementation 2009----- + virtual void InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&, SvLBoxButtonKind); +//-----IAccessibility2 Implementation 2009 public: ScContentTree( Window* pParent, const ResId& rResId ); ~ScContentTree(); +//IAccessibility2 Implementation 2009----- + String getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const; + String GetEntryAltText( SvLBoxEntry* pEntry ) const; + String GetEntryLongDescription( SvLBoxEntry* pEntry ) const; + + void ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry = NULL); + sal_Bool SetNavigatorDlgFlag(sal_Bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;}; +//-----IAccessibility2 Implementation 2009 virtual void MouseButtonDown( const MouseEvent& rMEvt ); virtual void KeyInput( const KeyEvent& rKEvt ); diff --git a/sc/source/ui/inc/dbnamdlg.hxx b/sc/source/ui/inc/dbnamdlg.hxx index 680804ce40e2..3ee3dae45fd8 100644 --- a/sc/source/ui/inc/dbnamdlg.hxx +++ b/sc/source/ui/inc/dbnamdlg.hxx @@ -100,6 +100,10 @@ private: ScDBCollection aLocalDbCol; ScRange theCurArea; List aRemoveList; + //IAccessibility2 Implementation 2009----- + Timer SynFocusTimer; + DECL_LINK( FocusToComoboxHdl, Timer* ); + //-----IAccessibility2 Implementation 2009 #ifdef _DBNAMDLG_CXX private: diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 1a121d8048bb..ff9ce35bccab 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -406,6 +406,14 @@ public: const ScOptSolverSave* GetSolverSaveData() const { return pSolverSaveData; } // may be null void SetSolverSaveData( const ScOptSolverSave& rData ); + +//IAccessibility2 Implementation 2009----- + virtual void setDocAccTitle( const String& rTitle ) { aDocument.setDocAccTitle( rTitle ); } + virtual const String getDocAccTitle() const { return aDocument.getDocAccTitle(); } + void setDocReadOnly( sal_Bool b){ aDocument.setDocReadOnly(b);} + sal_Bool getDocReadOnly() const { return aDocument.getDocReadOnly(); } +//-----IAccessibility2 Implementation 2009 + //<!--Added by PengYunQuan for Validity Cell Range Picker sal_Bool AcceptStateUpdate() const; //-->Added by PengYunQuan for Validity Cell Range Picker diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx index 1a9fd33d76bc..6279f4f1a4e2 100644 --- a/sc/source/ui/inc/drawview.hxx +++ b/sc/source/ui/inc/drawview.hxx @@ -155,6 +155,11 @@ public: SdrEndTextEditKind ScEndTextEdit(); // ruft SetDrawTextUndo(0) //UNUSED2009-05 void CaptionTextDirection(sal_uInt16 nSlot); ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable(); +//IAccessibility2 Implementation 2009----- + SdrObject* GetObjectByName(const String& rName); + sal_Bool GetObjectIsMarked( SdrObject * pObject ); + sal_Bool SelectCurrentViewObject( const String& rName ); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx index a3d4c051af20..9174ef2417b1 100644 --- a/sc/source/ui/inc/gridwin.hxx +++ b/sc/source/ui/inc/gridwin.hxx @@ -239,7 +239,9 @@ private: void ExecPageFieldSelect( SCCOL nCol, SCROW nRow, sal_Bool bHasSelection, const String& rStr ); sal_Bool HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange ); - +//IAccessibility2 Implementation 2009----- + sal_Bool HasScenarioRange( sal_uInt16 nCol, sal_Int32 nRow, ScRange& rScenRange ); +//-----IAccessibility2 Implementation 2009 sal_Bool DropScroll( const Point& rMousePos ); sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt ); @@ -388,6 +390,9 @@ public: void DoInvertRect( const Rectangle& rPixel ); void CheckNeedsRepaint(); +//IAccessibility2 Implementation 2009----- + virtual void SwitchView(); +//-----IAccessibility2 Implementation 2009 void UpdateDPFromFieldPopupMenu(); diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx index 4788dde2115f..bb469189161e 100644 --- a/sc/source/ui/inc/preview.hxx +++ b/sc/source/ui/inc/preview.hxx @@ -158,6 +158,9 @@ public: static void StaticInvalidate(); FmFormView* GetDrawView() { return pDrawView; } +//IAccessibility2 Implementation 2009----- + virtual void SwitchView(); +//-----IAccessibility2 Implementation 2009 }; diff --git a/sc/source/ui/inc/scuitphfedit.hxx b/sc/source/ui/inc/scuitphfedit.hxx index 7770b27eec0f..a297bab5d356 100644 --- a/sc/source/ui/inc/scuitphfedit.hxx +++ b/sc/source/ui/inc/scuitphfedit.hxx @@ -91,6 +91,9 @@ private: sal_uInt16 nWhich; String aCmdArr[6]; + //IAccessibility2 Implementation 2009----- + DECL_LINK( ObjectSelectHdl, ScEditWindow* ); + //-----IAccessibility2 Implementation 2009 private: #ifdef _TPHFEDIT_CXX diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx index 8c2985c0922d..18a0cfcbd7c8 100644 --- a/sc/source/ui/inc/tabview.hxx +++ b/sc/source/ui/inc/tabview.hxx @@ -472,7 +472,7 @@ public: sal_Bool bCols = sal_False, sal_Bool bRows = sal_False, sal_Bool bCellSelection = sal_False ); void InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, sal_Bool bTestNeg = sal_False, - sal_Bool bCols = sal_False, sal_Bool bRows = sal_False ); + sal_Bool bCols = sal_False, sal_Bool bRows = sal_False, sal_Bool bForceNeg = sal_False ); void InitOwnBlockMode(); void DoneBlockMode( sal_Bool bContinue = sal_False ); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 283ce5f0c05f..e98bb02e71b8 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -161,7 +161,9 @@ private: sal_Bool bPrintSelected; // for result of SvxPrtQryBox sal_Bool bReadOnly; // um Status-Aenderungen zu erkennen - +//IAccessibility2 Implementation 2009----- + sal_Bool bIsActive; +//-----IAccessibility2 Implementation 2009 SbxObject* pScSbxObject; //UNUSED2008-05 sal_Bool bChartDlgIsEdit; // Datenbereich aendern @@ -423,6 +425,11 @@ public: bool ExecuteRetypePassDlg(ScPasswordHash eDesiredHash); using ScTabView::ShowCursor; +//IAccessibility2 Implementation 2009----- + sal_Bool IsActive(){ return bIsActive; } + rtl::OUString GetFormula(ScAddress& rAddress); + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & GetForms() const; +//-----IAccessibility2 Implementation 2009 }; //================================================================== diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx index 8fe160f4f8e2..8a87b5252bed 100644 --- a/sc/source/ui/inc/tphfedit.hxx +++ b/sc/source/ui/inc/tphfedit.hxx @@ -78,6 +78,9 @@ public: virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); inline ScHeaderEditEngine* GetEditEngine() const {return pEdEngine;} + //IAccessibility2 Implementation 2009----- + void SetObjectSelectHdl( const Link& aLink){ aObjectSelectLink = aLink; }; + //-----IAccessibility2 Implementation 2009 protected: virtual void Paint( const Rectangle& rRec ); virtual void MouseMove( const MouseEvent& rMEvt ); @@ -96,6 +99,11 @@ private: com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xAcc; ScAccessibleEditObject* pAcc; + + //IAccessibility2 Implementation 2009----- + Link aObjectSelectLink; + //-----IAccessibility2 Implementation 2009 + }; //=================================================================== diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index 9b87cbf2aab9..5efacec7d14e 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -93,9 +93,8 @@ class ScValidationDlg :public ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false //<!--Added by PengYunQuan for Validity Cell Range Picker typedef ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false> ScValidationDlgBase; - //Start_Moddify by liliang 03/26/2008 SODC_13677_2 DECL_LINK( OkHdl, Button * ); - //End_Moddify by liliang 03/26/2008 SODC_13677_2 + bool m_bOwnRefHdlr:1; ScTabViewShell *m_pTabVwSh; diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx index 6a30f52d839b..905425d6b1c6 100644 --- a/sc/source/ui/inc/viewfunc.hxx +++ b/sc/source/ui/inc/viewfunc.hxx @@ -251,8 +251,11 @@ public: ScAutoFormatData* CreateAutoFormatData(); void AutoFormat( sal_uInt16 nFormatNo, sal_Bool bRecord = sal_True ); - void SearchAndReplace( const SvxSearchItem* pSearchItem, +//IAccessibility2 Implementation 2009----- +// void SearchAndReplace( const SvxSearchItem* pSearchItem, + sal_Bool SearchAndReplace( const SvxSearchItem* pSearchItem, sal_Bool bAddUndo, sal_Bool bIsApi ); +//-----IAccessibility2 Implementation 2009 void Solve( const ScSolveParam& rParam ); void TabOp( const ScTabOpParam& rParam, sal_Bool bRecord = sal_True ); diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index 564caec25d37..af135722b3a6 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -105,6 +105,7 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, Wind Init(); + aFilterCtr.SetAccessibleRelationMemberOf(&aFlFilter); } ScHighlightChgDlg::~ScHighlightChgDlg() @@ -257,6 +258,9 @@ IMPL_LINK( ScHighlightChgDlg, RefHandle, SvxTPFilter*, pRef ) aEdAssign.Show(); aRbAssign.Show(); aEdAssign.SetText(aFilterCtr.GetRange()); + //IAccessibility2 Implementation 2009----- + aEdAssign.GrabFocus(); + //-----IAccessibility2 Implementation 2009 ScAnyRefDlg::RefInputStart(&aEdAssign,&aRbAssign); } return 0; diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 172fb0547c38..f572efa57cf4 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -84,10 +84,34 @@ public: void SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; } void SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; } - + //IAccessibility2 Implementation 2009----- +// MT: Commented out SV_ITEM_ID_EXTENDRLBOXSTRING and GetExtendText() in svlbitem.hxx - needed? +// virtual USHORT IsA() {return SV_ITEM_ID_EXTENDRLBOXSTRING;} +// virtual XubString GetExtendText() const; + //-----IAccessibility2 Implementation 2009 virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry ); }; +//IAccessibility2 Implementation 2009----- +// MT: Commented out SV_ITEM_ID_EXTENDRLBOXSTRING and GetExtendText() in svlbitem.hxx - needed? +/* +XubString ScSolverOptionsString::GetExtendText() const +{ + String aNormalStr( GetText() ); + aNormalStr.Append( (sal_Unicode) ':' ); + String sTxt( ' ' ); + if ( mbIsDouble ) + sTxt += (String)rtl::math::doubleToUString( mfDoubleValue, + rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max, + ScGlobal::GetpLocaleData()->getNumDecimalSep().GetChar(0), true ); + else + sTxt += String::CreateFromInt32( mnIntValue ); + aNormalStr.Append(sTxt); + return aNormalStr; +} +*/ +//-----IAccessibility2 Implementation 2009 + void ScSolverOptionsString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* /* pEntry */ ) { //! move position? (SvxLinguTabPage: aPos.X() += 20) diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 8d42d3743bcd..803825f89e99 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -64,6 +64,10 @@ #include "navicfg.hxx" #include "navsett.hxx" #include "postit.hxx" +//IAccessibility2 Implementation 2009----- +#include "tabvwsh.hxx" +#include "drawview.hxx" +//-----IAccessibility2 Implementation 2009 #include "clipparam.hxx" using namespace com::sun::star; @@ -126,7 +130,10 @@ ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) : aHCEntryImages ( ScResId( RID_IMAGELIST_H_NAVCONT ) ), nRootType ( SC_CONTENT_ROOT ), bHiddenDoc ( sal_False ), - pHiddenDocument ( NULL ) + pHiddenDocument ( NULL ), +//IAccessibility2 Implementation 2009----- + bisInNavigatoeDlg ( sal_False ) +//-----IAccessibility2 Implementation 2009 { sal_uInt16 i; for (i=0; i<SC_CONTENT_COUNT; i++) @@ -142,12 +149,80 @@ ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) : SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) ); + //IAccessibility2 Implementation 2009----- + pTmpEntry= NULL; + m_bFirstPaint=true; + //-----IAccessibility2 Implementation 2009 + SetStyle( GetStyle() | WB_QUICK_SEARCH ); } ScContentTree::~ScContentTree() { } +//IAccessibility2 Implementation 2009----- +// helper function for GetEntryAltText and GetEntryLongDescription +String ScContentTree::getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const +{ + SdrObject* pFound = NULL; + + sal_uInt16 nType; + sal_uLong nChild; + GetEntryIndexes( nType, nChild, pEntry ); + switch( nType ) + { + case SC_CONTENT_OLEOBJECT: + case SC_CONTENT_GRAPHIC: + case SC_CONTENT_DRAWING: + { + ScDocument* pDoc = ( const_cast< ScContentTree* >(this) )->GetSourceDocument(); + SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS; + ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer(); + SfxObjectShell* pShell = pDoc->GetDocumentShell(); + if (pDrawLayer && pShell) + { + sal_uInt16 nTabCount = pDoc->GetTableCount(); + for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++) + { + SdrPage* pPage = pDrawLayer->GetPage(nTab); + DBG_ASSERT(pPage,"Page ?"); + if (pPage) + { + SdrObjListIter aIter( *pPage, eIter ); + SdrObject* pObject = aIter.Next(); + while (pObject) + { + if( ScDrawLayer::GetVisibleName( pObject ) == GetEntryText( pEntry ) ) + { + pFound = pObject; + break; + } + pObject = aIter.Next(); + } + } + } + } + if( pFound ) + { + if( isAltText ) + return pFound->GetTitle(); + else + return pFound->GetDescription(); + } + } + break; + } + return String(); +} +String ScContentTree::GetEntryAltText( SvLBoxEntry* pEntry ) const +{ + return getAltLongDescText( pEntry, sal_True ); +} +String ScContentTree::GetEntryLongDescription( SvLBoxEntry* pEntry ) const +{ + return getAltLongDescText( pEntry, sal_False); +} +//-----IAccessibility2 Implementation 2009 void ScContentTree::InitRoot( sal_uInt16 nType ) { @@ -175,7 +250,17 @@ void ScContentTree::InitRoot( sal_uInt16 nType ) void ScContentTree::ClearAll() { +//IAccessibility2 Implementation 2009----- + //There are one method in Control::SetUpdateMode(), and one override method SvTreeListBox::SetUpdateMode(). Here although + //SvTreeListBox::SetUpdateMode() is called in refresh method, it only call SvTreeListBox::SetUpdateMode(), not Control::SetUpdateMode(). + //In SvTreeList::Clear(), Broadcast( LISTACTION_CLEARED ) will be called and finally, it will be trapped into the event yield() loop. And + //the InitRoot() method won't be called. Then if a user click or press key to update the navigator tree, crash happens. + //So the solution is to disable the UpdateMode of Control, then call Clear(), then recover the update mode + sal_Bool bOldUpdate = Control::IsUpdateMode(); + Control::SetUpdateMode(sal_False); Clear(); + Control::SetUpdateMode(bOldUpdate); +//-----IAccessibility2 Implementation 2009 for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++) InitRoot(i); } @@ -403,10 +488,85 @@ void ScContentTree::KeyInput( const KeyEvent& rKEvt ) break; } } - StoreSettings(); +//IAccessibility2 Implementation 2009----- + //Solution: Make KEY_SPACE has same function as DoubleClick + if ( bisInNavigatoeDlg ) + { + if(aCode.GetCode() == KEY_SPACE ) + { + bUsed = sal_True; + sal_uInt16 nType; + sal_uLong nChild; + SvLBoxEntry* pEntry = GetCurEntry(); + GetEntryIndexes( nType, nChild, pEntry ); + if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) ) + { + if ( bHiddenDoc ) + return ; //! spaeter... + String aText( GetEntryText( pEntry ) ); + sKeyString = aText; + if ( aManualDoc.Len() ) + pParentWindow->SetCurrentDoc( aManualDoc ); + switch( nType ) + { + case SC_CONTENT_OLEOBJECT: + case SC_CONTENT_GRAPHIC: + case SC_CONTENT_DRAWING: + { + Window* pWindow=(Window*)GetParent(pEntry); + ScNavigatorDlg* pScNavigatorDlg = (ScNavigatorDlg*)pWindow; + ScTabViewShell* pScTabViewShell = NULL; + ScDrawView* pScDrawView = NULL; + if (pScNavigatorDlg!=NULL) + pScTabViewShell=pScNavigatorDlg->GetTabViewShell(); + if(pScTabViewShell !=NULL) + pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView(); + if(pScDrawView!=NULL) + { + pScDrawView->SelectCurrentViewObject(aText ); + sal_Bool bHasMakredObject = sal_False; + SvLBoxEntry* pParent = pRootNodes[nType]; + SvLBoxEntry* pBeginEntry = NULL; + if( pParent ) + pBeginEntry = FirstChild(pParent); + while( pBeginEntry ) + { + String aTempText( GetEntryText( pBeginEntry ) ); + if( pScDrawView->GetObjectIsMarked( pScDrawView->GetObjectByName( aTempText ) ) ) + { + bHasMakredObject = sal_True; + break; + } + pBeginEntry = Next( pBeginEntry ); + } + if( !bHasMakredObject && pScTabViewShell) + pScTabViewShell->SetDrawShell(sal_False); + ObjectFresh( nType,pEntry ); + } + } + break; + } + } + } + } + //StoreSettings(); + //-----IAccessibility2 Implementation 2009 if( !bUsed ) + //IAccessibility2 Implementation 2009----- + { + if(aCode.GetCode() == KEY_F5 ) + { + StoreSettings(); SvTreeListBox::KeyInput(rKEvt); + } + else + { + SvTreeListBox::KeyInput(rKEvt); + StoreSettings(); + } + } + //-----IAccessibility2 Implementation 2009 } //sal_Bool __EXPORT ScContentTree::Drop( const DropEvent& rEvt ) @@ -607,6 +767,56 @@ ScDocument* ScContentTree::GetSourceDocument() return NULL; } +//IAccessibility2 Implementation 2009----- +//Solution: move along and draw "*" sign . +void ScContentTree::ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry ) +{ + if ( bHiddenDoc && !pHiddenDocument ) + return; // anderes Dokument angezeigt + if(nType ==SC_CONTENT_GRAPHIC||nType ==SC_CONTENT_OLEOBJECT||nType ==SC_CONTENT_DRAWING) + { + SetUpdateMode(sal_False); + ClearType( nType ); + /*sal_uInt16 nId = OBJ_GRAF; + switch( nType ) + { + case SC_CONTENT_OLEOBJECT: + nId = OBJ_OLE2; + break; + case SC_CONTENT_DRAWING: + nId = OBJ_GRUP; + break; + }*/ + GetDrawNames( nType/*, nId*/ ); + if( !pEntry ) + ApplySettings(); + SetUpdateMode(sal_True); + if( pEntry ) + { + SvLBoxEntry* pParent = pRootNodes[nType]; + SvLBoxEntry* pBeginEntry = NULL; + SvLBoxEntry* pOldEntry = NULL; + if( pParent ) + pBeginEntry = FirstChild(pParent); + while( pBeginEntry ) + { + String aTempText( GetEntryText( pBeginEntry ) ); + if( aTempText == sKeyString ) + { + pOldEntry = pBeginEntry; + break; + } + pBeginEntry = Next( pBeginEntry ); + } + if( pOldEntry ) + { + Expand(pParent); + Select( pOldEntry,sal_True); + } + } + } +} +//-----IAccessibility2 Implementation 2009 void ScContentTree::Refresh( sal_uInt16 nType ) { if ( bHiddenDoc && !pHiddenDocument ) @@ -793,9 +1003,46 @@ void ScContentTree::GetDrawNames( sal_uInt16 nType ) { String aName = ScDrawLayer::GetVisibleName( pObject ); if (aName.Len()) - InsertContent( nType, aName ); + { + //IAccessibility2 Implementation 2009----- + //InsertContent( nType, aName ); + if( bisInNavigatoeDlg ) + { + if (nType >= SC_CONTENT_COUNT) + { + DBG_ERROR("ScContentTree::InsertContent mit falschem Typ"); + return; } - + SvLBoxEntry* pParent = pRootNodes[nType]; + if (pParent) + { + SvLBoxEntry* pChild=InsertEntry( aName, pParent ); + if(pChild) + pChild->SetMarked( sal_False); + Window* pWindow=NULL; + ScTabViewShell* pScTabViewShell=NULL; + ScDrawView* pScDrawView=NULL; + ScNavigatorDlg* pScNavigatorDlg=NULL; + if(pChild) + pWindow=(Window*)GetParent(pChild); + if(pWindow) + pScNavigatorDlg = (ScNavigatorDlg*)pWindow; + if (pScNavigatorDlg!=NULL) + pScTabViewShell=pScNavigatorDlg->GetTabViewShell(); + if(pScTabViewShell !=NULL) + pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView(); + if(pScDrawView!=NULL) + { + sal_Bool bMarked =pScDrawView->GetObjectIsMarked(pObject); + pChild->SetMarked( bMarked ); + } + }//end if parent + else + DBG_ERROR("InsertContent ohne Parent"); + } + } + } + //-----IAccessibility2 Implementation 2009 pObject = aIter.Next(); } } @@ -1515,7 +1762,50 @@ void ScContentTree::StoreSettings() const } } +//IAccessibility2 Implementation 2009----- +class ScContentLBoxString : public SvLBoxString +{ +public: + ScContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, + const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr) {} + virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, + SvLBoxEntry* pEntry); +}; +void ScContentTree::InitEntry(SvLBoxEntry* pEntry, + const XubString& rStr ,const Image& rImg1,const Image& rImg2, SvLBoxButtonKind eButtonKind) +{ + sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2" + SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind ); + SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite ); + ScContentLBoxString* pStr = new ScContentLBoxString( pEntry, 0, pCol->GetText() ); + pEntry->ReplaceItem( pStr, nColToHilite ); +} +void ScContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, + SvLBoxEntry* pEntry ) +{ + // IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this + /* + if (pEntry->IsMarked()) + { + rDev.DrawText( rPos, GetText() ); + XubString str; + str = XubString::CreateFromAscii("*"); + Point rPosStar(rPos.X()-6,rPos.Y()); + Font aOldFont( rDev.GetFont()); + Font aFont(aOldFont); + Color aCol( aOldFont.GetColor() ); + aCol.DecreaseLuminance( 200 ); + aFont.SetColor( aCol ); + rDev.SetFont( aFont ); + rDev.DrawText( rPosStar, str); + rDev.SetFont( aOldFont ); + } + else + */ + SvLBoxString::Paint( rPos, rDev, nFlags, pEntry); +} +//-----IAccessibility2 Implementation 2009 // //------------------------------------------------------------------------ // diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 8100212193a1..519f4e41ea61 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -785,6 +785,9 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win aTbxCmd.Select(IID_ZOOMOUT); aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT)); } + //IAccessibility2 Implementation 2009----- + aLbEntries.SetNavigatorDlgFlag(sal_True); + //-----IAccessibility2 Implementation 2009 } //------------------------------------------------------------------------ @@ -983,7 +986,13 @@ void __EXPORT ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint ) case FID_ANYDATACHANGED: aContentTimer.Start(); // Notizen nicht sofort suchen break; - + //IAccessibility2 Implementation 2009----- + case FID_KILLEDITVIEW: + aLbEntries.ObjectFresh( SC_CONTENT_OLEOBJECT ); + aLbEntries.ObjectFresh( SC_CONTENT_DRAWING ); + aLbEntries.ObjectFresh( SC_CONTENT_GRAPHIC ); + break; + //-----IAccessibility2 Implementation 2009 default: break; } diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx index 7e6f831f3fc4..0908f56ef7b7 100644 --- a/sc/source/ui/pagedlg/scuitphfedit.cxx +++ b/sc/source/ui/pagedlg/scuitphfedit.cxx @@ -166,6 +166,18 @@ ScHFEditPage::ScHFEditPage( Window* pParent, aWndCenter. SetFont( aPatAttr ); aWndRight. SetFont( aPatAttr ); + //IAccessibility2 Implementation 2009----- + aWndLeft.SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) ); + aWndCenter.SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) ); + aWndRight.SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) ); + aBtnText.SetAccessibleRelationMemberOf( &maFtCustomHF ); + aBtnFile.SetAccessibleRelationMemberOf( &maFtCustomHF ); + aBtnTable.SetAccessibleRelationMemberOf( &maFtCustomHF ); + aBtnPage.SetAccessibleRelationMemberOf( &maFtCustomHF ); + aBtnLastPage.SetAccessibleRelationMemberOf( &maFtCustomHF ); + aBtnDate.SetAccessibleRelationMemberOf( &maFtCustomHF ); + aBtnTime.SetAccessibleRelationMemberOf( &maFtCustomHF ); + //-----IAccessibility2 Implementation 2009 FillCmdArr(); aWndLeft.GrabFocus(); @@ -174,6 +186,14 @@ ScHFEditPage::ScHFEditPage( Window* pParent, FreeResource(); } + //IAccessibility2 Implementation 2009----- + IMPL_LINK( ScHFEditPage, ObjectSelectHdl, ScEditWindow*, pEdit ) + { + (void)pEdit; + aBtnText.GrabFocus(); + return NULL; + } + //-----IAccessibility2 Implementation 2009 // ----------------------------------------------------------------------- diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx index 5005ce6597c7..983bec52edb5 100644 --- a/sc/source/ui/pagedlg/tphfedit.cxx +++ b/sc/source/ui/pagedlg/tphfedit.cxx @@ -553,6 +553,10 @@ void __EXPORT ScEditWindow::Paint( const Rectangle& rRec ) Control::Paint( rRec ); pEdView->Paint( rRec ); + //IAccessibility2 Implementation 2009----- + if( HasFocus() ) + pEdView->ShowCursor(sal_True,sal_True); + //-----IAccessibility2 Implementation 2009 } // ----------------------------------------------------------------------- @@ -594,6 +598,14 @@ void __EXPORT ScEditWindow::KeyInput( const KeyEvent& rKEvt ) { Control::KeyInput( rKEvt ); } + //IAccessibility2 Implementation 2009----- + else if ( !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsShift() && + rKEvt.GetKeyCode().IsMod2() && rKEvt.GetKeyCode().GetCode() == KEY_DOWN ) + { + if (aObjectSelectLink.IsSet() ) + aObjectSelectLink.Call(this); + } + //-----IAccessibility2 Implementation 2009 } // ----------------------------------------------------------------------- @@ -607,6 +619,9 @@ void ScEditWindow::Command( const CommandEvent& rCEvt ) void __EXPORT ScEditWindow::GetFocus() { + //IAccessibility2 Implementation 2009----- + pEdView->ShowCursor(sal_True,sal_True); + //-----IAccessibility2 Implementation 2009 pActiveEdWnd = this; ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTemp = xAcc; diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 1aafc0cf82ff..8c4c0acf3ca1 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -689,6 +689,90 @@ void __EXPORT ScDrawView::UpdateUserViewOptions() #pragma optimize ( "", on ) #endif +//IAccessibility2 Implementation 2009----- +SdrObject* ScDrawView::GetObjectByName(const String& rName) +{ + SfxObjectShell* pShell = pDoc->GetDocumentShell(); + if (pShell) + { + SdrModel* pDrawLayer = GetModel(); + sal_uInt16 nTabCount = pDoc->GetTableCount(); + for (sal_uInt16 i=0; i<nTabCount; i++) + { + SdrPage* pPage = pDrawLayer->GetPage(i); + DBG_ASSERT(pPage,"Page ?"); + if (pPage) + { + SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS ); + SdrObject* pObject = aIter.Next(); + while (pObject) + { + if ( ScDrawLayer::GetVisibleName( pObject ) == rName ) + { + return pObject; + } + pObject = aIter.Next(); + } + } + } + } + return 0; +} +//Solution: realize multi-selection of objects +//================================================== +sal_Bool ScDrawView::SelectCurrentViewObject( const String& rName ) +{ + sal_uInt16 nObjectTab = 0; + SdrObject* pFound = NULL; + sal_Bool bUnMark=sal_False; + SfxObjectShell* pShell = pDoc->GetDocumentShell(); + if (pShell) + { + SdrModel* pDrawLayer = GetModel(); + sal_uInt16 nTabCount = pDoc->GetTableCount(); + for (sal_uInt16 i=0; i<nTabCount && !pFound; i++) + { + SdrPage* pPage = pDrawLayer->GetPage(i); + DBG_ASSERT(pPage,"Page ?"); + if (pPage) + { + SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS ); + SdrObject* pObject = aIter.Next(); + while (pObject && !pFound) + { + if ( ScDrawLayer::GetVisibleName( pObject ) == rName ) + { + pFound = pObject; + nObjectTab = i; + } + pObject = aIter.Next(); + } + } + } + } + if ( pFound ) + { + ScTabView* pView = pViewData->GetView(); + if ( nObjectTab != nTab ) // Tabelle umschalten + pView->SetTabNo( nObjectTab ); + DBG_ASSERT( nTab == nObjectTab, "Tabellen umschalten hat nicht geklappt" ); + pView->ScrollToObject( pFound ); + if ( pFound->GetLayer() == SC_LAYER_BACK && + !pViewData->GetViewShell()->IsDrawSelMode() && + !pDoc->IsTabProtected( nTab ) && + !pViewData->GetSfxDocShell()->IsReadOnly() ) + { + SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK); + if (pLayer) + SetLayerLocked( pLayer->GetName(), sal_False ); + } + SdrPageView* pPV = GetSdrPageView(); + bUnMark = IsObjMarked(pFound); + MarkObj( pFound, pPV, bUnMark); + } + return ( bUnMark ); +} +//-----IAccessibility2 Implementation 2009 sal_Bool ScDrawView::SelectObject( const String& rName ) { UnmarkAll(); @@ -750,6 +834,19 @@ sal_Bool ScDrawView::SelectObject( const String& rName ) return ( pFound != NULL ); } +//IAccessibility2 Implementation 2009----- +//Solution: If object is marked , return true , else return false . +//================================================== +sal_Bool ScDrawView::GetObjectIsMarked( SdrObject* pObject ) +{ + sal_Bool bisMarked =false; + if (pObject ) + { + bisMarked = IsObjMarked(pObject); + } + return bisMarked; +} +//-----IAccessibility2 Implementation 2009 //UNUSED2008-05 String ScDrawView::GetSelectedChartName() const //UNUSED2008-05 { //UNUSED2008-05 // used for modifying a chart's data area - PersistName must always be used diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 73417791184f..34c4aa061eaf 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -866,6 +866,45 @@ void ScGridWindow::DoScenarioMenue( const ScRange& rScenRange ) CaptureMouse(); } +//IAccessibility2 Implementation 2009----- +sal_Bool ScGridWindow::HasScenarioRange( sal_uInt16 nCol, sal_Int32 nRow, ScRange& rScenRange ) +{ + ScDocument* pDoc = pViewData->GetDocument(); + sal_uInt16 nTab = pViewData->GetTabNo(); + sal_uInt16 nTabCount = pDoc->GetTableCount(); + if ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) ) + { + sal_uInt16 i; + ScMarkData aMarks; + for (i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++) + pDoc->MarkScenario( i, nTab, aMarks, sal_False, SC_SCENARIO_SHOWFRAME ); + ScRangeList aRanges; + aMarks.FillRangeListWithMarks( &aRanges, sal_False ); + sal_uInt16 nRangeCount = (sal_uInt16)aRanges.Count(); + for (i=0; i<nRangeCount; i++) + { + ScRange aRange = *aRanges.GetObject(i); + pDoc->ExtendTotalMerge( aRange ); + sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 ); + sal_Bool bIsInScen = sal_False; + if ( bTextBelow ) + { + bIsInScen = (aRange.aStart.Col() == nCol && aRange.aEnd.Row() == nRow-1); + } + else + { + bIsInScen = (aRange.aStart.Col() == nCol && aRange.aStart.Row() == nRow+1); + } + if (bIsInScen) + { + rScenRange = aRange; + return sal_True; + } + } + } + return sal_False; +} +//-----IAccessibility2 Implementation 2009 void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, sal_Bool bDataSelect ) { delete pFilterBox; @@ -2234,6 +2273,9 @@ void __EXPORT ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt ) pViewData->GetView()->InvalidateAttribs(); } +//IAccessibility2 Implementation 2009----- + pViewData->GetViewShell()->SelectionChanged(); +//-----IAccessibility2 Implementation 2009 return; } } @@ -3068,7 +3110,9 @@ void __EXPORT ScGridWindow::KeyInput(const KeyEvent& rKEvt) if( !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) ) { SC_MOD()->EndReference(); - return; +//IAccessibility2 Implementation 2009----- + //return; +//-----IAccessibility2 Implementation 2009 } else if( pViewData->GetViewShell()->MoveCursorKeyInput( rKEvt ) ) { @@ -3076,8 +3120,14 @@ void __EXPORT ScGridWindow::KeyInput(const KeyEvent& rKEvt) pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(), pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() ); SC_MOD()->SetReference( aRef, pViewData->GetDocument() ); - return; +//IAccessibility2 Implementation 2009----- + //return; +//-----IAccessibility2 Implementation 2009 } +//IAccessibility2 Implementation 2009----- + pViewData->GetViewShell()->SelectionChanged(); + return ; +//-----IAccessibility2 Implementation 2009 } // wenn semi-Modeless-SfxChildWindow-Dialog oben, keine KeyInputs: else if( !pViewData->IsAnyFillMode() ) diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index fce5ba1a3f61..677cc7ae819c 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -179,6 +179,10 @@ sal_Bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt) if ( !bOldMarked && rKEvt.GetKeyCode().GetCode() == KEY_DELETE ) bUsed = sal_False; // nichts geloescht +//IAccessibility2 Implementation 2009----- + if(bOldMarked) + GetFocus(); +//-----IAccessibility2 Implementation 2009 } if (!bLeaveDraw) UpdateStatusPosSize(); // #108137# for moving/resizing etc. by keyboard diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx index e45ad78d0559..afa626206e78 100644 --- a/sc/source/ui/view/gridwin5.cxx +++ b/sc/source/ui/view/gridwin5.cxx @@ -58,6 +58,9 @@ #include "tabvwsh.hxx" #include "userdat.hxx" #include "postit.hxx" +//IAccessibility2 Implementation 2009----- +#include <vcl/svapp.hxx> +//-----IAccessibility2 Implementation 2009 // ----------------------------------------------------------------------- @@ -423,13 +426,42 @@ void ScGridWindow::HideNoteMarker() com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > ScGridWindow::CreateAccessible() { +//IAccessibility2 Implementation 2009----- + com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc= GetAccessible(sal_False); + if (xAcc.is()) + { + return xAcc; + } +//-----IAccessibility2 Implementation 2009 ScAccessibleDocument* pAccessibleDocument = new ScAccessibleDocument(GetAccessibleParentWindow()->GetAccessible(), pViewData->GetViewShell(), eWhich); - - com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccessible = pAccessibleDocument; +//IAccessibility2 Implementation 2009----- + //com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccessible = pAccessibleDocument; + xAcc = pAccessibleDocument; + SetAccessible(xAcc); +//-----IAccessibility2 Implementation 2009 pAccessibleDocument->Init(); - - return xAccessible; +//IAccessibility2 Implementation 2009----- + //return xAccessible; + return xAcc; +//-----IAccessibility2 Implementation 2009 } +//IAccessibility2 Implementation 2009----- +// MT: Removed Windows::SwitchView() introduced with IA2 CWS. +// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism +void ScGridWindow::SwitchView() +{ + if (!Application::IsAccessibilityEnabled()) + { + return ; + } + ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get()); + if (pAccDoc) + { + pAccDoc->SwitchViewFireFocus(); + } +} +//-----IAccessibility2 Implementation 2009 + diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index de3bb3a49b26..d53ee4d26647 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -80,6 +80,9 @@ static ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = { // Hilfsklasse, fuer die Farbzuordnung, // um nicht mehrfach hintereinander denselben User aus der Liste zu suchen +//IAccessibility2 Implementation 2009----- +//Move this class declare to Chgtrack.hxx +/* class ScActionColorChanger { private: @@ -96,6 +99,8 @@ public: void Update( const ScChangeAction& rAction ); ColorData GetColor() const { return nColor; } }; +*/ +//-----IAccessibility2 Implementation 2009 //------------------------------------------------------------------ diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 143ff3f2d0ff..47e4fc816e68 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -1474,13 +1474,42 @@ void ScPreview::LoseFocus() com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> ScPreview::CreateAccessible() { +//IAccessibility2 Implementation 2009----- + com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> xAcc= GetAccessible(sal_False); + if (xAcc.is()) + { + return xAcc; + } +//-----IAccessibility2 Implementation 2009 ScAccessibleDocumentPagePreview* pAccessible = new ScAccessibleDocumentPagePreview( GetAccessibleParentWindow()->GetAccessible(), pViewShell ); - com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xAccessible = pAccessible; +//IAccessibility2 Implementation 2009----- + //com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xAccessible = pAccessible; + xAcc = pAccessible; + SetAccessible(xAcc); +//-----IAccessibility2 Implementation 2009 pAccessible->Init(); - return xAccessible; +//IAccessibility2 Implementation 2009----- + //return xAccessible; + return xAcc; +//-----IAccessibility2 Implementation 2009 } - +//IAccessibility2 Implementation 2009----- +// MT: Removed Windows::SwitchView() introduced with IA2 CWS. +// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism +void ScPreview::SwitchView() +{ + if (!Application::IsAccessibilityEnabled()) + { + return ; + } + ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get()); + if (pAccDoc) + { + pAccDoc->SwitchViewFireFocus(); + } +} +//-----IAccessibility2 Implementation 2009 //Issue51656 Add resizeable margin on page preview from maoyg void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags ) { diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index eb36e9b92efb..f6d1a4c8f43f 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -369,6 +369,9 @@ sal_Bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, sal_Boo } pView->UpdateRef( nPosX, nPosY, pViewData->GetTabNo() ); +//IAccessibility2 Implementation 2009----- + pView->SelectionChanged(); +//-----IAccessibility2 Implementation 2009 } } else if (pViewData->IsFillMode() || diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 184540c6f253..389e916f53a3 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -118,7 +118,7 @@ void ScTabView::InitOwnBlockMode() } void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, - sal_Bool bTestNeg, sal_Bool bCols, sal_Bool bRows ) + sal_Bool bTestNeg, sal_Bool bCols, sal_Bool bRows, sal_Bool bForceNeg ) { if (!bIsBlockMode) { @@ -129,7 +129,11 @@ void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ, SCTAB nTab = aViewData.GetTabNo(); // Teil von Markierung aufheben? - if (bTestNeg) +//IAccessibility2 Implementation 2009----- + if (bForceNeg) + bBlockNeg = sal_True; +//-----IAccessibility2 Implementation 2009 + else if (bTestNeg) { if ( bCols ) bBlockNeg = rMark.IsColumnMarked( nCurX ); diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index eb81361b6b2a..023a6d92df44 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -41,6 +41,11 @@ #include <sfx2/sidebar/SidebarChildWindow.hxx> #include <avmedia/mediaplayer.hxx> +//IAccessibility2 Implementation 2009----- +#include "cell.hxx" +#include "docoptio.hxx" +//-----IAccessibility2 Implementation 2009 + #include "tabvwsh.hxx" #include "docsh.hxx" #include "reffact.hxx" @@ -106,3 +111,20 @@ IMPL_LINK( ScTabViewShell, HtmlOptionsHdl, void*, EMPTYARG ) GetViewFrame()->GetBindings().Invalidate(SID_DRAW_TEXT_MARQUEE); return 0; } + +//IAccessibility2 Implementation 2009----- +rtl::OUString ScTabViewShell::GetFormula(ScAddress& rAddress) +{ + String sFormula; + ScDocument* pDoc = GetViewData()->GetDocument(); + ScBaseCell* pCell = pDoc->GetCell(rAddress); + if (pCell && pCell->GetCellType()==CELLTYPE_FORMULA) + { + static_cast<ScFormulaCell*>(pCell)->GetFormula(sFormula); + } + return sFormula; +} +//-----IAccessibility2 Implementation 2009 + + + diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx index 1845779131df..652a356eae3d 100644 --- a/sc/source/ui/view/tabvwsh4.cxx +++ b/sc/source/ui/view/tabvwsh4.cxx @@ -93,6 +93,9 @@ #include "sc.hrc" //CHINA001 #include "scabstdlg.hxx" //CHINA001 #include "externalrefmgr.hxx" +//IAccessibility2 Implementation 2009----- +#include <svx/fmpage.hxx> +//-----IAccessibility2 Implementation 2009 void ActivateOlk( ScViewData* pViewData ); void DeActivateOlk( ScViewData* pViewData ); @@ -112,7 +115,9 @@ sal_uInt16 ScTabViewShell::nInsObjCtrlState = SID_INSERT_DIAGRAM; void __EXPORT ScTabViewShell::Activate(sal_Bool bMDI) { SfxViewShell::Activate(bMDI); - +//IAccessibility2 Implementation 2009----- + bIsActive = sal_True; +//-----IAccessibility2 Implementation 2009 // hier kein GrabFocus, sonst gibt's Probleme wenn etwas inplace editiert wird! if ( bMDI ) @@ -242,7 +247,9 @@ void __EXPORT ScTabViewShell::Deactivate(sal_Bool bMDI) } SfxViewShell::Deactivate(bMDI); - +//IAccessibility2 Implementation 2009----- + bIsActive = sal_False; +//-----IAccessibility2 Implementation 2009 ScInputHandler* pHdl = SC_MOD()->GetInputHdl(this); if( bMDI ) @@ -1481,6 +1488,52 @@ sal_Bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt) } } +//IAccessibility2 Implementation 2009----- + // use Ctrl+Alt+Shift+arrow keys to move the cursor in cells + // while keeping the last selection + if ( !bUsed && bAlt && bControl && bShift) + { + sal_uInt16 nSlotId = 0; + switch (nCode) + { + case KEY_UP: + nSlotId = SID_CURSORUP; + break; + case KEY_DOWN: + nSlotId = SID_CURSORDOWN; + break; + case KEY_LEFT: + nSlotId = SID_CURSORLEFT; + break; + case KEY_RIGHT: + nSlotId = SID_CURSORRIGHT; + break; + case KEY_PAGEUP: + nSlotId = SID_CURSORPAGEUP; + break; + case KEY_PAGEDOWN: + nSlotId = SID_CURSORPAGEDOWN; + break; + case KEY_HOME: + nSlotId = SID_CURSORHOME; + break; + case KEY_END: + nSlotId = SID_CURSOREND; + break; + default: + nSlotId = 0; + break; + } + if ( nSlotId ) + { + sal_uInt16 nMode = GetLockedModifiers(); + LockModifiers(KEY_MOD1); + GetViewData()->GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD ); + LockModifiers(nMode); + bUsed = sal_True; + } + } +//-----IAccessibility2 Implementation 2009 if (bHideCursor) ShowAllCursors(); @@ -1556,6 +1609,9 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode ) ScDocument* pDoc = pDocSh->GetDocument(); bReadOnly = pDocSh->IsReadOnly(); +//IAccessibility2 Implementation 2009----- + bIsActive = sal_False; +//-----IAccessibility2 Implementation 2009 SetName( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("View")) ); // fuer SBX Color aColBlack( COL_BLACK ); @@ -1980,3 +2036,13 @@ void ScTabViewShell::GetTbxState( SfxItemSet& rSet ) +//IAccessibility2 Implementation 2009----- +const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & ScTabViewShell::GetForms() const +{ + if( !pFormShell || !pFormShell->GetCurPage() ){ + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > aRef; + return aRef; + } + return pFormShell->GetCurPage()->GetForms(); +} +//-----IAccessibility2 Implementation 2009 diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index a7451681312c..d626ea8365af 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -48,6 +48,9 @@ #include "editsh.hxx" #include "dociter.hxx" #include "inputhdl.hxx" +//IAccessibility2 Implementation 2009----- +#include <svx/srchdlg.hxx> +//-----IAccessibility2 Implementation 2009 #include "document.hxx" //================================================================== @@ -254,7 +257,29 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) const SvxSearchItem* pSearchItem = (const SvxSearchItem*) pItem; ScGlobal::SetSearchItem( *pSearchItem ); - SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() ); + //IAccessibility2 Implementation 2009----- + //SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() ); + sal_Bool bSuccess = SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() ); + if ( Application::IsAccessibilityEnabled() ) + { + SvxSearchDialog* pSearchDlg = + ((SvxSearchDialog*)(SfxViewFrame::Current()->GetChildWindow( + SvxSearchDialogWrapper::GetChildWindowId())->GetWindow())); + if( pSearchDlg ) + { + ScTabView* pTabView = GetViewData()->GetView(); + if( pTabView ) + { + Window* pWin = pTabView->GetActiveWin(); + if( pWin ) + { + pSearchDlg->SetDocWin( pWin ); + pSearchDlg->SetSrchFlag( bSuccess ); + } + } + } + } + //-----IAccessibility2 Implementation 2009 rReq.Done(); } } @@ -306,6 +331,27 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq ) rReq.IsAPI() ? SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON : SFX_CALLMODE_STANDARD, &aSearchItem, 0L ); + //IAccessibility2 Implementation 2009----- + if ( Application::IsAccessibilityEnabled() ) + { + SvxSearchDialog* pSearchDlg = + ((SvxSearchDialog*)(SfxViewFrame::Current()->GetChildWindow( + SvxSearchDialogWrapper::GetChildWindowId())->GetWindow())); + if( pSearchDlg ) + { + ScTabView* pTabView = GetViewData()->GetView(); + if( pTabView ) + { + Window* pWin = pTabView->GetActiveWin(); + if( pWin ) + { + pSearchDlg->SetDocWin( pWin ); + pSearchDlg->SetSrchFlag(); + } + } + } + } + //-----IAccessibility2 Implementation 2009 } else { diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 9b9f360eb6c1..af54b7640ac3 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -1616,8 +1616,11 @@ void ScViewFunc::AutoFormat( sal_uInt16 nFormatNo, sal_Bool bRecord ) //---------------------------------------------------------------------------- // Suchen & Ersetzen -void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, +//IAccessibility2 Implementation 2009----- +//void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, +sal_Bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, sal_Bool bAddUndo, sal_Bool bIsApi ) +//-----IAccessibility2 Implementation 2009 { ScDocShell* pDocSh = GetViewData()->GetDocShell(); ScDocument* pDoc = pDocSh->GetDocument(); @@ -1669,7 +1672,10 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, if ( pOldSelectedTables ) delete [] pOldSelectedTables; ErrorMessage(STR_PROTECTIONERR); - return; + //IAccessibility2 Implementation 2009----- + //return; + return sal_False; + //-----IAccessibility2 Implementation 2009 } } } @@ -1843,6 +1849,9 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem, delete pUndoDoc; // loeschen wenn nicht benutzt delete pUndoMark; // kann immer geloescht werden +//IAccessibility2 Implementation 2009----- + return bFound; +//-----IAccessibility2 Implementation 2009 } |