summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorSteve Yin <steve_y@apache.org>2013-12-02 15:54:29 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-12-02 16:41:08 +0000
commitb41332475783c31136673fb44cf4c411bb0148f8 (patch)
tree39ba57867ed6ae3f39e60c38180f800542067b49 /sc/source
parent23fdf75cd6e6cb37bfeac08f503a15d07d9beda9 (diff)
Integrate branch of IAccessible2
Conflicts: everything Change-Id: I3d8cf956f511a0d953a1cefe83b6ef987806da25
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/documen2.cxx161
-rw-r--r--sc/source/core/data/document.cxx1
-rw-r--r--sc/source/core/data/drwlayer.cxx20
-rw-r--r--sc/source/core/data/table2.cxx9
-rw-r--r--sc/source/core/tool/detfunc.cxx5
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx180
-rw-r--r--sc/source/ui/Accessibility/AccessibleCellBase.cxx322
-rw-r--r--sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx115
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx488
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentBase.cxx5
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx27
-rw-r--r--sc/source/ui/Accessibility/AccessibleEditObject.cxx202
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx1006
-rw-r--r--sc/source/ui/Accessibility/AccessibleTableBase.cxx58
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx15
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx32
-rw-r--r--sc/source/ui/docshell/docsh.cxx16
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx12
-rw-r--r--sc/source/ui/inc/AccessibleCell.hxx15
-rw-r--r--sc/source/ui/inc/AccessibleCellBase.hxx13
-rw-r--r--sc/source/ui/inc/AccessibleDocument.hxx30
-rw-r--r--sc/source/ui/inc/AccessibleDocumentBase.hxx1
-rw-r--r--sc/source/ui/inc/AccessibleDocumentPagePreview.hxx2
-rw-r--r--sc/source/ui/inc/AccessibleEditObject.hxx51
-rw-r--r--sc/source/ui/inc/AccessibleSpreadsheet.hxx57
-rw-r--r--sc/source/ui/inc/AccessibleTableBase.hxx10
-rw-r--r--sc/source/ui/inc/AccessibleText.hxx4
-rw-r--r--sc/source/ui/inc/content.hxx16
-rw-r--r--sc/source/ui/inc/dbnamdlg.hxx2
-rw-r--r--sc/source/ui/inc/docsh.hxx5
-rw-r--r--sc/source/ui/inc/drawview.hxx4
-rw-r--r--sc/source/ui/inc/gridwin.hxx3
-rw-r--r--sc/source/ui/inc/preview.hxx2
-rw-r--r--sc/source/ui/inc/scuitphfedit.hxx2
-rw-r--r--sc/source/ui/inc/tabview.hxx2
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx6
-rw-r--r--sc/source/ui/inc/tphfedit.hxx5
-rw-r--r--sc/source/ui/inc/viewfunc.hxx2
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx2
-rw-r--r--sc/source/ui/navipi/content.cxx252
-rw-r--r--sc/source/ui/navipi/navipi.cxx7
-rw-r--r--sc/source/ui/pagedlg/scuitphfedit.cxx10
-rw-r--r--sc/source/ui/pagedlg/tphfedit.cxx10
-rw-r--r--sc/source/ui/view/drawview.cxx94
-rw-r--r--sc/source/ui/view/gridwin.cxx43
-rw-r--r--sc/source/ui/view/gridwin3.cxx2
-rw-r--r--sc/source/ui/view/gridwin5.cxx24
-rw-r--r--sc/source/ui/view/output.cxx17
-rw-r--r--sc/source/ui/view/preview.cxx23
-rw-r--r--sc/source/ui/view/select.cxx1
-rw-r--r--sc/source/ui/view/tabview2.cxx6
-rw-r--r--sc/source/ui/view/tabvwsh.cxx17
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx62
-rw-r--r--sc/source/ui/view/tabvwshe.cxx35
-rw-r--r--sc/source/ui/view/viewfun2.cxx3
55 files changed, 3307 insertions, 207 deletions
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 6c112d5803c3..2ee3828f30a0 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -82,6 +82,9 @@
#include "recursionhelper.hxx"
#include "lookupcache.hxx"
#include "externalrefmgr.hxx"
+#include "appoptio.hxx"
+#include "scmod.hxx"
+#include "../../ui/inc/viewutil.hxx"
#include "tabprotection.hxx"
#include "formulaparserpool.hxx"
#include "clipparam.hxx"
@@ -216,7 +219,8 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
mbStreamValidLocked( false ),
mbUserInteractionEnabled(true),
mnNamedRangesLockCount(0),
- mbUseEmbedFonts(false)
+ mbUseEmbedFonts(false),
+ mbReadOnly(false)
{
SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
@@ -1215,6 +1219,161 @@ void ScDocument::ClearLookupCaches()
pLookupCacheMapImpl->clear();
}
+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, OUString &aTrackText,sal_Bool &bLeftEdge)
+{
+ aTrackText = OUString();
+ // 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 += ", ";
+ aTrackText += ScGlobal::pLocaleData->getDate(aDT);
+ aTrackText += " ";
+ aTrackText += ScGlobal::pLocaleData->getTime(aDT);
+ aTrackText += ":\n";
+ OUString aComStr = pFound->GetComment();
+ if(!aComStr.isEmpty())
+ {
+ aTrackText += aComStr;
+ aTrackText += "\n( ";
+ }
+ pFound->GetDescription( aTrackText, this );
+ if (!aComStr.isEmpty())
+ {
+ aTrackText += ")";
+ }
+ }
+ }
+}
+
void ScDocument::SetPreviewFont( SfxItemSet* pFont )
{
delete pPreviewFont;
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 8048d0265344..a24889be64f3 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -178,7 +178,6 @@ void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck )
}
}
-
bool ScDocument::HasTable( SCTAB nTab ) const
{
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()))
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 5d52b0c1c9c7..4f3ba5b67564 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2030,6 +2030,26 @@ ScMacroInfo* ScDrawLayer::GetMacroInfo( SdrObject* pObj, sal_Bool bCreate )
return 0;
}
+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;
+}
+
void ScDrawLayer::SetGlobalDrawPersist(SfxObjectShell* pPersist)
{
OSL_ENSURE(!pGlobalDrawPersist,"Multiple SetGlobalDrawPersist");
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 30771ab49090..87e4832cdee0 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -3654,4 +3654,13 @@ sal_uLong ScTable::GetColOffset( SCCOL nCol, bool bHiddenAsZero ) const
return n;
}
+ScColumn* ScTable::GetColumnByIndex(sal_Int32 index)
+{
+ if( index <= MAXCOL && index >= 0 )
+ {
+ return &(aCol[index]);
+ }
+ return NULL;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index d69ba93a98ec..e1448a00e000 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1691,4 +1691,9 @@ sal_Bool ScDetectiveFunc::IsColorsInitialized()
return bColorsInitialized;
}
+void ScDetectiveFunc::AppendChangTrackNoteSeparator(OUString &rDisplay)
+{
+ rDisplay += "\n--------\n";
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
index 199ec69295d7..c768f8a63eff 100644
--- a/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -33,6 +33,7 @@
#include "markdata.hxx"
#include "cellvalue.hxx"
#include "formulaiter.hxx"
+#include "validat.hxx"
#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
@@ -44,6 +45,8 @@
#include <float.h>
#include <vcl/svapp.hxx>
+#include "AccessibleSpreadsheet.hxx"
+
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -103,11 +106,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 ============================================
@@ -226,6 +229,23 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
pStateSet->AddState(AccessibleStateType::DEFUNC);
else
{
+ 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;
+ }
if (IsEditable(xParentStates))
{
pStateSet->AddState(AccessibleStateType::EDITABLE);
@@ -234,6 +254,7 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
pStateSet->AddState(AccessibleStateType::ENABLED);
pStateSet->AddState(AccessibleStateType::MULTI_LINE);
pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+ pStateSet->AddState(AccessibleStateType::FOCUSABLE);
if (IsOpaque(xParentStates))
pStateSet->AddState(AccessibleStateType::OPAQUE);
pStateSet->AddState(AccessibleStateType::SELECTABLE);
@@ -329,6 +350,16 @@ sal_Bool ScAccessibleCell::IsOpaque(
sal_Bool ScAccessibleCell::IsSelected()
{
+ if (IsFormulaMode())
+ {
+ const ScAccessibleSpreadsheet *pSheet =static_cast<const ScAccessibleSpreadsheet*>(mxParent.get());
+ if (pSheet)
+ {
+ return pSheet->IsScAddrFormulaSel(maCellAddress);
+ }
+ return sal_False;
+ }
+
sal_Bool bResult(false);
if (mpViewShell && mpViewShell->GetViewData())
{
@@ -349,6 +380,10 @@ ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
SAL_WNODEPRECATED_DECLARATIONS_PUSH
::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
{
+ if (IsFormulaMode())
+ {
+ return ::std::auto_ptr< SvxEditSource >();
+ }
::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
@@ -435,4 +470,145 @@ void ScAccessibleCell::AddRelation(const ScRange& rRange,
}
}
+OUString ReplaceOneChar(OUString oldOUString, OUString replacedChar, 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;
+}
+
+OUString ReplaceFourChar(OUString oldOUString)
+{
+ oldOUString = ReplaceOneChar(oldOUString, "\\", "\\\\");
+ oldOUString = ReplaceOneChar(oldOUString, ";", "\\;");
+ oldOUString = ReplaceOneChar(oldOUString, "=", "\\=");
+ oldOUString = ReplaceOneChar(oldOUString, ",", "\\,");
+ oldOUString = ReplaceOneChar(oldOUString, ":", "\\:");
+ 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 OUString strAttr(":");
+ const OUString strSplit(";");
+ OUString strFor = mpViewShell->GetFormula(maCellAddress) ;
+ strFor = strFor.replaceAt(0,1,"");
+ strFor = ReplaceFourChar(strFor);
+ strFor = "Formula:" + strFor;
+ strFor += strSplit;
+ strFor += "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 += "isdropdown:";
+ if( IsDropdown() )
+ strFor += "true";
+ else
+ strFor += "false";
+ strFor += ";";
+ }
+ 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< 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)
+ {
+ OUString sLeftMarginName ("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();
+ 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;
+ }
+ 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) )
+ {
+ SCTAB 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;
+ SCTAB nRangeCount = aRanges.size();
+ for (i=0; i<nRangeCount; i++)
+ {
+ ScRange aRange = *aRanges[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;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index 84635248af11..d021dbd90ccb 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -28,11 +28,16 @@
#include "scresid.hxx"
#include "sc.hrc"
#include "unonames.hxx"
+#include "detfunc.hxx"
+#include "chgtrack.hxx"
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSheetAnnotation.hpp>
+#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
#include <editeng/brushitem.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
@@ -212,15 +217,9 @@ OUString SAL_CALL
ScAccessibleCellBase::createAccessibleName(void)
throw (uno::RuntimeException)
{
- OUString sName( SC_RESSTR(STR_ACC_CELL_NAME) );
// Document not needed, because only the cell address, but not the tablename is needed
// always us OOO notation
- OUString sAddress(maCellAddress.Format(SCA_VALID, NULL));
- /* #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 = sName.replaceFirst("%1", sAddress) + " ";
- return OUString(sName);
+ return maCellAddress.Format(SCA_VALID, NULL);
}
//===== XAccessibleValue ================================================
@@ -229,12 +228,14 @@ uno::Any SAL_CALL
ScAccessibleCellBase::getCurrentValue( )
throw (uno::RuntimeException)
{
- SolarMutexGuard aGuard;
+ SolarMutexGuard aGuard;
IsObjectValid();
uno::Any aAny;
if (mpDoc)
- aAny <<= mpDoc->GetValue(maCellAddress);
-
+ {
+ OUString valStr(mpDoc->GetString(maCellAddress.Col(),maCellAddress.Row(),maCellAddress.Tab()));
+ aAny <<= valStr;
+ }
return aAny;
}
@@ -320,4 +321,305 @@ sal_Bool ScAccessibleCellBase::IsEditable(
return bEditable;
}
+OUString SAL_CALL ScAccessibleCellBase::GetNote(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ 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;
+}
+
+#include <com/sun/star/table/ShadowFormat.hpp>
+
+OUString SAL_CALL ScAccessibleCellBase::getShadowAttrs(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard 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(OUString(SC_UNONAME_SHADOW));
+ aAny >>= aShadowFmt;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ //construct shadow attributes string
+ OUString sShadowAttrs("Shadow:");
+ OUString sInnerSplit(",");
+ OUString sOuterSplit(";");
+ 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 += "Location=";
+ sShadowAttrs += OUString::number( (sal_Int32)nLocationVal );
+ sShadowAttrs += sInnerSplit;
+ sShadowAttrs += "ShadowWidth=";
+ sShadowAttrs += OUString::number( (sal_Int32)aShadowFmt.ShadowWidth ) ;
+ sShadowAttrs += sInnerSplit;
+ sShadowAttrs += "IsTransparent=";
+ sShadowAttrs += OUString::number( (sal_Bool)aShadowFmt.IsTransparent ) ;
+ sShadowAttrs += sInnerSplit;
+ sShadowAttrs += "Color=";
+ sShadowAttrs += OUString::number( (sal_Int32)aShadowFmt.Color );
+ sShadowAttrs += sOuterSplit;
+ return sShadowAttrs;
+}
+
+#include <com/sun/star/table/BorderLine.hpp>
+
+OUString SAL_CALL ScAccessibleCellBase::getBorderAttrs(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard 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(OUString(SC_UNONAME_TOPBORDER));
+ aAny >>= aTopBorder;
+ aAny = xCellProps->getPropertyValue(OUString(SC_UNONAME_BOTTBORDER));
+ aAny >>= aBottomBorder;
+ aAny = xCellProps->getPropertyValue(OUString(SC_UNONAME_LEFTBORDER));
+ aAny >>= aLeftBorder;
+ aAny = xCellProps->getPropertyValue(OUString(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
+ OUString sBorderAttrs;
+ OUString sInnerSplit(",");
+ OUString sOuterSplit(";");
+ //top border
+ //if top of the cell has no border
+ if ( aTopBorder.InnerLineWidth == 0 && aTopBorder.OuterLineWidth == 0 )
+ {
+ sBorderAttrs += "TopBorder:;";
+ }
+ else//add all the border properties to the return string.
+ {
+ sBorderAttrs += "TopBorder:Color=";
+ sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.Color );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "InnerLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.InnerLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "OuterLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.OuterLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "LineDistance=";
+ sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.LineDistance );
+ sBorderAttrs += sOuterSplit;
+ }
+ //bottom border
+ if ( aBottomBorder.InnerLineWidth == 0 && aBottomBorder.OuterLineWidth == 0 )
+ {
+ sBorderAttrs += "BottomBorde:;";
+ }
+ else
+ {
+ sBorderAttrs += "BottomBorder:Color=";
+ sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.Color );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "InnerLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.InnerLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "OuterLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.OuterLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "LineDistance=";
+ sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.LineDistance );
+ sBorderAttrs += sOuterSplit;
+ }
+ //left border
+ if ( aLeftBorder.InnerLineWidth == 0 && aLeftBorder.OuterLineWidth == 0 )
+ {
+ sBorderAttrs += "LeftBorder:;";
+ }
+ else
+ {
+ sBorderAttrs += "LeftBorder:Color=";
+ sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.Color );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "InnerLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.InnerLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "OuterLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.OuterLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "LineDistance=";
+ sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.LineDistance );
+ sBorderAttrs += sOuterSplit;
+ }
+ //right border
+ if ( aRightBorder.InnerLineWidth == 0 && aRightBorder.OuterLineWidth == 0 )
+ {
+ sBorderAttrs += "RightBorder:;";
+ }
+ else
+ {
+ sBorderAttrs += "RightBorder:Color=";
+ sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.Color );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "InnerLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.InnerLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "OuterLineWidth=";
+ sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.OuterLineWidth );
+ sBorderAttrs += sInnerSplit;
+ sBorderAttrs += "LineDistance=";
+ sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.LineDistance );
+ sBorderAttrs += sOuterSplit;
+ }
+ return sBorderAttrs;
+}
+//end of cell attributes
+
+OUString SAL_CALL ScAccessibleCellBase::GetAllDisplayNote(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ OUString strNote;
+ OUString strTrackText;
+ if (mpDoc)
+ {
+ sal_Bool bLeftedge=sal_False;
+ mpDoc->GetCellChangeTrackNote(maCellAddress,strTrackText,bLeftedge);
+ }
+ if (!strTrackText.isEmpty())
+ {
+ ScDetectiveFunc::AppendChangTrackNoteSeparator(strTrackText);
+ strNote = strTrackText;
+ }
+ strNote += GetNote();
+ return strNote;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
index 20f18bc2ac33..073682b7c3a0 100644
--- a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
@@ -21,9 +21,15 @@
#include "fieldwnd.hxx"
#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <vcl/keycodes.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
#include <unotools/accessiblestatesethelper.hxx>
#include <comphelper/servicehelper.hxx>
#include <tools/gen.hxx>
@@ -35,6 +41,7 @@ using namespace ::com::sun::star::accessibility;
class ScAccessibleDataPilotButton
: public ScAccessibleContextBase
+ , public ::com::sun::star::accessibility::XAccessibleAction
{
public:
//===== internal ========================================================
@@ -56,6 +63,17 @@ public:
protected:
virtual ~ScAccessibleDataPilotButton(void);
public:
+ // 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 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 ();
///===== XAccessibleComponent ============================================
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
@@ -97,7 +115,8 @@ public:
::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
getAccessibleStateSet(void)
throw (::com::sun::star::uno::RuntimeException);
-
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet >
+ SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException);
///===== XServiceInfo ====================================================
/** Returns an identifier for the implementation of this object.
@@ -313,6 +332,9 @@ void ScAccessibleDataPilotControl::GotFocus()
{
OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
+ if(maChildren.size()==0)
+ return ;
+
sal_Int32 nIndex(mpFieldWindow->GetSelectedField());
if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size())
{
@@ -333,6 +355,9 @@ void ScAccessibleDataPilotControl::LostFocus()
{
OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
+ if(maChildren.size()==0)
+ return ;
+
sal_Int32 nIndex(mpFieldWindow->GetSelectedField());
if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size())
{
@@ -553,7 +578,7 @@ ScAccessibleDataPilotButton::ScAccessibleDataPilotButton(
::com::sun::star::accessibility::XAccessible>& rxParent,
ScDPFieldControlBase* pFieldWindow,
sal_Int32 nIndex)
- : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
+ : ScAccessibleContextBase(rxParent, AccessibleRole::BUTTON_MENU),
mpFieldWindow(pFieldWindow),
mnIndex(nIndex)
{
@@ -693,7 +718,23 @@ uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotButton::getAcc
return pStateSet;
}
- ///===== XServiceInfo ====================================================
+::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;
+
+}
+
+///===== XServiceInfo ====================================================
OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void)
throw (::com::sun::star::uno::RuntimeException)
@@ -717,6 +758,8 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotButton::getImplementationI
OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void)
throw (::com::sun::star::uno::RuntimeException)
{
+ if (mpFieldWindow)
+ return mpFieldWindow->GetHelpText();
return OUString();
}
@@ -754,4 +797,68 @@ Rectangle ScAccessibleDataPilotButton::GetBoundingBox(void) const
return Rectangle();
}
+// -----------------------------------------------------------------------------
+// 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;
+}
+
+OUString ScAccessibleDataPilotButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+ throw lang::IndexOutOfBoundsException();
+ return OUString("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;
+ ScDPFieldControlBase* pWindow = mpFieldWindow;
+ if ( pWindow )
+ {
+ awt::KeyStroke aKeyStroke;
+ aKeyStroke.Modifiers = 0;
+ aKeyStroke.KeyCode = KEY_SPACE;
+ pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+ }
+ return xKeyBinding;
+}
+
+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();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 6d3b7f8c1957..7a4a765ee6be 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -48,6 +48,7 @@
#include "userdat.hxx"
#include "scresid.hxx"
#include "sc.hrc"
+#include "table.hxx"
#include "markdata.hxx"
#include <com/sun/star/accessibility/AccessibleEventId.hpp>
@@ -74,9 +75,22 @@
#include <toolkit/helper/convert.hxx>
#include <vcl/svapp.hxx>
+#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>
+
#include <list>
#include <algorithm>
+#include "AccessibleCell.hxx"
+
+#include "svx/unoapi.hxx"
+#include "scmod.hxx"
+
#ifdef indices
#undef indices
#endif
@@ -256,6 +270,14 @@ public:
const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
) throw (::com::sun::star::uno::RuntimeException);
+ 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);
///===== Internal ========================================================
void SetDrawBroadcaster();
@@ -476,6 +498,44 @@ sal_Bool ScChildrenShapes::ReplaceChild (::accessibility::AccessibleShape* pCurr
return bResult;
}
+::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 );
+ if(xNewChild.get())
+ return xNewChild;
+ }
+ }
+ return NULL;
+}
+
sal_Int32 ScChildrenShapes::GetCount() const
{
SdrPage* pDrawPage = GetDrawPage();
@@ -754,6 +814,8 @@ uno::Reference< XAccessible > ScChildrenShapes::GetSelected(sal_Int32 nSelectedC
std::vector < uno::Reference < drawing::XShape > > aShapes;
FillShapes(aShapes);
+ if(aShapes.size()<=0)
+ return xAccessible;
SortedShapes::iterator aItr;
if (FindShape(aShapes[nSelectedChildIndex], aItr))
xAccessible = Get(aItr - maZOrderedShapes.begin());
@@ -898,9 +960,16 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin
}
else
mnShapesSelected = 0;
+ SdrObject *pFocusedObj = NULL;
+ if( mnShapesSelected == 1 && aShapesList.size() == 1)
+ {
+ pFocusedObj = GetSdrObjectFromXShape(aShapesList[0]->xShape);
+ }
ScShapeDataLess aLess;
std::sort(aShapesList.begin(), aShapesList.end(), aLess);
-
+ SortedShapes vecSelectedShapeAdd;
+ SortedShapes vecSelectedShapeRemove;
+ sal_Bool bHasSelect=sal_False;
SortedShapes::iterator aXShapesItr(aShapesList.begin());
SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
SortedShapes::iterator aDataItr(maZOrderedShapes.begin());
@@ -925,9 +994,14 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin
(*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
(*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
bResult = sal_True;
+ vecSelectedShapeAdd.push_back((*aDataItr));
}
aFocusedItr = aDataItr;
}
+ else
+ {
+ bHasSelect = sal_True;
+ }
++aDataItr;
++aXShapesItr;
}
@@ -941,6 +1015,7 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin
(*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
(*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
bResult = sal_True;
+ vecSelectedShapeRemove.push_back(*aDataItr);
}
}
++aDataItr;
@@ -955,9 +1030,120 @@ sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawin
else
++aDataItr;
}
- if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1))
+ 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);
+ }
std::for_each(aShapesList.begin(), aShapesList.end(), Destroy());
return bResult;
@@ -1345,12 +1531,30 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
const ScAccGridWinFocusGotHint& rRef = (const ScAccGridWinFocusGotHint&)rHint;
if (rRef.GetNewGridWin() == meSplitPos)
{
+ 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();
+ }
}
}
else if (rHint.ISA( SfxSimpleHint ))
@@ -1370,10 +1574,16 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
mpChildrenShapes = new ScChildrenShapes( this, mpViewShell, meSplitPos );
}
+ //Invoke Init() to rebuild the mpChildrenShapes variable
+ this->Init();
+
AccessibleEventObject aEvent;
aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
aEvent.Source = uno::Reference< XAccessibleContext >(this);
CommitChange(aEvent); // all children changed
+
+ if (mpAccessibleSpreadsheet)
+ mpAccessibleSpreadsheet->FireFirstCellFocus();
}
else if (rRef.GetId() == SC_HINT_ACC_MAKEDRAWLAYER)
{
@@ -1384,19 +1594,23 @@ 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(),
- OUString(ScResId(STR_ACC_EDITLINE_DESCR)), ScAccessibleEditObject::CellInEditMode);
- uno::Reference<XAccessible> xAcc = mpTempAccEdit;
+ const EditEngine* pEditEng = mpViewShell->GetViewData()->GetEditView(meSplitPos)->GetEditEngine();
+ if (pEditEng && pEditEng->GetUpdateMode())
+ {
+ mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
+ mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
+ OUString(ScResId(STR_ACC_EDITLINE_DESCR)), ScAccessibleEditObject::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();
+ }
}
}
else if (rRef.GetId() == SC_HINT_ACC_LEAVEEDITMODE)
@@ -1408,10 +1622,9 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
mpTempAccEdit = NULL;
RemoveChild(mxTempAcc, sal_True);
-
- if (mpAccessibleSpreadsheet)
+ if (mpAccessibleSpreadsheet && mpViewShell->IsActive())
mpAccessibleSpreadsheet->GotFocus();
- else
+ else if( mpViewShell->IsActive())
CommitFocusGained();
}
}
@@ -1472,6 +1685,10 @@ void SAL_CALL ScAccessibleDocument::selectionChanged( const lang::EventObject& /
CommitChange(aEvent);
}
+ if(mpChildrenShapes )
+ {
+ mpChildrenShapes->SelectionChanged();
+ }
}
//===== XInterface =====================================================
@@ -1479,6 +1696,13 @@ void SAL_CALL ScAccessibleDocument::selectionChanged( const lang::EventObject& /
uno::Any SAL_CALL ScAccessibleDocument::queryInterface( uno::Type const & rType )
throw (uno::RuntimeException)
{
+ 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;
+ }
uno::Any aAny (ScAccessibleDocumentImpl::queryInterface(rType));
return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
}
@@ -1630,7 +1854,37 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
return pStateSet;
}
- ///===== XAccessibleSelection ===========================================
+OUString SAL_CALL
+ ScAccessibleDocument::getAccessibleName(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ OUString sName = ScResId(STR_ACC_DOC_SPREADSHEET);
+ ScDocument* pScDoc = GetDocument();
+ if ( pScDoc )
+ {
+ OUString sFileName = pScDoc->getDocAccTitle();
+ if ( !sFileName.getLength() )
+ {
+ SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+ if ( pObjSh )
+ {
+ sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME );
+ }
+ }
+ OUString sReadOnly;
+ if (pScDoc->getDocReadOnly())
+ {
+ sReadOnly = ScResId(STR_ACC_DOC_SPREADSHEET_READONLY);
+ }
+ if ( sFileName.getLength() )
+ {
+ sName = sFileName + sReadOnly + " - " + sName;
+ }
+ }
+ return sName;
+}
+
+///===== XAccessibleSelection ===========================================
void SAL_CALL
ScAccessibleDocument::selectAccessibleChild( sal_Int32 nChildIndex )
@@ -2098,4 +2352,206 @@ OUString ScAccessibleDocument::GetCurrentCellDescription() const
return OUString();
}
+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;
+
+ OUString sName;
+ OUString sValue;
+ sal_uInt16 sheetIndex;
+ OUString sSheetName;
+ sheetIndex = getVisibleTable();
+ if(GetDocument()==NULL)
+ return anyAtrribute;
+ GetDocument()->GetName(sheetIndex,sSheetName);
+ sName = "page-name:";
+ sValue = sName + sSheetName ;
+ sName = ";page-number:";
+ sValue += sName;
+ sValue += OUString::number(sheetIndex+1) ;
+ sName = ";total-pages:";
+ sValue += sName;
+ sValue += OUString::number(GetDocument()->GetTableCount());
+ sValue += ";";
+ 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)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx b/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
index 1bafb7b7831f..12435ea038b1 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
@@ -36,4 +36,9 @@ ScAccessibleDocumentBase::~ScAccessibleDocumentBase(void)
{
}
+void ScAccessibleDocumentBase::SwitchViewFireFocus()
+{
+ CommitFocusGained();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index ee68b61d5db5..94c28ecc4d53 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1696,4 +1696,31 @@ ScShapeChildren* ScAccessibleDocumentPagePreview::GetShapeChildren()
return mpShapeChildren;
}
+OUString ScAccessibleDocumentPagePreview::getAccessibleName(void)
+throw (::com::sun::star::uno::RuntimeException)
+{
+ OUString sName = ScResId(STR_ACC_DOC_SPREADSHEET);
+ ScDocument* pScDoc = mpViewShell->GetDocument();
+ if ( pScDoc )
+ {
+ OUString sFileName = pScDoc->getDocAccTitle();
+ if ( !sFileName.getLength() )
+ {
+ SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+ if ( pObjSh )
+ {
+ sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME );
+ }
+ }
+ if ( sFileName.getLength() )
+ {
+ sName = sFileName + " - " + sName;
+ sName += ScResId(STR_ACC_DOC_PREVIEW_SUFFIX);
+
+ }
+ }
+
+ return sName;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index b99d4826776d..a45c9c52646e 100644
--- a/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -28,13 +28,25 @@
#include <unotools/accessiblestatesethelper.hxx>
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <comphelper/servicehelper.hxx>
#include <svx/AccessibleTextHelper.hxx>
#include <editeng/editview.hxx>
#include <editeng/editeng.hxx>
#include <svx/svdmodel.hxx>
#include <vcl/svapp.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;
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
@@ -55,6 +67,21 @@ ScAccessibleEditObject::ScAccessibleEditObject(
CreateTextHelper();
SetName(rName);
SetDescription(rDescription);
+ 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;
}
ScAccessibleEditObject::~ScAccessibleEditObject()
@@ -93,6 +120,31 @@ void ScAccessibleEditObject::GotFocus()
mpTextHelper->SetFocus(sal_True);
}
+//===== 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 ();
+}
//===== XAccessibleComponent ============================================
uno::Reference< XAccessible > SAL_CALL ScAccessibleEditObject::getAccessibleAtPoint(
@@ -340,4 +392,154 @@ void ScAccessibleEditObject::CreateTextHelper()
}
}
+sal_Int32 SAL_CALL ScAccessibleEditObject::getForeground( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return GetFgBgColor(OUString(SC_UNONAME_CCOLOR));
+}
+
+sal_Int32 SAL_CALL ScAccessibleEditObject::getBackground( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return GetFgBgColor(OUString(SC_UNONAME_CELLBACK));
+}
+
+sal_Int32 ScAccessibleEditObject::GetFgBgColor( const OUString &strPropColor)
+{
+ SolarMutexGuard 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)
+{
+ SolarMutexGuard 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 >();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index c06ea6077c8b..5a525d0c43ff 100644
--- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -36,12 +36,213 @@
#include <tools/gen.hxx>
#include <svtools/colorcfg.hxx>
#include <vcl/svapp.hxx>
+#include "scresid.hxx"
+#include "sc.hrc"
#include <algorithm>
using namespace ::com::sun::star;
using namespace ::com::sun::star::accessibility;
+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->size() <= 1)
+ {
+ ScRange* pRange = pMarkedRanges->front();
+ 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();
+ size_t nSize = pMarkedRanges->size();
+ for (size_t i = 0; i < nSize; ++i)
+ {
+ ScRange* pRange = (*pMarkedRanges)[i];
+ 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
+ SAL_WARN("sc", "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
+ SAL_WARN("sc", "Range of wrong table");
+ }
+ 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);
+ size_t nSrcSize = pSrc->size();
+ for (size_t i = 0; i < nSrcSize; ++i)
+ {
+ ScRange* pRange = (*pSrc)[i];
+ 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()));
+ }
+ }
+ }
+ return sal_False;
+ }
+ //the Dest Rang List is not empty
+ vecRet.reserve(10);
+ size_t nSizeSrc = pSrc->size();
+ for (size_t i = 0; i < nSizeSrc; ++i)
+ {
+ ScRange* pRange = (*pSrc)[i];
+ size_t nSizeDest = pDest->size();
+ for (size_t j = 0; j < nSizeDest; ++j)
+ {
+ ScRange* pRangeDest = (*pDest)[j];
+ if (CalcScRangeDifferenceMax(pRange,pRangeDest,nMax,vecRet,nSize))
+ {
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
//===== internal ============================================================
// FIXME: really unclear why we have an ScAccessibleTableBase with
@@ -54,7 +255,11 @@ ScAccessibleSpreadsheet::ScAccessibleSpreadsheet(
:
ScAccessibleTableBase (pAccDoc, GetDocument(pViewShell),
ScRange(ScAddress(0, 0, nTab),ScAddress(MAXCOL, MAXROW, nTab))),
- mbIsSpreadsheet( sal_True )
+ mbIsSpreadsheet( sal_True ),
+ m_bFormulaMode(sal_False),
+ m_bFormulaLastMode(sal_False),
+ m_pAccFormulaCell(NULL),
+ m_nMinX(0),m_nMaxX(0),m_nMinY(0),m_nMaxY(0)
{
ConstructScAccessibleSpreadsheet( pAccDoc, pViewShell, nTab, eSplitPos );
}
@@ -69,10 +274,7 @@ ScAccessibleSpreadsheet::ScAccessibleSpreadsheet(
ScAccessibleSpreadsheet::~ScAccessibleSpreadsheet()
{
- if (mpMarkedRanges)
- delete mpMarkedRanges;
- if (mpSortedMarkedCells)
- delete mpSortedMarkedCells;
+ delete mpMarkedRanges;
if (mpViewShell)
mpViewShell->RemoveAccessibilityObject(*this);
}
@@ -106,6 +308,11 @@ void ScAccessibleSpreadsheet::ConstructScAccessibleSpreadsheet(
mpAccCell = GetAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col());
mpAccCell->acquire();
mpAccCell->Init();
+ ScDocument* pScDoc= GetDocument(mpViewShell);
+ if (pScDoc)
+ {
+ pScDoc->GetName( maActiveCell.Tab(), m_strOldTabName );
+ }
}
}
@@ -128,11 +335,12 @@ void SAL_CALL ScAccessibleSpreadsheet::disposing()
void ScAccessibleSpreadsheet::CompleteSelectionChanged(sal_Bool bNewState)
{
+ if (IsFormulaMode())
+ {
+ return ;
+ }
if (mpMarkedRanges)
DELETEZ(mpMarkedRanges);
- if (mpSortedMarkedCells)
- DELETEZ(mpSortedMarkedCells);
-
mbHasSelection = bNewState;
AccessibleEventObject aEvent;
@@ -161,12 +369,40 @@ void ScAccessibleSpreadsheet::LostFocus()
void ScAccessibleSpreadsheet::GotFocus()
{
- CommitFocusGained();
-
AccessibleEventObject aEvent;
aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
aEvent.Source = uno::Reference< XAccessibleContext >(this);
- 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 ;
+ }
+ }
aEvent.NewValue <<= xNew;
CommitChange(aEvent);
@@ -197,59 +433,185 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
if (rHint.ISA( SfxSimpleHint ) )
{
const SfxSimpleHint& rRef = (const SfxSimpleHint&)rHint;
- // only notify if child exist, otherwise it is not necessary
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))
@@ -258,6 +620,38 @@ 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 = false;
+ ScViewData *pViewData = mpViewShell->GetViewData();
+ ScAddress aNewCell = pViewData->GetCurPos();
+ if( maActiveCell == aNewCell)
+ {
+ ScDocument* pScDoc= GetDocument(mpViewShell);
+ if (pScDoc)
+ {
+ OUString valStr(pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab()));
+ if(m_strCurCellValue != valStr)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
+ mpAccCell->CommitChange(aEvent);
+ m_strCurCellValue=valStr;
+ }
+ OUString tabName;
+ pScDoc->GetName( maActiveCell.Tab(), tabName );
+ if( m_strOldTabName != tabName )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ OUString sOldName(ScResId(STR_ACC_TABLE_NAME));
+ sOldName = sOldName.replaceFirst("%1", m_strOldTabName);
+ aEvent.OldValue <<= sOldName;
+ OUString sNewName(ScResId(STR_ACC_TABLE_NAME));
+ sOldName = sNewName.replaceFirst("%1", tabName);
+ aEvent.NewValue <<= sNewName;
+ CommitChange( aEvent );
+ m_strOldTabName = tabName;
+ }
+ }
+ }
}
// commented out, because to use a ModelChangeEvent is not the right way
// at the moment there is no way, but the Java/Gnome Api should be extended sometime
@@ -343,7 +737,63 @@ void ScAccessibleSpreadsheet::Notify( SfxBroadcaster& rBC, const SfxHint& rHint
ScAccessibleTableBase::Notify(rBC, rHint);
}
- //===== XAccessibleTable ================================================
+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)
+ {
+ m_strCurCellValue = pScDoc->GetString(maActiveCell.Col(),maActiveCell.Row(),maActiveCell.Tab());
+ }
+ CommitChange(aEvent);
+}
+
+sal_Bool ScAccessibleSpreadsheet::IsSameMarkCell()
+{
+ return m_LastMarkedRanges == *mpMarkedRanges;
+}
+
+//===== XAccessibleTable ================================================
uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleRowHeaders( )
throw (uno::RuntimeException)
@@ -389,6 +839,10 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
SolarMutexGuard aGuard;
IsObjectValid();
uno::Sequence<sal_Int32> aSequence;
+ if (IsFormulaMode())
+ {
+ return aSequence;
+ }
if (mpViewShell && mpViewShell->GetViewData())
{
aSequence.realloc(maRange.aEnd.Row() - maRange.aStart.Row() + 1);
@@ -416,6 +870,10 @@ uno::Sequence< sal_Int32 > SAL_CALL ScAccessibleSpreadsheet::getSelectedAccessib
SolarMutexGuard aGuard;
IsObjectValid();
uno::Sequence<sal_Int32> aSequence;
+ if (IsFormulaMode())
+ {
+ return aSequence;
+ }
if (mpViewShell && mpViewShell->GetViewData())
{
aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
@@ -442,6 +900,10 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleRowSelected( sal_Int32 nR
{
SolarMutexGuard aGuard;
IsObjectValid();
+ if (IsFormulaMode())
+ {
+ return sal_False;
+ }
if ((nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
throw lang::IndexOutOfBoundsException();
@@ -461,6 +923,10 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32
SolarMutexGuard aGuard;
IsObjectValid();
+ if (IsFormulaMode())
+ {
+ return sal_False;
+ }
if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0))
throw lang::IndexOutOfBoundsException();
@@ -476,14 +942,27 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32
ScAccessibleCell* ScAccessibleSpreadsheet::GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn)
{
ScAccessibleCell* pAccessibleCell = NULL;
- ScAddress aCellAddress(static_cast<SCCOL>(maRange.aStart.Col() + nColumn),
- static_cast<SCROW>(maRange.aStart.Row() + nRow), maRange.aStart.Tab());
- if ((aCellAddress == maActiveCell) && mpAccCell)
+ if (IsFormulaMode())
{
- pAccessibleCell = mpAccCell;
+ 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
- pAccessibleCell = new ScAccessibleCell(this, mpViewShell, aCellAddress, getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc);
+ {
+ ScAddress aCellAddress(static_cast<SCCOL>(maRange.aStart.Col() + nColumn),
+ static_cast<SCROW>(maRange.aStart.Row() + nRow), maRange.aStart.Tab());
+ if ((aCellAddress == maActiveCell) && mpAccCell)
+ {
+ pAccessibleCell = mpAccCell;
+ }
+ else
+ pAccessibleCell = new ScAccessibleCell(this, mpViewShell, aCellAddress, getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc);
+ }
return pAccessibleCell;
}
@@ -493,12 +972,14 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleCel
{
SolarMutexGuard aGuard;
IsObjectValid();
+ if (!IsFormulaMode())
+ {
if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) ||
nRow < 0 ||
nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) ||
nColumn < 0)
throw lang::IndexOutOfBoundsException();
-
+ }
uno::Reference<XAccessible> xAccessible;
ScAccessibleCell* pAccessibleCell = GetAccessibleCellAt(nRow, nColumn);
xAccessible = pAccessibleCell;
@@ -512,6 +993,11 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleSelected( sal_Int32 nRow,
SolarMutexGuard aGuard;
IsObjectValid();
+ if (IsFormulaMode())
+ {
+ ScAddress addr(static_cast<SCCOL>(nColumn), nRow, 0);
+ return IsScAddrFormulaSel(addr);
+ }
if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0) ||
(nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
throw lang::IndexOutOfBoundsException();
@@ -541,7 +1027,13 @@ uno::Reference< XAccessible > SAL_CALL ScAccessibleSpreadsheet::getAccessibleAtP
SCsCOL nX;
SCsROW nY;
mpViewShell->GetViewData()->GetPosFromPixel( rPoint.X, rPoint.Y, meSplitPos, nX, nY);
+ try{
xAccessible = getAccessibleCellAt(nY, nX);
+ }
+ catch( ::com::sun::star::lang::IndexOutOfBoundsException e)
+ {
+ return NULL;
+ }
}
}
return xAccessible;
@@ -649,7 +1141,8 @@ void SAL_CALL
IsObjectValid();
if (mpViewShell)
{
- mpViewShell->Unmark();
+ if (!IsFormulaMode())
+ mpViewShell->Unmark();
}
}
@@ -661,7 +1154,16 @@ void SAL_CALL
IsObjectValid();
if (mpViewShell)
{
- mpViewShell->SelectAll();
+ 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
+ mpViewShell->SelectAll();
}
}
@@ -674,16 +1176,22 @@ sal_Int32 SAL_CALL
sal_Int32 nResult(0);
if (mpViewShell)
{
- if (!mpMarkedRanges)
+ if (IsFormulaMode())
{
- mpMarkedRanges = new ScRangeList();
- ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
- aMarkData.MarkToMulti();
- aMarkData.FillRangeListWithMarks(mpMarkedRanges, false);
+ nResult = GetRowAll() * GetColAll() ;
+ }
+ else
+ {
+ if (!mpMarkedRanges)
+ {
+ mpMarkedRanges = new ScRangeList();
+ ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
+ aMarkData.FillRangeListWithMarks(mpMarkedRanges, false);
+ }
+ // is possible, because there shouldn't be overlapped ranges in it
+ if (mpMarkedRanges)
+ nResult = mpMarkedRanges->GetCellCount();
}
- // is possible, because there shouldn't be overlapped ranges in it
- if (mpMarkedRanges)
- nResult = mpMarkedRanges->GetCellCount();
}
return nResult;
}
@@ -695,6 +1203,15 @@ uno::Reference<XAccessible > SAL_CALL
SolarMutexGuard aGuard;
IsObjectValid();
uno::Reference < XAccessible > xAccessible;
+ if (IsFormulaMode())
+ {
+ if(CheckChildIndex(nSelectedChildIndex))
+ {
+ ScAddress addr = GetChildIndexAddress(nSelectedChildIndex);
+ xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
+ }
+ return xAccessible;
+ }
if (mpViewShell)
{
if (!mpMarkedRanges)
@@ -704,16 +1221,16 @@ uno::Reference<XAccessible > SAL_CALL
}
if (mpMarkedRanges)
{
- if (!mpSortedMarkedCells)
- CreateSortedMarkedCells();
- if (mpSortedMarkedCells)
+ 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());
}
}
return xAccessible;
@@ -734,6 +1251,16 @@ void SAL_CALL
sal_Int32 nCol(getAccessibleColumn(nChildIndex));
sal_Int32 nRow(getAccessibleRow(nChildIndex));
+ if (IsFormulaMode())
+ {
+ if(IsScAddrFormulaSel(
+ ScAddress(static_cast<SCCOL>(nCol), nRow,mpViewShell->GetViewData()->GetTabNo()))
+ )
+ {
+ SelectCell(nRow, nCol, sal_True);
+ }
+ return ;
+ }
if (mpViewShell->GetViewData()->GetMarkData().IsCellMarked(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)))
SelectCell(nRow, nCol, sal_True);
}
@@ -741,14 +1268,30 @@ void SAL_CALL
void ScAccessibleSpreadsheet::SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect)
{
+ if (IsFormulaMode())
+ {
+ if (bDeselect)
+ {//??
+ return;
+ }
+ else
+ {
+ 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());
+ }
+ return ;
+ }
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, false, false );
+ 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>();
@@ -791,7 +1334,7 @@ void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange)
mpSortedMarkedCells->push_back(aCell);
}
}
-}
+}*/
//===== XServiceInfo ====================================================
@@ -837,21 +1380,9 @@ void SAL_CALL ScAccessibleSpreadsheet::addAccessibleEventListener(const uno::Ref
IsObjectValid();
ScAccessibleTableBase::addAccessibleEventListener(xListener);
- if (!mbIsFocusSend)
- {
- mbIsFocusSend = sal_True;
- CommitFocusGained();
-
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
- aEvent.NewValue <<= getAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col());
-
- CommitChange(aEvent);
- }
}
- //==== internal =========================================================
+//==== internal =========================================================
Rectangle ScAccessibleSpreadsheet::GetBoundingBoxOnScreen() const
throw (uno::RuntimeException)
@@ -890,6 +1421,10 @@ sal_Bool ScAccessibleSpreadsheet::IsDefunc(
sal_Bool ScAccessibleSpreadsheet::IsEditable(
const uno::Reference<XAccessibleStateSet>& /* rxParentStates */)
{
+ if (IsFormulaMode())
+ {
+ return sal_False;
+ }
sal_Bool bProtected(false);
if (mpDoc && mpDoc->IsTabProtected(maRange.aStart.Tab()))
bProtected = sal_True;
@@ -909,6 +1444,11 @@ sal_Bool ScAccessibleSpreadsheet::IsFocused()
sal_Bool ScAccessibleSpreadsheet::IsCompleteSheetSelected()
{
+ if (IsFormulaMode())
+ {
+ return sal_False;
+ }
+
sal_Bool bResult(false);
if(mpViewShell)
{
@@ -960,4 +1500,286 @@ Rectangle ScAccessibleSpreadsheet::GetVisCells(const Rectangle& rVisArea)
return Rectangle();
}
+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());
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/sc/source/ui/Accessibility/AccessibleTableBase.cxx
index 60a008a637b9..5a74dcf5af72 100644
--- a/sc/source/ui/Accessibility/AccessibleTableBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleTableBase.cxx
@@ -22,6 +22,7 @@
#include "document.hxx"
#include "scresid.hxx"
#include "sc.hrc"
+#include "table.hxx"
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
@@ -64,8 +65,19 @@ 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);
+ 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;
}
void SAL_CALL ScAccessibleTableBase::acquire()
@@ -140,12 +152,10 @@ 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;
- }
+ mpDoc->FetchTable(maRange.aStart.Tab())->GetColumnByIndex(nColumn)->
+ ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False );
+ if (nEndRow > nRow)
+ nCount = nEndRow - nRow + 1;
}
return nCount;
@@ -169,12 +179,10 @@ 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)
+ mpDoc->FetchTable(maRange.aStart.Tab())->GetColumnByIndex(nColumn)->
+ ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False );
+ if (nEndCol > nColumn)
nCount = nEndCol - nColumn + 1;
- }
}
return nCount;
@@ -479,4 +487,28 @@ void ScAccessibleTableBase::CommitTableModelChange(sal_Int32 nStartRow, sal_Int3
CommitChange(aEvent);
}
+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;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 1692e9aa689c..7907bb652293 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -976,7 +976,7 @@ ScDocShell* ScAccessibleCellTextData::GetDocShell(ScTabViewShell* pViewShell)
}
-ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin)
+ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone)
:
mpViewForwarder(NULL),
mpEditViewForwarder(NULL),
@@ -985,13 +985,16 @@ ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditVi
mpForwarder(NULL),
mpWindow(pWin)
{
- if (mpEditEngine)
+ // If the object is cloned, do NOT add notify hdl.
+ mbIsCloned = isClone;
+ if (mpEditEngine && !mbIsCloned)
mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
}
ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData()
{
- if (mpEditEngine)
+ // If the object is cloned, do NOT set notify hdl.
+ if (mpEditEngine && !mbIsCloned)
mpEditEngine->SetNotifyHdl(Link());
if (mpViewForwarder)
delete mpViewForwarder;
@@ -1023,7 +1026,8 @@ void ScAccessibleEditObjectTextData::Notify( SfxBroadcaster& rBC, const SfxHint&
ScAccessibleTextData* ScAccessibleEditObjectTextData::Clone() const
{
- return new ScAccessibleEditObjectTextData(mpEditView, mpWindow);
+ // Add para to indicate the object is cloned
+ return new ScAccessibleEditObjectTextData(mpEditView, mpWindow,sal_True);
}
SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder()
@@ -1032,7 +1036,8 @@ SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder()
{
if (!mpEditEngine)
mpEditEngine = mpEditView->GetEditEngine();
- if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet())
+ // If the object is cloned, do NOT add notify hdl.
+ if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()&&!mbIsCloned)
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 7182ebe289ae..89d34fd42416 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -157,6 +157,10 @@ ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, Window* pParent,
pSaveObj = new DBSaveData( *m_pEdAssign, *m_pBtnHeader,
*m_pBtnDoSize, *m_pBtnKeepFmt, *m_pBtnStripData, theCurArea );
Init();
+
+ SynFocusTimer.SetTimeout(150);
+ SynFocusTimer.SetTimeoutHdl(LINK( this, ScDbNameDlg, FocusToComoboxHdl));
+ SynFocusTimer.Start();
}
@@ -635,8 +639,36 @@ IMPL_LINK_NOARG(ScDbNameDlg, AssModifyHdl)
if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID )
theCurArea = aTmpRange;
+ if (!aText.isEmpty() && !m_pEdName->GetText().isEmpty())
+ {
+ m_pBtnAdd->Enable();
+ m_pBtnHeader->Enable();
+ m_pBtnDoSize->Enable();
+ m_pBtnKeepFmt->Enable();
+ m_pBtnStripData->Enable();
+ m_pFTSource->Enable();
+ m_pFTOperations->Enable();
+ }
+ else
+ {
+ m_pBtnAdd->Disable();
+ m_pBtnHeader->Disable();
+ m_pBtnDoSize->Disable();
+ m_pBtnKeepFmt->Disable();
+ m_pBtnStripData->Disable();
+ m_pFTSource->Disable();
+ m_pFTOperations->Disable();
+ }
+
return 0;
}
+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;
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0760425ab6b0..9726cab9a0ff 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -34,6 +34,7 @@
#include <sfx2/docfile.hxx>
#include <sfx2/fcontnr.hxx>
#include <sfx2/objface.hxx>
+#include <sfx2/viewfrm.hxx>
#include <svl/documentlockfile.hxx>
#include <svl/sharecontrolfile.hxx>
#include "svl/urihelper.hxx"
@@ -105,7 +106,6 @@
#include "sheetdata.hxx"
#include "tabprotection.hxx"
#include "docparam.hxx"
-
#include "docshimp.hxx"
#include "sizedev.hxx"
@@ -1571,6 +1571,20 @@ sal_Bool ScDocShell::Save()
PrepareSaveGuard aPrepareGuard( *this);
+ aDocument.setDocAccTitle(OUString());
+ SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
+ if (pFrame1)
+ {
+ Window* pWindow = &pFrame1->GetWindow();
+ if ( pWindow )
+ {
+ Window* pSysWin = pWindow->GetSystemWindow();
+ if ( pSysWin )
+ {
+ pSysWin->SetAccessibleName(OUString());
+ }
+ }
+ }
// wait cursor is handled with progress bar
sal_Bool bRet = SfxObjectShell::Save();
if( bRet )
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index 90f612d7646b..99eb7fd3c749 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -311,10 +311,14 @@ sal_Bool FuDraw::KeyInput(const KeyEvent& rKEvt)
// changeover to the next object
if(!pView->MarkNextObj( !aCode.IsShift() ))
{
- // No next object: go over open end and
- // get first from the other side
- pView->UnmarkAllObj();
- pView->MarkNextObj(!aCode.IsShift());
+ //If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj().
+ if ( pView->GetMarkableObjCount() > 1 && pView->HasMarkableObj() )
+ {
+ // No next object: go over open end and
+ // get first from the other side
+ pView->UnmarkAllObj();
+ pView->MarkNextObj(!aCode.IsShift());
+ }
}
// II
diff --git a/sc/source/ui/inc/AccessibleCell.hxx b/sc/source/ui/inc/AccessibleCell.hxx
index 5fd9025ea321..bd8185d2c725 100644
--- a/sc/source/ui/inc/AccessibleCell.hxx
+++ b/sc/source/ui/inc/AccessibleCell.hxx
@@ -24,6 +24,7 @@
#include "AccessibleCellBase.hxx"
#include "global.hxx"
#include "viewdata.hxx"
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
#include <unotools/accessiblerelationsethelper.hxx>
#include <editeng/AccessibleStaticTextBase.hxx>
@@ -32,13 +33,17 @@
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,
+ public ScAccessibleCellAttributeImpl
{
public:
//===== internal ========================================================
@@ -130,6 +135,12 @@ public:
getSupportedServiceNames(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) ;
+
+ // 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< OUString >& aRequestedAttributes )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
private:
ScTabViewShell* mpViewShell;
ScAccessibleDocument* mpAccDoc;
@@ -159,6 +170,8 @@ private:
void AddRelation(const ScRange& rRange,
const sal_uInt16 aRelationType,
::utl::AccessibleRelationSetHelper* pRelationSet);
+ sal_Bool IsFormulaMode();
+ sal_Bool IsDropdown();
};
diff --git a/sc/source/ui/inc/AccessibleCellBase.hxx b/sc/source/ui/inc/AccessibleCellBase.hxx
index a303c9c64cc5..4cfe1daeac9f 100644
--- a/sc/source/ui/inc/AccessibleCellBase.hxx
+++ b/sc/source/ui/inc/AccessibleCellBase.hxx
@@ -136,6 +136,19 @@ private:
virtual sal_Bool IsEditable(
const com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
+protected:
+ virtual OUString SAL_CALL GetNote(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual OUString SAL_CALL GetAllDisplayNote(void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getShadowAttrs(void)
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual 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);
};
diff --git a/sc/source/ui/inc/AccessibleDocument.hxx b/sc/source/ui/inc/AccessibleDocument.hxx
index b0fba0aafaf4..46441a6a70af 100644
--- a/sc/source/ui/inc/AccessibleDocument.hxx
+++ b/sc/source/ui/inc/AccessibleDocument.hxx
@@ -25,7 +25,9 @@
#include "viewdata.hxx"
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
-#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
#include <svx/IAccessibleViewForwarder.hxx>
class ScTabViewShell;
@@ -43,13 +45,15 @@ namespace utl
<code>AccessibleContext</code> service.
*/
-typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleSelection,
+typedef cppu::ImplHelper3< ::com::sun::star::accessibility::XAccessibleSelection,
+ ::com::sun::star::accessibility::XAccessibleExtendedAttributes,
::com::sun::star::view::XSelectionChangeListener >
ScAccessibleDocumentImpl;
class ScAccessibleDocument
: public ScAccessibleDocumentBase,
public ScAccessibleDocumentImpl,
+ public com::sun::star::accessibility::XAccessibleGetAccFlowTo,
public accessibility::IAccessibleViewForwarder
{
public:
@@ -116,6 +120,12 @@ public:
getAccessibleStateSet(void)
throw (::com::sun::star::uno::RuntimeException);
+ virtual 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) ;
///===== XAccessibleSelection ===========================================
virtual void SAL_CALL
@@ -310,6 +320,22 @@ private:
OUString GetCurrentCellDescription() const;
Rectangle GetVisibleArea_Impl() const;
+ 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();
};
diff --git a/sc/source/ui/inc/AccessibleDocumentBase.hxx b/sc/source/ui/inc/AccessibleDocumentBase.hxx
index ef9332c23ac5..1d3ce35b174c 100644
--- a/sc/source/ui/inc/AccessibleDocumentBase.hxx
+++ b/sc/source/ui/inc/AccessibleDocumentBase.hxx
@@ -31,6 +31,7 @@ public:
ScAccessibleDocumentBase(
const ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessible>& rxParent);
+ virtual void SwitchViewFireFocus();
protected:
virtual ~ScAccessibleDocumentBase (void);
};
diff --git a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
index 1de55098655e..64835abcc910 100644
--- a/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
+++ b/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
@@ -81,6 +81,8 @@ public:
getAccessibleStateSet(void)
throw (::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL getAccessibleName(void)
+ throw (::com::sun::star::uno::RuntimeException);
///===== 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 4053bb8a8a66..c0c7474c8f39 100644
--- a/sc/source/ui/inc/AccessibleEditObject.hxx
+++ b/sc/source/ui/inc/AccessibleEditObject.hxx
@@ -23,6 +23,9 @@
#include "AccessibleContextBase.hxx"
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include "global.hxx"
+
namespace accessibility
{
class AccessibleTextHelper;
@@ -35,7 +38,8 @@ class Window;
<code>AccessibleCell</code> service.
*/
class ScAccessibleEditObject
- : public ScAccessibleContextBase
+ : public ScAccessibleContextBase,
+ public ::com::sun::star::accessibility::XAccessibleSelection
{
public:
enum EditObjectType
@@ -64,7 +68,15 @@ public:
virtual void LostFocus();
virtual void GotFocus();
+///===== 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 ();
///===== XAccessibleComponent ============================================
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
@@ -103,6 +115,31 @@ 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);
protected:
/// Return this object's description.
virtual OUString SAL_CALL
@@ -161,6 +198,18 @@ private:
::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
void CreateTextHelper();
+ 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) ;
};
diff --git a/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index 132f7e0eb090..56749beda960 100644
--- a/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -26,6 +26,9 @@
#include <vector>
+#include "rangelst.hxx"
+#include <map>
+
class ScMyAddress : public ScAddress
{
public:
@@ -232,6 +235,15 @@ public:
const ::com::sun::star::uno::Reference<
::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
throw (com::sun::star::uno::RuntimeException);
+ //===== 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) ;
protected:
/// Return the object's current bounding box relative to the desktop.
@@ -272,6 +284,51 @@ private:
ScDocument* GetDocument(ScTabViewShell* pViewShell);
Rectangle GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
Rectangle GetVisCells(const Rectangle& rVisArea);
+ 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;
+ OUString 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);
+ OUString m_strOldTabName;
};
#endif
diff --git a/sc/source/ui/inc/AccessibleTableBase.hxx b/sc/source/ui/inc/AccessibleTableBase.hxx
index cb4fc71860ad..42476f376c95 100644
--- a/sc/source/ui/inc/AccessibleTableBase.hxx
+++ b/sc/source/ui/inc/AccessibleTableBase.hxx
@@ -26,6 +26,7 @@
#include "address.hxx"
#include <com/sun/star/accessibility/XAccessibleTable.hpp>
#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
#include <cppuhelper/implbase2.hxx>
/** @descr
@@ -39,6 +40,7 @@ typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleTable,
class ScAccessibleTableBase :
public ScAccessibleContextBase,
+ public ::com::sun::star::accessibility::XAccessibleTableSelection,
public ScAccessibleTableBaseImpl
{
public:
@@ -193,6 +195,14 @@ public:
getAccessibleChild(sal_Int32 nIndex)
throw (::com::sun::star::uno::RuntimeException,
::com::sun::star::lang::IndexOutOfBoundsException);
+ 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) ;
protected:
/// Return this object's description.
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index e98d1336ead7..463a0f58a788 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -127,7 +127,8 @@ private:
class ScAccessibleEditObjectTextData : public ScAccessibleTextData
{
public:
- ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin);
+ // Add a para to indicate whether the object is cloned
+ ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone=sal_False);
virtual ~ScAccessibleEditObjectTextData();
virtual ScAccessibleTextData* Clone() const;
@@ -150,6 +151,7 @@ protected:
EditEngine* mpEditEngine;
SvxEditEngineForwarder* mpForwarder;
Window* mpWindow;
+ sal_Bool mbIsCloned;
};
diff --git a/sc/source/ui/inc/content.hxx b/sc/source/ui/inc/content.hxx
index 78a3cb92ac13..8bcf363df60e 100644
--- a/sc/source/ui/inc/content.hxx
+++ b/sc/source/ui/inc/content.hxx
@@ -29,6 +29,7 @@ class ScNavigatorDlg;
class ScDocument;
class ScDocShell;
class ScAreaLink;
+class SdrPage;
#define SC_CONTENT_ROOT 0
#define SC_CONTENT_TABLE 1
@@ -54,6 +55,8 @@ class ScContentTree : public SvTreeListBox
OUString aHiddenName; // URL to load
OUString aHiddenTitle; // for display
ScDocument* pHiddenDocument; // temporary
+ sal_Bool bisInNavigatoeDlg;
+ OUString sKeyString;
sal_uInt16 pPosList[SC_CONTENT_COUNT]; // for the sequence
@@ -101,10 +104,11 @@ class ScContentTree : public SvTreeListBox
DECL_LINK( ContentDoubleClickHdl, void* );
DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
+public:
+ SvTreeListEntry* pTmpEntry;
+ bool m_bFirstPaint;
protected:
-// virtual sal_Bool Drop( const DropEvent& rEvt );
-// virtual sal_Bool QueryDrop( DropEvent& rEvt );
using SvTreeListBox::ExecuteDrop;
@@ -115,11 +119,17 @@ protected:
virtual void Command( const CommandEvent& rCEvt );
virtual void RequestHelp( const HelpEvent& rHEvt );
-
+ virtual void InitEntry(SvTreeListEntry*,const OUString&,const Image&,const Image&, SvLBoxButtonKind);
public:
ScContentTree( Window* pParent, const ResId& rResId );
~ScContentTree();
+ OUString getAltLongDescText(SvTreeListEntry* pEntry , sal_Bool isAltText) const;
+ OUString GetEntryAltText( SvTreeListEntry* pEntry ) const;
+ OUString GetEntryLongDescription( SvTreeListEntry* pEntry ) const;
+
+ void ObjectFresh( sal_uInt16 nType, SvTreeListEntry* pEntry = NULL);
+ sal_Bool SetNavigatorDlgFlag(sal_Bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;};
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 65350a7f42d9..2fccd0ee2dce 100644
--- a/sc/source/ui/inc/dbnamdlg.hxx
+++ b/sc/source/ui/inc/dbnamdlg.hxx
@@ -86,6 +86,8 @@ private:
ScDBCollection aLocalDbCol;
ScRange theCurArea;
std::vector<ScRange> aRemoveList;
+ Timer SynFocusTimer;
+ DECL_LINK( FocusToComoboxHdl, Timer* );
private:
void Init();
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index 818a63f502f6..0b157e7eff6a 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -422,6 +422,11 @@ public:
void SetSolverSaveData( const ScOptSolverSave& rData );
ScSheetSaveData* GetSheetSaveData();
+ void setDocAccTitle( const OUString& rTitle ) { aDocument.setDocAccTitle( rTitle ); }
+ const OUString getDocAccTitle() const { return aDocument.getDocAccTitle(); }
+ void setDocReadOnly(bool b) { aDocument.setDocReadOnly(b); }
+ bool getDocReadOnly() const { return aDocument.getDocReadOnly(); }
+
void ResetKeyBindings( ScOptionsUtil::KeyBindingType eType );
// password protection for Calc (derived from SfxObjectShell)
diff --git a/sc/source/ui/inc/drawview.hxx b/sc/source/ui/inc/drawview.hxx
index 3da404cf394a..2e22397af985 100644
--- a/sc/source/ui/inc/drawview.hxx
+++ b/sc/source/ui/inc/drawview.hxx
@@ -146,6 +146,10 @@ public:
SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
+ SdrObject* GetObjectByName(const OUString& rName);
+ sal_Bool GetObjectIsMarked( SdrObject * pObject );
+ sal_Bool SelectCurrentViewObject( const OUString& rName );
+
static void CheckOle( const SdrMarkList& rMarkList, sal_Bool& rAnyOle, sal_Bool& rOneOle );
virtual void SyncForGrid( SdrObject* pObj );
};
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 8755da85bc0d..7818cc7318b7 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -244,6 +244,8 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe
bool HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange );
+ bool HasScenarioRange( sal_uInt16 nCol, sal_Int32 nRow, ScRange& rScenRange );
+
bool DropScroll( const Point& rMousePos );
sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt );
@@ -379,6 +381,7 @@ public:
void DoInvertRect( const Rectangle& rPixel );
void CheckNeedsRepaint();
+ virtual void SwitchView();
void UpdateDPFromFieldPopupMenu();
bool UpdateVisibleRange();
diff --git a/sc/source/ui/inc/preview.hxx b/sc/source/ui/inc/preview.hxx
index 8ac8b9980cb4..fe1f6427f0f7 100644
--- a/sc/source/ui/inc/preview.hxx
+++ b/sc/source/ui/inc/preview.hxx
@@ -159,6 +159,8 @@ public:
FmFormView* GetDrawView() { return pDrawView; }
+ virtual void SwitchView();
+
SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData& rMark);
SC_DLLPUBLIC const ScMarkData::MarkedTabsType& GetSelectedTabs() const;
};
diff --git a/sc/source/ui/inc/scuitphfedit.hxx b/sc/source/ui/inc/scuitphfedit.hxx
index bf5f977b6cce..46f2e3eaf248 100644
--- a/sc/source/ui/inc/scuitphfedit.hxx
+++ b/sc/source/ui/inc/scuitphfedit.hxx
@@ -86,6 +86,8 @@ private:
sal_uInt16 nWhich;
OUString aCmdArr[6];
+ DECL_LINK( ObjectSelectHdl, ScEditWindow* );
+
private:
void FillCmdArr();
void InitPreDefinedList();
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 4964e6d685c1..8832da4aeeed 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -468,7 +468,7 @@ public:
bool bCols = false, bool bRows = false, bool bCellSelection = false );
void InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
bool bTestNeg = false,
- bool bCols = false, bool bRows = false );
+ bool bCols = false, bool bRows = false, bool bForceNeg = false );
void InitOwnBlockMode();
void DoneBlockMode( bool bContinue = false );
diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx
index 9734ed3d94d8..a6d4f0effe30 100644
--- a/sc/source/ui/inc/tabvwsh.hxx
+++ b/sc/source/ui/inc/tabvwsh.hxx
@@ -161,6 +161,8 @@ private:
sal_Bool bReadOnly; // to detect status changes
+ sal_Bool bIsActive;
+
SbxObject* pScSbxObject;
sal_Bool bChartAreaValid; // if chart is drawn
@@ -410,6 +412,10 @@ public:
using ScTabView::ShowCursor;
+ sal_Bool IsActive() const { return bIsActive; }
+ OUString GetFormula(ScAddress& rAddress);
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & GetForms() const;
+
// ugly hack to call Define Names from Manage Names
void SwitchBetweenRefDialogs(SfxModelessDialog* pDialog);
};
diff --git a/sc/source/ui/inc/tphfedit.hxx b/sc/source/ui/inc/tphfedit.hxx
index 630c542a69d8..ec779d11a3b6 100644
--- a/sc/source/ui/inc/tphfedit.hxx
+++ b/sc/source/ui/inc/tphfedit.hxx
@@ -71,7 +71,8 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
- inline ScHeaderEditEngine* GetEditEngine() const {return pEdEngine;}
+ ScHeaderEditEngine* GetEditEngine() const { return pEdEngine; }
+ void SetObjectSelectHdl( const Link& aLink) { aObjectSelectLink = aLink; }
void SetLocation(ScEditWindowLocation eLoc) { eLocation = eLoc; }
protected:
@@ -93,6 +94,8 @@ private:
com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xAcc;
ScAccessibleEditObject* pAcc;
+
+ Link aObjectSelectLink;
};
//===================================================================
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0e28bb5fd992..4736964b82b7 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -241,7 +241,7 @@ public:
ScAutoFormatData* CreateAutoFormatData();
void AutoFormat( sal_uInt16 nFormatNo, sal_Bool bRecord = sal_True );
- void SearchAndReplace( const SvxSearchItem* pSearchItem,
+ sal_Bool SearchAndReplace( const SvxSearchItem* pSearchItem,
sal_Bool bAddUndo, sal_Bool bIsApi );
void Solve( const ScSolveParam& rParam );
diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx
index cec568e8c15a..d7da4bddf72d 100644
--- a/sc/source/ui/miscdlgs/highred.cxx
+++ b/sc/source/ui/miscdlgs/highred.cxx
@@ -78,6 +78,7 @@ ScHighlightChgDlg::ScHighlightChgDlg( SfxBindings* pB, SfxChildWindow* pCW, Wind
Init();
+ aFilterCtr.SetAccessibleRelationMemberOf(&aFlFilter);
}
ScHighlightChgDlg::~ScHighlightChgDlg()
@@ -214,6 +215,7 @@ IMPL_LINK( ScHighlightChgDlg, RefHandle, SvxTPFilter*, pRef )
aEdAssign.Show();
aRbAssign.Show();
aEdAssign.SetText(aFilterCtr.GetRange());
+ aEdAssign.GrabFocus();
ScAnyRefDlg::RefInputStart(&aEdAssign,&aRbAssign);
}
return 0;
diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx
index 69bcec78fa60..e8c11f5abdc1 100644
--- a/sc/source/ui/navipi/content.cxx
+++ b/sc/source/ui/navipi/content.cxx
@@ -30,7 +30,8 @@
#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <svl/urlbmk.hxx>
-#include "svtools/svlbitm.hxx"
+#include <svtools/svlbitm.hxx>
+#include <svtools/treelistentry.hxx>
#include <stdlib.h>
#include "content.hxx"
@@ -55,6 +56,8 @@
#include "navicfg.hxx"
#include "navsett.hxx"
#include "postit.hxx"
+#include "tabvwsh.hxx"
+#include "drawview.hxx"
#include "clipparam.hxx"
#include "markdata.hxx"
@@ -117,7 +120,8 @@ ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) :
aEntryImages ( ScResId( RID_IMAGELIST_NAVCONT ) ),
nRootType ( SC_CONTENT_ROOT ),
bHiddenDoc ( false ),
- pHiddenDocument ( NULL )
+ pHiddenDocument ( NULL ),
+ bisInNavigatoeDlg ( sal_False )
{
sal_uInt16 i;
for (i=0; i<SC_CONTENT_COUNT; i++)
@@ -133,6 +137,9 @@ ScContentTree::ScContentTree( Window* pParent, const ResId& rResId ) :
SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) );
+ pTmpEntry= NULL;
+ m_bFirstPaint=true;
+
SetStyle( GetStyle() | WB_QUICK_SEARCH );
}
@@ -140,6 +147,70 @@ ScContentTree::~ScContentTree()
{
}
+// helper function for GetEntryAltText and GetEntryLongDescription
+OUString ScContentTree::getAltLongDescText( SvTreeListEntry* 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 OUString();
+}
+
+OUString ScContentTree::GetEntryAltText( SvTreeListEntry* pEntry ) const
+{
+ return getAltLongDescText( pEntry, sal_True );
+}
+
+OUString ScContentTree::GetEntryLongDescription( SvTreeListEntry* pEntry ) const
+{
+ return getAltLongDescText( pEntry, sal_False);
+}
+
void ScContentTree::InitRoot( sal_uInt16 nType )
{
if ( !nType )
@@ -162,7 +233,15 @@ void ScContentTree::InitRoot( sal_uInt16 nType )
void ScContentTree::ClearAll()
{
+ //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);
for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++)
InitRoot(i);
}
@@ -383,10 +462,80 @@ void ScContentTree::KeyInput( const KeyEvent& rKEvt )
break;
}
}
- StoreSettings();
+ //Make KEY_SPACE has same function as DoubleClick
+ if ( bisInNavigatoeDlg )
+ {
+ if(aCode.GetCode() == KEY_SPACE )
+ {
+ bUsed = sal_True;
+ sal_uInt16 nType;
+ sal_uLong nChild;
+ SvTreeListEntry* pEntry = GetCurEntry();
+ GetEntryIndexes( nType, nChild, pEntry );
+ if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) )
+ {
+ if ( bHiddenDoc )
+ return ; //! spaeter...
+ OUString aText( GetEntryText( pEntry ) );
+ sKeyString = aText;
+ if (!aManualDoc.isEmpty())
+ 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;
+ SvTreeListEntry* pParent = pRootNodes[nType];
+ SvTreeListEntry* pBeginEntry = NULL;
+ if( pParent )
+ pBeginEntry = FirstChild(pParent);
+ while( pBeginEntry )
+ {
+ OUString 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;
+ }
+ }
+ }
+ }
if( !bUsed )
- SvTreeListBox::KeyInput(rKEvt);
+ {
+ if(aCode.GetCode() == KEY_F5 )
+ {
+ StoreSettings();
+ SvTreeListBox::KeyInput(rKEvt);
+ }
+ else
+ {
+ SvTreeListBox::KeyInput(rKEvt);
+ StoreSettings();
+ }
+ }
}
sal_Int8 ScContentTree::AcceptDrop( const AcceptDropEvent& /* rEvt */ )
@@ -574,6 +723,45 @@ ScDocument* ScContentTree::GetSourceDocument()
return NULL;
}
+//Move along and draw "*" sign .
+void ScContentTree::ObjectFresh( sal_uInt16 nType, SvTreeListEntry* 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 );
+ GetDrawNames( nType/*, nId*/ );
+ if( !pEntry )
+ ApplySettings();
+ SetUpdateMode(sal_True);
+ if( pEntry )
+ {
+ SvTreeListEntry* pParent = pRootNodes[nType];
+ SvTreeListEntry* pBeginEntry = NULL;
+ SvTreeListEntry* pOldEntry = NULL;
+ if( pParent )
+ pBeginEntry = FirstChild(pParent);
+ while( pBeginEntry )
+ {
+ OUString aTempText( GetEntryText( pBeginEntry ) );
+ if( aTempText == sKeyString )
+ {
+ pOldEntry = pBeginEntry;
+ break;
+ }
+ pBeginEntry = Next( pBeginEntry );
+ }
+ if( pOldEntry )
+ {
+ Expand(pParent);
+ Select( pOldEntry,sal_True);
+ }
+ }
+ }
+}
+
void ScContentTree::Refresh( sal_uInt16 nType )
{
if ( bHiddenDoc && !pHiddenDocument )
@@ -765,7 +953,44 @@ void ScContentTree::GetDrawNames( sal_uInt16 nType )
{
OUString aName = ScDrawLayer::GetVisibleName( pObject );
if (!aName.isEmpty())
- InsertContent( nType, aName );
+ {
+ if( bisInNavigatoeDlg )
+ {
+ if (nType >= SC_CONTENT_COUNT)
+ {
+ SAL_WARN("sc", "ScContentTree::InsertContent mit falschem Typ");
+ return;
+ }
+
+ SvTreeListEntry* pParent = pRootNodes[nType];
+ if (pParent)
+ {
+ SvTreeListEntry* 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
+ SAL_WARN("sc", "InsertContent ohne Parent");
+ }
+ }
+
}
pObject = aIter.Next();
@@ -1445,13 +1670,14 @@ void ScContentTree::StoreSettings() const
}
}
-
-//
-//------------------------------------------------------------------------
-//
-
-
-
-
+void ScContentTree::InitEntry(SvTreeListEntry* pEntry,
+ const OUString& 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 );
+ SvLBoxString* pStr = new SvLBoxString( pEntry, 0, pCol->GetText() );
+ pEntry->ReplaceItem( pStr, nColToHilite );
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx
index 5c918dc351f8..d69184451c79 100644
--- a/sc/source/ui/navipi/navipi.cxx
+++ b/sc/source/ui/navipi/navipi.cxx
@@ -741,6 +741,7 @@ ScNavigatorDlg::ScNavigatorDlg( SfxBindings* pB, SfxChildWindowContext* pCW, Win
aTbxCmd.Select(IID_ZOOMOUT);
aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT));
}
+ aLbEntries.SetNavigatorDlgFlag(sal_True);
}
//------------------------------------------------------------------------
@@ -934,7 +935,11 @@ void ScNavigatorDlg::Notify( SfxBroadcaster&, const SfxHint& rHint )
case FID_ANYDATACHANGED:
aContentTimer.Start(); // Notizen nicht sofort suchen
break;
-
+ case FID_KILLEDITVIEW:
+ aLbEntries.ObjectFresh( SC_CONTENT_OLEOBJECT );
+ aLbEntries.ObjectFresh( SC_CONTENT_DRAWING );
+ aLbEntries.ObjectFresh( SC_CONTENT_GRAPHIC );
+ break;
default:
break;
}
diff --git a/sc/source/ui/pagedlg/scuitphfedit.cxx b/sc/source/ui/pagedlg/scuitphfedit.cxx
index 048e0bbe8200..2a71c5d42668 100644
--- a/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -136,6 +136,9 @@ ScHFEditPage::ScHFEditPage( Window* pParent,
m_pWndCenter->SetFont( aPatAttr );
m_pWndRight->SetFont( aPatAttr );
+ m_pWndLeft->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+ m_pWndCenter->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+ m_pWndRight->SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
FillCmdArr();
m_pWndLeft->GrabFocus();
@@ -144,6 +147,13 @@ ScHFEditPage::ScHFEditPage( Window* pParent,
}
+IMPL_LINK( ScHFEditPage, ObjectSelectHdl, ScEditWindow*, pEdit )
+{
+ (void)pEdit;
+ m_pBtnText->GrabFocus();
+ return 0;
+}
+
// -----------------------------------------------------------------------
ScHFEditPage::~ScHFEditPage()
diff --git a/sc/source/ui/pagedlg/tphfedit.cxx b/sc/source/ui/pagedlg/tphfedit.cxx
index e58e3c2e3cac..2cea44389e24 100644
--- a/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/sc/source/ui/pagedlg/tphfedit.cxx
@@ -246,6 +246,9 @@ void ScEditWindow::Paint( const Rectangle& rRect )
Control::Paint( rRect );
pEdView->Paint( rRect );
+
+ if( HasFocus() )
+ pEdView->ShowCursor(sal_True,sal_True);
}
// -----------------------------------------------------------------------
@@ -287,6 +290,12 @@ void ScEditWindow::KeyInput( const KeyEvent& rKEvt )
{
Control::KeyInput( rKEvt );
}
+ else if ( !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsShift() &&
+ rKEvt.GetKeyCode().IsMod2() && rKEvt.GetKeyCode().GetCode() == KEY_DOWN )
+ {
+ if (aObjectSelectLink.IsSet() )
+ aObjectSelectLink.Call(this);
+ }
}
// -----------------------------------------------------------------------
@@ -300,6 +309,7 @@ void ScEditWindow::Command( const CommandEvent& rCEvt )
void ScEditWindow::GetFocus()
{
+ pEdView->ShowCursor(sal_True,sal_True);
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 18cd6fec9e38..c4a4da24a741 100644
--- a/sc/source/ui/view/drawview.cxx
+++ b/sc/source/ui/view/drawview.cxx
@@ -628,6 +628,90 @@ void ScDrawView::UpdateUserViewOptions()
}
}
+SdrObject* ScDrawView::GetObjectByName(const OUString& 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;
+}
+
+//realize multi-selection of objects
+//==================================================
+sal_Bool ScDrawView::SelectCurrentViewObject( const OUString& 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 );
+}
+
sal_Bool ScDrawView::SelectObject( const OUString& rName )
{
UnmarkAll();
@@ -689,6 +773,16 @@ sal_Bool ScDrawView::SelectObject( const OUString& rName )
return ( pFound != NULL );
}
+//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;
+}
bool ScDrawView::InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, sal_uLong nOptions)
{
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index f10ca07ab243..5782e7c8164e 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -1070,6 +1070,44 @@ void ScGridWindow::DoScenarioMenu( const ScRange& rScenRange )
CaptureMouse();
}
+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) )
+ {
+ SCTAB 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 );
+ SCTAB nRangeCount = aRanges.size();
+ for (i=0; i<nRangeCount; i++)
+ {
+ ScRange aRange = *aRanges[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 true;
+ }
+ }
+ }
+ return false;
+}
+
void ScGridWindow::LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelect )
{
delete pFilterBox;
@@ -2435,6 +2473,7 @@ void ScGridWindow::MouseButtonUp( const MouseEvent& rMEvt )
pViewData->GetView()->InvalidateAttribs();
}
+ pViewData->GetViewShell()->SelectionChanged();
return;
}
}
@@ -3237,7 +3276,6 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
if( !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) )
{
SC_MOD()->EndReference();
- return;
}
else if( pViewData->GetViewShell()->MoveCursorKeyInput( rKEvt ) )
{
@@ -3245,8 +3283,9 @@ void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(),
pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() );
SC_MOD()->SetReference( aRef, pViewData->GetDocument() );
- return;
}
+ pViewData->GetViewShell()->SelectionChanged();
+ return ;
}
else if( rKeyCode.GetCode() == KEY_RETURN && pViewData->IsPasteMode() )
{
diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx
index 5aab83453ebb..a151035c2b15 100644
--- a/sc/source/ui/view/gridwin3.cxx
+++ b/sc/source/ui/view/gridwin3.cxx
@@ -175,6 +175,8 @@ bool ScGridWindow::DrawKeyInput(const KeyEvent& rKEvt)
if ( !bOldMarked &&
rKEvt.GetKeyCode().GetCode() == KEY_DELETE )
bUsed = false; // nichts geloescht
+ if(bOldMarked)
+ GetFocus();
}
if (!bLeaveDraw)
UpdateStatusPosSize(); // for moving/resizing etc. by keyboard
diff --git a/sc/source/ui/view/gridwin5.cxx b/sc/source/ui/view/gridwin5.cxx
index 41328c1007bb..219fa4bf80a7 100644
--- a/sc/source/ui/view/gridwin5.cxx
+++ b/sc/source/ui/view/gridwin5.cxx
@@ -27,6 +27,7 @@
#include <svtools/imapobj.hxx>
#include <vcl/cursor.hxx>
#include <vcl/help.hxx>
+#include <vcl/svapp.hxx>
#include <tools/urlobj.hxx>
#include <sfx2/viewfrm.hxx>
@@ -448,15 +449,34 @@ void ScGridWindow::HideNoteMarker()
com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
ScGridWindow::CreateAccessible()
{
+ com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc= GetAccessible(sal_False);
+ if (xAcc.is())
+ {
+ return xAcc;
+ }
+
ScAccessibleDocument* pAccessibleDocument =
new ScAccessibleDocument(GetAccessibleParentWindow()->GetAccessible(),
pViewData->GetViewShell(), eWhich);
- com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccessible = pAccessibleDocument;
+ xAcc = pAccessibleDocument;
+ SetAccessible(xAcc);
pAccessibleDocument->Init();
- return xAccessible;
+ return xAcc;
+ }
+
+// 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()
+{
+ ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get());
+ if (pAccDoc)
+ {
+ pAccDoc->SwitchViewFireFocus();
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index 71d469e780a1..757bca6d7bd4 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -87,23 +87,6 @@ static const ColorData nAuthorColor[ SC_AUTHORCOLORCOUNT ] = {
// Hilfsklasse, fuer die Farbzuordnung,
// um nicht mehrfach hintereinander denselben User aus der Liste zu suchen
-class ScActionColorChanger
-{
-private:
- const ScAppOptions& rOpt;
- const std::set<OUString>& rUsers;
- OUString aLastUserName;
- size_t nLastUserIndex;
- ColorData nColor;
-
-public:
- ScActionColorChanger( const ScChangeTrack& rTrack );
- ~ScActionColorChanger() {}
-
- void Update( const ScChangeAction& rAction );
- ColorData GetColor() const { return nColor; }
-};
-
//------------------------------------------------------------------
ScActionColorChanger::ScActionColorChanger( const ScChangeTrack& rTrack ) :
diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx
index a5f77ea955fa..fbbf67a52642 100644
--- a/sc/source/ui/view/preview.cxx
+++ b/sc/source/ui/view/preview.cxx
@@ -1470,11 +1470,30 @@ void ScPreview::LoseFocus()
com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> ScPreview::CreateAccessible()
{
+ com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> xAcc= GetAccessible(sal_False);
+ if (xAcc.is())
+ {
+ return xAcc;
+ }
+
ScAccessibleDocumentPagePreview* pAccessible =
new ScAccessibleDocumentPagePreview( GetAccessibleParentWindow()->GetAccessible(), pViewShell );
- com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xAccessible = pAccessible;
+
+ xAcc = pAccessible;
+ SetAccessible(xAcc);
pAccessible->Init();
- return xAccessible;
+ return xAcc;
+}
+
+// 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()
+{
+ ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get());
+ if (pAccDoc)
+ {
+ pAccDoc->SwitchViewFireFocus();
+ }
}
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 6f44a531248f..c796cfbc8b40 100644
--- a/sc/source/ui/view/select.cxx
+++ b/sc/source/ui/view/select.cxx
@@ -451,6 +451,7 @@ sal_Bool ScViewFunctionSet::SetCursorAtCell( SCsCOL nPosX, SCsROW nPosY, sal_Boo
}
pView->UpdateRef( nPosX, nPosY, pViewData->GetTabNo() );
+ pView->SelectionChanged();
}
}
else if (pViewData->IsFillMode() ||
diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx
index bcce76ed94fb..4d8906f6daa2 100644
--- a/sc/source/ui/view/tabview2.cxx
+++ b/sc/source/ui/view/tabview2.cxx
@@ -353,7 +353,7 @@ void ScTabView::InitOwnBlockMode()
}
void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
- bool bTestNeg, bool bCols, bool bRows )
+ bool bTestNeg, bool bCols, bool bRows, bool bForceNeg )
{
if (!IsBlockMode())
{
@@ -364,7 +364,9 @@ void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
SCTAB nTab = aViewData.GetTabNo();
// Teil von Markierung aufheben?
- if (bTestNeg)
+ if (bForceNeg)
+ bBlockNeg = sal_True;
+ 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 bf2c58cbcbcd..7daff6dd0670 100644
--- a/sc/source/ui/view/tabvwsh.cxx
+++ b/sc/source/ui/view/tabvwsh.cxx
@@ -29,6 +29,9 @@
#include <sfx2/infobar.hxx>
#include <sfx2/sidebar/SidebarChildWindow.hxx>
+#include "cellvalue.hxx"
+#include "docoptio.hxx"
+
#include "tabvwsh.hxx"
#include "docsh.hxx"
#include "reffact.hxx"
@@ -38,7 +41,6 @@
#include "drawattr.hxx"
#include "spelldialog.hxx"
-
#define ScTabViewShell
#include "scslots.hxx"
@@ -98,4 +100,17 @@ SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" )
SFX_VIEW_REGISTRATION(ScDocShell);
}
+OUString ScTabViewShell::GetFormula(ScAddress& rAddress)
+{
+ OUString sFormula;
+ ScDocument* pDoc = GetViewData()->GetDocument();
+ ScRefCellValue aCell;
+ aCell.assign(*pDoc, rAddress);
+ if (!aCell.isEmpty() && aCell.meType == CELLTYPE_FORMULA)
+ {
+ sFormula = aCell.mpString->getString();
+ }
+ return sFormula;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwsh4.cxx b/sc/source/ui/view/tabvwsh4.cxx
index 1c73dbe79fee..2de2b0cbc7b9 100644
--- a/sc/source/ui/view/tabvwsh4.cxx
+++ b/sc/source/ui/view/tabvwsh4.cxx
@@ -24,6 +24,7 @@
#include <svx/extrusionbar.hxx>
#include <svx/fontworkbar.hxx>
#include <editeng/boxitem.hxx>
+#include <svx/fmpage.hxx>
#include <svx/fmshell.hxx>
#include <editeng/sizeitem.hxx>
#include <svx/prtqry.hxx>
@@ -104,7 +105,7 @@ sal_uInt16 ScTabViewShell::nInsObjCtrlState = SID_INSERT_DIAGRAM;
void ScTabViewShell::Activate(sal_Bool bMDI)
{
SfxViewShell::Activate(bMDI);
-
+ bIsActive = sal_True;
// hier kein GrabFocus, sonst gibt's Probleme wenn etwas inplace editiert wird!
if ( bMDI )
@@ -234,7 +235,7 @@ void ScTabViewShell::Deactivate(sal_Bool bMDI)
}
SfxViewShell::Deactivate(bMDI);
-
+ bIsActive = sal_False;
ScInputHandler* pHdl = SC_MOD()->GetInputHdl(this);
if( bMDI )
@@ -1404,6 +1405,50 @@ sal_Bool ScTabViewShell::TabKeyInput(const KeyEvent& rKEvt)
}
}
+ // 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;
+ }
+ }
if (bHideCursor)
ShowAllCursors();
@@ -1477,6 +1522,7 @@ void ScTabViewShell::Construct( sal_uInt8 nForceDesignMode )
ScDocShell* pDocSh = GetViewData()->GetDocShell();
ScDocument* pDoc = pDocSh->GetDocument();
bReadOnly = pDocSh->IsReadOnly();
+ bIsActive = sal_False;
EnableAutoSpell(pDoc->GetDocOptions().IsAutoSpell());
@@ -1870,8 +1916,14 @@ void ScTabViewShell::GetTbxState( SfxItemSet& rSet )
rSet.Put( SfxUInt16Item( SID_TBXCTL_INSOBJ, nInsObjCtrlState ) );
}
-
-
-
+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();
+}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx
index 1546afa45a32..55f169b724c8 100644
--- a/sc/source/ui/view/tabvwshe.cxx
+++ b/sc/source/ui/view/tabvwshe.cxx
@@ -38,6 +38,7 @@
#include "editsh.hxx"
#include "dociter.hxx"
#include "inputhdl.hxx"
+#include <svx/srchdlg.hxx>
#include "document.hxx"
//==================================================================
@@ -235,7 +236,23 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
const SvxSearchItem* pSearchItem = (const SvxSearchItem*) pItem;
ScGlobal::SetSearchItem( *pSearchItem );
- SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() );
+ sal_Bool bSuccess = SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() );
+ 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 );
+ }
+ }
+ }
rReq.Done();
}
}
@@ -287,6 +304,22 @@ void ScTabViewShell::ExecSearch( SfxRequest& rReq )
rReq.IsAPI() ? SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON :
SFX_CALLMODE_STANDARD,
&aSearchItem, 0L );
+ 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();
+ }
+ }
+ }
}
else
{
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2ee7075b5c6f..69658f282827 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -1548,7 +1548,7 @@ void ScViewFunc::AutoFormat( sal_uInt16 nFormatNo, sal_Bool bRecord )
//----------------------------------------------------------------------------
// Suchen & Ersetzen
-void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
+sal_Bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
sal_Bool bAddUndo, sal_Bool bIsApi )
{
ScDocShell* pDocSh = GetViewData()->GetDocShell();
@@ -1787,6 +1787,7 @@ void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
pDocSh->PostPaintGridAll(); // mark
GetFrameWin()->LeaveWait();
}
+ return bFound;
}