summaryrefslogtreecommitdiff
path: root/sc/source/ui
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui')
-rw-r--r--sc/source/ui/Accessibility/AccessibilityHints.cxx115
-rw-r--r--sc/source/ui/Accessibility/AccessibleCell.cxx456
-rw-r--r--sc/source/ui/Accessibility/AccessibleCellBase.cxx342
-rw-r--r--sc/source/ui/Accessibility/AccessibleContextBase.cxx625
-rw-r--r--sc/source/ui/Accessibility/AccessibleCsvControl.cxx1669
-rw-r--r--sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx736
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocument.cxx2090
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentBase.cxx52
-rw-r--r--sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx1712
-rw-r--r--sc/source/ui/Accessibility/AccessibleEditObject.cxx354
-rw-r--r--sc/source/ui/Accessibility/AccessibleFilterMenu.cxx400
-rw-r--r--sc/source/ui/Accessibility/AccessibleFilterMenuItem.cxx207
-rw-r--r--sc/source/ui/Accessibility/AccessibleFilterTopWindow.cxx129
-rw-r--r--sc/source/ui/Accessibility/AccessibleGlobal.cxx97
-rw-r--r--sc/source/ui/Accessibility/AccessiblePageHeader.cxx442
-rw-r--r--sc/source/ui/Accessibility/AccessiblePageHeaderArea.cxx327
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewCell.cxx318
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx444
-rw-r--r--sc/source/ui/Accessibility/AccessiblePreviewTable.cxx707
-rw-r--r--sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx978
-rw-r--r--sc/source/ui/Accessibility/AccessibleTableBase.cxx489
-rw-r--r--sc/source/ui/Accessibility/AccessibleText.cxx1781
-rw-r--r--sc/source/ui/Accessibility/DrawModelBroadcaster.cxx96
-rw-r--r--sc/source/ui/app/client.cxx257
-rw-r--r--sc/source/ui/app/drwtrans.cxx813
-rw-r--r--sc/source/ui/app/inputhdl.cxx3818
-rw-r--r--sc/source/ui/app/inputwin.cxx1800
-rw-r--r--sc/source/ui/app/lnktrans.cxx99
-rw-r--r--sc/source/ui/app/msgpool.cxx125
-rw-r--r--sc/source/ui/app/rfindlst.cxx69
-rw-r--r--sc/source/ui/app/scdll.cxx337
-rw-r--r--sc/source/ui/app/scmod.cxx2208
-rw-r--r--sc/source/ui/app/scmod2.cxx106
-rw-r--r--sc/source/ui/app/seltrans.cxx450
-rw-r--r--sc/source/ui/app/template.cxx81
-rw-r--r--sc/source/ui/app/transobj.cxx876
-rw-r--r--sc/source/ui/app/typemap.cxx139
-rw-r--r--sc/source/ui/app/uiitems.cxx724
-rw-r--r--sc/source/ui/app/wtcdummy.cxx68
-rw-r--r--sc/source/ui/attrdlg/attrdlg.cxx147
-rw-r--r--sc/source/ui/attrdlg/condfrmt.cxx871
-rw-r--r--sc/source/ui/attrdlg/scabstdlg.cxx60
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx1648
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx603
-rw-r--r--sc/source/ui/attrdlg/scuiexp.cxx58
-rw-r--r--sc/source/ui/attrdlg/tabpages.cxx253
-rw-r--r--sc/source/ui/cctrl/cbuttonw.cxx180
-rw-r--r--sc/source/ui/cctrl/dpcontrol.cxx1424
-rw-r--r--sc/source/ui/cctrl/dpcontrol.src79
-rw-r--r--sc/source/ui/cctrl/editfield.cxx86
-rw-r--r--sc/source/ui/cctrl/popmenu.cxx50
-rw-r--r--sc/source/ui/cctrl/tbinsert.cxx143
-rw-r--r--sc/source/ui/cctrl/tbzoomsliderctrl.cxx532
-rw-r--r--sc/source/ui/dbgui/asciiopt.cxx412
-rw-r--r--sc/source/ui/dbgui/asciiopt.hrc62
-rw-r--r--sc/source/ui/dbgui/asciiopt.src277
-rw-r--r--sc/source/ui/dbgui/consdlg.cxx657
-rw-r--r--sc/source/ui/dbgui/consdlg.hrc60
-rw-r--r--sc/source/ui/dbgui/consdlg.src230
-rw-r--r--sc/source/ui/dbgui/csvcontrol.cxx339
-rw-r--r--sc/source/ui/dbgui/csvgrid.cxx1375
-rw-r--r--sc/source/ui/dbgui/csvruler.cxx685
-rw-r--r--sc/source/ui/dbgui/csvsplits.cxx122
-rw-r--r--sc/source/ui/dbgui/csvtablebox.cxx436
-rw-r--r--sc/source/ui/dbgui/dapidata.cxx231
-rw-r--r--sc/source/ui/dbgui/dapitype.cxx184
-rw-r--r--sc/source/ui/dbgui/dapitype.hrc54
-rw-r--r--sc/source/ui/dbgui/dapitype.src310
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx726
-rw-r--r--sc/source/ui/dbgui/dpgroupdlg.cxx358
-rw-r--r--sc/source/ui/dbgui/dpgroupdlg.hrc63
-rw-r--r--sc/source/ui/dbgui/dpgroupdlg.src285
-rw-r--r--sc/source/ui/dbgui/dpuiglobal.hxx42
-rw-r--r--sc/source/ui/dbgui/expftext.cxx97
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx1294
-rw-r--r--sc/source/ui/dbgui/filtdlg.cxx1253
-rw-r--r--sc/source/ui/dbgui/foptmgr.cxx341
-rw-r--r--sc/source/ui/dbgui/imoptdlg.cxx120
-rw-r--r--sc/source/ui/dbgui/imoptdlg.hrc43
-rw-r--r--sc/source/ui/dbgui/imoptdlg.src135
-rw-r--r--sc/source/ui/dbgui/outline.src42
-rw-r--r--sc/source/ui/dbgui/pfiltdlg.cxx622
-rw-r--r--sc/source/ui/dbgui/pivot.hrc81
-rw-r--r--sc/source/ui/dbgui/pivot.src329
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx859
-rw-r--r--sc/source/ui/dbgui/pvfundlg.hrc79
-rw-r--r--sc/source/ui/dbgui/pvfundlg.src538
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx1941
-rw-r--r--sc/source/ui/dbgui/scendlg.cxx250
-rw-r--r--sc/source/ui/dbgui/scendlg.hrc60
-rw-r--r--sc/source/ui/dbgui/scendlg.src171
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx736
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx325
-rw-r--r--sc/source/ui/dbgui/sfiltdlg.cxx523
-rw-r--r--sc/source/ui/dbgui/sortdlg.cxx110
-rw-r--r--sc/source/ui/dbgui/subtdlg.cxx71
-rw-r--r--sc/source/ui/dbgui/textimportoptions.cxx120
-rw-r--r--sc/source/ui/dbgui/textimportoptions.src111
-rw-r--r--sc/source/ui/dbgui/tpsort.cxx1078
-rw-r--r--sc/source/ui/dbgui/tpsubt.cxx681
-rw-r--r--sc/source/ui/dbgui/validate.cxx998
-rw-r--r--sc/source/ui/dbgui/validate.src337
-rw-r--r--sc/source/ui/docshell/arealink.cxx531
-rw-r--r--sc/source/ui/docshell/autostyl.cxx234
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx1533
-rw-r--r--sc/source/ui/docshell/dbdocimp.cxx724
-rw-r--r--sc/source/ui/docshell/docfunc.cxx4948
-rw-r--r--sc/source/ui/docshell/docsh.cxx3049
-rw-r--r--sc/source/ui/docshell/docsh2.cxx233
-rw-r--r--sc/source/ui/docshell/docsh3.cxx1373
-rw-r--r--sc/source/ui/docshell/docsh4.cxx2333
-rw-r--r--sc/source/ui/docshell/docsh5.cxx1021
-rw-r--r--sc/source/ui/docshell/docsh6.cxx535
-rw-r--r--sc/source/ui/docshell/docsh7.cxx47
-rw-r--r--sc/source/ui/docshell/docsh8.cxx1175
-rw-r--r--sc/source/ui/docshell/docshimp.hxx59
-rw-r--r--sc/source/ui/docshell/editable.cxx164
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx2647
-rw-r--r--sc/source/ui/docshell/hiranges.cxx55
-rw-r--r--sc/source/ui/docshell/impex.cxx2104
-rw-r--r--sc/source/ui/docshell/macromgr.cxx216
-rw-r--r--sc/source/ui/docshell/olinefun.cxx799
-rw-r--r--sc/source/ui/docshell/pagedata.cxx141
-rw-r--r--sc/source/ui/docshell/pntlock.cxx63
-rw-r--r--sc/source/ui/docshell/servobj.cxx278
-rw-r--r--sc/source/ui/docshell/sizedev.cxx79
-rw-r--r--sc/source/ui/docshell/tablink.cxx620
-rw-r--r--sc/source/ui/docshell/tpstat.cxx103
-rw-r--r--sc/source/ui/docshell/tpstat.hrc36
-rw-r--r--sc/source/ui/docshell/tpstat.src79
-rw-r--r--sc/source/ui/drawfunc/chartsh.cxx82
-rw-r--r--sc/source/ui/drawfunc/drawsh.cxx482
-rw-r--r--sc/source/ui/drawfunc/drawsh2.cxx397
-rw-r--r--sc/source/ui/drawfunc/drawsh4.cxx117
-rw-r--r--sc/source/ui/drawfunc/drawsh5.cxx751
-rw-r--r--sc/source/ui/drawfunc/drformsh.cxx83
-rw-r--r--sc/source/ui/drawfunc/drformsh.src215
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx1076
-rw-r--r--sc/source/ui/drawfunc/drtxtob1.cxx150
-rw-r--r--sc/source/ui/drawfunc/drtxtob2.cxx301
-rw-r--r--sc/source/ui/drawfunc/fuconarc.cxx227
-rw-r--r--sc/source/ui/drawfunc/fuconcustomshape.cxx287
-rw-r--r--sc/source/ui/drawfunc/fuconpol.cxx358
-rw-r--r--sc/source/ui/drawfunc/fuconrec.cxx311
-rw-r--r--sc/source/ui/drawfunc/fuconstr.cxx337
-rw-r--r--sc/source/ui/drawfunc/fuconuno.cxx192
-rw-r--r--sc/source/ui/drawfunc/fudraw.cxx828
-rw-r--r--sc/source/ui/drawfunc/fuins1.cxx388
-rw-r--r--sc/source/ui/drawfunc/fuins2.cxx852
-rw-r--r--sc/source/ui/drawfunc/fumark.cxx292
-rw-r--r--sc/source/ui/drawfunc/fupoor.cxx388
-rw-r--r--sc/source/ui/drawfunc/fusel.cxx655
-rw-r--r--sc/source/ui/drawfunc/fusel2.cxx187
-rw-r--r--sc/source/ui/drawfunc/futext.cxx813
-rw-r--r--sc/source/ui/drawfunc/futext2.cxx173
-rw-r--r--sc/source/ui/drawfunc/futext3.cxx200
-rw-r--r--sc/source/ui/drawfunc/graphsh.cxx150
-rw-r--r--sc/source/ui/drawfunc/mediash.cxx146
-rw-r--r--sc/source/ui/drawfunc/objdraw.src685
-rw-r--r--sc/source/ui/drawfunc/oleobjsh.cxx83
-rw-r--r--sc/source/ui/formdlg/dwfunctr.cxx1141
-rw-r--r--sc/source/ui/formdlg/dwfunctr.hrc33
-rw-r--r--sc/source/ui/formdlg/dwfunctr.src127
-rw-r--r--sc/source/ui/formdlg/formdata.cxx63
-rw-r--r--sc/source/ui/formdlg/formdlgs.src30
-rw-r--r--sc/source/ui/formdlg/formula.cxx678
-rw-r--r--sc/source/ui/formdlg/privsplt.cxx424
-rw-r--r--sc/source/ui/inc/AccessibilityHints.hxx100
-rw-r--r--sc/source/ui/inc/AccessibleCell.hxx176
-rw-r--r--sc/source/ui/inc/AccessibleCellBase.hxx156
-rw-r--r--sc/source/ui/inc/AccessibleContextBase.hxx345
-rw-r--r--sc/source/ui/inc/AccessibleCsvControl.hxx668
-rw-r--r--sc/source/ui/inc/AccessibleDataPilotControl.hxx148
-rw-r--r--sc/source/ui/inc/AccessibleDocument.hxx331
-rw-r--r--sc/source/ui/inc/AccessibleDocumentBase.hxx50
-rw-r--r--sc/source/ui/inc/AccessibleDocumentPagePreview.hxx157
-rw-r--r--sc/source/ui/inc/AccessibleEditObject.hxx181
-rw-r--r--sc/source/ui/inc/AccessiblePageHeader.hxx114
-rw-r--r--sc/source/ui/inc/AccessiblePageHeaderArea.hxx138
-rw-r--r--sc/source/ui/inc/AccessiblePreviewCell.hxx123
-rw-r--r--sc/source/ui/inc/AccessiblePreviewHeaderCell.hxx155
-rw-r--r--sc/source/ui/inc/AccessiblePreviewTable.hxx185
-rw-r--r--sc/source/ui/inc/AccessibleSpreadsheet.hxx288
-rw-r--r--sc/source/ui/inc/AccessibleTableBase.hxx301
-rw-r--r--sc/source/ui/inc/AccessibleText.hxx360
-rw-r--r--sc/source/ui/inc/ChartRangeSelectionListener.hxx82
-rw-r--r--sc/source/ui/inc/DrawModelBroadcaster.hxx62
-rw-r--r--sc/source/ui/inc/IAnyRefDialog.hxx61
-rw-r--r--sc/source/ui/inc/ScDevChart.hxx87
-rw-r--r--sc/source/ui/inc/acredlin.hrc71
-rw-r--r--sc/source/ui/inc/acredlin.hxx257
-rw-r--r--sc/source/ui/inc/anyrefdg.hxx267
-rw-r--r--sc/source/ui/inc/areasave.hxx86
-rw-r--r--sc/source/ui/inc/areasdlg.hxx106
-rw-r--r--sc/source/ui/inc/asciiopt.hxx112
-rw-r--r--sc/source/ui/inc/attrdlg.hrc49
-rw-r--r--sc/source/ui/inc/attrdlg.hxx71
-rw-r--r--sc/source/ui/inc/auditsh.hxx61
-rw-r--r--sc/source/ui/inc/autofmt.hxx141
-rw-r--r--sc/source/ui/inc/autostyl.hxx75
-rw-r--r--sc/source/ui/inc/cbutton.hxx86
-rw-r--r--sc/source/ui/inc/cellmergeoption.hxx61
-rw-r--r--sc/source/ui/inc/cellsh.hxx117
-rw-r--r--sc/source/ui/inc/chartsh.hxx55
-rw-r--r--sc/source/ui/inc/client.hxx64
-rw-r--r--sc/source/ui/inc/colrowba.hxx112
-rw-r--r--sc/source/ui/inc/condfrmt.hrc78
-rw-r--r--sc/source/ui/inc/condfrmt.hxx154
-rw-r--r--sc/source/ui/inc/conflictsdlg.hrc43
-rw-r--r--sc/source/ui/inc/conflictsdlg.hxx215
-rw-r--r--sc/source/ui/inc/consdlg.hxx130
-rw-r--r--sc/source/ui/inc/content.hxx169
-rw-r--r--sc/source/ui/inc/corodlg.hxx77
-rw-r--r--sc/source/ui/inc/crdlg.hxx65
-rw-r--r--sc/source/ui/inc/crnrdlg.hrc45
-rw-r--r--sc/source/ui/inc/crnrdlg.hxx114
-rw-r--r--sc/source/ui/inc/csvcontrol.hxx434
-rw-r--r--sc/source/ui/inc/csvgrid.hxx363
-rw-r--r--sc/source/ui/inc/csvruler.hxx202
-rw-r--r--sc/source/ui/inc/csvsplits.hxx105
-rw-r--r--sc/source/ui/inc/csvtablebox.hxx159
-rw-r--r--sc/source/ui/inc/dapidata.hxx72
-rw-r--r--sc/source/ui/inc/dapitype.hxx103
-rw-r--r--sc/source/ui/inc/datafdlg.hrc42
-rw-r--r--sc/source/ui/inc/datafdlg.hxx102
-rw-r--r--sc/source/ui/inc/dbdocfun.hxx127
-rw-r--r--sc/source/ui/inc/dbfunc.hxx136
-rw-r--r--sc/source/ui/inc/dbnamdlg.hrc50
-rw-r--r--sc/source/ui/inc/dbnamdlg.hxx123
-rw-r--r--sc/source/ui/inc/delcldlg.hxx66
-rw-r--r--sc/source/ui/inc/delcodlg.hxx76
-rw-r--r--sc/source/ui/inc/docfunc.hxx212
-rw-r--r--sc/source/ui/inc/docsh.hxx479
-rw-r--r--sc/source/ui/inc/dpcontrol.hrc40
-rw-r--r--sc/source/ui/inc/dpcontrol.hxx366
-rw-r--r--sc/source/ui/inc/dpgroupdlg.hxx168
-rw-r--r--sc/source/ui/inc/drawsh.hxx94
-rw-r--r--sc/source/ui/inc/drawutil.hxx53
-rw-r--r--sc/source/ui/inc/drawview.hxx147
-rw-r--r--sc/source/ui/inc/drformsh.hxx58
-rw-r--r--sc/source/ui/inc/drtxtob.hxx88
-rw-r--r--sc/source/ui/inc/drwtrans.hxx115
-rw-r--r--sc/source/ui/inc/dwfunctr.hxx149
-rw-r--r--sc/source/ui/inc/editable.hxx88
-rw-r--r--sc/source/ui/inc/editfield.hxx52
-rw-r--r--sc/source/ui/inc/editsh.hxx88
-rw-r--r--sc/source/ui/inc/expftext.hxx48
-rw-r--r--sc/source/ui/inc/fieldwnd.hxx394
-rw-r--r--sc/source/ui/inc/filldlg.hxx133
-rw-r--r--sc/source/ui/inc/filtdlg.hxx263
-rw-r--r--sc/source/ui/inc/filter.hrc88
-rw-r--r--sc/source/ui/inc/foptmgr.hxx116
-rw-r--r--sc/source/ui/inc/formatsh.hxx85
-rw-r--r--sc/source/ui/inc/formdata.hxx68
-rw-r--r--sc/source/ui/inc/formula.hxx138
-rw-r--r--sc/source/ui/inc/fuconarc.hxx64
-rw-r--r--sc/source/ui/inc/fuconcustomshape.hxx63
-rw-r--r--sc/source/ui/inc/fuconpol.hxx65
-rw-r--r--sc/source/ui/inc/fuconrec.hxx64
-rw-r--r--sc/source/ui/inc/fuconstr.hxx70
-rw-r--r--sc/source/ui/inc/fuconuno.hxx69
-rw-r--r--sc/source/ui/inc/fudraw.hxx80
-rw-r--r--sc/source/ui/inc/fuedipo.hxx62
-rw-r--r--sc/source/ui/inc/fuinsert.hxx87
-rw-r--r--sc/source/ui/inc/fumark.hxx76
-rw-r--r--sc/source/ui/inc/funcpage.hxx128
-rw-r--r--sc/source/ui/inc/funcutl.hxx197
-rw-r--r--sc/source/ui/inc/fupoor.hxx138
-rw-r--r--sc/source/ui/inc/fusel.hxx80
-rw-r--r--sc/source/ui/inc/futext.hxx83
-rw-r--r--sc/source/ui/inc/graphsh.hxx60
-rw-r--r--sc/source/ui/inc/gridmerg.hxx66
-rw-r--r--sc/source/ui/inc/gridwin.hxx419
-rw-r--r--sc/source/ui/inc/groupdlg.hxx63
-rw-r--r--sc/source/ui/inc/hdrcont.hxx141
-rw-r--r--sc/source/ui/inc/hfedtdlg.hxx59
-rw-r--r--sc/source/ui/inc/highred.hrc60
-rw-r--r--sc/source/ui/inc/highred.hxx116
-rw-r--r--sc/source/ui/inc/hintwin.hxx56
-rw-r--r--sc/source/ui/inc/hiranges.hxx66
-rw-r--r--sc/source/ui/inc/imoptdlg.hxx114
-rw-r--r--sc/source/ui/inc/impex.hxx195
-rw-r--r--sc/source/ui/inc/inputhdl.hxx304
-rw-r--r--sc/source/ui/inc/inputwin.hxx228
-rw-r--r--sc/source/ui/inc/inscldlg.hxx64
-rw-r--r--sc/source/ui/inc/inscodlg.hxx118
-rw-r--r--sc/source/ui/inc/instbdlg.hrc48
-rw-r--r--sc/source/ui/inc/instbdlg.hxx126
-rw-r--r--sc/source/ui/inc/invmerge.hxx63
-rw-r--r--sc/source/ui/inc/lbseldlg.hxx69
-rw-r--r--sc/source/ui/inc/linkarea.hrc41
-rw-r--r--sc/source/ui/inc/linkarea.hxx101
-rw-r--r--sc/source/ui/inc/lnktrans.hxx55
-rw-r--r--sc/source/ui/inc/mediash.hxx57
-rw-r--r--sc/source/ui/inc/miscdlgs.hrc183
-rw-r--r--sc/source/ui/inc/msgpool.hxx79
-rw-r--r--sc/source/ui/inc/mtrindlg.hxx78
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx109
-rw-r--r--sc/source/ui/inc/namecrea.hxx57
-rw-r--r--sc/source/ui/inc/namedlg.hrc54
-rw-r--r--sc/source/ui/inc/namedlg.hxx137
-rw-r--r--sc/source/ui/inc/namepast.hxx62
-rw-r--r--sc/source/ui/inc/navcitem.hxx57
-rw-r--r--sc/source/ui/inc/navipi.hxx367
-rw-r--r--sc/source/ui/inc/navsett.hxx61
-rw-r--r--sc/source/ui/inc/notemark.hxx80
-rw-r--r--sc/source/ui/inc/oleobjsh.hxx55
-rw-r--r--sc/source/ui/inc/olinefun.hxx70
-rw-r--r--sc/source/ui/inc/olinewin.hxx246
-rw-r--r--sc/source/ui/inc/opredlin.hrc38
-rw-r--r--sc/source/ui/inc/opredlin.hxx78
-rw-r--r--sc/source/ui/inc/optdlg.hrc196
-rw-r--r--sc/source/ui/inc/optload.hrc38
-rw-r--r--sc/source/ui/inc/optload.hxx68
-rw-r--r--sc/source/ui/inc/optsolver.hrc95
-rw-r--r--sc/source/ui/inc/optsolver.hxx266
-rw-r--r--sc/source/ui/inc/output.hxx345
-rw-r--r--sc/source/ui/inc/overlayobject.hxx58
-rw-r--r--sc/source/ui/inc/pagedata.hxx97
-rw-r--r--sc/source/ui/inc/parawin.hxx171
-rw-r--r--sc/source/ui/inc/pfiltdlg.hxx131
-rw-r--r--sc/source/ui/inc/pfuncache.hxx127
-rw-r--r--sc/source/ui/inc/pgbrksh.hxx55
-rw-r--r--sc/source/ui/inc/pivotsh.hxx63
-rw-r--r--sc/source/ui/inc/pntlock.hxx69
-rw-r--r--sc/source/ui/inc/popmenu.hxx53
-rw-r--r--sc/source/ui/inc/preview.hxx173
-rw-r--r--sc/source/ui/inc/prevloc.hxx161
-rw-r--r--sc/source/ui/inc/prevwsh.hxx136
-rw-r--r--sc/source/ui/inc/printfun.hxx368
-rw-r--r--sc/source/ui/inc/privsplt.hxx89
-rw-r--r--sc/source/ui/inc/protectiondlg.hrc44
-rw-r--r--sc/source/ui/inc/protectiondlg.hxx85
-rw-r--r--sc/source/ui/inc/pvfundlg.hxx254
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx255
-rw-r--r--sc/source/ui/inc/redcom.hxx68
-rw-r--r--sc/source/ui/inc/reffact.hxx123
-rw-r--r--sc/source/ui/inc/refundo.hxx71
-rw-r--r--sc/source/ui/inc/retypepassdlg.hrc71
-rw-r--r--sc/source/ui/inc/retypepassdlg.hxx177
-rw-r--r--sc/source/ui/inc/rfindlst.hxx77
-rw-r--r--sc/source/ui/inc/scendlg.hxx82
-rw-r--r--sc/source/ui/inc/scui_def.hxx59
-rw-r--r--sc/source/ui/inc/scuiasciiopt.hxx149
-rw-r--r--sc/source/ui/inc/scuiautofmt.hxx90
-rw-r--r--sc/source/ui/inc/scuiimoptdlg.hxx81
-rw-r--r--sc/source/ui/inc/scuitphfedit.hxx167
-rw-r--r--sc/source/ui/inc/select.hxx131
-rw-r--r--sc/source/ui/inc/selectionstate.hxx81
-rw-r--r--sc/source/ui/inc/seltrans.hxx83
-rw-r--r--sc/source/ui/inc/servobj.hxx79
-rw-r--r--sc/source/ui/inc/sharedocdlg.hrc44
-rw-r--r--sc/source/ui/inc/sharedocdlg.hxx79
-rw-r--r--sc/source/ui/inc/shtabdlg.hxx71
-rw-r--r--sc/source/ui/inc/simpref.hrc36
-rw-r--r--sc/source/ui/inc/simpref.hxx116
-rw-r--r--sc/source/ui/inc/sizedev.hxx57
-rw-r--r--sc/source/ui/inc/solveroptions.hrc46
-rw-r--r--sc/source/ui/inc/solveroptions.hxx123
-rw-r--r--sc/source/ui/inc/solverutil.hxx52
-rw-r--r--sc/source/ui/inc/solvrdlg.hrc45
-rw-r--r--sc/source/ui/inc/solvrdlg.hxx111
-rw-r--r--sc/source/ui/inc/sortdlg.hrc78
-rw-r--r--sc/source/ui/inc/sortdlg.hxx90
-rw-r--r--sc/source/ui/inc/spelldialog.hxx105
-rw-r--r--sc/source/ui/inc/spelleng.hxx171
-rw-r--r--sc/source/ui/inc/spellparam.hxx89
-rw-r--r--sc/source/ui/inc/strindlg.hxx68
-rw-r--r--sc/source/ui/inc/styledlg.hrc39
-rw-r--r--sc/source/ui/inc/styledlg.hxx58
-rw-r--r--sc/source/ui/inc/submenu.hrc68
-rw-r--r--sc/source/ui/inc/subtdlg.hrc56
-rw-r--r--sc/source/ui/inc/subtdlg.hxx52
-rw-r--r--sc/source/ui/inc/tabbgcolordlg.hxx79
-rw-r--r--sc/source/ui/inc/tabcont.hxx91
-rw-r--r--sc/source/ui/inc/tabopdlg.hrc48
-rw-r--r--sc/source/ui/inc/tabopdlg.hxx116
-rw-r--r--sc/source/ui/inc/tabpages.hxx84
-rw-r--r--sc/source/ui/inc/tabpopsh.hxx55
-rw-r--r--sc/source/ui/inc/tabsplit.hxx62
-rw-r--r--sc/source/ui/inc/tabview.hxx522
-rw-r--r--sc/source/ui/inc/tabvwsh.hxx426
-rw-r--r--sc/source/ui/inc/target.hxx54
-rw-r--r--sc/source/ui/inc/tbinsert.hrc30
-rw-r--r--sc/source/ui/inc/tbinsert.hxx56
-rw-r--r--sc/source/ui/inc/tbzoomsliderctrl.hxx80
-rw-r--r--sc/source/ui/inc/textdlgs.hxx74
-rw-r--r--sc/source/ui/inc/textimportoptions.hrc39
-rw-r--r--sc/source/ui/inc/textimportoptions.hxx76
-rw-r--r--sc/source/ui/inc/tpcalc.hxx103
-rw-r--r--sc/source/ui/inc/tpcompatibility.hxx66
-rw-r--r--sc/source/ui/inc/tpformula.hxx99
-rw-r--r--sc/source/ui/inc/tphf.hxx103
-rw-r--r--sc/source/ui/inc/tphfedit.hxx140
-rw-r--r--sc/source/ui/inc/tpprint.hxx58
-rw-r--r--sc/source/ui/inc/tpsort.hxx224
-rw-r--r--sc/source/ui/inc/tpstat.hxx68
-rw-r--r--sc/source/ui/inc/tpsubt.hxx191
-rw-r--r--sc/source/ui/inc/tptable.hxx116
-rw-r--r--sc/source/ui/inc/tpusrlst.hxx119
-rw-r--r--sc/source/ui/inc/tpview.hxx173
-rw-r--r--sc/source/ui/inc/transobj.hxx118
-rw-r--r--sc/source/ui/inc/ui_pch.hxx327
-rw-r--r--sc/source/ui/inc/uiitems.hxx374
-rw-r--r--sc/source/ui/inc/undobase.hxx179
-rw-r--r--sc/source/ui/inc/undoblk.hxx997
-rw-r--r--sc/source/ui/inc/undocell.hxx377
-rw-r--r--sc/source/ui/inc/undodat.hxx541
-rw-r--r--sc/source/ui/inc/undodraw.hxx65
-rw-r--r--sc/source/ui/inc/undoolk.hxx47
-rw-r--r--sc/source/ui/inc/undostyl.hxx119
-rw-r--r--sc/source/ui/inc/undotab.hxx527
-rw-r--r--sc/source/ui/inc/undoutil.hxx69
-rw-r--r--sc/source/ui/inc/validate.hrc85
-rw-r--r--sc/source/ui/inc/validate.hxx324
-rw-r--r--sc/source/ui/inc/viewdata.hxx568
-rw-r--r--sc/source/ui/inc/viewfunc.hxx378
-rw-r--r--sc/source/ui/inc/viewutil.hxx114
-rw-r--r--sc/source/ui/inc/warnbox.hxx76
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx2007
-rw-r--r--sc/source/ui/miscdlgs/acredlin.src221
-rw-r--r--sc/source/ui/miscdlgs/anyrefdg.cxx956
-rw-r--r--sc/source/ui/miscdlgs/autofmt.cxx566
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.cxx842
-rw-r--r--sc/source/ui/miscdlgs/conflictsdlg.src112
-rw-r--r--sc/source/ui/miscdlgs/crdlg.cxx89
-rw-r--r--sc/source/ui/miscdlgs/crnrdlg.cxx1173
-rw-r--r--sc/source/ui/miscdlgs/datafdlg.cxx416
-rw-r--r--sc/source/ui/miscdlgs/delcldlg.cxx122
-rw-r--r--sc/source/ui/miscdlgs/delcodlg.cxx182
-rw-r--r--sc/source/ui/miscdlgs/filldlg.cxx381
-rw-r--r--sc/source/ui/miscdlgs/groupdlg.cxx85
-rw-r--r--sc/source/ui/miscdlgs/highred.cxx289
-rw-r--r--sc/source/ui/miscdlgs/highred.src107
-rw-r--r--sc/source/ui/miscdlgs/inscldlg.cxx122
-rw-r--r--sc/source/ui/miscdlgs/inscodlg.cxx374
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.cxx436
-rw-r--r--sc/source/ui/miscdlgs/instbdlg.src156
-rw-r--r--sc/source/ui/miscdlgs/lbseldlg.cxx103
-rw-r--r--sc/source/ui/miscdlgs/linkarea.cxx370
-rw-r--r--sc/source/ui/miscdlgs/linkarea.src126
-rw-r--r--sc/source/ui/miscdlgs/mtrindlg.cxx188
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx377
-rw-r--r--sc/source/ui/miscdlgs/namecrea.cxx81
-rw-r--r--sc/source/ui/miscdlgs/namepast.cxx124
-rw-r--r--sc/source/ui/miscdlgs/optsolver.cxx1079
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.cxx165
-rw-r--r--sc/source/ui/miscdlgs/protectiondlg.src131
-rw-r--r--sc/source/ui/miscdlgs/redcom.cxx187
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.cxx547
-rw-r--r--sc/source/ui/miscdlgs/retypepassdlg.src322
-rw-r--r--sc/source/ui/miscdlgs/scuiautofmt.cxx479
-rw-r--r--sc/source/ui/miscdlgs/sharedocdlg.cxx238
-rw-r--r--sc/source/ui/miscdlgs/sharedocdlg.src111
-rw-r--r--sc/source/ui/miscdlgs/shtabdlg.cxx113
-rw-r--r--sc/source/ui/miscdlgs/simpref.cxx259
-rw-r--r--sc/source/ui/miscdlgs/solveroptions.cxx494
-rw-r--r--sc/source/ui/miscdlgs/solverutil.cxx228
-rw-r--r--sc/source/ui/miscdlgs/solvrdlg.cxx318
-rw-r--r--sc/source/ui/miscdlgs/strindlg.cxx91
-rw-r--r--sc/source/ui/miscdlgs/tabbgcolordlg.cxx196
-rw-r--r--sc/source/ui/miscdlgs/tabopdlg.cxx373
-rw-r--r--sc/source/ui/miscdlgs/textdlgs.cxx132
-rw-r--r--sc/source/ui/miscdlgs/warnbox.cxx96
-rw-r--r--sc/source/ui/namedlg/namedlg.cxx642
-rw-r--r--sc/source/ui/navipi/content.cxx1490
-rw-r--r--sc/source/ui/navipi/navcitem.cxx125
-rw-r--r--sc/source/ui/navipi/navipi.cxx1483
-rw-r--r--sc/source/ui/navipi/navipi.hrc55
-rw-r--r--sc/source/ui/navipi/navipi.src343
-rw-r--r--sc/source/ui/navipi/scenwnd.cxx311
-rw-r--r--sc/source/ui/optdlg/opredlin.cxx227
-rw-r--r--sc/source/ui/optdlg/tpcalc.cxx306
-rw-r--r--sc/source/ui/optdlg/tpcompatibility.cxx108
-rw-r--r--sc/source/ui/optdlg/tpformula.cxx290
-rw-r--r--sc/source/ui/optdlg/tpprint.cxx146
-rw-r--r--sc/source/ui/optdlg/tpusrlst.cxx808
-rw-r--r--sc/source/ui/optdlg/tpview.cxx684
-rw-r--r--sc/source/ui/pagedlg/areasdlg.cxx908
-rw-r--r--sc/source/ui/pagedlg/hfedtdlg.cxx187
-rw-r--r--sc/source/ui/pagedlg/hfedtdlg.hrc54
-rw-r--r--sc/source/ui/pagedlg/hfedtdlg.src777
-rw-r--r--sc/source/ui/pagedlg/pagedlg.hrc100
-rw-r--r--sc/source/ui/pagedlg/pagedlg.src409
-rw-r--r--sc/source/ui/pagedlg/scuitphfedit.cxx994
-rw-r--r--sc/source/ui/pagedlg/tphf.cxx334
-rw-r--r--sc/source/ui/pagedlg/tphf.src37
-rw-r--r--sc/source/ui/pagedlg/tphfedit.cxx441
-rw-r--r--sc/source/ui/pagedlg/tptable.cxx570
-rw-r--r--sc/source/ui/src/attrdlg.src168
-rw-r--r--sc/source/ui/src/autofmt.src228
-rw-r--r--sc/source/ui/src/condfrmt.src407
-rw-r--r--sc/source/ui/src/crnrdlg.src143
-rw-r--r--sc/source/ui/src/datafdlg.src99
-rw-r--r--sc/source/ui/src/dbnamdlg.src187
-rw-r--r--sc/source/ui/src/filter.src894
-rw-r--r--sc/source/ui/src/globstr.src1827
-rw-r--r--sc/source/ui/src/hdrcont.src200
-rw-r--r--sc/source/ui/src/miscdlgs.src1508
-rw-r--r--sc/source/ui/src/namedlg.src195
-rw-r--r--sc/source/ui/src/opredlin.src103
-rw-r--r--sc/source/ui/src/optdlg.src910
-rw-r--r--sc/source/ui/src/optsolver.src573
-rw-r--r--sc/source/ui/src/popup.src544
-rw-r--r--sc/source/ui/src/pseudo.src28
-rw-r--r--sc/source/ui/src/sc.src44
-rw-r--r--sc/source/ui/src/scerrors.src169
-rw-r--r--sc/source/ui/src/scfuncs.src9044
-rw-r--r--sc/source/ui/src/scstring.src856
-rw-r--r--sc/source/ui/src/scwarngs.src43
-rw-r--r--sc/source/ui/src/simpref.src79
-rw-r--r--sc/source/ui/src/solveroptions.src191
-rw-r--r--sc/source/ui/src/solvrdlg.src139
-rw-r--r--sc/source/ui/src/sortdlg.src380
-rw-r--r--sc/source/ui/src/subtdlg.src245
-rw-r--r--sc/source/ui/src/tabopdlg.src149
-rw-r--r--sc/source/ui/src/textdlgs.src155
-rw-r--r--sc/source/ui/src/toolbox.src154
-rw-r--r--sc/source/ui/styleui/scstyles.src68
-rw-r--r--sc/source/ui/styleui/styledlg.cxx219
-rw-r--r--sc/source/ui/styleui/styledlg.src137
-rw-r--r--sc/source/ui/styleui/template.curbin0 -> 326 bytes
-rw-r--r--sc/source/ui/undo/areasave.cxx231
-rw-r--r--sc/source/ui/undo/refundo.cxx216
-rw-r--r--sc/source/ui/undo/target.cxx48
-rw-r--r--sc/source/ui/undo/undobase.cxx532
-rw-r--r--sc/source/ui/undo/undoblk.cxx2267
-rw-r--r--sc/source/ui/undo/undoblk2.cxx208
-rw-r--r--sc/source/ui/undo/undoblk3.cxx2136
-rw-r--r--sc/source/ui/undo/undocell.cxx1147
-rw-r--r--sc/source/ui/undo/undodat.cxx2235
-rw-r--r--sc/source/ui/undo/undodraw.cxx198
-rw-r--r--sc/source/ui/undo/undoolk.cxx104
-rw-r--r--sc/source/ui/undo/undorangename.cxx117
-rw-r--r--sc/source/ui/undo/undostyl.cxx312
-rw-r--r--sc/source/ui/undo/undotab.cxx1680
-rw-r--r--sc/source/ui/undo/undoutil.cxx137
-rw-r--r--sc/source/ui/unoobj/ChartRangeSelectionListener.cxx88
-rw-r--r--sc/source/ui/unoobj/addruno.cxx330
-rw-r--r--sc/source/ui/unoobj/afmtuno.cxx884
-rw-r--r--sc/source/ui/unoobj/appluno.cxx960
-rw-r--r--sc/source/ui/unoobj/celllistsource.cxx451
-rw-r--r--sc/source/ui/unoobj/celllistsource.hxx178
-rw-r--r--sc/source/ui/unoobj/cellsuno.cxx9833
-rw-r--r--sc/source/ui/unoobj/cellvaluebinding.cxx665
-rw-r--r--sc/source/ui/unoobj/cellvaluebinding.hxx174
-rw-r--r--sc/source/ui/unoobj/chart2uno.cxx3614
-rw-r--r--sc/source/ui/unoobj/chartuno.cxx809
-rw-r--r--sc/source/ui/unoobj/confuno.cxx487
-rw-r--r--sc/source/ui/unoobj/convuno.cxx66
-rw-r--r--sc/source/ui/unoobj/cursuno.cxx512
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx3563
-rw-r--r--sc/source/ui/unoobj/datauno.cxx2463
-rw-r--r--sc/source/ui/unoobj/defltuno.cxx389
-rw-r--r--sc/source/ui/unoobj/detreg.cxx92
-rw-r--r--sc/source/ui/unoobj/dispuno.cxx417
-rw-r--r--sc/source/ui/unoobj/docuno.cxx3734
-rw-r--r--sc/source/ui/unoobj/drdefuno.cxx85
-rw-r--r--sc/source/ui/unoobj/editsrc.cxx373
-rw-r--r--sc/source/ui/unoobj/eventuno.cxx200
-rw-r--r--sc/source/ui/unoobj/fielduno.cxx1514
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx314
-rw-r--r--sc/source/ui/unoobj/fmtuno.cxx1091
-rw-r--r--sc/source/ui/unoobj/forbiuno.cxx95
-rw-r--r--sc/source/ui/unoobj/funcuno.cxx743
-rw-r--r--sc/source/ui/unoobj/linkuno.cxx1819
-rw-r--r--sc/source/ui/unoobj/listenercalls.cxx91
-rw-r--r--sc/source/ui/unoobj/miscuno.cxx318
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx1167
-rw-r--r--sc/source/ui/unoobj/notesuno.cxx735
-rw-r--r--sc/source/ui/unoobj/optuno.cxx235
-rw-r--r--sc/source/ui/unoobj/pageuno.cxx81
-rw-r--r--sc/source/ui/unoobj/scdetect.cxx897
-rw-r--r--sc/source/ui/unoobj/scdetect.hxx98
-rw-r--r--sc/source/ui/unoobj/servuno.cxx622
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx1513
-rw-r--r--sc/source/ui/unoobj/srchuno.cxx278
-rw-r--r--sc/source/ui/unoobj/styleuno.cxx2132
-rw-r--r--sc/source/ui/unoobj/targuno.cxx315
-rw-r--r--sc/source/ui/unoobj/textuno.cxx1139
-rw-r--r--sc/source/ui/unoobj/tokenuno.cxx475
-rw-r--r--sc/source/ui/unoobj/unodoc.cxx69
-rw-r--r--sc/source/ui/unoobj/unoreflist.cxx75
-rw-r--r--sc/source/ui/unoobj/viewuno.cxx2390
-rw-r--r--sc/source/ui/unoobj/warnpassword.cxx97
-rw-r--r--sc/source/ui/vba/excelvbahelper.cxx557
-rw-r--r--sc/source/ui/vba/excelvbahelper.hxx113
-rw-r--r--sc/source/ui/vba/helperdecl.hxx55
-rw-r--r--sc/source/ui/vba/service.cxx102
-rw-r--r--sc/source/ui/vba/testvba/README37
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/ApplicationRunTest.xlsbin0 -> 25088 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/AutoFilter.xlsbin0 -> 54272 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcFont.xlsbin0 -> 73728 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/CalcZoom.xlsbin0 -> 62976 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncTests.xlsbin0 -> 71168 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/FinancialFuncs.xlsbin0 -> 47104 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscOperatorTests.xlsbin0 -> 66048 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/MiscRangeTests.xlsbin0 -> 126976 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/PageBreaks.xlsbin0 -> 63488 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-2.xlsbin0 -> 2209280 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges-3.xlsbin0 -> 54784 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/Ranges.xlsbin0 -> 2236416 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/Shapes.xlsbin0 -> 74240 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/StrConv-test.xlsbin0 -> 65024 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/Template.xlsbin0 -> 65024 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestAddress.xlsbin0 -> 84480 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest.xlsbin0 -> 67584 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestCalc_Rangetest2.xlsbin0 -> 71680 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestIntersection.xlsbin0 -> 81408 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/TestUnion.xlsbin0 -> 72192 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/VariantTest.xlsbin0 -> 68608 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/Window.xlsbin0 -> 87040 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/bytearraystring.xlsbin0 -> 58880 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/dateserial.xlsbin0 -> 57344 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/datevalue.xlsbin0 -> 61952 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/format.xlsbin0 -> 102400 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/AutoFilter.log20
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/MiscRangeTests.log45
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-2.log68
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges-3.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/Ranges.log280
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestAddress.log62
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest.log60
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/excel/TestCalc_Rangetest2.log64
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/format.log36
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/AutoFilter.log20
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcFont.log17
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/CalcZoom.log18
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/FinancialFuncTests.log31
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscOperatorTests.log30
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/MiscRangeTests.log45
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/PageBreaks.log10
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-2.log68
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges-3.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Ranges.log280
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Shapes.log77
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/StrConv-test.log9
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Template.log14
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestAddress.log67
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest.log60
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestCalc_Rangetest2.log65
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestIntersection.log26
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/TestUnion.log17
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/VariantTest.log47
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/Window.log46
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/bytearraystring.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/dateserial.log9
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/datevalue.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/format.log36
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/pagesetup.log77
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/partition.log11
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/range-4.log16
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/replace.log14
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/stringplusdouble.log62
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/unix/window2.log41
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/AutoFilter.log20
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/CalcFont.log17
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscOperatorTests.log29
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/MiscRangeTests.log45
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/PageBreaks.log10
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-2.log68
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges-3.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Ranges.log280
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Shapes.log77
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/StrConv-test.log9
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Template.log14
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestAddress.log67
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest.log60
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestCalc_Rangetest2.log65
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestIntersection.log26
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/TestUnion.log17
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/VariantTest.log47
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/Window.log46
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/bytearraystring.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/dateserial.log9
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/datevalue.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/format.log36
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/pagesetup.log87
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/partition.log11
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/range-4.log16
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/replace.log14
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/stringplusdouble.log62
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/logs/win/window2.log41
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/error.xlsbin0 -> 38400 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/imagecontrols.xlsbin0 -> 2415104 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/keyword.xlsbin0 -> 50688 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/objectmodule.xlsbin0 -> 62464 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/notwork/stringtodouble.odsbin0 -> 13260 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/partition.xlsbin0 -> 65536 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/range-4.xlsbin0 -> 2192384 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/replace.xlsbin0 -> 64512 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/stringplusdouble.xlsbin0 -> 75264 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments-ooo-build/window2.xlsbin0 -> 72192 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/ApplicationRunTest.xlsbin0 -> 25088 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/AutoFilter.xlsbin0 -> 54272 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/CalcFont.xlsbin0 -> 73728 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/FinancialFuncs.xlsbin0 -> 47104 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/MiscRangeTests.xlsbin0 -> 126976 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/PageBreaks.xlsbin0 -> 63488 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/Ranges-2.xlsbin0 -> 2209280 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/Ranges-3.xlsbin0 -> 54784 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/Ranges.xlsbin0 -> 2236416 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/Shapes.xlsbin0 -> 74240 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/StrConv-test.xlsbin0 -> 65024 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/Template.xlsbin0 -> 65024 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/TestAddress.xlsbin0 -> 84480 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest.xlsbin0 -> 67584 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/TestCalc_Rangetest2.xlsbin0 -> 71680 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/TestIntersection.xlsbin0 -> 81408 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/TestUnion.xlsbin0 -> 72192 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/Window.xlsbin0 -> 87040 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/bytearraystring.xlsbin0 -> 58880 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/dateserial.xlsbin0 -> 57344 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/datevalue.xlsbin0 -> 61952 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/format.xlsbin0 -> 102400 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/AutoFilter.log20
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/MiscRangeTests.log45
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges-2.log68
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges-3.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/Ranges.log280
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestAddress.log62
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest.log60
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/excel/TestCalc_Rangetest2.log64
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/AutoFilter.log20
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/CalcFont.log17
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/MiscRangeTests.log45
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/PageBreaks.log10
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges-2.log68
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges-3.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/Ranges.log280
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/Shapes.log77
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/StrConv-test.log9
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/Template.log14
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestAddress.log67
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest.log60
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestCalc_Rangetest2.log65
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestIntersection.log26
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/TestUnion.log17
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/Window.log46
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/bytearraystring.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/dateserial.log9
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/datevalue.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/format.log36
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/pagesetup.log77
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/partition.log11
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/range-4.log16
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/replace.log14
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/stringplusdouble.log62
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/unix/window2.log41
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/AutoFilter.log20
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/MiscRangeTests.log45
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges-2.log68
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges-3.log8
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/Ranges.log280
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/Shapes.log77
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/TestAddress.log62
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest.log60
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/TestCalc_Rangetest2.log65
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/pagesetup.log87
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/logs/win/replace.log14
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/pagesetup.xlsbin0 -> 72704 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/partition.xlsbin0 -> 65536 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/range-4.xlsbin0 -> 2192384 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/replace.xlsbin0 -> 64512 bytes
-rw-r--r--sc/source/ui/vba/testvba/TestDocuments/stringplusdouble.xlsbin0 -> 75264 bytes
-rwxr-xr-xsc/source/ui/vba/testvba/TestDocuments/window2.xlsbin0 -> 72192 bytes
-rw-r--r--sc/source/ui/vba/testvba/launchTest.pl45
-rwxr-xr-xsc/source/ui/vba/testvba/runTests.pl121
-rw-r--r--sc/source/ui/vba/testvba/testResult.pl171
-rwxr-xr-xsc/source/ui/vba/testvba/testResults.pl163
-rwxr-xr-xsc/source/ui/vba/testvba/testclientbin0 -> 50595 bytes
-rw-r--r--sc/source/ui/vba/testvba/testvba.cxx304
-rwxr-xr-xsc/source/ui/vba/testvba/timestampsClean.pl73
-rw-r--r--sc/source/ui/vba/vbaapplication.cxx1836
-rw-r--r--sc/source/ui/vba/vbaapplication.hxx149
-rw-r--r--sc/source/ui/vba/vbaassistant.cxx135
-rw-r--r--sc/source/ui/vba/vbaassistant.hxx73
-rw-r--r--sc/source/ui/vba/vbaaxes.cxx205
-rw-r--r--sc/source/ui/vba/vbaaxes.hxx54
-rw-r--r--sc/source/ui/vba/vbaaxis.cxx669
-rw-r--r--sc/source/ui/vba/vbaaxis.hxx101
-rw-r--r--sc/source/ui/vba/vbaaxistitle.cxx60
-rw-r--r--sc/source/ui/vba/vbaaxistitle.hxx47
-rw-r--r--sc/source/ui/vba/vbaborders.cxx577
-rw-r--r--sc/source/ui/vba/vbaborders.hxx78
-rw-r--r--sc/source/ui/vba/vbacharacters.cxx138
-rw-r--r--sc/source/ui/vba/vbacharacters.hxx77
-rw-r--r--sc/source/ui/vba/vbachart.cxx1129
-rw-r--r--sc/source/ui/vba/vbachart.hxx107
-rw-r--r--sc/source/ui/vba/vbachartobject.cxx159
-rw-r--r--sc/source/ui/vba/vbachartobject.hxx71
-rw-r--r--sc/source/ui/vba/vbachartobjects.cxx196
-rw-r--r--sc/source/ui/vba/vbachartobjects.hxx78
-rw-r--r--sc/source/ui/vba/vbacharttitle.cxx60
-rw-r--r--sc/source/ui/vba/vbacharttitle.hxx47
-rw-r--r--sc/source/ui/vba/vbacomment.cxx252
-rw-r--r--sc/source/ui/vba/vbacomment.hxx83
-rw-r--r--sc/source/ui/vba/vbacomments.cxx119
-rw-r--r--sc/source/ui/vba/vbacomments.hxx67
-rw-r--r--sc/source/ui/vba/vbacommentshape.cxx49
-rw-r--r--sc/source/ui/vba/vbacommentshape.hxx49
-rw-r--r--sc/source/ui/vba/vbacondition.cxx177
-rw-r--r--sc/source/ui/vba/vbacondition.hxx57
-rw-r--r--sc/source/ui/vba/vbadialog.cxx111
-rw-r--r--sc/source/ui/vba/vbadialog.hxx55
-rw-r--r--sc/source/ui/vba/vbadialogs.cxx77
-rw-r--r--sc/source/ui/vba/vbadialogs.hxx59
-rw-r--r--sc/source/ui/vba/vbaeventshelper.cxx791
-rw-r--r--sc/source/ui/vba/vbaeventshelper.hxx84
-rw-r--r--sc/source/ui/vba/vbafiledialog.cxx186
-rw-r--r--sc/source/ui/vba/vbafiledialog.hxx63
-rw-r--r--sc/source/ui/vba/vbafiledialogselecteditems.cxx157
-rw-r--r--sc/source/ui/vba/vbafiledialogselecteditems.hxx90
-rw-r--r--sc/source/ui/vba/vbafilesearch.cxx245
-rw-r--r--sc/source/ui/vba/vbafilesearch.hxx80
-rw-r--r--sc/source/ui/vba/vbafont.cxx504
-rw-r--r--sc/source/ui/vba/vbafont.hxx92
-rw-r--r--sc/source/ui/vba/vbaformat.cxx845
-rw-r--r--sc/source/ui/vba/vbaformat.hxx111
-rw-r--r--sc/source/ui/vba/vbaformatcondition.cxx179
-rw-r--r--sc/source/ui/vba/vbaformatcondition.hxx73
-rw-r--r--sc/source/ui/vba/vbaformatconditions.cxx291
-rw-r--r--sc/source/ui/vba/vbaformatconditions.hxx67
-rw-r--r--sc/source/ui/vba/vbafoundfiles.cxx146
-rw-r--r--sc/source/ui/vba/vbafoundfiles.hxx91
-rw-r--r--sc/source/ui/vba/vbaglobals.cxx313
-rw-r--r--sc/source/ui/vba/vbaglobals.hxx99
-rw-r--r--sc/source/ui/vba/vbahelper.cxx761
-rw-r--r--sc/source/ui/vba/vbahyperlink.cxx249
-rw-r--r--sc/source/ui/vba/vbahyperlink.hxx90
-rw-r--r--sc/source/ui/vba/vbahyperlinks.cxx296
-rw-r--r--sc/source/ui/vba/vbahyperlinks.hxx153
-rw-r--r--sc/source/ui/vba/vbainterior.cxx416
-rw-r--r--sc/source/ui/vba/vbainterior.hxx90
-rw-r--r--sc/source/ui/vba/vbamenu.cxx87
-rw-r--r--sc/source/ui/vba/vbamenu.hxx57
-rw-r--r--sc/source/ui/vba/vbamenubar.cxx69
-rw-r--r--sc/source/ui/vba/vbamenubar.hxx53
-rw-r--r--sc/source/ui/vba/vbamenubars.cxx140
-rw-r--r--sc/source/ui/vba/vbamenubars.hxx64
-rw-r--r--sc/source/ui/vba/vbamenuitem.cxx85
-rw-r--r--sc/source/ui/vba/vbamenuitem.hxx58
-rw-r--r--sc/source/ui/vba/vbamenuitems.cxx153
-rw-r--r--sc/source/ui/vba/vbamenuitems.hxx63
-rw-r--r--sc/source/ui/vba/vbamenus.cxx139
-rw-r--r--sc/source/ui/vba/vbamenus.hxx63
-rw-r--r--sc/source/ui/vba/vbaname.cxx232
-rw-r--r--sc/source/ui/vba/vbaname.hxx90
-rw-r--r--sc/source/ui/vba/vbanames.cxx262
-rw-r--r--sc/source/ui/vba/vbanames.hxx84
-rw-r--r--sc/source/ui/vba/vbaoleobject.cxx155
-rw-r--r--sc/source/ui/vba/vbaoleobject.hxx69
-rw-r--r--sc/source/ui/vba/vbaoleobjects.cxx188
-rw-r--r--sc/source/ui/vba/vbaoleobjects.hxx59
-rw-r--r--sc/source/ui/vba/vbaoutline.cxx68
-rw-r--r--sc/source/ui/vba/vbaoutline.hxx55
-rw-r--r--sc/source/ui/vba/vbapagebreak.cxx174
-rw-r--r--sc/source/ui/vba/vbapagebreak.hxx106
-rw-r--r--sc/source/ui/vba/vbapagebreaks.cxx321
-rw-r--r--sc/source/ui/vba/vbapagebreaks.hxx100
-rw-r--r--sc/source/ui/vba/vbapagesetup.cxx732
-rw-r--r--sc/source/ui/vba/vbapagesetup.hxx95
-rw-r--r--sc/source/ui/vba/vbapalette.cxx116
-rw-r--r--sc/source/ui/vba/vbapalette.hxx56
-rw-r--r--sc/source/ui/vba/vbapane.cxx209
-rw-r--r--sc/source/ui/vba/vbapane.hxx70
-rw-r--r--sc/source/ui/vba/vbapivotcache.cxx73
-rw-r--r--sc/source/ui/vba/vbapivotcache.hxx56
-rw-r--r--sc/source/ui/vba/vbapivottable.cxx66
-rw-r--r--sc/source/ui/vba/vbapivottable.hxx52
-rw-r--r--sc/source/ui/vba/vbapivottables.cxx97
-rw-r--r--sc/source/ui/vba/vbapivottables.hxx68
-rw-r--r--sc/source/ui/vba/vbapropvalue.cxx48
-rw-r--r--sc/source/ui/vba/vbapropvalue.hxx60
-rw-r--r--sc/source/ui/vba/vbaquerytable.cxx90
-rw-r--r--sc/source/ui/vba/vbaquerytable.hxx62
-rw-r--r--sc/source/ui/vba/vbarange.cxx6289
-rw-r--r--sc/source/ui/vba/vbarange.hxx324
-rw-r--r--sc/source/ui/vba/vbasheetobject.cxx551
-rw-r--r--sc/source/ui/vba/vbasheetobject.hxx223
-rw-r--r--sc/source/ui/vba/vbasheetobjects.cxx537
-rw-r--r--sc/source/ui/vba/vbasheetobjects.hxx116
-rw-r--r--sc/source/ui/vba/vbastyle.cxx189
-rw-r--r--sc/source/ui/vba/vbastyle.hxx69
-rw-r--r--sc/source/ui/vba/vbastyles.cxx185
-rw-r--r--sc/source/ui/vba/vbastyles.hxx60
-rw-r--r--sc/source/ui/vba/vbatextboxshape.cxx69
-rw-r--r--sc/source/ui/vba/vbatextboxshape.hxx53
-rw-r--r--sc/source/ui/vba/vbatextframe.cxx81
-rw-r--r--sc/source/ui/vba/vbatextframe.hxx52
-rw-r--r--sc/source/ui/vba/vbatitle.hxx166
-rw-r--r--sc/source/ui/vba/vbavalidation.cxx346
-rw-r--r--sc/source/ui/vba/vbavalidation.hxx74
-rw-r--r--sc/source/ui/vba/vbawindow.cxx848
-rw-r--r--sc/source/ui/vba/vbawindow.hxx126
-rw-r--r--sc/source/ui/vba/vbawindows.cxx257
-rw-r--r--sc/source/ui/vba/vbawindows.hxx66
-rw-r--r--sc/source/ui/vba/vbaworkbook.cxx460
-rw-r--r--sc/source/ui/vba/vbaworkbook.hxx94
-rw-r--r--sc/source/ui/vba/vbaworkbooks.cxx332
-rw-r--r--sc/source/ui/vba/vbaworkbooks.hxx71
-rw-r--r--sc/source/ui/vba/vbaworksheet.cxx1191
-rw-r--r--sc/source/ui/vba/vbaworksheet.hxx181
-rw-r--r--sc/source/ui/vba/vbaworksheets.cxx540
-rw-r--r--sc/source/ui/vba/vbaworksheets.hxx87
-rw-r--r--sc/source/ui/vba/vbawsfunction.cxx322
-rw-r--r--sc/source/ui/vba/vbawsfunction.hxx59
-rw-r--r--sc/source/ui/view/auditsh.cxx157
-rw-r--r--sc/source/ui/view/cellmergeoption.cxx90
-rw-r--r--sc/source/ui/view/cellsh.cxx985
-rw-r--r--sc/source/ui/view/cellsh1.cxx2485
-rw-r--r--sc/source/ui/view/cellsh2.cxx1192
-rw-r--r--sc/source/ui/view/cellsh3.cxx923
-rw-r--r--sc/source/ui/view/cellsh4.cxx456
-rw-r--r--sc/source/ui/view/colrowba.cxx416
-rw-r--r--sc/source/ui/view/dbfunc.cxx538
-rw-r--r--sc/source/ui/view/dbfunc2.cxx79
-rw-r--r--sc/source/ui/view/dbfunc3.cxx2334
-rw-r--r--sc/source/ui/view/dbfunc4.cxx103
-rw-r--r--sc/source/ui/view/drawattr.cxx84
-rw-r--r--sc/source/ui/view/drawutil.cxx118
-rw-r--r--sc/source/ui/view/drawvie2.cxx64
-rw-r--r--sc/source/ui/view/drawvie3.cxx214
-rw-r--r--sc/source/ui/view/drawvie4.cxx357
-rw-r--r--sc/source/ui/view/drawview.cxx753
-rw-r--r--sc/source/ui/view/editsh.cxx1203
-rw-r--r--sc/source/ui/view/formatsh.cxx2242
-rw-r--r--sc/source/ui/view/galwrap.cxx81
-rw-r--r--sc/source/ui/view/gridmerg.cxx176
-rw-r--r--sc/source/ui/view/gridwin.cxx5742
-rw-r--r--sc/source/ui/view/gridwin2.cxx1066
-rw-r--r--sc/source/ui/view/gridwin3.cxx400
-rw-r--r--sc/source/ui/view/gridwin4.cxx1749
-rw-r--r--sc/source/ui/view/gridwin5.cxx440
-rw-r--r--sc/source/ui/view/hdrcont.cxx1027
-rw-r--r--sc/source/ui/view/hintwin.cxx111
-rw-r--r--sc/source/ui/view/imapwrap.cxx78
-rw-r--r--sc/source/ui/view/invmerge.cxx194
-rw-r--r--sc/source/ui/view/notemark.cxx202
-rw-r--r--sc/source/ui/view/olinewin.cxx1045
-rw-r--r--sc/source/ui/view/olkact.cxx217
-rw-r--r--sc/source/ui/view/output.cxx2373
-rw-r--r--sc/source/ui/view/output2.cxx4766
-rw-r--r--sc/source/ui/view/output3.cxx274
-rw-r--r--sc/source/ui/view/overlayobject.cxx104
-rw-r--r--sc/source/ui/view/pfuncache.cxx200
-rw-r--r--sc/source/ui/view/pgbrksh.cxx87
-rw-r--r--sc/source/ui/view/pivotsh.cxx202
-rw-r--r--sc/source/ui/view/preview.cxx1612
-rw-r--r--sc/source/ui/view/prevloc.cxx751
-rw-r--r--sc/source/ui/view/prevwsh.cxx1136
-rw-r--r--sc/source/ui/view/prevwsh2.cxx222
-rw-r--r--sc/source/ui/view/printfun.cxx3176
-rw-r--r--sc/source/ui/view/reffact.cxx402
-rw-r--r--sc/source/ui/view/scextopt.cxx227
-rw-r--r--sc/source/ui/view/select.cxx965
-rw-r--r--sc/source/ui/view/selectionstate.cxx91
-rw-r--r--sc/source/ui/view/spelldialog.cxx281
-rw-r--r--sc/source/ui/view/spelleng.cxx460
-rw-r--r--sc/source/ui/view/tabcont.cxx647
-rw-r--r--sc/source/ui/view/tabpopsh.cxx75
-rw-r--r--sc/source/ui/view/tabsplit.cxx107
-rw-r--r--sc/source/ui/view/tabview.cxx2447
-rw-r--r--sc/source/ui/view/tabview2.cxx1470
-rw-r--r--sc/source/ui/view/tabview3.cxx2540
-rw-r--r--sc/source/ui/view/tabview4.cxx565
-rw-r--r--sc/source/ui/view/tabview5.cxx676
-rw-r--r--sc/source/ui/view/tabvwsh.cxx112
-rw-r--r--sc/source/ui/view/tabvwsh2.cxx482
-rw-r--r--sc/source/ui/view/tabvwsh3.cxx1160
-rw-r--r--sc/source/ui/view/tabvwsh4.cxx1891
-rw-r--r--sc/source/ui/view/tabvwsh5.cxx428
-rw-r--r--sc/source/ui/view/tabvwsh8.cxx105
-rw-r--r--sc/source/ui/view/tabvwsh9.cxx282
-rw-r--r--sc/source/ui/view/tabvwsha.cxx805
-rw-r--r--sc/source/ui/view/tabvwshb.cxx577
-rw-r--r--sc/source/ui/view/tabvwshc.cxx344
-rw-r--r--sc/source/ui/view/tabvwshd.cxx102
-rw-r--r--sc/source/ui/view/tabvwshe.cxx345
-rw-r--r--sc/source/ui/view/tabvwshf.cxx978
-rw-r--r--sc/source/ui/view/tabvwshg.cxx137
-rw-r--r--sc/source/ui/view/tabvwshh.cxx295
-rw-r--r--sc/source/ui/view/viewdata.cxx3096
-rw-r--r--sc/source/ui/view/viewfun2.cxx3093
-rw-r--r--sc/source/ui/view/viewfun3.cxx1955
-rw-r--r--sc/source/ui/view/viewfun4.cxx827
-rw-r--r--sc/source/ui/view/viewfun5.cxx737
-rw-r--r--sc/source/ui/view/viewfun6.cxx375
-rw-r--r--sc/source/ui/view/viewfun7.cxx491
-rw-r--r--sc/source/ui/view/viewfunc.cxx3046
-rw-r--r--sc/source/ui/view/viewutil.cxx473
-rw-r--r--sc/source/ui/view/waitoff.cxx72
992 files changed, 348895 insertions, 0 deletions
diff --git a/sc/source/ui/Accessibility/AccessibilityHints.cxx b/sc/source/ui/Accessibility/AccessibilityHints.cxx
new file mode 100644
index 000000000000..d0b9d3192da6
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibilityHints.cxx
@@ -0,0 +1,115 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+
+#include "AccessibilityHints.hxx"
+
+using namespace ::com::sun::star;
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1(ScAccWinFocusLostHint, SfxHint);
+
+// -----------------------------------------------------------------------
+// ScAccWinFocusLostHint - the current window lost its focus (to another application, view or document)
+// -----------------------------------------------------------------------
+
+ScAccWinFocusLostHint::ScAccWinFocusLostHint(
+ const uno::Reference< uno::XInterface >& xOld )
+ :
+ xOldAccessible(xOld)
+{
+}
+
+ScAccWinFocusLostHint::~ScAccWinFocusLostHint()
+{
+}
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1(ScAccWinFocusGotHint, SfxHint);
+
+// -----------------------------------------------------------------------
+// ScAccWinFocusGotHint - the window got the focus (from another application, view or document)
+// -----------------------------------------------------------------------
+
+ScAccWinFocusGotHint::ScAccWinFocusGotHint(
+ const uno::Reference< uno::XInterface >& xNew )
+ :
+ xNewAccessible(xNew)
+{
+}
+
+ScAccWinFocusGotHint::~ScAccWinFocusGotHint()
+{
+}
+// -----------------------------------------------------------------------
+
+TYPEINIT1(ScAccGridWinFocusLostHint, SfxHint);
+
+// -----------------------------------------------------------------------
+// ScAccGridWinFocusLostHint - the current grid window lost its focus (to another application, view or document)
+// -----------------------------------------------------------------------
+
+ScAccGridWinFocusLostHint::ScAccGridWinFocusLostHint(ScSplitPos eOld,
+ const uno::Reference< uno::XInterface >& xOld )
+ :
+ ScAccWinFocusLostHint(xOld),
+ eOldGridWin(eOld)
+{
+}
+
+ScAccGridWinFocusLostHint::~ScAccGridWinFocusLostHint()
+{
+}
+
+// -----------------------------------------------------------------------
+
+TYPEINIT1(ScAccGridWinFocusGotHint, SfxHint);
+
+// -----------------------------------------------------------------------
+// ScAccGridWinFocusGotHint - the grid window got the focus (from another application, view or document)
+// -----------------------------------------------------------------------
+
+ScAccGridWinFocusGotHint::ScAccGridWinFocusGotHint(ScSplitPos eNew,
+ const uno::Reference< uno::XInterface >& xNew )
+ :
+ ScAccWinFocusGotHint(xNew),
+ eNewGridWin(eNew)
+{
+}
+
+ScAccGridWinFocusGotHint::~ScAccGridWinFocusGotHint()
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx
new file mode 100644
index 000000000000..e3ee6d51b165
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -0,0 +1,456 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+#include "AccessibleCell.hxx"
+#include "scitems.hxx"
+#include <editeng/eeitem.hxx>
+
+
+#include "AccessibleText.hxx"
+#include "AccessibleDocument.hxx"
+#include "tabvwsh.hxx"
+#include "document.hxx"
+#include "attrib.hxx"
+#include "miscuno.hxx"
+#include "editsrc.hxx"
+#include "dociter.hxx"
+#include "cell.hxx"
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <editeng/brshitem.hxx>
+#include <comphelper/sequence.hxx>
+#include <float.h>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+ScAccessibleCell::ScAccessibleCell(
+ const uno::Reference<XAccessible>& rxParent,
+ ScTabViewShell* pViewShell,
+ ScAddress& rCellAddress,
+ sal_Int32 nIndex,
+ ScSplitPos eSplitPos,
+ ScAccessibleDocument* pAccDoc)
+ :
+ ScAccessibleCellBase(rxParent, GetDocument(pViewShell), rCellAddress, nIndex),
+ ::accessibility::AccessibleStaticTextBase(CreateEditSource(pViewShell, rCellAddress, eSplitPos)),
+ mpViewShell(pViewShell),
+ mpAccDoc(pAccDoc),
+ meSplitPos(eSplitPos)
+{
+ if (pViewShell)
+ pViewShell->AddAccessibilityObject(*this);
+}
+
+ScAccessibleCell::~ScAccessibleCell()
+{
+ if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ // call dispose to inform object wich have a weak reference to this object
+ dispose();
+ }
+}
+
+void ScAccessibleCell::Init()
+{
+ ScAccessibleCellBase::Init();
+
+ SetEventSource(this);
+}
+
+void SAL_CALL ScAccessibleCell::disposing()
+{
+ SolarMutexGuard aGuard;
+ // dispose in AccessibleStaticTextBase
+ Dispose();
+
+ if (mpViewShell)
+ {
+ mpViewShell->RemoveAccessibilityObject(*this);
+ mpViewShell = NULL;
+ }
+ mpAccDoc = NULL;
+
+ ScAccessibleCellBase::disposing();
+}
+
+ //===== XInterface =====================================================
+
+IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
+
+ //===== XTypeProvider ===================================================
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
+
+ //===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleCell::getAccessibleAtPoint(
+ const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ return AccessibleStaticTextBase::getAccessibleAtPoint(rPoint);
+}
+
+void SAL_CALL ScAccessibleCell::grabFocus( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (getAccessibleParent().is() && mpViewShell)
+ {
+ uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
+ if (xAccessibleComponent.is())
+ {
+ xAccessibleComponent->grabFocus();
+ mpViewShell->SetCursor(maCellAddress.Col(), maCellAddress.Row());
+ }
+ }
+}
+
+Rectangle ScAccessibleCell::GetBoundingBoxOnScreen(void) const
+ throw (uno::RuntimeException)
+{
+ Rectangle aCellRect(GetBoundingBox());
+ if (mpViewShell)
+ {
+ Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
+ if (pWindow)
+ {
+ Rectangle aRect = pWindow->GetWindowExtentsRelative(NULL);
+ aCellRect.setX(aCellRect.getX() + aRect.getX());
+ aCellRect.setY(aCellRect.getY() + aRect.getY());
+ }
+ }
+ return aCellRect;
+}
+
+Rectangle ScAccessibleCell::GetBoundingBox(void) const
+ throw (uno::RuntimeException)
+{
+ Rectangle aCellRect;
+ if (mpViewShell)
+ {
+ long nSizeX, nSizeY;
+ mpViewShell->GetViewData()->GetMergeSizePixel(
+ maCellAddress.Col(), maCellAddress.Row(), nSizeX, nSizeY);
+ aCellRect.SetSize(Size(nSizeX, nSizeY));
+ aCellRect.SetPos(mpViewShell->GetViewData()->GetScrPos(maCellAddress.Col(), maCellAddress.Row(), meSplitPos, sal_True));
+
+ Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
+ if (pWindow)
+ {
+ Rectangle aRect(pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow()));
+ aRect.Move(-aRect.Left(), -aRect.Top());
+ aCellRect = aRect.Intersection(aCellRect);
+ }
+
+ /* #i19430# Gnopernicus reads text partly if it sticks out of the cell
+ boundaries. This leads to wrong results in cases where the cell
+ text is rotated, because rotation is not taken into account when
+ calculating the visible part of the text. In these cases we will
+ simply expand the cell size to the width of the unrotated text. */
+ if (mpDoc)
+ {
+ const SfxInt32Item* pItem = static_cast< const SfxInt32Item* >(
+ mpDoc->GetAttr( maCellAddress.Col(), maCellAddress.Row(), maCellAddress.Tab(), ATTR_ROTATE_VALUE ) );
+ if( pItem && (pItem->GetValue() != 0) )
+ {
+ Rectangle aParaRect = GetParagraphBoundingBox();
+ if( !aParaRect.IsEmpty() && (aCellRect.GetWidth() < aParaRect.GetWidth()) )
+ aCellRect.SetSize( Size( aParaRect.GetWidth(), aCellRect.GetHeight() ) );
+ }
+ }
+ }
+ if (aCellRect.IsEmpty())
+ aCellRect.SetPos(Point(-1, -1));
+ return aCellRect;
+}
+
+ //===== XAccessibleContext ==============================================
+
+sal_Int32 SAL_CALL
+ ScAccessibleCell::getAccessibleChildCount(void)
+ throw (uno::RuntimeException)
+{
+ return AccessibleStaticTextBase::getAccessibleChildCount();
+}
+
+uno::Reference< XAccessible > SAL_CALL
+ ScAccessibleCell::getAccessibleChild(sal_Int32 nIndex)
+ throw (uno::RuntimeException,
+ lang::IndexOutOfBoundsException)
+{
+ return AccessibleStaticTextBase::getAccessibleChild(nIndex);
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ ScAccessibleCell::getAccessibleStateSet(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+ if (IsDefunc(xParentStates))
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ if (IsEditable(xParentStates))
+ {
+ pStateSet->AddState(AccessibleStateType::EDITABLE);
+ pStateSet->AddState(AccessibleStateType::RESIZABLE);
+ }
+ 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;
+}
+
+uno::Reference<XAccessibleRelationSet> SAL_CALL
+ ScAccessibleCell::getAccessibleRelationSet(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ utl::AccessibleRelationSetHelper* pRelationSet = NULL;
+ if (mpAccDoc)
+ pRelationSet = mpAccDoc->GetRelationSet(&maCellAddress);
+ if (!pRelationSet)
+ pRelationSet = new utl::AccessibleRelationSetHelper();
+ FillDependends(pRelationSet);
+ FillPrecedents(pRelationSet);
+ return pRelationSet;
+}
+
+ //===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL ScAccessibleCell::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleCell"));
+}
+
+uno::Sequence< ::rtl::OUString> SAL_CALL
+ ScAccessibleCell::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSequence = ScAccessibleContextBase::getSupportedServiceNames();
+ sal_Int32 nOldSize(aSequence.getLength());
+ aSequence.realloc(nOldSize + 1);
+ ::rtl::OUString* pNames = aSequence.getArray();
+
+ pNames[nOldSize] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.AccessibleCell"));
+
+ return aSequence;
+}
+
+ //==== internal =========================================================
+
+sal_Bool ScAccessibleCell::IsDefunc(
+ const uno::Reference<XAccessibleStateSet>& rxParentStates)
+{
+ return ScAccessibleContextBase::IsDefunc() || (mpDoc == NULL) || (mpViewShell == NULL) || !getAccessibleParent().is() ||
+ (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
+}
+
+sal_Bool ScAccessibleCell::IsEditable(
+ const uno::Reference<XAccessibleStateSet>& rxParentStates)
+{
+ sal_Bool bEditable(sal_True);
+ if (rxParentStates.is() && !rxParentStates->contains(AccessibleStateType::EDITABLE) &&
+ mpDoc)
+ {
+ // here I have to test whether the protection of the table should influence this cell.
+ const ScProtectionAttr* pItem = (const ScProtectionAttr*)mpDoc->GetAttr(
+ maCellAddress.Col(), maCellAddress.Row(),
+ maCellAddress.Tab(), ATTR_PROTECTION);
+ if (pItem)
+ bEditable = !pItem->GetProtection();
+ }
+ return bEditable;
+}
+
+sal_Bool ScAccessibleCell::IsOpaque(
+ const uno::Reference<XAccessibleStateSet>& /* rxParentStates */)
+{
+ // test whether there is a background color
+ sal_Bool bOpaque(sal_True);
+ if (mpDoc)
+ {
+ const SvxBrushItem* pItem = (const SvxBrushItem*)mpDoc->GetAttr(
+ maCellAddress.Col(), maCellAddress.Row(),
+ maCellAddress.Tab(), ATTR_BACKGROUND);
+ if (pItem)
+ bOpaque = pItem->GetColor() != COL_TRANSPARENT;
+ }
+ return bOpaque;
+}
+
+sal_Bool ScAccessibleCell::IsSelected()
+{
+ sal_Bool bResult(false);
+ if (mpViewShell && mpViewShell->GetViewData())
+ {
+ const ScMarkData& rMarkdata = mpViewShell->GetViewData()->GetMarkData();
+ bResult = rMarkdata.IsCellMarked(maCellAddress.Col(), maCellAddress.Row());
+ }
+ return bResult;
+}
+
+ScDocument* ScAccessibleCell::GetDocument(ScTabViewShell* pViewShell)
+{
+ ScDocument* pDoc = NULL;
+ if (pViewShell && pViewShell->GetViewData())
+ pDoc = pViewShell->GetViewData()->GetDocument();
+ return pDoc;
+}
+
+::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
+{
+ ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
+ ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
+ ::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
+
+ return pEditSource;
+}
+
+void ScAccessibleCell::FillDependends(utl::AccessibleRelationSetHelper* pRelationSet)
+{
+ if (mpDoc)
+ {
+ ScCellIterator aCellIter( mpDoc, 0,0, maCellAddress.Tab(), MAXCOL,MAXROW, maCellAddress.Tab() );
+ ScBaseCell* pCell = aCellIter.GetFirst();
+ while (pCell)
+ {
+ if (pCell->GetCellType() == CELLTYPE_FORMULA)
+ {
+ sal_Bool bFound(false);
+ ScDetectiveRefIter aIter( (ScFormulaCell*) pCell );
+ ScRange aRef;
+ while ( !bFound && aIter.GetNextRef( aRef ) )
+ {
+ if (aRef.In(maCellAddress))
+ bFound = sal_True;
+ }
+ if (bFound)
+ AddRelation(ScAddress(aCellIter.GetCol(), aCellIter.GetRow(), aCellIter.GetTab()), AccessibleRelationType::CONTROLLER_FOR, pRelationSet);
+ }
+ pCell = aCellIter.GetNext();
+ }
+ }
+}
+
+void ScAccessibleCell::FillPrecedents(utl::AccessibleRelationSetHelper* pRelationSet)
+{
+ if (mpDoc)
+ {
+ ScBaseCell* pBaseCell = mpDoc->GetCell(maCellAddress);
+ if (pBaseCell && (pBaseCell->GetCellType() == CELLTYPE_FORMULA))
+ {
+ ScFormulaCell* pFCell = (ScFormulaCell*) pBaseCell;
+
+ ScDetectiveRefIter aIter( pFCell );
+ ScRange aRef;
+ while ( aIter.GetNextRef( aRef ) )
+ {
+ AddRelation( aRef, AccessibleRelationType::CONTROLLED_BY, pRelationSet);
+ }
+ }
+ }
+}
+
+void ScAccessibleCell::AddRelation(const ScAddress& rCell,
+ const sal_uInt16 aRelationType,
+ utl::AccessibleRelationSetHelper* pRelationSet)
+{
+ AddRelation(ScRange(rCell, rCell), aRelationType, pRelationSet);
+}
+
+void ScAccessibleCell::AddRelation(const ScRange& rRange,
+ const sal_uInt16 aRelationType,
+ utl::AccessibleRelationSetHelper* pRelationSet)
+{
+ uno::Reference < XAccessibleTable > xTable ( getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY );
+ if (xTable.is())
+ {
+ sal_uInt32 nCount(static_cast<sal_uInt32>(rRange.aEnd.Col() -
+ rRange.aStart.Col() + 1) * (rRange.aEnd.Row() -
+ rRange.aStart.Row() + 1));
+ uno::Sequence < uno::Reference < uno::XInterface > > aTargetSet( nCount );
+ uno::Reference < uno::XInterface >* pTargetSet = aTargetSet.getArray();
+ if (pTargetSet)
+ {
+ sal_uInt32 nPos(0);
+ for (sal_uInt32 nRow = rRange.aStart.Row(); nRow <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Row()); ++nRow)
+ {
+ for (sal_uInt32 nCol = rRange.aStart.Col(); nCol <= sal::static_int_cast<sal_uInt32>(rRange.aEnd.Col()); ++nCol)
+ {
+ pTargetSet[nPos] = xTable->getAccessibleCellAt(nRow, nCol);
+ ++nPos;
+ }
+ }
+ DBG_ASSERT(nCount == nPos, "something wents wrong");
+ }
+ AccessibleRelation aRelation;
+ aRelation.RelationType = aRelationType;
+ aRelation.TargetSet = aTargetSet;
+ pRelationSet->AddRelation(aRelation);
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
new file mode 100644
index 000000000000..1428756f1ff4
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -0,0 +1,342 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+#include "AccessibleCellBase.hxx"
+#include "attrib.hxx"
+#include "scitems.hxx"
+#include "miscuno.hxx"
+#include "document.hxx"
+#include "docfunc.hxx"
+#include "cell.hxx"
+#include "scresid.hxx"
+#include "sc.hrc"
+#include "unonames.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 <tools/debug.hxx>
+#include <editeng/brshitem.hxx>
+#include <rtl/uuid.h>
+#include <comphelper/sequence.hxx>
+#include <sfx2/objsh.hxx>
+#include <vcl/svapp.hxx>
+
+#include <float.h>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+ScAccessibleCellBase::ScAccessibleCellBase(
+ const uno::Reference<XAccessible>& rxParent,
+ ScDocument* pDoc,
+ const ScAddress& rCellAddress,
+ sal_Int32 nIndex)
+ :
+ ScAccessibleContextBase(rxParent, AccessibleRole::TABLE_CELL),
+ maCellAddress(rCellAddress),
+ mpDoc(pDoc),
+ mnIndex(nIndex)
+{
+}
+
+ScAccessibleCellBase::~ScAccessibleCellBase()
+{
+}
+
+ //===== XAccessibleComponent ============================================
+
+sal_Bool SAL_CALL ScAccessibleCellBase::isVisible( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ // test whether the cell is hidden (column/row - hidden/filtered)
+ sal_Bool bVisible(sal_True);
+ if (mpDoc)
+ {
+ bool bColHidden = mpDoc->ColHidden(maCellAddress.Col(), maCellAddress.Tab());
+ bool bRowHidden = mpDoc->RowHidden(maCellAddress.Row(), maCellAddress.Tab());
+ bool bColFiltered = mpDoc->ColFiltered(maCellAddress.Col(), maCellAddress.Tab());
+ bool bRowFiltered = mpDoc->RowFiltered(maCellAddress.Row(), maCellAddress.Tab());
+
+ if (bColHidden || bColFiltered || bRowHidden || bRowFiltered)
+ bVisible = false;
+ }
+ return bVisible;
+}
+
+sal_Int32 SAL_CALL ScAccessibleCellBase::getForeground()
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nColor(0);
+ if (mpDoc)
+ {
+ SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+ if ( pObjSh )
+ {
+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+ if ( xSpreadDoc.is() )
+ {
+ uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+ uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+ if ( xIndex.is() )
+ {
+ uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+ uno::Reference<sheet::XSpreadsheet> xTable;
+ if (aTable>>=xTable)
+ {
+ uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+ if (xCell.is())
+ {
+ uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+ if (xCellProps.is())
+ {
+ uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CCOLOR)));
+ aAny >>= nColor;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return nColor;
+}
+
+sal_Int32 SAL_CALL ScAccessibleCellBase::getBackground()
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nColor(0);
+
+ if (mpDoc)
+ {
+ SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+ if ( pObjSh )
+ {
+ uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+ if ( xSpreadDoc.is() )
+ {
+ uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+ uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+ if ( xIndex.is() )
+ {
+ uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+ uno::Reference<sheet::XSpreadsheet> xTable;
+ if (aTable>>=xTable)
+ {
+ uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+ if (xCell.is())
+ {
+ uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+ if (xCellProps.is())
+ {
+ uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLBACK)));
+ aAny >>= nColor;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return nColor;
+}
+
+ //===== XInterface =====================================================
+
+uno::Any SAL_CALL ScAccessibleCellBase::queryInterface( uno::Type const & rType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aAny (ScAccessibleCellBaseImpl::queryInterface(rType));
+ return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
+}
+
+void SAL_CALL ScAccessibleCellBase::acquire()
+ throw ()
+{
+ ScAccessibleContextBase::acquire();
+}
+
+void SAL_CALL ScAccessibleCellBase::release()
+ throw ()
+{
+ ScAccessibleContextBase::release();
+}
+
+ //===== XAccessibleContext ==============================================
+
+sal_Int32
+ ScAccessibleCellBase::getAccessibleIndexInParent(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return mnIndex;
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleCellBase::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ rtl::OUString sDescription = String(ScResId(STR_ACC_CELL_DESCR));
+
+ return sDescription;
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleCellBase::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ String sName( ScResId(STR_ACC_CELL_NAME) );
+ String sAddress;
+ // Document not needed, because only the cell address, but not the tablename is needed
+ // always us OOO notation
+ maCellAddress.Format( sAddress, SCA_VALID, NULL );
+ sName.SearchAndReplaceAscii("%1", sAddress);
+ /* #i65103# ZoomText merges cell address and contents, e.g. if value 2 is
+ contained in cell A1, ZT reads "cell A twelve" instead of "cell A1 - 2".
+ Simple solution: Append a space character to the cell address. */
+ sName.Append( ' ' );
+ return rtl::OUString(sName);
+}
+
+ //===== XAccessibleValue ================================================
+
+uno::Any SAL_CALL
+ ScAccessibleCellBase::getCurrentValue( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ uno::Any aAny;
+ if (mpDoc)
+ aAny <<= mpDoc->GetValue(maCellAddress);
+
+ return aAny;
+}
+
+sal_Bool SAL_CALL
+ ScAccessibleCellBase::setCurrentValue( const uno::Any& aNumber )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ double fValue = 0;
+ sal_Bool bResult(false);
+ if((aNumber >>= fValue) && mpDoc && mpDoc->GetDocumentShell())
+ {
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ if (IsEditable(xParentStates))
+ {
+ ScDocShell* pDocShell = (ScDocShell*) mpDoc->GetDocumentShell();
+ ScDocFunc aFunc(*pDocShell);
+ bResult = aFunc.PutCell( maCellAddress, new ScValueCell(fValue), sal_True );
+ }
+ }
+ return bResult;
+}
+
+uno::Any SAL_CALL
+ ScAccessibleCellBase::getMaximumValue( )
+ throw (uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= DBL_MAX;
+
+ return aAny;
+}
+
+uno::Any SAL_CALL
+ ScAccessibleCellBase::getMinimumValue( )
+ throw (uno::RuntimeException)
+{
+ uno::Any aAny;
+ aAny <<= -DBL_MAX;
+
+ return aAny;
+}
+
+ //===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL ScAccessibleCellBase::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleCellBase"));
+}
+
+ //===== XTypeProvider ===================================================
+
+uno::Sequence< uno::Type > SAL_CALL ScAccessibleCellBase::getTypes()
+ throw (uno::RuntimeException)
+{
+ return comphelper::concatSequences(ScAccessibleCellBaseImpl::getTypes(), ScAccessibleContextBase::getTypes());
+}
+
+uno::Sequence<sal_Int8> SAL_CALL
+ ScAccessibleCellBase::getImplementationId(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+sal_Bool ScAccessibleCellBase::IsEditable(
+ const uno::Reference<XAccessibleStateSet>& rxParentStates)
+{
+ sal_Bool bEditable(false);
+ if (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::EDITABLE))
+ bEditable = sal_True;
+ return bEditable;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleContextBase.cxx b/sc/source/ui/Accessibility/AccessibleContextBase.cxx
new file mode 100644
index 000000000000..314fddb334c7
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleContextBase.cxx
@@ -0,0 +1,625 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+#include "AccessibleContextBase.hxx"
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <svl/smplhint.hxx>
+#include <comphelper/sequence.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/unohelp.hxx>
+#include <tools/color.hxx>
+#include <comphelper/accessibleeventnotifier.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+DBG_NAME(ScAccessibleContextBase)
+
+ScAccessibleContextBase::ScAccessibleContextBase(
+ const uno::Reference<XAccessible>& rxParent,
+ const sal_Int16 aRole)
+ :
+ ScAccessibleContextBaseWeakImpl(m_aMutex),
+ mxParent(rxParent),
+ mnClientId(0),
+ maRole(aRole)
+{
+ DBG_CTOR(ScAccessibleContextBase, NULL);
+}
+
+
+ScAccessibleContextBase::~ScAccessibleContextBase(void)
+{
+ DBG_DTOR(ScAccessibleContextBase, NULL);
+
+ if (!IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ // call dispose to inform object wich have a weak reference to this object
+ dispose();
+ }
+}
+
+void ScAccessibleContextBase::Init()
+{
+ // hold reference to make sure that the destructor is not called
+ uno::Reference< XAccessibleContext > xOwnContext(this);
+
+ if (mxParent.is())
+ {
+ uno::Reference< XAccessibleEventBroadcaster > xBroadcaster (mxParent->getAccessibleContext(), uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->addEventListener(this);
+ }
+ msName = createAccessibleName();
+ msDescription = createAccessibleDescription();
+}
+
+void SAL_CALL ScAccessibleContextBase::disposing()
+{
+ SolarMutexGuard aGuard;
+// CommitDefunc(); not necessary and should not be send, because it cost a lot of time
+
+ // hold reference to make sure that the destructor is not called
+ uno::Reference< XAccessibleContext > xOwnContext(this);
+
+ if ( mnClientId )
+ {
+ sal_Int32 nTemClientId(mnClientId);
+ mnClientId = 0;
+ comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( nTemClientId, *this );
+ }
+
+ if (mxParent.is())
+ {
+ uno::Reference< XAccessibleEventBroadcaster > xBroadcaster (mxParent->getAccessibleContext(), uno::UNO_QUERY);
+ if (xBroadcaster.is())
+ xBroadcaster->removeEventListener(this);
+ mxParent = NULL;
+ }
+
+ ScAccessibleContextBaseWeakImpl::disposing();
+}
+
+//===== XInterface =====================================================
+
+uno::Any SAL_CALL ScAccessibleContextBase::queryInterface( uno::Type const & rType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aAny (ScAccessibleContextBaseWeakImpl::queryInterface(rType));
+ return aAny.hasValue() ? aAny : ScAccessibleContextBaseImplEvent::queryInterface(rType);
+}
+
+void SAL_CALL ScAccessibleContextBase::acquire()
+ throw ()
+{
+ ScAccessibleContextBaseWeakImpl::acquire();
+}
+
+void SAL_CALL ScAccessibleContextBase::release()
+ throw ()
+{
+ ScAccessibleContextBaseWeakImpl::release();
+}
+
+//===== SfxListener =====================================================
+
+void ScAccessibleContextBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
+{
+ if (rHint.ISA( SfxSimpleHint ) )
+ {
+ const SfxSimpleHint& rRef = (const SfxSimpleHint&)rHint;
+ if (rRef.GetId() == SFX_HINT_DYING)
+ {
+ // it seems the Broadcaster is dying, since the view is dying
+ dispose();
+ }
+ }
+}
+
+//===== XAccessible =========================================================
+
+uno::Reference< XAccessibleContext> SAL_CALL
+ ScAccessibleContextBase::getAccessibleContext(void)
+ throw (uno::RuntimeException)
+{
+ return this;
+}
+
+//===== XAccessibleComponent ================================================
+
+sal_Bool SAL_CALL ScAccessibleContextBase::containsPoint(const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return Rectangle (Point(), GetBoundingBox().GetSize()).IsInside(VCLPoint(rPoint));
+}
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleContextBase::getAccessibleAtPoint(
+ const awt::Point& /* rPoint */ )
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented");
+ return uno::Reference<XAccessible>();
+}
+
+awt::Rectangle SAL_CALL ScAccessibleContextBase::getBounds( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return AWTRectangle(GetBoundingBox());
+}
+
+awt::Point SAL_CALL ScAccessibleContextBase::getLocation( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return AWTPoint(GetBoundingBox().TopLeft());
+}
+
+awt::Point SAL_CALL ScAccessibleContextBase::getLocationOnScreen( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return AWTPoint(GetBoundingBoxOnScreen().TopLeft());
+}
+
+awt::Size SAL_CALL ScAccessibleContextBase::getSize( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return AWTSize(GetBoundingBox().GetSize());
+}
+
+sal_Bool SAL_CALL ScAccessibleContextBase::isShowing( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Bool bShowing(false);
+ if (mxParent.is())
+ {
+ uno::Reference<XAccessibleComponent> xParentComponent (mxParent->getAccessibleContext(), uno::UNO_QUERY);
+ if (xParentComponent.is())
+ {
+ Rectangle aParentBounds(VCLRectangle(xParentComponent->getBounds()));
+ Rectangle aBounds(VCLRectangle(getBounds()));
+ bShowing = aBounds.IsOver(aParentBounds);
+ }
+ }
+ return bShowing;
+}
+
+sal_Bool SAL_CALL ScAccessibleContextBase::isVisible( )
+ throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL ScAccessibleContextBase::grabFocus( )
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented");
+}
+
+sal_Int32 SAL_CALL ScAccessibleContextBase::getForeground( )
+ throw (uno::RuntimeException)
+{
+ return COL_BLACK;
+}
+
+sal_Int32 SAL_CALL ScAccessibleContextBase::getBackground( )
+ throw (uno::RuntimeException)
+{
+ return COL_WHITE;
+}
+
+//===== XAccessibleContext ==================================================
+
+sal_Int32 SAL_CALL
+ ScAccessibleContextBase::getAccessibleChildCount(void)
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("should be implemented in the abrevated class");
+ return 0;
+}
+
+uno::Reference<XAccessible> SAL_CALL
+ ScAccessibleContextBase::getAccessibleChild(sal_Int32 /* nIndex */)
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ OSL_FAIL("should be implemented in the abrevated class");
+ return uno::Reference<XAccessible>();
+}
+
+uno::Reference<XAccessible> SAL_CALL
+ ScAccessibleContextBase::getAccessibleParent(void)
+ throw (uno::RuntimeException)
+{
+ return mxParent;
+}
+
+sal_Int32 SAL_CALL
+ ScAccessibleContextBase::getAccessibleIndexInParent(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ // Use a simple but slow solution for now. Optimize later.
+ // Return -1 to indicate that this object's parent does not know about the
+ // object.
+ sal_Int32 nIndex(-1);
+
+ // Iterate over all the parent's children and search for this object.
+ if (mxParent.is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext (
+ mxParent->getAccessibleContext());
+ if (xParentContext.is())
+ {
+ sal_Int32 nChildCount = xParentContext->getAccessibleChildCount();
+ for (sal_Int32 i=0; i<nChildCount; ++i)
+ {
+ uno::Reference<XAccessible> xChild (xParentContext->getAccessibleChild (i));
+ if (xChild.is())
+ {
+ if (xChild.get() == this)
+ nIndex = i;
+ }
+ }
+ }
+ }
+
+ return nIndex;
+}
+
+sal_Int16 SAL_CALL
+ ScAccessibleContextBase::getAccessibleRole(void)
+ throw (uno::RuntimeException)
+{
+ return maRole;
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleContextBase::getAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (!msDescription.getLength())
+ {
+ OUString sDescription(createAccessibleDescription());
+
+ if (msDescription != sDescription)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::DESCRIPTION_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.OldValue <<= msDescription;
+ aEvent.NewValue <<= sDescription;
+
+ msDescription = sDescription;
+
+ CommitChange(aEvent);
+ }
+ }
+ return msDescription;
+}
+
+OUString SAL_CALL
+ ScAccessibleContextBase::getAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (!msName.getLength())
+ {
+ OUString sName(createAccessibleName());
+ DBG_ASSERT(sName.getLength(), "We should give always a name.");
+
+ if (msName != sName)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.OldValue <<= msName;
+ aEvent.NewValue <<= sName;
+
+ msName = sName;
+
+ CommitChange(aEvent);
+ }
+ }
+ return msName;
+}
+
+uno::Reference<XAccessibleRelationSet> SAL_CALL
+ ScAccessibleContextBase::getAccessibleRelationSet(void)
+ throw (uno::RuntimeException)
+{
+ return new utl::AccessibleRelationSetHelper();
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ ScAccessibleContextBase::getAccessibleStateSet(void)
+ throw (uno::RuntimeException)
+{
+ return uno::Reference<XAccessibleStateSet>();
+}
+
+lang::Locale SAL_CALL
+ ScAccessibleContextBase::getLocale(void)
+ throw (IllegalAccessibleComponentStateException,
+ uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mxParent.is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext (
+ mxParent->getAccessibleContext());
+ if (xParentContext.is())
+ return xParentContext->getLocale ();
+ }
+
+ // No locale and no parent. Therefore throw exception to indicate this
+ // cluelessness.
+ throw IllegalAccessibleComponentStateException ();
+}
+
+ //===== XAccessibleEventBroadcaster =====================================
+
+void SAL_CALL
+ ScAccessibleContextBase::addEventListener(
+ const uno::Reference<XAccessibleEventListener>& xListener)
+ throw (uno::RuntimeException)
+{
+ if (xListener.is())
+ {
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (!IsDefunc())
+ {
+ if (!mnClientId)
+ mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+ comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+ }
+ }
+}
+
+void SAL_CALL
+ ScAccessibleContextBase::removeEventListener(
+ const uno::Reference<XAccessibleEventListener>& xListener)
+ throw (uno::RuntimeException)
+{
+ if (xListener.is())
+ {
+ SolarMutexGuard aGuard;
+ if (!IsDefunc() && mnClientId)
+ {
+ sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+ if ( !nListenerCount )
+ {
+ // no listeners anymore
+ // -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+ // and at least to us not firing any events anymore, in case somebody calls
+ // NotifyAccessibleEvent, again
+ comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+ mnClientId = 0;
+ }
+ }
+ }
+}
+
+ //===== XAccessibleEventListener ========================================
+
+void SAL_CALL ScAccessibleContextBase::disposing(
+ const lang::EventObject& rSource )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ if (rSource.Source == mxParent)
+ dispose();
+}
+
+void SAL_CALL ScAccessibleContextBase::notifyEvent(
+ const AccessibleEventObject& /* aEvent */ )
+ throw (uno::RuntimeException)
+{
+}
+
+//===== XServiceInfo ========================================================
+
+::rtl::OUString SAL_CALL
+ ScAccessibleContextBase::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleContextBase"));
+}
+
+sal_Bool SAL_CALL
+ ScAccessibleContextBase::supportsService(const OUString& sServiceName)
+ throw (uno::RuntimeException)
+{
+ // Iterate over all supported service names and return true if on of them
+ // matches the given name.
+ uno::Sequence< ::rtl::OUString> aSupportedServices (
+ getSupportedServiceNames ());
+ sal_Int32 nLength(aSupportedServices.getLength());
+ const OUString* pServiceNames = aSupportedServices.getConstArray();
+ for (int i=0; i<nLength; ++i, ++pServiceNames)
+ if (sServiceName == *pServiceNames)
+ return sal_True;
+ return false;
+}
+
+uno::Sequence< ::rtl::OUString> SAL_CALL
+ ScAccessibleContextBase::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence<OUString> aServiceNames(2);
+ OUString* pServiceNames = aServiceNames.getArray();
+ if (pServiceNames)
+ {
+ pServiceNames[0] = OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.Accessible"));
+ pServiceNames[1] = OUString(RTL_CONSTASCII_USTRINGPARAM ("com.sun.star.accessibility.AccessibleContext"));
+ }
+
+ return aServiceNames;
+}
+
+//===== XTypeProvider =======================================================
+
+uno::Sequence< uno::Type > SAL_CALL ScAccessibleContextBase::getTypes()
+ throw (uno::RuntimeException)
+{
+ return comphelper::concatSequences(ScAccessibleContextBaseWeakImpl::getTypes(), ScAccessibleContextBaseImplEvent::getTypes());
+}
+
+uno::Sequence<sal_Int8> SAL_CALL
+ ScAccessibleContextBase::getImplementationId(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+//===== internal ============================================================
+
+::rtl::OUString SAL_CALL
+ ScAccessibleContextBase::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("should be implemented in the abrevated class");
+ return rtl::OUString();
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleContextBase::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("should be implemented in the abrevated class");
+ return rtl::OUString();
+}
+
+void ScAccessibleContextBase::CommitChange(const AccessibleEventObject& rEvent) const
+{
+ if (mnClientId)
+ comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
+}
+
+void ScAccessibleContextBase::ChangeName()
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(const_cast<ScAccessibleContextBase*>(this));
+ aEvent.OldValue <<= msName;
+
+ msName = rtl::OUString(); // reset the name so it will be hold again
+ getAccessibleName(); // create the new name
+
+ aEvent.NewValue <<= msName;
+
+ CommitChange(aEvent);
+}
+
+void ScAccessibleContextBase::CommitFocusGained() const
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::STATE_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(const_cast<ScAccessibleContextBase*>(this));
+ aEvent.NewValue <<= AccessibleStateType::FOCUSED;
+
+ CommitChange(aEvent);
+
+ ::vcl::unohelper::NotifyAccessibleStateEventGlobally(aEvent);
+}
+
+void ScAccessibleContextBase::CommitFocusLost() const
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::STATE_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(const_cast<ScAccessibleContextBase*>(this));
+ aEvent.OldValue <<= AccessibleStateType::FOCUSED;
+
+ CommitChange(aEvent);
+
+ vcl::unohelper::NotifyAccessibleStateEventGlobally(aEvent);
+}
+
+Rectangle ScAccessibleContextBase::GetBoundingBoxOnScreen(void) const
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented");
+ return Rectangle();
+}
+
+Rectangle ScAccessibleContextBase::GetBoundingBox(void) const
+ throw (uno::RuntimeException)
+{
+ OSL_FAIL("not implemented");
+ return Rectangle();
+}
+
+void ScAccessibleContextBase::IsObjectValid() const
+ throw (lang::DisposedException)
+{
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
+ throw lang::DisposedException();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
new file mode 100644
index 000000000000..b85aca92fa41
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -0,0 +1,1669 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+// ============================================================================
+#include "AccessibleCsvControl.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/AccessibleTextType.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChangeType.hpp>
+#include <tools/debug.hxx>
+#include <rtl/uuid.h>
+#include <toolkit/helper/convert.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <comphelper/sequence.hxx>
+#include "scitems.hxx"
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/langitem.hxx>
+#include "csvcontrol.hxx"
+#include "csvruler.hxx"
+#include "csvgrid.hxx"
+#include "AccessibleText.hxx"
+#include "editsrc.hxx"
+#include "scresid.hxx"
+#include "sc.hrc"
+#include "scmod.hxx"
+#include <svtools/colorcfg.hxx>
+#include <vcl/svapp.hxx>
+// ause
+#include "editutil.hxx"
+
+using ::rtl::OUString;
+using ::rtl::OUStringBuffer;
+using ::utl::AccessibleRelationSetHelper;
+using ::utl::AccessibleStateSetHelper;
+using ::accessibility::AccessibleStaticTextBase;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::lang::DisposedException;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::beans::PropertyValue;
+using namespace ::com::sun::star::accessibility;
+
+
+// ----------------------------------------------------------------------------
+
+const sal_uInt16 nRulerRole = AccessibleRole::TEXT;
+const sal_uInt16 nGridRole = AccessibleRole::TABLE;
+const sal_uInt16 nCellRole = AccessibleRole::TEXT;
+
+#define CREATE_OUSTRING( name ) OUString( RTL_CONSTASCII_USTRINGPARAM( name ) )
+
+#define RULER_IMPL_NAME "ScAccessibleCsvRuler"
+#define GRID_IMPL_NAME "ScAccessibleCsvGrid"
+#define CELL_IMPL_NAME "ScAccessibleCsvCell"
+
+const sal_Unicode cRulerDot = '.';
+const sal_Unicode cRulerLine = '|';
+
+const sal_Int32 CSV_LINE_HEADER = CSV_POS_INVALID;
+const sal_uInt32 CSV_COLUMN_HEADER = CSV_COLUMN_INVALID;
+
+
+// CSV base control ===========================================================
+
+DBG_NAME( ScAccessibleCsvControl )
+
+ScAccessibleCsvControl::ScAccessibleCsvControl(
+ const Reference< XAccessible >& rxParent,
+ ScCsvControl& rControl,
+ sal_uInt16 nRole ) :
+ ScAccessibleContextBase( rxParent, nRole ),
+ mpControl( &rControl )
+{
+ DBG_CTOR( ScAccessibleCsvControl, NULL );
+}
+
+ScAccessibleCsvControl::~ScAccessibleCsvControl()
+{
+ DBG_DTOR( ScAccessibleCsvControl, NULL );
+ implDispose();
+}
+
+void SAL_CALL ScAccessibleCsvControl::disposing()
+{
+ SolarMutexGuard aGuard;
+ mpControl = NULL;
+ ScAccessibleContextBase::disposing();
+}
+
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvControl::getAccessibleAtPoint( const AwtPoint& /* rPoint */ )
+ throw( RuntimeException )
+{
+ ensureAlive();
+ return NULL;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvControl::isVisible() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetControl().IsVisible();
+}
+
+void SAL_CALL ScAccessibleCsvControl::grabFocus() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ implGetControl().GrabFocus();
+}
+
+
+// events ---------------------------------------------------------------------
+
+void ScAccessibleCsvControl::SendFocusEvent( bool bFocused )
+{
+ if( bFocused )
+ CommitFocusGained();
+ else
+ CommitFocusLost();
+}
+
+void ScAccessibleCsvControl::SendCaretEvent()
+{
+ DBG_ERRORFILE( "ScAccessibleCsvControl::SendCaretEvent - Illegal call" );
+}
+
+void ScAccessibleCsvControl::SendVisibleEvent()
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ CommitChange( aEvent );
+}
+
+void ScAccessibleCsvControl::SendSelectionEvent()
+{
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ CommitChange( aEvent );
+}
+
+void ScAccessibleCsvControl::SendTableUpdateEvent( sal_uInt32 /* nFirstColumn */, sal_uInt32 /* nLastColumn */, bool /* bAllRows */ )
+{
+ DBG_ERRORFILE( "ScAccessibleCsvControl::SendTableUpdateEvent - Illegal call" );
+}
+
+void ScAccessibleCsvControl::SendInsertColumnEvent( sal_uInt32 /* nFirstColumn */, sal_uInt32 /* nLastColumn */ )
+{
+ DBG_ERRORFILE( "ScAccessibleCsvControl::SendInsertColumnEvent - Illegal call" );
+}
+
+void ScAccessibleCsvControl::SendRemoveColumnEvent( sal_uInt32 /* nFirstColumn */, sal_uInt32 /* nLastColumn */ )
+{
+ DBG_ERRORFILE( "ScAccessibleCsvControl::SendRemoveColumnEvent - Illegal call" );
+}
+
+
+// helpers --------------------------------------------------------------------
+
+Rectangle ScAccessibleCsvControl::GetBoundingBoxOnScreen() const throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetControl().GetWindowExtentsRelative( NULL );
+}
+
+Rectangle ScAccessibleCsvControl::GetBoundingBox() const throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetControl().GetWindowExtentsRelative( implGetControl().GetAccessibleParentWindow() );
+}
+
+void ScAccessibleCsvControl::getUuid( Sequence< sal_Int8 >& rSeq )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ if( !rSeq.hasElements() )
+ {
+ rSeq.realloc( 16 );
+ rtl_createUuid( reinterpret_cast< sal_uInt8* >( rSeq.getArray() ), NULL, sal_True );
+ }
+}
+
+void ScAccessibleCsvControl::ensureAlive() const throw( DisposedException )
+{
+ if( !implIsAlive() )
+ throw DisposedException();
+}
+
+ScCsvControl& ScAccessibleCsvControl::implGetControl() const
+{
+ DBG_ASSERT( mpControl, "ScAccessibleCsvControl::implGetControl - missing control" );
+ return *mpControl;
+}
+
+Reference< XAccessible > ScAccessibleCsvControl::implGetChildByRole(
+ const Reference< XAccessible >& rxParentObj, sal_uInt16 nRole ) throw( RuntimeException )
+{
+ Reference< XAccessible > xAccObj;
+ if( rxParentObj.is() )
+ {
+ Reference< XAccessibleContext > xParentCtxt = rxParentObj->getAccessibleContext();
+ if( xParentCtxt.is() )
+ {
+ sal_Int32 nCount = xParentCtxt->getAccessibleChildCount();
+ sal_Int32 nIndex = 0;
+ while( !xAccObj.is() && (nIndex < nCount) )
+ {
+ Reference< XAccessible > xCurrObj = xParentCtxt->getAccessibleChild( nIndex );
+ if( xCurrObj.is() )
+ {
+ Reference< XAccessibleContext > xCurrCtxt = xCurrObj->getAccessibleContext();
+ if( xCurrCtxt.is() && (xCurrCtxt->getAccessibleRole() == nRole) )
+ xAccObj = xCurrObj;
+ }
+ ++nIndex;
+ }
+ }
+ }
+ return xAccObj;
+}
+
+AccessibleStateSetHelper* ScAccessibleCsvControl::implCreateStateSet()
+{
+ SolarMutexGuard aGuard;
+ AccessibleStateSetHelper* pStateSet = new AccessibleStateSetHelper();
+ if( implIsAlive() )
+ {
+ const ScCsvControl& rCtrl = implGetControl();
+ pStateSet->AddState( AccessibleStateType::OPAQUE );
+ if( rCtrl.IsEnabled() )
+ pStateSet->AddState( AccessibleStateType::ENABLED );
+ if( isShowing() )
+ pStateSet->AddState( AccessibleStateType::SHOWING );
+ if( isVisible() )
+ pStateSet->AddState( AccessibleStateType::VISIBLE );
+ }
+ else
+ pStateSet->AddState( AccessibleStateType::DEFUNC );
+ return pStateSet;
+}
+
+void ScAccessibleCsvControl::implDispose()
+{
+ if( implIsAlive() )
+ {
+ // prevent multiple call of dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+}
+
+Point ScAccessibleCsvControl::implGetAbsPos( const Point& rPos ) const
+{
+ return rPos + implGetControl().GetWindowExtentsRelative( NULL ).TopLeft();
+}
+
+
+// Ruler ======================================================================
+
+/** Converts a ruler cursor position to API text index. */
+sal_Int32 lcl_GetApiPos( sal_Int32 nRulerPos )
+{
+ sal_Int32 nApiPos = nRulerPos;
+ sal_Int32 nStart = (nRulerPos - 1) / 10;
+ sal_Int32 nExp = 1;
+ while( nStart >= nExp )
+ {
+ nApiPos += nStart - nExp + 1;
+ nExp *= 10;
+ }
+ return ::std::max( nApiPos, static_cast<sal_Int32>(0) );
+}
+
+/** Converts an API text index to a ruler cursor position. */
+sal_Int32 lcl_GetRulerPos( sal_Int32 nApiPos )
+{
+ sal_Int32 nDiv = 10;
+ sal_Int32 nExp = 10;
+ sal_Int32 nRulerPos = 0;
+ sal_Int32 nApiBase = 0;
+ sal_Int32 nApiLimit = 10;
+ while( nApiPos >= nApiLimit )
+ {
+ ++nDiv;
+ nRulerPos = nExp;
+ nExp *= 10;
+ nApiBase = nApiLimit;
+ nApiLimit = lcl_GetApiPos( nExp );
+ }
+ sal_Int32 nRelPos = nApiPos - nApiBase;
+ return nRulerPos + nRelPos / nDiv * 10 + ::std::max( nRelPos % nDiv - nDiv + 10L, 0L );
+}
+
+/** Expands the sequence's size and returns the base index of the new inserted elements. */
+inline sal_Int32 lcl_ExpandSequence( Sequence< PropertyValue >& rSeq, sal_Int32 nExp )
+{
+ DBG_ASSERT( nExp > 0, "lcl_ExpandSequence - invalid value" );
+ rSeq.realloc( rSeq.getLength() + nExp );
+ return rSeq.getLength() - nExp;
+}
+
+/** Fills the property value rVal with the specified name and value from the item. */
+inline void lcl_FillProperty( PropertyValue& rVal, const OUString& rPropName, const SfxPoolItem& rItem, sal_uInt8 nMID )
+{
+ rVal.Name = rPropName;
+ rItem.QueryValue( rVal.Value, nMID );
+}
+
+/** Fills the sequence with all font attributes of rFont. */
+void lcl_FillFontAttributes( Sequence< PropertyValue >& rSeq, const Font& rFont )
+{
+ SvxFontItem aFontItem( rFont.GetFamily(), rFont.GetName(), rFont.GetStyleName(), rFont.GetPitch(), rFont.GetCharSet(), ATTR_FONT );
+ SvxFontHeightItem aHeightItem( rFont.GetSize().Height(), 100, ATTR_FONT_HEIGHT );
+ SvxLanguageItem aLangItem( rFont.GetLanguage(), ATTR_FONT_LANGUAGE );
+
+ sal_Int32 nIndex = lcl_ExpandSequence( rSeq, 7 );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharFontName" ), aFontItem, MID_FONT_FAMILY_NAME );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharFontFamily" ), aFontItem, MID_FONT_FAMILY );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharFontStyleName" ), aFontItem, MID_FONT_STYLE_NAME );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharFontCharSet" ), aFontItem, MID_FONT_PITCH );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharFontPitch" ), aFontItem, MID_FONT_CHAR_SET );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharHeight" ), aHeightItem, MID_FONTHEIGHT );
+ lcl_FillProperty( rSeq[ nIndex++ ], CREATE_OUSTRING( "CharLocale" ), aLangItem, MID_LANG_LOCALE );
+}
+
+
+
+// ----------------------------------------------------------------------------
+
+DBG_NAME( ScAccessibleCsvRuler )
+
+ScAccessibleCsvRuler::ScAccessibleCsvRuler( ScCsvRuler& rRuler ) :
+ ScAccessibleCsvControl( rRuler.GetAccessibleParentWindow()->GetAccessible(), rRuler, nRulerRole )
+{
+ DBG_CTOR( ScAccessibleCsvRuler, NULL );
+ constructStringBuffer();
+}
+
+ScAccessibleCsvRuler::~ScAccessibleCsvRuler()
+{
+ DBG_DTOR( ScAccessibleCsvRuler, NULL );
+ implDispose();
+}
+
+// XAccessibleComponent -----------------------------------------------------
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getForeground( )
+ throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetRuler().GetSettings().GetStyleSettings().GetLabelTextColor().GetColor();
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getBackground( )
+ throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetRuler().GetSettings().GetStyleSettings().GetFaceColor().GetColor();
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getAccessibleChildCount() throw( RuntimeException )
+{
+ ensureAlive();
+ return 0;
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvRuler::getAccessibleChild( sal_Int32 /* nIndex */ )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ ensureAlive();
+ throw IndexOutOfBoundsException();
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvRuler::getAccessibleRelationSet()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ AccessibleRelationSetHelper* pRelationSet = new AccessibleRelationSetHelper();
+ Reference< XAccessible > xAccObj = implGetChildByRole( getAccessibleParent(), nGridRole );
+ if( xAccObj.is() )
+ {
+ Sequence< Reference< XInterface > > aSeq( 1 );
+ aSeq[ 0 ] = xAccObj;
+ pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLER_FOR, aSeq ) );
+ }
+ return pRelationSet;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL ScAccessibleCsvRuler::getAccessibleStateSet()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ AccessibleStateSetHelper* pStateSet = implCreateStateSet();
+ if( implIsAlive() )
+ {
+ pStateSet->AddState( AccessibleStateType::FOCUSABLE );
+ pStateSet->AddState( AccessibleStateType::SINGLE_LINE );
+ if( implGetRuler().HasFocus() )
+ pStateSet->AddState( AccessibleStateType::FOCUSED );
+ }
+ return pStateSet;
+}
+
+
+// XAccessibleText ------------------------------------------------------------
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getCaretPosition() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return lcl_GetApiPos( implGetRuler().GetRulerCursorPos() );
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvRuler::setCaretPosition( sal_Int32 nIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nIndex );
+ ScCsvRuler& rRuler = implGetRuler();
+ sal_Int32 nOldCursor = rRuler.GetRulerCursorPos();
+ rRuler.Execute( CSVCMD_MOVERULERCURSOR, lcl_GetRulerPos( nIndex ) );
+ return rRuler.GetRulerCursorPos() != nOldCursor;
+}
+
+sal_Unicode SAL_CALL ScAccessibleCsvRuler::getCharacter( sal_Int32 nIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nIndex );
+ return maBuffer.charAt( nIndex );
+}
+
+Sequence< PropertyValue > SAL_CALL ScAccessibleCsvRuler::getCharacterAttributes( sal_Int32 nIndex,
+ const ::com::sun::star::uno::Sequence< ::rtl::OUString >& /* aRequestedAttributes */ )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndexWithEnd( nIndex );
+ Sequence< PropertyValue > aSeq;
+ lcl_FillFontAttributes( aSeq, implGetRuler().GetFont() );
+ return aSeq;
+}
+
+ScAccessibleCsvRuler::AwtRectangle SAL_CALL ScAccessibleCsvRuler::getCharacterBounds( sal_Int32 nIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndexWithEnd( nIndex );
+ ScCsvRuler& rRuler = implGetRuler();
+ Point aPos( rRuler.GetX( lcl_GetRulerPos( nIndex ) ) - rRuler.GetCharWidth() / 2, 0 );
+ AwtRectangle aRect( aPos.X(), aPos.Y(), rRuler.GetCharWidth(), rRuler.GetSizePixel().Height() );
+ // do not return rectangle out of window
+ sal_Int32 nWidth = rRuler.GetOutputSizePixel().Width();
+ if( aRect.X >= nWidth )
+ throw IndexOutOfBoundsException();
+ if( aRect.X + aRect.Width > nWidth )
+ aRect.Width = nWidth - aRect.X;
+ return aRect;
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getCharacterCount() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetTextLength();
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getIndexAtPoint( const AwtPoint& rPoint )
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ScCsvRuler& rRuler = implGetRuler();
+ // use object's coordinate system, convert to API position
+ return lcl_GetApiPos( ::std::min( ::std::max( rRuler.GetPosFromX( rPoint.X ), static_cast<sal_Int32>(0) ), rRuler.GetPosCount() ) );
+}
+
+OUString SAL_CALL ScAccessibleCsvRuler::getSelectedText() throw( RuntimeException )
+{
+ ensureAlive();
+ return OUString();
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getSelectionStart() throw( RuntimeException )
+{
+ ensureAlive();
+ return -1;
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvRuler::getSelectionEnd() throw( RuntimeException )
+{
+ ensureAlive();
+ return -1;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvRuler::setSelection( sal_Int32 /* nStartIndex */, sal_Int32 /* nEndIndex */ )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ ensureAlive();
+ return false;
+}
+
+OUString SAL_CALL ScAccessibleCsvRuler::getText() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return OUString( maBuffer.getStr(), implGetTextLength() );
+}
+
+OUString SAL_CALL ScAccessibleCsvRuler::getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidRange( nStartIndex, nEndIndex );
+ return OUString( maBuffer.getStr() + nStartIndex, nEndIndex - nStartIndex );
+}
+
+TextSegment SAL_CALL ScAccessibleCsvRuler::getTextAtIndex( sal_Int32 nIndex, sal_Int16 nTextType )
+ throw( IndexOutOfBoundsException, IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+
+ TextSegment aResult;
+ aResult.SegmentStart = -1;
+ aResult.SegmentEnd = -1;
+
+ if( (nIndex == implGetTextLength()) && (nTextType != AccessibleTextType::LINE) )
+ return aResult;
+
+ ensureValidIndex( nIndex );
+
+ OUStringBuffer aResultText; // will be assigned to aResult.SegmentText below
+ sal_Int32 nRulerPos = lcl_GetRulerPos( nIndex );
+
+ switch( nTextType )
+ {
+ // single character
+ case AccessibleTextType::CHARACTER:
+ {
+ aResult.SegmentStart = nIndex;
+ aResultText.append( maBuffer.charAt( nIndex ) );
+ }
+ break;
+
+ // entire number or single dot/line
+ case AccessibleTextType::WORD:
+ case AccessibleTextType::GLYPH:
+ aResult.SegmentStart = nIndex;
+ if( nRulerPos % 10 )
+ aResultText.append( maBuffer.charAt( nIndex ) );
+ else
+ aResultText.append( nRulerPos ); // string representation of sal_Int32!!!
+ break;
+
+ // entire text
+ case AccessibleTextType::SENTENCE:
+ case AccessibleTextType::PARAGRAPH:
+ case AccessibleTextType::LINE:
+ aResult.SegmentStart = 0;
+ aResultText.append( maBuffer.getStr(), implGetTextLength() );
+ break;
+
+ // equal-formatted text
+ case AccessibleTextType::ATTRIBUTE_RUN:
+ {
+ sal_Int32 nFirstIndex = implGetFirstEqualFormatted( nIndex );
+ sal_Int32 nLastIndex = implGetLastEqualFormatted( nIndex );
+ aResult.SegmentStart = nFirstIndex;
+ aResultText.append( maBuffer.getStr() + nFirstIndex, nLastIndex - nFirstIndex + 1 );
+ }
+ break;
+
+ default:
+ throw RuntimeException();
+ }
+
+ aResult.SegmentText = aResultText.makeStringAndClear();
+ aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
+ return aResult;
+}
+
+TextSegment SAL_CALL ScAccessibleCsvRuler::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 nTextType )
+ throw( IndexOutOfBoundsException, IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndexWithEnd( nIndex );
+
+ TextSegment aResult;
+ aResult.SegmentStart = -1;
+ aResult.SegmentEnd = -1;
+
+ sal_Int32 nRulerPos = lcl_GetRulerPos( nIndex );
+
+ switch( nTextType )
+ {
+ // single character
+ case AccessibleTextType::CHARACTER:
+ if( nIndex > 0 )
+ aResult = getTextAtIndex( nIndex - 1, nTextType );
+ // else empty
+ break;
+
+ // entire number or single dot/line
+ case AccessibleTextType::WORD:
+ case AccessibleTextType::GLYPH:
+ if( nRulerPos > 0 )
+ aResult = getTextAtIndex( lcl_GetApiPos( nRulerPos - 1 ), nTextType );
+ // else empty
+ break;
+
+ // entire text
+ case AccessibleTextType::SENTENCE:
+ case AccessibleTextType::PARAGRAPH:
+ case AccessibleTextType::LINE:
+ // empty
+ break;
+
+ // equal-formatted text
+ case AccessibleTextType::ATTRIBUTE_RUN:
+ {
+ sal_Int32 nFirstIndex = implGetFirstEqualFormatted( nIndex );
+ if( nFirstIndex > 0 )
+ aResult = getTextAtIndex( nFirstIndex - 1, nTextType );
+ // else empty
+ }
+ break;
+
+ default:
+ throw RuntimeException();
+ }
+ return aResult;
+}
+
+TextSegment SAL_CALL ScAccessibleCsvRuler::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 nTextType )
+ throw( IndexOutOfBoundsException, IllegalArgumentException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndexWithEnd( nIndex );
+
+ TextSegment aResult;
+ aResult.SegmentStart = -1;
+ aResult.SegmentEnd = -1;
+
+ sal_Int32 nRulerPos = lcl_GetRulerPos( nIndex );
+ sal_Int32 nLastValid = implGetTextLength();
+
+ switch( nTextType )
+ {
+ // single character
+ case AccessibleTextType::CHARACTER:
+ if( nIndex < nLastValid )
+ aResult = getTextAtIndex( nIndex + 1, nTextType );
+ // else empty
+ break;
+
+ // entire number or single dot/line
+ case AccessibleTextType::WORD:
+ case AccessibleTextType::GLYPH:
+ if( nRulerPos < implGetRuler().GetPosCount() )
+ aResult = getTextAtIndex( lcl_GetApiPos( nRulerPos + 1 ), nTextType );
+ // else empty
+ break;
+
+ // entire text
+ case AccessibleTextType::SENTENCE:
+ case AccessibleTextType::PARAGRAPH:
+ case AccessibleTextType::LINE:
+ // empty
+ break;
+
+ // equal-formatted text
+ case AccessibleTextType::ATTRIBUTE_RUN:
+ {
+ sal_Int32 nLastIndex = implGetLastEqualFormatted( nIndex );
+ if( nLastIndex < nLastValid )
+ aResult = getTextAtIndex( nLastIndex + 1, nTextType );
+ // else empty
+ }
+ break;
+
+ default:
+ throw RuntimeException();
+ }
+ return aResult;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvRuler::copyText( sal_Int32 /* nStartIndex */, sal_Int32 /* nEndIndex */ )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ ensureAlive();
+ return false;
+}
+
+
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL ScAccessibleCsvRuler::queryInterface( const ::com::sun::star::uno::Type& rType )
+ throw( RuntimeException )
+{
+ Any aAny( ScAccessibleCsvRulerImpl::queryInterface( rType ) );
+ return aAny.hasValue() ? aAny : ScAccessibleCsvControl::queryInterface( rType );
+}
+
+void SAL_CALL ScAccessibleCsvRuler::acquire() throw ()
+{
+ ScAccessibleCsvControl::acquire();
+}
+
+void SAL_CALL ScAccessibleCsvRuler::release() throw ()
+{
+ ScAccessibleCsvControl::release();
+}
+
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL ScAccessibleCsvRuler::getImplementationName() throw( RuntimeException )
+{
+ return CREATE_OUSTRING( RULER_IMPL_NAME );
+}
+
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< ::com::sun::star::uno::Type > SAL_CALL ScAccessibleCsvRuler::getTypes() throw( RuntimeException )
+{
+ Sequence< ::com::sun::star::uno::Type > aSeq( 1 );
+ aSeq[ 0 ] = getCppuType( static_cast< const Reference< XAccessibleText >* >( NULL ) );
+ return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(), aSeq );
+}
+
+Sequence< sal_Int8 > SAL_CALL ScAccessibleCsvRuler::getImplementationId() throw( RuntimeException )
+{
+ static Sequence< sal_Int8 > aSeq;
+ getUuid( aSeq );
+ return aSeq;
+}
+
+
+// events ---------------------------------------------------------------------
+
+void ScAccessibleCsvRuler::SendCaretEvent()
+{
+ sal_Int32 nPos = implGetRuler().GetRulerCursorPos();
+ if( nPos != CSV_POS_INVALID )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CARET_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ aEvent.NewValue <<= nPos;
+ CommitChange( aEvent );
+ }
+}
+
+
+// helpers --------------------------------------------------------------------
+
+OUString SAL_CALL ScAccessibleCsvRuler::createAccessibleName() throw( RuntimeException )
+{
+ return String( ScResId( STR_ACC_CSVRULER_NAME ) );
+}
+
+OUString SAL_CALL ScAccessibleCsvRuler::createAccessibleDescription() throw( RuntimeException )
+{
+ return String( ScResId( STR_ACC_CSVRULER_DESCR ) );
+}
+
+void ScAccessibleCsvRuler::ensureValidIndex( sal_Int32 nIndex ) const
+ throw( IndexOutOfBoundsException )
+{
+ if( (nIndex < 0) || (nIndex >= implGetTextLength()) )
+ throw IndexOutOfBoundsException();
+}
+
+void ScAccessibleCsvRuler::ensureValidIndexWithEnd( sal_Int32 nIndex ) const
+ throw( IndexOutOfBoundsException )
+{
+ if( (nIndex < 0) || (nIndex > implGetTextLength()) )
+ throw IndexOutOfBoundsException();
+}
+
+void ScAccessibleCsvRuler::ensureValidRange( sal_Int32& rnStartIndex, sal_Int32& rnEndIndex ) const
+ throw( IndexOutOfBoundsException )
+{
+ if( rnStartIndex > rnEndIndex )
+ ::std::swap( rnStartIndex, rnEndIndex );
+ if( (rnStartIndex < 0) || (rnEndIndex > implGetTextLength()) )
+ throw IndexOutOfBoundsException();
+}
+
+ScCsvRuler& ScAccessibleCsvRuler::implGetRuler() const
+{
+ return static_cast< ScCsvRuler& >( implGetControl() );
+}
+
+void ScAccessibleCsvRuler::constructStringBuffer() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ // extend existing string buffer to new ruler size
+ sal_Int32 nRulerCount = implGetRuler().GetPosCount();
+ sal_Int32 nRulerPos = lcl_GetRulerPos( maBuffer.getLength() );
+ for( ; nRulerPos <= nRulerCount; ++nRulerPos ) // include last position
+ {
+ switch( nRulerPos % 10 )
+ {
+ case 0: maBuffer.append( nRulerPos ); break;
+ case 5: maBuffer.append( cRulerLine ); break;
+ default: maBuffer.append( cRulerDot );
+ }
+ }
+}
+
+sal_Int32 ScAccessibleCsvRuler::implGetTextLength() const
+{
+ return lcl_GetApiPos( implGetRuler().GetPosCount() + 1 );
+}
+
+bool ScAccessibleCsvRuler::implHasSplit( sal_Int32 nApiPos )
+{
+ sal_Int32 nRulerPos = lcl_GetRulerPos( nApiPos );
+ return implGetRuler().HasSplit( nRulerPos ) && (nApiPos == lcl_GetApiPos( nRulerPos ));
+}
+
+sal_Int32 ScAccessibleCsvRuler::implGetFirstEqualFormatted( sal_Int32 nApiPos )
+{
+ bool bSplit = implHasSplit( nApiPos );
+ while( (nApiPos > 0) && (implHasSplit( nApiPos - 1 ) == bSplit) )
+ --nApiPos;
+ return nApiPos;
+}
+
+sal_Int32 ScAccessibleCsvRuler::implGetLastEqualFormatted( sal_Int32 nApiPos )
+{
+ bool bSplit = implHasSplit( nApiPos );
+ sal_Int32 nLength = implGetTextLength();
+ while( (nApiPos < nLength - 1) && (implHasSplit( nApiPos + 1 ) == bSplit) )
+ ++nApiPos;
+ return nApiPos;
+}
+
+
+// Grid =======================================================================
+
+/** Converts a grid columnm index to an API column index. */
+inline sal_Int32 lcl_GetApiColumn( sal_uInt32 nGridColumn )
+{
+ return (nGridColumn != CSV_COLUMN_HEADER) ? static_cast< sal_Int32 >( nGridColumn + 1 ) : 0;
+}
+
+/** Converts an API columnm index to a ScCsvGrid column index. */
+inline sal_uInt32 lcl_GetGridColumn( sal_Int32 nApiColumn )
+{
+ return (nApiColumn > 0) ? static_cast< sal_uInt32 >( nApiColumn - 1 ) : CSV_COLUMN_HEADER;
+}
+
+
+// ----------------------------------------------------------------------------
+
+DBG_NAME( ScAccessibleCsvGrid )
+
+ScAccessibleCsvGrid::ScAccessibleCsvGrid( ScCsvGrid& rGrid ) :
+ ScAccessibleCsvControl( rGrid.GetAccessibleParentWindow()->GetAccessible(), rGrid, nGridRole )
+{
+ DBG_CTOR( ScAccessibleCsvGrid, NULL );
+}
+
+ScAccessibleCsvGrid::~ScAccessibleCsvGrid()
+{
+ DBG_DTOR( ScAccessibleCsvGrid, NULL );
+ implDispose();
+}
+
+
+// XAccessibleComponent -------------------------------------------------------
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleAtPoint( const AwtPoint& rPoint )
+ throw( RuntimeException )
+{
+ Reference< XAccessible > xRet;
+ if( containsPoint( rPoint ) )
+ {
+ SolarMutexGuard aGuard;
+ ensureAlive();
+
+ const ScCsvGrid& rGrid = implGetGrid();
+ // #102679#; use <= instead of <, because the offset is the size and not the point
+ sal_Int32 nColumn = ((rGrid.GetFirstX() <= rPoint.X) && (rPoint.X <= rGrid.GetLastX())) ?
+ lcl_GetApiColumn( rGrid.GetColumnFromX( rPoint.X ) ) : 0;
+ sal_Int32 nRow = (rPoint.Y >= rGrid.GetHdrHeight()) ?
+ (rGrid.GetLineFromY( rPoint.Y ) - rGrid.GetFirstVisLine() + 1) : 0;
+ xRet = implCreateCellObj( nRow, nColumn );
+ }
+ return xRet;
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getForeground( )
+throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetGrid().GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getBackground( )
+throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+}
+
+// XAccessibleContext ---------------------------------------------------------
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleChildCount() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetCellCount();
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleChild( sal_Int32 nIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nIndex );
+ return implCreateCellObj( implGetRow( nIndex ), implGetColumn( nIndex ) );
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleRelationSet()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ AccessibleRelationSetHelper* pRelationSet = new AccessibleRelationSetHelper();
+ Reference< XAccessible > xAccObj = implGetChildByRole( getAccessibleParent(), nRulerRole );
+ if( xAccObj.is() )
+ {
+ Sequence< Reference< XInterface > > aSeq( 1 );
+ aSeq[ 0 ] = xAccObj;
+ pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::CONTROLLED_BY, aSeq ) );
+ }
+ return pRelationSet;
+}
+
+Reference< XAccessibleStateSet > SAL_CALL ScAccessibleCsvGrid::getAccessibleStateSet()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ AccessibleStateSetHelper* pStateSet = implCreateStateSet();
+ if( implIsAlive() )
+ {
+ pStateSet->AddState( AccessibleStateType::FOCUSABLE );
+ pStateSet->AddState( AccessibleStateType::MULTI_SELECTABLE );
+ pStateSet->AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+ if( implGetGrid().HasFocus() )
+ pStateSet->AddState( AccessibleStateType::FOCUSED );
+ }
+ else
+ pStateSet->AddState( AccessibleStateType::DEFUNC );
+ return pStateSet;
+}
+
+
+// XAccessibleTable -----------------------------------------------------------
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleRowCount() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetRowCount();
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnCount() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetColumnCount();
+}
+
+OUString SAL_CALL ScAccessibleCsvGrid::getAccessibleRowDescription( sal_Int32 nRow )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidPosition( nRow, 0 );
+ return implGetCellText( nRow, 0 );
+}
+
+OUString SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnDescription( sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidPosition( 0, nColumn );
+ return implGetCellText( 0, nColumn );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ ensureAlive();
+ ensureValidPosition( nRow, nColumn );
+ return 1;
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ ensureAlive();
+ ensureValidPosition( nRow, nColumn );
+ return 1;
+}
+
+Reference< XAccessibleTable > SAL_CALL ScAccessibleCsvGrid::getAccessibleRowHeaders()
+ throw( RuntimeException )
+{
+ ensureAlive();
+ return NULL;
+}
+
+Reference< XAccessibleTable > SAL_CALL ScAccessibleCsvGrid::getAccessibleColumnHeaders()
+ throw( RuntimeException )
+{
+ ensureAlive();
+ return NULL;
+}
+
+Sequence< sal_Int32 > SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleRows()
+ throw( RuntimeException )
+{
+ ensureAlive();
+ return Sequence< sal_Int32 >();
+}
+
+Sequence< sal_Int32 > SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleColumns()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+
+ ScCsvGrid& rGrid = implGetGrid();
+ Sequence< sal_Int32 > aSeq( implGetColumnCount() );
+
+ sal_Int32 nSeqIx = 0;
+ sal_uInt32 nColIx = rGrid.GetFirstSelected();
+ for( ; nColIx != CSV_COLUMN_INVALID; ++nSeqIx, nColIx = rGrid.GetNextSelected( nColIx ) )
+ aSeq[ nSeqIx ] = lcl_GetApiColumn( nColIx );
+
+ aSeq.realloc( nSeqIx );
+ return aSeq;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvGrid::isAccessibleRowSelected( sal_Int32 /* nRow */ )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ ensureAlive();
+ return false;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvGrid::isAccessibleColumnSelected( sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nColumn );
+ return implIsColumnSelected( nColumn );
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidPosition( nRow, nColumn );
+ return implCreateCellObj( nRow, nColumn );
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleCaption()
+ throw( RuntimeException )
+{
+ ensureAlive();
+ return NULL;
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getAccessibleSummary()
+ throw( RuntimeException )
+{
+ ensureAlive();
+ return NULL;
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvGrid::isAccessibleSelected( sal_Int32 /* nRow */, sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ return isAccessibleColumnSelected( nColumn );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidPosition( nRow, nColumn );
+ return implGetIndex( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleRow( sal_Int32 nChildIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nChildIndex );
+ return implGetRow( nChildIndex );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getAccessibleColumn( sal_Int32 nChildIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nChildIndex );
+ return implGetColumn( nChildIndex );
+}
+
+
+// XAccessibleSelection -------------------------------------------------------
+
+void SAL_CALL ScAccessibleCsvGrid::selectAccessibleChild( sal_Int32 nChildIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nChildIndex );
+ sal_Int32 nColumn = implGetColumn( nChildIndex );
+ if( nChildIndex == 0 )
+ implGetGrid().SelectAll();
+ else
+ implSelectColumn( nColumn, true );
+}
+
+sal_Bool SAL_CALL ScAccessibleCsvGrid::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ensureValidIndex( nChildIndex );
+ sal_Int32 nColumn = implGetColumn( nChildIndex );
+ return implIsColumnSelected( nColumn );
+}
+
+void SAL_CALL ScAccessibleCsvGrid::clearAccessibleSelection() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ implGetGrid().SelectAll( false );
+}
+
+void SAL_CALL ScAccessibleCsvGrid::selectAllAccessibleChildren() throw( RuntimeException )
+{
+ selectAccessibleChild( 0 );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleChildCount() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetRowCount() * implGetSelColumnCount();
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvGrid::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ sal_Int32 nColumns = implGetSelColumnCount();
+ if( nColumns == 0 )
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nRow = nSelectedChildIndex / nColumns;
+ sal_Int32 nColumn = implGetSelColumn( nSelectedChildIndex % nColumns );
+ return getAccessibleCellAt( nRow, nColumn );
+}
+
+void SAL_CALL ScAccessibleCsvGrid::deselectAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ sal_Int32 nColumns = implGetSelColumnCount();
+ if( nColumns == 0 )
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nColumn = implGetSelColumn( nSelectedChildIndex % nColumns );
+ ensureValidPosition( nSelectedChildIndex / nColumns, nColumn );
+ if( nColumn > 0 )
+ implSelectColumn( nColumn, false );
+}
+
+
+// XInterface -----------------------------------------------------------------
+
+Any SAL_CALL ScAccessibleCsvGrid::queryInterface( const ::com::sun::star::uno::Type& rType )
+ throw( RuntimeException )
+{
+ Any aAny( ScAccessibleCsvGridImpl::queryInterface( rType ) );
+ return aAny.hasValue() ? aAny : ScAccessibleCsvControl::queryInterface( rType );
+}
+
+void SAL_CALL ScAccessibleCsvGrid::acquire() throw ()
+{
+ ScAccessibleCsvControl::acquire();
+}
+
+void SAL_CALL ScAccessibleCsvGrid::release() throw ()
+{
+ ScAccessibleCsvControl::release();
+}
+
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL ScAccessibleCsvGrid::getImplementationName() throw( RuntimeException )
+{
+ return CREATE_OUSTRING( GRID_IMPL_NAME );
+}
+
+
+// XTypeProvider --------------------------------------------------------------
+
+Sequence< ::com::sun::star::uno::Type > SAL_CALL ScAccessibleCsvGrid::getTypes() throw( RuntimeException )
+{
+ Sequence< ::com::sun::star::uno::Type > aSeq( 2 );
+ aSeq[ 0 ] = getCppuType( static_cast< const Reference< XAccessibleTable >* >( NULL ) );
+ aSeq[ 1 ] = getCppuType( static_cast< const Reference< XAccessibleSelection >* >( NULL ) );
+ return ::comphelper::concatSequences( ScAccessibleCsvControl::getTypes(), aSeq );
+}
+
+Sequence< sal_Int8 > SAL_CALL ScAccessibleCsvGrid::getImplementationId() throw( RuntimeException )
+{
+ static Sequence< sal_Int8 > aSeq;
+ getUuid( aSeq );
+ return aSeq;
+}
+
+
+// events ---------------------------------------------------------------------
+
+void ScAccessibleCsvGrid::SendFocusEvent( bool bFocused )
+{
+ ScAccessibleCsvControl::SendFocusEvent( bFocused );
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ (bFocused ? aEvent.NewValue : aEvent.OldValue) <<=
+ getAccessibleCellAt( 0, lcl_GetApiColumn( implGetGrid().GetFocusColumn() ) );
+ CommitChange( aEvent );
+}
+
+void ScAccessibleCsvGrid::SendTableUpdateEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn, bool bAllRows )
+{
+ if( nFirstColumn <= nLastColumn )
+ {
+ AccessibleTableModelChange aModelChange(
+ AccessibleTableModelChangeType::UPDATE, 0, bAllRows ? implGetRowCount() - 1 : 0,
+ lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) );
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ aEvent.NewValue <<= aModelChange;
+ CommitChange( aEvent );
+ }
+}
+
+void ScAccessibleCsvGrid::SendInsertColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn )
+{
+ if( nFirstColumn <= nLastColumn )
+ {
+ AccessibleTableModelChange aModelChange(
+ AccessibleTableModelChangeType::INSERT, 0, implGetRowCount() - 1,
+ lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) );
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ aEvent.NewValue <<= aModelChange;
+ CommitChange( aEvent );
+ }
+}
+
+void ScAccessibleCsvGrid::SendRemoveColumnEvent( sal_uInt32 nFirstColumn, sal_uInt32 nLastColumn )
+{
+ if( nFirstColumn <= nLastColumn )
+ {
+ AccessibleTableModelChange aModelChange(
+ AccessibleTableModelChangeType::DELETE, 0, implGetRowCount() - 1,
+ lcl_GetApiColumn( nFirstColumn ), lcl_GetApiColumn( nLastColumn ) );
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::TABLE_MODEL_CHANGED;
+ aEvent.Source = Reference< XAccessible >( this );
+ aEvent.NewValue <<= aModelChange;
+ CommitChange( aEvent );
+ }
+}
+
+
+// helpers --------------------------------------------------------------------
+
+OUString SAL_CALL ScAccessibleCsvGrid::createAccessibleName() throw( RuntimeException )
+{
+ return String( ScResId( STR_ACC_CSVGRID_NAME ) );
+}
+
+OUString SAL_CALL ScAccessibleCsvGrid::createAccessibleDescription() throw( RuntimeException )
+{
+ return String( ScResId( STR_ACC_CSVGRID_DESCR ) );
+}
+
+void ScAccessibleCsvGrid::ensureValidIndex( sal_Int32 nIndex ) const
+ throw( IndexOutOfBoundsException )
+{
+ if( (nIndex < 0) || (nIndex >= implGetCellCount()) )
+ throw IndexOutOfBoundsException();
+}
+
+void ScAccessibleCsvGrid::ensureValidPosition( sal_Int32 nRow, sal_Int32 nColumn ) const
+ throw( IndexOutOfBoundsException )
+{
+ if( (nRow < 0) || (nRow >= implGetRowCount()) || (nColumn < 0) || (nColumn >= implGetColumnCount()) )
+ throw IndexOutOfBoundsException();
+}
+
+ScCsvGrid& ScAccessibleCsvGrid::implGetGrid() const
+{
+ return static_cast< ScCsvGrid& >( implGetControl() );
+}
+
+bool ScAccessibleCsvGrid::implIsColumnSelected( sal_Int32 nColumn ) const
+{
+ return (nColumn > 0) && implGetGrid().IsSelected( lcl_GetGridColumn( nColumn ) );
+}
+
+void ScAccessibleCsvGrid::implSelectColumn( sal_Int32 nColumn, bool bSelect )
+{
+ if( nColumn > 0 )
+ implGetGrid().Select( lcl_GetGridColumn( nColumn ), bSelect );
+}
+
+sal_Int32 ScAccessibleCsvGrid::implGetRowCount() const
+{
+ return static_cast< sal_Int32 >( implGetGrid().GetLastVisLine() - implGetGrid().GetFirstVisLine() + 2 );
+}
+
+sal_Int32 ScAccessibleCsvGrid::implGetColumnCount() const
+{
+ return static_cast< sal_Int32 >( implGetGrid().GetColumnCount() + 1 );
+}
+
+sal_Int32 ScAccessibleCsvGrid::implGetSelColumnCount() const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ sal_Int32 nCount = 0;
+ for( sal_uInt32 nColIx = rGrid.GetFirstSelected(); nColIx != CSV_COLUMN_INVALID; nColIx = rGrid.GetNextSelected( nColIx ) )
+ ++nCount;
+ return nCount;
+}
+
+sal_Int32 ScAccessibleCsvGrid::implGetSelColumn( sal_Int32 nSelColumn ) const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ sal_Int32 nColumn = 0;
+ for( sal_uInt32 nColIx = rGrid.GetFirstSelected(); nColIx != CSV_COLUMN_INVALID; nColIx = rGrid.GetNextSelected( nColIx ) )
+ {
+ if( nColumn == nSelColumn )
+ return static_cast< sal_Int32 >( nColIx + 1 );
+ ++nColumn;
+ }
+ return 0;
+}
+
+String ScAccessibleCsvGrid::implGetCellText( sal_Int32 nRow, sal_Int32 nColumn ) const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ sal_Int32 nLine = nRow + rGrid.GetFirstVisLine() - 1;
+ String aCellStr;
+ if( (nColumn > 0) && (nRow > 0) )
+ aCellStr = rGrid.GetCellText( lcl_GetGridColumn( nColumn ), nLine );
+ else if( nRow > 0 )
+ aCellStr = String::CreateFromInt32( nLine + 1L );
+ else if( nColumn > 0 )
+ aCellStr = rGrid.GetColumnTypeName( lcl_GetGridColumn( nColumn ) );
+ return aCellStr;
+}
+
+
+ScAccessibleCsvControl* ScAccessibleCsvGrid::implCreateCellObj( sal_Int32 nRow, sal_Int32 nColumn ) const
+{
+ return new ScAccessibleCsvCell( implGetGrid(), implGetCellText( nRow, nColumn ), nRow, nColumn );
+}
+
+
+// ============================================================================
+
+DBG_NAME( ScAccessibleCsvCell )
+
+ScAccessibleCsvCell::ScAccessibleCsvCell(
+ ScCsvGrid& rGrid,
+ const String& rCellText,
+ sal_Int32 nRow, sal_Int32 nColumn ) :
+ ScAccessibleCsvControl( rGrid.GetAccessible(), rGrid, nCellRole ),
+ AccessibleStaticTextBase( SvxEditSourcePtr( NULL ) ),
+ maCellText( rCellText ),
+ mnLine( nRow ? (nRow + rGrid.GetFirstVisLine() - 1) : CSV_LINE_HEADER ),
+ mnColumn( lcl_GetGridColumn( nColumn ) ),
+ mnIndex( nRow * (rGrid.GetColumnCount() + 1) + nColumn )
+{
+ DBG_CTOR( ScAccessibleCsvCell, NULL );
+ SetEditSource( implCreateEditSource() );
+}
+
+ScAccessibleCsvCell::~ScAccessibleCsvCell()
+{
+ DBG_DTOR( ScAccessibleCsvCell, NULL );
+}
+
+void SAL_CALL ScAccessibleCsvCell::disposing()
+{
+ SolarMutexGuard aGuard;
+ SetEditSource( SvxEditSourcePtr( NULL ) );
+ ScAccessibleCsvControl::disposing();
+}
+
+
+// XAccessibleComponent -------------------------------------------------------
+
+void SAL_CALL ScAccessibleCsvCell::grabFocus() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ ScCsvGrid& rGrid = implGetGrid();
+ rGrid.Execute( CSVCMD_MOVEGRIDCURSOR, rGrid.GetColumnPos( mnColumn ) );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvCell::getForeground( )
+throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetGrid().GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvCell::getBackground( )
+throw (RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+}
+
+// XAccessibleContext -----------------------------------------------------
+
+sal_Int32 SAL_CALL ScAccessibleCsvCell::getAccessibleChildCount() throw( RuntimeException )
+{
+ return AccessibleStaticTextBase::getAccessibleChildCount();
+}
+
+Reference< XAccessible > SAL_CALL ScAccessibleCsvCell::getAccessibleChild( sal_Int32 nIndex )
+ throw( IndexOutOfBoundsException, RuntimeException )
+{
+ return AccessibleStaticTextBase::getAccessibleChild( nIndex );
+}
+
+sal_Int32 SAL_CALL ScAccessibleCsvCell::getAccessibleIndexInParent() throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return mnIndex;
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL ScAccessibleCsvCell::getAccessibleRelationSet()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return new AccessibleRelationSetHelper();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL ScAccessibleCsvCell::getAccessibleStateSet()
+ throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ AccessibleStateSetHelper* pStateSet = implCreateStateSet();
+ if( implIsAlive() )
+ {
+ const ScCsvGrid& rGrid = implGetGrid();
+ pStateSet->AddState( AccessibleStateType::SINGLE_LINE );
+ if( mnColumn != CSV_COLUMN_HEADER )
+ pStateSet->AddState( AccessibleStateType::SELECTABLE );
+ if( rGrid.HasFocus() && (rGrid.GetFocusColumn() == mnColumn) && (mnLine == CSV_LINE_HEADER) )
+ pStateSet->AddState( AccessibleStateType::ACTIVE );
+ if( rGrid.IsSelected( mnColumn ) )
+ pStateSet->AddState( AccessibleStateType::SELECTED );
+ }
+ return pStateSet;
+}
+
+// XInterface -----------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCsvCell, ScAccessibleCsvControl, AccessibleStaticTextBase )
+
+// XTypeProvider --------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCsvCell, ScAccessibleCsvControl, AccessibleStaticTextBase )
+
+// XServiceInfo ---------------------------------------------------------------
+
+OUString SAL_CALL ScAccessibleCsvCell::getImplementationName() throw( RuntimeException )
+{
+ return CREATE_OUSTRING( CELL_IMPL_NAME );
+}
+
+// helpers --------------------------------------------------------------------
+
+Rectangle ScAccessibleCsvCell::GetBoundingBoxOnScreen() const throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ Rectangle aRect( implGetBoundingBox() );
+ aRect.SetPos( implGetAbsPos( aRect.TopLeft() ) );
+ return aRect;
+}
+
+Rectangle ScAccessibleCsvCell::GetBoundingBox() const throw( RuntimeException )
+{
+ SolarMutexGuard aGuard;
+ ensureAlive();
+ return implGetBoundingBox();
+}
+
+OUString SAL_CALL ScAccessibleCsvCell::createAccessibleName() throw( RuntimeException )
+{
+ return maCellText;
+}
+
+OUString SAL_CALL ScAccessibleCsvCell::createAccessibleDescription() throw( RuntimeException )
+{
+ return OUString();
+}
+
+ScCsvGrid& ScAccessibleCsvCell::implGetGrid() const
+{
+ return static_cast< ScCsvGrid& >( implGetControl() );
+}
+
+Point ScAccessibleCsvCell::implGetRealPos() const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ return Point(
+ (mnColumn == CSV_COLUMN_HEADER) ? rGrid.GetHdrX() : rGrid.GetColumnX( mnColumn ),
+ (mnLine == CSV_LINE_HEADER) ? 0 : rGrid.GetY( mnLine ) );
+}
+
+sal_uInt32 ScAccessibleCsvCell::implCalcPixelWidth(sal_uInt32 nChars) const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ return rGrid.GetCharWidth() * nChars;
+}
+
+Size ScAccessibleCsvCell::implGetRealSize() const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ return Size(
+ (mnColumn == CSV_COLUMN_HEADER) ? rGrid.GetHdrWidth() : implCalcPixelWidth( rGrid.GetColumnWidth( mnColumn ) ),
+ (mnLine == CSV_LINE_HEADER) ? rGrid.GetHdrHeight() : rGrid.GetLineHeight() );
+}
+
+Rectangle ScAccessibleCsvCell::implGetBoundingBox() const
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ Rectangle aClipRect( Point( 0, 0 ), rGrid.GetSizePixel() );
+ if( mnColumn != CSV_COLUMN_HEADER )
+ {
+ aClipRect.Left() = rGrid.GetFirstX();
+ aClipRect.Right() = rGrid.GetLastX();
+ }
+ if( mnLine != CSV_LINE_HEADER )
+ aClipRect.Top() = rGrid.GetHdrHeight();
+
+ Rectangle aRect( implGetRealPos(), implGetRealSize() );
+ aRect.Intersection( aClipRect );
+ if( (aRect.GetWidth() <= 0) || (aRect.GetHeight() <= 0) )
+ aRect.SetSize( Size( -1, -1 ) );
+ return aRect;
+}
+
+::std::auto_ptr< SvxEditSource > ScAccessibleCsvCell::implCreateEditSource()
+{
+ ScCsvGrid& rGrid = implGetGrid();
+ Rectangle aBoundRect( implGetBoundingBox() );
+ aBoundRect -= implGetRealPos();
+
+ ::std::auto_ptr< ScAccessibleTextData > pCsvTextData( new ScAccessibleCsvTextData(
+ &rGrid, rGrid.GetEditEngine(), maCellText, aBoundRect, implGetRealSize() ) );
+
+ ::std::auto_ptr< SvxEditSource > pEditSource( new ScAccessibilityEditSource( pCsvTextData ) );
+ return pEditSource;
+}
+
+
+// ============================================================================
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
new file mode 100644
index 000000000000..f4915eee443d
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
@@ -0,0 +1,736 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#include "AccessibleDataPilotControl.hxx"
+#include "fieldwnd.hxx"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <rtl/uuid.h>
+#include <tools/gen.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <tools/debug.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+class ScAccessibleDataPilotButton
+ : public ScAccessibleContextBase
+{
+public:
+ //===== internal ========================================================
+ ScAccessibleDataPilotButton(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ ScDPFieldControlBase* pDPFieldWindow,
+ sal_Int32 nIndex);
+
+ virtual void Init();
+
+ using ScAccessibleContextBase::disposing;
+ virtual void SAL_CALL disposing();
+
+ void SetIndex(sal_Int32 nIndex) { mnIndex = nIndex; }
+ void NameChanged();
+ void SetFocused();
+ void ResetFocused();
+protected:
+ virtual ~ScAccessibleDataPilotButton(void);
+public:
+ ///===== XAccessibleComponent ============================================
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+ SAL_CALL getAccessibleAtPoint(
+ const ::com::sun::star::awt::Point& rPoint )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual sal_Bool SAL_CALL isVisible( )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL grabFocus( )
+ 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);
+
+ ///===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleChildCount(void) throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the specified child or NULL if index is invalid.
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+ getAccessibleChild(sal_Int32 nIndex)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException);
+
+ /// Return this objects index among the parents children.
+ virtual sal_Int32 SAL_CALL
+ getAccessibleIndexInParent(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the set of current states.
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+ getAccessibleStateSet(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ ///===== XServiceInfo ====================================================
+
+ /** Returns an identifier for the implementation of this object.
+ */
+ virtual ::rtl::OUString SAL_CALL
+ getImplementationName(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ ///===== XTypeProvider ===================================================
+
+ /** Returns a implementation id.
+ */
+ virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+ getImplementationId(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ /// Return this object's description.
+ virtual ::rtl::OUString SAL_CALL
+ createAccessibleDescription(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current name.
+ virtual ::rtl::OUString SAL_CALL
+ createAccessibleName(void)
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current bounding box relative to the desktop.
+ virtual Rectangle GetBoundingBoxOnScreen(void) const
+ throw (::com::sun::star::uno::RuntimeException);
+
+ /// Return the object's current bounding box relative to the parent object.
+ virtual Rectangle GetBoundingBox(void) const
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ ScDPFieldControlBase* mpDPFieldWindow;
+ sal_Int32 mnIndex;
+};
+
+ //===== internal ========================================================
+ScAccessibleDataPilotControl::ScAccessibleDataPilotControl(
+ const uno::Reference<XAccessible>& rxParent,
+ ScDPFieldControlBase* pDPFieldWindow)
+ :
+ ScAccessibleContextBase(rxParent, AccessibleRole::GROUP_BOX),
+ mpDPFieldWindow(pDPFieldWindow)
+{
+ if (mpDPFieldWindow)
+ maChildren.resize(mpDPFieldWindow->GetFieldCount());
+}
+
+ScAccessibleDataPilotControl::~ScAccessibleDataPilotControl(void)
+{
+ if (!IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ // call dispose to inform object wich have a weak reference to this object
+ dispose();
+ }
+}
+
+void ScAccessibleDataPilotControl::Init()
+{
+}
+
+void SAL_CALL ScAccessibleDataPilotControl::disposing()
+{
+ SolarMutexGuard aGuard;
+ mpDPFieldWindow = NULL;
+
+ ScAccessibleContextBase::disposing();
+}
+
+void ScAccessibleDataPilotControl::AddField(sal_Int32 nNewIndex)
+{
+ sal_Bool bAdded(sal_False);
+ if (static_cast<sal_uInt32>(nNewIndex) == maChildren.size())
+ {
+ maChildren.push_back(AccessibleWeak());
+ bAdded = sal_True;
+ }
+ else if (static_cast<sal_uInt32>(nNewIndex) < maChildren.size())
+ {
+ ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nNewIndex;
+ maChildren.insert(aItr, AccessibleWeak());
+
+ ::std::vector < AccessibleWeak >::iterator aEndItr = maChildren.end();
+ aItr = maChildren.begin() + nNewIndex + 1;
+ uno::Reference< XAccessible > xTempAcc;
+ sal_Int32 nIndex = nNewIndex + 1;
+ while (aItr != aEndItr)
+ {
+ xTempAcc = aItr->xWeakAcc;
+ if (xTempAcc.is() && aItr->pAcc)
+ aItr->pAcc->SetIndex(nIndex);
+ ++nIndex;
+ ++aItr;
+ }
+ bAdded = sal_True;
+ }
+ else
+ {
+ DBG_ERRORFILE("did not recognize a child count change");
+ }
+
+ if (bAdded)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.NewValue <<= getAccessibleChild(nNewIndex);
+
+ CommitChange(aEvent); // new child - event
+ }
+}
+
+void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex)
+{
+ sal_Bool bRemoved(sal_False);
+ uno::Reference< XAccessible > xTempAcc;
+ ScAccessibleDataPilotButton* pField = NULL;
+ if (static_cast<sal_uInt32>(nOldIndex) < maChildren.size())
+ {
+ xTempAcc = getAccessibleChild(nOldIndex);
+ pField = maChildren[nOldIndex].pAcc;
+
+ ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nOldIndex;
+ aItr = maChildren.erase(aItr);
+
+ ::std::vector < AccessibleWeak >::iterator aEndItr = maChildren.end();
+ uno::Reference< XAccessible > xItrAcc;
+ while (aItr != aEndItr)
+ {
+ xItrAcc = aItr->xWeakAcc;
+ if (xItrAcc.is() && aItr->pAcc)
+ aItr->pAcc->SetIndex(nOldIndex);
+ ++nOldIndex;
+ ++aItr;
+ }
+ bRemoved = sal_True;
+ }
+ else
+ {
+ DBG_ERRORFILE("did not recognize a child count change");
+ }
+
+ if (bRemoved)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.NewValue <<= xTempAcc;
+
+ CommitChange(aEvent); // gone child - event
+
+ if (pField)
+ pField->dispose();
+ }
+}
+
+void ScAccessibleDataPilotControl::FieldFocusChange(sal_Int32 nOldIndex, sal_Int32 nNewIndex)
+{
+ DBG_ASSERT(static_cast<sal_uInt32>(nOldIndex) < maChildren.size() &&
+ static_cast<sal_uInt32>(nNewIndex) < maChildren.size(), "did not recognize a child count change");
+
+ uno::Reference < XAccessible > xTempAcc = maChildren[nOldIndex].xWeakAcc;
+ if (xTempAcc.is() && maChildren[nOldIndex].pAcc)
+ maChildren[nOldIndex].pAcc->ResetFocused();
+
+ xTempAcc = maChildren[nNewIndex].xWeakAcc;
+ if (xTempAcc.is() && maChildren[nNewIndex].pAcc)
+ maChildren[nNewIndex].pAcc->SetFocused();
+}
+
+void ScAccessibleDataPilotControl::FieldNameChange(sal_Int32 nIndex)
+{
+ DBG_ASSERT(static_cast<sal_uInt32>(nIndex) < maChildren.size(), "did not recognize a child count change");
+
+ uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
+ if (xTempAcc.is() && maChildren[nIndex].pAcc)
+ maChildren[nIndex].pAcc->ChangeName();
+}
+
+void ScAccessibleDataPilotControl::GotFocus()
+{
+ if (mpDPFieldWindow)
+ {
+ DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
+
+ sal_Int32 nIndex(mpDPFieldWindow->GetSelectedField());
+ uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
+ if (xTempAcc.is() && maChildren[nIndex].pAcc)
+ maChildren[nIndex].pAcc->SetFocused();
+ }
+}
+
+void ScAccessibleDataPilotControl::LostFocus()
+{
+ if (mpDPFieldWindow)
+ {
+ DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
+
+ sal_Int32 nIndex(mpDPFieldWindow->GetSelectedField());
+ uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
+ if (xTempAcc.is() && maChildren[nIndex].pAcc)
+ maChildren[nIndex].pAcc->ResetFocused();
+ }
+}
+
+ ///===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotControl::getAccessibleAtPoint(
+ const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ uno::Reference<XAccessible> xAcc;
+ if (containsPoint(rPoint))
+ {
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ {
+ Point aAbsPoint(VCLPoint(rPoint));
+ Point aControlEdge(GetBoundingBoxOnScreen().TopLeft());
+ Point aRelPoint(aAbsPoint - aControlEdge);
+ size_t nChildIndex(0);
+ if (mpDPFieldWindow->GetFieldIndex(aRelPoint, nChildIndex))
+ xAcc = getAccessibleChild(static_cast< long >( nChildIndex ));
+ }
+ }
+ return xAcc;
+}
+
+sal_Bool SAL_CALL ScAccessibleDataPilotControl::isVisible( )
+ throw (uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL ScAccessibleDataPilotControl::grabFocus( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ mpDPFieldWindow->GrabFocus();
+}
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getForeground( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nColor(0);
+ if (mpDPFieldWindow)
+ {
+ nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
+ }
+ return nColor;
+}
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getBackground( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nColor(0);
+ if (mpDPFieldWindow)
+ {
+ if (mpDPFieldWindow->GetFieldType() == TYPE_SELECT)
+ {
+ nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
+ }
+ else
+ {
+ nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetWindowColor().GetColor();
+ }
+ }
+ return nColor;
+}
+
+ ///===== XAccessibleContext ==============================================
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getAccessibleChildCount(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ return mpDPFieldWindow->GetFieldCount();
+ else
+ return 0;
+}
+
+uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotControl::getAccessibleChild(sal_Int32 nIndex)
+ throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ uno::Reference<XAccessible> xAcc;
+ if (mpDPFieldWindow)
+ {
+ if (nIndex < 0 || static_cast< size_t >( nIndex ) >= mpDPFieldWindow->GetFieldCount())
+ throw lang::IndexOutOfBoundsException();
+
+ DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
+
+ uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
+ if (!xTempAcc.is())
+ {
+ maChildren[nIndex].pAcc = new ScAccessibleDataPilotButton(this, mpDPFieldWindow, nIndex);
+ xTempAcc = maChildren[nIndex].pAcc;
+ maChildren[nIndex].xWeakAcc = xTempAcc;
+ }
+
+ xAcc = xTempAcc;
+ }
+ return xAcc;
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotControl::getAccessibleStateSet(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+
+ if (IsDefunc())
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::OPAQUE);
+ if (isShowing())
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ if (isVisible())
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ }
+
+ return pStateSet;
+}
+
+ ///===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL ScAccessibleDataPilotControl::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleDataPilotControl"));
+}
+
+ ///===== XTypeProvider ===================================================
+
+uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotControl::getImplementationId(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+ //===== internal ========================================================
+
+::rtl::OUString SAL_CALL ScAccessibleDataPilotControl::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ return mpDPFieldWindow->GetDescription();
+
+ return rtl::OUString();
+}
+
+::rtl::OUString SAL_CALL ScAccessibleDataPilotControl::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ return mpDPFieldWindow->GetName();
+
+ return rtl::OUString();
+}
+
+Rectangle ScAccessibleDataPilotControl::GetBoundingBoxOnScreen(void) const
+ throw (uno::RuntimeException)
+{
+ if (mpDPFieldWindow)
+ return mpDPFieldWindow->GetWindowExtentsRelative(NULL);
+ else
+ return Rectangle();
+}
+
+Rectangle ScAccessibleDataPilotControl::GetBoundingBox(void) const
+ throw (uno::RuntimeException)
+{
+ if (mpDPFieldWindow)
+ return mpDPFieldWindow->GetWindowExtentsRelative(mpDPFieldWindow->GetAccessibleParentWindow());
+ else
+ return Rectangle();
+}
+
+
+//===============================================================================
+
+ScAccessibleDataPilotButton::ScAccessibleDataPilotButton(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ ScDPFieldControlBase* pDPFieldWindow,
+ sal_Int32 nIndex)
+ : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
+ mpDPFieldWindow(pDPFieldWindow),
+ mnIndex(nIndex)
+{
+}
+
+ScAccessibleDataPilotButton::~ScAccessibleDataPilotButton(void)
+{
+ if (!IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ // call dispose to inform object wich have a weak reference to this object
+ dispose();
+ }
+}
+
+void ScAccessibleDataPilotButton::Init()
+{
+}
+
+void SAL_CALL ScAccessibleDataPilotButton::disposing()
+{
+ SolarMutexGuard aGuard;
+ mpDPFieldWindow = NULL;
+
+ ScAccessibleContextBase::disposing();
+}
+
+void ScAccessibleDataPilotButton::SetFocused()
+{
+ CommitFocusGained();
+}
+
+void ScAccessibleDataPilotButton::ResetFocused()
+{
+ CommitFocusLost();
+}
+
+ ///===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotButton::getAccessibleAtPoint(
+ const ::com::sun::star::awt::Point& /* rPoint */ )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return NULL;
+}
+
+sal_Bool SAL_CALL ScAccessibleDataPilotButton::isVisible( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return sal_True;
+}
+
+void SAL_CALL ScAccessibleDataPilotButton::grabFocus( )
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ {
+ mpDPFieldWindow->GrabFocusWithSel(getAccessibleIndexInParent());
+ }
+}
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getForeground( )
+throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nColor(0);
+ if (mpDPFieldWindow)
+ {
+ nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
+ }
+ return nColor;
+}
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getBackground( )
+throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nColor(0);
+ if (mpDPFieldWindow)
+ {
+ nColor = mpDPFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
+ }
+ return nColor;
+}
+
+ ///===== XAccessibleContext ==============================================
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getAccessibleChildCount(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotButton::getAccessibleChild(sal_Int32 /* nIndex */)
+ throw (::com::sun::star::uno::RuntimeException,
+ ::com::sun::star::lang::IndexOutOfBoundsException)
+{
+ throw lang::IndexOutOfBoundsException();
+}
+
+sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getAccessibleIndexInParent(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return mnIndex;
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotButton::getAccessibleStateSet(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+
+ if (IsDefunc())
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::OPAQUE);
+ pStateSet->AddState(AccessibleStateType::FOCUSABLE);
+ if (mpDPFieldWindow && (sal::static_int_cast<sal_Int32>(mpDPFieldWindow->GetSelectedField()) == mnIndex))
+ pStateSet->AddState(AccessibleStateType::FOCUSED);
+ if (isShowing())
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ if (isVisible())
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ }
+
+ return pStateSet;
+}
+
+ ///===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleDataPilotButton"));
+}
+
+ ///===== XTypeProvider ===================================================
+
+uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotButton::getImplementationId(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ return rtl::OUString();
+}
+
+::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleName(void)
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpDPFieldWindow)
+ return mpDPFieldWindow->GetFieldText(getAccessibleIndexInParent());
+
+ return rtl::OUString();
+}
+
+Rectangle ScAccessibleDataPilotButton::GetBoundingBoxOnScreen(void) const
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ Rectangle aRect(GetBoundingBox());
+
+ if (mpDPFieldWindow)
+ {
+ Point aParentPos(mpDPFieldWindow->GetWindowExtentsRelative(NULL).TopLeft());
+ aRect.Move(aParentPos.getX(), aParentPos.getY());
+ }
+
+ return aRect;
+}
+
+Rectangle ScAccessibleDataPilotButton::GetBoundingBox(void) const
+ throw (::com::sun::star::uno::RuntimeException)
+{
+ if (mpDPFieldWindow)
+ return Rectangle (mpDPFieldWindow->GetFieldPosition(const_cast<ScAccessibleDataPilotButton*> (this)->getAccessibleIndexInParent()), mpDPFieldWindow->GetFieldSize());
+ else
+ return Rectangle();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
new file mode 100644
index 000000000000..fe8ef7b9decf
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -0,0 +1,2090 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+#include "AccessibleDocument.hxx"
+#include "AccessibleSpreadsheet.hxx"
+#include "tabvwsh.hxx"
+#include "AccessibilityHints.hxx"
+#include "document.hxx"
+#include "drwlayer.hxx"
+#include "shapeuno.hxx"
+#include "DrawModelBroadcaster.hxx"
+#include "drawview.hxx"
+#include "gridwin.hxx"
+#include "AccessibleEditObject.hxx"
+#include "userdat.hxx"
+#include "scresid.hxx"
+#include "sc.hrc"
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XShapes.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/AccessibleShapeTreeInfo.hxx>
+#include <svx/AccessibleShapeInfo.hxx>
+#include <comphelper/sequence.hxx>
+#include <sfx2/viewfrm.hxx>
+#include <svx/unoshcol.hxx>
+#include <svx/unoshape.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <vcl/svapp.hxx>
+
+#include <list>
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::std::for_each;
+
+ //===== internal ========================================================
+
+struct ScAccessibleShapeData
+{
+ ScAccessibleShapeData() : pAccShape(NULL), pRelationCell(NULL), bSelected(false), bSelectable(sal_True) {}
+ ~ScAccessibleShapeData();
+ mutable ::accessibility::AccessibleShape* pAccShape;
+ mutable ScAddress* pRelationCell; // if it is NULL this shape is anchored on the table
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape;
+ mutable sal_Bool bSelected;
+ sal_Bool bSelectable;
+};
+
+ScAccessibleShapeData::~ScAccessibleShapeData()
+{
+ if (pAccShape)
+ {
+ pAccShape->dispose();
+ pAccShape->release();
+ }
+}
+
+struct ScShapeDataLess
+{
+ rtl::OUString msLayerId;
+ rtl::OUString msZOrder;
+ ScShapeDataLess()
+ : msLayerId(RTL_CONSTASCII_USTRINGPARAM( "LayerID" )),
+ msZOrder(RTL_CONSTASCII_USTRINGPARAM( "ZOrder" ))
+ {
+ }
+ void ConvertLayerId(sal_Int16& rLayerID) const // changes the number of the LayerId so it the accessibility order
+ {
+ switch (rLayerID)
+ {
+ case SC_LAYER_FRONT:
+ rLayerID = 1;
+ break;
+ case SC_LAYER_BACK:
+ rLayerID = 0;
+ break;
+ case SC_LAYER_INTERN:
+ rLayerID = 2;
+ break;
+ case SC_LAYER_CONTROLS:
+ rLayerID = 3;
+ break;
+ }
+ }
+ sal_Bool LessThanSheet(const ScAccessibleShapeData* pData) const
+ {
+ sal_Bool bResult(false);
+ uno::Reference< beans::XPropertySet> xProps(pData->xShape, uno::UNO_QUERY);
+ if (xProps.is())
+ {
+ uno::Any aPropAny = xProps->getPropertyValue(msLayerId);
+ sal_Int16 nLayerID = 0;
+ if( (aPropAny >>= nLayerID) )
+ {
+ if (nLayerID == SC_LAYER_BACK)
+ bResult = sal_True;
+ }
+ }
+ return bResult;
+ }
+ sal_Bool operator()(const ScAccessibleShapeData* pData1, const ScAccessibleShapeData* pData2) const
+ {
+ sal_Bool bResult(false);
+ if (pData1 && pData2)
+ {
+ uno::Reference< beans::XPropertySet> xProps1(pData1->xShape, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet> xProps2(pData2->xShape, uno::UNO_QUERY);
+ if (xProps1.is() && xProps2.is())
+ {
+ uno::Any aPropAny1 = xProps1->getPropertyValue(msLayerId);
+ uno::Any aPropAny2 = xProps2->getPropertyValue(msLayerId);
+ sal_Int16 nLayerID1(0);
+ sal_Int16 nLayerID2(0);
+ if( (aPropAny1 >>= nLayerID1) && (aPropAny2 >>= nLayerID2) )
+ {
+ if (nLayerID1 == nLayerID2)
+ {
+ uno::Any aAny1 = xProps1->getPropertyValue(msZOrder);
+ sal_Int32 nZOrder1 = 0;
+ uno::Any aAny2 = xProps2->getPropertyValue(msZOrder);
+ sal_Int32 nZOrder2 = 0;
+ if ( (aAny1 >>= nZOrder1) && (aAny2 >>= nZOrder2) )
+ bResult = (nZOrder1 < nZOrder2);
+ }
+ else
+ {
+ ConvertLayerId(nLayerID1);
+ ConvertLayerId(nLayerID2);
+ bResult = (nLayerID1 < nLayerID2);
+ }
+ }
+ }
+ }
+ else if (pData1 && !pData2)
+ bResult = LessThanSheet(pData1);
+ else if (!pData1 && pData2)
+ bResult = !LessThanSheet(pData2);
+ else
+ bResult = false;
+ return bResult;
+ }
+};
+
+struct DeselectShape
+{
+ void operator() (const ScAccessibleShapeData* pAccShapeData) const
+ {
+ if (pAccShapeData)
+ {
+ pAccShapeData->bSelected = false;
+ if (pAccShapeData->pAccShape)
+ pAccShapeData->pAccShape->ResetState(AccessibleStateType::SELECTED);
+ }
+ }
+};
+
+struct SelectShape
+{
+ uno::Reference < drawing::XShapes > xShapes;
+ SelectShape(uno::Reference<drawing::XShapes>& xTemp) : xShapes(xTemp) {}
+ void operator() (const ScAccessibleShapeData* pAccShapeData) const
+ {
+ if (pAccShapeData && pAccShapeData->bSelectable)
+ {
+ pAccShapeData->bSelected = sal_True;
+ if (pAccShapeData->pAccShape)
+ pAccShapeData->pAccShape->SetState(AccessibleStateType::SELECTED);
+ if (xShapes.is())
+ xShapes->add(pAccShapeData->xShape);
+ }
+ }
+};
+
+struct Destroy
+{
+ void operator() (ScAccessibleShapeData* pData)
+ {
+ if (pData)
+ DELETEZ(pData);
+ }
+};
+
+class ScChildrenShapes : public SfxListener,
+ public ::accessibility::IAccessibleParent
+{
+public:
+ ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
+ ~ScChildrenShapes();
+
+ ///===== SfxListener =====================================================
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ ///===== IAccessibleParent ===============================================
+
+ virtual sal_Bool ReplaceChild (
+ ::accessibility::AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) throw (::com::sun::star::uno::RuntimeException);
+
+ ///===== Internal ========================================================
+ void SetDrawBroadcaster();
+
+ sal_Int32 GetCount() const;
+ uno::Reference< XAccessible > Get(const ScAccessibleShapeData* pData) const;
+ uno::Reference< XAccessible > Get(sal_Int32 nIndex) const;
+ uno::Reference< XAccessible > GetAt(const awt::Point& rPoint) const;
+
+ // gets the index of the shape starting on 0 (without the index of the table)
+ // returns the selected shape
+ sal_Bool IsSelected(sal_Int32 nIndex,
+ com::sun::star::uno::Reference<com::sun::star::drawing::XShape>& rShape) const;
+
+ sal_Bool SelectionChanged();
+
+ void Select(sal_Int32 nIndex);
+ void DeselectAll(); // deselect also the table
+ void SelectAll();
+ sal_Int32 GetSelectedCount() const;
+ uno::Reference< XAccessible > GetSelected(sal_Int32 nSelectedChildIndex, sal_Bool bTabSelected) const;
+ void Deselect(sal_Int32 nChildIndex);
+
+ SdrPage* GetDrawPage() const;
+
+ utl::AccessibleRelationSetHelper* GetRelationSet(const ScAddress* pAddress) const;
+
+ void VisAreaChanged() const;
+private:
+ typedef std::vector<ScAccessibleShapeData*> SortedShapes;
+
+ mutable SortedShapes maZOrderedShapes; // a null pointer represents the sheet in the correct order
+
+ mutable ::accessibility::AccessibleShapeTreeInfo maShapeTreeInfo;
+ mutable com::sun::star::uno::Reference<com::sun::star::view::XSelectionSupplier> xSelectionSupplier;
+ mutable sal_uInt32 mnSdrObjCount;
+ mutable sal_uInt32 mnShapesSelected;
+ ScTabViewShell* mpViewShell;
+ ScAccessibleDocument* mpAccessibleDocument;
+ ScSplitPos meSplitPos;
+
+ void FillShapes(std::vector < uno::Reference < drawing::XShape > >& rShapes) const;
+ sal_Bool FindSelectedShapesChanges(const com::sun::star::uno::Reference<com::sun::star::drawing::XShapes>& xShapes, sal_Bool bCommitChange) const;
+ void FillSelectionSupplier() const;
+
+ ScAddress* GetAnchor(const uno::Reference<drawing::XShape>& xShape) const;
+ uno::Reference<XAccessibleRelationSet> GetRelationSet(const ScAccessibleShapeData* pData) const;
+ void CheckWhetherAnchorChanged(const uno::Reference<drawing::XShape>& xShape) const;
+ void SetAnchor(const uno::Reference<drawing::XShape>& xShape, ScAccessibleShapeData* pData) const;
+ void AddShape(const uno::Reference<drawing::XShape>& xShape, sal_Bool bCommitChange) const;
+ void RemoveShape(const uno::Reference<drawing::XShape>& xShape) const;
+
+ sal_Bool FindShape(const uno::Reference<drawing::XShape>& xShape, SortedShapes::iterator& rItr) const;
+
+ sal_Int8 Compare(const ScAccessibleShapeData* pData1,
+ const ScAccessibleShapeData* pData2) const;
+};
+
+ScChildrenShapes::ScChildrenShapes(ScAccessibleDocument* pAccessibleDocument, ScTabViewShell* pViewShell, ScSplitPos eSplitPos)
+ :
+ mnShapesSelected(0),
+ mpViewShell(pViewShell),
+ mpAccessibleDocument(pAccessibleDocument),
+ meSplitPos(eSplitPos)
+{
+ FillSelectionSupplier();
+ maZOrderedShapes.push_back(NULL); // add an element which represents the table
+
+ GetCount(); // fill list with filtered shapes (no internal shapes)
+
+ if (mnShapesSelected)
+ {
+ //set flag on every selected shape
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ uno::Reference<drawing::XShapes> xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ if (xShapes.is())
+ FindSelectedShapesChanges(xShapes, false);
+ }
+ if (pViewShell)
+ {
+ SfxBroadcaster* pDrawBC = pViewShell->GetViewData()->GetDocument()->GetDrawBroadcaster();
+ if (pDrawBC)
+ {
+ StartListening(*pDrawBC);
+
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(pViewShell->GetViewData()->GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetSdrView(pViewShell->GetViewData()->GetScDrawView());
+ maShapeTreeInfo.SetController(NULL);
+ maShapeTreeInfo.SetWindow(pViewShell->GetWindowByPos(meSplitPos));
+ maShapeTreeInfo.SetViewForwarder(mpAccessibleDocument);
+ }
+ }
+}
+
+ScChildrenShapes::~ScChildrenShapes()
+{
+ std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), Destroy());
+ if (mpViewShell)
+ {
+ SfxBroadcaster* pDrawBC = mpViewShell->GetViewData()->GetDocument()->GetDrawBroadcaster();
+ if (pDrawBC)
+ EndListening(*pDrawBC);
+ }
+}
+
+void ScChildrenShapes::SetDrawBroadcaster()
+{
+ if (mpViewShell)
+ {
+ SfxBroadcaster* pDrawBC = mpViewShell->GetViewData()->GetDocument()->GetDrawBroadcaster();
+ if (pDrawBC)
+ {
+ StartListening(*pDrawBC, sal_True);
+
+ maShapeTreeInfo.SetModelBroadcaster( new ScDrawModelBroadcaster(mpViewShell->GetViewData()->GetDocument()->GetDrawLayer()) );
+ maShapeTreeInfo.SetSdrView(mpViewShell->GetViewData()->GetScDrawView());
+ maShapeTreeInfo.SetController(NULL);
+ maShapeTreeInfo.SetWindow(mpViewShell->GetWindowByPos(meSplitPos));
+ maShapeTreeInfo.SetViewForwarder(mpAccessibleDocument);
+ }
+ }
+}
+
+void ScChildrenShapes::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+ if ( rHint.ISA( SdrHint ) )
+ {
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ if (pSdrHint)
+ {
+ SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
+ if (pObj && /*(pObj->GetLayer() != SC_LAYER_INTERN) && */(pObj->GetPage() == GetDrawPage()) &&
+ (pObj->GetPage() == pObj->GetObjList()) ) //only do something if the object lies direct on the page
+ {
+ switch (pSdrHint->GetKind())
+ {
+ case HINT_OBJCHG : // Objekt geaendert
+ {
+ uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+ if (xShape.is())
+ {
+ ScShapeDataLess aLess;
+ std::sort(maZOrderedShapes.begin(), maZOrderedShapes.end(), aLess); // sort, because the z index or layer could be changed
+ CheckWhetherAnchorChanged(xShape);
+ }
+ }
+ break;
+ case HINT_OBJINSERTED : // Neues Zeichenobjekt eingefuegt
+ {
+ uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+ if (xShape.is())
+ AddShape(xShape, sal_True);
+ }
+ break;
+ case HINT_OBJREMOVED : // Zeichenobjekt aus Liste entfernt
+ {
+ uno::Reference<drawing::XShape> xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+ if (xShape.is())
+ RemoveShape(xShape);
+ }
+ break;
+ default :
+ {
+ // other events are not interesting
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+sal_Bool ScChildrenShapes::ReplaceChild (::accessibility::AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex, const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo)
+ throw (uno::RuntimeException)
+{
+ // create the new child
+ ::accessibility::AccessibleShape* pReplacement = ::accessibility::ShapeTypeHandler::Instance().CreateAccessibleObject (
+ ::accessibility::AccessibleShapeInfo ( _rxShape, pCurrentChild->getAccessibleParent(), this, _nIndex ),
+ _rShapeTreeInfo
+ );
+ ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xNewChild( pReplacement ); // keep this alive (do this before calling Init!)
+ if ( pReplacement )
+ pReplacement->Init();
+
+ sal_Bool bResult(false);
+ if (pCurrentChild && pReplacement)
+ {
+ DBG_ASSERT(pCurrentChild->GetXShape().get() == pReplacement->GetXShape().get(), "XShape changes and should be inserted sorted");
+ SortedShapes::iterator aItr;
+ FindShape(pCurrentChild->GetXShape(), aItr);
+ if (aItr != maZOrderedShapes.end() && (*aItr))
+ {
+ if ((*aItr)->pAccShape)
+ {
+ DBG_ASSERT((*aItr)->pAccShape == pCurrentChild, "wrong child found");
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(mpAccessibleDocument);
+ aEvent.OldValue <<= uno::makeAny(uno::Reference<XAccessible>(pCurrentChild));
+
+ mpAccessibleDocument->CommitChange(aEvent); // child is gone - event
+
+ pCurrentChild->dispose();
+ }
+ (*aItr)->pAccShape = pReplacement;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(mpAccessibleDocument);
+ aEvent.NewValue <<= uno::makeAny(uno::Reference<XAccessible>(pReplacement));
+
+ mpAccessibleDocument->CommitChange(aEvent); // child is new - event
+ bResult = sal_True;
+ }
+ }
+ return bResult;
+}
+
+sal_Int32 ScChildrenShapes::GetCount() const
+{
+ SdrPage* pDrawPage = GetDrawPage();
+ if (pDrawPage && (maZOrderedShapes.size() == 1)) // the table is always in
+ {
+ mnSdrObjCount = pDrawPage->GetObjCount();
+ maZOrderedShapes.reserve(mnSdrObjCount + 1); // the table is always in
+ for (sal_uInt32 i = 0; i < mnSdrObjCount; ++i)
+ {
+ SdrObject* pObj = pDrawPage->GetObj(i);
+ if (pObj/* && (pObj->GetLayer() != SC_LAYER_INTERN)*/)
+ {
+ uno::Reference< drawing::XShape > xShape (pObj->getUnoShape(), uno::UNO_QUERY);
+ AddShape(xShape, false); //inserts in the correct order
+ }
+ }
+ }
+ return maZOrderedShapes.size();
+}
+
+uno::Reference< XAccessible > ScChildrenShapes::Get(const ScAccessibleShapeData* pData) const
+{
+ if (!pData)
+ return NULL;
+
+ if (!pData->pAccShape)
+ {
+ ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
+ ::accessibility::AccessibleShapeInfo aShapeInfo(pData->xShape, mpAccessibleDocument, const_cast<ScChildrenShapes*>(this));
+ pData->pAccShape = rShapeHandler.CreateAccessibleObject(
+ aShapeInfo, maShapeTreeInfo);
+ if (pData->pAccShape)
+ {
+ pData->pAccShape->acquire();
+ pData->pAccShape->Init();
+ if (pData->bSelected)
+ pData->pAccShape->SetState(AccessibleStateType::SELECTED);
+ if (!pData->bSelectable)
+ pData->pAccShape->ResetState(AccessibleStateType::SELECTABLE);
+ pData->pAccShape->SetRelationSet(GetRelationSet(pData));
+ }
+ }
+ return pData->pAccShape;
+ }
+
+uno::Reference< XAccessible > ScChildrenShapes::Get(sal_Int32 nIndex) const
+{
+ if (maZOrderedShapes.size() <= 1)
+ GetCount(); // fill list with filtered shapes (no internal shapes)
+
+ if (static_cast<sal_uInt32>(nIndex) >= maZOrderedShapes.size())
+ return NULL;
+
+ return Get(maZOrderedShapes[nIndex]);
+}
+
+uno::Reference< XAccessible > ScChildrenShapes::GetAt(const awt::Point& rPoint) const
+{
+ uno::Reference<XAccessible> xAccessible;
+ if(mpViewShell)
+ {
+ sal_Int32 i(maZOrderedShapes.size() - 1);
+ sal_Bool bFound(false);
+ while (!bFound && i >= 0)
+ {
+ ScAccessibleShapeData* pShape = maZOrderedShapes[i];
+ if (pShape)
+ {
+ if (!pShape->pAccShape)
+ Get(pShape);
+
+ if (pShape->pAccShape)
+ {
+ Point aPoint(VCLPoint(rPoint));
+ aPoint -= VCLRectangle(pShape->pAccShape->getBounds()).TopLeft();
+ if (pShape->pAccShape->containsPoint(AWTPoint(aPoint)))
+ {
+ xAccessible = pShape->pAccShape;
+ bFound = sal_True;
+ }
+ }
+ else
+ {
+ DBG_ERRORFILE("I should have an accessible shape now!");
+ }
+ }
+ else
+ bFound = sal_True; // this is the sheet and it lies before the rest of the shapes which are background shapes
+
+ --i;
+ }
+ }
+ return xAccessible;
+}
+
+sal_Bool ScChildrenShapes::IsSelected(sal_Int32 nIndex,
+ uno::Reference<drawing::XShape>& rShape) const
+{
+ sal_Bool bResult (false);
+ if (maZOrderedShapes.size() <= 1)
+ GetCount(); // fill list with filtered shapes (no internal shapes)
+
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ if (!maZOrderedShapes[nIndex])
+ return false;
+
+ bResult = maZOrderedShapes[nIndex]->bSelected;
+ rShape = maZOrderedShapes[nIndex]->xShape;
+
+#ifdef DBG_UTIL // test whether it is truly selected by a slower method
+ uno::Reference< drawing::XShape > xReturnShape;
+ sal_Bool bDebugResult(false);
+ uno::Reference<container::XIndexAccess> xIndexAccess;
+ xSelectionSupplier->getSelection() >>= xIndexAccess;
+
+ if (xIndexAccess.is())
+ {
+ sal_Int32 nCount(xIndexAccess->getCount());
+ if (nCount)
+ {
+ uno::Reference< drawing::XShape > xShape;
+ uno::Reference< drawing::XShape > xIndexShape = maZOrderedShapes[nIndex]->xShape;
+ sal_Int32 i(0);
+ while (!bDebugResult && (i < nCount))
+ {
+ xIndexAccess->getByIndex(i) >>= xShape;
+ if (xShape.is() && (xIndexShape.get() == xShape.get()))
+ {
+ bDebugResult = sal_True;
+ xReturnShape = xShape;
+ }
+ else
+ ++i;
+ }
+ }
+ }
+ DBG_ASSERT((bResult == bDebugResult) && ((bResult && (rShape.get() == xReturnShape.get())) || !bResult), "found the wrong shape or result");
+#endif
+
+ return bResult;
+}
+
+sal_Bool ScChildrenShapes::SelectionChanged()
+{
+ sal_Bool bResult(false);
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ uno::Reference<drawing::XShapes> xShapes(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+
+ bResult = FindSelectedShapesChanges(xShapes, sal_True);
+
+ return bResult;
+}
+
+void ScChildrenShapes::Select(sal_Int32 nIndex)
+{
+ if (maZOrderedShapes.size() <= 1)
+ GetCount(); // fill list with filtered shapes (no internal shapes)
+
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ if (!maZOrderedShapes[nIndex])
+ return;
+
+ uno::Reference<drawing::XShape> xShape;
+ if (!IsSelected(nIndex, xShape) && maZOrderedShapes[nIndex]->bSelectable)
+ {
+ uno::Reference<drawing::XShapes> xShapes;
+ xSelectionSupplier->getSelection() >>= xShapes;
+
+ if (!xShapes.is())
+ xShapes = new SvxShapeCollection();
+
+ xShapes->add(maZOrderedShapes[nIndex]->xShape);
+
+ try
+ {
+ xSelectionSupplier->select(uno::makeAny(xShapes));
+ maZOrderedShapes[nIndex]->bSelected = sal_True;
+ if (maZOrderedShapes[nIndex]->pAccShape)
+ maZOrderedShapes[nIndex]->pAccShape->SetState(AccessibleStateType::SELECTED);
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+ }
+}
+
+void ScChildrenShapes::DeselectAll()
+{
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ sal_Bool bSomethingSelected(sal_True);
+ try
+ {
+ xSelectionSupplier->select(uno::Any()); //deselects all
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ DBG_ERRORFILE("nothing selected before");
+ bSomethingSelected = false;
+ }
+
+ if (bSomethingSelected)
+ std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), DeselectShape());
+}
+
+void ScChildrenShapes::SelectAll()
+{
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ if (maZOrderedShapes.size() <= 1)
+ GetCount(); // fill list with filtered shapes (no internal shapes)
+
+ if (maZOrderedShapes.size() > 1)
+ {
+ uno::Reference<drawing::XShapes> xShapes;
+ xShapes = new SvxShapeCollection();
+
+ try
+ {
+ std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), SelectShape(xShapes));
+ xSelectionSupplier->select(uno::makeAny(xShapes));
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ SelectionChanged(); // find all selected shapes and set the flags
+ }
+ }
+}
+
+void ScChildrenShapes::FillShapes(std::vector < uno::Reference < drawing::XShape > >& rShapes) const
+{
+ uno::Reference<container::XIndexAccess> xIndexAccess;
+ xSelectionSupplier->getSelection() >>= xIndexAccess;
+
+ if (xIndexAccess.is())
+ {
+ sal_uInt32 nCount(xIndexAccess->getCount());
+ for (sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ uno::Reference<drawing::XShape> xShape;
+ xIndexAccess->getByIndex(i) >>= xShape;
+ if (xShape.is())
+ rShapes.push_back(xShape);
+ }
+ }
+}
+
+sal_Int32 ScChildrenShapes::GetSelectedCount() const
+{
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ std::vector < uno::Reference < drawing::XShape > > aShapes;
+ FillShapes(aShapes);
+
+ return aShapes.size();
+}
+
+uno::Reference< XAccessible > ScChildrenShapes::GetSelected(sal_Int32 nSelectedChildIndex, sal_Bool bTabSelected) const
+{
+ uno::Reference< XAccessible > xAccessible;
+
+ if (maZOrderedShapes.size() <= 1)
+ GetCount(); // fill list with shapes
+
+ if (!bTabSelected)
+ {
+ std::vector < uno::Reference < drawing::XShape > > aShapes;
+ FillShapes(aShapes);
+
+ SortedShapes::iterator aItr;
+ if (FindShape(aShapes[nSelectedChildIndex], aItr))
+ xAccessible = Get(aItr - maZOrderedShapes.begin());
+ }
+ else
+ {
+ SortedShapes::iterator aItr = maZOrderedShapes.begin();
+ SortedShapes::iterator aEndItr = maZOrderedShapes.end();
+ sal_Bool bFound(false);
+ while(!bFound && aItr != aEndItr)
+ {
+ if (*aItr)
+ {
+ if ((*aItr)->bSelected)
+ {
+ if (nSelectedChildIndex == 0)
+ bFound = sal_True;
+ else
+ --nSelectedChildIndex;
+ }
+ }
+ else
+ {
+ if (nSelectedChildIndex == 0)
+ bFound = sal_True;
+ else
+ --nSelectedChildIndex;
+ }
+ if (!bFound)
+ ++aItr;
+ }
+ if (bFound && *aItr)
+ xAccessible = (*aItr)->pAccShape;
+ }
+
+ return xAccessible;
+}
+
+void ScChildrenShapes::Deselect(sal_Int32 nChildIndex)
+{
+ uno::Reference<drawing::XShape> xShape;
+ if (IsSelected(nChildIndex, xShape)) // returns false if it is the sheet
+ {
+ if (xShape.is())
+ {
+ uno::Reference<drawing::XShapes> xShapes;
+ xSelectionSupplier->getSelection() >>= xShapes;
+ if (xShapes.is())
+ xShapes->remove(xShape);
+
+ try
+ {
+ xSelectionSupplier->select(uno::makeAny(xShapes));
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ DBG_ERRORFILE("something not selectable");
+ }
+
+ maZOrderedShapes[nChildIndex]->bSelected = false;
+ if (maZOrderedShapes[nChildIndex]->pAccShape)
+ maZOrderedShapes[nChildIndex]->pAccShape->ResetState(AccessibleStateType::SELECTED);
+ }
+ }
+}
+
+
+SdrPage* ScChildrenShapes::GetDrawPage() const
+{
+ SCTAB nTab(mpAccessibleDocument->getVisibleTable());
+ SdrPage* pDrawPage = NULL;
+ if (mpViewShell)
+ {
+ ScDocument* pDoc = mpViewShell->GetViewData()->GetDocument();
+ if (pDoc && pDoc->GetDrawLayer())
+ {
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
+ pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
+ }
+ }
+ return pDrawPage;
+}
+
+struct SetRelation
+{
+ const ScChildrenShapes* mpChildrenShapes;
+ mutable utl::AccessibleRelationSetHelper* mpRelationSet;
+ const ScAddress* mpAddress;
+ SetRelation(const ScChildrenShapes* pChildrenShapes, const ScAddress* pAddress)
+ :
+ mpChildrenShapes(pChildrenShapes),
+ mpRelationSet(NULL),
+ mpAddress(pAddress)
+ {
+ }
+ void operator() (const ScAccessibleShapeData* pAccShapeData) const
+ {
+ if (pAccShapeData &&
+ ((!pAccShapeData->pRelationCell && !mpAddress) ||
+ (pAccShapeData->pRelationCell && mpAddress && (*(pAccShapeData->pRelationCell) == *mpAddress))))
+ {
+ if (!mpRelationSet)
+ mpRelationSet = new utl::AccessibleRelationSetHelper();
+
+ AccessibleRelation aRelation;
+ aRelation.TargetSet.realloc(1);
+ aRelation.TargetSet[0] = mpChildrenShapes->Get(pAccShapeData);
+ aRelation.RelationType = AccessibleRelationType::CONTROLLER_FOR;
+
+ mpRelationSet->AddRelation(aRelation);
+ }
+ }
+};
+
+utl::AccessibleRelationSetHelper* ScChildrenShapes::GetRelationSet(const ScAddress* pAddress) const
+{
+ SetRelation aSetRelation(this, pAddress);
+ ::std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), aSetRelation);
+ return aSetRelation.mpRelationSet;
+}
+
+sal_Bool ScChildrenShapes::FindSelectedShapesChanges(const uno::Reference<drawing::XShapes>& xShapes, sal_Bool /* bCommitChange */) const
+{
+ sal_Bool bResult(false);
+ SortedShapes aShapesList;
+ uno::Reference<container::XIndexAccess> xIndexAcc(xShapes, uno::UNO_QUERY);
+ if (xIndexAcc.is())
+ {
+ mnShapesSelected = xIndexAcc->getCount();
+ for (sal_uInt32 i = 0; i < mnShapesSelected; ++i)
+ {
+ uno::Reference< drawing::XShape > xShape;
+ xIndexAcc->getByIndex(i) >>= xShape;
+ if (xShape.is())
+ {
+ ScAccessibleShapeData* pShapeData = new ScAccessibleShapeData();
+ pShapeData->xShape = xShape;
+ aShapesList.push_back(pShapeData);
+ }
+ }
+ }
+ else
+ mnShapesSelected = 0;
+ ScShapeDataLess aLess;
+ std::sort(aShapesList.begin(), aShapesList.end(), aLess);
+
+ SortedShapes::iterator aXShapesItr(aShapesList.begin());
+ SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
+ SortedShapes::iterator aDataItr(maZOrderedShapes.begin());
+ SortedShapes::const_iterator aDataEndItr(maZOrderedShapes.end());
+ SortedShapes::const_iterator aFocusedItr = aDataEndItr;
+ while((aDataItr != aDataEndItr))
+ {
+ if (*aDataItr) // is it realy a shape or only the sheet
+ {
+ sal_Int8 nComp(0);
+ if (aXShapesItr == aXShapesEndItr)
+ nComp = -1; // simulate that the Shape is lower, so the selction state will be removed
+ else
+ nComp = Compare(*aDataItr, *aXShapesItr);
+ if (nComp == 0)
+ {
+ if (!(*aDataItr)->bSelected)
+ {
+ (*aDataItr)->bSelected = sal_True;
+ if ((*aDataItr)->pAccShape)
+ {
+ (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
+ (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
+ bResult = sal_True;
+ }
+ aFocusedItr = aDataItr;
+ }
+ ++aDataItr;
+ ++aXShapesItr;
+ }
+ else if (nComp < 0)
+ {
+ if ((*aDataItr)->bSelected)
+ {
+ (*aDataItr)->bSelected = false;
+ if ((*aDataItr)->pAccShape)
+ {
+ (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
+ (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
+ bResult = sal_True;
+ }
+ }
+ ++aDataItr;
+ }
+ else
+ {
+ DBG_ERRORFILE("here is a selected shape which is not in the childlist");
+ ++aXShapesItr;
+ --mnShapesSelected;
+ }
+ }
+ else
+ ++aDataItr;
+ }
+ if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1))
+ (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
+
+ std::for_each(aShapesList.begin(), aShapesList.end(), Destroy());
+
+ return bResult;
+}
+
+void ScChildrenShapes::FillSelectionSupplier() const
+{
+ if (!xSelectionSupplier.is() && mpViewShell)
+ {
+ SfxViewFrame* pViewFrame = mpViewShell->GetViewFrame();
+ if (pViewFrame)
+ {
+ xSelectionSupplier = uno::Reference<view::XSelectionSupplier>(pViewFrame->GetFrame().GetController(), uno::UNO_QUERY);
+ if (xSelectionSupplier.is())
+ {
+ if (mpAccessibleDocument)
+ xSelectionSupplier->addSelectionChangeListener(mpAccessibleDocument);
+ uno::Reference<drawing::XShapes> xShapes (xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ if (xShapes.is())
+ mnShapesSelected = xShapes->getCount();
+ }
+ }
+ }
+}
+
+ScAddress* ScChildrenShapes::GetAnchor(const uno::Reference<drawing::XShape>& xShape) const
+{
+ ScAddress* pAddress = NULL;
+ if (mpViewShell)
+ {
+ SvxShape* pShapeImp = SvxShape::getImplementation(xShape);
+ uno::Reference<beans::XPropertySet> xShapeProp(xShape, uno::UNO_QUERY);
+ if (pShapeImp && xShapeProp.is())
+ {
+ if (SdrObject *pSdrObj = pShapeImp->GetSdrObject())
+ {
+ if (ScDrawObjData *pAnchor = ScDrawLayer::GetObjData(pSdrObj))
+ return new ScAddress(pAnchor->maStart);
+ }
+ }
+ }
+
+ return pAddress;
+}
+
+uno::Reference<XAccessibleRelationSet> ScChildrenShapes::GetRelationSet(const ScAccessibleShapeData* pData) const
+{
+ utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper();
+
+ if(pData && pRelationSet && mpAccessibleDocument)
+ {
+ uno::Reference<XAccessible> xAccessible = mpAccessibleDocument->GetAccessibleSpreadsheet(); // should be the current table
+ if (pData->pRelationCell && xAccessible.is())
+ {
+ uno::Reference<XAccessibleTable> xAccTable (xAccessible->getAccessibleContext(), uno::UNO_QUERY);
+ if (xAccTable.is())
+ xAccessible = xAccTable->getAccessibleCellAt(pData->pRelationCell->Row(), pData->pRelationCell->Col());
+ }
+ AccessibleRelation aRelation;
+ aRelation.TargetSet.realloc(1);
+ aRelation.TargetSet[0] = xAccessible;
+ aRelation.RelationType = AccessibleRelationType::CONTROLLED_BY;
+ pRelationSet->AddRelation(aRelation);
+ }
+
+ return pRelationSet;
+}
+
+void ScChildrenShapes::CheckWhetherAnchorChanged(const uno::Reference<drawing::XShape>& xShape) const
+{
+ SortedShapes::iterator aItr;
+ if (FindShape(xShape, aItr))
+ SetAnchor(xShape, *aItr);
+}
+
+void ScChildrenShapes::SetAnchor(const uno::Reference<drawing::XShape>& xShape, ScAccessibleShapeData* pData) const
+{
+ if (pData)
+ {
+ ScAddress* pAddress = GetAnchor(xShape);
+ if ((pAddress && pData->pRelationCell && (*pAddress != *(pData->pRelationCell))) ||
+ (!pAddress && pData->pRelationCell) || (pAddress && !pData->pRelationCell))
+ {
+ if (pData->pRelationCell)
+ delete pData->pRelationCell;
+ pData->pRelationCell = pAddress;
+ if (pData->pAccShape)
+ pData->pAccShape->SetRelationSet(GetRelationSet(pData));
+ }
+ }
+}
+
+void ScChildrenShapes::AddShape(const uno::Reference<drawing::XShape>& xShape, sal_Bool bCommitChange) const
+{
+ SortedShapes::iterator aFindItr;
+ if (!FindShape(xShape, aFindItr))
+ {
+ ScAccessibleShapeData* pShape = new ScAccessibleShapeData();
+ pShape->xShape = xShape;
+ SortedShapes::iterator aNewItr = maZOrderedShapes.insert(aFindItr, pShape);
+ SetAnchor(xShape, pShape);
+
+ uno::Reference< beans::XPropertySet > xShapeProp(xShape, uno::UNO_QUERY);
+ if (xShapeProp.is())
+ {
+ uno::Any aPropAny = xShapeProp->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "LayerID" )));
+ sal_Int16 nLayerID = 0;
+ if( aPropAny >>= nLayerID )
+ {
+ if( (nLayerID == SC_LAYER_INTERN) || (nLayerID == SC_LAYER_HIDDEN) )
+ pShape->bSelectable = false;
+ else
+ pShape->bSelectable = sal_True;
+ }
+ }
+
+
+ if (!xSelectionSupplier.is())
+ throw uno::RuntimeException();
+
+ uno::Reference<container::XEnumerationAccess> xEnumAcc(xSelectionSupplier->getSelection(), uno::UNO_QUERY);
+ if (xEnumAcc.is())
+ {
+ uno::Reference<container::XEnumeration> xEnum = xEnumAcc->createEnumeration();
+ if (xEnum.is())
+ {
+ uno::Reference<drawing::XShape> xSelectedShape;
+ sal_Bool bFound(false);
+ while (!bFound && xEnum->hasMoreElements())
+ {
+ xEnum->nextElement() >>= xSelectedShape;
+ if (xShape.is() && (xShape.get() == xSelectedShape.get()))
+ {
+ pShape->bSelected = sal_True;
+ bFound = sal_True;
+ }
+ }
+ }
+ }
+ if (mpAccessibleDocument && bCommitChange)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(mpAccessibleDocument);
+ aEvent.NewValue <<= Get(aNewItr - maZOrderedShapes.begin());
+
+ mpAccessibleDocument->CommitChange(aEvent); // new child - event
+ }
+ }
+ else
+ {
+ DBG_ERRORFILE("shape is always in the list");
+ }
+}
+
+void ScChildrenShapes::RemoveShape(const uno::Reference<drawing::XShape>& xShape) const
+{
+ SortedShapes::iterator aItr;
+ if (FindShape(xShape, aItr))
+ {
+ if (mpAccessibleDocument)
+ {
+ uno::Reference<XAccessible> xOldAccessible (Get(aItr - maZOrderedShapes.begin()));
+
+ delete *aItr;
+ maZOrderedShapes.erase(aItr);
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(mpAccessibleDocument);
+ aEvent.OldValue <<= uno::makeAny(xOldAccessible);
+
+ mpAccessibleDocument->CommitChange(aEvent); // child is gone - event
+ }
+ else
+ {
+ delete *aItr;
+ maZOrderedShapes.erase(aItr);
+ }
+ }
+ else
+ {
+ DBG_ERRORFILE("shape was not in internal list");
+ }
+}
+
+sal_Bool ScChildrenShapes::FindShape(const uno::Reference<drawing::XShape>& xShape, ScChildrenShapes::SortedShapes::iterator& rItr) const
+{
+ sal_Bool bResult(false);
+ ScAccessibleShapeData aShape;
+ aShape.xShape = xShape;
+ ScShapeDataLess aLess;
+ rItr = std::lower_bound(maZOrderedShapes.begin(), maZOrderedShapes.end(), &aShape, aLess);
+ if ((rItr != maZOrderedShapes.end()) && (*rItr != NULL) && ((*rItr)->xShape.get() == xShape.get()))
+ bResult = sal_True; // if the shape is found
+
+#ifdef DBG_UTIL // test whether it finds truly the correct shape (perhaps it is not really sorted)
+ SortedShapes::iterator aDebugItr = maZOrderedShapes.begin();
+ SortedShapes::iterator aEndItr = maZOrderedShapes.end();
+ sal_Bool bFound(false);
+ while (!bFound && aDebugItr != aEndItr)
+ {
+ if (*aDebugItr && ((*aDebugItr)->xShape.get() == xShape.get()))
+ bFound = sal_True;
+ else
+ ++aDebugItr;
+ }
+ sal_Bool bResult2 = (aDebugItr != maZOrderedShapes.end());
+ DBG_ASSERT((bResult == bResult2) && ((bResult && (rItr == aDebugItr)) || !bResult), "wrong Shape found");
+#endif
+ return bResult;
+}
+
+sal_Int8 ScChildrenShapes::Compare(const ScAccessibleShapeData* pData1,
+ const ScAccessibleShapeData* pData2) const
+{
+ ScShapeDataLess aLess;
+
+ sal_Bool bResult1(aLess(pData1, pData2));
+ sal_Bool bResult2(aLess(pData2, pData1));
+
+ sal_Int8 nResult(0);
+ if (!bResult1 && bResult2)
+ nResult = 1;
+ else if (bResult1 && !bResult2)
+ nResult = -1;
+
+ return nResult;
+}
+
+struct ScVisAreaChanged
+{
+ ScAccessibleDocument* mpAccDoc;
+ ScVisAreaChanged(ScAccessibleDocument* pAccDoc) : mpAccDoc(pAccDoc) {}
+ void operator() (const ScAccessibleShapeData* pAccShapeData) const
+ {
+ if (pAccShapeData && pAccShapeData->pAccShape)
+ {
+ pAccShapeData->pAccShape->ViewForwarderChanged(::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA, mpAccDoc);
+ }
+ }
+};
+
+void ScChildrenShapes::VisAreaChanged() const
+{
+ ScVisAreaChanged aVisAreaChanged(mpAccessibleDocument);
+ std::for_each(maZOrderedShapes.begin(), maZOrderedShapes.end(), aVisAreaChanged);
+}
+
+// ============================================================================
+
+ScAccessibleDocument::ScAccessibleDocument(
+ const uno::Reference<XAccessible>& rxParent,
+ ScTabViewShell* pViewShell,
+ ScSplitPos eSplitPos)
+ : ScAccessibleDocumentBase(rxParent),
+ mpViewShell(pViewShell),
+ meSplitPos(eSplitPos),
+ mpAccessibleSpreadsheet(NULL),
+ mpChildrenShapes(NULL),
+ mpTempAccEdit(NULL),
+ mbCompleteSheetSelected(false)
+{
+ if (pViewShell)
+ {
+ pViewShell->AddAccessibilityObject(*this);
+ Window *pWin = pViewShell->GetWindowByPos(eSplitPos);
+ if( pWin )
+ {
+ pWin->AddChildEventListener( LINK( this, ScAccessibleDocument, WindowChildEventListener ));
+ sal_uInt16 nCount = pWin->GetChildCount();
+ for( sal_uInt16 i=0; i < nCount; ++i )
+ {
+ Window *pChildWin = pWin->GetChild( i );
+ if( pChildWin &&
+ AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ AddChild( pChildWin->GetAccessible(), false );
+ }
+ }
+ if (pViewShell->GetViewData()->HasEditView( eSplitPos ))
+ {
+ uno::Reference<XAccessible> xAcc = new ScAccessibleEditObject(this, pViewShell->GetViewData()->GetEditView(eSplitPos),
+ pViewShell->GetWindowByPos(eSplitPos), GetCurrentCellName(), GetCurrentCellDescription(),
+ CellInEditMode);
+ AddChild(xAcc, false);
+ }
+ }
+ maVisArea = GetVisibleArea_Impl();
+}
+
+void ScAccessibleDocument::Init()
+{
+ if(!mpChildrenShapes)
+ mpChildrenShapes = new ScChildrenShapes(this, mpViewShell, meSplitPos);
+}
+
+ScAccessibleDocument::~ScAccessibleDocument(void)
+{
+ if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+}
+
+void SAL_CALL ScAccessibleDocument::disposing()
+{
+ SolarMutexGuard aGuard;
+ FreeAccessibleSpreadsheet();
+ if (mpViewShell)
+ {
+ Window *pWin = mpViewShell->GetWindowByPos(meSplitPos);
+ if( pWin )
+ pWin->RemoveChildEventListener( LINK( this, ScAccessibleDocument, WindowChildEventListener ));
+
+ mpViewShell->RemoveAccessibilityObject(*this);
+ mpViewShell = NULL;
+ }
+ if (mpChildrenShapes)
+ DELETEZ(mpChildrenShapes);
+
+ ScAccessibleDocumentBase::disposing();
+}
+
+void SAL_CALL ScAccessibleDocument::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+ disposing();
+}
+
+ //===== SfxListener =====================================================
+
+IMPL_LINK( ScAccessibleDocument, WindowChildEventListener, VclSimpleEvent*, pEvent )
+{
+ DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "Unknown WindowEvent!" );
+ if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+ {
+ VclWindowEvent *pVclEvent = static_cast< VclWindowEvent * >( pEvent );
+ DBG_ASSERT( pVclEvent->GetWindow(), "Window???" );
+ switch ( pVclEvent->GetId() )
+ {
+ case VCLEVENT_WINDOW_SHOW: // send create on show for direct accessible children
+ {
+ Window* pChildWin = static_cast < Window * >( pVclEvent->GetData() );
+ if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ {
+ AddChild( pChildWin->GetAccessible(), sal_True );
+ }
+ }
+ break;
+ case VCLEVENT_WINDOW_HIDE: // send destroy on hide for direct accessible children
+ {
+ Window* pChildWin = static_cast < Window * >( pVclEvent->GetData() );
+ if( pChildWin && AccessibleRole::EMBEDDED_OBJECT == pChildWin->GetAccessibleRole() )
+ {
+ RemoveChild( pChildWin->GetAccessible(), sal_True );
+ }
+ }
+ break;
+ }
+ }
+ return 0;
+}
+
+void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
+{
+ if (rHint.ISA( ScAccGridWinFocusLostHint ) )
+ {
+ const ScAccGridWinFocusLostHint& rRef = (const ScAccGridWinFocusLostHint&)rHint;
+ if (rRef.GetOldGridWin() == meSplitPos)
+ {
+ if (mxTempAcc.is() && mpTempAccEdit)
+ mpTempAccEdit->LostFocus();
+ else if (mpAccessibleSpreadsheet)
+ mpAccessibleSpreadsheet->LostFocus();
+ else
+ CommitFocusLost();
+ }
+ }
+ else if (rHint.ISA( ScAccGridWinFocusGotHint ) )
+ {
+ const ScAccGridWinFocusGotHint& rRef = (const ScAccGridWinFocusGotHint&)rHint;
+ if (rRef.GetNewGridWin() == meSplitPos)
+ {
+ if (mxTempAcc.is() && mpTempAccEdit)
+ mpTempAccEdit->GotFocus();
+ else if (mpAccessibleSpreadsheet)
+ mpAccessibleSpreadsheet->GotFocus();
+ else
+ CommitFocusGained();
+ }
+ }
+ else 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_TABLECHANGED) &&
+ mpAccessibleSpreadsheet)
+ {
+ FreeAccessibleSpreadsheet();
+ if (mpChildrenShapes)
+ DELETEZ(mpChildrenShapes);
+
+ // Accessibility: Shapes / form controls after reload not accessible
+ if ( !mpChildrenShapes )
+ {
+ mpChildrenShapes = new ScChildrenShapes( this, mpViewShell, meSplitPos );
+ }
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ CommitChange(aEvent); // all childs changed
+ }
+ else if (rRef.GetId() == SC_HINT_ACC_MAKEDRAWLAYER)
+ {
+ if (mpChildrenShapes)
+ mpChildrenShapes->SetDrawBroadcaster();
+ }
+ else if ((rRef.GetId() == SC_HINT_ACC_ENTEREDITMODE)) // this event comes only on creating edit field of a cell
+ {
+ if (mpViewShell && mpViewShell->GetViewData()->HasEditView(meSplitPos))
+ {
+ mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
+ mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
+ rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode);
+ uno::Reference<XAccessible> xAcc = mpTempAccEdit;
+
+ AddChild(xAcc, sal_True);
+
+ if (mpAccessibleSpreadsheet)
+ mpAccessibleSpreadsheet->LostFocus();
+ else
+ CommitFocusLost();
+
+ mpTempAccEdit->GotFocus();
+ }
+ }
+ else if (rRef.GetId() == SC_HINT_ACC_LEAVEEDITMODE)
+ {
+ if (mxTempAcc.is())
+ {
+ if (mpTempAccEdit)
+ mpTempAccEdit->LostFocus();
+
+ mpTempAccEdit = NULL;
+ RemoveChild(mxTempAcc, sal_True);
+
+ if (mpAccessibleSpreadsheet)
+ mpAccessibleSpreadsheet->GotFocus();
+ else
+ CommitFocusGained();
+ }
+ }
+ else if ((rRef.GetId() == SC_HINT_ACC_VISAREACHANGED) || (rRef.GetId() == SC_HINT_ACC_WINDOWRESIZED))
+ {
+ Rectangle aOldVisArea(maVisArea);
+ maVisArea = GetVisibleArea_Impl();
+
+ if (maVisArea != aOldVisArea)
+ {
+ if (maVisArea.GetSize() != aOldVisArea.GetSize())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::BOUNDRECT_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+
+ CommitChange(aEvent);
+
+ if (mpAccessibleSpreadsheet)
+ mpAccessibleSpreadsheet->BoundingBoxChanged();
+ }
+ else if (mpAccessibleSpreadsheet)
+ {
+ mpAccessibleSpreadsheet->VisAreaChanged();
+ }
+ if (mpChildrenShapes)
+ mpChildrenShapes->VisAreaChanged();
+ }
+ }
+ }
+
+ ScAccessibleDocumentBase::Notify(rBC, rHint);
+}
+
+void SAL_CALL ScAccessibleDocument::selectionChanged( const lang::EventObject& /* aEvent */ )
+ throw (uno::RuntimeException)
+{
+ sal_Bool bSelectionChanged(false);
+ if (mpAccessibleSpreadsheet)
+ {
+ sal_Bool bOldSelected(mbCompleteSheetSelected);
+ mbCompleteSheetSelected = IsTableSelected();
+ if (bOldSelected != mbCompleteSheetSelected)
+ {
+ mpAccessibleSpreadsheet->CompleteSelectionChanged(mbCompleteSheetSelected);
+ bSelectionChanged = sal_True;
+ }
+ }
+
+ if (mpChildrenShapes && mpChildrenShapes->SelectionChanged())
+ bSelectionChanged = sal_True;
+
+ if (bSelectionChanged)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+
+ CommitChange(aEvent);
+ }
+}
+
+ //===== XInterface =====================================================
+
+uno::Any SAL_CALL ScAccessibleDocument::queryInterface( uno::Type const & rType )
+ throw (uno::RuntimeException)
+{
+ uno::Any aAny (ScAccessibleDocumentImpl::queryInterface(rType));
+ return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
+}
+
+void SAL_CALL ScAccessibleDocument::acquire()
+ throw ()
+{
+ ScAccessibleContextBase::acquire();
+}
+
+void SAL_CALL ScAccessibleDocument::release()
+ throw ()
+{
+ ScAccessibleContextBase::release();
+}
+
+ //===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleDocument::getAccessibleAtPoint(
+ const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ uno::Reference<XAccessible> xAccessible = NULL;
+ if (containsPoint(rPoint))
+ {
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (mpChildrenShapes)
+ xAccessible = mpChildrenShapes->GetAt(rPoint);
+ if(!xAccessible.is())
+ {
+ if (mxTempAcc.is())
+ {
+ uno::Reference< XAccessibleContext > xCont(mxTempAcc->getAccessibleContext());
+ uno::Reference< XAccessibleComponent > xComp(xCont, uno::UNO_QUERY);
+ if (xComp.is())
+ {
+ Rectangle aBound(VCLRectangle(xComp->getBounds()));
+ if (aBound.IsInside(VCLPoint(rPoint)))
+ xAccessible = mxTempAcc;
+ }
+ }
+ if (!xAccessible.is())
+ xAccessible = GetAccessibleSpreadsheet();
+ }
+ }
+ return xAccessible;
+}
+
+void SAL_CALL ScAccessibleDocument::grabFocus( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
+ if (xAccessibleComponent.is())
+ {
+ xAccessibleComponent->grabFocus();
+ // grab only focus if it does not have the focus and it is not hidden
+ if (mpViewShell && mpViewShell->GetViewData() &&
+ (mpViewShell->GetViewData()->GetActivePart() != meSplitPos) &&
+ mpViewShell->GetWindowByPos(meSplitPos)->IsVisible())
+ {
+ mpViewShell->ActivatePart(meSplitPos);
+ }
+ }
+ }
+}
+
+ //===== XAccessibleContext ==============================================
+
+ /// Return the number of currently visible children.
+sal_Int32 SAL_CALL
+ ScAccessibleDocument::getAccessibleChildCount(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nCount(1);
+ if (mpChildrenShapes)
+ nCount = mpChildrenShapes->GetCount(); // returns the count of the shapes inclusive the table
+
+ if (mxTempAcc.is())
+ ++nCount;
+
+ return nCount;
+}
+
+ /// Return the specified child or NULL if index is invalid.
+uno::Reference<XAccessible> SAL_CALL
+ ScAccessibleDocument::getAccessibleChild(sal_Int32 nIndex)
+ throw (uno::RuntimeException,
+ lang::IndexOutOfBoundsException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ uno::Reference<XAccessible> xAccessible;
+ if (nIndex >= 0)
+ {
+ sal_Int32 nCount(1);
+ if (mpChildrenShapes)
+ {
+ xAccessible = mpChildrenShapes->Get(nIndex); // returns NULL if it is the table or out of range
+ nCount = mpChildrenShapes->GetCount(); //there is always a table
+ }
+ if (!xAccessible.is())
+ {
+ if (nIndex < nCount)
+ xAccessible = GetAccessibleSpreadsheet();
+ else if (nIndex == nCount && mxTempAcc.is())
+ xAccessible = mxTempAcc;
+ }
+ }
+
+ if (!xAccessible.is())
+ throw lang::IndexOutOfBoundsException();
+
+ return xAccessible;
+}
+
+ /// Return the set of current states.
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ ScAccessibleDocument::getAccessibleStateSet(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+ if (IsDefunc(xParentStates))
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ if (IsEditable(xParentStates))
+ pStateSet->AddState(AccessibleStateType::EDITABLE);
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::OPAQUE);
+ if (isShowing())
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ if (isVisible())
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ }
+ return pStateSet;
+}
+
+ ///===== XAccessibleSelection ===========================================
+
+void SAL_CALL
+ ScAccessibleDocument::selectAccessibleChild( sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if (mpChildrenShapes)
+ {
+ sal_Int32 nCount(mpChildrenShapes->GetCount()); //all shapes and the table
+ if (mxTempAcc.is())
+ ++nCount;
+ if (nChildIndex < 0 || nChildIndex >= nCount)
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference < XAccessible > xAccessible = mpChildrenShapes->Get(nChildIndex);
+ if (xAccessible.is())
+ {
+ sal_Bool bWasTableSelected(IsTableSelected());
+
+ if (mpChildrenShapes)
+ mpChildrenShapes->Select(nChildIndex); // throws no lang::IndexOutOfBoundsException if Index is to high
+
+ if (bWasTableSelected)
+ mpViewShell->SelectAll();
+ }
+ else
+ {
+ if (mpViewShell)
+ mpViewShell->SelectAll();
+ }
+ }
+}
+
+sal_Bool SAL_CALL
+ ScAccessibleDocument::isAccessibleChildSelected( sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Bool bResult(false);
+
+ if (mpChildrenShapes)
+ {
+ sal_Int32 nCount(mpChildrenShapes->GetCount()); //all shapes and the table
+ if (mxTempAcc.is())
+ ++nCount;
+ if (nChildIndex < 0 || nChildIndex >= nCount)
+ throw lang::IndexOutOfBoundsException();
+
+ uno::Reference < XAccessible > xAccessible = mpChildrenShapes->Get(nChildIndex);
+ if (xAccessible.is())
+ {
+ uno::Reference<drawing::XShape> xShape;
+ bResult = mpChildrenShapes->IsSelected(nChildIndex, xShape); // throws no lang::IndexOutOfBoundsException if Index is to high
+ }
+ else
+ {
+ if (mxTempAcc.is() && nChildIndex == nCount)
+ bResult = sal_True;
+ else
+ bResult = IsTableSelected();
+ }
+ }
+ return bResult;
+}
+
+void SAL_CALL
+ ScAccessibleDocument::clearAccessibleSelection( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if (mpChildrenShapes)
+ mpChildrenShapes->DeselectAll(); //deselects all (also the table)
+}
+
+void SAL_CALL
+ ScAccessibleDocument::selectAllAccessibleChildren( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if (mpChildrenShapes)
+ mpChildrenShapes->SelectAll();
+
+ // select table after shapes, because while selecting shapes the table will be deselected
+ if (mpViewShell)
+ {
+ mpViewShell->SelectAll();
+ }
+}
+
+sal_Int32 SAL_CALL
+ ScAccessibleDocument::getSelectedAccessibleChildCount( )
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ sal_Int32 nCount(0);
+
+ if (mpChildrenShapes)
+ nCount = mpChildrenShapes->GetSelectedCount();
+
+ if (IsTableSelected())
+ ++nCount;
+
+ if (mxTempAcc.is())
+ ++nCount;
+
+ return nCount;
+}
+
+uno::Reference<XAccessible > SAL_CALL
+ ScAccessibleDocument::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ uno::Reference<XAccessible> xAccessible;
+ if (mpChildrenShapes)
+ {
+ sal_Int32 nCount(getSelectedAccessibleChildCount()); //all shapes and the table
+ if (nSelectedChildIndex < 0 || nSelectedChildIndex >= nCount)
+ throw lang::IndexOutOfBoundsException();
+
+ sal_Bool bTabMarked(IsTableSelected());
+
+ if (mpChildrenShapes)
+ xAccessible = mpChildrenShapes->GetSelected(nSelectedChildIndex, bTabMarked); // throws no lang::IndexOutOfBoundsException if Index is to high
+ if (mxTempAcc.is() && nSelectedChildIndex == nCount - 1)
+ xAccessible = mxTempAcc;
+ else if (bTabMarked)
+ xAccessible = GetAccessibleSpreadsheet();
+ }
+
+ DBG_ASSERT(xAccessible.is(), "here should always be an accessible object or a exception throwed");
+
+ return xAccessible;
+}
+
+void SAL_CALL
+ ScAccessibleDocument::deselectAccessibleChild( sal_Int32 nChildIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if (mpChildrenShapes)
+ {
+ sal_Int32 nCount(mpChildrenShapes->GetCount()); //all shapes and the table
+ if (mxTempAcc.is())
+ ++nCount;
+ if (nChildIndex < 0 || nChildIndex >= nCount)
+ throw lang::IndexOutOfBoundsException();
+
+ sal_Bool bTabMarked(IsTableSelected());
+
+ uno::Reference < XAccessible > xAccessible = mpChildrenShapes->Get(nChildIndex);
+ if (xAccessible.is())
+ {
+ if (mpChildrenShapes)
+ mpChildrenShapes->Deselect(nChildIndex); // throws no lang::IndexOutOfBoundsException if Index is to high
+
+ if (bTabMarked)
+ mpViewShell->SelectAll(); // select the table again
+ }
+ else if (bTabMarked)
+ mpViewShell->Unmark();
+ }
+}
+
+ //===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL
+ ScAccessibleDocument::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleDocument"));
+}
+
+uno::Sequence< ::rtl::OUString> SAL_CALL
+ ScAccessibleDocument::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSequence = ScAccessibleContextBase::getSupportedServiceNames();
+ sal_Int32 nOldSize(aSequence.getLength());
+ aSequence.realloc(nOldSize + 1);
+ ::rtl::OUString* pNames = aSequence.getArray();
+
+ pNames[nOldSize] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.AccessibleSpreadsheetDocumentView"));
+
+ return aSequence;
+}
+
+//===== XTypeProvider =======================================================
+
+uno::Sequence< uno::Type > SAL_CALL ScAccessibleDocument::getTypes()
+ throw (uno::RuntimeException)
+{
+ return comphelper::concatSequences(ScAccessibleDocumentImpl::getTypes(), ScAccessibleContextBase::getTypes());
+}
+
+uno::Sequence<sal_Int8> SAL_CALL
+ ScAccessibleDocument::getImplementationId(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+///===== IAccessibleViewForwarder ========================================
+
+sal_Bool ScAccessibleDocument::IsValid (void) const
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose);
+}
+
+Rectangle ScAccessibleDocument::GetVisibleArea_Impl() const
+{
+ Rectangle aVisRect(GetBoundingBox());
+
+ Point aPoint(mpViewShell->GetViewData()->GetPixPos(meSplitPos)); // returns a negative Point
+ aPoint.setX(-aPoint.getX());
+ aPoint.setY(-aPoint.getY());
+ aVisRect.SetPos(aPoint);
+
+ ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+ if (pWin)
+ aVisRect = pWin->PixelToLogic(aVisRect, pWin->GetDrawMapMode());
+
+ return aVisRect;
+}
+
+Rectangle ScAccessibleDocument::GetVisibleArea() const
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ return maVisArea;
+}
+
+Point ScAccessibleDocument::LogicToPixel (const Point& rPoint) const
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ Point aPoint;
+ ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+ if (pWin)
+ {
+ aPoint = pWin->LogicToPixel(rPoint, pWin->GetDrawMapMode());
+ aPoint += pWin->GetWindowExtentsRelative(NULL).TopLeft();
+ }
+ return aPoint;
+}
+
+Size ScAccessibleDocument::LogicToPixel (const Size& rSize) const
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ Size aSize;
+ ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+ if (pWin)
+ aSize = pWin->LogicToPixel(rSize, pWin->GetDrawMapMode());
+ return aSize;
+}
+
+Point ScAccessibleDocument::PixelToLogic (const Point& rPoint) const
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ Point aPoint;
+ ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+ if (pWin)
+ {
+ aPoint -= pWin->GetWindowExtentsRelative(NULL).TopLeft();
+ aPoint = pWin->PixelToLogic(rPoint, pWin->GetDrawMapMode());
+ }
+ return aPoint;
+}
+
+Size ScAccessibleDocument::PixelToLogic (const Size& rSize) const
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ Size aSize;
+ ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+ if (pWin)
+ aSize = pWin->PixelToLogic(rSize, pWin->GetDrawMapMode());
+ return aSize;
+}
+
+ //===== internal ========================================================
+
+utl::AccessibleRelationSetHelper* ScAccessibleDocument::GetRelationSet(const ScAddress* pAddress) const
+{
+ utl::AccessibleRelationSetHelper* pRelationSet = NULL;
+ if (mpChildrenShapes)
+ pRelationSet = mpChildrenShapes->GetRelationSet(pAddress);
+ return pRelationSet;
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleDocument::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ rtl::OUString sDescription = String(ScResId(STR_ACC_DOC_DESCR));
+ return sDescription;
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleDocument::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ rtl::OUString sName = String(ScResId(STR_ACC_DOC_NAME));
+ sal_Int32 nNumber(sal_Int32(meSplitPos) + 1);
+ sName += rtl::OUString::valueOf(nNumber);
+ return sName;
+}
+
+Rectangle ScAccessibleDocument::GetBoundingBoxOnScreen() const
+ throw (uno::RuntimeException)
+{
+ Rectangle aRect;
+ if (mpViewShell)
+ {
+ Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
+ if (pWindow)
+ aRect = pWindow->GetWindowExtentsRelative(NULL);
+ }
+ return aRect;
+}
+
+Rectangle ScAccessibleDocument::GetBoundingBox() const
+ throw (uno::RuntimeException)
+{
+ Rectangle aRect;
+ if (mpViewShell)
+ {
+ Window* pWindow = mpViewShell->GetWindowByPos(meSplitPos);
+ if (pWindow)
+ aRect = pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow());
+ }
+ return aRect;
+}
+
+SCTAB ScAccessibleDocument::getVisibleTable() const
+{
+ SCTAB nVisibleTable(0);
+ if (mpViewShell && mpViewShell->GetViewData())
+ nVisibleTable = mpViewShell->GetViewData()->GetTabNo();
+ return nVisibleTable;
+}
+
+uno::Reference < XAccessible >
+ ScAccessibleDocument::GetAccessibleSpreadsheet()
+{
+ if (!mpAccessibleSpreadsheet && mpViewShell)
+ {
+ mpAccessibleSpreadsheet = new ScAccessibleSpreadsheet(this, mpViewShell, getVisibleTable(), meSplitPos);
+ mpAccessibleSpreadsheet->acquire();
+ mpAccessibleSpreadsheet->Init();
+ mbCompleteSheetSelected = IsTableSelected();
+ }
+ return mpAccessibleSpreadsheet;
+}
+
+void ScAccessibleDocument::FreeAccessibleSpreadsheet()
+{
+ if (mpAccessibleSpreadsheet)
+ {
+ mpAccessibleSpreadsheet->dispose();
+ mpAccessibleSpreadsheet->release();
+ mpAccessibleSpreadsheet = NULL;
+ }
+}
+
+sal_Bool ScAccessibleDocument::IsTableSelected() const
+{
+ sal_Bool bResult (false);
+ if(mpViewShell)
+ {
+ SCTAB nTab(getVisibleTable());
+ //#103800#; use a copy of MarkData
+ ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
+ aMarkData.MarkToMulti();
+ if (aMarkData.IsAllMarked(ScRange(ScAddress(0, 0, nTab),ScAddress(MAXCOL, MAXROW, nTab))))
+ bResult = sal_True;
+ }
+ return bResult;
+}
+
+sal_Bool ScAccessibleDocument::IsDefunc(
+ const uno::Reference<XAccessibleStateSet>& rxParentStates)
+{
+ return ScAccessibleContextBase::IsDefunc() || (mpViewShell == NULL) || !getAccessibleParent().is() ||
+ (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
+}
+
+sal_Bool ScAccessibleDocument::IsEditable(
+ const uno::Reference<XAccessibleStateSet>& /* rxParentStates */)
+{
+ // what is with document protection or readonly documents?
+ return sal_True;
+}
+
+void ScAccessibleDocument::AddChild(const uno::Reference<XAccessible>& xAcc, sal_Bool bFireEvent)
+{
+ DBG_ASSERT(!mxTempAcc.is(), "this object should be removed before");
+ if (xAcc.is())
+ {
+ mxTempAcc = xAcc;
+ if( bFireEvent )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.Source = uno::Reference<XAccessibleContext>(this);
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= mxTempAcc;
+ CommitChange( aEvent );
+ }
+ }
+}
+
+void ScAccessibleDocument::RemoveChild(const uno::Reference<XAccessible>& xAcc, sal_Bool bFireEvent)
+{
+ DBG_ASSERT(mxTempAcc.is(), "this object should be added before");
+ if (xAcc.is())
+ {
+ DBG_ASSERT(xAcc.get() == mxTempAcc.get(), "only the same object should be removed");
+ if( bFireEvent )
+ {
+ AccessibleEventObject aEvent;
+ aEvent.Source = uno::Reference<XAccessibleContext>(this);
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.OldValue <<= mxTempAcc;
+ CommitChange( aEvent );
+ }
+ mxTempAcc = NULL;
+ }
+}
+
+rtl::OUString ScAccessibleDocument::GetCurrentCellName() const
+{
+ String sName( ScResId(STR_ACC_CELL_NAME) );
+ if (mpViewShell)
+ {
+ String sAddress;
+ // Document not needed, because only the cell address, but not the tablename is needed
+ mpViewShell->GetViewData()->GetCurPos().Format( sAddress, SCA_VALID, NULL );
+ sName.SearchAndReplaceAscii("%1", sAddress);
+ }
+ return rtl::OUString(sName);
+}
+
+rtl::OUString ScAccessibleDocument::GetCurrentCellDescription() const
+{
+ return rtl::OUString();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx b/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
new file mode 100644
index 000000000000..6c48fbffb388
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
@@ -0,0 +1,52 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+
+#include "AccessibleDocumentBase.hxx"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+ //===== internal ========================================================
+
+ScAccessibleDocumentBase::ScAccessibleDocumentBase(
+ const uno::Reference<XAccessible>& rxParent)
+ : ScAccessibleContextBase(rxParent, AccessibleRole::DOCUMENT)
+{
+}
+
+ScAccessibleDocumentBase::~ScAccessibleDocumentBase(void)
+{
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
new file mode 100644
index 000000000000..9535e84e0da3
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -0,0 +1,1712 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "AccessibleDocumentPagePreview.hxx"
+#include "AccessiblePreviewTable.hxx"
+#include "AccessiblePageHeader.hxx"
+#include "AccessibilityHints.hxx"
+#include "AccessibleText.hxx"
+#include "document.hxx"
+#include "prevwsh.hxx"
+#include "prevloc.hxx"
+#include "drwlayer.hxx"
+#include "editsrc.hxx"
+#include "scresid.hxx"
+#include "sc.hrc"
+#include "DrawModelBroadcaster.hxx"
+#include "docsh.hxx"
+#include "drawview.hxx"
+#include "preview.hxx"
+#include "postit.hxx"
+
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <tools/debug.hxx>
+#include <tools/gen.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/AccessibleTextHelper.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <toolkit/helper/convert.hxx>
+#include <svx/unoshape.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <vcl/svapp.hxx>
+
+#include <vector>
+#include <list>
+#include <algorithm>
+#include <memory>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+//=========================================================================
+
+typedef std::list< uno::Reference< XAccessible > > ScXAccList;
+
+
+struct ScAccNote
+{
+ String maNoteText;
+ Rectangle maRect;
+ ScAddress maNoteCell;
+ ::accessibility::AccessibleTextHelper* mpTextHelper;
+ sal_Int32 mnParaCount;
+ sal_Bool mbMarkNote;
+
+ ScAccNote() : mpTextHelper(NULL), mnParaCount(0) {}
+};
+
+class ScNotesChilds
+{
+public:
+ ScNotesChilds(ScPreviewShell* pViewShell, ScAccessibleDocumentPagePreview* pAccDoc);
+ ~ScNotesChilds();
+ void Init(const Rectangle& rVisRect, sal_Int32 nOffset);
+
+ sal_Int32 GetChildsCount() const;
+ uno::Reference<XAccessible> GetChild(sal_Int32 nIndex) const;
+ uno::Reference<XAccessible> GetAt(const awt::Point& rPoint) const;
+
+ void DataChanged(const Rectangle& rVisRect);
+
+private:
+ ScPreviewShell* mpViewShell;
+ ScAccessibleDocumentPagePreview* mpAccDoc;
+ typedef std::vector<ScAccNote> ScAccNotes;
+ mutable ScAccNotes maNotes;
+ mutable ScAccNotes maMarks;
+ sal_Int32 mnParagraphs;
+ sal_Int32 mnOffset;
+
+ ::accessibility::AccessibleTextHelper* CreateTextHelper(const String& rString, const Rectangle& rVisRect, const ScAddress& aCellPos, sal_Bool bMarkNote, sal_Int32 nChildOffset) const;
+ sal_Int32 AddNotes(const ScPreviewLocationData& rData, const Rectangle& rVisRect, sal_Bool bMark, ScAccNotes& rNotes);
+
+ sal_Int8 CompareCell(const ScAddress& aCell1, const ScAddress& aCell2);
+ void CollectChilds(const ScAccNote& rNote, ScXAccList& rList);
+ sal_Int32 CheckChanges(const ScPreviewLocationData& rData, const Rectangle& rVisRect,
+ sal_Bool bMark, ScAccNotes& rOldNotes, ScAccNotes& rNewNotes,
+ ScXAccList& rOldParas, ScXAccList& rNewParas);
+
+ inline ScDocument* GetDocument() const;
+};
+
+ScNotesChilds::ScNotesChilds(ScPreviewShell* pViewShell, ScAccessibleDocumentPagePreview* pAccDoc)
+ : mpViewShell(pViewShell),
+ mpAccDoc(pAccDoc),
+ mnParagraphs(0),
+ mnOffset(0)
+{
+}
+
+struct DeleteAccNote
+{
+ void operator()(ScAccNote& rNote)
+ {
+ if (rNote.mpTextHelper)
+ DELETEZ( rNote.mpTextHelper);
+ }
+};
+
+ScNotesChilds::~ScNotesChilds()
+{
+ std::for_each(maNotes.begin(), maNotes.end(), DeleteAccNote());
+ std::for_each(maMarks.begin(), maMarks.end(), DeleteAccNote());
+}
+
+::accessibility::AccessibleTextHelper* ScNotesChilds::CreateTextHelper(const String& rString, const Rectangle& rVisRect, const ScAddress& aCellPos, sal_Bool bMarkNote, sal_Int32 nChildOffset) const
+{
+ ::accessibility::AccessibleTextHelper* pTextHelper = NULL;
+
+ ::std::auto_ptr < ScAccessibleTextData > pAccessiblePreviewHeaderCellTextData
+ (new ScAccessibleNoteTextData(mpViewShell, rString, aCellPos, bMarkNote));
+ ::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessiblePreviewHeaderCellTextData));
+
+ pTextHelper = new ::accessibility::AccessibleTextHelper(pEditSource);
+
+ if (pTextHelper)
+ {
+ pTextHelper->SetEventSource(mpAccDoc);
+ pTextHelper->SetStartIndex(nChildOffset);
+ pTextHelper->SetOffset(rVisRect.TopLeft());
+ }
+
+ return pTextHelper;
+}
+
+sal_Int32 ScNotesChilds::AddNotes(const ScPreviewLocationData& rData, const Rectangle& rVisRect, sal_Bool bMark, ScAccNotes& rNotes)
+{
+ sal_Int32 nCount = rData.GetNoteCountInRange(rVisRect, bMark);
+
+ rNotes.reserve(nCount);
+
+ sal_Int32 nParagraphs(0);
+ ScDocument* pDoc = GetDocument();
+ if (pDoc)
+ {
+ ScAccNote aNote;
+ aNote.mbMarkNote = bMark;
+ if (bMark)
+ aNote.mnParaCount = 1;
+ for (sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex)
+ {
+ if (rData.GetNoteInRange(rVisRect, nIndex, bMark, aNote.maNoteCell, aNote.maRect))
+ {
+ if (bMark)
+ {
+ // Document not needed, because only the cell address, but not the tablename is needed
+ aNote.maNoteCell.Format( aNote.maNoteText, SCA_VALID, NULL );
+ }
+ else
+ {
+ if( ScPostIt* pNote = pDoc->GetNote( aNote.maNoteCell ) )
+ aNote.maNoteText = pNote->GetText();
+ aNote.mpTextHelper = CreateTextHelper(aNote.maNoteText, aNote.maRect, aNote.maNoteCell, aNote.mbMarkNote, nParagraphs + mnOffset);
+ if (aNote.mpTextHelper)
+ aNote.mnParaCount = aNote.mpTextHelper->GetChildCount();
+ }
+ nParagraphs += aNote.mnParaCount;
+ rNotes.push_back(aNote);
+ }
+ }
+ }
+ return nParagraphs;
+}
+
+void ScNotesChilds::Init(const Rectangle& rVisRect, sal_Int32 nOffset)
+{
+ if (mpViewShell && !mnParagraphs)
+ {
+ mnOffset = nOffset;
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+
+ mnParagraphs = AddNotes(rData, rVisRect, false, maMarks);
+ mnParagraphs += AddNotes(rData, rVisRect, sal_True, maNotes);
+ }
+}
+
+sal_Int32 ScNotesChilds::GetChildsCount() const
+{
+ return mnParagraphs;
+}
+
+struct ScParaFound
+{
+ sal_Int32 mnIndex;
+ ScParaFound(sal_Int32 nIndex) : mnIndex(nIndex) {}
+ sal_Bool operator() (const ScAccNote& rNote)
+ {
+ sal_Bool bResult(false);
+ if (rNote.mnParaCount > mnIndex)
+ bResult = sal_True;
+ else
+ mnIndex -= rNote.mnParaCount;
+ return bResult;
+ }
+};
+
+uno::Reference<XAccessible> ScNotesChilds::GetChild(sal_Int32 nIndex) const
+{
+ uno::Reference<XAccessible> xAccessible;
+
+ if (nIndex < mnParagraphs)
+ {
+ if (nIndex < static_cast<sal_Int32>(maMarks.size()))
+ {
+ ScAccNotes::iterator aEndItr = maMarks.end();
+ ScParaFound aParaFound(nIndex);
+ ScAccNotes::iterator aItr = std::find_if(maMarks.begin(), aEndItr, aParaFound);
+ if (aItr != aEndItr)
+ {
+ DBG_ASSERT((aItr->maNoteCell == maMarks[nIndex].maNoteCell) && (aItr->mbMarkNote == maMarks[nIndex].mbMarkNote), "wrong note found");
+ }
+ else
+ {
+ DBG_ERRORFILE("wrong note found");
+ }
+ if (!aItr->mpTextHelper)
+ aItr->mpTextHelper = CreateTextHelper(maMarks[nIndex].maNoteText, maMarks[nIndex].maRect, maMarks[nIndex].maNoteCell, maMarks[nIndex].mbMarkNote, nIndex + mnOffset); // the marks are the first and every mark has only one paragraph
+ xAccessible = aItr->mpTextHelper->GetChild(aParaFound.mnIndex + aItr->mpTextHelper->GetStartIndex());
+ }
+ else
+ {
+ nIndex -= maMarks.size();
+ ScAccNotes::iterator aEndItr = maNotes.end();
+ ScParaFound aParaFound(nIndex);
+ ScAccNotes::iterator aItr = std::find_if(maNotes.begin(), aEndItr, aParaFound);
+ if (aEndItr != aItr)
+ {
+ if (!aItr->mpTextHelper)
+ aItr->mpTextHelper = CreateTextHelper(aItr->maNoteText, aItr->maRect, aItr->maNoteCell, aItr->mbMarkNote, (nIndex - aParaFound.mnIndex) + mnOffset + maMarks.size());
+ xAccessible = aItr->mpTextHelper->GetChild(aParaFound.mnIndex + aItr->mpTextHelper->GetStartIndex());
+ }
+ }
+ }
+
+ return xAccessible;
+}
+
+struct ScPointFound
+{
+ Rectangle maPoint;
+ sal_Int32 mnParagraphs;
+ ScPointFound(const Point& rPoint) : maPoint(rPoint, Size(0, 0)), mnParagraphs(0) {}
+ sal_Bool operator() (const ScAccNote& rNote)
+ {
+ sal_Bool bResult(false);
+ if (maPoint.IsInside(rNote.maRect))
+ bResult = sal_True;
+ else
+ mnParagraphs += rNote.mnParaCount;
+ return bResult;
+ }
+};
+
+uno::Reference<XAccessible> ScNotesChilds::GetAt(const awt::Point& rPoint) const
+{
+ uno::Reference<XAccessible> xAccessible;
+
+ ScPointFound aPointFound(Point(rPoint.X, rPoint.Y));
+
+ ScAccNotes::iterator aEndItr = maMarks.end();
+ ScAccNotes::iterator aItr = std::find_if(maMarks.begin(), aEndItr, aPointFound);
+ if (aEndItr == aItr)
+ {
+ aEndItr = maNotes.end();
+ aItr = std::find_if(maNotes.begin(), aEndItr, aPointFound);
+ }
+ if (aEndItr != aItr)
+ {
+ if (!aItr->mpTextHelper)
+ aItr->mpTextHelper = CreateTextHelper(aItr->maNoteText, aItr->maRect, aItr->maNoteCell, aItr->mbMarkNote, aPointFound.mnParagraphs + mnOffset);
+ xAccessible = aItr->mpTextHelper->GetAt(rPoint);
+ }
+
+ return xAccessible;
+}
+
+sal_Int8 ScNotesChilds::CompareCell(const ScAddress& aCell1, const ScAddress& aCell2)
+{
+ DBG_ASSERT(aCell1.Tab() == aCell2.Tab(), "the notes should be on the same table");
+ sal_Int8 nResult(0);
+ if (aCell1 != aCell2)
+ {
+ if (aCell1.Row() == aCell2.Row())
+ nResult = (aCell1.Col() < aCell2.Col()) ? -1 : 1;
+ else
+ nResult = (aCell1.Row() < aCell2.Row()) ? -1 : 1;
+ }
+ return nResult;
+}
+
+void ScNotesChilds::CollectChilds(const ScAccNote& rNote, ScXAccList& rList)
+{
+ if (rNote.mpTextHelper)
+ for (sal_Int32 i = 0; i < rNote.mnParaCount; ++i)
+ rList.push_back(rNote.mpTextHelper->GetChild(i + rNote.mpTextHelper->GetStartIndex()));
+}
+
+sal_Int32 ScNotesChilds::CheckChanges(const ScPreviewLocationData& rData,
+ const Rectangle& rVisRect, sal_Bool bMark, ScAccNotes& rOldNotes,
+ ScAccNotes& rNewNotes, ScXAccList& rOldParas, ScXAccList& rNewParas)
+{
+ sal_Int32 nCount = rData.GetNoteCountInRange(rVisRect, bMark);
+
+ rNewNotes.reserve(nCount);
+
+ sal_Int32 nParagraphs(0);
+ ScDocument* pDoc = GetDocument();
+ if (pDoc)
+ {
+ ScAccNote aNote;
+ aNote.mbMarkNote = bMark;
+ if (bMark)
+ aNote.mnParaCount = 1;
+ ScAccNotes::iterator aItr = rOldNotes.begin();
+ ScAccNotes::iterator aEndItr = rOldNotes.end();
+ sal_Bool bAddNote(false);
+ for (sal_Int32 nIndex = 0; nIndex < nCount; ++nIndex)
+ {
+ if (rData.GetNoteInRange(rVisRect, nIndex, bMark, aNote.maNoteCell, aNote.maRect))
+ {
+ if (bMark)
+ {
+ // Document not needed, because only the cell address, but not the tablename is needed
+ aNote.maNoteCell.Format( aNote.maNoteText, SCA_VALID, NULL );
+ }
+ else
+ {
+ if( ScPostIt* pNote = pDoc->GetNote( aNote.maNoteCell ) )
+ aNote.maNoteText = pNote->GetText();
+ }
+
+ sal_Int8 nCompare(-1); // if there are no more old childs it is always a new one
+ if (aItr != aEndItr)
+ nCompare = CompareCell(aNote.maNoteCell, aItr->maNoteCell);
+ if (nCompare == 0)
+ {
+ if (aNote.maNoteText == aItr->maNoteText)
+ {
+ aNote.mpTextHelper = aItr->mpTextHelper;
+ if (aNote.maRect != aItr->maRect) //neue VisArea setzen
+ {
+ aNote.mpTextHelper->SetOffset(aNote.maRect.TopLeft());
+ aNote.mpTextHelper->UpdateChildren();
+ //DBG_ASSERT(aItr->maRect.GetSize() == aNote.maRect.GetSize(), "size should be the same, because the text is not changed");
+ // could be changed, because only a part of the note is visible
+ }
+ }
+ else
+ {
+ aNote.mpTextHelper = CreateTextHelper(aNote.maNoteText, aNote.maRect, aNote.maNoteCell, aNote.mbMarkNote, nParagraphs + mnOffset);
+ if (aNote.mpTextHelper)
+ aNote.mnParaCount = aNote.mpTextHelper->GetChildCount();
+ // collect removed childs
+ CollectChilds(*aItr, rOldParas);
+ DELETEZ(aItr->mpTextHelper);
+ // collect new childs
+ CollectChilds(aNote, rNewParas);
+ }
+ bAddNote = sal_True;
+ // not necessary, because this branch should not be reached if it is the end
+ //if (aItr != aEndItr)
+ ++aItr;
+ }
+ else if (nCompare < 0)
+ {
+ aNote.mpTextHelper = CreateTextHelper(aNote.maNoteText, aNote.maRect, aNote.maNoteCell, aNote.mbMarkNote, nParagraphs + mnOffset);
+ if (aNote.mpTextHelper)
+ aNote.mnParaCount = aNote.mpTextHelper->GetChildCount();
+ // collect new childs
+ CollectChilds(aNote, rNewParas);
+ bAddNote = sal_True;
+ }
+ else
+ {
+ // collect removed childs
+ CollectChilds(*aItr, rOldParas);
+ DELETEZ(aItr->mpTextHelper);
+
+ // no note to add
+ // not necessary, because this branch should not be reached if it is the end
+ //if (aItr != aEndItr)
+ ++aItr;
+ }
+ if (bAddNote)
+ {
+ nParagraphs += aNote.mnParaCount;
+ rNewNotes.push_back(aNote);
+ bAddNote = false;
+ }
+ }
+ }
+ }
+ return nParagraphs;
+}
+
+struct ScChildGone
+{
+ ScAccessibleDocumentPagePreview* mpAccDoc;
+ ScChildGone(ScAccessibleDocumentPagePreview* pAccDoc) : mpAccDoc(pAccDoc) {}
+ void operator() (const uno::Reference<XAccessible>& xAccessible) const
+ {
+ if (mpAccDoc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(mpAccDoc);
+ aEvent.OldValue <<= xAccessible;
+
+ mpAccDoc->CommitChange(aEvent); // gone child - event
+ }
+ }
+};
+
+struct ScChildNew
+{
+ ScAccessibleDocumentPagePreview* mpAccDoc;
+ ScChildNew(ScAccessibleDocumentPagePreview* pAccDoc) : mpAccDoc(pAccDoc) {}
+ void operator() (const uno::Reference<XAccessible>& xAccessible) const
+ {
+ if (mpAccDoc)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(mpAccDoc);
+ aEvent.NewValue <<= xAccessible;
+
+ mpAccDoc->CommitChange(aEvent); // new child - event
+ }
+ }
+};
+
+void ScNotesChilds::DataChanged(const Rectangle& rVisRect)
+{
+ if (mpViewShell && mpAccDoc)
+ {
+ ScXAccList aNewParas;
+ ScXAccList aOldParas;
+ ScAccNotes aNewMarks;
+ mnParagraphs = CheckChanges(mpViewShell->GetLocationData(), rVisRect, sal_True, maMarks, aNewMarks, aOldParas, aNewParas);
+ maMarks = aNewMarks;
+ ScAccNotes aNewNotes;
+ mnParagraphs += CheckChanges(mpViewShell->GetLocationData(), rVisRect, false, maNotes, aNewNotes, aOldParas, aNewParas);
+ maNotes = aNewNotes;
+
+ std::for_each(aOldParas.begin(), aOldParas.end(), ScChildGone(mpAccDoc));
+ std::for_each(aNewParas.begin(), aNewParas.end(), ScChildNew(mpAccDoc));
+ }
+}
+
+struct ScChangeOffset
+{
+ sal_Int32 mnDiff;
+ ScChangeOffset(sal_Int32 nDiff) : mnDiff(nDiff) {}
+ void operator() (const ScAccNote& rNote)
+ {
+ if (rNote.mpTextHelper)
+ rNote.mpTextHelper->SetStartIndex(rNote.mpTextHelper->GetStartIndex() + mnDiff);
+ }
+};
+
+inline ScDocument* ScNotesChilds::GetDocument() const
+{
+ ScDocument* pDoc = NULL;
+ if (mpViewShell)
+ pDoc = mpViewShell->GetDocument();
+ return pDoc;
+}
+
+class ScIAccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder
+{
+public:
+ ScIAccessibleViewForwarder();
+ ScIAccessibleViewForwarder(ScPreviewShell* pViewShell,
+ ScAccessibleDocumentPagePreview* pAccDoc,
+ const MapMode& aMapMode);
+ ~ScIAccessibleViewForwarder();
+
+ ///===== IAccessibleViewForwarder ========================================
+
+ virtual sal_Bool IsValid (void) const;
+ virtual Rectangle GetVisibleArea() const;
+ virtual Point LogicToPixel (const Point& rPoint) const;
+ virtual Size LogicToPixel (const Size& rSize) const;
+ virtual Point PixelToLogic (const Point& rPoint) const;
+ virtual Size PixelToLogic (const Size& rSize) const;
+
+private:
+ ScPreviewShell* mpViewShell;
+ ScAccessibleDocumentPagePreview* mpAccDoc;
+ MapMode maMapMode;
+ sal_Bool mbValid;
+};
+
+ScIAccessibleViewForwarder::ScIAccessibleViewForwarder()
+ : mbValid(false)
+{
+}
+
+ScIAccessibleViewForwarder::ScIAccessibleViewForwarder(ScPreviewShell* pViewShell,
+ ScAccessibleDocumentPagePreview* pAccDoc,
+ const MapMode& aMapMode)
+ : mpViewShell(pViewShell),
+ mpAccDoc(pAccDoc),
+ maMapMode(aMapMode),
+ mbValid(sal_True)
+{
+}
+
+ScIAccessibleViewForwarder::~ScIAccessibleViewForwarder()
+{
+}
+
+///===== IAccessibleViewForwarder ========================================
+
+sal_Bool ScIAccessibleViewForwarder::IsValid (void) const
+{
+ SolarMutexGuard aGuard;
+ return mbValid;
+}
+
+Rectangle ScIAccessibleViewForwarder::GetVisibleArea() const
+{
+ SolarMutexGuard aGuard;
+ Rectangle aVisRect;
+ Window* pWin = mpViewShell->GetWindow();
+ if (pWin)
+ {
+ aVisRect.SetSize(pWin->GetOutputSizePixel());
+ aVisRect.SetPos(Point(0, 0));
+
+ aVisRect = pWin->PixelToLogic(aVisRect, maMapMode);
+ }
+
+ return aVisRect;
+}
+
+Point ScIAccessibleViewForwarder::LogicToPixel (const Point& rPoint) const
+{
+ SolarMutexGuard aGuard;
+ Point aPoint;
+ Window* pWin = mpViewShell->GetWindow();
+ if (pWin && mpAccDoc)
+ {
+ Rectangle aRect(mpAccDoc->GetBoundingBoxOnScreen());
+ aPoint = pWin->LogicToPixel(rPoint, maMapMode) + aRect.TopLeft();
+ }
+
+ return aPoint;
+}
+
+Size ScIAccessibleViewForwarder::LogicToPixel (const Size& rSize) const
+{
+ SolarMutexGuard aGuard;
+ Size aSize;
+ Window* pWin = mpViewShell->GetWindow();
+ if (pWin)
+ aSize = pWin->LogicToPixel(rSize, maMapMode);
+ return aSize;
+}
+
+Point ScIAccessibleViewForwarder::PixelToLogic (const Point& rPoint) const
+{
+ SolarMutexGuard aGuard;
+ Point aPoint;
+ Window* pWin = mpViewShell->GetWindow();
+ if (pWin && mpAccDoc)
+ {
+ Rectangle aRect(mpAccDoc->GetBoundingBoxOnScreen());
+ aPoint = pWin->PixelToLogic(rPoint - aRect.TopLeft(), maMapMode);
+ }
+ return aPoint;
+}
+
+Size ScIAccessibleViewForwarder::PixelToLogic (const Size& rSize) const
+{
+ SolarMutexGuard aGuard;
+ Size aSize;
+ Window* pWin = mpViewShell->GetWindow();
+ if (pWin)
+ aSize = pWin->PixelToLogic(rSize, maMapMode);
+ return aSize;
+}
+
+struct ScShapeChild
+{
+ ScShapeChild() : mpAccShape(NULL) {}
+ ScShapeChild(const ScShapeChild& rOld);
+ ~ScShapeChild();
+ mutable ::accessibility::AccessibleShape* mpAccShape;
+ com::sun::star::uno::Reference< com::sun::star::drawing::XShape > mxShape;
+ sal_Int32 mnRangeId;
+};
+
+ScShapeChild::ScShapeChild(const ScShapeChild& rOld)
+:
+mpAccShape(rOld.mpAccShape),
+mxShape(rOld.mxShape),
+mnRangeId(rOld.mnRangeId)
+{
+ if (mpAccShape)
+ mpAccShape->acquire();
+}
+
+ScShapeChild::~ScShapeChild()
+{
+ if (mpAccShape)
+ {
+ mpAccShape->dispose();
+ mpAccShape->release();
+ }
+}
+
+struct ScShapeChildLess
+{
+ sal_Bool operator()(const ScShapeChild& rChild1, const ScShapeChild& rChild2) const
+ {
+ sal_Bool bResult(false);
+ if (rChild1.mxShape.is() && rChild2.mxShape.is())
+ bResult = (rChild1.mxShape.get() < rChild2.mxShape.get());
+ return bResult;
+ }
+};
+
+typedef std::vector<ScShapeChild> ScShapeChildVec;
+
+struct ScShapeRange
+{
+ ScShapeChildVec maBackShapes;
+ ScShapeChildVec maForeShapes; // inclusive internal shapes
+ ScShapeChildVec maControls;
+ Rectangle maPixelRect;
+ MapMode maMapMode;
+ ScIAccessibleViewForwarder maViewForwarder;
+};
+
+typedef std::vector<ScShapeRange> ScShapeRangeVec;
+
+class ScShapeChilds : public SfxListener,
+ public ::accessibility::IAccessibleParent
+{
+public:
+ ScShapeChilds(ScPreviewShell* pViewShell, ScAccessibleDocumentPagePreview* pAccDoc);
+ ~ScShapeChilds();
+
+ ///===== SfxListener =====================================================
+
+ virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
+
+ ///===== IAccessibleParent ==============================================
+
+ virtual sal_Bool ReplaceChild (
+ ::accessibility::AccessibleShape* pCurrentChild,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& _rxShape,
+ const long _nIndex,
+ const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
+ ) throw (::com::sun::star::uno::RuntimeException);
+
+ ///===== Internal ========================================================
+
+ void Init();
+
+ sal_Int32 GetBackShapeCount() const;
+ uno::Reference<XAccessible> GetBackShape(sal_Int32 nIndex) const;
+ sal_Int32 GetForeShapeCount() const;
+ uno::Reference<XAccessible> GetForeShape(sal_Int32 nIndex) const;
+ sal_Int32 GetControlCount() const;
+ uno::Reference<XAccessible> GetControl(sal_Int32 nIndex) const;
+ uno::Reference<XAccessible> GetForegroundShapeAt(const awt::Point& rPoint) const; // inclusive controls
+ uno::Reference<XAccessible> GetBackgroundShapeAt(const awt::Point& rPoint) const;
+
+ void DataChanged();
+ void VisAreaChanged() const;
+
+ void SetDrawBroadcaster();
+private:
+ ScAccessibleDocumentPagePreview* mpAccDoc;
+ ScPreviewShell* mpViewShell;
+ ScShapeRangeVec maShapeRanges;
+
+ void FindChanged(ScShapeChildVec& aOld, ScShapeChildVec& aNew) const;
+ void FindChanged(ScShapeRange& aOld, ScShapeRange& aNew) const;
+ ::accessibility::AccessibleShape* GetAccShape(const ScShapeChild& rShape) const;
+ ::accessibility::AccessibleShape* GetAccShape(const ScShapeChildVec& rShapes, sal_Int32 nIndex) const;
+ void FillShapes(const Rectangle& aPixelPaintRect, const MapMode& aMapMode, sal_uInt8 nRangeId);
+
+// void AddShape(const uno::Reference<drawing::XShape>& xShape, SdrLayerID aLayerID);
+// void RemoveShape(const uno::Reference<drawing::XShape>& xShape, SdrLayerID aLayerID);
+ SdrPage* GetDrawPage() const;
+};
+
+ScShapeChilds::ScShapeChilds(ScPreviewShell* pViewShell, ScAccessibleDocumentPagePreview* pAccDoc)
+ :
+ mpAccDoc(pAccDoc),
+ mpViewShell(pViewShell),
+ maShapeRanges(SC_PREVIEW_MAXRANGES)
+{
+ if (pViewShell)
+ {
+ SfxBroadcaster* pDrawBC = pViewShell->GetDocument()->GetDrawBroadcaster();
+ if (pDrawBC)
+ StartListening(*pDrawBC);
+ }
+}
+
+ScShapeChilds::~ScShapeChilds()
+{
+ if (mpViewShell)
+ {
+ SfxBroadcaster* pDrawBC = mpViewShell->GetDocument()->GetDrawBroadcaster();
+ if (pDrawBC)
+ EndListening(*pDrawBC);
+ }
+}
+
+void ScShapeChilds::SetDrawBroadcaster()
+{
+ if (mpViewShell)
+ {
+ SfxBroadcaster* pDrawBC = mpViewShell->GetDocument()->GetDrawBroadcaster();
+ if (pDrawBC)
+ StartListening(*pDrawBC, sal_True);
+ }
+}
+
+void ScShapeChilds::Notify(SfxBroadcaster&, const SfxHint& rHint)
+{
+ if ( rHint.ISA( SdrHint ) )
+ {
+ const SdrHint* pSdrHint = PTR_CAST( SdrHint, &rHint );
+ if (pSdrHint)
+ {
+ SdrObject* pObj = const_cast<SdrObject*>(pSdrHint->GetObject());
+ if (pObj && (pObj->GetPage() == GetDrawPage()))
+ {
+ switch (pSdrHint->GetKind())
+ {
+ case HINT_OBJCHG : // Objekt geaendert
+ {
+ }
+ break;
+ default :
+ {
+ // other events are not interesting
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
+void ScShapeChilds::FindChanged(ScShapeChildVec& rOld, ScShapeChildVec& rNew) const
+{
+ ScShapeChildVec::iterator aOldItr = rOld.begin();
+ ScShapeChildVec::iterator aOldEnd = rOld.end();
+ ScShapeChildVec::const_iterator aNewItr = rNew.begin();
+ ScShapeChildVec::const_iterator aNewEnd = rNew.begin();
+ uno::Reference<XAccessible> xAcc;
+ while ((aNewItr != aNewEnd) && (aOldItr != aOldEnd))
+ {
+ if (aNewItr->mxShape.get() == aOldItr->mxShape.get())
+ {
+ ++aOldItr;
+ ++aNewItr;
+ }
+ else if (aNewItr->mxShape.get() < aOldItr->mxShape.get())
+ {
+ xAcc = GetAccShape(*aNewItr);
+ AccessibleEventObject aEvent;
+ aEvent.Source = uno::Reference<XAccessibleContext> (mpAccDoc);
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAcc;
+ mpAccDoc->CommitChange(aEvent);
+ ++aNewItr;
+ }
+ else
+ {
+ xAcc = GetAccShape(*aOldItr);
+ AccessibleEventObject aEvent;
+ aEvent.Source = uno::Reference<XAccessibleContext> (mpAccDoc);
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.OldValue <<= xAcc;
+ mpAccDoc->CommitChange(aEvent);
+ ++aOldItr;
+ }
+ }
+ while (aOldItr != aOldEnd)
+ {
+ xAcc = GetAccShape(*aOldItr);
+ AccessibleEventObject aEvent;
+ aEvent.Source = uno::Reference<XAccessibleContext> (mpAccDoc);
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.OldValue <<= xAcc;
+ mpAccDoc->CommitChange(aEvent);
+ ++aOldItr;
+ }
+ while (aNewItr != aNewEnd)
+ {
+ xAcc = GetAccShape(*aNewItr);
+ AccessibleEventObject aEvent;
+ aEvent.Source = uno::Reference<XAccessibleContext> (mpAccDoc);
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.NewValue <<= xAcc;
+ mpAccDoc->CommitChange(aEvent);
+ ++aNewItr;
+ }
+}
+
+void ScShapeChilds::FindChanged(ScShapeRange& rOld, ScShapeRange& rNew) const
+{
+ FindChanged(rOld.maBackShapes, rNew.maBackShapes);
+ FindChanged(rOld.maForeShapes, rNew.maForeShapes);
+ FindChanged(rOld.maControls, rNew.maControls);
+}
+
+void ScShapeChilds::DataChanged()
+{
+ ScShapeRangeVec aOldShapeRanges(maShapeRanges);
+ maShapeRanges.clear();
+ maShapeRanges.resize(SC_PREVIEW_MAXRANGES);
+ Init();
+ for (sal_Int32 i = 0; i < SC_PREVIEW_MAXRANGES; ++i)
+ {
+ FindChanged(aOldShapeRanges[i], maShapeRanges[i]);
+ }
+}
+
+struct ScVisAreaChanged
+{
+ const ScIAccessibleViewForwarder* mpViewForwarder;
+ ScVisAreaChanged(const ScIAccessibleViewForwarder* pViewForwarder) : mpViewForwarder(pViewForwarder) {}
+ void operator() (const ScShapeChild& rAccShapeData) const
+ {
+ if (rAccShapeData.mpAccShape)
+ {
+ rAccShapeData.mpAccShape->ViewForwarderChanged(::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA, mpViewForwarder);
+ }
+ }
+};
+
+void ScShapeChilds::VisAreaChanged() const
+{
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin();
+ while (aItr != aEndItr)
+ {
+ ScVisAreaChanged aVisAreaChanged(&(aItr->maViewForwarder));
+ std::for_each(aItr->maBackShapes.begin(), aItr->maBackShapes.end(), aVisAreaChanged);
+ std::for_each(aItr->maControls.begin(), aItr->maControls.end(), aVisAreaChanged);
+ std::for_each(aItr->maForeShapes.begin(), aItr->maForeShapes.end(), aVisAreaChanged);
+ ++aItr;
+ }
+}
+
+ ///===== IAccessibleParent ==============================================
+
+sal_Bool ScShapeChilds::ReplaceChild (::accessibility::AccessibleShape* /* pCurrentChild */,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& /* _rxShape */,
+ const long /* _nIndex */, const ::accessibility::AccessibleShapeTreeInfo& /* _rShapeTreeInfo */)
+ throw (uno::RuntimeException)
+{
+ DBG_ERRORFILE("should not be called in the page preview");
+ return false;
+}
+
+ ///===== Internal ========================================================
+
+void ScShapeChilds::Init()
+{
+ if(mpViewShell)
+ {
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ MapMode aMapMode;
+ Rectangle aPixelPaintRect;
+ sal_uInt8 nRangeId;
+ sal_uInt16 nCount(rData.GetDrawRanges());
+ for (sal_uInt16 i = 0; i < nCount; ++i)
+ {
+ rData.GetDrawRange(i, aPixelPaintRect, aMapMode, nRangeId);
+ FillShapes(aPixelPaintRect, aMapMode, nRangeId);
+ }
+ }
+}
+
+sal_Int32 ScShapeChilds::GetBackShapeCount() const
+{
+ sal_Int32 nCount(0);
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ for ( ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin(); aItr != aEndItr; ++aItr )
+ nCount += aItr->maBackShapes.size();
+ return nCount;
+}
+
+uno::Reference<XAccessible> ScShapeChilds::GetBackShape(sal_Int32 nIndex) const
+{
+ uno::Reference<XAccessible> xAccessible;
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin();
+ while ((aItr != aEndItr) && !xAccessible.is())
+ {
+ sal_Int32 nCount(aItr->maBackShapes.size());
+ if(nIndex < nCount)
+ xAccessible = GetAccShape(aItr->maBackShapes, nIndex);
+ else
+ ++aItr;
+ nIndex -= nCount;
+ }
+
+ if (nIndex >= 0)
+ throw lang::IndexOutOfBoundsException();
+
+ return xAccessible;
+}
+
+sal_Int32 ScShapeChilds::GetForeShapeCount() const
+{
+ sal_Int32 nCount(0);
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ for ( ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin(); aItr != aEndItr; ++aItr )
+ nCount += aItr->maForeShapes.size();
+ return nCount;
+}
+
+uno::Reference<XAccessible> ScShapeChilds::GetForeShape(sal_Int32 nIndex) const
+{
+ uno::Reference<XAccessible> xAccessible;
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin();
+ while ((aItr != aEndItr) && !xAccessible.is())
+ {
+ sal_Int32 nCount(aItr->maForeShapes.size());
+ if(nIndex < nCount)
+ xAccessible = GetAccShape(aItr->maForeShapes, nIndex);
+ else
+ ++aItr;
+ nIndex -= nCount;
+ }
+
+ if (nIndex >= 0)
+ throw lang::IndexOutOfBoundsException();
+
+ return xAccessible;
+}
+
+sal_Int32 ScShapeChilds::GetControlCount() const
+{
+ sal_Int32 nCount(0);
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ for ( ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin(); aItr != aEndItr; ++aItr )
+ nCount += aItr->maControls.size();
+ return nCount;
+}
+
+uno::Reference<XAccessible> ScShapeChilds::GetControl(sal_Int32 nIndex) const
+{
+ uno::Reference<XAccessible> xAccessible;
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin();
+ while ((aItr != aEndItr) && !xAccessible.is())
+ {
+ sal_Int32 nCount(aItr->maControls.size());
+ if(nIndex < nCount)
+ xAccessible = GetAccShape(aItr->maControls, nIndex);
+ else
+ ++aItr;
+ nIndex -= nCount;
+ }
+
+ if (nIndex >= 0)
+ throw lang::IndexOutOfBoundsException();
+
+ return xAccessible;
+}
+
+struct ScShapePointFound
+{
+ Point maPoint;
+ ScShapePointFound(const awt::Point& rPoint) : maPoint(VCLPoint(rPoint)) {}
+ sal_Bool operator() (const ScShapeChild& rShape)
+ {
+ sal_Bool bResult(false);
+ if ((VCLRectangle(rShape.mpAccShape->getBounds())).IsInside(maPoint))
+ bResult = sal_True;
+ return bResult;
+ }
+};
+
+uno::Reference<XAccessible> ScShapeChilds::GetForegroundShapeAt(const awt::Point& rPoint) const //inclusive Controls
+{
+ uno::Reference<XAccessible> xAcc;
+
+ ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin();
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ while((aItr != aEndItr) && !xAcc.is())
+ {
+ ScShapeChildVec::const_iterator aFindItr = std::find_if(aItr->maForeShapes.begin(), aItr->maForeShapes.end(), ScShapePointFound(rPoint));
+ if (aFindItr != aItr->maForeShapes.end())
+ xAcc = GetAccShape(*aFindItr);
+ else
+ {
+ ScShapeChildVec::const_iterator aCtrlItr = std::find_if(aItr->maControls.begin(), aItr->maControls.end(), ScShapePointFound(rPoint));
+ if (aCtrlItr != aItr->maControls.end())
+ xAcc = GetAccShape(*aCtrlItr);
+ else
+ ++aItr;
+ }
+ }
+
+ return xAcc;
+}
+
+uno::Reference<XAccessible> ScShapeChilds::GetBackgroundShapeAt(const awt::Point& rPoint) const
+{
+ uno::Reference<XAccessible> xAcc;
+
+ ScShapeRangeVec::const_iterator aItr = maShapeRanges.begin();
+ ScShapeRangeVec::const_iterator aEndItr = maShapeRanges.end();
+ while((aItr != aEndItr) && !xAcc.is())
+ {
+ ScShapeChildVec::const_iterator aFindItr = std::find_if(aItr->maBackShapes.begin(), aItr->maBackShapes.end(), ScShapePointFound(rPoint));
+ if (aFindItr != aItr->maBackShapes.end())
+ xAcc = GetAccShape(*aFindItr);
+ else
+ ++aItr;
+ }
+
+ return xAcc;
+}
+
+::accessibility::AccessibleShape* ScShapeChilds::GetAccShape(const ScShapeChild& rShape) const
+{
+ if (!rShape.mpAccShape)
+ {
+ ::accessibility::ShapeTypeHandler& rShapeHandler = ::accessibility::ShapeTypeHandler::Instance();
+ ::accessibility::AccessibleShapeInfo aShapeInfo(rShape.mxShape, mpAccDoc, const_cast<ScShapeChilds*>(this));
+
+ if (mpViewShell)
+ {
+ ::accessibility::AccessibleShapeTreeInfo aShapeTreeInfo;
+ aShapeTreeInfo.SetSdrView(mpViewShell->GetPreview()->GetDrawView());
+ aShapeTreeInfo.SetController(NULL);
+ aShapeTreeInfo.SetWindow(mpViewShell->GetWindow());
+ aShapeTreeInfo.SetViewForwarder(&(maShapeRanges[rShape.mnRangeId].maViewForwarder));
+ rShape.mpAccShape = rShapeHandler.CreateAccessibleObject(aShapeInfo, aShapeTreeInfo);
+ if (rShape.mpAccShape)
+ {
+ rShape.mpAccShape->acquire();
+ rShape.mpAccShape->Init();
+ }
+ }
+ }
+ return rShape.mpAccShape;
+}
+
+::accessibility::AccessibleShape* ScShapeChilds::GetAccShape(const ScShapeChildVec& rShapes, sal_Int32 nIndex) const
+{
+ return (GetAccShape(rShapes[nIndex]));
+}
+
+void ScShapeChilds::FillShapes(const Rectangle& aPixelPaintRect, const MapMode& aMapMode, sal_uInt8 nRangeId)
+{
+ DBG_ASSERT(nRangeId < maShapeRanges.size(), "this is not a valid range for draw objects");
+ SdrPage* pPage = GetDrawPage();
+ Window* pWin = mpViewShell->GetWindow();
+ if (pPage && pWin)
+ {
+ sal_Bool bForeAdded(false);
+ sal_Bool bBackAdded(false);
+ sal_Bool bControlAdded(false);
+ Rectangle aClippedPixelPaintRect(aPixelPaintRect);
+ if (mpAccDoc)
+ {
+ Rectangle aRect2(Point(0,0), mpAccDoc->GetBoundingBoxOnScreen().GetSize());
+ aClippedPixelPaintRect = aPixelPaintRect.GetIntersection(aRect2);
+ }
+ maShapeRanges[nRangeId].maPixelRect = aClippedPixelPaintRect;
+ maShapeRanges[nRangeId].maMapMode = aMapMode;
+ ScIAccessibleViewForwarder aViewForwarder(mpViewShell, mpAccDoc, aMapMode);
+ maShapeRanges[nRangeId].maViewForwarder = aViewForwarder;
+ sal_uInt32 nCount(pPage->GetObjCount());
+ for (sal_uInt32 i = 0; i < nCount; ++i)
+ {
+ SdrObject* pObj = pPage->GetObj(i);
+ if (pObj)
+ {
+ uno::Reference< drawing::XShape > xShape(pObj->getUnoShape(), uno::UNO_QUERY);
+ if (xShape.is())
+ {
+ Rectangle aRect(pWin->LogicToPixel(VCLPoint(xShape->getPosition()), aMapMode), pWin->LogicToPixel(VCLSize(xShape->getSize()), aMapMode));
+ if(!aClippedPixelPaintRect.GetIntersection(aRect).IsEmpty())
+ {
+ ScShapeChild aShape;
+ aShape.mxShape = xShape;
+ aShape.mnRangeId = nRangeId;
+ switch (pObj->GetLayer())
+ {
+ case SC_LAYER_INTERN:
+ case SC_LAYER_FRONT:
+ {
+ maShapeRanges[nRangeId].maForeShapes.push_back(aShape);
+ bForeAdded = sal_True;
+ }
+ break;
+ case SC_LAYER_BACK:
+ {
+ maShapeRanges[nRangeId].maBackShapes.push_back(aShape);
+ bBackAdded = sal_True;
+ }
+ break;
+ case SC_LAYER_CONTROLS:
+ {
+ maShapeRanges[nRangeId].maControls.push_back(aShape);
+ bControlAdded = sal_True;
+ }
+ break;
+ default:
+ {
+ DBG_ERRORFILE("I don't know this layer.");
+ }
+ break;
+ }
+ }
+ }
+ }
+ }
+ if (bForeAdded)
+ std::sort(maShapeRanges[nRangeId].maForeShapes.begin(), maShapeRanges[nRangeId].maForeShapes.end(),ScShapeChildLess());
+ if (bBackAdded)
+ std::sort(maShapeRanges[nRangeId].maBackShapes.begin(), maShapeRanges[nRangeId].maBackShapes.end(),ScShapeChildLess());
+ if (bControlAdded)
+ std::sort(maShapeRanges[nRangeId].maControls.begin(), maShapeRanges[nRangeId].maControls.end(),ScShapeChildLess());
+ }
+}
+
+SdrPage* ScShapeChilds::GetDrawPage() const
+{
+ SCTAB nTab( mpViewShell->GetLocationData().GetPrintTab() );
+ SdrPage* pDrawPage = NULL;
+ if (mpViewShell)
+ {
+ ScDocument* pDoc = mpViewShell->GetDocument();
+ if (pDoc && pDoc->GetDrawLayer())
+ {
+ ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+ if (pDrawLayer->HasObjects() && (pDrawLayer->GetPageCount() > nTab))
+ pDrawPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(static_cast<sal_Int16>(nTab)));
+ }
+ }
+ return pDrawPage;
+}
+
+struct ScPagePreviewCountData
+{
+ // order is background shapes, header, table or notes, footer, foreground shapes, controls
+
+ Rectangle aVisRect;
+ long nBackShapes;
+ long nHeaders;
+ long nTables;
+ long nNoteParagraphs;
+ long nFooters;
+ long nForeShapes;
+ long nControls;
+
+ ScPagePreviewCountData( const ScPreviewLocationData& rData, Window* pSizeWindow,
+ ScNotesChilds* pNotesChilds, ScShapeChilds* pShapeChilds );
+
+ long GetTotal() const
+ {
+ return nBackShapes + nHeaders + nTables + nNoteParagraphs + nFooters + nForeShapes + nControls;
+ }
+};
+
+ScPagePreviewCountData::ScPagePreviewCountData( const ScPreviewLocationData& rData,
+ Window* pSizeWindow, ScNotesChilds* pNotesChilds,
+ ScShapeChilds* pShapeChilds) :
+ nBackShapes( 0 ),
+ nHeaders( 0 ),
+ nTables( 0 ),
+ nNoteParagraphs( 0 ),
+ nFooters( 0 ),
+ nForeShapes( 0 ),
+ nControls( 0 )
+{
+ Size aOutputSize;
+ if ( pSizeWindow )
+ aOutputSize = pSizeWindow->GetOutputSizePixel();
+ Point aPoint;
+ aVisRect = Rectangle( aPoint, aOutputSize );
+
+ Rectangle aObjRect;
+
+ if ( rData.GetHeaderPosition( aObjRect ) && aObjRect.IsOver( aVisRect ) )
+ nHeaders = 1;
+
+ if ( rData.GetFooterPosition( aObjRect ) && aObjRect.IsOver( aVisRect ) )
+ nFooters = 1;
+
+ if ( rData.HasCellsInRange( aVisRect ) )
+ nTables = 1;
+
+ //! shapes...
+ nBackShapes = pShapeChilds->GetBackShapeCount();
+ nForeShapes = pShapeChilds->GetForeShapeCount();
+ nControls = pShapeChilds->GetControlCount();
+
+ // there are only notes if there is no table
+ if (nTables == 0)
+ nNoteParagraphs = pNotesChilds->GetChildsCount();
+}
+
+//===== internal ========================================================
+
+ScAccessibleDocumentPagePreview::ScAccessibleDocumentPagePreview(
+ const uno::Reference<XAccessible>& rxParent, ScPreviewShell* pViewShell ) :
+ ScAccessibleDocumentBase(rxParent),
+ mpViewShell(pViewShell),
+ mpNotesChilds(NULL),
+ mpShapeChilds(NULL),
+ mpTable(NULL),
+ mpHeader(NULL),
+ mpFooter(NULL)
+{
+ if (pViewShell)
+ pViewShell->AddAccessibilityObject(*this);
+
+}
+
+ScAccessibleDocumentPagePreview::~ScAccessibleDocumentPagePreview(void)
+{
+ if (!ScAccessibleDocumentBase::IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ // call dispose to inform object wich have a weak reference to this object
+ dispose();
+ }
+}
+
+void SAL_CALL ScAccessibleDocumentPagePreview::disposing()
+{
+ SolarMutexGuard aGuard;
+ if (mpTable)
+ {
+ mpTable->release();
+ mpTable = NULL;
+ }
+ if (mpHeader)
+ {
+ mpHeader->release();
+ mpHeader = NULL;
+ }
+ if (mpFooter)
+ {
+ mpFooter->release();
+ mpFooter = NULL;
+ }
+
+ if (mpViewShell)
+ {
+ mpViewShell->RemoveAccessibilityObject(*this);
+ mpViewShell = NULL;
+ }
+
+ // no need to Dispose the AccessibleTextHelper,
+ // as long as mpNotesChilds are destructed here
+ if (mpNotesChilds)
+ DELETEZ(mpNotesChilds);
+
+ if (mpShapeChilds)
+ DELETEZ(mpShapeChilds);
+
+ ScAccessibleDocumentBase::disposing();
+}
+
+//===== SfxListener =====================================================
+
+void ScAccessibleDocumentPagePreview::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_DATACHANGED))
+ {
+ if (mpTable) // if there is no table there is nothing to notify, because no one recongnizes the change
+ {
+ {
+ uno::Reference<XAccessible> xAcc = mpTable;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.OldValue <<= xAcc;
+ CommitChange(aEvent);
+ }
+
+ mpTable->dispose();
+ mpTable->release();
+ mpTable = NULL;
+ }
+
+ Size aOutputSize;
+ Window* pSizeWindow = mpViewShell->GetWindow();
+ if ( pSizeWindow )
+ aOutputSize = pSizeWindow->GetOutputSizePixel();
+ Point aPoint;
+ Rectangle aVisRect( aPoint, aOutputSize );
+ GetNotesChilds()->DataChanged(aVisRect);
+
+ GetShapeChilds()->DataChanged();
+
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+
+ if (aCount.nTables > 0)
+ {
+ //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+ sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
+
+ mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
+ mpTable->acquire();
+ mpTable->Init();
+
+ {
+ uno::Reference<XAccessible> xAcc = mpTable;
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.NewValue <<= xAcc;
+ CommitChange(aEvent);
+ }
+ }
+ }
+ else if (rRef.GetId() == SC_HINT_ACC_MAKEDRAWLAYER)
+ {
+ GetShapeChilds()->SetDrawBroadcaster();
+ }
+ else if (rRef.GetId() == SC_HINT_ACC_VISAREACHANGED)
+ {
+ Size aOutputSize;
+ Window* pSizeWindow = mpViewShell->GetWindow();
+ if ( pSizeWindow )
+ aOutputSize = pSizeWindow->GetOutputSizePixel();
+ Point aPoint;
+ Rectangle aVisRect( aPoint, aOutputSize );
+ GetNotesChilds()->DataChanged(aVisRect);
+
+ GetShapeChilds()->VisAreaChanged();
+
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ CommitChange(aEvent);
+ }
+ }
+ else if ( rHint.ISA(ScAccWinFocusLostHint) )
+ {
+ CommitFocusLost();
+ }
+ else if ( rHint.ISA(ScAccWinFocusGotHint) )
+ {
+ CommitFocusGained();
+ }
+ ScAccessibleDocumentBase::Notify(rBC, rHint);
+}
+
+//===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleDocumentPagePreview::getAccessibleAtPoint( const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ uno::Reference<XAccessible> xAccessible;
+ if (containsPoint(rPoint))
+ {
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if ( mpViewShell )
+ {
+ xAccessible = GetShapeChilds()->GetForegroundShapeAt(rPoint);
+ if (!xAccessible.is())
+ {
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+
+ if ( !mpTable && (aCount.nTables > 0) )
+ {
+ //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+ sal_Int32 nIndex (aCount.nBackShapes + aCount.nHeaders);
+
+ mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
+ mpTable->acquire();
+ mpTable->Init();
+ }
+ if (mpTable && VCLRectangle(mpTable->getBounds()).IsInside(VCLPoint(rPoint)))
+ xAccessible = mpTable;
+ }
+ if (!xAccessible.is())
+ xAccessible = GetNotesChilds()->GetAt(rPoint);
+ if (!xAccessible.is())
+ {
+ if (!mpHeader || !mpFooter)
+ {
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+
+ if (!mpHeader)
+ {
+ mpHeader = new ScAccessiblePageHeader( this, mpViewShell, sal_True, aCount.nBackShapes + aCount.nHeaders - 1);
+ mpHeader->acquire();
+ }
+ if (!mpFooter)
+ {
+ mpFooter = new ScAccessiblePageHeader( this, mpViewShell, false, aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs + aCount.nFooters - 1 );
+ mpFooter->acquire();
+ }
+ }
+
+ Point aPoint(VCLPoint(rPoint));
+
+ if (VCLRectangle(mpHeader->getBounds()).IsInside(aPoint))
+ xAccessible = mpHeader;
+ else if (VCLRectangle(mpFooter->getBounds()).IsInside(aPoint))
+ xAccessible = mpFooter;
+ }
+ if (!xAccessible.is())
+ xAccessible = GetShapeChilds()->GetBackgroundShapeAt(rPoint);
+ }
+ }
+
+ return xAccessible;
+}
+
+void SAL_CALL ScAccessibleDocumentPagePreview::grabFocus() throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
+ if (xAccessibleComponent.is())
+ {
+ // just grab the focus for the window
+ xAccessibleComponent->grabFocus();
+ }
+ }
+}
+
+//===== XAccessibleContext ==============================================
+
+sal_Int32 SAL_CALL ScAccessibleDocumentPagePreview::getAccessibleChildCount(void) throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ long nRet = 0;
+ if ( mpViewShell )
+ {
+ ScPagePreviewCountData aCount( mpViewShell->GetLocationData(), mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+ nRet = aCount.GetTotal();
+ }
+
+ return nRet;
+}
+
+uno::Reference<XAccessible> SAL_CALL ScAccessibleDocumentPagePreview::getAccessibleChild(sal_Int32 nIndex)
+ throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ uno::Reference<XAccessible> xAccessible;
+
+ if ( mpViewShell )
+ {
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+
+ if ( nIndex < aCount.nBackShapes )
+ {
+ xAccessible = GetShapeChilds()->GetBackShape(nIndex);
+ }
+ else if ( nIndex < aCount.nBackShapes + aCount.nHeaders )
+ {
+ if ( !mpHeader )
+ {
+ mpHeader = new ScAccessiblePageHeader( this, mpViewShell, sal_True, nIndex );
+ mpHeader->acquire();
+ }
+
+ xAccessible = mpHeader;
+ }
+ else if ( nIndex < aCount.nBackShapes + aCount.nHeaders + aCount.nTables )
+ {
+ if ( !mpTable )
+ {
+ mpTable = new ScAccessiblePreviewTable( this, mpViewShell, nIndex );
+ mpTable->acquire();
+ mpTable->Init();
+ }
+ xAccessible = mpTable;
+ }
+ else if ( nIndex < aCount.nBackShapes + aCount.nHeaders + aCount.nNoteParagraphs )
+ {
+ xAccessible = GetNotesChilds()->GetChild(nIndex - aCount.nBackShapes - aCount.nHeaders);
+ }
+ else if ( (nIndex < aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs + aCount.nFooters) )
+ {
+ if ( !mpFooter )
+ {
+ mpFooter = new ScAccessiblePageHeader( this, mpViewShell, false, nIndex );
+ mpFooter->acquire();
+ }
+ xAccessible = mpFooter;
+ }
+ else
+ {
+ sal_Int32 nIdx(nIndex - (aCount.nBackShapes + aCount.nHeaders + aCount.nTables + aCount.nNoteParagraphs + aCount.nFooters));
+ if (nIdx < aCount.nForeShapes)
+ xAccessible = GetShapeChilds()->GetForeShape(nIdx);
+ else
+ xAccessible = GetShapeChilds()->GetControl(nIdx - aCount.nForeShapes);
+ }
+ }
+
+ if ( !xAccessible.is() )
+ throw lang::IndexOutOfBoundsException();
+
+ return xAccessible;
+}
+
+ /// Return the set of current states.
+uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDocumentPagePreview::getAccessibleStateSet(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+ if (IsDefunc(xParentStates))
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ // never editable
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::OPAQUE);
+ if (isShowing())
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ if (isVisible())
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ }
+ return pStateSet;
+}
+
+ //===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL ScAccessibleDocumentPagePreview::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessibleDocumentPagePreview"));
+}
+
+uno::Sequence< ::rtl::OUString> SAL_CALL ScAccessibleDocumentPagePreview::getSupportedServiceNames(void)
+ throw (uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSequence = ScAccessibleContextBase::getSupportedServiceNames();
+ sal_Int32 nOldSize(aSequence.getLength());
+ aSequence.realloc(nOldSize + 1);
+ ::rtl::OUString* pNames = aSequence.getArray();
+
+ pNames[nOldSize] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.AccessibleSpreadsheetPageView"));
+
+ return aSequence;
+}
+
+//===== XTypeProvider =======================================================
+
+uno::Sequence<sal_Int8> SAL_CALL
+ ScAccessibleDocumentPagePreview::getImplementationId(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+//===== internal ========================================================
+
+::rtl::OUString SAL_CALL ScAccessibleDocumentPagePreview::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ rtl::OUString sDescription = String(ScResId(STR_ACC_PREVIEWDOC_DESCR));
+ return sDescription;
+}
+
+::rtl::OUString SAL_CALL ScAccessibleDocumentPagePreview::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ rtl::OUString sName = String(ScResId(STR_ACC_PREVIEWDOC_NAME));
+ return sName;
+}
+
+Rectangle ScAccessibleDocumentPagePreview::GetBoundingBoxOnScreen() const throw (uno::RuntimeException)
+{
+ Rectangle aRect;
+ if (mpViewShell)
+ {
+ Window* pWindow = mpViewShell->GetWindow();
+ if (pWindow)
+ aRect = pWindow->GetWindowExtentsRelative(NULL);
+ }
+ return aRect;
+}
+
+Rectangle ScAccessibleDocumentPagePreview::GetBoundingBox() const throw (uno::RuntimeException)
+{
+ Rectangle aRect;
+ if (mpViewShell)
+ {
+ Window* pWindow = mpViewShell->GetWindow();
+ if (pWindow)
+ aRect = pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow());
+ }
+ return aRect;
+}
+
+sal_Bool ScAccessibleDocumentPagePreview::IsDefunc(
+ const uno::Reference<XAccessibleStateSet>& rxParentStates)
+{
+ return ScAccessibleContextBase::IsDefunc() || !getAccessibleParent().is() ||
+ (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
+}
+
+ScNotesChilds* ScAccessibleDocumentPagePreview::GetNotesChilds()
+{
+ if (!mpNotesChilds && mpViewShell)
+ {
+ mpNotesChilds = new ScNotesChilds(mpViewShell, this);
+
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ ScPagePreviewCountData aCount( rData, mpViewShell->GetWindow(), GetNotesChilds(), GetShapeChilds() );
+
+ //! order is background shapes, header, table or notes, footer, foreground shapes, controls
+ mpNotesChilds->Init(aCount.aVisRect, aCount.nBackShapes + aCount.nHeaders);
+ }
+ return mpNotesChilds;
+}
+
+ScShapeChilds* ScAccessibleDocumentPagePreview::GetShapeChilds()
+{
+ if (!mpShapeChilds && mpViewShell)
+ {
+ mpShapeChilds = new ScShapeChilds(mpViewShell, this);
+ mpShapeChilds->Init();
+ }
+
+ return mpShapeChilds;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
new file mode 100644
index 000000000000..d30cd246857e
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -0,0 +1,354 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+#include "AccessibleEditObject.hxx"
+#include "scitems.hxx"
+#include <editeng/eeitem.hxx>
+#include "AccessibleText.hxx"
+#include "editsrc.hxx"
+#include "scmod.hxx"
+#include "inputhdl.hxx"
+
+#include <unotools/accessiblestatesethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <rtl/uuid.h>
+#include <tools/debug.hxx>
+#include <svx/AccessibleTextHelper.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/editeng.hxx>
+#include <svx/svdmodel.hxx>
+#include <vcl/svapp.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+//===== internal ============================================================
+
+ScAccessibleEditObject::ScAccessibleEditObject(
+ const uno::Reference<XAccessible>& rxParent,
+ EditView* pEditView, Window* pWin, const rtl::OUString& rName,
+ const rtl::OUString& rDescription, EditObjectType eObjectType)
+ :
+ ScAccessibleContextBase(rxParent, AccessibleRole::TEXT_FRAME),
+ mpTextHelper(NULL),
+ mpEditView(pEditView),
+ mpWindow(pWin),
+ meObjectType(eObjectType),
+ mbHasFocus(false)
+{
+ CreateTextHelper();
+ SetName(rName);
+ SetDescription(rDescription);
+}
+
+ScAccessibleEditObject::~ScAccessibleEditObject()
+{
+ if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ // call dispose to inform object wich have a weak reference to this object
+ dispose();
+ }
+}
+
+void SAL_CALL ScAccessibleEditObject::disposing()
+{
+ SolarMutexGuard aGuard;
+ if (mpTextHelper)
+ DELETEZ(mpTextHelper);
+
+ ScAccessibleContextBase::disposing();
+}
+
+void ScAccessibleEditObject::LostFocus()
+{
+ mbHasFocus = false;
+ if (mpTextHelper)
+ mpTextHelper->SetFocus(false);
+ CommitFocusLost();
+}
+
+void ScAccessibleEditObject::GotFocus()
+{
+ mbHasFocus = sal_True;
+ CommitFocusGained();
+ if (mpTextHelper)
+ mpTextHelper->SetFocus(sal_True);
+}
+
+ //===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessibleEditObject::getAccessibleAtPoint(
+ const awt::Point& rPoint )
+ throw (uno::RuntimeException)
+{
+ uno::Reference<XAccessible> xRet;
+ if (containsPoint(rPoint))
+ {
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if(!mpTextHelper)
+ CreateTextHelper();
+
+ xRet = mpTextHelper->GetAt(rPoint);
+ }
+
+ return xRet;
+}
+
+Rectangle ScAccessibleEditObject::GetBoundingBoxOnScreen(void) const
+ throw (uno::RuntimeException)
+{
+ Rectangle aScreenBounds;
+
+ if ( mpWindow )
+ {
+ if ( meObjectType == CellInEditMode )
+ {
+ if ( mpEditView && mpEditView->GetEditEngine() )
+ {
+ MapMode aMapMode( mpEditView->GetEditEngine()->GetRefMapMode() );
+ aScreenBounds = mpWindow->LogicToPixel( mpEditView->GetOutputArea(), aMapMode );
+ Point aCellLoc = aScreenBounds.TopLeft();
+ Rectangle aWindowRect = mpWindow->GetWindowExtentsRelative( NULL );
+ Point aWindowLoc = aWindowRect.TopLeft();
+ Point aPos( aCellLoc.getX() + aWindowLoc.getX(), aCellLoc.getY() + aWindowLoc.getY() );
+ aScreenBounds.SetPos( aPos );
+ }
+ }
+ else
+ {
+ aScreenBounds = mpWindow->GetWindowExtentsRelative( NULL );
+ }
+ }
+
+ return aScreenBounds;
+}
+
+Rectangle ScAccessibleEditObject::GetBoundingBox(void) const
+ throw (uno::RuntimeException)
+{
+ Rectangle aBounds( GetBoundingBoxOnScreen() );
+
+ if ( mpWindow )
+ {
+ uno::Reference< XAccessible > xThis( mpWindow->GetAccessible() );
+ if ( xThis.is() )
+ {
+ uno::Reference< XAccessibleContext > xContext( xThis->getAccessibleContext() );
+ if ( xContext.is() )
+ {
+ uno::Reference< XAccessible > xParent( xContext->getAccessibleParent() );
+ if ( xParent.is() )
+ {
+ uno::Reference< XAccessibleComponent > xParentComponent( xParent->getAccessibleContext(), uno::UNO_QUERY );
+ if ( xParentComponent.is() )
+ {
+ Point aScreenLoc = aBounds.TopLeft();
+ awt::Point aParentScreenLoc = xParentComponent->getLocationOnScreen();
+ Point aPos( aScreenLoc.getX() - aParentScreenLoc.X, aScreenLoc.getY() - aParentScreenLoc.Y );
+ aBounds.SetPos( aPos );
+ }
+ }
+ }
+ }
+ }
+
+ return aBounds;
+}
+
+ //===== XAccessibleContext ==============================================
+
+sal_Int32 SAL_CALL
+ ScAccessibleEditObject::getAccessibleChildCount(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (!mpTextHelper)
+ CreateTextHelper();
+ return mpTextHelper->GetChildCount();
+}
+
+uno::Reference< XAccessible > SAL_CALL
+ ScAccessibleEditObject::getAccessibleChild(sal_Int32 nIndex)
+ throw (uno::RuntimeException,
+ lang::IndexOutOfBoundsException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (!mpTextHelper)
+ CreateTextHelper();
+ return mpTextHelper->GetChild(nIndex);
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+ ScAccessibleEditObject::getAccessibleStateSet(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+ if (IsDefunc(xParentStates))
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ // all states are const, because this object exists only in one state
+ pStateSet->AddState(AccessibleStateType::EDITABLE);
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::SENSITIVE);
+ pStateSet->AddState(AccessibleStateType::MULTI_LINE);
+ pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ }
+ return pStateSet;
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleEditObject::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+// DBG_ERRORFILE("Should never be called, because is set in the constructor.")
+ return rtl::OUString();
+}
+
+::rtl::OUString SAL_CALL
+ ScAccessibleEditObject::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ DBG_ERRORFILE("Should never be called, because is set in the constructor.");
+ return rtl::OUString();
+}
+
+ ///===== XAccessibleEventBroadcaster =====================================
+
+void SAL_CALL
+ ScAccessibleEditObject::addEventListener(const uno::Reference<XAccessibleEventListener>& xListener)
+ throw (uno::RuntimeException)
+{
+ if (!mpTextHelper)
+ CreateTextHelper();
+
+ mpTextHelper->AddEventListener(xListener);
+
+ ScAccessibleContextBase::addEventListener(xListener);
+}
+
+void SAL_CALL
+ ScAccessibleEditObject::removeEventListener(const uno::Reference<XAccessibleEventListener>& xListener)
+ throw (uno::RuntimeException)
+{
+ if (!mpTextHelper)
+ CreateTextHelper();
+
+ mpTextHelper->RemoveEventListener(xListener);
+
+ ScAccessibleContextBase::removeEventListener(xListener);
+}
+
+ //===== XServiceInfo ====================================================
+
+::rtl::OUString SAL_CALL ScAccessibleEditObject::getImplementationName(void)
+ throw (uno::RuntimeException)
+{
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM ("ScAccessibleEditObject"));
+}
+
+//===== XTypeProvider =======================================================
+
+uno::Sequence<sal_Int8> SAL_CALL
+ ScAccessibleEditObject::getImplementationId(void)
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ static uno::Sequence<sal_Int8> aId;
+ if (aId.getLength() == 0)
+ {
+ aId.realloc (16);
+ rtl_createUuid (reinterpret_cast<sal_uInt8 *>(aId.getArray()), 0, sal_True);
+ }
+ return aId;
+}
+
+ //==== internal =========================================================
+
+sal_Bool ScAccessibleEditObject::IsDefunc(
+ const uno::Reference<XAccessibleStateSet>& rxParentStates)
+{
+ return ScAccessibleContextBase::IsDefunc() || !getAccessibleParent().is() ||
+ (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
+}
+
+void ScAccessibleEditObject::CreateTextHelper()
+{
+ if (!mpTextHelper)
+ {
+ ::std::auto_ptr < ScAccessibleTextData > pAccessibleTextData;
+ if (meObjectType == CellInEditMode || meObjectType == EditControl)
+ {
+ pAccessibleTextData.reset
+ (new ScAccessibleEditObjectTextData(mpEditView, mpWindow));
+ }
+ else
+ {
+ pAccessibleTextData.reset
+ (new ScAccessibleEditLineTextData(NULL, mpWindow));
+ }
+
+ ::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleTextData));
+ mpTextHelper = new ::accessibility::AccessibleTextHelper(pEditSource );
+ mpTextHelper->SetEventSource(this);
+ mpTextHelper->SetFocus(mbHasFocus);
+
+ // #i54814# activate cell in edit mode
+ if( meObjectType == CellInEditMode )
+ {
+ // do not activate cell object, if top edit line is active
+ const ScInputHandler* pInputHdl = SC_MOD()->GetInputHdl();
+ if( pInputHdl && !pInputHdl->IsTopMode() )
+ {
+ SdrHint aHint( HINT_BEGEDIT );
+ mpTextHelper->GetEditSource().GetBroadcaster().Broadcast( aHint );
+ }
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleFilterMenu.cxx b/sc/source/ui/Accessibility/AccessibleFilterMenu.cxx
new file mode 100644
index 000000000000..ce7e7d4de919
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleFilterMenu.cxx
@@ -0,0 +1,400 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+
+#include "precompiled_sc.hxx"
+#include "AccessibleGlobal.hxx"
+#include "AccessibleFilterMenu.hxx"
+#include "AccessibleFilterMenuItem.hxx"
+#include "global.hxx"
+#include "document.hxx"
+#include "docpool.hxx"
+
+#include "tools/gen.hxx"
+#include "editeng/unoedsrc.hxx"
+#include "editeng/editdata.hxx"
+#include "editeng/outliner.hxx"
+#include "vcl/unohelp.hxx"
+#include "dpcontrol.hxx"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::accessibility::AccessibleStateType;
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::lang::IllegalArgumentException;
+using ::com::sun::star::uno::RuntimeException;
+using ::rtl::OUString;
+using ::std::for_each;
+using ::std::vector;
+
+// ============================================================================
+
+namespace {
+
+class AddRemoveEventListener : public ::std::unary_function<void, Reference<XAccessible> >
+{
+public:
+ explicit AddRemoveEventListener(const Reference<XAccessibleEventListener>& rListener, bool bAdd) :
+ mxListener(rListener), mbAdd(bAdd) {}
+
+ void operator() (const Reference<XAccessible>& xAccessible) const
+ {
+ if (!xAccessible.is())
+ return;
+
+ Reference<XAccessibleEventBroadcaster> xBc(xAccessible, UNO_QUERY);
+ if (xBc.is())
+ {
+ if (mbAdd)
+ xBc->addEventListener(mxListener);
+ else
+ xBc->removeEventListener(mxListener);
+ }
+ }
+private:
+ Reference<XAccessibleEventListener> mxListener;
+ bool mbAdd;
+};
+
+}
+
+// ============================================================================
+
+ScAccessibleFilterMenu::ScAccessibleFilterMenu(const Reference<XAccessible>& rxParent, ScMenuFloatingWindow* pWin, const OUString& rName, size_t nMenuPos, ScDocument* pDoc) :
+ ScAccessibleContextBase(rxParent, AccessibleRole::MENU),
+ mnMenuPos(nMenuPos),
+ mpWindow(pWin),
+ mpDoc(pDoc),
+ mbEnabled(true)
+{
+ SetName(rName);
+}
+
+ScAccessibleFilterMenu::~ScAccessibleFilterMenu()
+{
+}
+
+// XAccessibleComponent
+
+Reference<XAccessible> ScAccessibleFilterMenu::getAccessibleAtPoint( const ::com::sun::star::awt::Point& /*rPoint*/ )
+ throw (RuntimeException)
+{
+ return this;
+}
+
+sal_Bool ScAccessibleFilterMenu::isVisible() throw (RuntimeException)
+{
+ return mpWindow->IsVisible();
+}
+
+void ScAccessibleFilterMenu::grabFocus()
+ throw (RuntimeException)
+{
+}
+
+sal_Int32 ScAccessibleFilterMenu::getForeground()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+sal_Int32 ScAccessibleFilterMenu::getBackground()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+// XAccessibleContext
+
+OUString ScAccessibleFilterMenu::getAccessibleName() throw (RuntimeException)
+{
+ return ScAccessibleContextBase::getAccessibleName();
+}
+
+sal_Int32 ScAccessibleFilterMenu::getAccessibleChildCount()
+ throw (RuntimeException)
+{
+ return getMenuItemCount();
+}
+
+Reference<XAccessible> ScAccessibleFilterMenu::getAccessibleChild(sal_Int32 nIndex)
+ throw (RuntimeException, IndexOutOfBoundsException)
+{
+ if (maMenuItems.size() <= static_cast<size_t>(nIndex))
+ throw IndexOutOfBoundsException();
+
+ return maMenuItems[nIndex];
+}
+
+Reference<XAccessibleStateSet> ScAccessibleFilterMenu::getAccessibleStateSet()
+ throw (RuntimeException)
+{
+ updateStates();
+ return mxStateSet;
+}
+
+OUString ScAccessibleFilterMenu::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessibleFilterMenu"));
+}
+
+// XAccessibleEventBroadcaster
+
+void ScAccessibleFilterMenu::addEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
+ throw (com::sun::star::uno::RuntimeException)
+{
+ ScAccessibleContextBase::addEventListener(xListener);
+ for_each(maMenuItems.begin(), maMenuItems.end(), AddRemoveEventListener(xListener, true));
+}
+
+void ScAccessibleFilterMenu::removeEventListener(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
+ throw (com::sun::star::uno::RuntimeException)
+{
+ ScAccessibleContextBase::removeEventListener(xListener);
+ for_each(maMenuItems.begin(), maMenuItems.end(), AddRemoveEventListener(xListener, false));
+}
+
+// XAccessibleSelection
+
+void ScAccessibleFilterMenu::selectAccessibleChild(sal_Int32 nChildIndex)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if (static_cast<size_t>(nChildIndex) >= maMenuItems.size())
+ throw IndexOutOfBoundsException();
+
+ mpWindow->setSelectedMenuItem(nChildIndex, false, true);
+}
+
+sal_Bool ScAccessibleFilterMenu::isAccessibleChildSelected(sal_Int32 nChildIndex)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if (static_cast<size_t>(nChildIndex) >= maMenuItems.size())
+ throw IndexOutOfBoundsException();
+
+ return mpWindow->isMenuItemSelected(static_cast<size_t>(nChildIndex));
+}
+
+void ScAccessibleFilterMenu::clearAccessibleSelection() throw (RuntimeException)
+{
+ mpWindow->clearSelectedMenuItem();
+}
+
+void ScAccessibleFilterMenu::selectAllAccessibleChildren() throw (RuntimeException)
+{
+ // not suported - this is a menu, you can't select all menu items.
+}
+
+sal_Int32 ScAccessibleFilterMenu::getSelectedAccessibleChildCount() throw (RuntimeException)
+{
+ // Since this is a menu, either one menu item is selected, or none at all.
+ return mpWindow->getSelectedMenuItem() == ScMenuFloatingWindow::MENU_NOT_SELECTED ? 0 : 1;
+}
+
+Reference<XAccessible> ScAccessibleFilterMenu::getSelectedAccessibleChild(sal_Int32 nChildIndex)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if (static_cast<size_t>(nChildIndex) >= maMenuItems.size())
+ throw IndexOutOfBoundsException();
+
+ return maMenuItems[nChildIndex];
+}
+
+void ScAccessibleFilterMenu::deselectAccessibleChild(sal_Int32 nChildIndex) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ if (static_cast<size_t>(nChildIndex) >= maMenuItems.size())
+ throw IndexOutOfBoundsException();
+
+ mpWindow->selectMenuItem(nChildIndex, false, false);
+}
+
+// XInterface
+
+uno::Any SAL_CALL ScAccessibleFilterMenu::queryInterface( uno::Type const & rType )
+ throw (RuntimeException)
+{
+ Any any = ScAccessibleContextBase::queryInterface(rType);
+ if (any.hasValue())
+ return any;
+
+ return ScAccessibleFilterMenu_BASE::queryInterface(rType);
+}
+
+void SAL_CALL ScAccessibleFilterMenu::acquire() throw ()
+{
+ ScAccessibleContextBase::acquire();
+}
+
+void SAL_CALL ScAccessibleFilterMenu::release() throw ()
+{
+ ScAccessibleContextBase::release();
+}
+
+// XTypeProvider
+
+Sequence<sal_Int8> ScAccessibleFilterMenu::getImplementationId()
+ throw (RuntimeException)
+{
+ Sequence<sal_Int8> aId(16);
+ return aId;
+}
+
+Rectangle ScAccessibleFilterMenu::GetBoundingBoxOnScreen() const
+ throw (RuntimeException)
+{
+ if (mnMenuPos == ScMenuFloatingWindow::MENU_NOT_SELECTED)
+ return Rectangle();
+
+ // Menu object's bounding box is the bounding box of the menu item that
+ // launches the menu, which belongs to the parent window.
+ ScMenuFloatingWindow* pParentWin = mpWindow->getParentMenuWindow();
+ if (!pParentWin)
+ return Rectangle();
+
+ if (!pParentWin->IsVisible())
+ return Rectangle();
+
+ Point aPos = pParentWin->OutputToAbsoluteScreenPixel(Point(0,0));
+ Point aMenuPos;
+ Size aMenuSize;
+ pParentWin->getMenuItemPosSize(mnMenuPos, aMenuPos, aMenuSize);
+ Rectangle aRect(aPos + aMenuPos, aMenuSize);
+ return aRect;
+}
+
+Rectangle ScAccessibleFilterMenu::GetBoundingBox() const
+ throw (RuntimeException)
+{
+ if (mnMenuPos == ScMenuFloatingWindow::MENU_NOT_SELECTED)
+ return Rectangle();
+
+ // Menu object's bounding box is the bounding box of the menu item that
+ // launches the menu, which belongs to the parent window.
+ ScMenuFloatingWindow* pParentWin = mpWindow->getParentMenuWindow();
+ if (!pParentWin)
+ return Rectangle();
+
+ if (!pParentWin->IsVisible())
+ return Rectangle();
+
+ Point aMenuPos;
+ Size aMenuSize;
+ pParentWin->getMenuItemPosSize(mnMenuPos, aMenuPos, aMenuSize);
+ Rectangle aRect(aMenuPos, aMenuSize);
+ return aRect;
+}
+
+void ScAccessibleFilterMenu::appendMenuItem(const OUString& rName, bool bEnabled, size_t nMenuPos)
+{
+ // Check weather this menu item is a sub menu or a regular menu item.
+ ScMenuFloatingWindow* pSubMenu = mpWindow->getSubMenuWindow(nMenuPos);
+ Reference<XAccessible> xAccessible;
+ if (pSubMenu)
+ {
+ xAccessible = pSubMenu->CreateAccessible();
+ ScAccessibleFilterMenu* p =
+ static_cast<ScAccessibleFilterMenu*>(xAccessible.get());
+ p->setEnabled(bEnabled);
+ p->setMenuPos(nMenuPos);
+ }
+ else
+ {
+ xAccessible.set(new ScAccessibleFilterMenuItem(this, mpWindow, rName, nMenuPos));
+ ScAccessibleFilterMenuItem* p =
+ static_cast<ScAccessibleFilterMenuItem*>(xAccessible.get());
+ p->setEnabled(bEnabled);
+ }
+ maMenuItems.push_back(xAccessible);
+}
+
+void ScAccessibleFilterMenu::setMenuPos(size_t nMenuPos)
+{
+ mnMenuPos = nMenuPos;
+}
+
+void ScAccessibleFilterMenu::setEnabled(bool bEnabled)
+{
+ mbEnabled = bEnabled;
+}
+
+sal_Int32 ScAccessibleFilterMenu::getMenuItemCount() const
+{
+ return maMenuItems.size();
+}
+
+bool ScAccessibleFilterMenu::isSelected() const
+{
+ // Check to see if any of the child menu items is selected.
+ return mpWindow->isMenuItemSelected(mnMenuPos);
+}
+
+bool ScAccessibleFilterMenu::isFocused() const
+{
+ return isSelected();
+}
+
+void ScAccessibleFilterMenu::updateStates()
+{
+ if (!mxStateSet.is())
+ mxStateSet.set(new ScAccessibleStateSet);
+
+ ScAccessibleStateSet* p = static_cast<ScAccessibleStateSet*>(
+ mxStateSet.get());
+
+ p->clear();
+
+ p->insert(ENABLED);
+ p->insert(FOCUSABLE);
+ p->insert(SELECTABLE);
+ p->insert(SENSITIVE);
+ p->insert(OPAQUE);
+
+ if (isFocused())
+ p->insert(FOCUSED);
+
+ if (isSelected())
+ p->insert(SELECTED);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleFilterMenuItem.cxx b/sc/source/ui/Accessibility/AccessibleFilterMenuItem.cxx
new file mode 100644
index 000000000000..bff9ad5bd88e
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleFilterMenuItem.cxx
@@ -0,0 +1,207 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+
+#include "precompiled_sc.hxx"
+#include "AccessibleGlobal.hxx"
+#include "AccessibleFilterMenuItem.hxx"
+#include "dpcontrol.hxx"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/TextSegment.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::accessibility::AccessibleStateType;
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::uno::RuntimeException;
+using ::rtl::OUString;
+
+ScAccessibleFilterMenuItem::ScAccessibleFilterMenuItem(
+ const Reference<XAccessible>& rxParent, ScMenuFloatingWindow* pWin, const OUString& rName, size_t nMenuPos) :
+ ScAccessibleContextBase(rxParent, AccessibleRole::MENU_ITEM),
+ mpWindow(pWin),
+ maName(rName),
+ mnMenuPos(nMenuPos),
+ mbEnabled(true)
+{
+ SetName(rName);
+}
+
+ScAccessibleFilterMenuItem::~ScAccessibleFilterMenuItem()
+{
+}
+
+sal_Int32 ScAccessibleFilterMenuItem::getAccessibleChildCount()
+ throw (RuntimeException)
+{
+ return 0;
+}
+
+Reference<XAccessible> ScAccessibleFilterMenuItem::getAccessibleChild(sal_Int32 /*nIndex*/)
+ throw (RuntimeException, IndexOutOfBoundsException)
+{
+ throw IndexOutOfBoundsException();
+}
+
+Reference<XAccessibleStateSet> ScAccessibleFilterMenuItem::getAccessibleStateSet()
+ throw (RuntimeException)
+{
+ updateStateSet();
+ return mxStateSet;
+}
+
+OUString ScAccessibleFilterMenuItem::getImplementationName()
+ throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessibleFilterMenuItem"));
+}
+
+// XAccessibleAction
+
+sal_Int32 ScAccessibleFilterMenuItem::getAccessibleActionCount() throw (RuntimeException)
+{
+ return 1;
+}
+
+sal_Bool ScAccessibleFilterMenuItem::doAccessibleAction(sal_Int32 /*nIndex*/)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ mpWindow->executeMenuItem(mnMenuPos);
+ return true;
+}
+
+OUString ScAccessibleFilterMenuItem::getAccessibleActionDescription(sal_Int32 /*nIndex*/)
+ throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("click"));
+}
+
+Reference<XAccessibleKeyBinding> ScAccessibleFilterMenuItem::getAccessibleActionKeyBinding(
+ sal_Int32 /*nIndex*/) throw (IndexOutOfBoundsException, RuntimeException)
+{
+ return Reference<XAccessibleKeyBinding>();
+}
+
+Any SAL_CALL ScAccessibleFilterMenuItem::queryInterface( uno::Type const & rType )
+ throw (RuntimeException)
+{
+ Any any = ScAccessibleContextBase::queryInterface(rType);
+ if (any.hasValue())
+ return any;
+
+ return ScAccessibleFilterMenuItem_BASE::queryInterface(rType);
+}
+
+void SAL_CALL ScAccessibleFilterMenuItem::acquire() throw ()
+{
+ ScAccessibleContextBase::acquire();
+}
+
+void SAL_CALL ScAccessibleFilterMenuItem::release() throw ()
+{
+ ScAccessibleContextBase::release();
+}
+
+bool ScAccessibleFilterMenuItem::isSelected() const
+{
+ return mpWindow->isMenuItemSelected(mnMenuPos);
+}
+
+bool ScAccessibleFilterMenuItem::isFocused() const
+{
+ return isSelected();
+}
+
+void ScAccessibleFilterMenuItem::setEnabled(bool bEnabled)
+{
+ mbEnabled = bEnabled;
+}
+
+Rectangle ScAccessibleFilterMenuItem::GetBoundingBoxOnScreen() const
+ throw (RuntimeException)
+{
+ if (!mpWindow->IsVisible())
+ return Rectangle();
+
+ Point aPos = mpWindow->OutputToAbsoluteScreenPixel(Point(0,0));
+ Point aMenuPos;
+ Size aMenuSize;
+ mpWindow->getMenuItemPosSize(mnMenuPos, aMenuPos, aMenuSize);
+ Rectangle aRect(aPos + aMenuPos, aMenuSize);
+ return aRect;
+}
+
+Rectangle ScAccessibleFilterMenuItem::GetBoundingBox() const
+ throw (RuntimeException)
+{
+ if (!mpWindow->IsVisible())
+ return Rectangle();
+
+ Point aMenuPos;
+ Size aMenuSize;
+ mpWindow->getMenuItemPosSize(mnMenuPos, aMenuPos, aMenuSize);
+ Rectangle aRect(aMenuPos, aMenuSize);
+ return aRect;
+}
+
+void ScAccessibleFilterMenuItem::updateStateSet()
+{
+ if (!mxStateSet.is())
+ mxStateSet.set(new ScAccessibleStateSet);
+
+ ScAccessibleStateSet* p = static_cast<ScAccessibleStateSet*>(
+ mxStateSet.get());
+
+ p->clear();
+
+ p->insert(ENABLED);
+ p->insert(FOCUSABLE);
+ p->insert(SELECTABLE);
+ p->insert(SENSITIVE);
+ p->insert(OPAQUE);
+
+ if (isFocused())
+ p->insert(FOCUSED);
+
+ if (isSelected())
+ p->insert(SELECTED);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleFilterTopWindow.cxx b/sc/source/ui/Accessibility/AccessibleFilterTopWindow.cxx
new file mode 100644
index 000000000000..4e28e8bbb7cf
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleFilterTopWindow.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+
+#include "precompiled_sc.hxx"
+#include "AccessibleFilterTopWindow.hxx"
+#include "AccessibleFilterMenu.hxx"
+#include "dpcontrol.hxx"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
+using ::rtl::OUString;
+
+ScAccessibleFilterTopWindow::ScAccessibleFilterTopWindow(
+ const Reference<XAccessible>& rxParent, ScDPFieldPopupWindow* pWin, const OUString& rName, ScDocument* pDoc) :
+ ScAccessibleFilterMenu(rxParent, pWin, rName, ScMenuFloatingWindow::MENU_NOT_SELECTED, pDoc),
+ mpWindow(pWin),
+ mpDoc(pDoc)
+{
+ SetName(rName);
+}
+
+ScAccessibleFilterTopWindow::~ScAccessibleFilterTopWindow()
+{
+}
+
+// XAccessibleContext
+
+sal_Int32 ScAccessibleFilterTopWindow::getAccessibleChildCount() throw (RuntimeException)
+{
+ sal_Int32 nMenuCount = getMenuItemCount();
+ return nMenuCount + 6;
+}
+
+Reference<XAccessible> ScAccessibleFilterTopWindow::getAccessibleChild(
+ sal_Int32 nIndex) throw (RuntimeException, IndexOutOfBoundsException)
+{
+ if (nIndex >= getAccessibleChildCount())
+ throw IndexOutOfBoundsException();
+
+ sal_Int32 nMenuCount = getMenuItemCount();
+ if (nIndex < nMenuCount)
+ return ScAccessibleFilterMenu::getAccessibleChild(nIndex);
+
+ nIndex -= nMenuCount;
+ switch (nIndex)
+ {
+ case 0:
+ return mxAccListBox;
+ case 1:
+ return mxAccToggleAll;
+ case 2:
+ return mxAccSingleOnBtn;
+ case 3:
+ return mxAccSingleOffBtn;
+ case 4:
+ return mxAccOkBtn;
+ case 5:
+ return mxAccCancelBtn;
+ default:
+ ;
+ }
+
+ return Reference<XAccessible>();
+}
+
+OUString ScAccessibleFilterTopWindow::getImplementationName() throw (RuntimeException)
+{
+ return OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessibleFilterTopWindow"));
+}
+
+void ScAccessibleFilterTopWindow::setAccessibleChild(
+ const Reference<XAccessible>& rAccessible, ChildControlType eType)
+{
+ switch (eType)
+ {
+ case LISTBOX:
+ mxAccListBox = rAccessible;
+ break;
+ case TOGGLE_ALL:
+ mxAccToggleAll = rAccessible;
+ break;
+ case SINGLE_ON_BTN:
+ mxAccSingleOnBtn = rAccessible;
+ break;
+ case SINGLE_OFF_BTN:
+ mxAccSingleOffBtn = rAccessible;
+ break;
+ case OK_BTN:
+ mxAccOkBtn = rAccessible;
+ break;
+ case CANCEL_BTN:
+ mxAccCancelBtn = rAccessible;
+ break;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessibleGlobal.cxx b/sc/source/ui/Accessibility/AccessibleGlobal.cxx
new file mode 100644
index 000000000000..2ddc53694c89
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessibleGlobal.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+
+#include "precompiled_sc.hxx"
+#include "AccessibleGlobal.hxx"
+
+using ::com::sun::star::uno::RuntimeException;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::std::set;
+
+ScAccessibleStateSet::ScAccessibleStateSet()
+{
+}
+
+ScAccessibleStateSet::~ScAccessibleStateSet()
+{
+}
+
+// XAccessibleStateSet
+
+sal_Bool SAL_CALL ScAccessibleStateSet::isEmpty() throw (RuntimeException)
+{
+ return maStates.empty();
+}
+
+sal_Bool SAL_CALL ScAccessibleStateSet::contains(sal_Int16 nState)
+ throw (RuntimeException)
+{
+ return maStates.count(nState) != 0;
+}
+
+sal_Bool SAL_CALL ScAccessibleStateSet::containsAll(
+ const Sequence<sal_Int16>& aStateSet) throw (RuntimeException)
+{
+ sal_Int32 n = aStateSet.getLength();
+ for (sal_Int32 i = 0; i < n; ++i)
+ {
+ if (!maStates.count(aStateSet[i]))
+ // This state is not set.
+ return false;
+ }
+ // All specified states are set.
+ return true;
+}
+
+Sequence<sal_Int16> SAL_CALL ScAccessibleStateSet::getStates()
+ throw (RuntimeException)
+{
+ Sequence<sal_Int16> aSeq(0);
+ set<sal_Int16>::const_iterator itr = maStates.begin(), itrEnd = maStates.end();
+ for (size_t i = 0; itr != itrEnd; ++itr, ++i)
+ {
+ aSeq.realloc(i+1);
+ aSeq[i] = *itr;
+ }
+ return aSeq;
+}
+
+void ScAccessibleStateSet::insert(sal_Int16 nState)
+{
+ maStates.insert(nState);
+}
+
+void ScAccessibleStateSet::clear()
+{
+ maStates.clear();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/Accessibility/AccessiblePageHeader.cxx b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
new file mode 100644
index 000000000000..20e50119d680
--- /dev/null
+++ b/sc/source/ui/Accessibility/AccessiblePageHeader.cxx
@@ -0,0 +1,442 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sc.hxx"
+
+#include "AccessiblePageHeader.hxx"
+#include "AccessiblePageHeaderArea.hxx"
+#include "AccessibilityHints.hxx"
+#include "prevwsh.hxx"
+#include "miscuno.hxx"
+#include "prevloc.hxx"
+#include "document.hxx"
+#include "stlpool.hxx"
+#include "scitems.hxx"
+#include "attrib.hxx"
+#include "scresid.hxx"
+#include "sc.hrc"
+
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+
+#include <vcl/window.hxx>
+#include <svl/smplhint.hxx>
+#include <vcl/svapp.hxx>
+#include <unotools/accessiblestatesethelper.hxx>
+#include <svl/style.hxx>
+#include <svl/itempool.hxx>
+#include <editeng/editobj.hxx>
+#include <toolkit/helper/convert.hxx>
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::accessibility;
+
+const sal_uInt8 MAX_AREAS = 3;
+
+//===== internal ============================================================
+struct Acquire
+{
+ void operator() (ScAccessiblePageHeaderArea* pArea)
+ {
+ if (pArea)
+ pArea->acquire();
+ }
+};
+
+struct Release
+{
+ void operator() (ScAccessiblePageHeaderArea*& pArea)
+ {
+ if (pArea)
+ pArea->release();
+ }
+};
+
+struct Dispose
+{
+ void operator() (ScAccessiblePageHeaderArea*& pArea)
+ {
+ if (pArea)
+ {
+ pArea->dispose();
+ pArea->release();
+ }
+ pArea = NULL;
+ }
+};
+
+ScAccessiblePageHeader::ScAccessiblePageHeader( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::accessibility::XAccessible>& rxParent,
+ ScPreviewShell* pViewShell, sal_Bool bHeader, sal_Int32 nIndex ) :
+ScAccessibleContextBase( rxParent, bHeader ? AccessibleRole::HEADER : AccessibleRole::FOOTER ),
+ mpViewShell( pViewShell ),
+ mnIndex( nIndex ),
+ mbHeader( bHeader ),
+ maAreas(MAX_AREAS, NULL),
+ mnChildCount(-1)
+{
+ if (mpViewShell)
+ mpViewShell->AddAccessibilityObject(*this);
+}
+
+ScAccessiblePageHeader::~ScAccessiblePageHeader()
+{
+ if (!ScAccessibleContextBase::IsDefunc() && !rBHelper.bInDispose)
+ {
+ // increment refcount to prevent double call off dtor
+ osl_incrementInterlockedCount( &m_refCount );
+ dispose();
+ }
+}
+
+void SAL_CALL ScAccessiblePageHeader::disposing()
+{
+ SolarMutexGuard aGuard;
+ if (mpViewShell)
+ {
+ mpViewShell->RemoveAccessibilityObject(*this);
+ mpViewShell = NULL;
+ }
+ std::for_each(maAreas.begin(), maAreas.end(), Dispose());
+
+ ScAccessibleContextBase::disposing();
+}
+
+//===== SfxListener =====================================================
+
+void ScAccessiblePageHeader::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_DATACHANGED))
+ {
+ ScHFAreas aOldAreas(maAreas);
+ std::for_each(aOldAreas.begin(), aOldAreas.end(), Acquire());
+ mnChildCount = -1;
+ getAccessibleChildCount();
+ for (sal_uInt8 i = 0; i < MAX_AREAS; ++i)
+ {
+ if ((aOldAreas[i] && maAreas[i] && !ScGlobal::EETextObjEqual(aOldAreas[i]->GetEditTextObject(), maAreas[i]->GetEditTextObject())) ||
+ (aOldAreas[i] && !maAreas[i]) || (!aOldAreas[i] && maAreas[i]))
+ {
+ if (aOldAreas[i] && aOldAreas[i]->GetEditTextObject())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.OldValue = uno::makeAny(uno::Reference<XAccessible>(aOldAreas[i]));
+
+ CommitChange(aEvent); // child gone - event
+ aOldAreas[i]->dispose();
+ }
+ if (maAreas[i] && maAreas[i]->GetEditTextObject())
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CHILD;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ aEvent.NewValue = uno::makeAny(uno::Reference<XAccessible>(maAreas[i]));
+
+ CommitChange(aEvent); // new child - event
+ }
+ }
+ }
+ std::for_each(aOldAreas.begin(), aOldAreas.end(), Release());
+ }
+ else if (rRef.GetId() == SC_HINT_ACC_VISAREACHANGED)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::VISIBLE_DATA_CHANGED;
+ aEvent.Source = uno::Reference< XAccessibleContext >(this);
+ CommitChange(aEvent);
+ }
+ }
+
+ ScAccessibleContextBase::Notify(rBC, rHint);
+}
+
+//===== XAccessibleComponent ============================================
+
+uno::Reference< XAccessible > SAL_CALL ScAccessiblePageHeader::getAccessibleAtPoint( const awt::Point& aPoint )
+ throw (uno::RuntimeException)
+{
+ uno::Reference<XAccessible> xRet;
+
+ if (containsPoint(aPoint))
+ {
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ sal_Int32 nCount(getAccessibleChildCount()); // fill the areas
+
+ if (nCount)
+ {
+ // return the first with content, because they have all the same Bounding Box
+ sal_uInt8 i(0);
+ while(!xRet.is() && i < MAX_AREAS)
+ {
+ if (maAreas[i])
+ xRet = maAreas[i];
+ else
+ ++i;
+ }
+ }
+ }
+
+ return xRet;
+}
+
+void SAL_CALL ScAccessiblePageHeader::grabFocus() throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleComponent> xAccessibleComponent(getAccessibleParent()->getAccessibleContext(), uno::UNO_QUERY);
+ if (xAccessibleComponent.is())
+ xAccessibleComponent->grabFocus();
+ }
+}
+
+//===== XAccessibleContext ==============================================
+
+sal_Int32 SAL_CALL ScAccessiblePageHeader::getAccessibleChildCount() throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ if((mnChildCount < 0) && mpViewShell)
+ {
+ mnChildCount = 0;
+ ScDocument* pDoc = mpViewShell->GetDocument();
+ if (pDoc)
+ {
+ // find out how many regions (left,center, right) are with content
+
+ SfxStyleSheetBase* pStyle = pDoc->GetStyleSheetPool()->Find(pDoc->GetPageStyle(mpViewShell->GetLocationData().GetPrintTab()), SFX_STYLE_FAMILY_PAGE);
+ if (pStyle)
+ {
+ sal_uInt16 nPageWhichId(0);
+ if (mbHeader)
+ nPageWhichId = mpViewShell->GetLocationData().IsHeaderLeft() ? ATTR_PAGE_HEADERLEFT : ATTR_PAGE_HEADERRIGHT;
+ else
+ nPageWhichId = mpViewShell->GetLocationData().IsFooterLeft() ? ATTR_PAGE_FOOTERLEFT : ATTR_PAGE_FOOTERRIGHT;
+
+ const ScPageHFItem& rPageItem = static_cast<const ScPageHFItem&>(pStyle->GetItemSet().Get(nPageWhichId));
+ AddChild(rPageItem.GetLeftArea(), 0, SVX_ADJUST_LEFT);
+ AddChild(rPageItem.GetCenterArea(), 1, SVX_ADJUST_CENTER);
+ AddChild(rPageItem.GetRightArea(), 2, SVX_ADJUST_RIGHT);
+ }
+ }
+ }
+
+ return mnChildCount;
+}
+
+uno::Reference< XAccessible > SAL_CALL ScAccessiblePageHeader::getAccessibleChild( sal_Int32 nIndex )
+ throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ IsObjectValid();
+
+ uno::Reference<XAccessible> xRet;
+
+ if(mnChildCount < 0)
+ getAccessibleChildCount();
+
+ ScHFAreas::iterator aItr = maAreas.begin();
+ ScHFAreas::iterator aEndItr = maAreas.end();
+ while (!xRet.is() && (nIndex >= 0) && (aItr != aEndItr))
+ {
+ if (*aItr)
+ {
+ if (nIndex == 0)
+ xRet = *aItr;
+ else
+ --nIndex;
+ }
+ else
+ ++aItr;
+ }
+
+ if ( !xRet.is() )
+ throw lang::IndexOutOfBoundsException();
+
+ return xRet;
+}
+
+sal_Int32 SAL_CALL ScAccessiblePageHeader::getAccessibleIndexInParent() throw (uno::RuntimeException)
+{
+ return mnIndex;
+}
+
+uno::Reference< XAccessibleStateSet > SAL_CALL ScAccessiblePageHeader::getAccessibleStateSet()
+ throw (uno::RuntimeException)
+{
+ SolarMutexGuard aGuard;
+ uno::Reference<XAccessibleStateSet> xParentStates;
+ if (getAccessibleParent().is())
+ {
+ uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+ xParentStates = xParentContext->getAccessibleStateSet();
+ }
+ utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
+ if (IsDefunc(xParentStates))
+ pStateSet->AddState(AccessibleStateType::DEFUNC);
+ else
+ {
+ pStateSet->AddState(AccessibleStateType::ENABLED);
+ pStateSet->AddState(AccessibleStateType::OPAQUE);
+ if (isShowing())
+ pStateSet->AddState(AccessibleStateType::SHOWING);
+ if (isVisible())
+ pStateSet->AddState(AccessibleStateType::VISIBLE);
+ }
+ return pStateSet;
+}
+
+//===== XServiceInfo ====================================================
+
+rtl::OUString SAL_CALL ScAccessiblePageHeader::getImplementationName() throw(uno::RuntimeException)
+{
+ return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScAccessiblePageHeader"));
+}
+
+uno::Sequence<rtl::OUString> SAL_CALL ScAccessiblePageHeader::getSupportedServiceNames()
+ throw(uno::RuntimeException)
+{
+ uno::Sequence< ::rtl::OUString > aSequence = ScAccessibleContextBase::getSupportedServiceNames();
+ sal_Int32 nOldSize(aSequence.getLength());
+ aSequence.realloc(nOldSize + 1);
+ ::rtl::OUString* pNames = aSequence.getArray();
+
+ pNames[nOldSize] = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.AccessibleHeaderFooterView"));
+
+ return aSequence;
+}
+
+//==== internal =========================================================
+
+::rtl::OUString SAL_CALL ScAccessiblePageHeader::createAccessibleDescription(void)
+ throw (uno::RuntimeException)
+{
+ String sDesc(ScResId(mbHeader ? STR_ACC_HEADER_DESCR : STR_ACC_FOOTER_DESCR));
+ sDesc.SearchAndReplaceAscii("%1", String(ScResId(SCSTR_UNKNOWN)));
+ return rtl::OUString( sDesc );
+}
+
+::rtl::OUString SAL_CALL ScAccessiblePageHeader::createAccessibleName(void)
+ throw (uno::RuntimeException)
+{
+ String sName(ScResId(mbHeader ? STR_ACC_HEADER_NAME : STR_ACC_FOOTER_NAME));
+ sName.SearchAndReplaceAscii("%1", String(ScResId(SCSTR_UNKNOWN)));
+ return rtl::OUString( sName );
+}
+
+Rectangle ScAccessiblePageHeader::GetBoundingBoxOnScreen() const throw (uno::RuntimeException)
+{
+ Rectangle aCellRect(GetBoundingBox());
+ if (mpViewShell)
+ {
+ Window* pWindow = mpViewShell->GetWindow();
+ if (pWindow)
+ {
+ Rectangle aRect = pWindow->GetWindowExtentsRelative(NULL);
+ aCellRect.setX(aCellRect.getX() + aRect.getX());
+ aCellRect.setY(aCellRect.getY() + aRect.getY());
+ }
+ }
+ return aCellRect;
+}
+
+Rectangle ScAccessiblePageHeader::GetBoundingBox() const throw (uno::RuntimeException)
+{
+ Rectangle aRect;
+ if (mpViewShell)
+ {
+ const ScPreviewLocationData& rData = mpViewShell->GetLocationData();
+ if ( mbHeader )
+ rData.GetHeaderPosition( aRect );
+ else
+ rData.GetFooterPosition( aRect );
+
+ // the Rectangle could contain negative coordinates so it should be cliped
+ Rectangle aClipRect(Point(0, 0), aRect.GetSize());
+ Window* pWindow = mpViewShell->GetWindow();
+ if (pWindow)
+ aClipRect = pWindow->GetWindowExtentsRelative(pWindow->GetAccessibleParentWindow());
+ aRect = aClipRect.GetIntersection(aRect);
+ }
+ if (aRect.IsEmpty())
+ aRect.SetSize(Size(-1, -1));
+
+ return aRect;
+}
+
+sal_Bool ScAccessiblePageHeader::IsDefunc( const uno::Reference<XAccessibleStateSet>& rxParentStates )
+{
+ return ScAccessibleContextBase::IsDefunc() || (mpViewShell == NULL) || !getAccessibleParent().is() ||
+ (rxParentStates.is() && rxParentStates->contains(AccessibleStateType::DEFUNC));
+}
+
+void ScAccessiblePageHeader::AddChild(const EditTextObject* pArea, sal_uInt32 nIndex, SvxAdjust eAdjust)
+{
+ if (pArea && (pArea->GetText(0).Len() || (pArea->GetParagraphCount() > 1)))
+ {
+ if (maAreas[nIndex])
+ {